From 443d19901779f1fa02e63f88ec20caf8be8ddcd2 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 8 Apr 2019 23:12:09 +0300 Subject: [PATCH] (cd7359bb3) StatusEffects can modify item sound and sight ranges (requires an AITarget) --- .../BarotraumaShared/Source/Items/Item.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index cf37c8e41..ff324aca2 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -235,6 +235,26 @@ namespace Barotrauma set { /*do nothing*/ } } + [Serialize(0.0f, false)] + /// + /// Can be used by status effects or conditionals to modify the sound range + /// + public float SoundRange + { + get { return aiTarget == null ? 0.0f : aiTarget.SoundRange; } + set { if (aiTarget != null) { aiTarget.SoundRange = Math.Max(0.0f, value); } } + } + + [Serialize(0.0f, false)] + /// + /// Can be used by status effects or conditionals to modify the sound range + /// + public float SightRange + { + get { return aiTarget == null ? 0.0f : aiTarget.SightRange; } + set { if (aiTarget != null) { aiTarget.SightRange = Math.Max(0.0f, value); } } + } + /// /// Should the item's Use method be called with the "Use" or with the "Shoot" key? ///