Fixed IsInWater acting strangely
This commit is contained in:
@@ -175,11 +175,11 @@
|
|||||||
<StatusEffect type="OnUse" target="Character" Health="-5.0" disabledeltatime="true">
|
<StatusEffect type="OnUse" target="Character" Health="-5.0" disabledeltatime="true">
|
||||||
<RequiredItem name="Medical Syringe" type="Container"/>
|
<RequiredItem name="Medical Syringe" type="Container"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
<!-- InWater is horribly broken right now. https://github.com/Regalis11/Barotrauma/issues/187
|
<!-- InWater is horribly broken right now. https://github.com/Regalis11/Barotrauma/issues/187 -->
|
||||||
<StatusEffect type="InWater" target="This" Condition="0.0" setvalue="true">
|
<StatusEffect type="InWater" target="This" Condition="0.0" setvalue="true">
|
||||||
<Sound file="Content/Items/Reactor/explosion.ogg"/>
|
<Sound file="Content/Items/Reactor/explosion.ogg"/>
|
||||||
<Explosion range="250.0" structuredamage="10" damage="20" stun="5" force="5.0"/>
|
<Explosion range="250.0" structuredamage="10" damage="20" stun="5" force="5.0"/>
|
||||||
</StatusEffect> -->
|
</StatusEffect>
|
||||||
</Throwable>
|
</Throwable>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@
|
|||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
<!-- Here's a problem: if a chemical with delay is injected into more than one person, only the last person will get that delayed effect.
|
<!-- Here's a problem: if a chemical with delay is injected into more than one person, only the last person will get that delayed effect.
|
||||||
Everyone else gets off scott free! Woo!!!..... -->
|
Everyone else gets off scott free! Woo!!!..... -->
|
||||||
<StatusEffect type="OnUse" target="Character" Oxygen="-15.0" Health="-1.0" duration="60.0" delay="20.0">
|
<StatusEffect type="OnUse" target="Character" Oxygen="-20.0" Health="-1.0" duration="60.0" delay="20.0">
|
||||||
<RequiredItem name="Medical Syringe" type="Container"/>
|
<RequiredItem name="Medical Syringe" type="Container"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Throwable>
|
</Throwable>
|
||||||
|
|||||||
@@ -777,11 +777,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool IsInWater()
|
private bool IsInWater()
|
||||||
{
|
{
|
||||||
|
if (parentInventory != null && parentInventory.Owner != null)
|
||||||
|
FindHull();
|
||||||
if (CurrentHull == null) return true;
|
if (CurrentHull == null) return true;
|
||||||
|
|
||||||
float surfaceY = CurrentHull.Surface;
|
float surfaceY = CurrentHull.Surface;
|
||||||
|
|
||||||
return Position.Y < surfaceY;
|
return CurrentHull.WaterVolume > 0.0f && Position.Y < surfaceY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -826,11 +828,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inWater = IsInWater();
|
if (body != null && body.Enabled)
|
||||||
if (inWater) ApplyStatusEffects(ActionType.InWater, deltaTime);
|
{
|
||||||
|
|
||||||
if (body == null || !body.Enabled) return;
|
|
||||||
|
|
||||||
System.Diagnostics.Debug.Assert(body.FarseerBody.FixtureList != null);
|
System.Diagnostics.Debug.Assert(body.FarseerBody.FixtureList != null);
|
||||||
|
|
||||||
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f)
|
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f)
|
||||||
@@ -861,8 +860,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateNetPosition();
|
UpdateNetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
if (!inWater || ParentInventory != null) return;
|
inWater = IsInWater();
|
||||||
|
|
||||||
|
if (inWater) ApplyStatusEffects(ActionType.InWater, deltaTime);
|
||||||
|
|
||||||
|
if (body == null || !body.Enabled || !inWater || ParentInventory != null) return;
|
||||||
|
|
||||||
ApplyWaterForces();
|
ApplyWaterForces();
|
||||||
CurrentHull?.ApplyFlowForces(deltaTime, this);
|
CurrentHull?.ApplyFlowForces(deltaTime, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user