diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm
index d2508b3e..858b8dbd 100644
--- a/code/_onclick/hud/action_button.dm
+++ b/code/_onclick/hud/action_button.dm
@@ -113,7 +113,7 @@
name = "Show Buttons"
else
name = "Hide Buttons"
- UpdateIcon()
+ update_icon()
usr.update_action_buttons()
/obj/screen/movable/action_button/hide_toggle/AltClick(mob/user)
@@ -135,9 +135,9 @@
hide_icon = settings["toggle_icon"]
hide_state = settings["toggle_hide"]
show_state = settings["toggle_show"]
- UpdateIcon()
+ update_icon()
-/obj/screen/movable/action_button/hide_toggle/proc/UpdateIcon()
+/obj/screen/movable/action_button/hide_toggle/update_icon()
cut_overlays()
add_overlay(mutable_appearance(hide_icon, hidden ? show_state : hide_state))
diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm
index 544d7983..db7ad9f0 100644
--- a/code/game/area/areas.dm
+++ b/code/game/area/areas.dm
@@ -335,7 +335,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
for(var/obj/machinery/light/L in src)
L.update()
-/area/proc/updateicon()
+/area/proc/update_icon()
var/weather_icon
for(var/V in SSweather.processing)
var/datum/weather/W = V
@@ -345,7 +345,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(!weather_icon)
icon_state = null
-/area/space/updateicon()
+/area/space/update_icon()
icon_state = null
/*
@@ -378,7 +378,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/area/proc/power_change()
for(var/obj/machinery/M in src) // for each machine in the area
M.power_change() // reverify power status (to update icons etc.)
- updateicon()
+ update_icon()
/area/proc/usage(chan)
var/used = 0
diff --git a/code/game/machinery/Beacon.dm b/code/game/machinery/Beacon.dm
index 8d849c8c..c98795c9 100644
--- a/code/game/machinery/Beacon.dm
+++ b/code/game/machinery/Beacon.dm
@@ -1,48 +1,48 @@
-/obj/machinery/bluespace_beacon
-
- icon = 'icons/obj/objects.dmi'
- icon_state = "floor_beaconf"
- name = "bluespace gigabeacon"
- desc = "A device that draws power from bluespace and creates a permanent tracking beacon."
- level = 1 // underfloor
- layer = LOW_OBJ_LAYER
- use_power = IDLE_POWER_USE
- idle_power_usage = 0
- var/obj/item/beacon/Beacon
-
-/obj/machinery/bluespace_beacon/Initialize()
- . = ..()
- var/turf/T = loc
- Beacon = new(T)
- Beacon.invisibility = INVISIBILITY_MAXIMUM
-
- hide(T.intact)
-
-/obj/machinery/bluespace_beacon/Destroy()
- QDEL_NULL(Beacon)
- return ..()
-
-// update the invisibility and icon
-/obj/machinery/bluespace_beacon/hide(intact)
- invisibility = intact ? INVISIBILITY_MAXIMUM : 0
- updateicon()
-
-// update the icon_state
-/obj/machinery/bluespace_beacon/proc/updateicon()
- var/state="floor_beacon"
-
- if(invisibility)
- icon_state = "[state]f"
-
- else
- icon_state = "[state]"
-
-/obj/machinery/bluespace_beacon/process()
- if(!Beacon)
- var/turf/T = loc
- Beacon = new(T)
- Beacon.invisibility = INVISIBILITY_MAXIMUM
- else if (Beacon.loc != loc)
- Beacon.forceMove(loc)
-
- updateicon()
+/obj/machinery/bluespace_beacon
+
+ icon = 'icons/obj/objects.dmi'
+ icon_state = "floor_beaconf"
+ name = "bluespace gigabeacon"
+ desc = "A device that draws power from bluespace and creates a permanent tracking beacon."
+ level = 1 // underfloor
+ layer = LOW_OBJ_LAYER
+ use_power = IDLE_POWER_USE
+ idle_power_usage = 0
+ var/obj/item/beacon/Beacon
+
+/obj/machinery/bluespace_beacon/Initialize()
+ . = ..()
+ var/turf/T = loc
+ Beacon = new(T)
+ Beacon.invisibility = INVISIBILITY_MAXIMUM
+
+ hide(T.intact)
+
+/obj/machinery/bluespace_beacon/Destroy()
+ QDEL_NULL(Beacon)
+ return ..()
+
+// update the invisibility and icon
+/obj/machinery/bluespace_beacon/hide(intact)
+ invisibility = intact ? INVISIBILITY_MAXIMUM : 0
+ update_icon()
+
+// update the icon_state
+/obj/machinery/bluespace_beacon/update_icon()
+ var/state="floor_beacon"
+
+ if(invisibility)
+ icon_state = "[state]f"
+
+ else
+ icon_state = "[state]"
+
+/obj/machinery/bluespace_beacon/process()
+ if(!Beacon)
+ var/turf/T = loc
+ Beacon = new(T)
+ Beacon.invisibility = INVISIBILITY_MAXIMUM
+ else if (Beacon.loc != loc)
+ Beacon.forceMove(loc)
+
+ update_icon()
diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm
index 1969fe8b..1c0635fd 100644
--- a/code/game/machinery/cell_charger.dm
+++ b/code/game/machinery/cell_charger.dm
@@ -1,130 +1,130 @@
-/obj/machinery/cell_charger
- name = "cell charger"
- desc = "It charges power cells."
- icon = 'icons/obj/power.dmi'
- icon_state = "ccharger"
- use_power = IDLE_POWER_USE
- idle_power_usage = 5
- active_power_usage = 60
- power_channel = EQUIP
- circuit = /obj/item/circuitboard/machine/cell_charger
- pass_flags = PASSTABLE
- var/obj/item/stock_parts/cell/charging = null
- var/chargelevel = -1
- var/charge_rate = 500
-
-/obj/machinery/cell_charger/proc/updateicon()
- cut_overlays()
- if(charging)
- add_overlay(image(charging.icon, charging.icon_state))
- add_overlay("ccharger-on")
- if(!(stat & (BROKEN|NOPOWER)))
- var/newlevel = round(charging.percent() * 4 / 100)
- chargelevel = newlevel
- add_overlay("ccharger-o[newlevel]")
-
-/obj/machinery/cell_charger/examine(mob/user)
- . = ..()
- . += "There's [charging ? "a" : "no"] cell in the charger."
- if(charging)
- . += "Current charge: [round(charging.percent(), 1)]%."
-
-/obj/machinery/cell_charger/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/stock_parts/cell) && !panel_open)
- if(stat & BROKEN)
- to_chat(user, "[src] is broken!")
- return
- if(!anchored)
- to_chat(user, "[src] isn't attached to the ground!")
- return
- if(charging)
- to_chat(user, "There is already a cell in the charger!")
- return
- else
- var/area/a = loc.loc // Gets our locations location, like a dream within a dream
- if(!isarea(a))
- return
- if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power!
- to_chat(user, "[src] blinks red as you try to insert the cell!")
- return
- if(!user.transferItemToLoc(W,src))
- return
-
- charging = W
- user.visible_message("[user] inserts a cell into [src].", "You insert a cell into [src].")
- chargelevel = -1
- updateicon()
- else
- if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W))
- return
- if(default_deconstruction_crowbar(W))
- return
- if(!charging && default_unfasten_wrench(user, W))
- return
- return ..()
-
-/obj/machinery/cell_charger/deconstruct()
- if(charging)
- charging.forceMove(drop_location())
- return ..()
-
-/obj/machinery/cell_charger/Destroy()
- QDEL_NULL(charging)
- return ..()
-
-/obj/machinery/cell_charger/proc/removecell()
- charging.update_icon()
- charging = null
- chargelevel = -1
- updateicon()
-
-/obj/machinery/cell_charger/attack_hand(mob/user)
- . = ..()
- if(.)
- return
- if(!charging)
- return
-
- user.put_in_hands(charging)
- charging.add_fingerprint(user)
-
- user.visible_message("[user] removes [charging] from [src].", "You remove [charging] from [src].")
-
- removecell()
-
-/obj/machinery/cell_charger/attack_tk(mob/user)
- if(!charging)
- return
-
- charging.forceMove(loc)
- to_chat(user, "You telekinetically remove [charging] from [src].")
-
- removecell()
-
-/obj/machinery/cell_charger/attack_ai(mob/user)
- return
-
-/obj/machinery/cell_charger/emp_act(severity)
- . = ..()
-
- if(stat & (BROKEN|NOPOWER) || . & EMP_PROTECT_CONTENTS)
- return
-
- if(charging)
- charging.emp_act(severity)
-
-/obj/machinery/cell_charger/RefreshParts()
- charge_rate = 500
- for(var/obj/item/stock_parts/capacitor/C in component_parts)
- charge_rate *= C.rating
-
-/obj/machinery/cell_charger/process()
- if(!charging || !anchored || (stat & (BROKEN|NOPOWER)))
- return
-
- if(charging.percent() >= 100)
- return
- use_power(charge_rate)
- charging.give(charge_rate) //this is 2558, efficient batteries exist
-
- updateicon()
+/obj/machinery/cell_charger
+ name = "cell charger"
+ desc = "It charges power cells."
+ icon = 'icons/obj/power.dmi'
+ icon_state = "ccharger"
+ use_power = IDLE_POWER_USE
+ idle_power_usage = 5
+ active_power_usage = 60
+ power_channel = EQUIP
+ circuit = /obj/item/circuitboard/machine/cell_charger
+ pass_flags = PASSTABLE
+ var/obj/item/stock_parts/cell/charging = null
+ var/chargelevel = -1
+ var/charge_rate = 500
+
+/obj/machinery/cell_charger/update_icon()
+ cut_overlays()
+ if(charging)
+ add_overlay(image(charging.icon, charging.icon_state))
+ add_overlay("ccharger-on")
+ if(!(stat & (BROKEN|NOPOWER)))
+ var/newlevel = round(charging.percent() * 4 / 100)
+ chargelevel = newlevel
+ add_overlay("ccharger-o[newlevel]")
+
+/obj/machinery/cell_charger/examine(mob/user)
+ . = ..()
+ . += "There's [charging ? "a" : "no"] cell in the charger."
+ if(charging)
+ . += "Current charge: [round(charging.percent(), 1)]%."
+
+/obj/machinery/cell_charger/attackby(obj/item/W, mob/user, params)
+ if(istype(W, /obj/item/stock_parts/cell) && !panel_open)
+ if(stat & BROKEN)
+ to_chat(user, "[src] is broken!")
+ return
+ if(!anchored)
+ to_chat(user, "[src] isn't attached to the ground!")
+ return
+ if(charging)
+ to_chat(user, "There is already a cell in the charger!")
+ return
+ else
+ var/area/a = loc.loc // Gets our locations location, like a dream within a dream
+ if(!isarea(a))
+ return
+ if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power!
+ to_chat(user, "[src] blinks red as you try to insert the cell!")
+ return
+ if(!user.transferItemToLoc(W,src))
+ return
+
+ charging = W
+ user.visible_message("[user] inserts a cell into [src].", "You insert a cell into [src].")
+ chargelevel = -1
+ update_icon()
+ else
+ if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W))
+ return
+ if(default_deconstruction_crowbar(W))
+ return
+ if(!charging && default_unfasten_wrench(user, W))
+ return
+ return ..()
+
+/obj/machinery/cell_charger/deconstruct()
+ if(charging)
+ charging.forceMove(drop_location())
+ return ..()
+
+/obj/machinery/cell_charger/Destroy()
+ QDEL_NULL(charging)
+ return ..()
+
+/obj/machinery/cell_charger/proc/removecell()
+ charging.update_icon()
+ charging = null
+ chargelevel = -1
+ update_icon()
+
+/obj/machinery/cell_charger/attack_hand(mob/user)
+ . = ..()
+ if(.)
+ return
+ if(!charging)
+ return
+
+ user.put_in_hands(charging)
+ charging.add_fingerprint(user)
+
+ user.visible_message("[user] removes [charging] from [src].", "You remove [charging] from [src].")
+
+ removecell()
+
+/obj/machinery/cell_charger/attack_tk(mob/user)
+ if(!charging)
+ return
+
+ charging.forceMove(loc)
+ to_chat(user, "You telekinetically remove [charging] from [src].")
+
+ removecell()
+
+/obj/machinery/cell_charger/attack_ai(mob/user)
+ return
+
+/obj/machinery/cell_charger/emp_act(severity)
+ . = ..()
+
+ if(stat & (BROKEN|NOPOWER) || . & EMP_PROTECT_CONTENTS)
+ return
+
+ if(charging)
+ charging.emp_act(severity)
+
+/obj/machinery/cell_charger/RefreshParts()
+ charge_rate = 500
+ for(var/obj/item/stock_parts/capacitor/C in component_parts)
+ charge_rate *= C.rating
+
+/obj/machinery/cell_charger/process()
+ if(!charging || !anchored || (stat & (BROKEN|NOPOWER)))
+ return
+
+ if(charging.percent() >= 100)
+ return
+ use_power(charge_rate)
+ charging.give(charge_rate) //this is 2558, efficient batteries exist
+
+ update_icon()
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index 20b59e7a..2a4b9039 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -1,67 +1,67 @@
-// the light switch
-// can have multiple per area
-// can also operate on non-loc area through "otherarea" var
-/obj/machinery/light_switch
- name = "light switch"
- icon = 'icons/obj/power.dmi'
- icon_state = "light1"
- desc = "Make dark."
- var/on = TRUE
- var/area/area = null
- var/otherarea = null
-
-/obj/machinery/light_switch/Initialize()
- . = ..()
- area = get_area(src)
-
- if(otherarea)
- area = locate(text2path("/area/[otherarea]"))
-
- if(!name)
- name = "light switch ([area.name])"
-
- on = area.lightswitch
- updateicon()
-
-/obj/machinery/light_switch/proc/updateicon()
- if(stat & NOPOWER)
- icon_state = "light-p"
- else
- if(on)
- icon_state = "light1"
- else
- icon_state = "light0"
-
-/obj/machinery/light_switch/examine(mob/user)
- . = ..()
- . += "It is [on? "on" : "off"]."
-
-/obj/machinery/light_switch/interact(mob/user)
- . = ..()
- on = !on
-
- area.lightswitch = on
- area.updateicon()
-
- for(var/obj/machinery/light_switch/L in area)
- L.on = on
- L.updateicon()
-
- area.power_change()
-
-/obj/machinery/light_switch/power_change()
-
- if(!otherarea)
- if(powered(LIGHT))
- stat &= ~NOPOWER
- else
- stat |= NOPOWER
-
- updateicon()
-
-/obj/machinery/light_switch/emp_act(severity)
- . = ..()
- if (. & EMP_PROTECT_SELF)
- return
- if(!(stat & (BROKEN|NOPOWER)))
- power_change()
+// the light switch
+// can have multiple per area
+// can also operate on non-loc area through "otherarea" var
+/obj/machinery/light_switch
+ name = "light switch"
+ icon = 'icons/obj/power.dmi'
+ icon_state = "light1"
+ desc = "Make dark."
+ var/on = TRUE
+ var/area/area = null
+ var/otherarea = null
+
+/obj/machinery/light_switch/Initialize()
+ . = ..()
+ area = get_area(src)
+
+ if(otherarea)
+ area = locate(text2path("/area/[otherarea]"))
+
+ if(!name)
+ name = "light switch ([area.name])"
+
+ on = area.lightswitch
+ update_icon()
+
+/obj/machinery/light_switch/update_icon()
+ if(stat & NOPOWER)
+ icon_state = "light-p"
+ else
+ if(on)
+ icon_state = "light1"
+ else
+ icon_state = "light0"
+
+/obj/machinery/light_switch/examine(mob/user)
+ . = ..()
+ . += "It is [on? "on" : "off"]."
+
+/obj/machinery/light_switch/interact(mob/user)
+ . = ..()
+ on = !on
+
+ area.lightswitch = on
+ area.update_icon()
+
+ for(var/obj/machinery/light_switch/L in area)
+ L.on = on
+ L.update_icon()
+
+ area.power_change()
+
+/obj/machinery/light_switch/power_change()
+
+ if(!otherarea)
+ if(powered(LIGHT))
+ stat &= ~NOPOWER
+ else
+ stat |= NOPOWER
+
+ update_icon()
+
+/obj/machinery/light_switch/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
+ if(!(stat & (BROKEN|NOPOWER)))
+ power_change()
diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm
index cd5482d7..c1d53293 100644
--- a/code/game/machinery/magnet.dm
+++ b/code/game/machinery/magnet.dm
@@ -1,386 +1,386 @@
-// Magnetic attractor, creates variable magnetic fields and attraction.
-// Can also be used to emit electron/proton beams to create a center of magnetism on another tile
-
-// tl;dr: it's magnets lol
-// This was created for firing ranges, but I suppose this could have other applications - Doohl
-
-/obj/machinery/magnetic_module
- icon = 'icons/obj/objects.dmi'
- icon_state = "floor_magnet-f"
- name = "electromagnetic generator"
- desc = "A device that uses station power to create points of magnetic energy."
- level = 1 // underfloor
- layer = LOW_OBJ_LAYER
- use_power = IDLE_POWER_USE
- idle_power_usage = 50
-
- var/freq = FREQ_MAGNETS // radio frequency
- var/electricity_level = 1 // intensity of the magnetic pull
- var/magnetic_field = 1 // the range of magnetic attraction
- var/code = 0 // frequency code, they should be different unless you have a group of magnets working together or something
- var/turf/center // the center of magnetic attraction
- var/on = FALSE
- var/magneting = FALSE
-
- // x, y modifiers to the center turf; (0, 0) is centered on the magnet, whereas (1, -1) is one tile right, one tile down
- var/center_x = 0
- var/center_y = 0
- var/max_dist = 20 // absolute value of center_x,y cannot exceed this integer
-
-/obj/machinery/magnetic_module/Initialize()
- ..()
- var/turf/T = loc
- hide(T.intact)
- center = T
- SSradio.add_object(src, freq, RADIO_MAGNETS)
- return INITIALIZE_HINT_LATELOAD
-
-/obj/machinery/magnetic_module/LateInitialize()
- magnetic_process()
-
-/obj/machinery/magnetic_module/Destroy()
- SSradio.remove_object(src, freq)
- center = null
- return ..()
-
-// update the invisibility and icon
-/obj/machinery/magnetic_module/hide(intact)
- invisibility = intact ? INVISIBILITY_MAXIMUM : 0
- updateicon()
-
-// update the icon_state
-/obj/machinery/magnetic_module/proc/updateicon()
- var/state="floor_magnet"
- var/onstate=""
- if(!on)
- onstate="0"
-
- if(invisibility)
- icon_state = "[state][onstate]-f" // if invisible, set icon to faded version
- // in case of being revealed by T-scanner
- else
- icon_state = "[state][onstate]"
-
-/obj/machinery/magnetic_module/receive_signal(datum/signal/signal)
-
- var/command = signal.data["command"]
- var/modifier = signal.data["modifier"]
- var/signal_code = signal.data["code"]
- if(command && (signal_code == code))
-
- Cmd(command, modifier)
-
-
-
-/obj/machinery/magnetic_module/proc/Cmd(command, modifier)
-
- if(command)
- switch(command)
- if("set-electriclevel")
- if(modifier)
- electricity_level = modifier
- if("set-magneticfield")
- if(modifier)
- magnetic_field = modifier
-
- if("add-elec")
- electricity_level++
- if(electricity_level > 12)
- electricity_level = 12
- if("sub-elec")
- electricity_level--
- if(electricity_level <= 0)
- electricity_level = 1
- if("add-mag")
- magnetic_field++
- if(magnetic_field > 4)
- magnetic_field = 4
- if("sub-mag")
- magnetic_field--
- if(magnetic_field <= 0)
- magnetic_field = 1
-
- if("set-x")
- if(modifier)
- center_x = modifier
- if("set-y")
- if(modifier)
- center_y = modifier
-
- if("N") // NORTH
- center_y++
- if("S") // SOUTH
- center_y--
- if("E") // EAST
- center_x++
- if("W") // WEST
- center_x--
- if("C") // CENTER
- center_x = 0
- center_y = 0
- if("R") // RANDOM
- center_x = rand(-max_dist, max_dist)
- center_y = rand(-max_dist, max_dist)
-
- if("set-code")
- if(modifier)
- code = modifier
- if("toggle-power")
- on = !on
-
- if(on)
- INVOKE_ASYNC(src, .proc/magnetic_process)
-
-
-
-/obj/machinery/magnetic_module/process()
- if(stat & NOPOWER)
- on = FALSE
-
- // Sanity checks:
- if(electricity_level <= 0)
- electricity_level = 1
- if(magnetic_field <= 0)
- magnetic_field = 1
-
-
- // Limitations:
- if(abs(center_x) > max_dist)
- center_x = max_dist
- if(abs(center_y) > max_dist)
- center_y = max_dist
- if(magnetic_field > 4)
- magnetic_field = 4
- if(electricity_level > 12)
- electricity_level = 12
-
- // Update power usage:
- if(on)
- use_power = ACTIVE_POWER_USE
- active_power_usage = electricity_level*15
- else
- use_power = NO_POWER_USE
-
- updateicon()
-
-
-/obj/machinery/magnetic_module/proc/magnetic_process() // proc that actually does the magneting
- if(magneting)
- return
- while(on)
-
- magneting = TRUE
- center = locate(x+center_x, y+center_y, z)
- if(center)
- for(var/obj/M in orange(magnetic_field, center))
- if(!M.anchored && (M.flags_1 & CONDUCT_1))
- step_towards(M, center)
-
- for(var/mob/living/silicon/S in orange(magnetic_field, center))
- if(isAI(S))
- continue
- step_towards(S, center)
-
- use_power(electricity_level * 5)
- sleep(13 - electricity_level)
-
- magneting = FALSE
-
-
-
-
-/obj/machinery/magnetic_controller
- name = "magnetic control console"
- icon = 'icons/obj/airlock_machines.dmi' // uses an airlock machine icon, THINK GREEN HELP THE ENVIRONMENT - RECYCLING!
- icon_state = "airlock_control_standby"
- density = FALSE
- use_power = IDLE_POWER_USE
- idle_power_usage = 45
- var/frequency = FREQ_MAGNETS
- var/code = 0
- var/list/magnets = list()
- var/title = "Magnetic Control Console"
- var/autolink = 0 // if set to 1, can't probe for other magnets!
-
- var/pathpos = 1 // position in the path
- var/path = "w;e;e;w;s;n;n;s" // text path of the magnet
- var/speed = 1 // lowest = 1, highest = 10
- var/list/rpath = list() // real path of the magnet, used in iterator
-
- var/moving = 0 // 1 if scheduled to loop
- var/looping = 0 // 1 if looping
-
- var/datum/radio_frequency/radio_connection
-
-
-/obj/machinery/magnetic_controller/Initialize()
- . = ..()
- if(autolink)
- for(var/obj/machinery/magnetic_module/M in GLOB.machines)
- if(M.freq == frequency && M.code == code)
- magnets.Add(M)
-
- if(path) // check for default path
- filter_path() // renders rpath
- radio_connection = SSradio.add_object(src, frequency, RADIO_MAGNETS)
-
-/obj/machinery/magnetic_controller/Destroy()
- SSradio.remove_object(src, frequency)
- magnets = null
- rpath = null
- return ..()
-
-/obj/machinery/magnetic_controller/process()
- if(magnets.len == 0 && autolink)
- for(var/obj/machinery/magnetic_module/M in GLOB.machines)
- if(M.freq == frequency && M.code == code)
- magnets.Add(M)
-
-/obj/machinery/magnetic_controller/ui_interact(mob/user)
- . = ..()
- var/dat = "Magnetic Control Console
"
- if(!autolink)
- dat += {"
- Frequency: [frequency]
- Code: [code]
- Probe Generators
- "}
-
- if(magnets.len >= 1)
-
- dat += "Magnets confirmed:
"
- var/i = 0
- for(var/obj/machinery/magnetic_module/M in magnets)
- i++
- dat += " < \[[i]\] ([M.on ? "On":"Off"]) | Electricity level: - [M.electricity_level] +; Magnetic field: - [M.magnetic_field] +
"
-
- dat += "
Speed: - [speed] +
"
- dat += "Path: {[path]}
"
- dat += "Moving: [moving ? "Enabled":"Disabled"]"
-
-
- user << browse(dat, "window=magnet;size=400x500")
- onclose(user, "magnet")
-
-/obj/machinery/magnetic_controller/Topic(href, href_list)
- if(..())
- return
- usr.set_machine(src)
-
- if(href_list["radio-op"])
-
- // Prepare signal beforehand, because this is a radio operation
- var/datum/signal/signal = new(list("code" = code))
-
- // Apply any necessary commands
- switch(href_list["radio-op"])
- if("togglepower")
- signal.data["command"] = "toggle-power"
-
- if("minuselec")
- signal.data["command"] = "sub-elec"
- if("pluselec")
- signal.data["command"] = "add-elec"
-
- if("minusmag")
- signal.data["command"] = "sub-mag"
- if("plusmag")
- signal.data["command"] = "add-mag"
-
-
- // Broadcast the signal
-
- radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
-
- spawn(1)
- updateUsrDialog() // pretty sure this increases responsiveness
-
- if(href_list["operation"])
- switch(href_list["operation"])
- if("plusspeed")
- speed ++
- if(speed > 10)
- speed = 10
- if("minusspeed")
- speed --
- if(speed <= 0)
- speed = 1
- if("setpath")
- var/newpath = stripped_input(usr, "Please define a new path!", "New Path", path, MAX_MESSAGE_LEN)
- if(newpath && newpath != "")
- moving = 0 // stop moving
- path = newpath
- pathpos = 1 // reset position
- filter_path() // renders rpath
-
- if("togglemoving")
- moving = !moving
- if(moving)
- spawn() MagnetMove()
-
-
- updateUsrDialog()
-
-/obj/machinery/magnetic_controller/proc/MagnetMove()
- if(looping)
- return
-
- while(moving && rpath.len >= 1)
-
- if(stat & (BROKEN|NOPOWER))
- break
-
- looping = 1
-
- // Prepare the radio signal
- var/datum/signal/signal = new(list("code" = code))
-
- if(pathpos > rpath.len) // if the position is greater than the length, we just loop through the list!
- pathpos = 1
-
- var/nextmove = uppertext(rpath[pathpos]) // makes it un-case-sensitive
-
- if(!(nextmove in list("N","S","E","W","C","R")))
- // N, S, E, W are directional
- // C is center
- // R is random (in magnetic field's bounds)
- qdel(signal)
- break // break the loop if the character located is invalid
-
- signal.data["command"] = nextmove
-
-
- pathpos++ // increase iterator
-
- // Broadcast the signal
- spawn()
- radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
-
- if(speed == 10)
- sleep(1)
- else
- sleep(12-speed)
-
- looping = 0
-
-
-/obj/machinery/magnetic_controller/proc/filter_path()
- // Generates the rpath variable using the path string, think of this as "string2list"
- // Doesn't use params2list() because of the akward way it stacks entities
- rpath = list() // clear rpath
- var/maximum_characters = 50
-
- var/lentext = length(path)
- var/nextchar = ""
- var/charcount = 0
-
- for(var/i = 1, i <= lentext, i += length(nextchar)) // iterates through all characters in path
- nextchar = path[i] // find next character
-
- if(nextchar in list(";", "&", "*", " ")) // if char is a separator, ignore
- continue
- rpath += nextchar // else, add to list
- // there doesn't HAVE to be separators but it makes paths syntatically visible
- charcount++
- if(charcount >= maximum_characters)
- break
+// Magnetic attractor, creates variable magnetic fields and attraction.
+// Can also be used to emit electron/proton beams to create a center of magnetism on another tile
+
+// tl;dr: it's magnets lol
+// This was created for firing ranges, but I suppose this could have other applications - Doohl
+
+/obj/machinery/magnetic_module
+ icon = 'icons/obj/objects.dmi'
+ icon_state = "floor_magnet-f"
+ name = "electromagnetic generator"
+ desc = "A device that uses station power to create points of magnetic energy."
+ level = 1 // underfloor
+ layer = LOW_OBJ_LAYER
+ use_power = IDLE_POWER_USE
+ idle_power_usage = 50
+
+ var/freq = FREQ_MAGNETS // radio frequency
+ var/electricity_level = 1 // intensity of the magnetic pull
+ var/magnetic_field = 1 // the range of magnetic attraction
+ var/code = 0 // frequency code, they should be different unless you have a group of magnets working together or something
+ var/turf/center // the center of magnetic attraction
+ var/on = FALSE
+ var/magneting = FALSE
+
+ // x, y modifiers to the center turf; (0, 0) is centered on the magnet, whereas (1, -1) is one tile right, one tile down
+ var/center_x = 0
+ var/center_y = 0
+ var/max_dist = 20 // absolute value of center_x,y cannot exceed this integer
+
+/obj/machinery/magnetic_module/Initialize()
+ ..()
+ var/turf/T = loc
+ hide(T.intact)
+ center = T
+ SSradio.add_object(src, freq, RADIO_MAGNETS)
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/magnetic_module/LateInitialize()
+ magnetic_process()
+
+/obj/machinery/magnetic_module/Destroy()
+ SSradio.remove_object(src, freq)
+ center = null
+ return ..()
+
+// update the invisibility and icon
+/obj/machinery/magnetic_module/hide(intact)
+ invisibility = intact ? INVISIBILITY_MAXIMUM : 0
+ update_icon()
+
+// update the icon_state
+/obj/machinery/magnetic_module/update_icon()
+ var/state="floor_magnet"
+ var/onstate=""
+ if(!on)
+ onstate="0"
+
+ if(invisibility)
+ icon_state = "[state][onstate]-f" // if invisible, set icon to faded version
+ // in case of being revealed by T-scanner
+ else
+ icon_state = "[state][onstate]"
+
+/obj/machinery/magnetic_module/receive_signal(datum/signal/signal)
+
+ var/command = signal.data["command"]
+ var/modifier = signal.data["modifier"]
+ var/signal_code = signal.data["code"]
+ if(command && (signal_code == code))
+
+ Cmd(command, modifier)
+
+
+
+/obj/machinery/magnetic_module/proc/Cmd(command, modifier)
+
+ if(command)
+ switch(command)
+ if("set-electriclevel")
+ if(modifier)
+ electricity_level = modifier
+ if("set-magneticfield")
+ if(modifier)
+ magnetic_field = modifier
+
+ if("add-elec")
+ electricity_level++
+ if(electricity_level > 12)
+ electricity_level = 12
+ if("sub-elec")
+ electricity_level--
+ if(electricity_level <= 0)
+ electricity_level = 1
+ if("add-mag")
+ magnetic_field++
+ if(magnetic_field > 4)
+ magnetic_field = 4
+ if("sub-mag")
+ magnetic_field--
+ if(magnetic_field <= 0)
+ magnetic_field = 1
+
+ if("set-x")
+ if(modifier)
+ center_x = modifier
+ if("set-y")
+ if(modifier)
+ center_y = modifier
+
+ if("N") // NORTH
+ center_y++
+ if("S") // SOUTH
+ center_y--
+ if("E") // EAST
+ center_x++
+ if("W") // WEST
+ center_x--
+ if("C") // CENTER
+ center_x = 0
+ center_y = 0
+ if("R") // RANDOM
+ center_x = rand(-max_dist, max_dist)
+ center_y = rand(-max_dist, max_dist)
+
+ if("set-code")
+ if(modifier)
+ code = modifier
+ if("toggle-power")
+ on = !on
+
+ if(on)
+ INVOKE_ASYNC(src, .proc/magnetic_process)
+
+
+
+/obj/machinery/magnetic_module/process()
+ if(stat & NOPOWER)
+ on = FALSE
+
+ // Sanity checks:
+ if(electricity_level <= 0)
+ electricity_level = 1
+ if(magnetic_field <= 0)
+ magnetic_field = 1
+
+
+ // Limitations:
+ if(abs(center_x) > max_dist)
+ center_x = max_dist
+ if(abs(center_y) > max_dist)
+ center_y = max_dist
+ if(magnetic_field > 4)
+ magnetic_field = 4
+ if(electricity_level > 12)
+ electricity_level = 12
+
+ // Update power usage:
+ if(on)
+ use_power = ACTIVE_POWER_USE
+ active_power_usage = electricity_level*15
+ else
+ use_power = NO_POWER_USE
+
+ update_icon()
+
+
+/obj/machinery/magnetic_module/proc/magnetic_process() // proc that actually does the magneting
+ if(magneting)
+ return
+ while(on)
+
+ magneting = TRUE
+ center = locate(x+center_x, y+center_y, z)
+ if(center)
+ for(var/obj/M in orange(magnetic_field, center))
+ if(!M.anchored && (M.flags_1 & CONDUCT_1))
+ step_towards(M, center)
+
+ for(var/mob/living/silicon/S in orange(magnetic_field, center))
+ if(isAI(S))
+ continue
+ step_towards(S, center)
+
+ use_power(electricity_level * 5)
+ sleep(13 - electricity_level)
+
+ magneting = FALSE
+
+
+
+
+/obj/machinery/magnetic_controller
+ name = "magnetic control console"
+ icon = 'icons/obj/airlock_machines.dmi' // uses an airlock machine icon, THINK GREEN HELP THE ENVIRONMENT - RECYCLING!
+ icon_state = "airlock_control_standby"
+ density = FALSE
+ use_power = IDLE_POWER_USE
+ idle_power_usage = 45
+ var/frequency = FREQ_MAGNETS
+ var/code = 0
+ var/list/magnets = list()
+ var/title = "Magnetic Control Console"
+ var/autolink = 0 // if set to 1, can't probe for other magnets!
+
+ var/pathpos = 1 // position in the path
+ var/path = "w;e;e;w;s;n;n;s" // text path of the magnet
+ var/speed = 1 // lowest = 1, highest = 10
+ var/list/rpath = list() // real path of the magnet, used in iterator
+
+ var/moving = 0 // 1 if scheduled to loop
+ var/looping = 0 // 1 if looping
+
+ var/datum/radio_frequency/radio_connection
+
+
+/obj/machinery/magnetic_controller/Initialize()
+ . = ..()
+ if(autolink)
+ for(var/obj/machinery/magnetic_module/M in GLOB.machines)
+ if(M.freq == frequency && M.code == code)
+ magnets.Add(M)
+
+ if(path) // check for default path
+ filter_path() // renders rpath
+ radio_connection = SSradio.add_object(src, frequency, RADIO_MAGNETS)
+
+/obj/machinery/magnetic_controller/Destroy()
+ SSradio.remove_object(src, frequency)
+ magnets = null
+ rpath = null
+ return ..()
+
+/obj/machinery/magnetic_controller/process()
+ if(magnets.len == 0 && autolink)
+ for(var/obj/machinery/magnetic_module/M in GLOB.machines)
+ if(M.freq == frequency && M.code == code)
+ magnets.Add(M)
+
+/obj/machinery/magnetic_controller/ui_interact(mob/user)
+ . = ..()
+ var/dat = "Magnetic Control Console
"
+ if(!autolink)
+ dat += {"
+ Frequency: [frequency]
+ Code: [code]
+ Probe Generators
+ "}
+
+ if(magnets.len >= 1)
+
+ dat += "Magnets confirmed:
"
+ var/i = 0
+ for(var/obj/machinery/magnetic_module/M in magnets)
+ i++
+ dat += " < \[[i]\] ([M.on ? "On":"Off"]) | Electricity level: - [M.electricity_level] +; Magnetic field: - [M.magnetic_field] +
"
+
+ dat += "
Speed: - [speed] +
"
+ dat += "Path: {[path]}
"
+ dat += "Moving: [moving ? "Enabled":"Disabled"]"
+
+
+ user << browse(dat, "window=magnet;size=400x500")
+ onclose(user, "magnet")
+
+/obj/machinery/magnetic_controller/Topic(href, href_list)
+ if(..())
+ return
+ usr.set_machine(src)
+
+ if(href_list["radio-op"])
+
+ // Prepare signal beforehand, because this is a radio operation
+ var/datum/signal/signal = new(list("code" = code))
+
+ // Apply any necessary commands
+ switch(href_list["radio-op"])
+ if("togglepower")
+ signal.data["command"] = "toggle-power"
+
+ if("minuselec")
+ signal.data["command"] = "sub-elec"
+ if("pluselec")
+ signal.data["command"] = "add-elec"
+
+ if("minusmag")
+ signal.data["command"] = "sub-mag"
+ if("plusmag")
+ signal.data["command"] = "add-mag"
+
+
+ // Broadcast the signal
+
+ radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
+
+ spawn(1)
+ updateUsrDialog() // pretty sure this increases responsiveness
+
+ if(href_list["operation"])
+ switch(href_list["operation"])
+ if("plusspeed")
+ speed ++
+ if(speed > 10)
+ speed = 10
+ if("minusspeed")
+ speed --
+ if(speed <= 0)
+ speed = 1
+ if("setpath")
+ var/newpath = stripped_input(usr, "Please define a new path!", "New Path", path, MAX_MESSAGE_LEN)
+ if(newpath && newpath != "")
+ moving = 0 // stop moving
+ path = newpath
+ pathpos = 1 // reset position
+ filter_path() // renders rpath
+
+ if("togglemoving")
+ moving = !moving
+ if(moving)
+ spawn() MagnetMove()
+
+
+ updateUsrDialog()
+
+/obj/machinery/magnetic_controller/proc/MagnetMove()
+ if(looping)
+ return
+
+ while(moving && rpath.len >= 1)
+
+ if(stat & (BROKEN|NOPOWER))
+ break
+
+ looping = 1
+
+ // Prepare the radio signal
+ var/datum/signal/signal = new(list("code" = code))
+
+ if(pathpos > rpath.len) // if the position is greater than the length, we just loop through the list!
+ pathpos = 1
+
+ var/nextmove = uppertext(rpath[pathpos]) // makes it un-case-sensitive
+
+ if(!(nextmove in list("N","S","E","W","C","R")))
+ // N, S, E, W are directional
+ // C is center
+ // R is random (in magnetic field's bounds)
+ qdel(signal)
+ break // break the loop if the character located is invalid
+
+ signal.data["command"] = nextmove
+
+
+ pathpos++ // increase iterator
+
+ // Broadcast the signal
+ spawn()
+ radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
+
+ if(speed == 10)
+ sleep(1)
+ else
+ sleep(12-speed)
+
+ looping = 0
+
+
+/obj/machinery/magnetic_controller/proc/filter_path()
+ // Generates the rpath variable using the path string, think of this as "string2list"
+ // Doesn't use params2list() because of the akward way it stacks entities
+ rpath = list() // clear rpath
+ var/maximum_characters = 50
+
+ var/lentext = length(path)
+ var/nextchar = ""
+ var/charcount = 0
+
+ for(var/i = 1, i <= lentext, i += length(nextchar)) // iterates through all characters in path
+ nextchar = path[i] // find next character
+
+ if(nextchar in list(";", "&", "*", " ")) // if char is a separator, ignore
+ continue
+ rpath += nextchar // else, add to list
+ // there doesn't HAVE to be separators but it makes paths syntatically visible
+ charcount++
+ if(charcount >= maximum_characters)
+ break
diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm
index 38416e94..7dc651e3 100644
--- a/code/game/machinery/navbeacon.dm
+++ b/code/game/machinery/navbeacon.dm
@@ -1,214 +1,214 @@
-// Navigation beacon for AI robots
-// No longer exists on the radio controller, it is managed by a global list.
-
-/obj/machinery/navbeacon
-
- icon = 'icons/obj/objects.dmi'
- icon_state = "navbeacon0-f"
- name = "navigation beacon"
- desc = "A radio beacon used for bot navigation."
- level = 1 // underfloor
- layer = LOW_OBJ_LAYER
- max_integrity = 500
- armor = list("melee" = 70, "bullet" = 70, "laser" = 70, "energy" = 70, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80)
-
- var/open = FALSE // true if cover is open
- var/locked = TRUE // true if controls are locked
- var/freq = FREQ_NAV_BEACON
- var/location = "" // location response text
- var/list/codes // assoc. list of transponder codes
- var/codes_txt = "" // codes as set on map: "tag1;tag2" or "tag1=value;tag2=value"
-
- req_one_access = list(ACCESS_ENGINE, ACCESS_ROBOTICS)
-
-/obj/machinery/navbeacon/Initialize()
- . = ..()
-
- set_codes()
-
- var/turf/T = loc
- hide(T.intact)
- if(codes["patrol"])
- if(!GLOB.navbeacons["[z]"])
- GLOB.navbeacons["[z]"] = list()
- GLOB.navbeacons["[z]"] += src //Register with the patrol list!
- if(codes["delivery"])
- GLOB.deliverybeacons += src
- GLOB.deliverybeacontags += location
-
-/obj/machinery/navbeacon/Destroy()
- if (GLOB.navbeacons["[z]"])
- GLOB.navbeacons["[z]"] -= src //Remove from beacon list, if in one.
- GLOB.deliverybeacons -= src
- return ..()
-
-/obj/machinery/navbeacon/onTransitZ(old_z, new_z)
- if (GLOB.navbeacons["[old_z]"])
- GLOB.navbeacons["[old_z]"] -= src
- if (GLOB.navbeacons["[new_z]"])
- GLOB.navbeacons["[new_z]"] += src
- ..()
-
-// set the transponder codes assoc list from codes_txt
-/obj/machinery/navbeacon/proc/set_codes()
- if(!codes_txt)
- return
-
- codes = new()
-
- var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons
-
- for(var/e in entries)
- var/index = findtext(e, "=") // format is "key=value"
- if(index)
- var/key = copytext(e, 1, index)
- var/val = copytext(e, index + length(e[index]))
- codes[key] = val
- else
- codes[e] = "1"
-
-
-// called when turf state changes
-// hide the object if turf is intact
-/obj/machinery/navbeacon/hide(intact)
- invisibility = intact ? INVISIBILITY_MAXIMUM : 0
- updateicon()
-
-// update the icon_state
-/obj/machinery/navbeacon/proc/updateicon()
- var/state="navbeacon[open]"
-
- if(invisibility)
- icon_state = "[state]-f" // if invisible, set icon to faded version
- // in case revealed by T-scanner
- else
- icon_state = "[state]"
-
-/obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params)
- var/turf/T = loc
- if(T.intact)
- return // prevent intraction when T-scanner revealed
-
- if(istype(I, /obj/item/screwdriver))
- open = !open
-
- user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "You [open ? "open" : "close"] the beacon's cover.")
-
- updateicon()
-
- else if (istype(I, /obj/item/card/id)||istype(I, /obj/item/pda))
- if(open)
- if (src.allowed(user))
- src.locked = !src.locked
- to_chat(user, "Controls are now [src.locked ? "locked" : "unlocked"].")
- else
- to_chat(user, "Access denied.")
- updateDialog()
- else
- to_chat(user, "You must open the cover first!")
- else
- return ..()
-
-/obj/machinery/navbeacon/attack_ai(mob/user)
- interact(user, 1)
-
-/obj/machinery/navbeacon/attack_paw()
- return
-
-/obj/machinery/navbeacon/ui_interact(mob/user)
- . = ..()
- var/ai = isAI(user)
- var/turf/T = loc
- if(T.intact)
- return // prevent intraction when T-scanner revealed
-
- if(!open && !ai) // can't alter controls if not open, unless you're an AI
- to_chat(user, "The beacon's control cover is closed!")
- return
-
-
- var/t
-
- if(locked && !ai)
- t = {"Navigation Beacon
-(swipe card to unlock controls)
-Location: [location ? location : "(none)"]
-Transponder Codes:"}
-
- for(var/key in codes)
- t += "- [key] ... [codes[key]]"
- t+= "
"
-
- else
-
- t = {"Navigation Beacon
-(swipe card to lock controls)
-
-
-Location: [location ? location : "None"]
-Transponder Codes:"}
-
- for(var/key in codes)
- t += "- [key] ... [codes[key]]"
- t += " Edit"
- t += " Delete
"
- t += " Add New
"
- t+= "
"
-
- var/datum/browser/popup = new(user, "navbeacon", "Navigation Beacon", 300, 400)
- popup.set_content(t)
- popup.open()
- return
-
-/obj/machinery/navbeacon/Topic(href, href_list)
- if(..())
- return
- if(open && !locked)
- usr.set_machine(src)
-
- if(href_list["locedit"])
- var/newloc = stripped_input(usr, "Enter New Location", "Navigation Beacon", location, MAX_MESSAGE_LEN)
- if(newloc)
- location = newloc
- updateDialog()
-
- else if(href_list["edit"])
- var/codekey = href_list["code"]
-
- var/newkey = stripped_input(usr, "Enter Transponder Code Key", "Navigation Beacon", codekey)
- if(!newkey)
- return
-
- var/codeval = codes[codekey]
- var/newval = stripped_input(usr, "Enter Transponder Code Value", "Navigation Beacon", codeval)
- if(!newval)
- newval = codekey
- return
-
- codes.Remove(codekey)
- codes[newkey] = newval
-
- updateDialog()
-
- else if(href_list["delete"])
- var/codekey = href_list["code"]
- codes.Remove(codekey)
- updateDialog()
-
- else if(href_list["add"])
-
- var/newkey = stripped_input(usr, "Enter New Transponder Code Key", "Navigation Beacon")
- if(!newkey)
- return
-
- var/newval = stripped_input(usr, "Enter New Transponder Code Value", "Navigation Beacon")
- if(!newval)
- newval = "1"
- return
-
- if(!codes)
- codes = new()
-
- codes[newkey] = newval
-
- updateDialog()
+// Navigation beacon for AI robots
+// No longer exists on the radio controller, it is managed by a global list.
+
+/obj/machinery/navbeacon
+
+ icon = 'icons/obj/objects.dmi'
+ icon_state = "navbeacon0-f"
+ name = "navigation beacon"
+ desc = "A radio beacon used for bot navigation."
+ level = 1 // underfloor
+ layer = LOW_OBJ_LAYER
+ max_integrity = 500
+ armor = list("melee" = 70, "bullet" = 70, "laser" = 70, "energy" = 70, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80)
+
+ var/open = FALSE // true if cover is open
+ var/locked = TRUE // true if controls are locked
+ var/freq = FREQ_NAV_BEACON
+ var/location = "" // location response text
+ var/list/codes // assoc. list of transponder codes
+ var/codes_txt = "" // codes as set on map: "tag1;tag2" or "tag1=value;tag2=value"
+
+ req_one_access = list(ACCESS_ENGINE, ACCESS_ROBOTICS)
+
+/obj/machinery/navbeacon/Initialize()
+ . = ..()
+
+ set_codes()
+
+ var/turf/T = loc
+ hide(T.intact)
+ if(codes["patrol"])
+ if(!GLOB.navbeacons["[z]"])
+ GLOB.navbeacons["[z]"] = list()
+ GLOB.navbeacons["[z]"] += src //Register with the patrol list!
+ if(codes["delivery"])
+ GLOB.deliverybeacons += src
+ GLOB.deliverybeacontags += location
+
+/obj/machinery/navbeacon/Destroy()
+ if (GLOB.navbeacons["[z]"])
+ GLOB.navbeacons["[z]"] -= src //Remove from beacon list, if in one.
+ GLOB.deliverybeacons -= src
+ return ..()
+
+/obj/machinery/navbeacon/onTransitZ(old_z, new_z)
+ if (GLOB.navbeacons["[old_z]"])
+ GLOB.navbeacons["[old_z]"] -= src
+ if (GLOB.navbeacons["[new_z]"])
+ GLOB.navbeacons["[new_z]"] += src
+ ..()
+
+// set the transponder codes assoc list from codes_txt
+/obj/machinery/navbeacon/proc/set_codes()
+ if(!codes_txt)
+ return
+
+ codes = new()
+
+ var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons
+
+ for(var/e in entries)
+ var/index = findtext(e, "=") // format is "key=value"
+ if(index)
+ var/key = copytext(e, 1, index)
+ var/val = copytext(e, index + length(e[index]))
+ codes[key] = val
+ else
+ codes[e] = "1"
+
+
+// called when turf state changes
+// hide the object if turf is intact
+/obj/machinery/navbeacon/hide(intact)
+ invisibility = intact ? INVISIBILITY_MAXIMUM : 0
+ update_icon()
+
+// update the icon_state
+/obj/machinery/navbeacon/update_icon()
+ var/state="navbeacon[open]"
+
+ if(invisibility)
+ icon_state = "[state]-f" // if invisible, set icon to faded version
+ // in case revealed by T-scanner
+ else
+ icon_state = "[state]"
+
+/obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params)
+ var/turf/T = loc
+ if(T.intact)
+ return // prevent intraction when T-scanner revealed
+
+ if(istype(I, /obj/item/screwdriver))
+ open = !open
+
+ user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "You [open ? "open" : "close"] the beacon's cover.")
+
+ update_icon()
+
+ else if (istype(I, /obj/item/card/id)||istype(I, /obj/item/pda))
+ if(open)
+ if (src.allowed(user))
+ src.locked = !src.locked
+ to_chat(user, "Controls are now [src.locked ? "locked" : "unlocked"].")
+ else
+ to_chat(user, "Access denied.")
+ updateDialog()
+ else
+ to_chat(user, "You must open the cover first!")
+ else
+ return ..()
+
+/obj/machinery/navbeacon/attack_ai(mob/user)
+ interact(user, 1)
+
+/obj/machinery/navbeacon/attack_paw()
+ return
+
+/obj/machinery/navbeacon/ui_interact(mob/user)
+ . = ..()
+ var/ai = isAI(user)
+ var/turf/T = loc
+ if(T.intact)
+ return // prevent intraction when T-scanner revealed
+
+ if(!open && !ai) // can't alter controls if not open, unless you're an AI
+ to_chat(user, "The beacon's control cover is closed!")
+ return
+
+
+ var/t
+
+ if(locked && !ai)
+ t = {"Navigation Beacon
+(swipe card to unlock controls)
+Location: [location ? location : "(none)"]
+Transponder Codes:"}
+
+ for(var/key in codes)
+ t += "- [key] ... [codes[key]]"
+ t+= "
"
+
+ else
+
+ t = {"Navigation Beacon
+(swipe card to lock controls)
+
+
+Location: [location ? location : "None"]
+Transponder Codes:"}
+
+ for(var/key in codes)
+ t += "- [key] ... [codes[key]]"
+ t += " Edit"
+ t += " Delete
"
+ t += " Add New
"
+ t+= "
"
+
+ var/datum/browser/popup = new(user, "navbeacon", "Navigation Beacon", 300, 400)
+ popup.set_content(t)
+ popup.open()
+ return
+
+/obj/machinery/navbeacon/Topic(href, href_list)
+ if(..())
+ return
+ if(open && !locked)
+ usr.set_machine(src)
+
+ if(href_list["locedit"])
+ var/newloc = stripped_input(usr, "Enter New Location", "Navigation Beacon", location, MAX_MESSAGE_LEN)
+ if(newloc)
+ location = newloc
+ updateDialog()
+
+ else if(href_list["edit"])
+ var/codekey = href_list["code"]
+
+ var/newkey = stripped_input(usr, "Enter Transponder Code Key", "Navigation Beacon", codekey)
+ if(!newkey)
+ return
+
+ var/codeval = codes[codekey]
+ var/newval = stripped_input(usr, "Enter Transponder Code Value", "Navigation Beacon", codeval)
+ if(!newval)
+ newval = codekey
+ return
+
+ codes.Remove(codekey)
+ codes[newkey] = newval
+
+ updateDialog()
+
+ else if(href_list["delete"])
+ var/codekey = href_list["code"]
+ codes.Remove(codekey)
+ updateDialog()
+
+ else if(href_list["add"])
+
+ var/newkey = stripped_input(usr, "Enter New Transponder Code Key", "Navigation Beacon")
+ if(!newkey)
+ return
+
+ var/newval = stripped_input(usr, "Enter New Transponder Code Value", "Navigation Beacon")
+ if(!newval)
+ newval = "1"
+ return
+
+ if(!codes)
+ codes = new()
+
+ codes[newkey] = newval
+
+ updateDialog()
diff --git a/code/game/objects/items/pneumaticCannon.dm b/code/game/objects/items/pneumaticCannon.dm
index 72d27ae5..e63b4d7a 100644
--- a/code/game/objects/items/pneumaticCannon.dm
+++ b/code/game/objects/items/pneumaticCannon.dm
@@ -213,7 +213,7 @@
loadedWeightClass -= I.w_class
else if (A == tank)
tank = null
- update_icons()
+ update_icon()
/obj/item/pneumatic_cannon/ghetto //Obtainable by improvised methods; more gas per use, less capacity, but smaller
name = "improvised pneumatic cannon"
@@ -239,14 +239,13 @@
return
to_chat(user, "You hook \the [thetank] up to \the [src].")
tank = thetank
- update_icons()
+ update_icon()
-/obj/item/pneumatic_cannon/proc/update_icons()
+/obj/item/pneumatic_cannon/update_icon()
cut_overlays()
if(!tank)
return
add_overlay(tank.icon_state)
- update_icon()
/obj/item/pneumatic_cannon/proc/fill_with_type(type, amount)
if(!ispath(type, /obj) && !ispath(type, /mob))
diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm
index 811d5f24..91b8021d 100644
--- a/code/game/objects/items/robot/robot_parts.dm
+++ b/code/game/objects/items/robot/robot_parts.dm
@@ -1,413 +1,413 @@
-
-
-//The robot bodyparts have been moved to code/module/surgery/bodyparts/robot_bodyparts.dm
-
-
-/obj/item/robot_suit
- name = "cyborg endoskeleton"
- desc = "A complex metal backbone with standard limb sockets and pseudomuscle anchors."
- icon = 'icons/mob/augmentation/augments.dmi'
- icon_state = "robo_suit"
- var/obj/item/bodypart/l_arm/robot/l_arm = null
- var/obj/item/bodypart/r_arm/robot/r_arm = null
- var/obj/item/bodypart/l_leg/robot/l_leg = null
- var/obj/item/bodypart/r_leg/robot/r_leg = null
- var/obj/item/bodypart/chest/robot/chest = null
- var/obj/item/bodypart/head/robot/head = null
-
- var/created_name = ""
- var/mob/living/silicon/ai/forced_ai
- var/locomotion = 1
- var/lawsync = 1
- var/aisync = 1
- var/panel_locked = TRUE
-
-/obj/item/robot_suit/New()
- ..()
- updateicon()
-
-/obj/item/robot_suit/prebuilt/New()
- l_arm = new(src)
- r_arm = new(src)
- l_leg = new(src)
- r_leg = new(src)
- head = new(src)
- head.flash1 = new(head)
- head.flash2 = new(head)
- chest = new(src)
- chest.wired = TRUE
- chest.cell = new /obj/item/stock_parts/cell/high/plus(chest)
- ..()
-
-/obj/item/robot_suit/proc/updateicon()
- cut_overlays()
- if(l_arm)
- add_overlay("[l_arm.icon_state]+o")
- if(r_arm)
- add_overlay("[r_arm.icon_state]+o")
- if(chest)
- add_overlay("[chest.icon_state]+o")
- if(l_leg)
- add_overlay("[l_leg.icon_state]+o")
- if(r_leg)
- add_overlay("[r_leg.icon_state]+o")
- if(head)
- add_overlay("[head.icon_state]+o")
-
-/obj/item/robot_suit/proc/check_completion()
- if(src.l_arm && src.r_arm)
- if(src.l_leg && src.r_leg)
- if(src.chest && src.head)
- SSblackbox.record_feedback("amount", "cyborg_frames_built", 1)
- return 1
- return 0
-
-/obj/item/robot_suit/wrench_act(mob/living/user, obj/item/I) //Deconstucts empty borg shell. Flashes remain unbroken because they haven't been used yet
- var/turf/T = get_turf(src)
- if(l_leg || r_leg || chest || l_arm || r_arm || head)
- if(I.use_tool(src, user, 5, volume=50))
- if(l_leg)
- l_leg.forceMove(T)
- l_leg = null
- if(r_leg)
- r_leg.forceMove(T)
- r_leg = null
- if(chest)
- if (chest.cell) //Sanity check.
- chest.cell.forceMove(T)
- chest.cell = null
- chest.forceMove(T)
- new /obj/item/stack/cable_coil(T, 1)
- chest.wired = FALSE
- chest = null
- if(l_arm)
- l_arm.forceMove(T)
- l_arm = null
- if(r_arm)
- r_arm.forceMove(T)
- r_arm = null
- if(head)
- head.forceMove(T)
- head.flash1.forceMove(T)
- head.flash1 = null
- head.flash2.forceMove(T)
- head.flash2 = null
- head = null
- to_chat(user, "You disassemble the cyborg shell.")
- else
- to_chat(user, "There is nothing to remove from the endoskeleton.")
- updateicon()
-
-/obj/item/robot_suit/proc/put_in_hand_or_drop(mob/living/user, obj/item/I) //normal put_in_hands() drops the item ontop of the player, this drops it at the suit's loc
- if(!user.put_in_hands(I))
- I.forceMove(drop_location())
- return FALSE
- return TRUE
-
-/obj/item/robot_suit/screwdriver_act(mob/living/user, obj/item/I) //Swaps the power cell if you're holding a new one in your other hand.
- . = ..()
- if(.)
- return TRUE
-
- if(!chest) //can't remove a cell if there's no chest to remove it from.
- to_chat(user, "[src] has no attached torso.")
- return
-
- var/obj/item/stock_parts/cell/temp_cell = user.is_holding_item_of_type(/obj/item/stock_parts/cell)
- var/swap_failed
- if(!temp_cell) //if we're not holding a cell
- swap_failed = TRUE
- else if(!user.transferItemToLoc(temp_cell, chest))
- swap_failed = TRUE
- to_chat(user, "[temp_cell] is stuck to your hand, you can't put it in [src]!")
-
- if(chest.cell) //drop the chest's current cell no matter what.
- put_in_hand_or_drop(user, chest.cell)
-
- if(swap_failed) //we didn't transfer any new items.
- if(chest.cell) //old cell ejected, nothing inserted.
- to_chat(user, "You remove [chest.cell] from [src].")
- chest.cell = null
- else
- to_chat(user, "The power cell slot in [src]'s torso is empty.")
- return
-
- to_chat(user, "You [chest.cell ? "replace [src]'s [chest.cell.name] with [temp_cell]" : "insert [temp_cell] into [src]"].")
- chest.cell = temp_cell
- return TRUE
-
-/obj/item/robot_suit/attackby(obj/item/W, mob/user, params)
-
- if(istype(W, /obj/item/stack/sheet/metal))
- var/obj/item/stack/sheet/metal/M = W
- if(!l_arm && !r_arm && !l_leg && !r_leg && !chest && !head)
- if (M.use(1))
- var/obj/item/bot_assembly/ed209/B = new
- B.forceMove(drop_location())
- to_chat(user, "You arm the robot frame.")
- var/holding_this = user.get_inactive_held_item()==src
- qdel(src)
- if (holding_this)
- user.put_in_inactive_hand(B)
- else
- to_chat(user, "You need one sheet of metal to start building ED-209!")
- return
- else if(istype(W, /obj/item/bodypart/l_leg/robot))
- if(src.l_leg)
- return
- if(!user.transferItemToLoc(W, src))
- return
- W.icon_state = initial(W.icon_state)
- W.cut_overlays()
- src.l_leg = W
- src.updateicon()
-
- else if(istype(W, /obj/item/bodypart/r_leg/robot))
- if(src.r_leg)
- return
- if(!user.transferItemToLoc(W, src))
- return
- W.icon_state = initial(W.icon_state)
- W.cut_overlays()
- src.r_leg = W
- src.updateicon()
-
- else if(istype(W, /obj/item/bodypart/l_arm/robot))
- if(src.l_arm)
- return
- if(!user.transferItemToLoc(W, src))
- return
- W.icon_state = initial(W.icon_state)
- W.cut_overlays()
- src.l_arm = W
- src.updateicon()
-
- else if(istype(W, /obj/item/bodypart/r_arm/robot))
- if(src.r_arm)
- return
- if(!user.transferItemToLoc(W, src))
- return
- W.icon_state = initial(W.icon_state)//in case it is a dismembered robotic limb
- W.cut_overlays()
- src.r_arm = W
- src.updateicon()
-
- else if(istype(W, /obj/item/bodypart/chest/robot))
- var/obj/item/bodypart/chest/robot/CH = W
- if(src.chest)
- return
- if(CH.wired && CH.cell)
- if(!user.transferItemToLoc(CH, src))
- return
- CH.icon_state = initial(CH.icon_state) //in case it is a dismembered robotic limb
- CH.cut_overlays()
- src.chest = CH
- src.updateicon()
- else if(!CH.wired)
- to_chat(user, "You need to attach wires to it first!")
- else
- to_chat(user, "You need to attach a cell to it first!")
-
- else if(istype(W, /obj/item/bodypart/head/robot))
- var/obj/item/bodypart/head/robot/HD = W
- for(var/X in HD.contents)
- if(istype(X, /obj/item/organ))
- to_chat(user, "There are organs inside [HD]!")
- return
- if(src.head)
- return
- if(HD.flash2 && HD.flash1)
- if(!user.transferItemToLoc(HD, src))
- return
- HD.icon_state = initial(HD.icon_state)//in case it is a dismembered robotic limb
- HD.cut_overlays()
- src.head = HD
- src.updateicon()
- else
- to_chat(user, "You need to attach a flash to it first!")
-
- else if (istype(W, /obj/item/multitool))
- if(check_completion())
- Interact(user)
- else
- to_chat(user, "The endoskeleton must be assembled before debugging can begin!")
-
- else if(istype(W, /obj/item/mmi))
- var/obj/item/mmi/M = W
- if(check_completion())
- if(!chest.cell)
- to_chat(user, "The endoskeleton still needs a power cell!")
- return
- if(!isturf(loc))
- to_chat(user, "You can't put [M] in, the frame has to be standing on the ground to be perfectly precise!")
- return
- if(!M.brainmob)
- to_chat(user, "Sticking an empty [M.name] into the frame would sort of defeat the purpose!")
- return
-
- var/mob/living/brain/BM = M.brainmob
- if(!BM.key || !BM.mind)
- to_chat(user, "The MMI indicates that their mind is completely unresponsive; there's no point!")
- return
-
- if(!BM.client) //braindead
- to_chat(user, "The MMI indicates that their mind is currently inactive; it might change!")
- return
-
- if(BM.stat == DEAD || (M.brain && M.brain.organ_flags & ORGAN_FAILING))
- to_chat(user, "Sticking a dead brain into the frame would sort of defeat the purpose!")
- return
-
- if(jobban_isbanned(BM, "Cyborg") || QDELETED(src) || QDELETED(BM) || QDELETED(user) || QDELETED(M) || !Adjacent(user))
- if(!QDELETED(M))
- to_chat(user, "This [M.name] does not seem to fit!")
- return
-
- if(!user.temporarilyRemoveItemFromInventory(W))
- return
-
- var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc))
- if(!O)
- return
-
- if(M.laws && M.laws.id != DEFAULT_AI_LAWID)
- aisync = 0
- lawsync = 0
- O.laws = M.laws
- M.laws.associate(O)
-
- O.invisibility = 0
- //Transfer debug settings to new mob
- O.custom_name = created_name
- O.locked = panel_locked
- if(!aisync)
- lawsync = 0
- O.set_connected_ai(null)
- else
- O.notify_ai(NEW_BORG)
- if(forced_ai)
- O.set_connected_ai(forced_ai)
- if(!lawsync)
- O.lawupdate = 0
- if(M.laws.id == DEFAULT_AI_LAWID)
- O.make_laws()
-
- SSticker.mode.remove_antag_for_borging(BM.mind)
- if(!istype(M.laws, /datum/ai_laws/ratvar))
- remove_servant_of_ratvar(BM, TRUE)
- BM.mind.transfer_to(O)
-
- if(O.mind && O.mind.special_role)
- O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.")
- to_chat(O, "You have been robotized!")
- to_chat(O, "You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.")
-
- O.job = "Cyborg"
-
- O.cell = chest.cell
- chest.cell.forceMove(O)
- chest.cell = null
- W.forceMove(O)//Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
- if(O.mmi) //we delete the mmi created by robot/New()
- qdel(O.mmi)
- O.mmi = W //and give the real mmi to the borg.
- O.updatename()
- SSblackbox.record_feedback("amount", "cyborg_birth", 1)
- forceMove(O)
- O.robot_suit = src
-
- if(!locomotion)
- O.lockcharge = 1
- O.update_canmove()
- to_chat(O, "Error: Servo motors unresponsive.")
-
- else
- to_chat(user, "The MMI must go in after everything else!")
-
- else if(istype(W, /obj/item/borg/upgrade/ai))
- var/obj/item/borg/upgrade/ai/M = W
- if(check_completion())
- if(!isturf(loc))
- to_chat(user, "You cannot install[M], the frame has to be standing on the ground to be perfectly precise!")
- return
- if(!user.temporarilyRemoveItemFromInventory(M))
- to_chat(user, "[M] is stuck to your hand!")
- return
- qdel(M)
- var/mob/living/silicon/robot/O = new /mob/living/silicon/robot/shell(get_turf(src))
-
- if(!aisync)
- lawsync = FALSE
- O.set_connected_ai(null)
- else
- if(forced_ai)
- O.set_connected_ai(forced_ai)
- O.notify_ai(AI_SHELL)
- if(!lawsync)
- O.lawupdate = FALSE
- O.make_laws()
-
-
- O.cell = chest.cell
- chest.cell.forceMove(O)
- chest.cell = null
- O.locked = panel_locked
- O.job = "Cyborg"
- forceMove(O)
- O.robot_suit = src
- if(!locomotion)
- O.lockcharge = TRUE
- O.update_canmove()
-
- else if(istype(W, /obj/item/pen))
- to_chat(user, "You need to use a multitool to name [src]!")
- else
- return ..()
-
-/obj/item/robot_suit/proc/Interact(mob/user)
- var/t1 = "Designation: [(created_name ? "[created_name]" : "Default Cyborg")]
\n"
- t1 += "Master AI: [(forced_ai ? "[forced_ai.name]" : "Automatic")]
\n"
-
- t1 += "LawSync Port: [(lawsync ? "Open" : "Closed")]
\n"
- t1 += "AI Connection Port: [(aisync ? "Open" : "Closed")]
\n"
- t1 += "Servo Motor Functions: [(locomotion ? "Unlocked" : "Locked")]
\n"
- t1 += "Panel Lock: [(panel_locked ? "Engaged" : "Disengaged")]
\n"
- var/datum/browser/popup = new(user, "robotdebug", "Cyborg Boot Debug", 310, 220)
- popup.set_content(t1)
- popup.open()
-
-/obj/item/robot_suit/Topic(href, href_list)
- if(usr.incapacitated() || !Adjacent(usr))
- return
-
- var/mob/living/living_user = usr
- var/obj/item/item_in_hand = living_user.get_active_held_item()
- if(!istype(item_in_hand, /obj/item/multitool))
- to_chat(living_user, "You need a multitool!")
- return
-
- if(href_list["Name"])
- var/new_name = reject_bad_name(input(usr, "Enter new designation. Set to blank to reset to default.", "Cyborg Debug", src.created_name), TRUE)
- if(!in_range(src, usr) && src.loc != usr)
- return
- if(new_name)
- created_name = new_name
- else
- created_name = ""
-
- else if(href_list["Master"])
- forced_ai = select_active_ai(usr)
- if(!forced_ai)
- to_chat(usr, "No active AIs detected.")
-
- else if(href_list["Law"])
- lawsync = !lawsync
- else if(href_list["AI"])
- aisync = !aisync
- else if(href_list["Loco"])
- locomotion = !locomotion
- else if(href_list["Panel"])
- panel_locked = !panel_locked
-
- add_fingerprint(usr)
- Interact(usr)
+
+
+//The robot bodyparts have been moved to code/module/surgery/bodyparts/robot_bodyparts.dm
+
+
+/obj/item/robot_suit
+ name = "cyborg endoskeleton"
+ desc = "A complex metal backbone with standard limb sockets and pseudomuscle anchors."
+ icon = 'icons/mob/augmentation/augments.dmi'
+ icon_state = "robo_suit"
+ var/obj/item/bodypart/l_arm/robot/l_arm = null
+ var/obj/item/bodypart/r_arm/robot/r_arm = null
+ var/obj/item/bodypart/l_leg/robot/l_leg = null
+ var/obj/item/bodypart/r_leg/robot/r_leg = null
+ var/obj/item/bodypart/chest/robot/chest = null
+ var/obj/item/bodypart/head/robot/head = null
+
+ var/created_name = ""
+ var/mob/living/silicon/ai/forced_ai
+ var/locomotion = 1
+ var/lawsync = 1
+ var/aisync = 1
+ var/panel_locked = TRUE
+
+/obj/item/robot_suit/New()
+ ..()
+ update_icon()
+
+/obj/item/robot_suit/prebuilt/New()
+ l_arm = new(src)
+ r_arm = new(src)
+ l_leg = new(src)
+ r_leg = new(src)
+ head = new(src)
+ head.flash1 = new(head)
+ head.flash2 = new(head)
+ chest = new(src)
+ chest.wired = TRUE
+ chest.cell = new /obj/item/stock_parts/cell/high/plus(chest)
+ ..()
+
+/obj/item/robot_suit/update_icon()
+ cut_overlays()
+ if(l_arm)
+ add_overlay("[l_arm.icon_state]+o")
+ if(r_arm)
+ add_overlay("[r_arm.icon_state]+o")
+ if(chest)
+ add_overlay("[chest.icon_state]+o")
+ if(l_leg)
+ add_overlay("[l_leg.icon_state]+o")
+ if(r_leg)
+ add_overlay("[r_leg.icon_state]+o")
+ if(head)
+ add_overlay("[head.icon_state]+o")
+
+/obj/item/robot_suit/proc/check_completion()
+ if(src.l_arm && src.r_arm)
+ if(src.l_leg && src.r_leg)
+ if(src.chest && src.head)
+ SSblackbox.record_feedback("amount", "cyborg_frames_built", 1)
+ return 1
+ return 0
+
+/obj/item/robot_suit/wrench_act(mob/living/user, obj/item/I) //Deconstucts empty borg shell. Flashes remain unbroken because they haven't been used yet
+ var/turf/T = get_turf(src)
+ if(l_leg || r_leg || chest || l_arm || r_arm || head)
+ if(I.use_tool(src, user, 5, volume=50))
+ if(l_leg)
+ l_leg.forceMove(T)
+ l_leg = null
+ if(r_leg)
+ r_leg.forceMove(T)
+ r_leg = null
+ if(chest)
+ if (chest.cell) //Sanity check.
+ chest.cell.forceMove(T)
+ chest.cell = null
+ chest.forceMove(T)
+ new /obj/item/stack/cable_coil(T, 1)
+ chest.wired = FALSE
+ chest = null
+ if(l_arm)
+ l_arm.forceMove(T)
+ l_arm = null
+ if(r_arm)
+ r_arm.forceMove(T)
+ r_arm = null
+ if(head)
+ head.forceMove(T)
+ head.flash1.forceMove(T)
+ head.flash1 = null
+ head.flash2.forceMove(T)
+ head.flash2 = null
+ head = null
+ to_chat(user, "You disassemble the cyborg shell.")
+ else
+ to_chat(user, "There is nothing to remove from the endoskeleton.")
+ update_icon()
+
+/obj/item/robot_suit/proc/put_in_hand_or_drop(mob/living/user, obj/item/I) //normal put_in_hands() drops the item ontop of the player, this drops it at the suit's loc
+ if(!user.put_in_hands(I))
+ I.forceMove(drop_location())
+ return FALSE
+ return TRUE
+
+/obj/item/robot_suit/screwdriver_act(mob/living/user, obj/item/I) //Swaps the power cell if you're holding a new one in your other hand.
+ . = ..()
+ if(.)
+ return TRUE
+
+ if(!chest) //can't remove a cell if there's no chest to remove it from.
+ to_chat(user, "[src] has no attached torso.")
+ return
+
+ var/obj/item/stock_parts/cell/temp_cell = user.is_holding_item_of_type(/obj/item/stock_parts/cell)
+ var/swap_failed
+ if(!temp_cell) //if we're not holding a cell
+ swap_failed = TRUE
+ else if(!user.transferItemToLoc(temp_cell, chest))
+ swap_failed = TRUE
+ to_chat(user, "[temp_cell] is stuck to your hand, you can't put it in [src]!")
+
+ if(chest.cell) //drop the chest's current cell no matter what.
+ put_in_hand_or_drop(user, chest.cell)
+
+ if(swap_failed) //we didn't transfer any new items.
+ if(chest.cell) //old cell ejected, nothing inserted.
+ to_chat(user, "You remove [chest.cell] from [src].")
+ chest.cell = null
+ else
+ to_chat(user, "The power cell slot in [src]'s torso is empty.")
+ return
+
+ to_chat(user, "You [chest.cell ? "replace [src]'s [chest.cell.name] with [temp_cell]" : "insert [temp_cell] into [src]"].")
+ chest.cell = temp_cell
+ return TRUE
+
+/obj/item/robot_suit/attackby(obj/item/W, mob/user, params)
+
+ if(istype(W, /obj/item/stack/sheet/metal))
+ var/obj/item/stack/sheet/metal/M = W
+ if(!l_arm && !r_arm && !l_leg && !r_leg && !chest && !head)
+ if (M.use(1))
+ var/obj/item/bot_assembly/ed209/B = new
+ B.forceMove(drop_location())
+ to_chat(user, "You arm the robot frame.")
+ var/holding_this = user.get_inactive_held_item()==src
+ qdel(src)
+ if (holding_this)
+ user.put_in_inactive_hand(B)
+ else
+ to_chat(user, "You need one sheet of metal to start building ED-209!")
+ return
+ else if(istype(W, /obj/item/bodypart/l_leg/robot))
+ if(src.l_leg)
+ return
+ if(!user.transferItemToLoc(W, src))
+ return
+ W.icon_state = initial(W.icon_state)
+ W.cut_overlays()
+ src.l_leg = W
+ update_icon()
+
+ else if(istype(W, /obj/item/bodypart/r_leg/robot))
+ if(src.r_leg)
+ return
+ if(!user.transferItemToLoc(W, src))
+ return
+ W.icon_state = initial(W.icon_state)
+ W.cut_overlays()
+ src.r_leg = W
+ update_icon()
+
+ else if(istype(W, /obj/item/bodypart/l_arm/robot))
+ if(src.l_arm)
+ return
+ if(!user.transferItemToLoc(W, src))
+ return
+ W.icon_state = initial(W.icon_state)
+ W.cut_overlays()
+ src.l_arm = W
+ update_icon()
+
+ else if(istype(W, /obj/item/bodypart/r_arm/robot))
+ if(src.r_arm)
+ return
+ if(!user.transferItemToLoc(W, src))
+ return
+ W.icon_state = initial(W.icon_state)//in case it is a dismembered robotic limb
+ W.cut_overlays()
+ src.r_arm = W
+ update_icon()
+
+ else if(istype(W, /obj/item/bodypart/chest/robot))
+ var/obj/item/bodypart/chest/robot/CH = W
+ if(src.chest)
+ return
+ if(CH.wired && CH.cell)
+ if(!user.transferItemToLoc(CH, src))
+ return
+ CH.icon_state = initial(CH.icon_state) //in case it is a dismembered robotic limb
+ CH.cut_overlays()
+ src.chest = CH
+ update_icon()
+ else if(!CH.wired)
+ to_chat(user, "You need to attach wires to it first!")
+ else
+ to_chat(user, "You need to attach a cell to it first!")
+
+ else if(istype(W, /obj/item/bodypart/head/robot))
+ var/obj/item/bodypart/head/robot/HD = W
+ for(var/X in HD.contents)
+ if(istype(X, /obj/item/organ))
+ to_chat(user, "There are organs inside [HD]!")
+ return
+ if(src.head)
+ return
+ if(HD.flash2 && HD.flash1)
+ if(!user.transferItemToLoc(HD, src))
+ return
+ HD.icon_state = initial(HD.icon_state)//in case it is a dismembered robotic limb
+ HD.cut_overlays()
+ src.head = HD
+ update_icon()
+ else
+ to_chat(user, "You need to attach a flash to it first!")
+
+ else if (istype(W, /obj/item/multitool))
+ if(check_completion())
+ Interact(user)
+ else
+ to_chat(user, "The endoskeleton must be assembled before debugging can begin!")
+
+ else if(istype(W, /obj/item/mmi))
+ var/obj/item/mmi/M = W
+ if(check_completion())
+ if(!chest.cell)
+ to_chat(user, "The endoskeleton still needs a power cell!")
+ return
+ if(!isturf(loc))
+ to_chat(user, "You can't put [M] in, the frame has to be standing on the ground to be perfectly precise!")
+ return
+ if(!M.brainmob)
+ to_chat(user, "Sticking an empty [M.name] into the frame would sort of defeat the purpose!")
+ return
+
+ var/mob/living/brain/BM = M.brainmob
+ if(!BM.key || !BM.mind)
+ to_chat(user, "The MMI indicates that their mind is completely unresponsive; there's no point!")
+ return
+
+ if(!BM.client) //braindead
+ to_chat(user, "The MMI indicates that their mind is currently inactive; it might change!")
+ return
+
+ if(BM.stat == DEAD || (M.brain && M.brain.organ_flags & ORGAN_FAILING))
+ to_chat(user, "Sticking a dead brain into the frame would sort of defeat the purpose!")
+ return
+
+ if(jobban_isbanned(BM, "Cyborg") || QDELETED(src) || QDELETED(BM) || QDELETED(user) || QDELETED(M) || !Adjacent(user))
+ if(!QDELETED(M))
+ to_chat(user, "This [M.name] does not seem to fit!")
+ return
+
+ if(!user.temporarilyRemoveItemFromInventory(W))
+ return
+
+ var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc))
+ if(!O)
+ return
+
+ if(M.laws && M.laws.id != DEFAULT_AI_LAWID)
+ aisync = 0
+ lawsync = 0
+ O.laws = M.laws
+ M.laws.associate(O)
+
+ O.invisibility = 0
+ //Transfer debug settings to new mob
+ O.custom_name = created_name
+ O.locked = panel_locked
+ if(!aisync)
+ lawsync = 0
+ O.set_connected_ai(null)
+ else
+ O.notify_ai(NEW_BORG)
+ if(forced_ai)
+ O.set_connected_ai(forced_ai)
+ if(!lawsync)
+ O.lawupdate = 0
+ if(M.laws.id == DEFAULT_AI_LAWID)
+ O.make_laws()
+
+ SSticker.mode.remove_antag_for_borging(BM.mind)
+ if(!istype(M.laws, /datum/ai_laws/ratvar))
+ remove_servant_of_ratvar(BM, TRUE)
+ BM.mind.transfer_to(O)
+
+ if(O.mind && O.mind.special_role)
+ O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.")
+ to_chat(O, "You have been robotized!")
+ to_chat(O, "You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.")
+
+ O.job = "Cyborg"
+
+ O.cell = chest.cell
+ chest.cell.forceMove(O)
+ chest.cell = null
+ W.forceMove(O)//Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
+ if(O.mmi) //we delete the mmi created by robot/New()
+ qdel(O.mmi)
+ O.mmi = W //and give the real mmi to the borg.
+ O.updatename()
+ SSblackbox.record_feedback("amount", "cyborg_birth", 1)
+ forceMove(O)
+ O.robot_suit = src
+
+ if(!locomotion)
+ O.lockcharge = 1
+ O.update_canmove()
+ to_chat(O, "Error: Servo motors unresponsive.")
+
+ else
+ to_chat(user, "The MMI must go in after everything else!")
+
+ else if(istype(W, /obj/item/borg/upgrade/ai))
+ var/obj/item/borg/upgrade/ai/M = W
+ if(check_completion())
+ if(!isturf(loc))
+ to_chat(user, "You cannot install[M], the frame has to be standing on the ground to be perfectly precise!")
+ return
+ if(!user.temporarilyRemoveItemFromInventory(M))
+ to_chat(user, "[M] is stuck to your hand!")
+ return
+ qdel(M)
+ var/mob/living/silicon/robot/O = new /mob/living/silicon/robot/shell(get_turf(src))
+
+ if(!aisync)
+ lawsync = FALSE
+ O.set_connected_ai(null)
+ else
+ if(forced_ai)
+ O.set_connected_ai(forced_ai)
+ O.notify_ai(AI_SHELL)
+ if(!lawsync)
+ O.lawupdate = FALSE
+ O.make_laws()
+
+
+ O.cell = chest.cell
+ chest.cell.forceMove(O)
+ chest.cell = null
+ O.locked = panel_locked
+ O.job = "Cyborg"
+ forceMove(O)
+ O.robot_suit = src
+ if(!locomotion)
+ O.lockcharge = TRUE
+ O.update_canmove()
+
+ else if(istype(W, /obj/item/pen))
+ to_chat(user, "You need to use a multitool to name [src]!")
+ else
+ return ..()
+
+/obj/item/robot_suit/proc/Interact(mob/user)
+ var/t1 = "Designation: [(created_name ? "[created_name]" : "Default Cyborg")]
\n"
+ t1 += "Master AI: [(forced_ai ? "[forced_ai.name]" : "Automatic")]
\n"
+
+ t1 += "LawSync Port: [(lawsync ? "Open" : "Closed")]
\n"
+ t1 += "AI Connection Port: [(aisync ? "Open" : "Closed")]
\n"
+ t1 += "Servo Motor Functions: [(locomotion ? "Unlocked" : "Locked")]
\n"
+ t1 += "Panel Lock: [(panel_locked ? "Engaged" : "Disengaged")]
\n"
+ var/datum/browser/popup = new(user, "robotdebug", "Cyborg Boot Debug", 310, 220)
+ popup.set_content(t1)
+ popup.open()
+
+/obj/item/robot_suit/Topic(href, href_list)
+ if(usr.incapacitated() || !Adjacent(usr))
+ return
+
+ var/mob/living/living_user = usr
+ var/obj/item/item_in_hand = living_user.get_active_held_item()
+ if(!istype(item_in_hand, /obj/item/multitool))
+ to_chat(living_user, "You need a multitool!")
+ return
+
+ if(href_list["Name"])
+ var/new_name = reject_bad_name(input(usr, "Enter new designation. Set to blank to reset to default.", "Cyborg Debug", src.created_name), TRUE)
+ if(!in_range(src, usr) && src.loc != usr)
+ return
+ if(new_name)
+ created_name = new_name
+ else
+ created_name = ""
+
+ else if(href_list["Master"])
+ forced_ai = select_active_ai(usr)
+ if(!forced_ai)
+ to_chat(usr, "No active AIs detected.")
+
+ else if(href_list["Law"])
+ lawsync = !lawsync
+ else if(href_list["AI"])
+ aisync = !aisync
+ else if(href_list["Loco"])
+ locomotion = !locomotion
+ else if(href_list["Panel"])
+ panel_locked = !panel_locked
+
+ add_fingerprint(usr)
+ Interact(usr)
diff --git a/code/game/objects/structures/divine.dm b/code/game/objects/structures/divine.dm
index 91836b83..5ce34d44 100644
--- a/code/game/objects/structures/divine.dm
+++ b/code/game/objects/structures/divine.dm
@@ -40,11 +40,11 @@
last_process = world.time
to_chat(user, "The water feels warm and soothing as you touch it. The fountain immediately dries up shortly afterwards.")
user.reagents.add_reagent(/datum/reagent/medicine/omnizine/godblood,20)
- update_icons()
- addtimer(CALLBACK(src, .proc/update_icons), time_between_uses)
+ update_icon()
+ addtimer(CALLBACK(src, .proc/update_icon), time_between_uses)
-/obj/structure/healingfountain/proc/update_icons()
+/obj/structure/healingfountain/update_icon()
if(last_process + time_between_uses > world.time)
icon_state = "fountain"
else
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 32af8888..f75607df 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -820,7 +820,7 @@
robot_suit.head.flash2.burn_out()
robot_suit.head.flash2 = null
robot_suit.head = null
- robot_suit.updateicon()
+ robot_suit.update_icon()
else
new /obj/item/robot_suit(T)
new /obj/item/bodypart/l_leg/robot(T)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 018a16e4..a4cd9d92 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -1,231 +1,231 @@
-// stored_power += (pulse_strength-RAD_COLLECTOR_EFFICIENCY)*RAD_COLLECTOR_COEFFICIENT
-#define RAD_COLLECTOR_EFFICIENCY 60 // radiation needs to be over this amount to get power
-#define RAD_COLLECTOR_COEFFICIENT 100
-#define RAD_COLLECTOR_STORED_OUT 0.04 // (this*100)% of stored power outputted per tick. Doesn't actualy change output total, lower numbers just means collectors output for longer in absence of a source
-#define RAD_COLLECTOR_MINING_CONVERSION_RATE 0.00001 //This is gonna need a lot of tweaking to get right. This is the number used to calculate the conversion of watts to research points per process()
-#define RAD_COLLECTOR_OUTPUT min(stored_power, (stored_power*RAD_COLLECTOR_STORED_OUT)+1000) //Produces at least 1000 watts if it has more than that stored
-
-/obj/machinery/power/rad_collector
- name = "Radiation Collector Array"
- desc = "A device which uses Hawking Radiation and plasma to produce power."
- icon = 'icons/obj/singularity.dmi'
- icon_state = "ca"
- anchored = FALSE
- density = TRUE
- req_access = list(ACCESS_ENGINE_EQUIP)
-// use_power = NO_POWER_USE
- max_integrity = 350
- integrity_failure = 80
- circuit = /obj/item/circuitboard/machine/rad_collector
- var/obj/item/tank/internals/plasma/loaded_tank = null
- var/stored_power = 0
- var/active = 0
- var/locked = FALSE
- var/drainratio = 1
- var/powerproduction_drain = 0.001
-
- var/bitcoinproduction_drain = 0.15
- var/bitcoinmining = FALSE
- rad_insulation = RAD_EXTREME_INSULATION
-
-/obj/machinery/power/rad_collector/anchored
- anchored = TRUE
-
-/obj/machinery/power/rad_collector/Destroy()
- return ..()
-
-/obj/machinery/power/rad_collector/process()
- if(!loaded_tank)
- return
- if(!bitcoinmining)
- if(!loaded_tank.air_contents.gases[/datum/gas/plasma])
- investigate_log("out of fuel.", INVESTIGATE_SINGULO)
- playsound(src, 'sound/machines/ding.ogg', 50, 1)
- eject()
- else
- var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.gases[/datum/gas/plasma])
- loaded_tank.air_contents.gases[/datum/gas/plasma] -= gasdrained
- loaded_tank.air_contents.gases[/datum/gas/tritium] += gasdrained
- GAS_GARBAGE_COLLECT(loaded_tank.air_contents.gases)
-
- var/power_produced = RAD_COLLECTOR_OUTPUT
- add_avail(power_produced)
- stored_power-=power_produced
- else if(is_station_level(z) && SSresearch.science_tech)
- if(!loaded_tank.air_contents.gases[/datum/gas/tritium] || !loaded_tank.air_contents.gases[/datum/gas/oxygen])
- playsound(src, 'sound/machines/ding.ogg', 50, 1)
- eject()
- else
- var/gasdrained = bitcoinproduction_drain*drainratio
- loaded_tank.air_contents.gases[/datum/gas/tritium] -= gasdrained
- loaded_tank.air_contents.gases[/datum/gas/oxygen] -= gasdrained
- loaded_tank.air_contents.gases[/datum/gas/carbon_dioxide] += gasdrained*2
- GAS_GARBAGE_COLLECT(loaded_tank.air_contents.gases)
- var/bitcoins_mined = RAD_COLLECTOR_OUTPUT
- SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, bitcoins_mined*RAD_COLLECTOR_MINING_CONVERSION_RATE)
- stored_power-=bitcoins_mined
-
-/obj/machinery/power/rad_collector/interact(mob/user)
- if(anchored)
- if(!src.locked)
- toggle_power()
- user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
- "You turn the [src.name] [active? "on":"off"].")
- var/fuel
- if(loaded_tank)
- fuel = loaded_tank.air_contents.gases[/datum/gas/plasma]
- investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_SINGULO)
- return
- else
- to_chat(user, "The controls are locked!")
- return
-
-/obj/machinery/power/rad_collector/can_be_unfasten_wrench(mob/user, silent)
- if(loaded_tank)
- if(!silent)
- to_chat(user, "Remove the plasma tank first!")
- return FAILED_UNFASTEN
- return ..()
-
-/obj/machinery/power/rad_collector/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
- . = ..()
- if(. == SUCCESSFUL_UNFASTEN)
- if(anchored)
- connect_to_network()
- else
- disconnect_from_network()
-
-/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/tank/internals/plasma))
- if(!anchored)
- to_chat(user, "[src] needs to be secured to the floor first!")
- return TRUE
- if(loaded_tank)
- to_chat(user, "There's already a plasma tank loaded!")
- return TRUE
- if(panel_open)
- to_chat(user, "Close the maintenance panel first!")
- return TRUE
- if(!user.transferItemToLoc(W, src))
- return
- loaded_tank = W
- update_icons()
- else if(W.GetID())
- if(allowed(user))
- if(active)
- locked = !locked
- to_chat(user, "You [locked ? "lock" : "unlock"] the controls.")
- else
- to_chat(user, "The controls can only be locked when \the [src] is active!")
- else
- to_chat(user, "Access denied.")
- return TRUE
- else
- return ..()
-
-/obj/machinery/power/rad_collector/wrench_act(mob/living/user, obj/item/I)
- default_unfasten_wrench(user, I)
- return TRUE
-
-/obj/machinery/power/rad_collector/screwdriver_act(mob/living/user, obj/item/I)
- if(..())
- return TRUE
- if(loaded_tank)
- to_chat(user, "Remove the plasma tank first!")
- else
- default_deconstruction_screwdriver(user, icon_state, icon_state, I)
- return TRUE
-
-/obj/machinery/power/rad_collector/crowbar_act(mob/living/user, obj/item/I)
- if(loaded_tank)
- if(locked)
- to_chat(user, "The controls are locked!")
- return TRUE
- eject()
- return TRUE
- if(default_deconstruction_crowbar(I))
- return TRUE
- to_chat(user, "There isn't a tank loaded!")
- return TRUE
-
-/obj/machinery/power/rad_collector/multitool_act(mob/living/user, obj/item/I)
- if(!is_station_level(z) && !SSresearch.science_tech)
- to_chat(user, "[src] isn't linked to a research system!")
- return TRUE
- if(locked)
- to_chat(user, "[src] is locked!")
- return TRUE
- if(active)
- to_chat(user, "[src] is currently active, producing [bitcoinmining ? "research points":"power"].")
- return TRUE
- bitcoinmining = !bitcoinmining
- to_chat(user, "You [bitcoinmining ? "enable":"disable"] the research point production feature of [src].")
- return TRUE
-
-/obj/machinery/power/rad_collector/analyzer_act(mob/living/user, obj/item/I)
- if(loaded_tank)
- loaded_tank.analyzer_act(user, I)
-
-/obj/machinery/power/rad_collector/examine(mob/user)
- . = ..()
- if(active)
- if(!bitcoinmining)
- . += "[src]'s display states that it has stored [DisplayPower(stored_power)], and is processing [DisplayPower((RAD_COLLECTOR_OUTPUT)*((60 SECONDS)/SSmachines.wait))] per minute.
The plasma within it's tank is being irradiated into tritium."
- else
- . += "[src]'s display states that it's producing a total of [(stored_power*RAD_COLLECTOR_MINING_CONVERSION_RATE)*((60 SECONDS)/SSmachines.wait)] research points per minute.
The tritium and oxygen within it's tank is being combusted into carbon dioxide."
- else
- if(!bitcoinmining)
- . += "[src]'s display displays the words: \"Power production mode. Please insert Plasma. Use a multitool to change production modes.\""
- else
- . += "[src]'s display displays the words: \"Research point production mode. Please insert Tritium and Oxygen. Use a multitool to change production modes.\""
-
-/obj/machinery/power/rad_collector/obj_break(damage_flag)
- if(!(stat & BROKEN) && !(flags_1 & NODECONSTRUCT_1))
- eject()
- stat |= BROKEN
-
-/obj/machinery/power/rad_collector/proc/eject()
- locked = FALSE
- var/obj/item/tank/internals/plasma/Z = src.loaded_tank
- if (!Z)
- return
- Z.forceMove(drop_location())
- Z.layer = initial(Z.layer)
- Z.plane = initial(Z.plane)
- src.loaded_tank = null
- if(active)
- toggle_power()
- else
- update_icons()
-
-/obj/machinery/power/rad_collector/rad_act(pulse_strength)
- . = ..()
- if(loaded_tank && active && pulse_strength > RAD_COLLECTOR_EFFICIENCY)
- stored_power += (pulse_strength-RAD_COLLECTOR_EFFICIENCY)*RAD_COLLECTOR_COEFFICIENT
-
-/obj/machinery/power/rad_collector/proc/update_icons()
- cut_overlays()
- if(loaded_tank)
- add_overlay("ptank")
- if(stat & (NOPOWER|BROKEN))
- return
- if(active)
- add_overlay("on")
-
-
-/obj/machinery/power/rad_collector/proc/toggle_power()
- active = !active
- if(active)
- icon_state = "ca_on"
- flick("ca_active", src)
- else
- icon_state = "ca"
- flick("ca_deactive", src)
- update_icons()
- return
-
-#undef RAD_COLLECTOR_EFFICIENCY
-#undef RAD_COLLECTOR_COEFFICIENT
-#undef RAD_COLLECTOR_STORED_OUT
-#undef RAD_COLLECTOR_MINING_CONVERSION_RATE
-#undef RAD_COLLECTOR_OUTPUT
+// stored_power += (pulse_strength-RAD_COLLECTOR_EFFICIENCY)*RAD_COLLECTOR_COEFFICIENT
+#define RAD_COLLECTOR_EFFICIENCY 60 // radiation needs to be over this amount to get power
+#define RAD_COLLECTOR_COEFFICIENT 100
+#define RAD_COLLECTOR_STORED_OUT 0.04 // (this*100)% of stored power outputted per tick. Doesn't actualy change output total, lower numbers just means collectors output for longer in absence of a source
+#define RAD_COLLECTOR_MINING_CONVERSION_RATE 0.00001 //This is gonna need a lot of tweaking to get right. This is the number used to calculate the conversion of watts to research points per process()
+#define RAD_COLLECTOR_OUTPUT min(stored_power, (stored_power*RAD_COLLECTOR_STORED_OUT)+1000) //Produces at least 1000 watts if it has more than that stored
+
+/obj/machinery/power/rad_collector
+ name = "Radiation Collector Array"
+ desc = "A device which uses Hawking Radiation and plasma to produce power."
+ icon = 'icons/obj/singularity.dmi'
+ icon_state = "ca"
+ anchored = FALSE
+ density = TRUE
+ req_access = list(ACCESS_ENGINE_EQUIP)
+// use_power = NO_POWER_USE
+ max_integrity = 350
+ integrity_failure = 80
+ circuit = /obj/item/circuitboard/machine/rad_collector
+ var/obj/item/tank/internals/plasma/loaded_tank = null
+ var/stored_power = 0
+ var/active = 0
+ var/locked = FALSE
+ var/drainratio = 1
+ var/powerproduction_drain = 0.001
+
+ var/bitcoinproduction_drain = 0.15
+ var/bitcoinmining = FALSE
+ rad_insulation = RAD_EXTREME_INSULATION
+
+/obj/machinery/power/rad_collector/anchored
+ anchored = TRUE
+
+/obj/machinery/power/rad_collector/Destroy()
+ return ..()
+
+/obj/machinery/power/rad_collector/process()
+ if(!loaded_tank)
+ return
+ if(!bitcoinmining)
+ if(!loaded_tank.air_contents.gases[/datum/gas/plasma])
+ investigate_log("out of fuel.", INVESTIGATE_SINGULO)
+ playsound(src, 'sound/machines/ding.ogg', 50, 1)
+ eject()
+ else
+ var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.gases[/datum/gas/plasma])
+ loaded_tank.air_contents.gases[/datum/gas/plasma] -= gasdrained
+ loaded_tank.air_contents.gases[/datum/gas/tritium] += gasdrained
+ GAS_GARBAGE_COLLECT(loaded_tank.air_contents.gases)
+
+ var/power_produced = RAD_COLLECTOR_OUTPUT
+ add_avail(power_produced)
+ stored_power-=power_produced
+ else if(is_station_level(z) && SSresearch.science_tech)
+ if(!loaded_tank.air_contents.gases[/datum/gas/tritium] || !loaded_tank.air_contents.gases[/datum/gas/oxygen])
+ playsound(src, 'sound/machines/ding.ogg', 50, 1)
+ eject()
+ else
+ var/gasdrained = bitcoinproduction_drain*drainratio
+ loaded_tank.air_contents.gases[/datum/gas/tritium] -= gasdrained
+ loaded_tank.air_contents.gases[/datum/gas/oxygen] -= gasdrained
+ loaded_tank.air_contents.gases[/datum/gas/carbon_dioxide] += gasdrained*2
+ GAS_GARBAGE_COLLECT(loaded_tank.air_contents.gases)
+ var/bitcoins_mined = RAD_COLLECTOR_OUTPUT
+ SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, bitcoins_mined*RAD_COLLECTOR_MINING_CONVERSION_RATE)
+ stored_power-=bitcoins_mined
+
+/obj/machinery/power/rad_collector/interact(mob/user)
+ if(anchored)
+ if(!src.locked)
+ toggle_power()
+ user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
+ "You turn the [src.name] [active? "on":"off"].")
+ var/fuel
+ if(loaded_tank)
+ fuel = loaded_tank.air_contents.gases[/datum/gas/plasma]
+ investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_SINGULO)
+ return
+ else
+ to_chat(user, "The controls are locked!")
+ return
+
+/obj/machinery/power/rad_collector/can_be_unfasten_wrench(mob/user, silent)
+ if(loaded_tank)
+ if(!silent)
+ to_chat(user, "Remove the plasma tank first!")
+ return FAILED_UNFASTEN
+ return ..()
+
+/obj/machinery/power/rad_collector/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
+ . = ..()
+ if(. == SUCCESSFUL_UNFASTEN)
+ if(anchored)
+ connect_to_network()
+ else
+ disconnect_from_network()
+
+/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user, params)
+ if(istype(W, /obj/item/tank/internals/plasma))
+ if(!anchored)
+ to_chat(user, "[src] needs to be secured to the floor first!")
+ return TRUE
+ if(loaded_tank)
+ to_chat(user, "There's already a plasma tank loaded!")
+ return TRUE
+ if(panel_open)
+ to_chat(user, "Close the maintenance panel first!")
+ return TRUE
+ if(!user.transferItemToLoc(W, src))
+ return
+ loaded_tank = W
+ update_icon()
+ else if(W.GetID())
+ if(allowed(user))
+ if(active)
+ locked = !locked
+ to_chat(user, "You [locked ? "lock" : "unlock"] the controls.")
+ else
+ to_chat(user, "The controls can only be locked when \the [src] is active!")
+ else
+ to_chat(user, "Access denied.")
+ return TRUE
+ else
+ return ..()
+
+/obj/machinery/power/rad_collector/wrench_act(mob/living/user, obj/item/I)
+ default_unfasten_wrench(user, I)
+ return TRUE
+
+/obj/machinery/power/rad_collector/screwdriver_act(mob/living/user, obj/item/I)
+ if(..())
+ return TRUE
+ if(loaded_tank)
+ to_chat(user, "Remove the plasma tank first!")
+ else
+ default_deconstruction_screwdriver(user, icon_state, icon_state, I)
+ return TRUE
+
+/obj/machinery/power/rad_collector/crowbar_act(mob/living/user, obj/item/I)
+ if(loaded_tank)
+ if(locked)
+ to_chat(user, "The controls are locked!")
+ return TRUE
+ eject()
+ return TRUE
+ if(default_deconstruction_crowbar(I))
+ return TRUE
+ to_chat(user, "There isn't a tank loaded!")
+ return TRUE
+
+/obj/machinery/power/rad_collector/multitool_act(mob/living/user, obj/item/I)
+ if(!is_station_level(z) && !SSresearch.science_tech)
+ to_chat(user, "[src] isn't linked to a research system!")
+ return TRUE
+ if(locked)
+ to_chat(user, "[src] is locked!")
+ return TRUE
+ if(active)
+ to_chat(user, "[src] is currently active, producing [bitcoinmining ? "research points":"power"].")
+ return TRUE
+ bitcoinmining = !bitcoinmining
+ to_chat(user, "You [bitcoinmining ? "enable":"disable"] the research point production feature of [src].")
+ return TRUE
+
+/obj/machinery/power/rad_collector/analyzer_act(mob/living/user, obj/item/I)
+ if(loaded_tank)
+ loaded_tank.analyzer_act(user, I)
+
+/obj/machinery/power/rad_collector/examine(mob/user)
+ . = ..()
+ if(active)
+ if(!bitcoinmining)
+ . += "[src]'s display states that it has stored [DisplayPower(stored_power)], and is processing [DisplayPower((RAD_COLLECTOR_OUTPUT)*((60 SECONDS)/SSmachines.wait))] per minute.
The plasma within it's tank is being irradiated into tritium."
+ else
+ . += "[src]'s display states that it's producing a total of [(stored_power*RAD_COLLECTOR_MINING_CONVERSION_RATE)*((60 SECONDS)/SSmachines.wait)] research points per minute.
The tritium and oxygen within it's tank is being combusted into carbon dioxide."
+ else
+ if(!bitcoinmining)
+ . += "[src]'s display displays the words: \"Power production mode. Please insert Plasma. Use a multitool to change production modes.\""
+ else
+ . += "[src]'s display displays the words: \"Research point production mode. Please insert Tritium and Oxygen. Use a multitool to change production modes.\""
+
+/obj/machinery/power/rad_collector/obj_break(damage_flag)
+ if(!(stat & BROKEN) && !(flags_1 & NODECONSTRUCT_1))
+ eject()
+ stat |= BROKEN
+
+/obj/machinery/power/rad_collector/proc/eject()
+ locked = FALSE
+ var/obj/item/tank/internals/plasma/Z = src.loaded_tank
+ if (!Z)
+ return
+ Z.forceMove(drop_location())
+ Z.layer = initial(Z.layer)
+ Z.plane = initial(Z.plane)
+ src.loaded_tank = null
+ if(active)
+ toggle_power()
+ else
+ update_icon()
+
+/obj/machinery/power/rad_collector/rad_act(pulse_strength)
+ . = ..()
+ if(loaded_tank && active && pulse_strength > RAD_COLLECTOR_EFFICIENCY)
+ stored_power += (pulse_strength-RAD_COLLECTOR_EFFICIENCY)*RAD_COLLECTOR_COEFFICIENT
+
+/obj/machinery/power/rad_collector/update_icon()
+ cut_overlays()
+ if(loaded_tank)
+ add_overlay("ptank")
+ if(stat & (NOPOWER|BROKEN))
+ return
+ if(active)
+ add_overlay("on")
+
+
+/obj/machinery/power/rad_collector/proc/toggle_power()
+ active = !active
+ if(active)
+ icon_state = "ca_on"
+ flick("ca_active", src)
+ else
+ icon_state = "ca"
+ flick("ca_deactive", src)
+ update_icon()
+ return
+
+#undef RAD_COLLECTOR_EFFICIENCY
+#undef RAD_COLLECTOR_COEFFICIENT
+#undef RAD_COLLECTOR_STORED_OUT
+#undef RAD_COLLECTOR_MINING_CONVERSION_RATE
+#undef RAD_COLLECTOR_OUTPUT