EMP Refactor & Multi Z-level EMPs (#17781)

* sdfasf

* sdfas

* dsf
This commit is contained in:
Fluffy
2023-12-04 19:37:49 +00:00
committed by GitHub
parent 8f1a282756
commit d8d063edc6
143 changed files with 744 additions and 272 deletions
+4 -3
View File
@@ -98,17 +98,18 @@
playsound(get_turf(src), 'sound/effects/bang.ogg', 50, 1)
/obj/machinery/power/am_control_unit/emp_act(severity)
. = ..()
switch(severity)
if(1)
if(EMP_HEAVY)
if(active)
toggle_power()
stability -= rand(15, 30)
if(2)
if(EMP_LIGHT)
if(active)
toggle_power()
stability -= rand(10, 20)
check_stability()
..()
/obj/machinery/power/am_control_unit/ex_act(severity)
switch(severity)
+3 -1
View File
@@ -110,7 +110,9 @@
/obj/machinery/am_shielding/emp_act()//Immune due to not really much in the way of electronics.
return FALSE
. = ..()
return
/obj/machinery/am_shielding/ex_act(severity)
switch(severity)
+2 -1
View File
@@ -1530,6 +1530,8 @@
// damage and destruction acts
/obj/machinery/power/apc/emp_act(severity)
. = ..()
if(cell)
cell.emp_act(severity)
@@ -1540,7 +1542,6 @@
update_icon()
addtimer(CALLBACK(src, PROC_REF(post_emp_act)), 600)
..()
/obj/machinery/power/apc/proc/post_emp_act()
update_channels()
+18 -1
View File
@@ -168,6 +168,8 @@
rigged = 1 //broken batterys are dangerous
/obj/item/cell/emp_act(severity)
. = ..()
//remove this once emp changes on dev are merged in
if(isrobot(loc))
var/mob/living/silicon/robot/R = loc
@@ -176,7 +178,22 @@
charge -= maxcharge / severity
if (charge < 0)
charge = 0
..()
/**
* Drains a percentage of the power from the battery
*
* * divisor - The fraction to remove, after multiplication with `cell_emp_mult` if a robot, calculated as maxcharge / divisor
*/
/obj/item/cell/proc/powerdrain(divisor)
SHOULD_NOT_SLEEP(TRUE)
if(isrobot(loc))
var/mob/living/silicon/robot/R = loc
divisor *= R.cell_emp_mult
charge -= maxcharge / divisor
if (charge < 0)
charge = 0
/obj/item/cell/ex_act(severity)
+1 -2
View File
@@ -424,7 +424,6 @@
/obj/effect/fusion_em_field/proc/Radiate()
if(istype(loc, /turf))
var/empsev = max(1, min(3, Ceil(size/2)))
for(var/atom/movable/AM in range(max(1,Floor(size/2)), loc))
if(AM == src || AM == owned_core || !AM.simulated)
@@ -440,7 +439,7 @@
AM.visible_message(SPAN_DANGER("The field buckles visibly around \the [AM]!"))
tick_instability += rand(30,50)
AM.emp_act(empsev)
AM.emp_act(EMP_LIGHT)
if(owned_core && owned_core.loc)
var/datum/gas_mixture/environment = owned_core.loc.return_air()
+4 -5
View File
@@ -75,17 +75,16 @@
to_chat(user, SPAN_NOTICE("The generator is off."))
/obj/machinery/power/portgen/emp_act(severity)
. = ..()
var/duration = 6000 //ten minutes
switch(severity)
if(1)
if(EMP_HEAVY)
stat &= BROKEN
if(prob(75)) explode()
if(2)
if(EMP_LIGHT)
if(prob(25)) stat &= BROKEN
if(prob(10)) explode()
if(3)
if(prob(10)) stat &= BROKEN
duration = 300
stat |= EMPED
if(duration)
+3 -1
View File
@@ -111,7 +111,9 @@
return TRUE
/obj/machinery/power/emitter/emp_act()
/obj/machinery/power/emitter/emp_act(severity)
. = ..()
activate(null)
return TRUE
@@ -155,7 +155,9 @@ field_generator power level display
return
/obj/machinery/field_generator/emp_act()
/obj/machinery/field_generator/emp_act(severity)
. = ..()
return 0
/obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj)
+4 -3
View File
@@ -478,9 +478,9 @@
else if(prob(15)) //Power drain
small_spark.queue()
if(prob(50))
emp_act(1)
emp_act(EMP_HEAVY)
else
emp_act(2)
emp_act(EMP_LIGHT)
else if(prob(5)) //smoke only
var/datum/effect/effect/system/smoke_spread/smoke = new /datum/effect/effect/system/smoke_spread()
smoke.set_up(3, 0, src.loc)
@@ -500,6 +500,8 @@
outputting = 0
/obj/machinery/power/smes/emp_act(severity)
. = ..()
if(prob(50))
inputting(rand(0,1))
outputting(rand(0,1))
@@ -513,7 +515,6 @@
if(prob(50))
energy_fail(rand(0 + (severity * 30),30 + (severity * 30)))
update_icon()
..()
/obj/machinery/power/smes/magical
+1 -1
View File
@@ -430,7 +430,7 @@
if(issilicon(closest_mob))
var/mob/living/silicon/S = closest_mob
if(stun_mobs)
S.emp_act(2)
S.emp_act(EMP_LIGHT)
tesla_zap(S, 7, power / 1.5, explosive, stun_mobs) // metallic folks bounce it further
else
tesla_zap(closest_mob, 5, power / 1.5, explosive, stun_mobs)