Merge pull request #11285 from Fox-McCloud/elecrocution-refactor

Refactors Electrocution
This commit is contained in:
variableundefined
2019-04-16 19:47:42 +08:00
committed by GitHub
31 changed files with 158 additions and 143 deletions
+23 -18
View File
@@ -134,43 +134,48 @@
M.forceMove(get_turf(src))
visible_message("<span class='danger'>[M] bursts out of [src]!</span>")
/mob/living/carbon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, override = 0, tesla_shock = 0)
/mob/living/carbon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE)
SEND_SIGNAL(src, COMSIG_LIVING_ELECTROCUTE_ACT, shock_damage)
if(status_flags & GODMODE) //godmode
return 0
return FALSE
if(NO_SHOCK in mutations) //shockproof
return 0
return FALSE
if(tesla_shock && tesla_ignore)
return FALSE
shock_damage *= siemens_coeff
if(shock_damage<1 && !override)
return 0
if(dna && dna.species)
shock_damage *= dna.species.siemens_coeff
if(shock_damage < 1 && !override)
return FALSE
if(reagents.has_reagent("teslium"))
shock_damage *= 1.5 //If the mob has teslium in their body, shocks are 50% more damaging!
take_overall_damage(0,shock_damage, TRUE, used_weapon = "Electrocution")
shock_internal_organs(shock_damage)
if(illusion)
adjustStaminaLoss(shock_damage)
else
take_overall_damage(0, shock_damage, TRUE, used_weapon = "Electrocution")
shock_internal_organs(shock_damage)
visible_message(
"<span class='danger'>[src] was shocked by \the [source]!</span>", \
"<span class='userdanger'>You feel a powerful shock coursing through your body!</span>", \
"<span class='italics'>You hear a heavy electrical crack.</span>" \
)
"<span class='danger'>[src] was shocked by \the [source]!</span>",
"<span class='userdanger'>You feel a powerful shock coursing through your body!</span>",
"<span class='italics'>You hear a heavy electrical crack.</span>")
AdjustJitter(1000) //High numbers for violent convulsions
do_jitter_animation(jitteriness)
AdjustStuttering(2)
if(!tesla_shock || (tesla_shock && siemens_coeff > 0.5))
if((!tesla_shock || (tesla_shock && siemens_coeff > 0.5)) && stun)
Stun(2)
spawn(20)
AdjustJitter(-1000, bound_lower = 10) //Still jittery, but vastly less
if(!tesla_shock || (tesla_shock && siemens_coeff > 0.5))
if((!tesla_shock || (tesla_shock && siemens_coeff > 0.5)) && stun)
Stun(3)
Weaken(3)
if(shock_damage > 200)
src.visible_message(
"<span class='danger'>[src] was arc flashed by the [source]!</span>", \
"<span class='userdanger'>The [source] arc flashes and electrocutes you!</span>", \
"<span class='italics'>You hear a lightning-like crack!</span>" \
)
"<span class='danger'>[src] was arc flashed by the [source]!</span>",
"<span class='userdanger'>The [source] arc flashes and electrocutes you!</span>",
"<span class='italics'>You hear a lightning-like crack!</span>")
playsound(loc, 'sound/effects/eleczap.ogg', 50, 1, -1)
explosion(src.loc,-1,0,2,2)
explosion(loc, -1, 0, 2, 2)
if(override)
return override
else
+6 -13
View File
@@ -551,13 +551,8 @@
dna.species.update_sight(src)
//Removed the horrible safety parameter. It was only being used by ninja code anyways.
//Now checks siemens_coefficient of the affected area by default
/mob/living/carbon/human/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, override = 0, tesla_shock = 0)
if(status_flags & GODMODE) //godmode
return 0
if(NO_SHOCK in mutations) //shockproof
return 0
//Added a safety check in case you want to shock a human mob directly through electrocute_act.
/mob/living/carbon/human/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE)
if(tesla_shock)
var/total_coeff = 1
if(gloves)
@@ -575,20 +570,18 @@
siemens_coeff = 0
else if(!safety)
var/gloves_siemens_coeff = 1
var/species_siemens_coeff = 1
if(gloves)
var/obj/item/clothing/gloves/G = gloves
gloves_siemens_coeff = G.siemens_coefficient
if(dna.species)
species_siemens_coeff = dna.species.siemens_coeff
siemens_coeff = gloves_siemens_coeff * species_siemens_coeff
if(undergoing_cardiac_arrest())
siemens_coeff = gloves_siemens_coeff
if(undergoing_cardiac_arrest() && !illusion)
if(shock_damage * siemens_coeff >= 1 && prob(25))
set_heartattack(FALSE)
if(stat == CONSCIOUS)
to_chat(src, "<span class='notice'>You feel your heart beating again!</span>")
. = ..()
dna.species.spec_electrocute_act(src, shock_damage, source, siemens_coeff, safety, override, tesla_shock, illusion, stun)
. = ..(shock_damage, source, siemens_coeff, safety, override, tesla_shock, illusion, stun)
/mob/living/carbon/human/Topic(href, href_list)
if(!usr.stat && usr.canmove && !usr.restrained() && in_range(src, usr))
@@ -309,6 +309,9 @@
/datum/species/proc/handle_death(mob/living/carbon/human/H) //Handles any species-specific death events (such as dionaea nymph spawns).
return
/datum/species/proc/spec_electrocute_act(mob/living/carbon/human/H, shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE)
return
/datum/species/proc/help(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style)
if(attacker_style && attacker_style.help_act(user, target))//adminfu only...
return TRUE
+16 -2
View File
@@ -55,8 +55,22 @@
/mob/living/proc/check_projectile_dismemberment(obj/item/projectile/P, def_zone)
return 0
/mob/living/proc/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, tesla_shock = 0)
return 0 //only carbon liveforms have this proc
/mob/living/proc/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE)
SEND_SIGNAL(src, COMSIG_LIVING_ELECTROCUTE_ACT, shock_damage)
if(status_flags & GODMODE) //godmode
return FALSE
if(NO_SHOCK in mutations) //shockproof
return FALSE
if(tesla_shock && tesla_ignore)
return FALSE
if(shock_damage > 0)
if(!illusion)
adjustFireLoss(shock_damage)
visible_message(
"<span class='danger'>[src] was shocked by \the [source]!</span>",
"<span class='userdanger'>You feel a powerful shock coursing through your body!</span>",
"<span class='italics'>You hear a heavy electrical crack.</span>")
return shock_damage
/mob/living/emp_act(severity)
var/list/L = src.get_contents()
@@ -71,6 +71,9 @@
/mob/living/silicon/drop_item()
return
/mob/living/silicon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE)
return FALSE //So borgs they don't die trying to fix wiring
/mob/living/silicon/emp_act(severity)
switch(severity)
if(1)
@@ -85,6 +85,9 @@
/mob/living/simple_animal/hostile/construct/narsie_act()
return
/mob/living/simple_animal/hostile/construct/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE)
return FALSE
/////////////////Juggernaut///////////////
@@ -142,7 +142,7 @@
return
/mob/living/simple_animal/hostile/floor_cluwne/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, tesla_shock = 0, illusion = 0, stun = TRUE)//prevents runtimes with machine fuckery
/mob/living/simple_animal/hostile/floor_cluwne/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE) //prevents runtimes with machine fuckery
return FALSE