Runtime hunting: Thrown batons (#16518)

* Runtime hunting: Thrown batons

* macros and stuff
This commit is contained in:
DamianX
2017-11-10 22:11:44 +01:00
committed by Pieter-Jan Briers
parent a262ce1463
commit ac89c6110c

View File

@@ -15,7 +15,6 @@
var/status = 0 var/status = 0
var/obj/item/weapon/cell/bcell = null var/obj/item/weapon/cell/bcell = null
var/hitcost = 100 // 10 hits on crap cell var/hitcost = 100 // 10 hits on crap cell
var/mob/foundmob = "" //Used in throwing proc.
/obj/item/weapon/melee/baton/suicide_act(mob/user) /obj/item/weapon/melee/baton/suicide_act(mob/user)
to_chat(viewers(user), "<span class='danger'>[user] is putting the live [src.name] in \his mouth! It looks like \he's trying to commit suicide.</span>") to_chat(viewers(user), "<span class='danger'>[user] is putting the live [src.name] in \his mouth! It looks like \he's trying to commit suicide.</span>")
@@ -209,38 +208,37 @@
M.LAssailant = user M.LAssailant = user
/obj/item/weapon/melee/baton/throw_impact(atom/hit_atom) /obj/item/weapon/melee/baton/throw_impact(atom/hit_atom)
foundmob = directory[ckey(fingerprintslast)] if(prob(50))
if (prob(50)) return ..()
if(istype(hit_atom, /mob/living)) if(!isliving(hit_atom) || !status)
var/mob/living/L = hit_atom return
if(status) var/client/foundclient = directory[ckey(fingerprintslast)]
if(foundmob) var/mob/foundmob = foundclient.mob
foundmob.lastattacked = L var/mob/living/L = hit_atom
L.lastattacker = foundmob if(foundmob && ismob(foundmob))
foundmob.lastattacked = L
L.lastattacker = foundmob
L.Stun(stunforce) L.Stun(stunforce)
L.Knockdown(stunforce) L.Knockdown(stunforce)
L.apply_effect(STUTTER, stunforce) L.apply_effect(STUTTER, stunforce)
L.visible_message("<span class='danger'>[L] has been stunned with [src] by [foundmob ? foundmob : "Unknown"]!</span>") L.visible_message("<span class='danger'>[L] has been stunned with [src] by [foundmob ? foundmob : "Unknown"]!</span>")
playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1) playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
deductcharge(hitcost) deductcharge(hitcost)
if(ishuman(L)) if(ishuman(L))
var/mob/living/carbon/human/H = L var/mob/living/carbon/human/H = L
H.forcesay(hit_appends) H.forcesay(hit_appends)
foundmob.attack_log += "\[[time_stamp()]\]<font color='red'> Stunned [L.name] ([L.ckey]) with [name]</font>" foundmob.attack_log += "\[[time_stamp()]\]<font color='red'> Stunned [L.name] ([L.ckey]) with [name]</font>"
L.attack_log += "\[[time_stamp()]\]<font color='orange'> Stunned by thrown [src] by [istype(foundmob) ? foundmob.name : ""] ([istype(foundmob) ? foundmob.ckey : ""])</font>" L.attack_log += "\[[time_stamp()]\]<font color='orange'> Stunned by thrown [src] by [istype(foundmob) ? foundmob.name : ""] ([istype(foundmob) ? foundmob.ckey : ""])</font>"
log_attack("<font color='red'>Flying [src.name], thrown by [istype(foundmob) ? foundmob.name : ""] ([istype(foundmob) ? foundmob.ckey : ""]) stunned [L.name] ([L.ckey])</font>" ) log_attack("<font color='red'>Flying [src.name], thrown by [istype(foundmob) ? foundmob.name : ""] ([istype(foundmob) ? foundmob.ckey : ""]) stunned [L.name] ([L.ckey])</font>" )
if(!iscarbon(foundmob)) if(!iscarbon(foundmob))
L.LAssailant = null L.LAssailant = null
else else
L.LAssailant = foundmob L.LAssailant = foundmob
return
return ..()
/obj/item/weapon/melee/baton/emp_act(severity) /obj/item/weapon/melee/baton/emp_act(severity)
if(bcell) if(bcell)