Files
fulpstation/code/modules/research/rdmachines.dm
A miscellaneous Fern f3397e3136 January TGU - First Draft (#879)
* Update beefman.dm

* Update beefman.dm

* xsaxsfvvvvvvvv

* Update shaded_bloodsucker.dm

* yeah that thing

* FUCK you

* Update hunting_contract.dm

* dd

* vdvdfv

* Update monsterhunter_weapons.dm

* Update whiterabbit.dm

* onokkn

* Update monsterhunter_weapons.dm

* Update monsterhunter_weapons.dm

* efe

* Update whiterabbit.dm

* yeaywa

* Update red_rabbit.dmi

* oihop

* Update HunterContract.js

* wonderland.dm

* gs

* dcd

* Update rabbit.dmi

* ass

* fvd

* Update paradox_rabbit.dm

* f

* Update tgstation.dme

* Delete heartbeatmoon.dmi

* shtntb

* sed

* sfe

* Update monsterhunter_weapons.dm

* cdc

* Update wonderland.dm

* dgrd

* wef

* b

* pipkk

* Update hunting_contract.dm

* Update paradox_rabbit.dm

* wr

* Update worn_mask.dmi

* some documenting

* Update areas.dm

* eg

* Update white_rabbit.dm

* Update HunterContract.js

* s

* Update weapons.dmi

* Update weapons.dmi

* Jack in the bomb

* some signals

* ui

* h

* y

* music

* Update wonderlandmusic.ogg

* f

* v

* cleanups

* g

* a

* t

* y

* g

* a

* o

* first commit

* Adding our stuff back in

* k

* Before procs

* proc refs

* carps

* Fixes

* shuttles

* dumb dumb names

* I hate windows I hate windows

* I hate windows I hate windows

* h

* Selenestation has issues

* Update monsterhunter_weapons.dm

* eretics

* Update weapons.dmi

* Update monsterhunter_weapons.dm

* g

* kpop

* r

* m

* grgr

* Update simple_animal_freeze.dm

* Update wonderland_apocalypse.dm

* Update wonderland_apocalypse.dm

* d

* Update fulp_defines.dm

* ff

* Update wonderland.dmm

* Update tgstation.dme

* Update infil_objectives.dm

* Update infil_objectives.dm

* Update monsterhunter_weapons.dm

* Update monsterhunter_event.dm

* Update monsterhunter_event.dm

* Update areas.dm

* Update monsterhunter_event.dm

* Update monsterhunter_weapons.dm

* Step 0, version 2

* step 0.5 - version 2

* step 1 - version 2

* 2.5 version 2

* fix

* Mapping

* okay fine

* more mapping

* uuuuu
hhhh

* fixes

* help me

* hurry

* I'm killing the mf that did access helpers on this map

* Welp, we lost.

* Or did we?

---------

Co-authored-by: SmoSmoSmoSmok <95004236+SmoSmoSmoSmok@users.noreply.github.com>
Co-authored-by: Pepsilawn <reisenrui@gmail.com>
Co-authored-by: SgtHunk <68669754+SgtHunk@users.noreply.github.com>
2023-02-01 03:57:55 -03:00

137 lines
4.3 KiB
Plaintext

//All devices that link into the R&D console fall into thise type for easy identification and some shared procs.
/obj/machinery/rnd
name = "R&D Device"
icon = 'icons/obj/machines/research.dmi'
density = TRUE
use_power = IDLE_POWER_USE
var/busy = FALSE
var/hacked = FALSE
var/console_link = TRUE //allow console link.
var/disabled = FALSE
var/obj/item/loaded_item = null //the item loaded inside the machine (currently only used by experimentor and destructive analyzer)
/// Ref to global science techweb.
var/datum/techweb/stored_research
/obj/machinery/rnd/proc/reset_busy()
busy = FALSE
/obj/machinery/rnd/Initialize(mapload)
. = ..()
if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research)
connect_techweb(SSresearch.science_tech)
wires = new /datum/wires/rnd(src)
/obj/machinery/rnd/Destroy()
if(stored_research)
log_research("[src] disconnected from techweb [stored_research] (destroyed).")
stored_research = null
QDEL_NULL(wires)
return ..()
/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
/obj/machinery/rnd/proc/shock(mob/user, prb)
if(machine_stat & (BROKEN|NOPOWER)) // unpowered, no shock
return FALSE
if(!prob(prb))
return FALSE
do_sparks(5, TRUE, src)
if (electrocute_mob(user, get_area(src), src, 0.7, TRUE))
return TRUE
else
return FALSE
/obj/machinery/rnd/attackby(obj/item/O, mob/user, params)
if(is_refillable() && O.is_drainable())
return FALSE //inserting reagents into the machine
if(Insert_Item(O, user))
return TRUE
return ..()
/obj/machinery/rnd/crowbar_act(mob/living/user, obj/item/tool)
return default_deconstruction_crowbar(tool)
/obj/machinery/rnd/crowbar_act_secondary(mob/living/user, obj/item/tool)
return default_deconstruction_crowbar(tool)
/obj/machinery/rnd/screwdriver_act(mob/living/user, obj/item/tool)
return default_deconstruction_screwdriver(user, "[initial(icon_state)]_t", initial(icon_state), tool)
/obj/machinery/rnd/screwdriver_act_secondary(mob/living/user, obj/item/tool)
return default_deconstruction_screwdriver(user, "[initial(icon_state)]_t", initial(icon_state), tool)
/obj/machinery/rnd/multitool_act(mob/living/user, obj/item/multitool/tool)
if(panel_open)
wires.interact(user)
return TRUE
if(!QDELETED(tool.buffer) && istype(tool.buffer, /datum/techweb))
connect_techweb(tool.buffer)
return TRUE
return FALSE
/obj/machinery/rnd/multitool_act_secondary(mob/living/user, obj/item/tool)
if(panel_open)
wires.interact(user)
return TRUE
/obj/machinery/rnd/wirecutter_act(mob/living/user, obj/item/tool)
if(panel_open)
wires.interact(user)
return TRUE
/obj/machinery/rnd/wirecutter_act_secondary(mob/living/user, obj/item/tool)
if(panel_open)
wires.interact(user)
return TRUE
//proc used to handle inserting items or reagents into rnd machines
/obj/machinery/rnd/proc/Insert_Item(obj/item/I, mob/user)
return
//whether the machine can have an item inserted in its current state.
/obj/machinery/rnd/proc/is_insertion_ready(mob/user)
if(panel_open)
to_chat(user, span_warning("You can't load [src] while it's opened!"))
return FALSE
if(disabled)
to_chat(user, span_warning("The insertion belts of [src] won't engage!"))
return FALSE
if(busy)
to_chat(user, span_warning("[src] is busy right now."))
return FALSE
if(machine_stat & BROKEN)
to_chat(user, span_warning("[src] is broken."))
return FALSE
if(machine_stat & NOPOWER)
to_chat(user, span_warning("[src] has no power."))
return FALSE
if(loaded_item)
to_chat(user, span_warning("[src] is already loaded."))
return FALSE
return TRUE
//we eject the loaded item when deconstructing the machine
/obj/machinery/rnd/on_deconstruction()
if(loaded_item)
loaded_item.forceMove(loc)
..()
/obj/machinery/rnd/proc/AfterMaterialInsert(item_inserted, id_inserted, amount_inserted)
var/stack_name
if(istype(item_inserted, /obj/item/stack/ore/bluespace_crystal))
stack_name = "bluespace"
use_power(MINERAL_MATERIAL_AMOUNT / 10)
else
var/obj/item/stack/S = item_inserted
stack_name = S.name
use_power(min(active_power_usage, (amount_inserted / 100)))
add_overlay("protolathe_[stack_name]")
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, cut_overlay), "protolathe_[stack_name]"), 10)