diff --git a/code/game/machinery/atm_ret_field.dm b/code/game/machinery/atm_ret_field.dm
index 595758da7cb..5c2c567485c 100644
--- a/code/game/machinery/atm_ret_field.dm
+++ b/code/game/machinery/atm_ret_field.dm
@@ -12,12 +12,18 @@
active_power_usage = 2500
var/ispowered = TRUE
var/isactive = FALSE
- var/wasactive = FALSE
+ var/wasactive = FALSE //controls automatic reboot after power-loss
var/alwaysactive = FALSE //for a special subtype
+
+ //how long it takes us to reboot if we're shut down by an EMP
+ var/reboot_delay_min = 50
+ var/reboot_delay_max = 75
+
var/hatch_open = FALSE
var/wires_intact = TRUE
var/list/areas_added
var/field_type = /obj/structure/atmospheric_retention_field
+ circuit = /obj/item/weapon/circuitboard/arf_generator
/obj/machinery/atmospheric_field_generator/impassable
desc = "An older model of ARF-G that generates an impassable retention field. Works just as well as the modern variety, but is slightly more energy-efficient.
Note: prolonged immersion in active atmospheric retention fields may have negative long-term health consequences."
@@ -27,11 +33,19 @@
/obj/machinery/atmospheric_field_generator/perma
name = "static atmospheric retention field generator"
desc = "A floor-mounted piece of equipment that generates an atmosphere-retaining energy field when powered and activated. This model is designed to always be active, though the field will still drop from loss of power or electromagnetic interference.
Note: prolonged immersion in active atmospheric retention fields may have negative long-term health consequences."
- alwaysactive = TRUE //
- active_power_usage = 2000 //lowest of the lot
+ alwaysactive = TRUE
+ active_power_usage = 2000
+
+/obj/machinery/atmospheric_field_generator/perma/impassable
+ active_power_usage = 1500
+ field_type = /obj/structure/atmospheric_retention_field/impassable
/obj/machinery/atmospheric_field_generator/attackby(obj/item/weapon/W as obj, mob/user as mob)
- if(W.is_crowbar())
+ if(W.is_crowbar() && isactive)
+ if(!src) return
+ to_chat(user, "You can't open the ARF-G whilst it's running!")
+ return
+ if(W.is_crowbar() && !isactive)
if(!src) return
to_chat(user, "You [hatch_open? "close" : "open"] \the [src]'s access hatch.")
hatch_open = !hatch_open
@@ -45,6 +59,7 @@
generate_field()
else if(!alwaysactive)
disable_field()
+ update_icon()
return
if(hatch_open && W.is_wirecutter())
if(!src) return
@@ -52,11 +67,24 @@
wires_intact = !wires_intact
if(!wires_intact)
disable_field()
+ update_icon()
return
/obj/machinery/atmospheric_field_generator/perma/Initialize()
generate_field()
-
+
+/obj/machinery/atmospheric_field_generator/update_icon()
+ if(stat & BROKEN)
+ icon_state = "arfg_broken"
+ else if(hatch_open && wires_intact)
+ icon_state = "arfg_open_wires"
+ else if(hatch_open && !wires_intact)
+ icon_state = "arfg_open_wirescut"
+ else if(isactive)
+ icon_state = "arfg_on"
+ else
+ icon_state = "arfg_off"
+
/obj/machinery/atmospheric_field_generator/power_change()
var/oldstat
..()
@@ -74,7 +102,7 @@
. = ..()
disable_field() //shutting dowwwwwwn
if(alwaysactive || wasactive) //reboot after a short delay if we were online before
- spawn(rand(50,75))
+ spawn(rand(reboot_delay_min,reboot_delay_max))
generate_field()
//for now, do nothing, we'll fix this up later
@@ -82,7 +110,7 @@
return
/obj/machinery/atmospheric_field_generator/proc/generate_field()
- if(!ispowered || !wires_intact || isactive) //if it's not powered, the wires are busted, or it's already on, don't do anything
+ 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
diff --git a/code/game/machinery/frame.dm b/code/game/machinery/frame.dm
index ed4b086e73d..d651ad2025a 100644
--- a/code/game/machinery/frame.dm
+++ b/code/game/machinery/frame.dm
@@ -221,6 +221,11 @@
frame_style = FRAME_STYLE_WALL
x_offset = 28
y_offset = 28
+
+/datum/frame/frame_types/arfgs
+ name = "ARF Generator"
+ frame_class = FRAME_CLASS_MACHINE
+ frame_size = 3
//////////////////////////////
// Frame Object (Structure)
diff --git a/code/game/objects/items/weapons/circuitboards/frame.dm b/code/game/objects/items/weapons/circuitboards/frame.dm
index ddc86fb4edc..7ef7c4bfefc 100644
--- a/code/game/objects/items/weapons/circuitboards/frame.dm
+++ b/code/game/objects/items/weapons/circuitboards/frame.dm
@@ -255,3 +255,13 @@
/obj/item/weapon/stock_parts/spring = 1,
/obj/item/stack/cable_coil = 5)
+/obj/item/weapon/circuitboard/arf_generator
+ name = T_BOARD("atmospheric field generator")
+ build_path = /obj/machinery/atmospheric_field_generator
+ board_type = new /datum/frame/frame_types/arfgs
+ origin_tech = list(TECH_MAGNET = 4, TECH_POWER = 4, TECH_BIO = 3)
+ req_components = list(
+ /obj/item/weapon/stock_parts/micro_laser/high = 2, //field emitters
+ /obj/item/weapon/stock_parts/scanning_module = 1, //atmosphere sensor
+ /obj/item/weapon/stock_parts/capacitor/adv = 1, //for the JUICE
+ /obj/item/stack/cable_coil = 10)
\ No newline at end of file
diff --git a/code/modules/research/designs/circuits/circuits.dm b/code/modules/research/designs/circuits/circuits.dm
index c4c0825a2e0..fbf41ab8067 100644
--- a/code/modules/research/designs/circuits/circuits.dm
+++ b/code/modules/research/designs/circuits/circuits.dm
@@ -427,6 +427,13 @@ CIRCUITS BELOW
build_path = /obj/item/weapon/circuitboard/skills
sort_string = "LAAAC"
+/datum/design/circuit/arf_generator
+ name = "atmospheric field generator"
+ id = "arf_generator"
+ req_tech = list(TECH_MAGNET = 4, TECH_POWER = 4, TECH_BIO = 3)
+ build_path = /obj/item/weapon/circuitboard/arf_generator
+ sort_string = "LAAAD"
+
/datum/design/circuit/mecha
req_tech = list(TECH_DATA = 3)
diff --git a/icons/obj/atm_fieldgen.dmi b/icons/obj/atm_fieldgen.dmi
index 8226a568384..0c30371196a 100644
Binary files a/icons/obj/atm_fieldgen.dmi and b/icons/obj/atm_fieldgen.dmi differ
diff --git a/icons/obj/stock_parts.dmi b/icons/obj/stock_parts.dmi
index 64184432c7a..1f203a1e8f1 100644
Binary files a/icons/obj/stock_parts.dmi and b/icons/obj/stock_parts.dmi differ