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

View File

@@ -26,7 +26,8 @@
<Item
name="Medicine Cabinet"
linkable="true"
pickdistance ="150">
pickdistance="150"
waterproof="true">
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64" canflipx="false"/>
@@ -37,9 +38,10 @@
</Item>
<Item
name="Toxic Cabinet"
linkable="true"
pickdistance ="150">
name="Toxic Cabinet"
linkable="true"
pickdistance="150"
waterproof="true">
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64" canflipx="false"/>
@@ -52,7 +54,7 @@
<Item
name="Metal Crate"
linkable="true"
pickdistance ="150">
pickdistance="150">
<Deconstruct time="20">
<Item name="Steel Bar"/>
@@ -74,7 +76,7 @@
<Item
name="Explosive Crate"
linkable="true"
pickdistance ="150">
pickdistance="150">
<Deconstruct time="20">
<Item name="Steel Bar"/>

View File

@@ -252,6 +252,11 @@ namespace Barotrauma
get { return prefab.FireProof; }
}
public bool WaterProof
{
get { return prefab.WaterProof; }
}
public bool CanUseOnSelf
{
get { return prefab.CanUseOnSelf; }
@@ -662,7 +667,6 @@ namespace Barotrauma
if (Container == null) return null;
Item rootContainer = Container;
while (rootContainer.Container != null)
{
rootContainer = rootContainer.Container;
@@ -882,8 +886,17 @@ namespace Barotrauma
}
inWater = IsInWater();
if (inWater) ApplyStatusEffects(ActionType.InWater, deltaTime);
if (inWater)
{
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;

View File

@@ -122,6 +122,13 @@ namespace Barotrauma
private set;
}
[Serialize(false, false)]
public bool WaterProof
{
get;
private set;
}
[Serialize(0.0f, false)]
public float ImpactTolerance
{