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

View File

@@ -179,7 +179,7 @@
<Propulsion force="-40" usablein="both"/>
<Projectile launchimpulse="80.0">
<Projectile characterusable="false" launchimpulse="80.0">
<Attack damage="1000" bleedingdamage="10" structuredamage="500" damagetype="Blunt"/>
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">

View File

@@ -29,7 +29,7 @@
<Containable name="chem"/>
</ItemContainer>
<Projectile launchimpulse="20.0" sticktocharacters="true">
<Projectile characterusable="false" launchimpulse="20.0" sticktocharacters="true">
<Attack damage="5" bleedingdamage="0.2" structuredamage="1" damagetype="Blunt" stun="0.1" targetforce="5"/>
<StatusEffect type="OnImpact" target="Contained, Character" Condition="-50.0" disabledeltatime="true" >
<sound file="Content/Items/Medical/syringe.ogg" range="500"/>
@@ -511,7 +511,7 @@
<Body width="8" height="16" density="10"/>
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable characterusable="false" canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true"/>
<StatusEffect type="OnFire" target="this" condition="-50"/>
<StatusEffect type="OnBroken" target="This" Condition="-100.0">

View File

@@ -49,7 +49,7 @@
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,20" handle2="10,20" aimable="false"/>
<Projectile launchimpulse="5.0">
<Projectile characterusable="false" launchimpulse="5.0">
<Attack damage="1" structuredamage="1" damagetype="Blunt"/>
<StatusEffect type="OnImpact" target="Contained">
<Use/>
@@ -80,7 +80,7 @@
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,20" handle2="10,20" aimable="false"/>
<Projectile launchimpulse="5.0">
<Projectile characterusable="false" launchimpulse="5.0">
<StatusEffect type="OnImpact" Condition="-100.0" stun="10.0" disabledeltatime="true">
<sound file="Content/Items/Weapons/bigexplosion.ogg" range="10000"/>
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>

View File

@@ -10,7 +10,7 @@
<Sprite texture="weapons.png" depth="0.8" sourcerect="0,97,24,8"/>
<Body width="24" height="8"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="This" Condition="-100.0">
<sound file="Content/Items/Reactor/explosion.ogg" range="3000"/>
<Explosion range="500.0" structuredamage="250" damage="200" stun="5" force="20.0" severlimbsprobability="0.5" decal="explosion" decalsize="0.5"/>
@@ -29,7 +29,7 @@
<Sprite texture="weapons.png" depth="0.8" sourcerect="0,97,24,8"/>
<Body width="24" height="8"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
<StatusEffect type="OnUse" target="This" Condition="-100.0">
<sound file="Content/Items/Reactor/explosion.ogg" range="3000"/>
@@ -49,7 +49,7 @@
<Sprite texture="weapons.png" depth="0.8" sourcerect="0,97,24,8"/>
<Body width="24" height="8"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="Always" target="This" Condition="-0.35"/>
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
<StatusEffect type="OnBroken" target="This">
@@ -76,7 +76,7 @@
<Sprite texture="weapons.png" depth="0.8" sourcerect="0,97,24,8"/>
<Body width="24" height="8"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable characterusable="false" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
<StatusEffect type="OnUse" target="This" Condition="-100.0">
<sound file="Content/Items/Reactor/explosion.ogg" range="2000"/>

View File

@@ -87,7 +87,7 @@
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,0" handle2="10,0" aimable="false"/>
<Projectile launchimpulse="80.0">
<Projectile characterusable="false" launchimpulse="80.0">
<Attack damage="100" bleedingdamage="10" structuredamage="200" damagetype="Blunt" severlimbsprobability="1.0"/>
<StatusEffect type="OnActive" target="This">
@@ -120,7 +120,7 @@
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,0" handle2="10,0" aimable="false"/>
<Projectile launchimpulse="80.0">
<Projectile characterusable="false" launchimpulse="80.0">
<Attack damage="1000" bleedingdamage="10" structuredamage="200" damagetype="Blunt" severlimbsprobability="1.0"/>
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">

View File

@@ -17,7 +17,7 @@
<Body width="64" height="5" density="20"/>
<Pickable slots="Any"/>
<Projectile launchimpulse="20.0" sticktocharacters="true">
<Projectile characterusable="false" launchimpulse="20.0" sticktocharacters="true">
<Attack damage="20" bleedingdamage="2" structuredamage="50" damagetype="Blunt" stun="0.2" targetforce="50"/>
</Projectile>
</Item>
@@ -102,7 +102,7 @@
<Body width="8" height="3" density="40"/>
<Pickable slots="Any"/>
<Projectile hitscan="true" removeonhit="true" >
<Projectile characterusable="false" hitscan="true" removeonhit="true" >
<Attack damage="40" bleedingdamage="3" structuredamage="100" damagetype="Blunt" stun="0.5" targetforce="50"/>
</Projectile>
</Item>

View File

@@ -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)

View File

@@ -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
{

View File

@@ -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

View File

@@ -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));