Base ItemComponents can apply OnUse statuseffects, grenades can be placed in detonators. Closes #113
This commit is contained in:
@@ -100,7 +100,9 @@
|
||||
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||
<input name="activate">
|
||||
<StatusEffect type="OnUse" target="Contained" Condition="-100.0"/>
|
||||
<StatusEffect type="OnUse" target="Contained" Condition="-100.0">
|
||||
<Use/>
|
||||
</StatusEffect>
|
||||
</input>
|
||||
</ConnectionPanel>
|
||||
</Item>
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
name="Stun Grenade"
|
||||
category="Equipment"
|
||||
price="200"
|
||||
tags="smallitem,weapon">
|
||||
tags="smallitem,weapon,explosive">
|
||||
|
||||
<Deconstruct time="10">
|
||||
<Item name="Steel Bar"/>
|
||||
@@ -153,6 +153,14 @@
|
||||
<Sprite texture="weapons.png" sourcerect="98,0,11,24" depth="0.55"/>
|
||||
|
||||
<Body width="11" height="24" density="30"/>
|
||||
|
||||
<!-- Empty itemcomponent that explodes the grenade when used by something else than a character (e.g. a detonator) -->
|
||||
<ItemComponent characterusable="false">
|
||||
<StatusEffect type="OnUse" target="This" Condition="-100.0">
|
||||
<sound file="Content/Items/Weapons/stungrenade.ogg"/>
|
||||
<Explosion range="500" damage="5" stun="25" force="0.1" smoke="false"/>
|
||||
</StatusEffect>
|
||||
</ItemComponent>
|
||||
|
||||
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10">
|
||||
<StatusEffect type="OnSecondaryUse" target="This" Condition="-100.0" delay="3.0">
|
||||
@@ -165,7 +173,7 @@
|
||||
<Item
|
||||
name="Incendium Grenade"
|
||||
category="Equipment"
|
||||
tags="smallitem,weapon">
|
||||
tags="smallitem,weapon,explosive">
|
||||
|
||||
<Deconstruct time="10">
|
||||
<Item name="Steel Bar"/>
|
||||
@@ -177,6 +185,14 @@
|
||||
|
||||
<Body width="11" height="24" density="30"/>
|
||||
|
||||
<!-- Empty itemcomponent that explodes the grenade when used by something else than a character (e.g. a detonator) -->
|
||||
<ItemComponent characterusable="false">
|
||||
<StatusEffect type="OnUse" target="This" Condition="-100.0">
|
||||
<sound file="Content/Items/Weapons/stungrenade.ogg"/>
|
||||
<Explosion range="500" damage="5" stun="25" force="0.1" smoke="false"/>
|
||||
</StatusEffect>
|
||||
</ItemComponent>
|
||||
|
||||
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10">
|
||||
<StatusEffect type="OnSecondaryUse" target="This" Condition="-100.0" delay="3.0">
|
||||
<sound file="Content/Items/Weapons/stungrenade.ogg"/>
|
||||
|
||||
@@ -516,15 +516,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (useItemCount > 0)
|
||||
|
||||
for (int i = 0; i < useItemCount; i++)
|
||||
{
|
||||
for (int i=0; i<useItemCount; i++)
|
||||
foreach (Item item in targets.FindAll(t => t is Item).Cast<Item>())
|
||||
{
|
||||
foreach (Item item in targets.FindAll(t => t is Item).Cast<Item>())
|
||||
{
|
||||
item.Use(deltaTime, targets.FirstOrDefault(t => t is Character) as Character);
|
||||
}
|
||||
item.Use(deltaTime, targets.FirstOrDefault(t => t is Character) as Character);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace Barotrauma.Items.Components
|
||||
//returns true if the item was used succesfully (not out of ammo, reloading, etc)
|
||||
public virtual bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
return false;
|
||||
return characterUsable || character == null;
|
||||
}
|
||||
|
||||
//called when the item is equipped and right mouse button is pressed
|
||||
|
||||
Reference in New Issue
Block a user