Fixed explosives being directly usable by characters, causing them to explode when left clicking while holding them due to 9dd9425c. See #385

This commit is contained in:
Joonas Rikkonen
2018-04-24 18:00:23 +03:00
parent 1f460c401e
commit 91d6c7b91f
10 changed files with 25 additions and 27 deletions
@@ -28,7 +28,7 @@ namespace Barotrauma.Items.Components
public override bool Use(float deltaTime, Character character = null)
{
return true; //We do the actual throwing in Aim because Use might be used by chems
return characterUsable || character == null; //We do the actual throwing in Aim because Use might be used by chems
}
public override bool SecondaryUse(float deltaTime, Character character = null)
@@ -141,6 +141,14 @@ namespace Barotrauma.Items.Components
get { return removeOnCombined; }
set { removeOnCombined = value; }
}
//Can the "Use" action be triggered by characters or just other items/statuseffects
[Serialize(true, false)]
public bool CharacterUsable
{
get { return characterUsable; }
set { characterUsable = value; }
}
public InputType PickKey
{
@@ -37,14 +37,7 @@ namespace Barotrauma.Items.Components
get { return launchImpulse; }
set { launchImpulse = value; }
}
[Serialize(false, false)]
public bool CharacterUsable
{
get { return characterUsable; }
set { characterUsable = value; }
}
[Serialize(false, false)]
//backwards compatibility, can stick to anything
public bool DoesStick
@@ -73,13 +73,10 @@ namespace Barotrauma.Items.Components
projectileAnchor.X = element.GetAttributeFloat("projectileanchorx", 0.0f);
projectileAnchor.Y = element.GetAttributeFloat("projectileanchory", 0.0f);
projectileAnchor = ConvertUnits.ToSimUnits(projectileAnchor);
characterUsable = element.GetAttributeBool("characterusable", false);
sprite = new Sprite(spritePath, new Vector2(0.5f,0.5f));
sectionLength = ConvertUnits.ToSimUnits(sprite.size.X);
Path ropePath = new Path();
ropePath.Add(item.body.SimPosition);
ropePath.Add(item.body.SimPosition + new Vector2(length, 0.0f));