Electrocution Refactor+Electric Reagents

This commit is contained in:
Fox-McCloud
2015-12-31 17:28:27 -05:00
parent 58ad640d17
commit e38417cebe
12 changed files with 106 additions and 55 deletions
+24 -35
View File
@@ -114,8 +114,7 @@ mob/living
return
return
/mob/living/carbon/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0, var/def_zone = null,var/override = 0, tesla_shock = 0)
/mob/living/carbon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, override = 0, tesla_shock = 0)
if(status_flags & GODMODE) //godmode
return 0
if(NO_SHOCK in mutations) //shockproof
@@ -124,42 +123,32 @@ mob/living
shock_damage *= siemens_coeff
if(shock_damage<1 && !override)
return 0
src.apply_damage(shock_damage, BURN, def_zone, used_weapon="Electrocution")
if(heart_attack && prob(25))
heart_attack = 0
playsound(loc, "sparks", 50, 1, -1)
if (shock_damage < 10)
src.visible_message(
"\red [src] was mildly shocked by the [source].", \
"\red You feel a mild shock course through your body.", \
"\red You hear a light zapping." \
)
jitteriness += (rand(2,4))//mostly for the swarmer trap
do_jitter_animation(jitteriness)
if (shock_damage > 10)
if (shock_damage < 200)
src.visible_message(
"\red [src] was shocked by the [source]!", \
"\red <B>You feel a powerful shock course through your body!</B>", \
"\red You hear a heavy electrical crack." \
)
jitteriness += 1000 //High numbers for violent convulsions
do_jitter_animation(jitteriness)
stuttering += 2
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)
//src.burn_skin(shock_damage)
//src.adjustFireLoss(shock_damage) //burn_skin will do this for us
//src.updatehealth()
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>" \
)
jitteriness += 1000 //High numbers for violent convulsions
do_jitter_animation(jitteriness)
stuttering += 2
if(!tesla_shock || (tesla_shock && siemens_coeff > 0.5))
Stun(2)
spawn(20)
jitteriness = max(jitteriness - 990, 10) //Still jittery, but vastly less
if(!tesla_shock || (tesla_shock && siemens_coeff > 0.5))
Stun(2)
spawn(20)
jitteriness = max(jitteriness - 990, 10) //Still jittery, but vastly less
if(!tesla_shock || (tesla_shock && siemens_coeff > 0.5))
Stun(3)
Weaken(3)
Stun(3)
Weaken(3)
if (shock_damage > 200)
src.visible_message(
"\red [src] was arc flashed by the [source]!", \
"\red <B>The [source] arc flashes and electrocutes you!</B>", \
"\red You hear a lightning-like crack!" \
"<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)
@@ -245,6 +245,9 @@
else
msg += "[t_He] [t_is] quite chubby.\n"
if(reagents.has_reagent("teslium"))
msg += "[t_He] is emitting a gentle blue glow!\n"
msg += "</span>"
if(getBrainLoss() >= 60)
+16 -11
View File
@@ -742,19 +742,11 @@
//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(var/shock_damage, var/obj/source, var/base_siemens_coeff = 1.0, var/def_zone = null,var/override = 0, tesla_shock = 0)
/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
if (!def_zone)
def_zone = pick("l_hand", "r_hand")
var/obj/item/organ/external/affected_organ = get_organ(check_zone(def_zone))
var/siemens_coeff = base_siemens_coeff * get_siemens_coefficient_organ(affected_organ)
if(tesla_shock)
var/total_coeff = 1
if(gloves)
@@ -766,8 +758,21 @@
if(S.siemens_coefficient <= 0)
total_coeff -= 0.95
siemens_coeff = total_coeff
return ..(shock_damage, source, siemens_coeff, def_zone, override, tesla_shock)
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(species)
species_siemens_coeff = species.siemens_coeff
siemens_coeff = gloves_siemens_coeff * species_siemens_coeff
if(heart_attack)
if(shock_damage * siemens_coeff >= 1 && prob(25))
heart_attack = 0
if(stat == CONSCIOUS)
src << "<span class='notice'>You feel your heart beating again!</span>"
. = ..(shock_damage,source,siemens_coeff,safety,override,tesla_shock)
/mob/living/carbon/human/Topic(href, href_list)
@@ -12,7 +12,7 @@
blood_color = "#515573"
flesh_color = "#137E8F"
siemens_coeff = 0
has_organ = list(
"brain" = /obj/item/organ/brain/golem
@@ -42,6 +42,8 @@
var/passive_temp_gain = 0 //IS_SYNTHETIC species will gain this much temperature every second
var/reagent_tag //Used for metabolizing reagents.
var/siemens_coeff = 1 //base electrocution coefficient
var/darksight = 2
var/hazard_high_pressure = HAZARD_HIGH_PRESSURE // Dangerously high pressure.
var/warning_high_pressure = WARNING_HIGH_PRESSURE // High pressure warning.
+1 -1
View File
@@ -65,7 +65,7 @@
apply_damage(P.damage, P.damage_type, def_zone, armor)
return P.on_hit(src, armor, def_zone)
/mob/living/proc/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0, var/def_zone = null, tesla_shock = 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/emp_act(severity)
@@ -434,8 +434,7 @@
var/mob/living/L = AM
if(!istype(L, /mob/living/simple_animal/hostile/swarmer))
playsound(loc,'sound/effects/snap.ogg',50, 1, -1)
L.Stun(1) //i am doing this here instead of electrocute act
L.electrocute_act(0, src, 1, "l_foot", 1)
L.electrocute_act(0, src, 1, 1)
if(isrobot(L) || L.isSynthetic())
L.Weaken(5)
qdel(src)
@@ -105,7 +105,7 @@
if(M == user)
return
M.Beam(L,icon_state="purple_lightning",icon='icons/effects/effects.dmi',time=5)
M.electrocute_act(shock_damage, "[L.name]")
M.electrocute_act(shock_damage, "[L.name]", safety=1)
var/datum/effect/system/spark_spread/z = new /datum/effect/system/spark_spread/
z.set_up(4, 0, M)
z.start()
+18
View File
@@ -608,3 +608,21 @@ datum/reagent/firefighting_foam/reaction_obj(var/obj/O, var/volume)
var/location = get_turf(holder.my_atom)
explosion(location,0,0,3)
return
/datum/chemical_reaction/shock_explosion
name = "shock_explosion"
id = "shock_explosion"
result = null
required_reagents = list("teslium" = 5, "uranium" = 5) //uranium to this so it can't be spammed like no tomorrow without mining help.
result_amount = 1
mix_message = "<span class='danger'>The reaction releases an electrical blast!</span>"
mix_sound = 'sound/magic/lightningbolt.ogg'
/datum/chemical_reaction/shock_explosion/on_reaction(var/datum/reagents/holder, var/created_volume)
var/turf/T = get_turf(holder.my_atom)
for(var/mob/living/carbon/C in view(6, T))
C.Beam(T,icon_state="lightning[rand(1,12)]",icon='icons/effects/effects.dmi',time=5) //What? Why are we beaming from the mob to the turf? Turf to mob generates really odd results.
C.electrocute_act(1, "electrical blast")
holder.del_reagent("teslium") //Clear all remaining Teslium and Uranium, but leave all other reagents untouched.
holder.del_reagent("uranium")
return
+34
View File
@@ -745,3 +745,37 @@ datum/reagent/ants/on_mob_life(var/mob/living/M as mob)
M.adjustBruteLoss(2)
..()
return
/datum/reagent/teslium //Teslium. Causes periodic shocks, and makes shocks against the target much more effective.
name = "Teslium"
id = "teslium"
description = "An unstable, electrically-charged metallic slurry. Increases the conductance of living things."
reagent_state = LIQUID
color = "#20324D" //RGB: 32, 50, 77
metabolization_rate = 0.2
var/shock_timer = 0
/datum/reagent/teslium/on_mob_life(mob/living/M)
shock_timer++
if(shock_timer >= rand(5,30)) //Random shocks are wildly unpredictable
shock_timer = 0
M.electrocute_act(rand(5,20), "Teslium in their body", 1, 1) //Override because it's caused from INSIDE of you
playsound(M, "sparks", 50, 1)
..()
/datum/chemical_reaction/teslium
name = "Teslium"
id = "teslium"
result = "teslium"
required_reagents = list("plasma" = 1, "silver" = 1, "blackpowder" = 1)
result_amount = 3
mix_message = "<span class='danger'>A jet of sparks flies from the mixture as it merges into a flickering slurry.</span>"
min_temp = 400
mix_sound = null
/datum/chemical_reaction/teslium/on_reaction(var/datum/reagents/holder, var/created_volume)
var/location = get_turf(holder.my_atom)
var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
s.set_up(6, 1, location)
s.start()
return