Merge pull request #14178 from Poojawa/fancy-AFGs

Fixes #14118
This commit is contained in:
Heroman3003
2022-12-10 10:22:16 +10:00
committed by CHOMPStation2
parent 7566c3306c
commit 6f890fbe98

View File

@@ -98,26 +98,30 @@
/obj/machinery/atmospheric_field_generator/power_change()
var/oldstat
..()
if(!(stat & NOPOWER))
ispowered = 1
if(!(stat & (BROKEN|NOPOWER|EMPED)))
ispowered = TRUE
update_icon()
if(alwaysactive || wasactive) //reboot our field if we were on or are supposed to be always-on
generate_field()
if(stat != oldstat && isactive && (stat & NOPOWER))
ispowered = 0
if(stat != oldstat && isactive && (stat & (BROKEN|NOPOWER|EMPED)))
ispowered = FALSE
disable_field()
update_icon()
/obj/machinery/atmospheric_field_generator/emp_act()
. = ..()
if(!(stat & EMPED))
stat |= EMPED
disable_field() //shutting dowwwwwwn
if(alwaysactive || wasactive) //reboot after a short delay if we were online before
spawn(rand(reboot_delay_min,reboot_delay_max))
stat &= ~EMPED
if(alwaysactive || wasactive) //reboot after a short delay if we were online before
generate_field()
..()
/obj/machinery/atmospheric_field_generator/ex_act(severity)
switch(severity)
if(1)
stat |= BROKEN //ensures that always on generators are set as broken prior to being deleted, thus, off.
disable_field()
qdel(src)
return
@@ -134,7 +138,7 @@
if(!ispowered || hatch_open || !wires_intact || isactive) //if it's not powered, the hatch is open, the wires are busted, or it's already on, don't do anything
return
else
isactive = 1
isactive = TRUE
icon_state = "arfg_on"
new field_type (src.loc)
src.visible_message("<span class='warning'>The ARF-G crackles to life!</span>","<span class='warning'>You hear an ARF-G coming online!</span>")
@@ -143,12 +147,15 @@
/obj/machinery/atmospheric_field_generator/proc/disable_field()
if(isactive)
if(alwaysactive == TRUE && !(stat & (BROKEN|NOPOWER|EMPED))) //If we're not damaged, don't turn off if we're always on.
return
else
icon_state = "arfg_off"
for(var/obj/structure/atmospheric_retention_field/F in loc)
qdel(F)
src.visible_message("The ARF-G shuts down with a low hum.","You hear an ARF-G powering down.")
update_use_power(USE_POWER_IDLE)
isactive = 0
isactive = FALSE
return
/obj/machinery/atmospheric_field_generator/Initialize()