Fixes and test.

This commit is contained in:
Fermi
2019-06-02 03:24:01 +01:00
parent 3cf3268c76
commit 0fa445c153
6 changed files with 108 additions and 19 deletions
@@ -61,8 +61,8 @@
..()
/obj/item/ammo_casing/syringegun/dart
name = "syringe gun spring"
desc = "A high-power spring that throws syringes."
projectile_type = /obj/item/projectile/bullet/dart/syringe
name = "dart gun air canister"
desc = "A small canister of compressed gas."
projectile_type = /obj/item/projectile/bullet/dart/syringe/dart
firing_effect_type = null
harmful = FALSE
@@ -110,6 +110,7 @@
item_state = "dartgun"
materials = list(MAT_METAL=2000, MAT_GLASS=500)
suppressed = TRUE //Softer fire sound
can_unsuppress = FALSE
/obj/item/gun/syringe/dart/Initialize()
..()
@@ -9,12 +9,14 @@
create_reagents(50)
reagents.set_reacting(FALSE)
/obj/item/projectile/bullet/dart/on_hit(atom/target, blocked = FALSE)
/obj/item/projectile/bullet/dart/on_hit(atom/target, blocked = FALSE, skip = FALSE)
if(iscarbon(target))
var/mob/living/carbon/M = target
if(blocked != 100) // not completely blocked
if(M.can_inject(null, FALSE, def_zone, piercing)) // Pass the hit zone to see if it can inject by whether it hit the head or the body.
..()
if(skip == TRUE)
return
reagents.reaction(M, INJECT)
reagents.trans_to(M, reagents.total_volume)
return TRUE
@@ -37,3 +39,49 @@
/obj/item/projectile/bullet/dart/syringe
name = "syringe"
icon_state = "syringeproj"
//I am in a mess of my own making
/obj/item/projectile/bullet/dart/syringe/dart
name = "Smartdart"
icon_state = "syringeproj"
damage = 0
/obj/item/projectile/bullet/dart/syringe/dart/on_hit(atom/target, blocked = FALSE)
message_admins("Dart landed!")
if(iscarbon(target))
var/mob/living/carbon/M = target
if(blocked != 100) // not completely blocked
if(M.can_inject(null, FALSE, def_zone, piercing)) // Pass the hit zone to see if it can inject by whether it hit the head or the body.
..(target, blocked, TRUE)
message_admins("Checking reagents")
for(var/datum/reagent/R in reagents.reagent_list) //OD prevention time!
message_admins("Reagent: [R]")
if(istype(R, /datum/reagent/medicine)) //Is this a medicine?
message_admins("Is a medicine")
if(M.reagents.has_reagent(R.id))
message_admins("reagent found! with new")
var/datum/reagent/medicine/Rm = locate(R) in M
if(R.overdose_threshold == 0) //Is there a possible OD?
M.reagents.add_reagent(R.id, R.volume)
else
var/transVol = CLAMP(R.volume, 0, (R.overdose_threshold - Rm.volume) -1)
M.reagents.add_reagent(R.id, transVol)
target.visible_message("<span class='notice'>\The [src] beeps!</span>")
return TRUE
else
if(!R.overdose_threshold == 0)
var/transVol = CLAMP(R.volume, 0, R.overdose_threshold-1)
M.reagents.add_reagent(R.id, transVol)
else
M.reagents.add_reagent(R.id, R.volume)
target.visible_message("<span class='notice'>\The [src] beeps!</span>")
to_chat("<span class='notice'><i>You feel a tiny prick, and turn around to see a smartdart embedded in your butt.</i.</span>")
return TRUE
else
blocked = 100
target.visible_message("<span class='danger'>\The [src] was deflected!</span>", \
"<span class='userdanger'>You see a [src] bounce off you, booping sadly!</span>")
target.visible_message("<span class='danger'>\The [src] fails to land on target!</span>")
return TRUE