Files
GS13NG/code/game/machinery/rechargestation.dm
T
Poojawaanddeathride58 5fa001c10f things with stuff (#6233)
* buncha things from upstream

* datums globals, onclick

* datums

* game folder, holy shit mirror bot why

* modules

* icons

* dme

* compiles cleanly

* tools purge

* updates maps

* double check just because. and wew lad

* incidentally, this needs more work first

* some things

* weh

* sound cleanup and icons

* reeeee

* compile issues

* oh look, fresh code sync

* cleans up some unused icons

* dirty vars

* reeeeeeeeeeeeeeee

* wew lad. fuck off with this already
2018-04-07 23:07:09 -04:00

116 lines
2.9 KiB
Plaintext

/obj/machinery/recharge_station
name = "cyborg recharging station"
icon = 'icons/obj/objects.dmi'
icon_state = "borgcharger0"
density = FALSE
anchored = TRUE
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)
var/recharge_speed
var/repairs
/obj/machinery/recharge_station/Initialize()
. = ..()
update_icon()
/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/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)
occupant.emp_act(severity)
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(exchange_parts(user, 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()
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 && iscyborg(occupant))
var/mob/living/silicon/robot/R = occupant
restock_modules()
if(repairs)
R.heal_bodypart_damage(repairs, repairs - 1)
if(R.cell)
R.cell.charge = min(R.cell.charge + recharge_speed, R.cell.maxcharge)
/obj/machinery/recharge_station/proc/restock_modules()
if(occupant)
var/mob/living/silicon/robot/R = occupant
if(R && R.module)
var/coeff = recharge_speed * 0.005
R.module.respawn_consumable(R, coeff)