diff --git a/Barotrauma/BarotraumaShared/Content/Items/Containers/containers.xml b/Barotrauma/BarotraumaShared/Content/Items/Containers/containers.xml index 2d754d99f..0a826eb83 100644 --- a/Barotrauma/BarotraumaShared/Content/Items/Containers/containers.xml +++ b/Barotrauma/BarotraumaShared/Content/Items/Containers/containers.xml @@ -26,7 +26,8 @@ + pickdistance="150" + waterproof="true"> @@ -37,9 +38,10 @@ + name="Toxic Cabinet" + linkable="true" + pickdistance="150" + waterproof="true"> @@ -52,7 +54,7 @@ + pickdistance="150"> @@ -74,7 +76,7 @@ + pickdistance="150"> diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index 6fabcf24b..a037b0c81 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -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; diff --git a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs index 856cee705..84c1a467c 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs @@ -122,6 +122,13 @@ namespace Barotrauma private set; } + [Serialize(false, false)] + public bool WaterProof + { + get; + private set; + } + [Serialize(0.0f, false)] public float ImpactTolerance {