Files
S.P.L.U.R.T-Station-13/code/game/machinery/rechargestation.dm
2023-05-01 00:16:20 -05:00

132 lines
3.8 KiB
Plaintext

/obj/machinery/recharge_station
name = "recharging station"
desc = "This device recharges energy dependent lifeforms, like cyborgs, ethereals and MODsuit users."
icon = 'icons/obj/objects.dmi'
icon_state = "borgcharger0"
density = FALSE
use_power = IDLE_POWER_USE
idle_power_usage = 5
active_power_usage = 1000
req_access = list(ACCESS_ROBOTICS)
state_open = TRUE
circuit = /obj/item/circuitboard/machine/cyborgrecharger
occupant_typecache = list(/mob/living/silicon/robot, /mob/living/carbon/human)
var/recharge_speed
var/repairs
/obj/machinery/recharge_station/Initialize(mapload)
. = ..()
update_icon()
/obj/machinery/recharge_station/upgraded
/obj/machinery/recharge_station/upgraded/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/machine/cyborgrecharger(null)
component_parts += new /obj/item/stock_parts/capacitor/super(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/stock_parts/cell/hyper(null)
RefreshParts()
/obj/machinery/recharge_station/fullupgrade
/obj/machinery/recharge_station/fullupgrade/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/machine/cyborgrecharger(null)
component_parts += new /obj/item/stock_parts/capacitor/quadratic(null)
component_parts += new /obj/item/stock_parts/manipulator/femto(null)
component_parts += new /obj/item/stock_parts/cell/bluespace(null)
RefreshParts()
/obj/machinery/recharge_station/RefreshParts()
recharge_speed = 0
repairs = 0
for(var/obj/item/stock_parts/capacitor/C in component_parts)
recharge_speed += C.rating * 100
for(var/obj/item/stock_parts/manipulator/M in component_parts)
repairs += M.rating - 1
for(var/obj/item/stock_parts/cell/C in component_parts)
recharge_speed *= C.maxcharge / 10000
/obj/machinery/recharge_station/examine(mob/user)
. = ..()
if(in_range(user, src) || isobserver(user))
. += "<span class='notice'>The status display reads: Recharging <b>[recharge_speed]J</b> per cycle.</span>"
if(repairs)
to_chat(user, "<span class='notice'>[src] has been upgraded to support automatic repairs.<span>")
/obj/machinery/recharge_station/process()
if(!is_operational())
return
if(occupant)
process_occupant()
return 1
/obj/machinery/recharge_station/relaymove(mob/user)
if(user.stat)
return
open_machine()
/obj/machinery/recharge_station/emp_act(severity)
. = ..()
if(!(stat & (BROKEN|NOPOWER)))
if(occupant && !(. & EMP_PROTECT_CONTENTS))
occupant.emp_act(severity)
if (!(. & EMP_PROTECT_SELF))
open_machine()
/obj/machinery/recharge_station/attackby(obj/item/P, mob/user, params)
if(state_open)
if(default_deconstruction_screwdriver(user, "borgdecon2", "borgcharger0", P))
return
if(default_pry_open(P))
return
if(default_deconstruction_crowbar(P))
return
return ..()
/obj/machinery/recharge_station/interact(mob/user)
toggle_open()
return TRUE
/obj/machinery/recharge_station/proc/toggle_open()
if(state_open)
close_machine()
else
open_machine()
/obj/machinery/recharge_station/open_machine()
. = ..()
if(iscyborg(occupant))
use_power = IDLE_POWER_USE
/obj/machinery/recharge_station/close_machine()
. = ..()
if(occupant)
if(iscyborg(occupant))
use_power = ACTIVE_POWER_USE
add_fingerprint(occupant)
/obj/machinery/recharge_station/update_icon_state()
if(is_operational())
if(state_open)
icon_state = "borgcharger0"
else
icon_state = (occupant ? "borgcharger1" : "borgcharger2")
else
icon_state = (state_open ? "borgcharger-u0" : "borgcharger-u1")
/obj/machinery/recharge_station/power_change()
..()
update_icon()
/obj/machinery/recharge_station/proc/process_occupant()
if(!occupant)
return
SEND_SIGNAL(occupant, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, recharge_speed, repairs)