Made medical & toxic cabinets waterproof. Closes #578

This commit is contained in:
Joonas Rikkonen
2018-08-06 14:08:00 +03:00
parent fa65372715
commit c463baed44
3 changed files with 31 additions and 9 deletions
@@ -26,7 +26,8 @@
<Item <Item
name="Medicine Cabinet" name="Medicine Cabinet"
linkable="true" linkable="true"
pickdistance ="150"> pickdistance="150"
waterproof="true">
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64" canflipx="false"/> <Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64" canflipx="false"/>
@@ -37,9 +38,10 @@
</Item> </Item>
<Item <Item
name="Toxic Cabinet" name="Toxic Cabinet"
linkable="true" linkable="true"
pickdistance ="150"> pickdistance="150"
waterproof="true">
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64" canflipx="false"/> <Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64" canflipx="false"/>
@@ -52,7 +54,7 @@
<Item <Item
name="Metal Crate" name="Metal Crate"
linkable="true" linkable="true"
pickdistance ="150"> pickdistance="150">
<Deconstruct time="20"> <Deconstruct time="20">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
@@ -74,7 +76,7 @@
<Item <Item
name="Explosive Crate" name="Explosive Crate"
linkable="true" linkable="true"
pickdistance ="150"> pickdistance="150">
<Deconstruct time="20"> <Deconstruct time="20">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
@@ -252,6 +252,11 @@ namespace Barotrauma
get { return prefab.FireProof; } get { return prefab.FireProof; }
} }
public bool WaterProof
{
get { return prefab.WaterProof; }
}
public bool CanUseOnSelf public bool CanUseOnSelf
{ {
get { return prefab.CanUseOnSelf; } get { return prefab.CanUseOnSelf; }
@@ -662,7 +667,6 @@ namespace Barotrauma
if (Container == null) return null; if (Container == null) return null;
Item rootContainer = Container; Item rootContainer = Container;
while (rootContainer.Container != null) while (rootContainer.Container != null)
{ {
rootContainer = rootContainer.Container; rootContainer = rootContainer.Container;
@@ -882,8 +886,17 @@ namespace Barotrauma
} }
inWater = IsInWater(); inWater = IsInWater();
if (inWater)
if (inWater) ApplyStatusEffects(ActionType.InWater, deltaTime); {
bool waterProof = WaterProof;
Item container = this.Container;
while (!waterProof && container != null)
{
waterProof = container.WaterProof;
container = container.Container;
}
if (!waterProof) ApplyStatusEffects(ActionType.InWater, deltaTime);
}
if (body == null || !body.Enabled || !inWater || ParentInventory != null) return; if (body == null || !body.Enabled || !inWater || ParentInventory != null) return;
@@ -122,6 +122,13 @@ namespace Barotrauma
private set; private set;
} }
[Serialize(false, false)]
public bool WaterProof
{
get;
private set;
}
[Serialize(0.0f, false)] [Serialize(0.0f, false)]
public float ImpactTolerance public float ImpactTolerance
{ {