- changes to the logic for distributing oxygen through vents: the oxygen generator pushes more oxygen to larger rooms

- bugfixes in HumanoidAnimController.Flip()
- item/itemcomponent statuseffects are stored in a dictionary with the actiontype as a key, so the item doesn't have to iterate over all the components and all their statuseffects
- gap bubble particle tweaking
This commit is contained in:
Regalis
2016-03-29 17:57:05 +03:00
parent 23f1623562
commit 3ac8139fc7
10 changed files with 129 additions and 62 deletions
@@ -18,6 +18,8 @@ namespace Barotrauma.Items.Components
List<Vent> ventList;
private float totalHullVolume;
public bool IsRunning()
{
return (running && item.Condition>0.0f);
@@ -98,18 +100,27 @@ namespace Barotrauma.Items.Components
if (linkedItem == null) continue;
Vent vent = linkedItem.GetComponent<Vent>();
if (vent != null) ventList.Add(vent);
if (vent == null) continue;
ventList.Add(vent);
if (linkedItem.CurrentHull!=null) totalHullVolume += linkedItem.CurrentHull.FullVolume;
}
}
public override void OnMapLoaded()
{
GetVents();
}
private void UpdateVents(float deltaOxygen)
{
if (!ventList.Any()) return;
if (!ventList.Any() || totalHullVolume == 0.0f) return;
deltaOxygen = deltaOxygen / ventList.Count;
foreach (Vent v in ventList)
{
v.OxygenFlow = deltaOxygen;
if (v.Item.CurrentHull == null) continue;
v.OxygenFlow = deltaOxygen * (v.Item.CurrentHull.FullVolume / totalHullVolume);
v.IsActive = true;
}
}