mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-27 14:08:44 +01:00
Merges taser and stun baton effects
Makes the code for handling stun weapon effects much cleaner. Moves electrocute_act and emp_act from living.dm into living_defense.dm
This commit is contained in:
@@ -112,27 +112,24 @@
|
||||
var/mob/living/L = M
|
||||
|
||||
var/contact = 1
|
||||
var/target_zone
|
||||
if(user.a_intent == "harm")
|
||||
contact = ..()
|
||||
agony *= 0.5 //whacking someone causes a much poorer contact than prodding them.
|
||||
stun *= 0.5
|
||||
//we can't really extract the actual hit zone from ..(), unfortunately. Just act like they prodded the chest.
|
||||
target_zone = "chest"
|
||||
else
|
||||
//copied from human_defense.dm
|
||||
//copied from human_defense.dm - human defence code should really be refactored some time.
|
||||
if (ishuman(L))
|
||||
user.lastattacked = L //are these used at all, if we have logs?
|
||||
L.lastattacker = user
|
||||
|
||||
var/target_zone = get_zone_with_miss_chance(user.zone_sel.selecting, L)
|
||||
target_zone = get_zone_with_miss_chance(user.zone_sel.selecting, L)
|
||||
if(user == L) // Attacking yourself can't miss
|
||||
target_zone = user.zone_sel.selecting
|
||||
target_zone = check_zone(user.zone_sel.selecting)
|
||||
if(!target_zone)
|
||||
contact = 0
|
||||
else
|
||||
switch (target_zone)
|
||||
if("head")
|
||||
agony *= 1.25
|
||||
//if("l_hand", "r_hand") //TODO
|
||||
//if("l_foot", "r_foot") //TODO
|
||||
|
||||
//put this here to avoid duplicate messages and logs from ..() above
|
||||
if (!contact)
|
||||
@@ -141,30 +138,20 @@
|
||||
if(!status)
|
||||
L.visible_message("<span class='warning'>[L] has been prodded with [src] by [user]. Luckily it was off.</span>")
|
||||
else
|
||||
L.visible_message("<span class='danger'>[L] has been prodded with [src] by [user]!</span>")
|
||||
//unfortunately we can't tuck this away into human/stun_effect_act()...
|
||||
if (ishuman(L))
|
||||
var/mob/living/carbon/human/H = L
|
||||
var/datum/organ/external/affecting = H.get_organ(target_zone)
|
||||
if (affecting)
|
||||
H.visible_message("<span class='danger'>[L] has been prodded in the [affecting.display_name] with [src] by [user]!</span>")
|
||||
else
|
||||
L.visible_message("<span class='danger'>[L] has been prodded with [src] by [user]!</span>")
|
||||
|
||||
//stun effects
|
||||
if (contact)
|
||||
msg_admin_attack("[key_name(user)] attempted to stun [key_name(L)] with the [src].")
|
||||
|
||||
if (ishuman(L))
|
||||
var/mob/living/carbon/human/H = L
|
||||
var/datum/organ/external/affected = get_organ(def_zone)
|
||||
var/siemens_coeff = H.get_siemens_coefficient_organ(affected)
|
||||
stun *= siemens_coeff
|
||||
agony *= siemens_coeff
|
||||
|
||||
if (stun)
|
||||
L.Stun(stun)
|
||||
L.Weaken(stun)
|
||||
L.apply_effect(STUTTER, stun)
|
||||
|
||||
if (agony)
|
||||
//perhaps this could be merged with taser effects?
|
||||
L.apply_effect(agony,AGONY,0)
|
||||
L.apply_effect(STUTTER, agony/10)
|
||||
L.apply_effect(EYE_BLUR, agony/10)
|
||||
L.flash_pain()
|
||||
L.stun_effect_act(stun, agony, target_zone)
|
||||
|
||||
playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
|
||||
msg_admin_attack("[key_name(user)] stunned [key_name(L)] with the [src].")
|
||||
|
||||
@@ -59,18 +59,7 @@ emp_act
|
||||
|
||||
//BEGIN BOOK'S TASER NERF.
|
||||
if(istype(P, /obj/item/projectile/beam/stun))
|
||||
var/datum/organ/external/select_area = get_organ(def_zone) // We're checking the outside, buddy!
|
||||
var/list/clothing_items = list(head, wear_mask, wear_suit, w_uniform, gloves, shoes) // What all are we checking?
|
||||
|
||||
for(var/obj/item/clothing/CL in clothing_items) //Make an unregulated var to pass around.
|
||||
if(!istype(CL)) //This isn't necessary, is it?
|
||||
continue
|
||||
if(CL.body_parts_covered & select_area.body_part) // Is that body part being targeted covered by CL?
|
||||
P.agony *= CL.siemens_coefficient
|
||||
|
||||
//blocked = 0 here as we've already adjused based on siemens_coefficient.
|
||||
apply_effect(P.agony,AGONY,0)
|
||||
flash_pain()
|
||||
stun_effect_act(0, P.agony, def_zone)
|
||||
src <<"\red You have been hit by [P]!"
|
||||
del P
|
||||
return
|
||||
@@ -88,6 +77,19 @@ emp_act
|
||||
|
||||
return (..(P , def_zone))
|
||||
|
||||
/mob/living/carbon/human/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone)
|
||||
switch (def_zone)
|
||||
if("head")
|
||||
agony_amount *= 1.25
|
||||
//if("l_hand", "r_hand") //TODO
|
||||
//if("l_foot", "r_foot") //TODO
|
||||
|
||||
var/datum/organ/external/affected = get_organ(check_zone(def_zone))
|
||||
var/siemens_coeff = get_siemens_coefficient_organ(affected)
|
||||
stun_amount *= siemens_coeff
|
||||
agony_amount *= siemens_coeff
|
||||
|
||||
..(stun_amount, agony_amount, def_zone)
|
||||
|
||||
/mob/living/carbon/human/getarmor(var/def_zone, var/type)
|
||||
var/armorval = 0
|
||||
@@ -191,7 +193,7 @@ emp_act
|
||||
/mob/living/carbon/human/proc/attacked_by(var/obj/item/I, var/mob/living/user, var/def_zone)
|
||||
if(!I || !user) return 0
|
||||
|
||||
var/target_zone = def_zone? def_zone : get_zone_with_miss_chance(user.zone_sel.selecting, src)
|
||||
var/target_zone = def_zone? check_zone(def_zone) : get_zone_with_miss_chance(user.zone_sel.selecting, src)
|
||||
|
||||
if(user == src) // Attacking yourself can't miss
|
||||
target_zone = user.zone_sel.selecting
|
||||
|
||||
@@ -202,15 +202,6 @@
|
||||
return 0
|
||||
|
||||
|
||||
/mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0)
|
||||
return 0 //only carbon liveforms have this proc
|
||||
|
||||
/mob/living/emp_act(severity)
|
||||
var/list/L = src.get_contents()
|
||||
for(var/obj/O in L)
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
|
||||
/mob/living/proc/can_inject()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -65,6 +65,30 @@
|
||||
P.on_hit(src, absorb, def_zone)
|
||||
return absorb
|
||||
|
||||
//Handles the effects of "stun" weapons
|
||||
/mob/living/proc/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone)
|
||||
flash_pain()
|
||||
|
||||
if (stun_amount)
|
||||
Stun(stun_amount)
|
||||
Weaken(stun_amount)
|
||||
apply_effect(STUTTER, stun_amount)
|
||||
apply_effect(EYE_BLUR, stun_amount)
|
||||
|
||||
if (agony_amount)
|
||||
apply_effect(agony_amount, AGONY,0)
|
||||
apply_effect(STUTTER, agony_amount/10)
|
||||
apply_effect(EYE_BLUR, agony_amount/10)
|
||||
|
||||
/mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0)
|
||||
return 0 //only carbon liveforms have this proc
|
||||
|
||||
/mob/living/emp_act(severity)
|
||||
var/list/L = src.get_contents()
|
||||
for(var/obj/O in L)
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
|
||||
//this proc handles being hit by a thrown atom
|
||||
/mob/living/hitby(atom/movable/AM as mob|obj,var/speed = 5)//Standardization and logging -Sieve
|
||||
if(istype(AM,/obj/))
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
src << "\red Warning: Electromagnetic pulse detected."
|
||||
..()
|
||||
|
||||
/mob/living/silicon/stun_effect_act(var/stun_amount, var/agony_amount)
|
||||
return //immune
|
||||
|
||||
/mob/living/silicon/proc/damage_mob(var/brute = 0, var/fire = 0, var/tox = 0)
|
||||
return
|
||||
|
||||
|
||||
@@ -129,17 +129,6 @@ proc/hasorgans(A)
|
||||
zone = "head"
|
||||
if("mouth")
|
||||
zone = "head"
|
||||
/* if("l_hand")
|
||||
zone = "l_arm"
|
||||
if("r_hand")
|
||||
zone = "r_arm"
|
||||
if("l_foot")
|
||||
zone = "l_leg"
|
||||
if("r_foot")
|
||||
zone = "r_leg"
|
||||
if("groin")
|
||||
zone = "chest"
|
||||
*/
|
||||
return zone
|
||||
|
||||
// Returns zone with a certain probability.
|
||||
|
||||
Reference in New Issue
Block a user