Files
CHOMPStation2/code/modules/research/tg/rdmachines.dm
2025-08-01 19:28:40 +02:00

65 lines
1.8 KiB
Plaintext

/obj/machinery/rnd
name = "R&D Device"
icon = 'icons/obj/machines/research_vr.dmi'
density = TRUE
anchored = TRUE
use_power = USE_POWER_IDLE
///Are we currently printing a machine
var/busy = FALSE
///Is this machne hacked via wires
var/hacked = FALSE
///Is this machine disabled via wires
var/disabled = FALSE
///Ref to global science techweb.
var/datum/techweb/stored_research
///The item loaded inside the machine, used by experimentors and destructive analyzers only.
var/obj/item/loaded_item
/obj/machinery/rnd/Initialize(mapload)
. = ..()
if(!stored_research)
CONNECT_TO_RND_SERVER_ROUNDSTART(stored_research, src)
if(stored_research)
on_connected_techweb()
/obj/machinery/rnd/Destroy()
if(stored_research)
log_research("[src] disconnected from techweb [stored_research] (destroyed).")
stored_research = null
return ..()
///Called when attempting to connect the machine to a techweb, forgetting the old.
/obj/machinery/rnd/proc/connect_techweb(datum/techweb/new_techweb)
if(stored_research)
log_research("[src] disconnected from techweb [stored_research] when connected to [new_techweb].")
stored_research = new_techweb
if(!isnull(stored_research))
on_connected_techweb()
///Called post-connection to a new techweb.
/obj/machinery/rnd/proc/on_connected_techweb()
SHOULD_CALL_PARENT(FALSE)
///Reset the state of this machine
/obj/machinery/rnd/proc/reset_busy()
busy = FALSE
/obj/machinery/rnd/attackby(obj/item/W, mob/user, attack_modifier, click_parameters)
add_fingerprint(user)
if(default_deconstruction_screwdriver(user, W))
return
if(default_deconstruction_crowbar(user, W))
return
if(default_part_replacement(user, W))
return
if(default_unfasten_wrench(user, W, 2 SECONDS))
return
return ..()
/obj/machinery/rnd/dismantle()
if(loaded_item)
loaded_item.forceMove(drop_location())
. = ..()