mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-20 02:27:36 +01:00
* upgraded machines and pre-loading * agghhhh! * stovetop of failure * Update cerestation.dmm --------- Signed-off-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
226 lines
7.1 KiB
Plaintext
226 lines
7.1 KiB
Plaintext
/obj/machinery/recharge_station
|
|
name = "cyborg recharging station"
|
|
icon = 'icons/obj/objects.dmi'
|
|
icon_state = "borgcharger0"
|
|
density = TRUE
|
|
anchored = TRUE
|
|
idle_power_consumption = 5
|
|
active_power_consumption = 1000
|
|
/// A reference to the occupant currently sitting inside the recharger.
|
|
var/mob/occupant = null
|
|
/// What type of circuit board is required to build this machine.
|
|
var/circuitboard = /obj/item/circuitboard/cyborgrecharger
|
|
/// How fast the recharger can give charge to the occupants energy cell. Based on capacitors and the cell the recharger has.
|
|
var/recharge_speed
|
|
/// How much nutrition is given to the occupant. Based on capacitors and the cell the recharger has. Only relevent for IPCs.
|
|
var/recharge_speed_nutrition
|
|
/// How much the occupant is repaired every cycle. Based on what manipulator the recharger has.
|
|
var/repairs
|
|
/// How efficiently the recharger is able to recharge consumable items such as metal, glass, chemicals in sprays, welding tool fuel, etc.
|
|
var/consumable_recharge_coeff
|
|
|
|
/obj/machinery/recharge_station/Destroy()
|
|
go_out()
|
|
return ..()
|
|
|
|
/obj/machinery/recharge_station/Initialize(mapload)
|
|
. = ..()
|
|
component_parts = list()
|
|
component_parts += new /obj/item/circuitboard/cyborgrecharger(null)
|
|
component_parts += new /obj/item/stock_parts/capacitor(null)
|
|
component_parts += new /obj/item/stock_parts/capacitor(null)
|
|
component_parts += new /obj/item/stock_parts/manipulator(null)
|
|
component_parts += new /obj/item/stock_parts/cell/high(null)
|
|
RefreshParts()
|
|
update_icon(UPDATE_ICON_STATE)
|
|
|
|
/obj/machinery/recharge_station/upgraded/Initialize(mapload)
|
|
. = ..()
|
|
component_parts = list()
|
|
component_parts += new /obj/item/circuitboard/cyborgrecharger(null)
|
|
component_parts += new /obj/item/stock_parts/capacitor/quadratic(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
|
|
recharge_speed_nutrition = 0
|
|
repairs = 0
|
|
// The recharge_speed can be anywhere from 200 to 3200, depending on the capacitors and the cell.
|
|
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
|
recharge_speed += C.rating * 100
|
|
recharge_speed_nutrition += C.rating * 10
|
|
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)
|
|
var/multiplier = C.maxcharge / 10000
|
|
recharge_speed *= multiplier
|
|
recharge_speed_nutrition *= multiplier
|
|
|
|
// This coefficient can be anywhere from 1, to 16.
|
|
consumable_recharge_coeff = max(1, recharge_speed / 200)
|
|
|
|
/obj/machinery/recharge_station/process()
|
|
if(stat & (NOPOWER|BROKEN))
|
|
return
|
|
|
|
if(occupant)
|
|
process_occupant()
|
|
|
|
for(var/mob/M as mob in src) // makes sure that simple mobs don't get stuck inside a sleeper when they resist out of occupant's grasp
|
|
if(M == occupant)
|
|
continue
|
|
else if(!ispulsedemon(M))
|
|
M.forceMove(src.loc)
|
|
return 1
|
|
|
|
/obj/machinery/recharge_station/ex_act(severity)
|
|
if(occupant)
|
|
occupant.ex_act(severity)
|
|
..()
|
|
|
|
/obj/machinery/recharge_station/handle_atom_del(atom/A)
|
|
..()
|
|
if(A == occupant)
|
|
occupant = null
|
|
update_icon(UPDATE_ICON_STATE)
|
|
|
|
/obj/machinery/recharge_station/narsie_act()
|
|
go_out()
|
|
new /obj/effect/gibspawner/generic(get_turf(loc)) //I REPLACE YOUR TECHNOLOGY WITH FLESH!
|
|
qdel(src)
|
|
|
|
/obj/machinery/recharge_station/Bumped(mob/bumper)
|
|
if(istype(bumper))
|
|
move_inside(bumper, bumper)
|
|
|
|
/obj/machinery/recharge_station/AllowDrop()
|
|
return FALSE
|
|
|
|
/obj/machinery/recharge_station/relaymove(mob/user as mob)
|
|
if(ispulsedemon(user))
|
|
return
|
|
if(user.stat)
|
|
return
|
|
go_out()
|
|
|
|
/obj/machinery/recharge_station/emp_act(severity)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
..(severity)
|
|
return
|
|
if(occupant)
|
|
occupant.emp_act(severity)
|
|
go_out()
|
|
..(severity)
|
|
|
|
/obj/machinery/recharge_station/update_icon_state()
|
|
if(occupant)
|
|
if(!(stat & (NOPOWER|BROKEN)))
|
|
icon_state = "borgcharger1"
|
|
else
|
|
icon_state = "borgcharger2"
|
|
else
|
|
icon_state = "borgcharger0"
|
|
|
|
/obj/machinery/recharge_station/crowbar_act(mob/user, obj/item/I)
|
|
if(default_deconstruction_crowbar(user, I))
|
|
return TRUE
|
|
|
|
/obj/machinery/recharge_station/screwdriver_act(mob/user, obj/item/I)
|
|
if(occupant)
|
|
to_chat(user, SPAN_NOTICE("The maintenance panel is locked."))
|
|
return TRUE
|
|
if(default_deconstruction_screwdriver(user, "borgdecon2", "borgcharger0", I))
|
|
return TRUE
|
|
|
|
/obj/machinery/recharge_station/proc/process_occupant()
|
|
SEND_SIGNAL(occupant, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, recharge_speed, repairs)
|
|
if(isrobot(occupant))
|
|
var/mob/living/silicon/robot/R = occupant
|
|
if(R.module)
|
|
R.module.recharge_consumables(R, consumable_recharge_coeff) // This will handle all of a cyborg's items.
|
|
if(repairs)
|
|
R.heal_overall_damage(repairs, repairs)
|
|
if(R.cell)
|
|
R.cell.charge = min(R.cell.charge + recharge_speed, R.cell.maxcharge)
|
|
else if(ishuman(occupant))
|
|
var/mob/living/carbon/human/H = occupant
|
|
if(ismachineperson(H))
|
|
if(H.nutrition < NUTRITION_LEVEL_FULL - 1)
|
|
H.set_nutrition(min(H.nutrition + recharge_speed_nutrition, NUTRITION_LEVEL_FULL - 1))
|
|
if(repairs)
|
|
H.heal_overall_damage(repairs, repairs, TRUE, 0, 1)
|
|
|
|
|
|
/obj/machinery/recharge_station/proc/go_out()
|
|
if(!occupant)
|
|
return
|
|
SEND_SIGNAL(occupant, COMSIG_EXITED_BORGCHARGER)
|
|
UnregisterSignal(occupant, COMSIG_MOVABLE_MOVED)
|
|
occupant.forceMove(loc)
|
|
occupant = null
|
|
update_icon(UPDATE_ICON_STATE)
|
|
change_power_mode(IDLE_POWER_USE)
|
|
|
|
/obj/machinery/recharge_station/AltClick(mob/user)
|
|
if(user.stat || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user))
|
|
return
|
|
go_out()
|
|
|
|
/obj/machinery/recharge_station/force_eject_occupant(mob/target)
|
|
go_out()
|
|
|
|
/obj/machinery/recharge_station/MouseDrop_T(mob/living/target, mob/user)
|
|
if(!istype(target))
|
|
return
|
|
INVOKE_ASYNC(src, TYPE_PROC_REF(/obj/machinery/recharge_station, move_inside), user, target)
|
|
return TRUE
|
|
|
|
/obj/machinery/recharge_station/proc/move_inside(mob/user, mob/target)
|
|
if(!user || user.stat)
|
|
return
|
|
|
|
if(get_dist(src, user) > 2 || get_dist(target, user) > 1)
|
|
to_chat(user, SPAN_NOTICE("[target] is too far away to put inside [src]."))
|
|
return
|
|
|
|
if(panel_open)
|
|
to_chat(user, SPAN_WARNING("Close the maintenance panel first."))
|
|
return
|
|
|
|
var/can_accept_user
|
|
if(isrobot(target))
|
|
var/mob/living/silicon/robot/R = target
|
|
if(occupant)
|
|
to_chat(R, SPAN_WARNING("The cell is already occupied!"))
|
|
return
|
|
can_accept_user = TRUE
|
|
|
|
else if(ishuman(target))
|
|
var/mob/living/carbon/human/H = target
|
|
|
|
if(H.stat == DEAD)
|
|
return
|
|
if(occupant)
|
|
to_chat(H, SPAN_WARNING("The cell is already occupied!"))
|
|
return
|
|
if(ismodcontrol(H.back) || ismachineperson(H))
|
|
can_accept_user = TRUE
|
|
|
|
if(!can_accept_user)
|
|
to_chat(user, SPAN_NOTICE("Only non-organics and people wearing modsuits may enter the recharger!"))
|
|
return
|
|
|
|
target.stop_pulling()
|
|
QDEL_LIST_CONTENTS(target.grabbed_by)
|
|
SEND_SIGNAL(target, COMSIG_ENTERED_BORGCHARGER)
|
|
target.forceMove(src)
|
|
occupant = target
|
|
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(go_out))
|
|
|
|
add_fingerprint(user)
|
|
update_icon(UPDATE_ICON_STATE)
|
|
change_power_mode(IDLE_POWER_USE)
|