Page 1 of 1

Dart Gun

Posted: Tue Dec 12, 2017 1:56 pm
by chikoeduardo
Basically, a syringe thrower. I partially implemented it in my mod but after some time trying to make it work, I believe it's not possible to make darts that will deal the containing drug effects on targets. So I made this instead:

Code: Select all

<Item
    name="Tranquilizer Dart"
    category="Equipment"
	Tags="smallitem,weapon,chem"
	description="A dart containing Midazolam, which can be used to put either dangerous individuals or creatures to sleep."
    interactthroughwalls="true"
    price="150">
	
	<Deconstruct time="5">
      <Item name="Polycarbonate Bar"/>
    </Deconstruct>

    <Sprite texture="Mods/Chiko/Items/Weapons/weapons.png" sourcerect="0,78,25,8" depth="0.55"/>

    <Body width="23" height="6" density="10.1"/>

    <Projectile launchimpulse="30" doesstick="true">
      <Attack damage="1" stun="120" damagetype="Slash"/>
	  <StatusEffect type="OnImpact" target="This" Condition="-100" delay="5.0"/>
    </Projectile>
	
	<Pickable slots="Any"/>
  </Item>
  
  <Item
    name="Bleedout Dart"
    category="Equipment"
	Tags="smallitem,weapon,chem"
	description="A dart containing Hematosine, which causes massive hemorrhage through all natural openings and wounds the victim might already have."
    interactthroughwalls="true">
	
	<Deconstruct time="5">
      <Item name="Polycarbonate Bar"/>
    </Deconstruct>

    <Sprite texture="Mods/Chiko/Items/Weapons/weapons.png" sourcerect="31,78,25,8" depth="0.55"/>

    <Body width="23" height="6" density="10.1"/>

    <Projectile launchimpulse="30" doesstick="true">
      <Attack damage="1" bleedingdamage="75" stun="2" damagetype="Slash"/>
	  <StatusEffect type="OnImpact" target="This" Condition="-100" delay="5.0"/>
    </Projectile>
	
	<Pickable slots="Any"/>
  </Item>
  
  <Item
    name="Dart Gun"
    category="Equipment"
	tags="bigitem,weapon"
	description="This is an scoped pneumatic rifle that can propel darts containing different drugs."
    price="1500">

    <Deconstruct time="10">      
      <Item name="Steel Bar"/>
      <Item name="Aluminium Bar"/>      
      <Item name="Polycarbonate Bar"/>
    </Deconstruct>
  
    <Sprite texture="Mods/Chiko/Items/Weapons/weapons.png" sourcerect="0,30,98,33" depth="0.55"/>

    <Body width="90" height="30" density="40"/>
    
    <RangedWeapon barrelpos="49,10" spread="0" unskilledspread="10">
      <Sound file="Mods/Chiko/Items/Weapons/DartGun1.ogg" type="OnUse"/>
      <Sound file="Mods/Chiko/Items/Weapons/DartGun2.ogg" type="OnUse"/>
      <RequiredItems name="Tranquilizer Dart,Bleedout Dart" type="Contained" msg="The loaded dart is depleted"/>
      <RequiredSkill name="Weapons" level="50"/>
    </RangedWeapon>

    <ItemContainer capacity="1" hideitems="true">
      <Containable name="Tranquilizer Dart"/>
	  <Containable name="Bleedout Dart"/>
    </ItemContainer>
	
	<Holdable slots="RightHand+LeftHand,Any" controlpose="true"
              holdpos="35,-10" aimpos="60,5" handle1="-15,-6" handle2="26,7"/>
  </Item>
It's not as versatile as it needs to be but it works.


My suggestion is to implement code to allow projectiles to apply drug/chem effects upon impact, similar to how syringes work. I'm not savvy enough for actual coding but I can offer sprites with this suggestion:
Image

Re: Dart Gun

Posted: Wed Dec 13, 2017 9:42 am
by Crystalwarrior
https://github.com/Regalis11/Barotrauma/pull/123
Required some code tweaks, but now it's entirely possible to manipulate projectiles themselves in clever ways (e.g. remove condition, apply status effects, apply OnUse effects, etc.)
Will also be part of vanilla so WOOOOOO

Re: Dart Gun

Posted: Wed Dec 13, 2017 11:43 am
by chikoeduardo
Woah! Awesome news. I've been waiting for this kind of projectile stuff for a while now. :O