From 23c0fd7b4fb5734721bc9b719ec044143e88a040 Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Thu, 21 Dec 2023 12:40:49 +0100 Subject: [PATCH] Autolathe and wires panel TGUI, autolathe queueing. (#17978) * autolathe 1 * FUCK MY LIFE * more fixes * autolathe queueing * cl * garbage collection * wire fixes * some final tweaks * on second thought this might be annoying * fix that * whoopsies * that didn't work for shit --------- Co-authored-by: Matt Atlas --- aurorastation.dme | 1 + code/__defines/dcs/signals.dm | 6 +- code/__defines/wires.dm | 85 +++ code/controllers/subsystems/garbage.dm | 2 +- code/controllers/subsystems/materials.dm | 1 - code/controllers/subsystems/statpanel.dm | 2 +- code/datums/components/connect_mob_behalf.dm | 4 +- code/datums/elements/_element.dm | 4 +- code/datums/progressbar.dm | 2 +- code/datums/wires/airlock.dm | 187 +++--- code/datums/wires/alarm.dm | 69 ++- code/datums/wires/apc.dm | 53 +- code/datums/wires/autolathe.dm | 67 +- code/datums/wires/camera.dm | 73 +-- code/datums/wires/disposals.dm | 33 +- code/datums/wires/explosive.dm | 28 +- code/datums/wires/iff.dm | 25 +- code/datums/wires/ipc_tag_scanner.dm | 45 +- code/datums/wires/landmine.dm | 22 +- code/datums/wires/nuclearbomb.dm | 49 +- code/datums/wires/particle_accelerator.dm | 51 +- code/datums/wires/radio.dm | 45 +- code/datums/wires/robot.dm | 78 +-- code/datums/wires/smartfridge.dm | 82 +-- code/datums/wires/smes.dm | 74 +-- code/datums/wires/suit_storage_unit.dm | 61 +- code/datums/wires/vending.dm | 109 ++-- code/datums/wires/wires.dm | 581 ++++++++++-------- code/game/machinery/alarm.dm | 4 +- code/game/machinery/autolathe/autolathe.dm | 304 +++++---- .../machinery/autolathe/autolathe_datums.dm | 230 +++---- code/game/machinery/camera/camera.dm | 10 +- code/game/machinery/doors/airlock.dm | 44 +- code/game/machinery/nuclear_bomb.dm | 6 +- code/game/machinery/suit_cycler.dm | 4 +- code/game/machinery/vending.dm | 4 +- .../game/objects/items/devices/radio/radio.dm | 10 +- code/game/objects/items/weapons/explosives.dm | 2 +- .../game/objects/items/weapons/ipc_scanner.dm | 2 +- code/game/objects/items/weapons/landmines.dm | 2 +- code/modules/assembly/assembly.dm | 10 +- code/modules/assembly/proximity.dm | 2 +- code/modules/assembly/signaler.dm | 4 +- code/modules/assembly/timer.dm | 2 +- code/modules/clothing/spacesuits/rig/rig.dm | 16 +- .../clothing/spacesuits/rig/rig_attackby.dm | 2 +- .../clothing/spacesuits/rig/rig_wiring.dm | 23 +- code/modules/clothing/suits/hoodies.dm | 2 +- code/modules/cooking/machinery/smartfridge.dm | 2 +- code/modules/events/camera_damage.dm | 4 +- .../heavy_vehicle/equipment/utility.dm | 4 +- code/modules/mob/living/silicon/robot/life.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 6 +- code/modules/overmap/ships/identification.dm | 2 +- code/modules/power/apc.dm | 10 +- .../particle_accelerator/particle_control.dm | 8 +- code/modules/power/smes_construction.dm | 4 +- code/modules/recycling/disposal.dm | 2 +- code/modules/research/designs/designs.dm | 4 +- html/changelogs/mattatlas-carolinen.yml | 43 ++ maps/runtime/runtime-1.dmm | 14 +- tgui/packages/tgui/interfaces/Autolathe.tsx | 267 ++++++++ tgui/packages/tgui/interfaces/Wires.tsx | 117 ++++ tgui/packages/tgui/styles/colors.scss | 12 + 64 files changed, 1839 insertions(+), 1184 deletions(-) create mode 100644 code/__defines/wires.dm create mode 100644 html/changelogs/mattatlas-carolinen.yml create mode 100644 tgui/packages/tgui/interfaces/Autolathe.tsx create mode 100644 tgui/packages/tgui/interfaces/Wires.tsx diff --git a/aurorastation.dme b/aurorastation.dme index b678ece412a..cc424d3ea5e 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -120,6 +120,7 @@ #include "code\__defines\typeids.dm" #include "code\__defines\verbs.dm" #include "code\__defines\webhook.dm" +#include "code\__defines\wires.dm" #include "code\__defines\xenoarch.dm" #include "code\__defines\ZAS.dm" #include "code\__defines\zcopy.dm" diff --git a/code/__defines/dcs/signals.dm b/code/__defines/dcs/signals.dm index 2877369cdf0..a2b9b0e9734 100644 --- a/code/__defines/dcs/signals.dm +++ b/code/__defines/dcs/signals.dm @@ -20,7 +20,7 @@ /// before a datum's Destroy() is called: (force), returning a nonzero value will cancel the qdel operation #define COMSIG_PARENT_PREQDELETED "parent_preqdeleted" /// just before a datum's Destroy() is called: (force), at this point none of the other components chose to interrupt qdel and Destroy will be called -#define COMSIG_PARENT_QDELETING "parent_qdeleting" +#define COMSIG_QDELETING "parent_qdeleting" /// from datum ui_act (usr, action) #define COMSIG_UI_ACT "COMSIG_UI_ACT" /// fires on the target datum when an element is attached to it (/datum/element) @@ -64,6 +64,10 @@ #define COMSIG_MOB_GET_STATUS_TAB_ITEMS "mob_get_status_tab_items" ///from /mob/living/carbon/human/proc/force_say(): () #define COMSIG_HUMAN_FORCESAY "human_forcesay" +///Mob is trying to open the wires of a target [/atom], from /datum/wires/interactable(): (atom/target) +#define COMSIG_TRY_WIRES_INTERACT "try_wires_interact" + #define COMPONENT_CANT_INTERACT_WIRES (1<<0) + /// Sent from /proc/do_after if someone starts a do_after action bar. #define COMSIG_DO_AFTER_BEGAN "mob_do_after_began" diff --git a/code/__defines/wires.dm b/code/__defines/wires.dm new file mode 100644 index 00000000000..24b49f99396 --- /dev/null +++ b/code/__defines/wires.dm @@ -0,0 +1,85 @@ +/// from base of /datum/wires/proc/cut : (wire) +#define COMSIG_CUT_WIRE(wire) "cut_wire [wire]" +#define COMSIG_MEND_WIRE(wire) "mend_wire [wire]" + +//retvals for attempt_wires_interaction +#define WIRE_INTERACTION_FAIL 0 +#define WIRE_INTERACTION_SUCCESSFUL 1 +#define WIRE_INTERACTION_BLOCK 2 //don't do anything else rather than open wires and whatever else. + +#define WIRE_ACCEPT "Scan Success" +#define WIRE_ACTIVATE "Activate" +#define WIRE_LAUNCH "Launch" +#define WIRE_SAFETIES "Safeties" +#define WIRE_AGELIMIT "Age Limit" +#define WIRE_AI "AI Connection" +#define WIRE_ALARM "Alarm" +#define WIRE_AVOIDANCE "Avoidance" +#define WIRE_BACKUP1 "Auxiliary Power 1" +#define WIRE_BACKUP2 "Auxiliary Power 2" +#define WIRE_BEACON "Beacon" +#define WIRE_BOLTLIGHT "Bolt Lights" +#define WIRE_BOLTS "Bolts" +#define WIRE_BOOM "Boom Wire 1" +#define WIRE_BOOM2 "Boom Wire 2" +#define WIRE_CAMERA "Camera" +#define WIRE_CONTRABAND "Contraband" +#define WIRE_DELAY "Delay" +#define WIRE_DENY "Scan Fail" +#define WIRE_DISABLE "Disable" +#define WIRE_DISARM "Disarm" +#define WIRE_DUD_PREFIX "__dud" +#define WIRE_HACK "Hack" +#define WIRE_IDSCAN "ID Scan" +#define WIRE_INTERFACE "Interface" +#define WIRE_LAWSYNC "AI Law Synchronization" +#define WIRE_LIGHT "Lights" +#define WIRE_LIMIT "Limiter" +#define WIRE_LOADCHECK "Load Check" +#define WIRE_LOCKDOWN "Lockdown" +#define WIRE_MOTOR1 "Motor 1" +#define WIRE_MOTOR2 "Motor 2" +#define WIRE_OPEN "Open" +#define WIRE_PANIC "Panic Siphon" +#define WIRE_POWER "Power" +#define WIRE_POWER1 "Main Power 1" +#define WIRE_POWER2 "Main Power 2" +#define WIRE_PRIZEVEND "Emergency Prize Vend" +#define WIRE_PROCEED "Proceed" +#define WIRE_RESET_MODEL "Reset Model" +#define WIRE_RESETOWNER "Reset Owner" +#define WIRE_UNRESTRICTED_EXIT "Unrestricted Exit" +#define WIRE_RX "Receive" +#define WIRE_SAFETY "Safety" +#define WIRE_SHOCK "High Voltage Ground" +#define WIRE_SIGNAL "Signal" +#define WIRE_RECEIVE "Receive" +#define WIRE_TRANSMIT "Transmit" +#define WIRE_SPEAKER "Speaker" +#define WIRE_STRENGTH "Strength" +#define WIRE_THROW "Throw" +#define WIRE_TIMING "Timing" +#define WIRE_TX "Transmit" +#define WIRE_UNBOLT "Unbolt" +#define WIRE_ZAP "High Voltage Circuit" +#define WIRE_ZAP1 "High Voltage Circuit 1" +#define WIRE_ZAP2 "High Voltage Circuit 2" +#define WIRE_OVERCLOCK "Overclock" +#define WIRE_FOCUS "Focus" +#define WIRE_FLUSH "Flush" +#define WIRE_RESET "Reset" +#define WIRE_POWER_LIMIT "Power Limiter" +#define WIRE_EXPLODE "Explode" +#define WIRE_COOLING "Cooling" +#define WIRE_HEATING "Heating" +#define WIRE_RCON "RCON" +#define WIRE_INPUT "Input" +#define WIRE_OUTPUT "Output" +#define WIRE_GROUNDING "Grounding" +#define WIRE_FAILSAFES "Failsafes" + +// Wire states for the AI +#define AI_WIRE_NORMAL 0 +#define AI_WIRE_DISABLED 1 +#define AI_WIRE_HACKED 2 +#define AI_WIRE_DISABLED_HACKED -1 diff --git a/code/controllers/subsystems/garbage.dm b/code/controllers/subsystems/garbage.dm index dd7830aaaf1..27416a6e31f 100644 --- a/code/controllers/subsystems/garbage.dm +++ b/code/controllers/subsystems/garbage.dm @@ -220,7 +220,7 @@ SUBSYSTEM_DEF(garbage) D.gcDestroyed = GC_CURRENTLY_BEING_QDELETED var/start_time = world.time var/hint = D.Destroy(force) // Let our friend know they're about to get fucked up. - SEND_SIGNAL(D, COMSIG_PARENT_QDELETING, force) // Let the (remaining) components know about the result of Destroy + SEND_SIGNAL(D, COMSIG_QDELETING, force) // Let the (remaining) components know about the result of Destroy if(world.time != start_time) SSgarbage.sleptDestroy["[D.type]"]++ if(!D) diff --git a/code/controllers/subsystems/materials.dm b/code/controllers/subsystems/materials.dm index 680e06125ce..2332c05e08c 100644 --- a/code/controllers/subsystems/materials.dm +++ b/code/controllers/subsystems/materials.dm @@ -6,7 +6,6 @@ SUBSYSTEM_DEF(materials) var/list/materials var/list/materials_by_name - var/list/autolathe_recipes var/list/autolathe_categories /datum/controller/subsystem/materials/Initialize() diff --git a/code/controllers/subsystems/statpanel.dm b/code/controllers/subsystems/statpanel.dm index 579b2c053f0..6bae8410bc0 100644 --- a/code/controllers/subsystems/statpanel.dm +++ b/code/controllers/subsystems/statpanel.dm @@ -186,7 +186,7 @@ SUBSYSTEM_DEF(statpanels) // Now, we're gonna queue image generation out of those refs to_make += turf_item already_seen[turf_item] = OBJ_IMAGE_LOADING - obj_window.RegisterSignal(turf_item, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/datum/object_window_info,viewing_atom_deleted)) // we reset cache if anything in it gets deleted + obj_window.RegisterSignal(turf_item, COMSIG_QDELETING, TYPE_PROC_REF(/datum/object_window_info,viewing_atom_deleted)) // we reset cache if anything in it gets deleted return turf_items #undef OBJ_IMAGE_LOADING diff --git a/code/datums/components/connect_mob_behalf.dm b/code/datums/components/connect_mob_behalf.dm index 1c1a8a65234..b8aa014f810 100644 --- a/code/datums/components/connect_mob_behalf.dm +++ b/code/datums/components/connect_mob_behalf.dm @@ -19,12 +19,12 @@ src.tracked = tracked /datum/component/connect_mob_behalf/RegisterWithParent() - RegisterSignal(tracked, COMSIG_PARENT_QDELETING, PROC_REF(handle_tracked_qdel)) + RegisterSignal(tracked, COMSIG_QDELETING, PROC_REF(handle_tracked_qdel)) update_signals() /datum/component/connect_mob_behalf/UnregisterFromParent() unregister_signals() - UnregisterSignal(tracked, COMSIG_PARENT_QDELETING) + UnregisterSignal(tracked, COMSIG_QDELETING) tracked = null tracked_mob = null diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm index e01683640cd..7d4d1ff8a94 100644 --- a/code/datums/elements/_element.dm +++ b/code/datums/elements/_element.dm @@ -23,13 +23,13 @@ return ELEMENT_INCOMPATIBLE SEND_SIGNAL(target, COMSIG_ELEMENT_ATTACH, src) if(element_flags & ELEMENT_DETACH_ON_HOST_DESTROY) - RegisterSignal(target, COMSIG_PARENT_QDELETING, PROC_REF(Detach), override = TRUE) + RegisterSignal(target, COMSIG_QDELETING, PROC_REF(Detach), override = TRUE) /// Deactivates the functionality defines by the element on the given datum /datum/element/proc/Detach(datum/source, force) SEND_SIGNAL(source, COMSIG_ELEMENT_DETACH_ON_HOST_DESTROY, src) SHOULD_CALL_PARENT(1) - UnregisterSignal(source, COMSIG_PARENT_QDELETING) + UnregisterSignal(source, COMSIG_QDELETING) /datum/element/Destroy(force) if(!force) diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm index 3cf08217549..e0e7f28995e 100644 --- a/code/datums/progressbar.dm +++ b/code/datums/progressbar.dm @@ -48,7 +48,7 @@ user_client = user.client addProgBarImageToClient() - RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(onUserDelete)) + RegisterSignal(user, COMSIG_QDELETING, PROC_REF(onUserDelete)) RegisterSignal(user, COMSIG_MOB_LOGOUT, PROC_REF(cleanUserClient)) RegisterSignal(user, COMSIG_MOB_LOGIN, PROC_REF(onUserLogin)) diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 57027e411a6..09b86eff4f7 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -1,82 +1,84 @@ // Wires for airlocks /datum/wires/airlock + proper_name = "Airlock" holder_type = /obj/machinery/door/airlock - wire_count = 12 - window_y = 570 + +/datum/wires/airlock/New(atom/holder) + wires = list( + WIRE_AI, + WIRE_BACKUP1, + WIRE_BACKUP2, + WIRE_BOLTS, + WIRE_IDSCAN, + WIRE_BOLTLIGHT, + WIRE_OPEN, + WIRE_POWER1, + WIRE_POWER2, + WIRE_SAFETY, + WIRE_SHOCK, + WIRE_TIMING + ) + add_duds(4) + ..() /datum/wires/airlock/secure random = TRUE - wire_count = 14 /datum/wires/airlock/blueprint cares_about_holder = FALSE -var/const/AIRLOCK_WIRE_IDSCAN = 1 -var/const/AIRLOCK_WIRE_MAIN_POWER1 = 2 -var/const/AIRLOCK_WIRE_MAIN_POWER2 = 4 -var/const/AIRLOCK_WIRE_DOOR_BOLTS = 8 -var/const/AIRLOCK_WIRE_BACKUP_POWER1 = 16 -var/const/AIRLOCK_WIRE_BACKUP_POWER2 = 32 -var/const/AIRLOCK_WIRE_OPEN_DOOR = 64 -var/const/AIRLOCK_WIRE_AI_CONTROL = 128 -var/const/AIRLOCK_WIRE_ELECTRIFY = 256 -var/const/AIRLOCK_WIRE_SAFETY = 512 -var/const/AIRLOCK_WIRE_SPEED = 1024 -var/const/AIRLOCK_WIRE_LIGHT = 2048 - -/datum/wires/airlock/CanUse(var/mob/living/L) +/datum/wires/airlock/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/door/airlock/A = holder - if(!istype(L, /mob/living/silicon)) + if(!istype(user, /mob/living/silicon)) if(A.isElectrified()) - if(A.shock(L, 100)) - return 0 - if(A.p_open) - return 1 - return 0 + if(A.shock(user, 100)) + return FALSE + if(!A.p_open) + return FALSE + return TRUE -/datum/wires/airlock/GetInteractWindow() +/datum/wires/airlock/get_status() var/obj/machinery/door/airlock/A = holder var/haspower = A.arePowerSystemsOn() //If there's no power, then no lights will be on. - - . += ..() - var/list/text = list() + . = ..() if(!haspower) - text += "The test light and all the other indicator lights are [SPAN_BAD("off")]!" - text += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up." + . += "The test light and all the other indicator lights are off!" + . += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up." else - text += "The test light is [SPAN_GOOD("on")]." - text += A.backup_power_lost_until ? "The backup power light is [SPAN_BAD("off")]!" : "The backup power light is [SPAN_GOOD("on")]." + . += "The test light is on." + . += A.backup_power_lost_until ? "The backup power light is off!" : "The backup power light is on." if(A.lights) // show different bolt message depending on whether we have lights - text += "The door bolt indicator lights are [SPAN_GOOD("on")]." - text += "They show the bolts are [A.locked ? SPAN_BAD("down") : SPAN_GOOD("up")]." + . += "The door bolt indicator lights are on." + . += "They show the bolts are [A.locked ? "down" : "up"]." else - text += "The door bolt indicator lights are [SPAN_BAD("off")]!" - text += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up." // this is a closer inspection + . += "The door bolt indicator lights are off!" + . += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up." // this is a closer inspection if(A.ai_control_disabled==0) if(A.emagged) - text += "The 'AI control allowed' light is red." + . += "The 'AI control allowed' light red." else if(A.ai_bolting) - text += "The 'AI control allowed' light is green." + . += "The 'AI control allowed' light is green." else - text += "The 'AI control allowed' light is orange." + . += "The 'AI control allowed' light is orange." else - text += "The 'AI control allowed' light is [SPAN_BAD("off")]." - text += A.safe==0 ? "The 'Check Wiring' light is [SPAN_GOOD("on")]." : "The 'Check Wiring' light is [SPAN_BAD("off")]." - text += A.normalspeed==0 ? "The 'Check Timing Mechanism' light is [SPAN_GOOD("on")]." : "The 'Check Timing Mechanism' light is [SPAN_BAD("off")]." - text += A.ai_disabled_id_scanner==0 ? "The IDScan light is [SPAN_GOOD("on")]." : "The IDScan light is [SPAN_BAD("off")]." - . += "
\n" + jointext(text, "
\n") + . += "The 'AI control allowed' light is off." + . += A.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off." + . += A.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off." + . += A.ai_disabled_id_scanner==0 ? "The IDScan light is on." : "The IDScan light is off." -/datum/wires/airlock/UpdateCut(var/index, var/mended) +/datum/wires/airlock/on_cut(wire, mend, source) var/obj/machinery/door/airlock/A = holder - switch(index) - if(AIRLOCK_WIRE_IDSCAN) - A.ai_disabled_id_scanner = !mended + switch(wire) + if(WIRE_IDSCAN) + A.ai_disabled_id_scanner = !mend - if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2) - if(!mended) + if(WIRE_POWER1, WIRE_POWER2) + if(!mend) //Cutting either one disables the main door power, but unless backup power is also cut, the backup power re-powers the door in 10 seconds. While unpowered, the door may be crowbarred open, but bolts-raising will not work. Cutting these wires may electocute the user. A.loseMainPower() A.shock(usr, 50) @@ -84,8 +86,8 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 A.regainMainPower() A.shock(usr, 50) - if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2) - if(!mended) + if(WIRE_BACKUP1, WIRE_BACKUP2) + if(!mend) //Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user. A.loseBackupPower() A.shock(usr, 50) @@ -93,14 +95,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 A.regainBackupPower() A.shock(usr, 50) - if(AIRLOCK_WIRE_DOOR_BOLTS) - if(!mended) + if(WIRE_BOLTS) + if(!mend) //Cutting this wire also drops the door bolts, and mending it does not raise them. (This is what happens now, except there are a lot more wires going to door bolts at present) A.lock(1) A.update_icon() - if(AIRLOCK_WIRE_AI_CONTROL) - if(!mended) + if(WIRE_AI) + if(!mend) //one wire for AI control. Cutting this prevents the AI from controlling the door unless it has hacked the door through the power connection (which takes about a minute). If both main and backup power are cut, as well as this wire, then the AI cannot operate or hack the door at all. //ai_control_disabled: If 1, AI control is disabled until the AI hacks back in and disables the lock. If 2, the AI has bypassed the lock. If -1, the control is enabled but the AI had bypassed it earlier, so if it is disabled again the AI would have no trouble getting back in. if(A.ai_control_disabled == 0) @@ -113,42 +115,42 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 else if(A.ai_control_disabled == 2) A.ai_control_disabled = -1 - if(AIRLOCK_WIRE_ELECTRIFY) - if(!mended) + if(WIRE_SHOCK) + if(!mend) //Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted. A.electrify(-1) else A.electrify(0) return // Don't update the dialog. - if (AIRLOCK_WIRE_SAFETY) - A.safe = mended + if (WIRE_SAFETY) + A.safe = mend - if(AIRLOCK_WIRE_SPEED) - A.autoclose = mended - if(mended) + if(WIRE_TIMING) + A.autoclose = mend + if(mend) if(!A.density) A.close() - if(AIRLOCK_WIRE_LIGHT) - A.lights = mended + if(WIRE_BOLTLIGHT) + A.lights = mend A.update_icon() -/datum/wires/airlock/UpdatePulsed(var/index) +/datum/wires/airlock/on_pulse(wire) var/obj/machinery/door/airlock/A = holder - switch(index) - if(AIRLOCK_WIRE_IDSCAN) + switch(wire) + if(WIRE_IDSCAN) //Sending a pulse through flashes the red light on the door (if the door has power). if(A.arePowerSystemsOn() && A.density) A.do_animate("deny") - if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2) + if(WIRE_POWER1, WIRE_POWER2) //Sending a pulse through either one causes a breaker to trip, disabling the door for 10 seconds if backup power is connected, or 1 minute if not (or until backup power comes back on, whichever is shorter). A.loseMainPower() - if(AIRLOCK_WIRE_DOOR_BOLTS) + if(WIRE_BOLTS) //one wire for door bolts. Sending a pulse through this drops door bolts if they're not down (whether power's on or not), //raises them if they are down (only if power's on) if(!A.locked) @@ -156,21 +158,21 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 else A.unlock() - if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2) + if(WIRE_BACKUP1, WIRE_BACKUP2) //two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter). A.loseBackupPower() - if(AIRLOCK_WIRE_AI_CONTROL) + if(WIRE_AI) //Sending a pulse toggles whether AI can bolt the doors (if not emagged) if(A.emagged) return A.ai_bolting = !A.ai_bolting - if(AIRLOCK_WIRE_ELECTRIFY) + if(WIRE_SHOCK) //one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds. A.electrify(30) - if(AIRLOCK_WIRE_OPEN_DOOR) + if(WIRE_OPEN) //tries to open the door without ID //will succeed only if the ID wire is cut or the door requires no access and it's not emagged if(A.emagged) @@ -181,50 +183,25 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 else A.close() - if(AIRLOCK_WIRE_SAFETY) + if(WIRE_SAFETY) A.safe = !A.safe if(!A.density) A.close() - if(AIRLOCK_WIRE_SPEED) + if(WIRE_TIMING) A.normalspeed = !A.normalspeed - if(AIRLOCK_WIRE_LIGHT) + if(WIRE_BOLTLIGHT) A.lights = !A.lights A.update_icon() /datum/wires/airlock/get_wire_diagram(var/mob/user) var/dat = "" - for(var/color in wires) - dat += "[capitalize(color)]: [index_to_type(GetIndex(color))]
" + for(var/color in colors) + if(is_dud_color(color)) + continue + dat += "[capitalize(color)]: [get_wire(color)]
" var/datum/browser/wire_win = new(user, "airlockwires", "Airlock Wires", 450, 500) wire_win.set_content(dat) wire_win.open() - -/datum/wires/airlock/proc/index_to_type(var/index) - switch(index) - if(AIRLOCK_WIRE_IDSCAN) - return "ID Scan" - if(AIRLOCK_WIRE_MAIN_POWER1) - return "Power" - if(AIRLOCK_WIRE_MAIN_POWER2) - return "Power" - if(AIRLOCK_WIRE_DOOR_BOLTS) - return "Bolts" - if(AIRLOCK_WIRE_BACKUP_POWER1) - return "Backup Power" - if(AIRLOCK_WIRE_BACKUP_POWER2) - return "Backup Power" - if(AIRLOCK_WIRE_OPEN_DOOR) - return "Actuation" - if(AIRLOCK_WIRE_AI_CONTROL) - return "AI Control" - if(AIRLOCK_WIRE_ELECTRIFY) - return "Anti-tampering" - if(AIRLOCK_WIRE_SAFETY) - return "Safety" - if(AIRLOCK_WIRE_SPEED) - return "Speed" - if(AIRLOCK_WIRE_LIGHT) - return "Bolt Lights" diff --git a/code/datums/wires/alarm.dm b/code/datums/wires/alarm.dm index 2fb801318ec..c94cd2f7133 100644 --- a/code/datums/wires/alarm.dm +++ b/code/datums/wires/alarm.dm @@ -1,58 +1,63 @@ /datum/wires/alarm + proper_name = "Air Alarm" holder_type = /obj/machinery/alarm - wire_count = 5 -var/const/AALARM_WIRE_IDSCAN = 1 -var/const/AALARM_WIRE_POWER = 2 -var/const/AALARM_WIRE_SYPHON = 4 -var/const/AALARM_WIRE_AI_CONTROL = 8 -var/const/AALARM_WIRE_AALARM = 16 +/datum/wires/airalarm/New(atom/holder) + wires = list( + WIRE_POWER, + WIRE_IDSCAN, WIRE_AI, + WIRE_PANIC, WIRE_ALARM + ) + add_duds(3) + ..() - -/datum/wires/alarm/CanUse(var/mob/living/L) +/datum/wires/airalarm/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/alarm/A = holder if(A.wiresexposed && A.buildstage == 2) - return 1 - return 0 + return TRUE -/datum/wires/alarm/GetInteractWindow() +/datum/wires/alarm/get_status() var/obj/machinery/alarm/A = holder - . += ..() - . += text("
\n[(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]
\n[((A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]
\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]") + . = ..() + . += A.locked ? "The air alarm is locked." : "The air alarm is unlocked." + . += (A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!" + . += A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on." -/datum/wires/alarm/UpdateCut(var/index, var/mended) +/datum/wires/alarm/on_cut(wire, mend, source) var/obj/machinery/alarm/A = holder - switch(index) - if(AALARM_WIRE_IDSCAN) - if(!mended) + switch(wire) + if(WIRE_IDSCAN) + if(!mend) A.locked = 1 - if(AALARM_WIRE_POWER) + if(WIRE_POWER) A.shock(usr, 50) - A.shorted = !mended + A.shorted = !mend A.update_icon() - if (AALARM_WIRE_AI_CONTROL) - if (A.aidisabled == !mended) - A.aidisabled = mended + if (WIRE_AI) + if (A.aidisabled == !mend) + A.aidisabled = mend - if(AALARM_WIRE_SYPHON) - if(!mended) + if(WIRE_PANIC) + if(!mend) A.mode = 3 // AALARM_MODE_PANIC A.apply_mode() - if(AALARM_WIRE_AALARM) + if(WIRE_ALARM) if (A.alarm_area.atmosalert(2, A)) A.post_alert(2) A.update_icon() -/datum/wires/alarm/UpdatePulsed(var/index) +/datum/wires/alarm/on_pulse(wire) var/obj/machinery/alarm/A = holder - switch(index) - if(AALARM_WIRE_IDSCAN) + switch(wire) + if(WIRE_IDSCAN) A.locked = !A.locked - if (AALARM_WIRE_POWER) + if (WIRE_POWER) if(A.shorted == 0) A.shorted = 1 A.update_icon() @@ -63,7 +68,7 @@ var/const/AALARM_WIRE_AALARM = 16 A.update_icon() - if (AALARM_WIRE_AI_CONTROL) + if (WIRE_AI) if (A.aidisabled == 0) A.aidisabled = 1 A.updateDialog() @@ -71,14 +76,14 @@ var/const/AALARM_WIRE_AALARM = 16 if (A.aidisabled == 1) A.aidisabled = 0 - if(AALARM_WIRE_SYPHON) + if(WIRE_PANIC) if(A.mode == 1) // AALARM_MODE_SCRUB A.mode = 3 // AALARM_MODE_PANIC else A.mode = 1 // AALARM_MODE_SCRUB A.apply_mode() - if(AALARM_WIRE_AALARM) + if(WIRE_ALARM) if (A.alarm_area.atmosalert(0, A)) A.post_alert(0) A.update_icon() diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm index 2f733592092..c44951a6b2f 100644 --- a/code/datums/wires/apc.dm +++ b/code/datums/wires/apc.dm @@ -1,36 +1,43 @@ /datum/wires/apc + proper_name = "APC" holder_type = /obj/machinery/power/apc - wire_count = 4 -#define APC_WIRE_IDSCAN (1<<0) -#define APC_WIRE_MAIN_POWER1 (1<<1) -#define APC_WIRE_MAIN_POWER2 (1<<2) -#define APC_WIRE_AI_CONTROL (1<<3) +/datum/wires/apc/New(atom/holder) + wires = list( + WIRE_POWER1, WIRE_POWER2, + WIRE_IDSCAN, WIRE_AI + ) + add_duds(6) + ..() -/datum/wires/apc/GetInteractWindow() +/datum/wires/apc/get_status() var/obj/machinery/power/apc/A = holder - . += ..() - . += text("
\n[(A.locked ? "The APC is locked." : "The APC is unlocked.")]
\n[(A.shorted ? "The APCs power has been shorted." : "The APC is working properly!")]
\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]") + . = ..() + . += A.locked ? "The APC is locked." : "The APC is unlocked." + . += A.shorted ? "The APCs power has been shorted." : "The APC is working properly!" + . += A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on." -/datum/wires/apc/CanUse(var/mob/living/L) +/datum/wires/apc/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/power/apc/A = holder return A?.wiresexposed -/datum/wires/apc/UpdatePulsed(var/index) +/datum/wires/apc/on_pulse(wire) var/obj/machinery/power/apc/A = holder - switch(index) + switch(wire) - if(APC_WIRE_IDSCAN) + if(WIRE_IDSCAN) set_locked(A, FALSE) addtimer(CALLBACK(src, PROC_REF(set_locked), A, TRUE), 30 SECONDS) - if (APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2) + if (WIRE_POWER1, WIRE_POWER2) set_short_out(A, TRUE) addtimer(CALLBACK(src, PROC_REF(set_short_out), A, FALSE), 120 SECONDS) - if (APC_WIRE_AI_CONTROL) + if (WIRE_AI) set_ai_control(A, TRUE) addtimer(CALLBACK(src, PROC_REF(set_ai_control), A, FALSE), 1 SECONDS) @@ -42,28 +49,28 @@ /datum/wires/apc/proc/set_short_out(var/obj/machinery/power/apc/A, var/setting) if(setting) A.shorted = TRUE - else if(A && !IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2)) + else if(A && !is_cut(WIRE_POWER1) && !is_cut(WIRE_POWER2)) A.shorted = FALSE /datum/wires/apc/proc/set_ai_control(var/obj/machinery/power/apc/A, var/setting) if(setting) A.aidisabled = TRUE - else if(A && !IsIndexCut(APC_WIRE_AI_CONTROL)) + else if(A && !is_cut(WIRE_AI)) A.aidisabled = FALSE -/datum/wires/apc/UpdateCut(var/index, var/mended) +/datum/wires/apc/on_cut(wire, mend, source) var/obj/machinery/power/apc/A = holder - switch(index) - if(APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2) + switch(wire) + if(WIRE_POWER1, WIRE_POWER2) - if(!mended) + if(!mend) A.shock(usr, 50) A.shorted = TRUE - else if(!IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2)) + else if(!is_cut(WIRE_POWER1) && !is_cut(WIRE_POWER2)) A.shorted = FALSE A.shock(usr, 50) - if(APC_WIRE_AI_CONTROL) - A.aidisabled = !mended + if(WIRE_AI) + A.aidisabled = !mend diff --git a/code/datums/wires/autolathe.dm b/code/datums/wires/autolathe.dm index 2a36323146e..d549767e571 100644 --- a/code/datums/wires/autolathe.dm +++ b/code/datums/wires/autolathe.dm @@ -1,55 +1,60 @@ /datum/wires/autolathe + proper_name = "Autolathe" holder_type = /obj/machinery/autolathe - wire_count = 6 -var/const/AUTOLATHE_HACK_WIRE = 1 -var/const/AUTOLATHE_SHOCK_WIRE = 2 -var/const/AUTOLATHE_DISABLE_WIRE = 4 +/datum/wires/autolathe/New(atom/holder) + wires = list( + WIRE_HACK, WIRE_DISABLE, + WIRE_SHOCK + ) + add_duds(2) + ..() -/datum/wires/autolathe/GetInteractWindow() +/datum/wires/autolathe/get_status() var/obj/machinery/autolathe/A = holder + . = ..() + . += "\The [A] [A.disabled ? "is dead quiet" : "has a soft electric whirr"]." + . += "\The [A] [A.shocked ? "is making sparking noises" : "is cycling normally"]." + . += "\The [A] [A.hacked ? "rarely" : "occasionally"] makes a beep boop noise." - . += ..() - . += "
\The [A] [A.disabled ? "is dead quiet" : "has a soft electric whirr"]." - . += "
\The [A] [A.shocked ? "is making sparking noises" : "is cycling normally"]." - . += "
\The [A] [A.hacked ? "rarely" : "occasionally"] makes a beep boop noise.
" - -/datum/wires/autolathe/CanUse() +/datum/wires/autolathe/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/autolathe/A = holder if(A.panel_open) return TRUE return FALSE -/datum/wires/autolathe/UpdateCut(index, mended) +/datum/wires/autolathe/on_cut(wire, mend, source) var/obj/machinery/autolathe/A = holder - switch(index) - if(AUTOLATHE_HACK_WIRE) - A.hacked = !mended - if(AUTOLATHE_SHOCK_WIRE) - A.shocked = !mended - if(AUTOLATHE_DISABLE_WIRE) - A.disabled = !mended + switch(wire) + if(WIRE_HACK) + A.hacked = !mend + if(WIRE_SHOCK) + A.shocked = !mend + if(WIRE_DISABLE) + A.disabled = !mend -/datum/wires/autolathe/UpdatePulsed(index) - if(IsIndexCut(index)) +/datum/wires/autolathe/on_pulse(wire) + if(is_cut(wire)) return var/obj/machinery/autolathe/A = holder - switch(index) - if(AUTOLATHE_HACK_WIRE) + switch(wire) + if(WIRE_HACK) A.hacked = !A.hacked spawn(50) - if(A && !IsIndexCut(index)) + if(A && !is_cut(wire)) A.hacked = 0 - Interact(usr) - if(AUTOLATHE_SHOCK_WIRE) + interact(usr) + if(WIRE_SHOCK) A.shocked = !A.shocked spawn(50) - if(A && !IsIndexCut(index)) + if(A && !is_cut(wire)) A.shocked = 0 - Interact(usr) - if(AUTOLATHE_DISABLE_WIRE) + interact(usr) + if(WIRE_DISABLE) A.disabled = !A.disabled spawn(50) - if(A && !IsIndexCut(index)) + if(A && !is_cut(wire)) A.disabled = 0 - Interact(usr) + interact(usr) diff --git a/code/datums/wires/camera.dm b/code/datums/wires/camera.dm index ad3a38f5ed5..4336d6465fd 100644 --- a/code/datums/wires/camera.dm +++ b/code/datums/wires/camera.dm @@ -1,73 +1,74 @@ // Wires for cameras. /datum/wires/camera + proper_name = "Camera" holder_type = /obj/machinery/camera - wire_count = 6 -/datum/wires/camera/GetInteractWindow() +/datum/wires/camera/New(atom/holder) + wires = list( + WIRE_POWER, WIRE_FOCUS, + WIRE_LIGHT, WIRE_ALARM + ) + add_duds(1) + ..() - . = ..() +/datum/wires/camera/get_status() var/obj/machinery/camera/C = holder - . += "
\n[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]" - . += "
\n[(C.can_use() ? "The power link light is on." : "The power link light is off.")]" - . += "
\n[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]" - . += "
\n[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]" - return . + . = ..() + . += "[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]" + . += "[(C.can_use() ? "The power link light is on." : "The power link light is off.")]" + . += "[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]" + . += "[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]" -/datum/wires/camera/CanUse(var/mob/living/L) +/datum/wires/camera/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/camera/C = holder return C.panel_open -var/const/CAMERA_WIRE_FOCUS = 1 -var/const/CAMERA_WIRE_POWER = 2 -var/const/CAMERA_WIRE_LIGHT = 4 -var/const/CAMERA_WIRE_ALARM = 8 -var/const/CAMERA_WIRE_NOTHING1 = 16 -var/const/CAMERA_WIRE_NOTHING2 = 32 - -/datum/wires/camera/UpdateCut(var/index, var/mended) +/datum/wires/camera/on_cut(wire, mend, source) var/obj/machinery/camera/C = holder - switch(index) - if(CAMERA_WIRE_FOCUS) - var/range = (mended ? initial(C.view_range) : C.short_range) + switch(wire) + if(WIRE_FOCUS) + var/range = (mend ? initial(C.view_range) : C.short_range) C.setViewRange(range) - if(CAMERA_WIRE_POWER) - if(C.status && !mended || !C.status && mended) + if(WIRE_POWER) + if(C.status && !mend || !C.status && mend) C.deactivate(usr, 1) - if(CAMERA_WIRE_LIGHT) - C.light_disabled = !mended + if(WIRE_LIGHT) + C.light_disabled = !mend - if(CAMERA_WIRE_ALARM) - if(!mended) + if(WIRE_ALARM) + if(!mend) C.triggerCameraAlarm() else C.cancelCameraAlarm() return -/datum/wires/camera/UpdatePulsed(var/index) +/datum/wires/camera/on_pulse(wire) var/obj/machinery/camera/C = holder - if(IsIndexCut(index)) + if(is_cut(wire)) return - switch(index) - if(CAMERA_WIRE_FOCUS) + switch(wire) + if(WIRE_FOCUS) var/new_range = (C.view_range == initial(C.view_range) ? C.short_range : initial(C.view_range)) C.setViewRange(new_range) - if(CAMERA_WIRE_POWER) + if(WIRE_POWER) C.kick_viewers() // Kicks anyone watching the camera - if(CAMERA_WIRE_LIGHT) + if(WIRE_LIGHT) C.light_disabled = !C.light_disabled - if(CAMERA_WIRE_ALARM) + if(WIRE_ALARM) C.visible_message("[icon2html(C, viewers(get_turf(C)))] *beep*", "[icon2html(C, viewers(get_turf(C)))] *beep*") return /datum/wires/camera/proc/CanDeconstruct() - if(IsIndexCut(CAMERA_WIRE_POWER) && IsIndexCut(CAMERA_WIRE_FOCUS) && IsIndexCut(CAMERA_WIRE_LIGHT) && IsIndexCut(CAMERA_WIRE_NOTHING1) && IsIndexCut(CAMERA_WIRE_NOTHING2)) - return 1 + if(is_cut(WIRE_POWER) && is_cut(WIRE_FOCUS) && is_cut(WIRE_LIGHT)) + return TRUE else - return 0 + return FALSE diff --git a/code/datums/wires/disposals.dm b/code/datums/wires/disposals.dm index 8419b8475a3..42b11e133ab 100644 --- a/code/datums/wires/disposals.dm +++ b/code/datums/wires/disposals.dm @@ -1,36 +1,41 @@ /datum/wires/disposal + proper_name = "Disposals" random = TRUE holder_type = /obj/machinery/disposal - wire_count = 3 -var/const/DISPOSAL_WIRE_FLUSH = 1 +/datum/wires/disposal/New(atom/holder) + wires = list( + WIRE_FLUSH + ) + add_duds(3) + ..() -/datum/wires/disposal/GetInteractWindow() +/datum/wires/disposal/get_status() + var/obj/machinery/disposal/D = holder . = ..() - - var/obj/machinery/disposal/D = holder . += "
\nThe light indicator inserted within the flush handle is [D.can_flush ? "on" : "off"]." - return . -/datum/wires/disposal/UpdateCut(var/index, var/mended) +/datum/wires/disposal/on_cut(wire, mend, source) var/obj/machinery/disposal/D = holder - switch(index) - if(DISPOSAL_WIRE_FLUSH) - if(!mended) + switch(wire) + if(WIRE_FLUSH) + if(!mend) D.can_flush = FALSE D.visible_message(SPAN_WARNING("\The [D] whines loudly."), range = 3) else D.can_flush = TRUE D.visible_message(SPAN_NOTICE("\The [D] hums soothingly."), range = 3) -/datum/wires/disposal/UpdatePulsed(var/index) +/datum/wires/disposal/on_pulse(wire) var/obj/machinery/disposal/D = holder - switch(index) - if(DISPOSAL_WIRE_FLUSH) + switch(wire) + if(WIRE_FLUSH) if(D.air_contents.return_pressure() >= (700 + ONE_ATMOSPHERE) || !D.uses_air) D.flush() -/datum/wires/disposal/CanUse(var/mob/living/L) +/datum/wires/disposal/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/disposal/D = holder if(D.mode <= 0) return TRUE diff --git a/code/datums/wires/explosive.dm b/code/datums/wires/explosive.dm index 97e2c8dd6f4..db992864312 100644 --- a/code/datums/wires/explosive.dm +++ b/code/datums/wires/explosive.dm @@ -1,30 +1,34 @@ -/datum/wires/explosive - wire_count = 1 - -var/const/WIRE_EXPLODE = 1 +/datum/wires/explosive/New() + wires = list( + WIRE_EXPLODE + ) + add_duds(4) + ..() /datum/wires/explosive/proc/explode() return -/datum/wires/explosive/UpdatePulsed(var/index) - switch(index) +/datum/wires/explosive/on_pulse(wire) + switch(wire) if(WIRE_EXPLODE) explode() -/datum/wires/explosive/UpdateCut(var/index, var/mended) - switch(index) +/datum/wires/explosive/on_cut(wire, mend, source) + switch(wire) if(WIRE_EXPLODE) - if(!mended) + if(!mend) explode() /datum/wires/explosive/c4 holder_type = /obj/item/plastique -/datum/wires/explosive/c4/CanUse(var/mob/living/L) +/datum/wires/explosive/c4/interactable(mob/user) + if(!..()) + return FALSE var/obj/item/plastique/P = holder if(P.open_panel) - return 1 - return 0 + return TRUE + return FALSE /datum/wires/explosive/c4/explode() var/obj/item/plastique/P = holder diff --git a/code/datums/wires/iff.dm b/code/datums/wires/iff.dm index b3e9a05e5cc..9be8cae7586 100644 --- a/code/datums/wires/iff.dm +++ b/code/datums/wires/iff.dm @@ -1,24 +1,31 @@ /datum/wires/iff + proper_name = "IFF Beacon" holder_type = /obj/machinery/iff_beacon - wire_count = 1 -#define IFF_WIRE_RESET 1 +/datum/wires/iff/New() + wires = list( + WIRE_RESET + ) + add_duds(2) + ..() -/datum/wires/iff/GetInteractWindow() +/datum/wires/iff/get_status() var/obj/machinery/iff_beacon/I = holder . += ..() - . += text("
\n[(I.use_power ? "The beacon is transmitting." : "The beacon is not transmitting.")]") + . += "[(I.use_power ? "The beacon is transmitting." : "The beacon is not transmitting.")]" -/datum/wires/iff/CanUse(var/mob/living/L) +/datum/wires/iff/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/iff_beacon/I = holder return I.panel_open -/datum/wires/iff/UpdateCut(var/index, var/mended) +/datum/wires/iff/on_cut(wire, mend, source) var/obj/machinery/iff_beacon/I = holder - switch(index) - if(IFF_WIRE_RESET) - if(!mended) + switch(wire) + if(WIRE_RESET) + if(!mend) I.shock(usr, 50) I.toggle() I.disable() diff --git a/code/datums/wires/ipc_tag_scanner.dm b/code/datums/wires/ipc_tag_scanner.dm index 75d7e007a6e..a812d9674e0 100644 --- a/code/datums/wires/ipc_tag_scanner.dm +++ b/code/datums/wires/ipc_tag_scanner.dm @@ -1,34 +1,35 @@ /datum/wires/tag_scanner + proper_name = "IPC Tag Scanner" random = TRUE holder_type = /obj/item/ipc_tag_scanner - wire_count = 4 -var/const/TAG_WIRE_DUMMY_ONE = 1 -var/const/TAG_WIRE_POWER = 2 -var/const/TAG_WIRE_DUMMY_TWO = 4 -var/const/TAG_WIRE_HACK = 8 - -/datum/wires/tag_scanner/GetInteractWindow() - . = ..() +/datum/wires/tag_scanner/New() + wires = list( + WIRE_POWER, WIRE_HACK + ) + add_duds(4) + ..() +/datum/wires/tag_scanner/get_status() var/obj/item/ipc_tag_scanner/S = holder - . += text("
\n[(S.powered ? "The scanlight is steady." : "The scanlight is strobing.")]") - . += text("
\n[(S.hacked ? "The scanlight is red." : "The scanlight is purple.")]") + . = ..() + . += "[(S.powered ? "The scanlight is steady." : "The scanlight is strobing.")]" + . += "[(S.hacked ? "The scanlight is red." : "The scanlight is purple.")]" return . -/datum/wires/tag_scanner/UpdateCut(var/index, var/mended) +/datum/wires/tag_scanner/on_cut(wire, mend, source) var/obj/item/ipc_tag_scanner/S = holder - switch(index) - if(TAG_WIRE_POWER) - if(!mended) + switch(wire) + if(WIRE_POWER) + if(!mend) S.powered = FALSE S.visible_message(SPAN_WARNING("\The [S] whines loudly."), range = 3) else S.powered = TRUE S.visible_message(SPAN_NOTICE("\The [S] hums soothingly."), range = 3) - if(TAG_WIRE_HACK) - if(!mended) + if(WIRE_HACK) + if(!mend) S.hacked = TRUE S.visible_message(SPAN_WARNING("\The [S] starts beeping incessantly."), range = 3) else @@ -36,16 +37,18 @@ var/const/TAG_WIRE_HACK = 8 S.visible_message(SPAN_NOTICE("\The [S] hums soothingly."), range = 3) -/datum/wires/tag_scanner/UpdatePulsed(var/index) +/datum/wires/tag_scanner/on_pulse(wire) var/obj/item/ipc_tag_scanner/S = holder - switch(index) - if(TAG_WIRE_POWER) + switch(wire) + if(WIRE_POWER) S.visible_message(SPAN_WARNING("[icon2html(S, viewers(get_turf(S)))] [capitalize_first_letters(S.name)] beeps, \"BOOWEEEP!\"")) - if(TAG_WIRE_HACK) + if(WIRE_HACK) S.visible_message(SPAN_WARNING("[icon2html(S, viewers(get_turf(S)))] [capitalize_first_letters(S.name)] beeps, \"BEEYUUP!\"")) -/datum/wires/tag_scanner/CanUse(var/mob/living/L) +/datum/wires/tag_scanner/interactable(mob/user) + if(!..()) + return FALSE var/obj/item/ipc_tag_scanner/S = holder if(S.wires_exposed) return TRUE diff --git a/code/datums/wires/landmine.dm b/code/datums/wires/landmine.dm index 8b7cddc7abd..9a48949361c 100644 --- a/code/datums/wires/landmine.dm +++ b/code/datums/wires/landmine.dm @@ -1,24 +1,30 @@ -/datum/wires/landmine - wire_count = 1 +/datum/wires/landmine/New() + wires = list( + WIRE_EXPLODE + ) + add_duds(3) + ..() /datum/wires/landmine/proc/explode() return -/datum/wires/landmine/UpdatePulsed(var/index) - switch(index) +/datum/wires/landmine/on_pulse(wire, user) + switch(wire) if(WIRE_EXPLODE) explode() -/datum/wires/landmine/UpdateCut(var/index, var/mended) - switch(index) +/datum/wires/landmine/on_cut(wire, mend, source) + switch(wire) if(WIRE_EXPLODE) - if(!mended) + if(!mend) explode() /datum/wires/landmine/claymore holder_type = /obj/item/landmine/claymore -/datum/wires/landmine/claymore/CanUse(var/mob/living/L) +/datum/wires/landmine/claymore/interactable(mob/user) + if(!..()) + return var/obj/item/landmine/claymore/claymore = holder if(!claymore.deactivated && claymore.deployed) return TRUE diff --git a/code/datums/wires/nuclearbomb.dm b/code/datums/wires/nuclearbomb.dm index b33daa753e4..f01b3ce24e2 100644 --- a/code/datums/wires/nuclearbomb.dm +++ b/code/datums/wires/nuclearbomb.dm @@ -1,38 +1,45 @@ /datum/wires/nuclearbomb + proper_name = "Nuclear Fission Device" holder_type = /obj/machinery/nuclearbomb random = 1 - wire_count = 7 -var/const/NUCLEARBOMB_WIRE_LIGHT = 1 -var/const/NUCLEARBOMB_WIRE_TIMING = 2 -var/const/NUCLEARBOMB_WIRE_SAFETY = 4 +/datum/wires/nuclearbomb/New() + wires = list( + WIRE_LIGHT, WIRE_TIMING, + WIRE_SAFETY + ) + /// Listen, Derek. I know you're a surgeon, but... + add_duds(2) + ..() -/datum/wires/nuclearbomb/CanUse(var/mob/living/L) +/datum/wires/nuclearbomb/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/nuclearbomb/N = holder return N.panel_open -/datum/wires/nuclearbomb/GetInteractWindow() +/datum/wires/nuclearbomb/get_status() var/obj/machinery/nuclearbomb/N = holder . += ..() - . += "
The device is [N.timing ? "shaking!" : "still."]
" - . += "The device is is [N.safety ? "quiet" : "whirring"].
" - . += "The lights are [N.lighthack ? "static" : "functional"].
" + . += "The device is [N.timing ? "shaking!" : "still."]" + . += "The device is is [N.safety ? "quiet" : "whirring"]." + . += "The lights are [N.lighthack ? "static" : "functional"]." -/datum/wires/nuclearbomb/UpdatePulsed(var/index) +/datum/wires/nuclearbomb/on_pulse(wire) var/obj/machinery/nuclearbomb/N = holder - switch(index) - if(NUCLEARBOMB_WIRE_LIGHT) + switch(wire) + if(WIRE_LIGHT) N.lighthack = !N.lighthack N.update_icon() spawn(100) N.lighthack = !N.lighthack N.update_icon() - if(NUCLEARBOMB_WIRE_TIMING) + if(WIRE_TIMING) if(N.timing) spawn log_and_message_admins("pulsed a nuclear bomb's detonation wire, causing it to explode.") N.explode() - if(NUCLEARBOMB_WIRE_SAFETY) + if(WIRE_SAFETY) N.safety = !N.safety spawn(100) N.safety = !N.safety @@ -42,17 +49,17 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4 else N.visible_message("\The [N] emits a quiet whirling noise!") -/datum/wires/nuclearbomb/UpdateCut(var/index, var/mended) +/datum/wires/nuclearbomb/on_cut(wire, mend, source) var/obj/machinery/nuclearbomb/N = holder - switch(index) - if(NUCLEARBOMB_WIRE_SAFETY) - N.safety = mended + switch(wire) + if(WIRE_SAFETY) + N.safety = mend if(N.timing) spawn log_and_message_admins("cut a nuclear bomb's timing wire, causing it to explode.") N.explode() - if(NUCLEARBOMB_WIRE_TIMING) + if(WIRE_TIMING) N.secure_device() - if(NUCLEARBOMB_WIRE_LIGHT) - N.lighthack = !mended + if(WIRE_LIGHT) + N.lighthack = !mend N.update_icon() diff --git a/code/datums/wires/particle_accelerator.dm b/code/datums/wires/particle_accelerator.dm index 2e085a544bd..38b87c386c7 100644 --- a/code/datums/wires/particle_accelerator.dm +++ b/code/datums/wires/particle_accelerator.dm @@ -1,47 +1,52 @@ /datum/wires/particle_acc/control_box - wire_count = 4 + proper_name = "Particle Accelerator" holder_type = /obj/machinery/particle_accelerator/control_box -var/const/PARTICLE_TOGGLE_WIRE = 1 // Toggles whether the PA is on or not. -var/const/PARTICLE_STRENGTH_WIRE = 2 // Determines the strength of the PA. -var/const/PARTICLE_LIMIT_POWER_WIRE = 4 // Determines how strong the PA can be. +/datum/wires/particle_acc/control_box/New() + wires = list( + WIRE_POWER, + WIRE_STRENGTH, WIRE_POWER_LIMIT + ) + add_duds(2) + ..() -/datum/wires/particle_acc/control_box/GetInteractWindow() +/datum/wires/particle_acc/control_box/get_status() var/obj/machinery/particle_accelerator/control_box/C = holder . += ..() - . += text("
\n[]
\n[]
\n[]", - ((C.active && C.assembled) ? "The firing light is on." : "The firing light is off."), - (C.strength ? "The strength light is blinking." : "The strength light is off."), - (C.strength_upper_limit == 2 ? "The strength limiter light is on." : "The strength limiter light is off.")) + . += (C.active && C.assembled) ? "The firing light is on." : "The firing light is off." + . += C.strength ? "The strength light is blinking." : "The strength light is off." + . += C.strength_upper_limit == 2 ? "The strength limiter light is on." : "The strength limiter light is off." -/datum/wires/particle_acc/control_box/CanUse(var/mob/living/L) +/datum/wires/particle_acc/control_box/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/particle_accelerator/control_box/C = holder if(C.construction_state == 2) - return 1 - return 0 + return TRUE + return FALSE -/datum/wires/particle_acc/control_box/UpdatePulsed(var/index) +/datum/wires/particle_acc/control_box/on_pulse(wire) var/obj/machinery/particle_accelerator/control_box/C = holder - switch(index) + switch(wire) - if(PARTICLE_TOGGLE_WIRE) + if(WIRE_POWER) C.toggle_power(usr) - if(PARTICLE_STRENGTH_WIRE) + if(WIRE_STRENGTH) C.add_strength() - if(PARTICLE_LIMIT_POWER_WIRE) + if(WIRE_POWER_LIMIT) C.visible_message("[icon2html(C, viewers(get_turf(C)))][C] makes a large whirring noise.") -/datum/wires/particle_acc/control_box/UpdateCut(var/index, var/mended) +/datum/wires/particle_acc/control_box/on_cut(wire, mend, source) var/obj/machinery/particle_accelerator/control_box/C = holder - switch(index) + switch(wire) - if(PARTICLE_TOGGLE_WIRE) - if(C.active == !mended) + if(WIRE_POWER) + if(C.active == !mend) C.toggle_power(usr) - if(PARTICLE_LIMIT_POWER_WIRE) - C.strength_upper_limit = (mended ? 2 : 3) + if(WIRE_POWER_LIMIT) + C.strength_upper_limit = (mend ? 2 : 3) if(C.strength_upper_limit < C.strength) C.remove_strength() diff --git a/code/datums/wires/radio.dm b/code/datums/wires/radio.dm index b920f9a1f68..87169812c51 100644 --- a/code/datums/wires/radio.dm +++ b/code/datums/wires/radio.dm @@ -1,41 +1,48 @@ /datum/wires/radio + proper_name = "Radio" holder_type = /obj/item/device/radio - wire_count = 3 -var/const/WIRE_SIGNAL = 1 -var/const/WIRE_RECEIVE = 2 -var/const/WIRE_TRANSMIT = 4 +/datum/wires/radio/New() + wires = list( + WIRE_SIGNAL, + WIRE_RECEIVE, + WIRE_TRANSMIT + ) + add_duds(1) + ..() -/datum/wires/radio/CanUse(var/mob/living/L) +/datum/wires/radio/interactable(mob/user) + if(!..()) + return FALSE var/obj/item/device/radio/R = holder if(R.b_stat) - return 1 - return 0 + return TRUE + return FALSE -/datum/wires/radio/UpdatePulsed(var/index) +/datum/wires/radio/on_pulse(wire) var/obj/item/device/radio/R = holder - switch(index) + switch(wire) if(WIRE_SIGNAL) - R.set_listening(!R.get_listening() && !IsIndexCut(WIRE_RECEIVE)) - R.set_broadcasting(R.get_listening() && !IsIndexCut(WIRE_TRANSMIT)) + R.set_listening(!R.get_listening() && !is_cut(WIRE_RECEIVE)) + R.set_broadcasting(R.get_listening() && !is_cut(WIRE_TRANSMIT)) if(WIRE_RECEIVE) - R.set_listening(!R.get_listening() && !IsIndexCut(WIRE_SIGNAL)) + R.set_listening(!R.get_listening() && !is_cut(WIRE_SIGNAL)) if(WIRE_TRANSMIT) - R.set_broadcasting(!R.get_broadcasting() && !IsIndexCut(WIRE_SIGNAL)) + R.set_broadcasting(!R.get_broadcasting() && !is_cut(WIRE_SIGNAL)) SSnanoui.update_uis(holder) -/datum/wires/radio/UpdateCut(var/index, var/mended) +/datum/wires/radio/on_cut(wire, mend, source) var/obj/item/device/radio/R = holder - switch(index) + switch(wire) if(WIRE_SIGNAL) - R.set_listening(mended && !IsIndexCut(WIRE_RECEIVE)) - R.set_broadcasting(mended && !IsIndexCut(WIRE_TRANSMIT)) + R.set_listening(mend && !is_cut(WIRE_RECEIVE)) + R.set_broadcasting(mend && !is_cut(WIRE_TRANSMIT)) if(WIRE_RECEIVE) - R.set_listening(mended && !IsIndexCut(WIRE_SIGNAL)) + R.set_listening(mend && !is_cut(WIRE_SIGNAL)) if(WIRE_TRANSMIT) - R.set_broadcasting(mended && !IsIndexCut(WIRE_SIGNAL)) + R.set_broadcasting(mend && !is_cut(WIRE_SIGNAL)) SSnanoui.update_uis(holder) diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index 5182da6dbb5..3a9043cdf86 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -1,30 +1,32 @@ /datum/wires/robot - random = 1 + proper_name = "Synthetic" + random = TRUE holder_type = /mob/living/silicon/robot - wire_count = 5 -var/const/BORG_WIRE_LAWCHECK = 1 -var/const/BORG_WIRE_MAIN_POWER = 2 // The power wires do nothing whyyyyyyyyyyyyy -var/const/BORG_WIRE_LOCKED_DOWN = 4 -var/const/BORG_WIRE_AI_CONTROL = 8 -var/const/BORG_WIRE_CAMERA = 16 - -/datum/wires/robot/GetInteractWindow() +/datum/wires/robot/New() + wires = list( + WIRE_LAWSYNC, + WIRE_AI, + WIRE_CAMERA, + WIRE_LOCKDOWN + ) + add_duds(2) + ..() +/datum/wires/robot/get_status() + var/mob/living/silicon/robot/R = holder . = ..() - var/mob/living/silicon/robot/R = holder - . += text("
\n[(R.law_update ? "The LawSync light is on." : "The LawSync light is off.")]") - . += text("
\n[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]") - . += text("
\n[((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]") - . += text("
\n[(R.lock_charge ? "The lockdown light is on." : "The lockdown light is off.")]") - return . + . += "[(R.law_update ? "The LawSync light is on." : "The LawSync light is off.")]" + . += "[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]" + . += "[((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]" + . += "[(R.lock_charge ? "The lockdown light is on." : "The lockdown light is off.")]" -/datum/wires/robot/UpdateCut(var/index, var/mended) +/datum/wires/robot/on_cut(wire, mend, source) var/mob/living/silicon/robot/R = holder - switch(index) - if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI - if(!mended) + switch(wire) + if(WIRE_LAWSYNC) //Cut the law wire, and the borg will no longer receive law updates from its AI + if(!mend) if (R.law_update == 1) to_chat(R, "LawSync protocol engaged.") R.show_laws() @@ -32,48 +34,46 @@ var/const/BORG_WIRE_CAMERA = 16 if (R.law_update == 0 && !R.emagged) R.law_update = 1 - if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control - if(!mended) + if (WIRE_AI) //Cut the AI wire to reset AI control + if(!mend) R.disconnect_from_ai() - if (BORG_WIRE_CAMERA) + if (WIRE_CAMERA) if(!isnull(R.camera) && !R.scrambled_codes) - R.camera.status = mended + R.camera.status = mend R.camera.kick_viewers() // Will kick anyone who is watching the Cyborg's camera. - if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh + if(WIRE_LAWSYNC) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh if (R.law_update) R.lawsync() - if(BORG_WIRE_LOCKED_DOWN) - R.SetLockdown(!mended) + if(WIRE_LOCKDOWN) + R.SetLockdown(!mend) - -/datum/wires/robot/UpdatePulsed(var/index) +/datum/wires/robot/on_pulse(wire) var/mob/living/silicon/robot/R = holder - switch(index) - if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI + switch(wire) + if (WIRE_AI) //pulse the AI wire to make the borg reselect an AI if(!R.emagged) var/mob/living/silicon/ai/new_ai = select_active_ai(R) R.connect_to_ai(new_ai) - if (BORG_WIRE_CAMERA) + if (WIRE_CAMERA) if(!isnull(R.camera) && R.camera.can_use() && !R.scrambled_codes) R.camera.kick_viewers() // Kick anyone watching the Cyborg's camera R.visible_message("[R]'s camera lense focuses loudly.") to_chat(R, "Your camera lense focuses loudly.") - if(BORG_WIRE_LOCKED_DOWN) + if(WIRE_LOCKDOWN) R.SetLockdown(!R.lock_charge) // Toggle -/datum/wires/robot/CanUse(var/mob/living/L) +/datum/wires/robot/interactable(mob/user) + if(!..()) + return FALSE var/mob/living/silicon/robot/R = holder if(R.wires_exposed) - return 1 - return 0 - -/datum/wires/robot/proc/IsCameraCut() - return wires_status & BORG_WIRE_CAMERA + return TRUE + return FALSE /datum/wires/robot/proc/LockedCut() - return wires_status & BORG_WIRE_LOCKED_DOWN + return is_cut(WIRE_LOCKDOWN) diff --git a/code/datums/wires/smartfridge.dm b/code/datums/wires/smartfridge.dm index 06c5799120f..92c56a3c24a 100644 --- a/code/datums/wires/smartfridge.dm +++ b/code/datums/wires/smartfridge.dm @@ -1,69 +1,75 @@ /datum/wires/smartfridge + proper_name = "SmartFridge" holder_type = /obj/machinery/smartfridge - wire_count = 5 + +/datum/wires/smartfridge/New() + wires = list( + WIRE_THROW, + WIRE_SHOCK, + WIRE_IDSCAN, + WIRE_COOLING, + WIRE_HEATING + ) + add_duds(1) + ..() /datum/wires/smartfridge/secure random = 1 - wire_count = 6 -var/const/SMARTFRIDGE_WIRE_ELECTRIFY = 1 -var/const/SMARTFRIDGE_WIRE_THROW = 2 -var/const/SMARTFRIDGE_WIRE_IDSCAN = 4 -var/const/SMARTFRIDGE_WIRE_COOLING = 8 -var/const/SMARTFRIDGE_WIRE_HEATING = 16 - -/datum/wires/smartfridge/CanUse(var/mob/living/L) +/datum/wires/smartfridge/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/smartfridge/S = holder - if(!istype(L, /mob/living/silicon)) + if(!istype(user, /mob/living/silicon)) if(S.seconds_electrified) - if(S.shock(L, 100)) - return 0 + if(S.shock(user, 100)) + return FALSE if(S.panel_open) - return 1 - return 0 + return TRUE + return FALSE -/datum/wires/smartfridge/GetInteractWindow() +/datum/wires/smartfridge/get_status() var/obj/machinery/smartfridge/S = holder . += ..() - . += "
The orange light is [S.seconds_electrified ? "off" : "on"].
" - . += "The red light is [S.shoot_inventory ? "off" : "blinking"].
" - . += "A [S.scan_id ? "purple" : "yellow"] light is on.
" - . += "The cyan light is [S.cooling ? "on" : "off"].
" - . += "The blue light is [S.heating ? "on" : "off"].
" + . += "The orange light is [S.seconds_electrified ? "off" : "on"]." + . += "The red light is [S.shoot_inventory ? "off" : "blinking"]." + . += "A [S.scan_id ? "purple" : "yellow"] light is on." + . += "The cyan light is [S.cooling ? "on" : "off"]." + . += "The blue light is [S.heating ? "on" : "off"]." -/datum/wires/smartfridge/UpdatePulsed(var/index) +/datum/wires/smartfridge/on_pulse(wire) var/obj/machinery/smartfridge/S = holder - switch(index) - if(SMARTFRIDGE_WIRE_THROW) + switch(wire) + if(WIRE_THROW) S.shoot_inventory = !S.shoot_inventory - if(SMARTFRIDGE_WIRE_ELECTRIFY) + if(WIRE_SHOCK) S.seconds_electrified = 30 - if(SMARTFRIDGE_WIRE_IDSCAN) + if(WIRE_IDSCAN) S.scan_id = !S.scan_id - if(SMARTFRIDGE_WIRE_COOLING) + if(WIRE_COOLING) S.cooling = !S.cooling S.heating = FALSE - if(SMARTFRIDGE_WIRE_HEATING) + if(WIRE_HEATING) S.heating = !S.cooling S.cooling = FALSE -/datum/wires/smartfridge/UpdateCut(var/index, var/mended) +/datum/wires/smartfridge/on_cut(wire, mend, source) var/obj/machinery/smartfridge/S = holder - switch(index) - if(SMARTFRIDGE_WIRE_THROW) - S.shoot_inventory = !mended - if(SMARTFRIDGE_WIRE_ELECTRIFY) - if(mended) + switch(wire) + if(WIRE_THROW) + S.shoot_inventory = !mend + if(WIRE_SHOCK) + if(mend) S.seconds_electrified = 0 else S.seconds_electrified = -1 - if(SMARTFRIDGE_WIRE_IDSCAN) + if(WIRE_IDSCAN) S.scan_id = 1 - if(SMARTFRIDGE_WIRE_COOLING) - S.cooling = mended + if(WIRE_COOLING) + S.cooling = mend S.heating = FALSE - if(SMARTFRIDGE_WIRE_HEATING) - S.heating = mended + if(WIRE_HEATING) + S.heating = mend S.cooling = FALSE diff --git a/code/datums/wires/smes.dm b/code/datums/wires/smes.dm index 5df9d1eb3f4..2ce562eb2a3 100644 --- a/code/datums/wires/smes.dm +++ b/code/datums/wires/smes.dm @@ -1,58 +1,62 @@ /datum/wires/smes + proper_name = "SMES" holder_type = /obj/machinery/power/smes/buildable - wire_count = 5 -var/const/SMES_WIRE_RCON = 1 // Remote control (AI and consoles), cut to disable -var/const/SMES_WIRE_INPUT = 2 // Input wire, cut to disable input, pulse to disable for 60s -var/const/SMES_WIRE_OUTPUT = 4 // Output wire, cut to disable output, pulse to disable for 60s -var/const/SMES_WIRE_GROUNDING = 8 // Cut to quickly discharge causing sparks, pulse to only create few sparks -var/const/SMES_WIRE_FAILSAFES = 16 // Cut to disable failsafes, mend to reenable +/datum/wires/smes/New() + wires = list( + WIRE_RCON, + WIRE_INPUT, + WIRE_OUTPUT, + WIRE_GROUNDING, + WIRE_FAILSAFES + ) + add_duds(1) + ..() - -/datum/wires/smes/CanUse(var/mob/living/L) +/datum/wires/smes/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/power/smes/buildable/S = holder if(S.open_hatch) - return 1 - return 0 + return TRUE + return FALSE - -/datum/wires/smes/GetInteractWindow() +/datum/wires/smes/get_status() var/obj/machinery/power/smes/buildable/S = holder . += ..() - . += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]
" - . += "The red light is [(S.safeties_enabled || S.grounding) ? "off" : "blinking"]
" - . += "The blue light is [S.RCon ? "on" : "off"]" + . += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]." + . += "The red light is [(S.safeties_enabled || S.grounding) ? "off" : "blinking"]." + . += "The blue light is [S.RCon ? "on" : "off"]." - -/datum/wires/smes/UpdateCut(var/index, var/mended) +/datum/wires/smes/on_cut(wire, mend, source) var/obj/machinery/power/smes/buildable/S = holder - switch(index) - if(SMES_WIRE_RCON) - S.RCon = mended - if(SMES_WIRE_INPUT) - S.input_cut = !mended - if(SMES_WIRE_OUTPUT) - S.output_cut = !mended - if(SMES_WIRE_GROUNDING) - S.grounding = mended - if(SMES_WIRE_FAILSAFES) - S.safeties_enabled = mended + switch(wire) + if(WIRE_RCON) + S.RCon = mend + if(WIRE_INPUT) + S.input_cut = !mend + if(WIRE_OUTPUT) + S.output_cut = !mend + if(WIRE_GROUNDING) + S.grounding = mend + if(WIRE_FAILSAFES) + S.safeties_enabled = mend -/datum/wires/smes/UpdatePulsed(var/index) +/datum/wires/smes/on_pulse(wire) var/obj/machinery/power/smes/buildable/S = holder - switch(index) - if(SMES_WIRE_RCON) + switch(wire) + if(WIRE_RCON) if(S.RCon) S.RCon = 0 addtimer(CALLBACK(S, TYPE_PROC_REF(/obj/machinery/power/smes/buildable, reset_rcon)), 10) - if(SMES_WIRE_INPUT) + if(WIRE_INPUT) S.toggle_input() - if(SMES_WIRE_OUTPUT) + if(WIRE_OUTPUT) S.toggle_output() - if(SMES_WIRE_GROUNDING) + if(WIRE_GROUNDING) S.grounding = 0 - if(SMES_WIRE_FAILSAFES) + if(WIRE_FAILSAFES) if(S.safeties_enabled) S.safeties_enabled = 0 addtimer(CALLBACK(S, TYPE_PROC_REF(/obj/machinery/power/smes/buildable, reset_safeties)), 10) diff --git a/code/datums/wires/suit_storage_unit.dm b/code/datums/wires/suit_storage_unit.dm index c2d1a130d79..eaa517db512 100644 --- a/code/datums/wires/suit_storage_unit.dm +++ b/code/datums/wires/suit_storage_unit.dm @@ -1,47 +1,54 @@ /datum/wires/suit_storage_unit + proper_name = "Suit Storage Unit" holder_type = /obj/machinery/suit_cycler - wire_count = 3 -var/const/SUIT_STORAGE_WIRE_ELECTRIFY = 1 -var/const/SUIT_STORAGE_WIRE_SAFETY = 2 -var/const/SUIT_STORAGE_WIRE_LOCKED = 4 +/datum/wires/suit_storage_unit/New() + wires = list( + WIRE_SAFETY, + WIRE_SHOCK, + WIRE_LOCKDOWN + ) + add_duds(1) + ..() -/datum/wires/suit_storage_unit/CanUse(var/mob/living/L) +/datum/wires/suit_storage_unit/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/suit_cycler/S = holder - if(!istype(L, /mob/living/silicon)) + if(!istype(user, /mob/living/silicon)) if(S.electrified) - if(S.shock(L, 100)) - return 0 + if(S.shock(user, 100)) + return FALSE if(S.panel_open) - return 1 - return 0 + return TRUE + return FALSE -/datum/wires/suit_storage_unit/GetInteractWindow() +/datum/wires/suit_storage_unit/get_status() var/obj/machinery/suit_cycler/S = holder . += ..() - . += "
The orange light is [S.electrified ? "off" : "on"].
" - . += "The red light is [S.safeties ? "off" : "blinking"].
" - . += "The yellow light is [S.locked ? "on" : "off"].
" + . += "The orange light is [S.electrified ? "off" : "on"]." + . += "The red light is [S.safeties ? "off" : "blinking"]." + . += "The yellow light is [S.locked ? "on" : "off"]." -/datum/wires/suit_storage_unit/UpdatePulsed(var/index) +/datum/wires/suit_storage_unit/on_pulse(wire) var/obj/machinery/suit_cycler/S = holder - switch(index) - if(SUIT_STORAGE_WIRE_SAFETY) + switch(wire) + if(WIRE_SAFETY) S.safeties = !S.safeties - if(SUIT_STORAGE_WIRE_ELECTRIFY) + if(WIRE_SHOCK) S.electrified = 30 - if(SUIT_STORAGE_WIRE_LOCKED) + if(WIRE_LOCKDOWN) S.locked = !S.locked -/datum/wires/suit_storage_unit/UpdateCut(var/index, var/mended) +/datum/wires/suit_storage_unit/on_cut(wire, mend, source) var/obj/machinery/suit_cycler/S = holder - switch(index) - if(SUIT_STORAGE_WIRE_SAFETY) - S.safeties = mended - if(SUIT_STORAGE_WIRE_LOCKED) - S.locked = mended - if(SUIT_STORAGE_WIRE_ELECTRIFY) - if(mended) + switch(wire) + if(WIRE_SAFETY) + S.safeties = mend + if(WIRE_SHOCK) + S.locked = mend + if(WIRE_LOCKDOWN) + if(mend) S.electrified = 0 else S.electrified = -1 diff --git a/code/datums/wires/vending.dm b/code/datums/wires/vending.dm index 983a12c652b..82cad00569a 100644 --- a/code/datums/wires/vending.dm +++ b/code/datums/wires/vending.dm @@ -1,92 +1,85 @@ /datum/wires/vending + proper_name = "Vending Machine" holder_type = /obj/machinery/vending - wire_count = 6 + +/datum/wires/vending/New() + wires = list( + WIRE_THROW, + WIRE_CONTRABAND, + WIRE_SHOCK, + WIRE_IDSCAN, + WIRE_COOLING, + WIRE_HEATING + ) + ..() /datum/wires/vending/blueprint cares_about_holder = FALSE -var/const/VENDING_WIRE_THROW = 1 -var/const/VENDING_WIRE_CONTRABAND = 2 -var/const/VENDING_WIRE_ELECTRIFY = 4 -var/const/VENDING_WIRE_IDSCAN = 8 -var/const/VENDING_WIRE_COOLING = 16 -var/const/VENDING_WIRE_HEATING = 32 - -/datum/wires/vending/CanUse(var/mob/living/L) +/datum/wires/vending/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/vending/V = holder - if(!istype(L, /mob/living/silicon)) + if(!istype(user, /mob/living/silicon)) if(V.seconds_electrified) - if(V.shock(L, 100)) - return 0 + if(V.shock(user, 100)) + return FALSE if(V.panel_open) - return 1 - return 0 + return TRUE + return FALSE -/datum/wires/vending/GetInteractWindow() +/datum/wires/vending/get_status() var/obj/machinery/vending/V = holder . += ..() - . += "
The orange light is [V.seconds_electrified ? "off" : "on"].
" - . += "The red light is [V.shoot_inventory ? "off" : "blinking"].
" - . += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"].
" - . += "The [V.scan_id ? "purple" : "yellow"] light is on.
" - . += "The cyan light is [V.temperature_setting == -1 ? "on" : "off"].
" - . += "The blue light is [V.temperature_setting == 1 ? "on" : "off"].
" + . += "The orange light is [V.seconds_electrified ? "off" : "on"]." + . += "The red light is [V.shoot_inventory ? "off" : "blinking"]." + . += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"]." + . += "The [V.scan_id ? "purple" : "yellow"] light is on." + . += "The cyan light is [V.temperature_setting == -1 ? "on" : "off"]." + . += "The blue light is [V.temperature_setting == 1 ? "on" : "off"]." -/datum/wires/vending/UpdatePulsed(var/index) +/datum/wires/vending/on_pulse(wire) var/obj/machinery/vending/V = holder - switch(index) - if(VENDING_WIRE_THROW) + switch(wire) + if(WIRE_THROW) V.shoot_inventory = !V.shoot_inventory - if(VENDING_WIRE_CONTRABAND) + if(WIRE_CONTRABAND) V.categories ^= CAT_HIDDEN - if(VENDING_WIRE_ELECTRIFY) + if(WIRE_SHOCK) V.seconds_electrified = 30 - if(VENDING_WIRE_IDSCAN) + if(WIRE_IDSCAN) V.scan_id = !V.scan_id - if(VENDING_WIRE_COOLING) + if(WIRE_COOLING) V.temperature_setting = V.temperature_setting != -1 ? -1 : 0 - if(VENDING_WIRE_HEATING) + if(WIRE_HEATING) V.temperature_setting = V.temperature_setting != 1 ? 1 : 0 -/datum/wires/vending/UpdateCut(var/index, var/mended) +/datum/wires/vending/on_cut(wire, mend, source) var/obj/machinery/vending/V = holder - switch(index) - if(VENDING_WIRE_THROW) - V.shoot_inventory = !mended - if(VENDING_WIRE_CONTRABAND) + switch(wire) + if(WIRE_THROW) + V.shoot_inventory = !mend + if(WIRE_CONTRABAND) V.categories &= ~CAT_HIDDEN - if(VENDING_WIRE_ELECTRIFY) - if(mended) + if(WIRE_SHOCK) + if(mend) V.seconds_electrified = 0 else V.seconds_electrified = -1 - if(VENDING_WIRE_IDSCAN) + if(WIRE_IDSCAN) V.scan_id = 1 - if(VENDING_WIRE_COOLING) - V.temperature_setting = mended && V.temperature_setting != 1 ? -1 : 0 - if(VENDING_WIRE_HEATING) - V.temperature_setting = mended && V.temperature_setting != -1 ? 1 : 0 + if(WIRE_COOLING) + V.temperature_setting = mend && V.temperature_setting != 1 ? -1 : 0 + if(WIRE_HEATING) + V.temperature_setting = mend && V.temperature_setting != -1 ? 1 : 0 /datum/wires/vending/get_wire_diagram(var/mob/user) var/dat = "" - for(var/color in wires) - dat += "[capitalize(color)]: [index_to_type(GetIndex(color))]
" + for(var/color in colors) + if(is_dud_color(color)) + continue + dat += "[capitalize(color)]: [get_wire(color)]
" var/datum/browser/wire_win = new(user, "vendingwires", "Vending Wires", 450, 500) wire_win.set_content(dat) wire_win.open() - -/datum/wires/vending/proc/index_to_type(var/index) - switch(index) - if(1) - return "Ballistic Delivery Service" - if(2) - return "Secondary Stock" - if(4) - return "Anti-tampering" - if(8) - return "ID Scan" - if(16) - return "Cooling" - if(32) - return "Heating" diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index d2da33857e0..d447f453943 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -1,172 +1,208 @@ -// Wire datums. Created by Giacomand. -// Was created to replace a horrible case of copy and pasted code with no care for maintability. -// Goodbye Door wires, Cyborg wires, Vending Machine wires, Autolathe wires -// Protolathe wires, APC wires and Camera wires! +#define MAXIMUM_EMP_WIRES 3 -#define MAX_FLAG 65535 - -var/list/same_wires = list() -// 14 colours, if you're adding more than 14 wires then add more colours here -var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown", "gold", "gray", "cyan", "navy", "purple", "pink", "black", "yellow") +var/global/list/wire_color_directory = list() +var/global/list/wire_name_directory = list() /datum/wires - - var/random = 0 // Will the wires be different for every single instance. - var/atom/holder = null // The holder + /// The holder (atom that contains these wires). + var/atom/holder + /// The holder's typepath (used for sanity checks to make sure the holder is the appropriate type for these wire sets). + var/holder_type + /// Whether this wire datum errors out if it has a wrong holder or not. var/cares_about_holder = TRUE - var/holder_type = null // The holder type; used to make sure that the holder is the correct type. - var/wire_count = 0 // Max is 16 - var/wires_status = 0 // BITFLAG OF WIRES + /// Key that enables wire assignments to be common across different holders. If null, will use the holder_type as a key. + var/dictionary_key = null + /// The display name for the wire set. Used in the hacking interface. + var/proper_name = "Unknown" - var/list/wires - var/list/signalers + /// List of all wires. + var/list/wires = list() + /// List of cut wires. + var/list/cut_wires = list() // List of wires that have been cut. + /// Dictionary of colours to wire. + var/list/colors = list() + /// List of attached assemblies. + var/list/assemblies = list() + /// If every instance of these wires should be random. Prevents wires from showing up in station blueprints. + var/random = FALSE + /// Wire manufacturer for the UI skin. + var/manufacturer = "hephaestus" - var/table_options = " align='center'" - var/row_options1 = " width='80px'" - var/row_options2 = " width='260px'" - var/window_x = 370 - var/window_y = 470 +/datum/wires/New(atom/holder) + ..() + if(!istype(holder, holder_type) && cares_about_holder) + CRASH("Wire holder is not of the expected type!") -/datum/wires/New(var/atom/holder) - wires = list() - signalers = list() src.holder = holder - if(cares_about_holder && !istype(holder, holder_type)) - CRASH("Our holder is null/the wrong type!") + if(istype(holder, /obj/machinery)) + var/obj/machinery/M = holder + manufacturer = M.manufacturer - // Generate new wires + // If there is a dictionary key set, we'll want to use that. Otherwise, use the holder type. + var/key = dictionary_key ? dictionary_key : holder_type + + RegisterSignal(holder, COMSIG_QDELETING, PROC_REF(on_holder_qdel)) if(random) - GenerateWires() - // Get the same wires + randomize() else - // We don't have any wires to copy yet, generate some and then copy it. - if(!same_wires[holder_type]) - GenerateWires() - same_wires[holder_type] = src.wires.Copy() + if(!wire_color_directory[key]) + randomize() + wire_color_directory[key] = colors + wire_name_directory[key] = proper_name else - var/list/wires = same_wires[holder_type] - src.wires = wires // Reference the wires list. + colors = wire_color_directory[key] /datum/wires/Destroy() holder = null + //properly clear refs to avoid harddels & other problems + for(var/color in assemblies) + var/obj/item/device/assembly/assembly = assemblies[color] + assembly.holder = null + LAZYCLEARLIST(assemblies) return ..() -/datum/wires/proc/GenerateWires() - var/list/colours_to_pick = wireColours.Copy() // Get a copy, not a reference. - var/list/indexes_to_pick = list() - //Generate our indexes - for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i) - indexes_to_pick += i - colours_to_pick.len = wire_count // Downsize it to our specifications. +/datum/wires/proc/add_duds(duds) + while(duds) + var/dud = WIRE_DUD_PREFIX + "[--duds]" + if(dud in wires) + continue + wires += dud - while(colours_to_pick.len && indexes_to_pick.len) - // Pick and remove a colour - var/colour = pick_n_take(colours_to_pick) +///Called when holder is qdeleted for us to clean ourselves as not to leave any unlawful references. +/datum/wires/proc/on_holder_qdel(atom/source, force) + SIGNAL_HANDLER - // Pick and remove an index - var/index = pick_n_take(indexes_to_pick) + qdel(src) - src.wires[colour] = index - //wires = shuffle(wires) +/datum/wires/proc/randomize() + var/static/list/possible_colors = list( + "blue", + "brown", + "crimson", + "cyan", + "gold", + "green", + "grey", + "lime", + "magenta", + "orange", + "pink", + "purple", + "red", + "silver", + "violet", + "white", + "yellow", + ) + + var/list/my_possible_colors = possible_colors.Copy() + + for(var/wire in shuffle(wires)) + colors[pick_n_take(my_possible_colors)] = wire + +/datum/wires/proc/shuffle_wires() + colors.Cut() + randomize() + +/datum/wires/proc/repair() + for(var/wire in cut_wires) + cut(wire) // I KNOW I KNOW OK -/datum/wires/proc/Interact(var/mob/living/user) +/datum/wires/proc/get_wire(color) + return colors[color] - var/html = null - if(holder && CanUse(user)) - html = GetInteractWindow() - if(html) - user.set_machine(holder) +/datum/wires/proc/get_color_of_wire(wire_type) + for(var/color in colors) + var/other_type = colors[color] + if(wire_type == other_type) + return color + +/datum/wires/proc/get_attached(color) + if(assemblies[color]) + return assemblies[color] + return null + +/datum/wires/proc/is_attached(color) + if(assemblies[color]) + return TRUE + +/datum/wires/proc/is_cut(wire) + return (wire in cut_wires) + +/datum/wires/proc/is_color_cut(color) + return is_cut(get_wire(color)) + +/datum/wires/proc/is_all_cut() + if(cut_wires.len == wires.len) + return TRUE + +/datum/wires/proc/is_dud(wire) + return findtext(wire, WIRE_DUD_PREFIX, 1, length(WIRE_DUD_PREFIX) + 1) + +/datum/wires/proc/is_dud_color(color) + return is_dud(get_wire(color)) + +/datum/wires/proc/cut(wire, source) + if(is_cut(wire)) + cut_wires -= wire + SEND_SIGNAL(src, COMSIG_MEND_WIRE(wire), wire) + on_cut(wire, mend = TRUE, source = source) else - user.unset_machine() - // No content means no window. - user << browse(null, "window=wires") + cut_wires += wire + SEND_SIGNAL(src, COMSIG_CUT_WIRE(wire), wire) + on_cut(wire, mend = FALSE, source = source) + +/datum/wires/proc/cut_color(color, source) + cut(get_wire(color), source) + +/datum/wires/proc/cut_random(source) + cut(wires[rand(1, wires.len)], source) + +/datum/wires/proc/cut_all(source) + for(var/wire in wires) + cut(wire, source) + +/datum/wires/proc/pulse(wire, user, force=FALSE) + if(!force && is_cut(wire)) return + on_pulse(wire, user) - var/datum/browser/popup = new(user, "wires", holder.name, window_x, window_y) - popup.set_content(html) - popup.set_title_image(user.browse_rsc_icon(holder.icon, holder.icon_state)) - popup.open() +/datum/wires/proc/pulse_color(color, mob/living/user, force=FALSE) + pulse(get_wire(color), user, force) -/datum/wires/proc/GetInteractWindow() - var/html = "
" - html += "

Exposed Wires

" - html += "" +/datum/wires/proc/pulse_assembly(obj/item/device/assembly/signaler/S) + for(var/color in assemblies) + if(S == assemblies[color]) + pulse_color(color, force=TRUE) + return TRUE - for(var/colour in wires) - html += "" - html += "[capitalize(colour)]" - html += "" - html += "[IsColourCut(colour) ? "Mend" : "Cut"]" - html += " Pulse" - html += " [IsAttached(colour) ? "Detach" : "Attach"] Signaler" - html += "" - html += "
" +/datum/wires/proc/attach_assembly(color, obj/item/device/assembly/signaler/S) + if(S && istype(S) && !is_attached(color)) + assemblies[color] = S + S.forceMove(holder) + S.connected = src + return S - if (random) - html += "\The [holder] appears to have tamper-resistant electronics installed.

" //maybe this could be more generic? +/datum/wires/proc/detach_assembly(color) + var/obj/item/device/assembly/signaler/S = get_attached(color) + if(S && istype(S)) + assemblies -= color + S.connected = null + S.forceMove(holder.loc) + return S - return html +/// Called from [/atom/proc/emp_act] +/datum/wires/proc/emp_pulse() + var/list/possible_wires = shuffle(wires) + var/remaining_pulses = MAXIMUM_EMP_WIRES -/datum/wires/Topic(href, href_list) - ..() - if(in_range(holder, usr) && isliving(usr)) - - var/mob/living/L = usr - if(CanUse(L) && href_list["action"]) - if(href_list["attach"]) - var/colour = href_list["attach"] - // Attach - if(!IsAttached(colour)) - var/obj/item/device/assembly/signaler/I = L.get_type_in_hands(/obj/item/device/assembly/signaler) - if(!istype(I)) - to_chat(usr, SPAN_WARNING("You do not have a signaler to attach!")) - return - usr.drop_from_inventory(I) - Attach(colour, I) - // Detach - else - var/obj/item/O = Detach(colour) - if(O) - L.put_in_hands(O) - - if(href_list["cut"]) // Toggles the cut/mend status - var/obj/item/I = L.get_active_hand() - if(!I || !I.iswirecutter()) - if(isrobot(L)) - var/mob/living/silicon/robot/R = L - I = R.return_wirecutter() - else - I = L.get_inactive_hand() - if(I?.iswirecutter()) - var/colour = href_list["cut"] - CutWireColour(colour) - holder.add_hiddenprint(L) - else - to_chat(L, SPAN_WARNING("You need wirecutters!")) - - else if(href_list["pulse"]) - var/obj/item/I = L.get_active_hand() - if(!I || !I.ismultitool()) - if(isrobot(L)) - var/mob/living/silicon/robot/R = L - I = R.return_multitool() - else - I = L.get_inactive_hand() - if(I?.ismultitool()) - var/colour = href_list["pulse"] - PulseColour(colour) - holder.add_hiddenprint(L) - else - to_chat(L, SPAN_WARNING("You need a multitool!")) - - - // Update Window - Interact(usr) - - if(href_list["close"]) - usr << browse(null, "window=wires") - usr.unset_machine(holder) + for(var/wire in possible_wires) + if(prob(33)) + pulse(wire) + remaining_pulses-- + if(!remaining_pulses) + break /datum/wires/proc/get_wire_diagram(var/mob/user) return @@ -175,154 +211,157 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown" // Overridable Procs // -// Called when wires cut/mended. -/datum/wires/proc/UpdateCut(var/index, var/mended) +/datum/wires/proc/interactable(mob/user) + SHOULD_CALL_PARENT(TRUE) + if((SEND_SIGNAL(user, COMSIG_TRY_WIRES_INTERACT, holder) & COMPONENT_CANT_INTERACT_WIRES)) + return FALSE + return TRUE + +/datum/wires/proc/get_status() + return list() + +/datum/wires/proc/on_cut(wire, mend = FALSE, source = null) return -// Called when wire pulsed. Add code here. -/datum/wires/proc/UpdatePulsed(var/index) +/datum/wires/proc/on_pulse(wire, user) return -/datum/wires/proc/CanUse(var/mob/living/L) - return 1 +// End Overridable Procs -// Example of use: -/* - -var/const/BOLTED= 1 -var/const/SHOCKED = 2 -var/const/SAFETY = 4 -var/const/POWER = 8 - -/datum/wires/door/UpdateCut(var/index, var/mended) - var/obj/machinery/door/airlock/A = holder - switch(index) - if(BOLTED) - if(!mended) - A.bolt() - if(SHOCKED) - A.shock() - if(SAFETY ) - A.safety() - -*/ - - -// -// Helper Procs -// - -/datum/wires/proc/PulseColour(var/colour) - PulseIndex(GetIndex(colour)) - -/datum/wires/proc/PulseIndex(var/index) - if(IsIndexCut(index)) +/datum/wires/proc/interact(mob/user) + if(!interactable(user)) return - UpdatePulsed(index) - -/datum/wires/proc/GetIndex(var/colour) - if(wires[colour]) - var/index = wires[colour] - return index - else - CRASH("[colour] is not a key in wires.") - -// -// Is Index/Colour Cut procs -// - -/datum/wires/proc/IsColourCut(var/colour) - var/index = GetIndex(colour) - return IsIndexCut(index) - -/datum/wires/proc/IsIndexCut(var/index) - return (index & wires_status) - -// -// signaler Procs -// - -/datum/wires/proc/IsAttached(var/colour) - if(signalers[colour]) - return 1 - return 0 - -/datum/wires/proc/GetAttached(var/colour) - if(signalers[colour]) - return signalers[colour] - return null - -/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/signaler/S) - if(colour && S) - if(!IsAttached(colour)) - signalers[colour] = S - S.forceMove(holder) - S.connected = src - return S - -/datum/wires/proc/Detach(var/colour) - if(colour) - var/obj/item/device/assembly/signaler/S = GetAttached(colour) - if(S) - signalers -= colour - S.connected = null - S.forceMove(holder.loc) - return S + ui_interact(user) + for(var/A in assemblies) + var/obj/item/I = assemblies[A] + if(istype(I) && I.on_found(user)) + return -/datum/wires/proc/Pulse(var/obj/item/device/assembly/signaler/S) +/** + * Checks whether wire assignments should be revealed. + * + * Returns TRUE if the wires should be revealed, FALSE otherwise. + * Currently checks for admin ghost AI, abductor multitool and blueprints. + * Arguments: + * * user - The mob to check when deciding whether to reveal wires. + */ +/datum/wires/proc/can_reveal_wires(mob/user) + // Admin ghost can see a purpose of each wire. + if(isobserver(user) && check_rights(R_MOD, FALSE, user)) + return TRUE - for(var/colour in signalers) - if(S == signalers[colour]) - PulseColour(colour) - break + // Station blueprints do that too, but only if the wires are not randomized. + if(istype(user.get_active_hand(), /obj/item/blueprints) && !random) + return TRUE + + return FALSE + +/** + * Whether the given wire should always be revealed. + * + * Intended to be overridden. Allows for forcing a wire's assignmenmt to always be revealed + * in the hacking interface. + * Arguments: + * * color - Color string of the wire to check. + */ +/datum/wires/proc/always_reveal_wire(color) + return FALSE + +/datum/wires/ui_host() + return holder + +/datum/wires/ui_status(mob/user) + if(interactable(user)) + return ..() + return UI_CLOSE + +/datum/wires/ui_state(mob/user) + return physical_state -// -// Cut Wire Colour/Index procs -// +/datum/wires/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if (!ui) + ui = new(user, src, "Wires", "[capitalize(holder.name)] Wires") + ui.open() -/datum/wires/proc/CutWireColour(var/colour) - var/index = GetIndex(colour) - CutWireIndex(index) +/datum/wires/ui_data(mob/user) + var/list/data = list() + var/list/payload = list() + var/reveal_wires = can_reveal_wires(user) -/datum/wires/proc/CutWireIndex(var/index) - if(IsIndexCut(index)) - wires_status &= ~index - UpdateCut(index, 1) - else - wires_status |= index - UpdateCut(index, 0) + for(var/color in colors) + payload.Add(list(list( + "color" = color, + "wire" = (((reveal_wires || always_reveal_wire(color)) && !is_dud_color(color)) ? get_wire(color) : null), + "cut" = is_color_cut(color), + "attached" = is_attached(color) + ))) + data["manufacturer"] = manufacturer + data["wires"] = payload + data["status"] = get_status() + data["proper_name"] = (proper_name != "Unknown") ? proper_name : null + data["tamper_resistance"] = FALSE + if(random) + data["tamper_resistance"] = TRUE + return data -/datum/wires/proc/RandomCut() - var/r = rand(1, wires.len) - CutWireIndex(r) +/datum/wires/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(. || !interactable(usr)) + return -/datum/wires/proc/RandomCutAll(var/probability = 10) - for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i) - if(prob(probability)) - CutWireIndex(i) + var/mob/living/L = usr + var/target_wire = params["wire"] + switch(action) + if("attach") + // Attach + if(!is_attached(target_wire)) + var/obj/item/device/assembly/signaler/I = L.get_type_in_hands(/obj/item/device/assembly/signaler) + if(!istype(I)) + to_chat(usr, SPAN_WARNING("You do not have a signaler to attach!")) + return + usr.drop_from_inventory(I) + if(!attach_assembly(target_wire, I)) + I.forceMove(get_turf(L)) + . = TRUE + // Detach + else + var/obj/item/O = detach_assembly(target_wire) + if(O) + L.put_in_hands(O) + . = TRUE -/datum/wires/proc/CutAll() - for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i) - CutWireIndex(i) + if("cut") // Toggles the cut/mend status + var/obj/item/I = L.get_active_hand() + if(!I || !I.iswirecutter()) + if(isrobot(L)) + var/mob/living/silicon/robot/R = L + I = R.return_wirecutter() + else + I = L.get_inactive_hand() + if(I?.iswirecutter()) + cut_color(target_wire, source = L) + holder.add_hiddenprint(L) + I.play_tool_sound(holder, 50) + . = TRUE + else + to_chat(L, SPAN_WARNING("You need wirecutters!")) -/datum/wires/proc/IsAllCut() - if(wires_status == (1 << wire_count) - 1) - return 1 - return 0 + if("pulse") + var/obj/item/I = L.get_active_hand() + if(!I || !I.ismultitool()) + if(isrobot(L)) + var/mob/living/silicon/robot/R = L + I = R.return_multitool() + else + I = L.get_inactive_hand() + if(I?.ismultitool()) + pulse_color(target_wire, L) + holder.add_hiddenprint(L) + . = TRUE + else + to_chat(L, SPAN_WARNING("You need a multitool!")) -/datum/wires/proc/MendAll() - for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i) - if(IsIndexCut(i)) - CutWireIndex(i) - -// -//Shuffle and Mend -// - -/datum/wires/proc/Shuffle() - wires_status = 0 - GenerateWires() - -#undef MAX_FLAG +#undef MAXIMUM_EMP_WIRES diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 62ab7f80532..53eb553220a 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -637,7 +637,7 @@ pixel_x = 10; /obj/machinery/alarm/interact(mob/user) ui_interact(user) - wires.Interact(user) + wires.interact(user) /obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, var/master_ui = null, var/datum/ui_state/state = default_state) var/data = list() @@ -957,7 +957,7 @@ pixel_x = 10; to_chat(user, "Nothing happens.") return TRUE else - if(allowed(usr) && !wires.IsIndexCut(AALARM_WIRE_IDSCAN)) + if(allowed(usr) && !wires.is_cut(WIRE_IDSCAN)) locked = !locked to_chat(user, "You [ locked ? "lock" : "unlock"] the Air Alarm interface.") else diff --git a/code/game/machinery/autolathe/autolathe.dm b/code/game/machinery/autolathe/autolathe.dm index a2e22742287..711ef592535 100644 --- a/code/game/machinery/autolathe/autolathe.dm +++ b/code/game/machinery/autolathe/autolathe.dm @@ -1,3 +1,6 @@ +#define AUTOLATHE_BUSY 1 +#define AUTOLATHE_STARTED 2 + /obj/machinery/autolathe name = "autolathe" desc = "A large device loaded with various item schematics. It uses a combination of steel and glass to fabricate items." @@ -20,16 +23,19 @@ var/hacked = FALSE var/disabled = FALSE var/shocked = FALSE - var/busy = FALSE - var/datum/autolathe/recipe/build_item + var/autolathe_flags = 0 + var/datum/autolathe_queue_item/currently_printing var/mat_efficiency = 1 + var/last_process_time var/build_time = 50 var/does_flick = TRUE var/datum/wires/autolathe/wires + var/list/print_queue = list() + component_types = list( /obj/item/circuitboard/autolathe, /obj/item/stock_parts/matter_bin = 3, @@ -57,17 +63,15 @@ /obj/machinery/autolathe/Destroy() QDEL_NULL(wires) + print_queue.Cut() return ..() /obj/machinery/autolathe/proc/populate_lathe_recipes() - if(SSmaterials.autolathe_recipes && SSmaterials.autolathe_categories) + if(SSmaterials.autolathe_categories) return - SSmaterials.autolathe_recipes = list() SSmaterials.autolathe_categories = list() - for(var/R in subtypesof(/datum/autolathe/recipe)) - var/datum/autolathe/recipe/recipe = new R - SSmaterials.autolathe_recipes += recipe + for(var/singleton/autolathe_recipe/recipe in GET_SINGLETON_SUBTYPE_LIST(/singleton/autolathe_recipe)) SSmaterials.autolathe_categories |= recipe.category var/obj/item/I = new recipe.path @@ -76,81 +80,71 @@ for(var/material in I.matter) recipe.resources[material] = I.matter[material]*1.25 // More expensive to produce than they are to recycle. qdel(I) + SSmaterials.autolathe_categories |= "All" + SSmaterials.autolathe_categories = sort_list(SSmaterials.autolathe_categories, GLOBAL_PROC_REF(cmp_text_asc)) -/obj/machinery/autolathe/interact(mob/user) - if(..() || (disabled && !panel_open)) - to_chat(user, SPAN_DANGER("\The [src] is disabled!")) - return +/obj/machinery/autolathe/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "Autolathe", capitalize_first_letters(name)) + ui.open() - if(shocked) - shock(user, 50) +/obj/machinery/autolathe/ui_data(mob/user) + . = ..() + var/list/data = list() + data["disabled"] = disabled + data["material_efficiency"] = mat_efficiency + data["materials"] = list() + data["categories"] = SSmaterials.autolathe_categories + data["build_time"] = build_time + for(var/material in stored_material) + data["materials"] += list(list("material" = material, "stored" = stored_material[material], "max_capacity" = storage_capacity[material])) + data["recipes"] = list() + for(var/recipe in GET_SINGLETON_SUBTYPE_LIST(/singleton/autolathe_recipe)) + var/singleton/autolathe_recipe/R = recipe + if(R.hidden && !hacked) + continue + var/list/recipe_data = list() + recipe_data["name"] = R.name + recipe_data["recipe"] = R.type + recipe_data["hidden"] = R.hidden + var/list/resources = list() + for(var/resource in R.resources) + resources += "[R.resources[resource] * mat_efficiency] [resource]" + recipe_data["sheets"] = stored_material[resource]/round(R.resources[resource]*mat_efficiency) + recipe_data["can_make"] = !isnull(stored_material[resource]) && stored_material[resource] < round(R.resources[resource]*mat_efficiency) + recipe_data["category"] = R.category + recipe_data["resources"] = english_list(resources) + recipe_data["max_sheets"] = null + if(R.is_stack) + var/obj/item/stack/R_stack = R.path + recipe_data["max_sheets"] = initial(R_stack.max_amount) + data["recipes"] += list(recipe_data) - var/dat = "
" - - if(!disabled) - dat += "" - var/material_top = "" - var/material_bottom = "" - - for(var/material in stored_material) - material_top += "" - material_bottom += "" - - dat += "[material_top][material_bottom]
[capitalize_first_letters(material)][stored_material[material]]/[storage_capacity[material]]

" - dat += "

Printable Designs

Showing: [show_category]

" - - var/index = 0 - for(var/recipe in SSmaterials.autolathe_recipes) - var/datum/autolathe/recipe/R = recipe - index++ - if(R.hidden && !hacked || (show_category != "All" && show_category != R.category)) - continue - var/can_make = TRUE - var/material_string = "" - var/multiplier_string = "" - var/max_sheets - var/comma - if(!R.resources || !R.resources.len) - material_string = "No resources required." - else - //Make sure it's buildable and list requires resources. - for(var/material in R.resources) - var/sheets = round(stored_material[material]/round(R.resources[material]*mat_efficiency)) - if(isnull(max_sheets) || max_sheets > sheets) - max_sheets = sheets - if(!isnull(stored_material[material]) && stored_material[material] < round(R.resources[material]*mat_efficiency)) - can_make = FALSE - if(!comma) - comma = TRUE - else - material_string += ", " - material_string += "[round(R.resources[material] * mat_efficiency)] [material]" - material_string += "
" - //Build list of multipliers for sheets. - if(R.is_stack) - if(max_sheets) - var/obj/item/stack/R_stack = R.path - max_sheets = min(max_sheets, initial(R_stack.max_amount)) - multiplier_string += "
" - for(var/i = 5; i < max_sheets; i *= 2) //5,10,20,40... - multiplier_string += "\[x[i]\]" - multiplier_string += "\[x[max_sheets]\]" - - dat += "" - dat += "
[R.hidden ? "*" : ""][can_make ? "" : ""][R.hidden ? "*" : ""][multiplier_string][material_string]

" - - var/datum/browser/autolathe_win = new(user, "autolathe", "
Autolathe Control Panel
") - autolathe_win.set_content(dat) - autolathe_win.add_stylesheet("misc", 'html/browser/misc.css') - autolathe_win.open() + data["currently_printing"] = null + if(currently_printing) + data["currently_printing"] = "\ref[currently_printing]" + data["queue"] = list() + for(var/datum/autolathe_queue_item/AR in print_queue) + data["queue"] += list( + list( + "ref" = "\ref[AR]", + "order" = AR.recipe.name, + "path" = AR.recipe.type, + "multiplier" = AR.multiplier, + "build_time" = AR.build_time, + "progress" = AR.progress + ) + ) + return data /obj/machinery/autolathe/attackby(obj/item/O, mob/user) - if(busy) + if(HAS_FLAG(autolathe_flags, AUTOLATHE_BUSY)) to_chat(user, SPAN_NOTICE("\The [src] is busy. Please wait for the completion of previous operation.")) return TRUE if(default_deconstruction_screwdriver(user, O)) - updateUsrDialog() + SStgui.update_uis(src) return TRUE if(default_deconstruction_crowbar(user, O)) return TRUE @@ -164,7 +158,7 @@ //Don't eat multitools or wirecutters used on an open lathe. if(O.ismultitool() || O.iswirecutter()) if(panel_open) - wires.Interact(user) + wires.interact(user) else to_chat(user, SPAN_WARNING("\The [src]'s wires aren't exposed.")) return TRUE @@ -176,90 +170,115 @@ return FALSE load_lathe(O, user) - - updateUsrDialog() return TRUE /obj/machinery/autolathe/attack_hand(mob/user) user.set_machine(src) - interact(user) + ui_interact(user) -/obj/machinery/autolathe/Topic(href, href_list) - if(..()) +/obj/machinery/autolathe/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) return usr.set_machine(src) add_fingerprint(usr) - var/list/categories = SSmaterials.autolathe_categories + "All" + playsound(src, /singleton/sound_category/keyboard_sound) - if(href_list["change_category"]) - var/choice = tgui_input_list(usr, "Which category do you wish to display?", "Autolathe", categories) - if(!choice) - return - show_category = choice - updateUsrDialog() - return - - if(busy) - to_chat(usr, SPAN_WARNING("The autolathe is busy. Please wait for the completion of previous operation.")) - return - - if(href_list["make"] && SSmaterials.autolathe_recipes) - var/index = text2num(href_list["make"]) - var/multiplier = text2num(href_list["multiplier"]) - build_item = null - - if(index > 0 && index <= length(SSmaterials.autolathe_recipes)) - build_item = SSmaterials.autolathe_recipes[index] - - //Exploit detection, not sure if necessary after rewrite. - if(!build_item || multiplier < 0 || multiplier > 100) - var/turf/exploit_loc = get_turf(usr) - message_admins("[key_name_admin(usr)] tried to exploit an autolathe to duplicate an item! ([exploit_loc ? "JMP" : "null"])", 0) - log_admin("EXPLOIT : [key_name(usr)] tried to exploit an autolathe to duplicate an item!",ckey=key_name(usr)) - return - - busy = TRUE - update_use_power(POWER_USE_ACTIVE) + if(action == "make") + var/multiplier = text2num(params["multiplier"]) + var/singleton/autolathe_recipe/R = GET_SINGLETON(text2path(params["recipe"])) + if(!istype(R)) + CRASH("Unknown recipe given! [R], param is [params["recipe"]].") intent_message(MACHINE_SOUND) //Check if we still have the materials. - for(var/material in build_item.resources) + for(var/material in R.resources) if(!isnull(stored_material[material])) - if(stored_material[material] < round(build_item.resources[material] * mat_efficiency) * multiplier) + if(stored_material[material] < round(R.resources[material] * mat_efficiency) * multiplier) return - //Consume materials. - for(var/material in build_item.resources) + var/datum/autolathe_queue_item/order = new() + order.recipe = R + order.multiplier = multiplier + order.build_time = build_time + //We know we have the materials, store them in the order. + for(var/material in R.resources) if(!isnull(stored_material[material])) - stored_material[material] = max(0, stored_material[material] - round(build_item.resources[material] * mat_efficiency) * multiplier) + var/material_usage = round(R.resources[material] * mat_efficiency) * multiplier + order.materials_used[material] = material_usage + stored_material[material] = max(0, stored_material[material] - material_usage) - if(does_flick) - //Fancy autolathe animation. - add_overlay("process") + print_queue += order + . = TRUE - sleep(build_time) + if(action == "remove") + var/datum/autolathe_queue_item/order = locate(params["ref"]) + if(!order) + return + if(currently_printing == order) + to_chat(usr, SPAN_WARNING("This item is already being printed!")) + return + for(var/material in order.materials_used) + if((stored_material[material] + order.materials_used[material]) > storage_capacity[material]) + to_chat(usr, SPAN_WARNING("The autolathe display indicates that there isn't enough space to refund the materials!")) + return + stored_material[material] += order.materials_used[material] + print_queue -= order + qdel(order) + . = TRUE - busy = FALSE +/obj/machinery/autolathe/process() + if(length(print_queue)) + if(!currently_printing) + last_process_time = world.time + currently_printing = print_queue[1] + autolathe_flags |= AUTOLATHE_BUSY + update_use_power(POWER_USE_ACTIVE) + else if(!currently_printing && (autolathe_flags & AUTOLATHE_BUSY)) + autolathe_flags &= ~(AUTOLATHE_BUSY|AUTOLATHE_STARTED) update_use_power(POWER_USE_IDLE) - //Sanity check. - if(!build_item || !src) - return + if(currently_printing && use_power == POWER_USE_ACTIVE) + if(!HAS_FLAG(autolathe_flags, AUTOLATHE_STARTED)) + start_processing_queue_item() + else if(HAS_FLAG(autolathe_flags, AUTOLATHE_BUSY)) + process_queue_item() - //Create the desired item. - var/obj/item/I = new build_item.path(get_turf(print_loc)) - I.Created() - if(multiplier > 1 && istype(I, /obj/item/stack)) - var/obj/item/stack/S = I - S.amount = multiplier - build_item = null - cut_overlay("process") - I.update_icon() +/// Used so that we don't try to add_overlay every tick the autolathe processes. +/obj/machinery/autolathe/proc/start_processing_queue_item() + if(does_flick) + //Fancy autolathe animation. + add_overlay("process") + autolathe_flags |= AUTOLATHE_STARTED|AUTOLATHE_BUSY - updateUsrDialog() +/obj/machinery/autolathe/proc/process_queue_item() + if(!currently_printing) + return + + var/time_difference = world.time - last_process_time + currently_printing.progress = min(currently_printing.progress + time_difference, currently_printing.build_time) + last_process_time = world.time + if(currently_printing.progress >= currently_printing.build_time) + complete_queue_item() + +/obj/machinery/autolathe/proc/complete_queue_item() + //Create the desired item. + var/obj/item/I = new currently_printing.recipe.path(get_turf(print_loc)) + I.Created() + if(currently_printing.multiplier > 1 && istype(I, /obj/item/stack)) + var/obj/item/stack/S = I + S.amount = currently_printing.multiplier + + print_queue -= currently_printing + QDEL_NULL(currently_printing) + cut_overlay("process") + I.update_icon() + update_use_power(POWER_USE_IDLE) + + return TRUE /obj/machinery/autolathe/update_icon() icon_state = (panel_open ? "autolathe_panel" : "autolathe") @@ -275,7 +294,7 @@ man_rating += M.rating storage_capacity[DEFAULT_WALL_MATERIAL] = mb_rating * 25000 - storage_capacity["glass"] = mb_rating * 12500 + storage_capacity[MATERIAL_GLASS] = mb_rating * 12500 build_time = 50 / man_rating mat_efficiency = 1.1 - man_rating * 0.1 // Normally, price is 1.25 the amount of material, so this shouldn't go higher than 0.8. Maximum rating of parts is 3 @@ -358,6 +377,25 @@ user.remove_from_mob(O) qdel(O) +/// Queue items are needed so that the queue knows exactly what it's doing. +/datum/autolathe_queue_item + /// The recipe singleton. We need to know exactly what we're making. + var/singleton/autolathe_recipe/recipe + /// Multiplier, used to know how many sheets we are printing. Note that this is specifically for sheets. + var/multiplier = 1 + /// The materials used for this order. + var/list/materials_used = list() + /// How much time it takes to build this order. 50 for an un-upgraded autolathe. + var/build_time = 0 + /// Current progress on this queue item. + var/progress = 0 + +/datum/autolathe_queue_item/Destroy() + recipe = null + return ..() + #undef NO_SPACE #undef FILL_COMPLETELY #undef FILL_INCOMPLETELY +#undef AUTOLATHE_BUSY +#undef AUTOLATHE_STARTED diff --git a/code/game/machinery/autolathe/autolathe_datums.dm b/code/game/machinery/autolathe/autolathe_datums.dm index d9b85e79aa5..b026af1afdd 100644 --- a/code/game/machinery/autolathe/autolathe_datums.dm +++ b/code/game/machinery/autolathe/autolathe_datums.dm @@ -1,4 +1,4 @@ -/datum/autolathe/recipe +/singleton/autolathe_recipe var/name = "object" var/path var/list/resources @@ -7,605 +7,605 @@ var/power_use = 0 var/is_stack -/datum/autolathe/recipe/bucket +/singleton/autolathe_recipe/bucket name = "bucket" path = /obj/item/reagent_containers/glass/bucket category = "General" -/datum/autolathe/recipe/flashlight +/singleton/autolathe_recipe/flashlight name = "flashlight" path = /obj/item/device/flashlight/empty category = "General" -/datum/autolathe/recipe/floor_light +/singleton/autolathe_recipe/floor_light name = "floor light" path = /obj/machinery/floor_light category = "General" -/datum/autolathe/recipe/tile_circuit_blue +/singleton/autolathe_recipe/tile_circuit_blue name = "circuit tile, blue" path = /obj/item/stack/tile/circuit_blue category = "General" is_stack = 1 -/datum/autolathe/recipe/tile_circuit_green +/singleton/autolathe_recipe/tile_circuit_green name = "circuit tile, green" path = /obj/item/stack/tile/circuit_green category = "General" is_stack = 1 -/datum/autolathe/recipe/extinguisher +/singleton/autolathe_recipe/extinguisher name = "extinguisher" path = /obj/item/extinguisher category = "General" -/datum/autolathe/recipe/jar +/singleton/autolathe_recipe/jar name = "jar" path = /obj/item/glass_jar category = "General" -/datum/autolathe/recipe/bowl +/singleton/autolathe_recipe/bowl name = "bowl" path = /obj/item/reagent_containers/cooking_container/board/bowl category = "General" -/datum/autolathe/recipe/crowbar +/singleton/autolathe_recipe/crowbar name = "crowbar" path = /obj/item/crowbar category = "Tools" -/datum/autolathe/recipe/multitool +/singleton/autolathe_recipe/multitool name = "multitool" path = /obj/item/device/multitool category = "Tools" -/datum/autolathe/recipe/t_scanner +/singleton/autolathe_recipe/t_scanner name = "T-ray scanner" path = /obj/item/device/t_scanner category = "Tools" -/datum/autolathe/recipe/weldertool +/singleton/autolathe_recipe/weldertool name = "welding tool" path = /obj/item/weldingtool category = "Tools" -/datum/autolathe/recipe/screwdriver +/singleton/autolathe_recipe/screwdriver name = "screwdriver" path = /obj/item/screwdriver category = "Tools" -/datum/autolathe/recipe/wirecutters +/singleton/autolathe_recipe/wirecutters name = "wirecutters" path = /obj/item/wirecutters category = "Tools" -/datum/autolathe/recipe/wrench +/singleton/autolathe_recipe/wrench name = "wrench" path = /obj/item/wrench category = "Tools" -/datum/autolathe/recipe/hatchet +/singleton/autolathe_recipe/hatchet name = "hatchet" path = /obj/item/material/hatchet category = "Tools" -/datum/autolathe/recipe/minihoe +/singleton/autolathe_recipe/minihoe name = "mini hoe" path = /obj/item/material/minihoe category = "Tools" -/datum/autolathe/recipe/radio_headset +/singleton/autolathe_recipe/radio_headset name = "radio headset" path = /obj/item/device/radio/headset category = "General" -/datum/autolathe/recipe/radio_bounced +/singleton/autolathe_recipe/radio_bounced name = "shortwave radio" path = /obj/item/device/radio/off category = "General" -/datum/autolathe/recipe/weldermask +/singleton/autolathe_recipe/weldermask name = "welding mask" path = /obj/item/clothing/head/welding category = "General" -/datum/autolathe/recipe/metal +/singleton/autolathe_recipe/metal name = "steel sheets" path = /obj/item/stack/material/steel category = "General" is_stack = 1 -/datum/autolathe/recipe/glass +/singleton/autolathe_recipe/glass name = "glass sheets" path = /obj/item/stack/material/glass category = "General" is_stack = 1 -/datum/autolathe/recipe/rglass +/singleton/autolathe_recipe/rglass name = "reinforced glass sheets" path = /obj/item/stack/material/glass/reinforced category = "General" is_stack = 1 -/datum/autolathe/recipe/rods +/singleton/autolathe_recipe/rods name = "metal rods" path = /obj/item/stack/rods category = "General" is_stack = 1 -/datum/autolathe/recipe/barbed_wire +/singleton/autolathe_recipe/barbed_wire name = "barbed wire" path = /obj/item/stack/barbed_wire category = "General" is_stack = 1 -/datum/autolathe/recipe/knife +/singleton/autolathe_recipe/knife name = "kitchen knife" path = /obj/item/material/knife category = "General" -/datum/autolathe/recipe/drinking_glass +/singleton/autolathe_recipe/drinking_glass name = "drinking glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass category = "General" -/datum/autolathe/recipe/half_pint_glass +/singleton/autolathe_recipe/half_pint_glass name = "half pint glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/square category = "General" -/datum/autolathe/recipe/rocks_glass +/singleton/autolathe_recipe/rocks_glass name = "rocks glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/rocks category = "General" -/datum/autolathe/recipe/sherry_glass +/singleton/autolathe_recipe/sherry_glass name = "sherry glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/shake category = "General" -/datum/autolathe/recipe/cocktail_glass +/singleton/autolathe_recipe/cocktail_glass name = "cocktail glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/cocktail category = "General" -/datum/autolathe/recipe/shot_glass +/singleton/autolathe_recipe/shot_glass name = "shot glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/shot category = "General" -/datum/autolathe/recipe/pint_glass +/singleton/autolathe_recipe/pint_glass name = "pint glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/pint category = "General" -/datum/autolathe/recipe/mug_glass +/singleton/autolathe_recipe/mug_glass name = "mug glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/mug category = "General" -/datum/autolathe/recipe/flute_glass +/singleton/autolathe_recipe/flute_glass name = "flute glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/flute category = "General" -/datum/autolathe/recipe/cognac_glass +/singleton/autolathe_recipe/cognac_glass name = "cognac glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/cognac category = "General" -/datum/autolathe/recipe/goblet_glass +/singleton/autolathe_recipe/goblet_glass name = "goblet glass" path = /obj/item/reagent_containers/food/drinks/drinkingglass/newglass/goblet category = "General" -/datum/autolathe/recipe/bottle +/singleton/autolathe_recipe/bottle name = "bottle" path = /obj/item/reagent_containers/food/drinks/bottle category = "General" -/datum/autolathe/recipe/taperecorder +/singleton/autolathe_recipe/taperecorder name = "tape recorder" path = /obj/item/device/taperecorder category = "General" -/datum/autolathe/recipe/airlockmodule +/singleton/autolathe_recipe/airlockmodule name = "airlock electronics" path = /obj/item/airlock_electronics category = "Engineering" -/datum/autolathe/recipe/airalarm +/singleton/autolathe_recipe/airalarm name = "air alarm electronics" path = /obj/item/airalarm_electronics category = "Engineering" -/datum/autolathe/recipe/firealarm +/singleton/autolathe_recipe/firealarm name = "fire alarm electronics" path = /obj/item/firealarm_electronics category = "Engineering" -/datum/autolathe/recipe/powermodule +/singleton/autolathe_recipe/powermodule name = "power control module" path = /obj/item/module/power_control category = "Engineering" -/datum/autolathe/recipe/stockparts_box +/singleton/autolathe_recipe/stockparts_box name = "stock parts box" path = /obj/item/storage/bag/stockparts_box category = "Engineering" -/datum/autolathe/recipe/scalpel +/singleton/autolathe_recipe/scalpel name = "scalpel" path = /obj/item/surgery/scalpel category = "Medical" -/datum/autolathe/recipe/circularsaw +/singleton/autolathe_recipe/circularsaw name = "circular saw" path = /obj/item/surgery/circular_saw category = "Medical" -/datum/autolathe/recipe/surgicaldrill +/singleton/autolathe_recipe/surgicaldrill name = "surgical drill" path = /obj/item/surgery/surgicaldrill category = "Medical" -/datum/autolathe/recipe/retractor +/singleton/autolathe_recipe/retractor name = "retractor" path = /obj/item/surgery/retractor category = "Medical" -/datum/autolathe/recipe/cautery +/singleton/autolathe_recipe/cautery name = "cautery" path = /obj/item/surgery/cautery category = "Medical" -/datum/autolathe/recipe/hemostat +/singleton/autolathe_recipe/hemostat name = "hemostat" path = /obj/item/surgery/hemostat category = "Medical" -/datum/autolathe/recipe/beaker +/singleton/autolathe_recipe/beaker name = "glass beaker" path = /obj/item/reagent_containers/glass/beaker category = "Medical" -/datum/autolathe/recipe/beaker_large +/singleton/autolathe_recipe/beaker_large name = "large glass beaker" path = /obj/item/reagent_containers/glass/beaker/large category = "Medical" -/datum/autolathe/recipe/vial +/singleton/autolathe_recipe/vial name = "glass vial" path = /obj/item/reagent_containers/glass/beaker/vial category = "Medical" -/datum/autolathe/recipe/autoinjector +/singleton/autolathe_recipe/autoinjector name = "autoinjector" path = /obj/item/reagent_containers/hypospray/autoinjector category = "Medical" -/datum/autolathe/recipe/autoinhaler +/singleton/autolathe_recipe/autoinhaler name = "autoinhaler" path = /obj/item/reagent_containers/inhaler category = "Medical" -/datum/autolathe/recipe/syringe +/singleton/autolathe_recipe/syringe name = "syringe" path = /obj/item/reagent_containers/syringe category = "Medical" -/datum/autolathe/recipe/syringe/large +/singleton/autolathe_recipe/syringe/large name = "large syringe" path = /obj/item/reagent_containers/syringe/large -/datum/autolathe/recipe/syringegun_ammo +/singleton/autolathe_recipe/syringegun_ammo name = "syringe gun cartridge" path = /obj/item/syringe_cartridge category = "Arms and Ammunition" -/datum/autolathe/recipe/shotgun_blanks +/singleton/autolathe_recipe/shotgun_blanks name = "ammunition (shotgun, blank)" path = /obj/item/ammo_casing/shotgun/blank category = "Arms and Ammunition" -/datum/autolathe/recipe/shotgun_beanbag +/singleton/autolathe_recipe/shotgun_beanbag name = "ammunition (shotgun, beanbag)" path = /obj/item/ammo_casing/shotgun/beanbag category = "Arms and Ammunition" -/datum/autolathe/recipe/shotgun_flash +/singleton/autolathe_recipe/shotgun_flash name = "ammunition (shotgun, flash)" path = /obj/item/ammo_casing/shotgun/flash category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_rubber +/singleton/autolathe_recipe/magazine_rubber name = "ammunition (.45, rubber)" path = /obj/item/ammo_magazine/c45m/rubber category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_flash +/singleton/autolathe_recipe/magazine_flash name = "ammunition (.45, flash)" path = /obj/item/ammo_magazine/c45m/flash category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_smg_rubber +/singleton/autolathe_recipe/magazine_smg_rubber name = "ammunition (9mm rubber top mounted)" path = /obj/item/ammo_magazine/mc9mmt/rubber category = "Arms and Ammunition" -/datum/autolathe/recipe/detective_revolver_rubber +/singleton/autolathe_recipe/detective_revolver_rubber name = "ammunition (.38, rubber)" path = /obj/item/ammo_magazine/c38/rubber category = "Arms and Ammunition" -/datum/autolathe/recipe/consolescreen +/singleton/autolathe_recipe/consolescreen name = "console screen" path = /obj/item/stock_parts/console_screen category = "Devices and Components" -/datum/autolathe/recipe/igniter +/singleton/autolathe_recipe/igniter name = "igniter" path = /obj/item/device/assembly/igniter category = "Devices and Components" -/datum/autolathe/recipe/signaler +/singleton/autolathe_recipe/signaler name = "signaler" path = /obj/item/device/assembly/signaler category = "Devices and Components" -/datum/autolathe/recipe/sensor_infra +/singleton/autolathe_recipe/sensor_infra name = "infrared sensor" path = /obj/item/device/assembly/infra category = "Devices and Components" -/datum/autolathe/recipe/timer +/singleton/autolathe_recipe/timer name = "timer" path = /obj/item/device/assembly/timer category = "Devices and Components" -/datum/autolathe/recipe/sensor_prox +/singleton/autolathe_recipe/sensor_prox name = "proximity sensor" path = /obj/item/device/assembly/prox_sensor category = "Devices and Components" -/datum/autolathe/recipe/tube +/singleton/autolathe_recipe/tube name = "light tube" path = /obj/item/light/tube category = "General" -/datum/autolathe/recipe/bulb +/singleton/autolathe_recipe/bulb name = "light bulb" path = /obj/item/light/bulb category = "General" -/datum/autolathe/recipe/ashtray_glass +/singleton/autolathe_recipe/ashtray_glass name = "glass ashtray" path = /obj/item/material/ashtray/glass category = "General" -/datum/autolathe/recipe/camera_assembly +/singleton/autolathe_recipe/camera_assembly name = "camera assembly" path = /obj/item/camera_assembly category = "Engineering" -/datum/autolathe/recipe/suit_cooling +/singleton/autolathe_recipe/suit_cooling name = "portable suit cooling unit" path = /obj/item/device/suit_cooling_unit/no_cell category = "Engineering" -/datum/autolathe/recipe/emergency_cell +/singleton/autolathe_recipe/emergency_cell name = "miniature cell" path = /obj/item/cell/device/emergency_light/empty category = "Engineering" -/datum/autolathe/recipe/cable_coil +/singleton/autolathe_recipe/cable_coil name = "cable coil" path = /obj/item/stack/cable_coil category = "Devices and Components" is_stack = 1 -/datum/autolathe/recipe/labeler +/singleton/autolathe_recipe/labeler name = "hand labeler" path = /obj/item/device/hand_labeler category = "General" -/datum/autolathe/recipe/destTagger +/singleton/autolathe_recipe/destTagger name = "destination tagger" path = /obj/item/device/destTagger category = "General" -/datum/autolathe/recipe/cratescanner +/singleton/autolathe_recipe/cratescanner name = "crate contents scanner" path = /obj/item/device/cratescanner category = "General" -/datum/autolathe/recipe/debugger +/singleton/autolathe_recipe/debugger name = "debugger" path = /obj/item/device/debugger category = "Engineering" // Basic Stock Parts for Engineering -/datum/autolathe/recipe/micromanip +/singleton/autolathe_recipe/micromanip name = "micro-manipulator" path = /obj/item/stock_parts/manipulator category = "Devices and Components" -/datum/autolathe/recipe/matterbin +/singleton/autolathe_recipe/matterbin name = "matter bin" path = /obj/item/stock_parts/matter_bin category = "Devices and Components" -/datum/autolathe/recipe/capacitor +/singleton/autolathe_recipe/capacitor name = "capacitor" path = /obj/item/stock_parts/capacitor category = "Devices and Components" -/datum/autolathe/recipe/scanningmod +/singleton/autolathe_recipe/scanningmod name = "scanning module" path = /obj/item/stock_parts/scanning_module category = "Devices and Components" -/datum/autolathe/recipe/microlaser +/singleton/autolathe_recipe/microlaser name = "micro-laser" path = /obj/item/stock_parts/micro_laser category = "Devices and Components" -/datum/autolathe/recipe/flamethrower +/singleton/autolathe_recipe/flamethrower name = "flamethrower" path = /obj/item/flamethrower/full hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_revolver_1 +/singleton/autolathe_recipe/magazine_revolver_1 name = "ammunition (.357)" path = /obj/item/ammo_magazine/a357 hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_revolver_2 +/singleton/autolathe_recipe/magazine_revolver_2 name = "ammunition (.45)" path = /obj/item/ammo_magazine/c45m hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_stetchkin +/singleton/autolathe_recipe/magazine_stetchkin name = "ammunition (9mm)" path = /obj/item/ammo_magazine/mc9mm hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_stetchkin_flash +/singleton/autolathe_recipe/magazine_stetchkin_flash name = "ammunition (9mm, flash)" path = /obj/item/ammo_magazine/mc9mm/flash hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_c20r +/singleton/autolathe_recipe/magazine_c20r name = "ammunition (10mm)" path = /obj/item/ammo_magazine/a10mm hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_arifle +/singleton/autolathe_recipe/magazine_arifle name = "ammunition (7.62mm)" path = /obj/item/ammo_magazine/c762 hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_smg +/singleton/autolathe_recipe/magazine_smg name = "ammunition (9mm top mounted)" path = /obj/item/ammo_magazine/mc9mmt hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_carbine +/singleton/autolathe_recipe/magazine_carbine name = "ammunition (5.56mm, large)" path = /obj/item/ammo_magazine/a556 hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_carbinepolymer +/singleton/autolathe_recipe/magazine_carbinepolymer name = "ammunition (5.56mm, polymer)" path = /obj/item/ammo_magazine/a556/polymer hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_smallcarbine +/singleton/autolathe_recipe/magazine_smallcarbine name = "ammunition (5.56mm, small)" path = /obj/item/ammo_magazine/a556/carbine hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/magazine_smallcarbinepolymer +/singleton/autolathe_recipe/magazine_smallcarbinepolymer name = "ammunition (5.56mm, small polymer)" path = /obj/item/ammo_magazine/a556/carbine/polymer hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/shotgun +/singleton/autolathe_recipe/shotgun name = "ammunition (slug, shotgun)" path = /obj/item/ammo_casing/shotgun hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/shotgun_pellet +/singleton/autolathe_recipe/shotgun_pellet name = "ammunition (shell, shotgun)" path = /obj/item/ammo_casing/shotgun/pellet hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/tacknife +/singleton/autolathe_recipe/tacknife name = "tactical knife" path = /obj/item/material/knife/tacknife hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/stunshell +/singleton/autolathe_recipe/stunshell name = "ammunition (stun cartridge, shotgun)" path = /obj/item/ammo_casing/shotgun/stunshell hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/clip_boltaction +/singleton/autolathe_recipe/clip_boltaction name = "ammunition clip (7.62mm)" path = /obj/item/ammo_magazine/boltaction hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/detective_revolver_lethal +/singleton/autolathe_recipe/detective_revolver_lethal name = "ammunition (.38)" path = /obj/item/ammo_magazine/c38 hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/submachine_mag +/singleton/autolathe_recipe/submachine_mag name = "submachinegun magazine (.45)" path = /obj/item/ammo_magazine/submachinemag hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/uzi_mag +/singleton/autolathe_recipe/uzi_mag name = "stick magazine (.45)" path = /obj/item/ammo_magazine/c45uzi hidden = 1 category = "Arms and Ammunition" -/datum/autolathe/recipe/electropack +/singleton/autolathe_recipe/electropack name = "electropack" path = /obj/item/device/radio/electropack hidden = 1 category = "Devices and Components" -/datum/autolathe/recipe/trap +/singleton/autolathe_recipe/trap name = "mechanical trap" path = /obj/item/trap hidden = 1 category = "Devices and Components" -/datum/autolathe/recipe/welder_industrial +/singleton/autolathe_recipe/welder_industrial name = "industrial welding tool" path = /obj/item/weldingtool/largetank hidden = 1 category = "Tools" -/datum/autolathe/recipe/handcuffs +/singleton/autolathe_recipe/handcuffs name = "handcuffs" path = /obj/item/handcuffs hidden = 1 category = "General" -/datum/autolathe/recipe/brassknuckles +/singleton/autolathe_recipe/brassknuckles name = "brass knuckles" path = /obj/item/clothing/gloves/brassknuckles hidden = 1 category = "General" -/datum/autolathe/recipe/grenade +/singleton/autolathe_recipe/grenade name = "grenade casing" path = /obj/item/grenade/chem_grenade category = "Arms and Ammunition" -/datum/autolathe/recipe/grenade/large +/singleton/autolathe_recipe/grenade/large name = "large grenade casing" path = /obj/item/grenade/chem_grenade/large hidden = TRUE diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 0ea22ab0ec3..79a8f9dae98 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -267,7 +267,7 @@ //Used when someone breaks a camera /obj/machinery/camera/proc/destroy() stat |= BROKEN - wires.RandomCutAll() + wires.cut_all() kick_viewers() triggerCameraAlarm() @@ -318,7 +318,7 @@ camera_alarm.triggerAlarm(loc, src, duration) /obj/machinery/camera/proc/cancelCameraAlarm(var/force = FALSE) - if(wires.IsIndexCut(CAMERA_WIRE_ALARM) && !force) + if(wires.is_cut(WIRE_ALARM) && !force) return alarm_on = 0 @@ -405,7 +405,7 @@ return user.set_machine(src) - wires.Interact(user) + wires.interact(user) /obj/machinery/camera/proc/add_network(var/network_name) add_networks(list(network_name)) @@ -468,7 +468,7 @@ return if (stat & BROKEN) // Fix the camera stat &= ~BROKEN - wires.CutAll() - wires.MendAll() + wires.cut_all(src) + wires.repair() update_icon() update_coverage() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 244484d8a84..f70bf7e42de 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -818,7 +818,7 @@ About the new airlock wires panel: /obj/machinery/door/airlock/proc/isWireCut(var/wireIndex) // You can find the wires in the datum folder. - return QDELETED(wires) ? FALSE : wires.IsIndexCut(wireIndex) + return QDELETED(wires) ? FALSE : wires.is_cut(wireIndex) /obj/machinery/door/airlock/proc/canAIControl() return ((src.ai_control_disabled!=1) && (!src.isAllPowerLoss())); @@ -832,7 +832,7 @@ About the new airlock wires panel: return (src.main_power_lost_until==0 || src.backup_power_lost_until==0) /obj/machinery/door/airlock/requiresID() - return !(src.isWireCut(AIRLOCK_WIRE_IDSCAN) || ai_disabled_id_scanner) + return !(src.isWireCut(WIRE_IDSCAN) || ai_disabled_id_scanner) /obj/machinery/door/airlock/proc/isAllPowerLoss() if(stat & (NOPOWER|BROKEN)) @@ -842,10 +842,10 @@ About the new airlock wires panel: return FALSE /obj/machinery/door/airlock/proc/mainPowerCablesCut() - return src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2) + return src.isWireCut(WIRE_POWER1) || src.isWireCut(WIRE_POWER2) /obj/machinery/door/airlock/proc/backupPowerCablesCut() - return src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2) + return src.isWireCut(WIRE_BACKUP1) || src.isWireCut(WIRE_BACKUP2) /obj/machinery/door/airlock/proc/loseMainPower() main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) @@ -893,7 +893,7 @@ About the new airlock wires panel: /obj/machinery/door/airlock/proc/electrify(var/duration, var/feedback = 0) var/message = "" - if(isWireCut(AIRLOCK_WIRE_ELECTRIFY) && arePowerSystemsOn()) + if(isWireCut(WIRE_SHOCK) && arePowerSystemsOn()) message = text("The electrification wire is cut - Door permanently electrified.") electrified_until = -1 else if(duration && !arePowerSystemsOn()) @@ -919,14 +919,14 @@ About the new airlock wires panel: /obj/machinery/door/airlock/proc/set_idscan(var/activate, var/feedback = 0) var/message = "" - if(src.isWireCut(AIRLOCK_WIRE_IDSCAN)) - message = "The IdScan wire is cut - IdScan feature permanently disabled." + if(src.isWireCut(WIRE_IDSCAN)) + message = "The IDScan wire is cut - IdScan feature permanently disabled." else if(activate && src.ai_disabled_id_scanner) src.ai_disabled_id_scanner = FALSE - message = "IdScan feature has been enabled." + message = "IDScan feature has been enabled." else if(!activate && !src.ai_disabled_id_scanner) src.ai_disabled_id_scanner = TRUE - message = "IdScan feature has been disabled." + message = "IDScan feature has been disabled." if(feedback && message) to_chat(usr, message) @@ -934,7 +934,7 @@ About the new airlock wires panel: /obj/machinery/door/airlock/proc/set_safeties(var/activate, var/feedback = 0) var/message = "" // Safeties! We don't need no stinking safeties! - if (src.isWireCut(AIRLOCK_WIRE_SAFETY)) + if (src.isWireCut(WIRE_SAFETY)) message = text("The safety wire is cut - Cannot enable safeties.") else if (!activate && src.safe) safe = FALSE @@ -1209,7 +1209,7 @@ About the new airlock wires panel: set_safeties(!activate, 1) if("timing") // Door speed control - if(src.isWireCut(AIRLOCK_WIRE_SPEED)) + if(src.isWireCut(WIRE_TIMING)) to_chat(usr, text("The timing wire is cut - Cannot alter timing.")) else if (activate && src.normalspeed) normalspeed = FALSE @@ -1217,7 +1217,7 @@ About the new airlock wires panel: normalspeed = TRUE if("lights") // Bolt lights - if(src.isWireCut(AIRLOCK_WIRE_LIGHT)) + if(src.isWireCut(WIRE_BOLTLIGHT)) to_chat(usr, "The bolt lights wire is cut - The door bolt lights are permanently disabled.") else if (!activate && src.lights) lights = FALSE @@ -1232,7 +1232,7 @@ About the new airlock wires panel: if(isrobot(user) && !Adjacent(user)) to_chat(user, SPAN_WARNING("Your frame does not allow long distance wireless bolt control, you will need be adjacent the door.")) return - if(isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) // cut wire is noop + if(isWireCut(WIRE_BOLTLIGHT)) // cut wire is noop to_chat(user, SPAN_WARNING("The door bolt control wire is cut - Door bolts permanently dropped.")) else if(isAdmin || issilicon(user)) // controls for silicons, "stealthy" antag silicons and "stealthy" admins if(!arePowerSystemsOn()) // cannot queue actions or "speak" from unpowered doors @@ -1259,7 +1259,7 @@ About the new airlock wires panel: /obj/machinery/door/airlock/proc/bolts_override(var/mob/user, var/activate, var/isAdmin, var/antag) if(isAdmin || (issilicon(user) && antag)) // admin and silicon antag can override - if(!isAdmin && src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) // cut wire is noop, except for admins + if(!isAdmin && src.isWireCut(WIRE_BOLTLIGHT)) // cut wire is noop, except for admins to_chat(user, SPAN_WARNING("The door bolt control wire is cut - Door bolts permanently dropped.")) else if(!isAdmin && !arePowerSystemsOn()) // door must be powered - display friendly message if not (admins can magically skip this) to_chat(user, SPAN_WARNING("The door is unpowered - Cannot [activate ? "drop" : "raise"] bolts.")) @@ -1390,7 +1390,7 @@ About the new airlock wires panel: return if(src.p_open) user.set_machine(src) - wires.Interact(user) + wires.interact(user) else ..(user) return @@ -1529,7 +1529,7 @@ About the new airlock wires panel: if(isrobot(usr) && !Adjacent(usr)) to_chat(usr, SPAN_WARNING("Your frame does not allow long distance wireless bolt control, you will need be adjacent the door.")) return - if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) // cut wire is noop + if(src.isWireCut(WIRE_BOLTLIGHT)) // cut wire is noop to_chat(usr, SPAN_WARNING("The door bolt control wire is cut - Door bolts permanently dropped.")) else if(isAdmin || issilicon(usr)) // controls for silicons, "stealthy" antag silicons and "stealthy" admins if(!src.arePowerSystemsOn()) // cannot queue actions or "speak" from unpowered doors @@ -1555,7 +1555,7 @@ About the new airlock wires panel: to_chat(usr, SPAN_NOTICE("The door bolts have been raised.")) if("bolts_override") if(isAdmin || (issilicon(usr) && antag)) // admin and silicon antag can override - if(!isAdmin && src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) // cut wire is noop, except for admins + if(!isAdmin && src.isWireCut(WIRE_BOLTLIGHT)) // cut wire is noop, except for admins to_chat(usr, SPAN_WARNING("The door bolt control wire is cut - Door bolts permanently dropped.")) else if(!isAdmin && !src.arePowerSystemsOn()) // door must be powered - display friendly message if not (admins can magically skip this) to_chat(usr, SPAN_WARNING("The door is unpowered - Cannot [activate ? "drop" : "raise"] bolts.")) @@ -1595,7 +1595,7 @@ About the new airlock wires panel: set_safeties(!activate, 1) if("timing") // Door speed control - if(src.isWireCut(AIRLOCK_WIRE_SPEED)) + if(src.isWireCut(WIRE_TIMING)) to_chat(usr, text("The timing wire is cut - Cannot alter timing.")) else if (activate && src.normalspeed) normalspeed = FALSE @@ -1603,7 +1603,7 @@ About the new airlock wires panel: normalspeed = TRUE if("lights") // Bolt lights - if(src.isWireCut(AIRLOCK_WIRE_LIGHT)) + if(src.isWireCut(WIRE_BOLTLIGHT)) to_chat(usr, "The bolt lights wire is cut - The door bolt lights are permanently disabled.") else if (!activate && src.lights) lights = FALSE @@ -1860,7 +1860,7 @@ About the new airlock wires panel: /obj/machinery/door/airlock/can_open(var/forced=0) if(!forced) - if(!arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR)) + if(!arePowerSystemsOn() || isWireCut(WIRE_OPEN)) return 0 if (bracer) do_animate("brace") @@ -1875,7 +1875,7 @@ About the new airlock wires panel: return 0 if(!forced) //despite the name, this wire is for general door control. - if(!arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR)) + if(!arePowerSystemsOn() || isWireCut(WIRE_OPEN)) return 0 return ..() @@ -1997,7 +1997,7 @@ About the new airlock wires panel: if(!src.locked) return if (!forced) - if(operating || !src.arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) return + if(operating || !src.arePowerSystemsOn() || isWireCut(WIRE_BOLTS)) return src.locked = FALSE playsound(src, bolts_rising, 30, 0, -6) update_icon() diff --git a/code/game/machinery/nuclear_bomb.dm b/code/game/machinery/nuclear_bomb.dm index b807465293f..87b266434d5 100644 --- a/code/game/machinery/nuclear_bomb.dm +++ b/code/game/machinery/nuclear_bomb.dm @@ -149,7 +149,7 @@ var/bomb_set /obj/machinery/nuclearbomb/attack_hand(mob/user as mob) if (extended) if (panel_open) - wires.Interact(user) + wires.interact(user) else ui_interact(user) else if (deployable) @@ -273,7 +273,7 @@ var/bomb_set to_chat(usr, "The safety is still on.") SSnanoui.update_uis(src) return - if (wires.IsIndexCut(NUCLEARBOMB_WIRE_TIMING)) + if (wires.is_cut(WIRE_TIMING)) to_chat(usr, "Nothing happens, something might be wrong with the wiring.") SSnanoui.update_uis(src) return @@ -290,7 +290,7 @@ var/bomb_set set_security_level(SEC_LEVEL_DELTA) alerted = 1 if (href_list["safety"]) - if (wires.IsIndexCut(NUCLEARBOMB_WIRE_SAFETY)) + if (wires.is_cut(WIRE_SAFETY)) to_chat(usr, "Nothing happens, something might be wrong with the wiring.") SSnanoui.update_uis(src) return diff --git a/code/game/machinery/suit_cycler.dm b/code/game/machinery/suit_cycler.dm index 9d584335a26..235f47e8234 100644 --- a/code/game/machinery/suit_cycler.dm +++ b/code/game/machinery/suit_cycler.dm @@ -191,7 +191,7 @@ //Hacking init. if(I.ismultitool() || I.iswirecutter()) if(panel_open) - wires.Interact(user) + wires.interact(user) return //Other interface stuff. @@ -267,7 +267,7 @@ add_fingerprint(user) if(panel_open) - wires.Interact(user) + wires.interact(user) return if(..() || stat & (BROKEN|NOPOWER)) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 9bf883f16e5..3313c5f5aba 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -235,7 +235,7 @@ to_chat(user, SPAN_NOTICE("\The [W] reads, \"Solution found. Fix applied.\".")) shut_up = TRUE if(shoot_inventory) - if(wires.IsIndexCut(VENDING_WIRE_THROW)) + if(wires.is_cut(WIRE_THROW)) to_chat(user, SPAN_WARNING("\The [W] reads, \"Hardware error detected. Manual repair required.\".")) return TRUE to_chat(user, SPAN_WARNING("\The [W] reads, \"Software error detected. Rectifying.\".")) @@ -508,7 +508,7 @@ return if (panel_open) - wires.Interact(user) + wires.interact(user) else ui_interact(user) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index c52d4ae6e57..24f8afe6876 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -197,7 +197,7 @@ var/global/list/default_interrogation_channels = list( return 0 if(b_stat) - wires.Interact(user) + wires.interact(user) return ui_interact(user) @@ -210,8 +210,8 @@ var/global/list/default_interrogation_channels = list( data["default_freq"] = format_frequency(default_frequency) data["rawfreq"] = num2text(frequency) - data["mic_cut"] = (wires.IsIndexCut(WIRE_TRANSMIT) || wires.IsIndexCut(WIRE_SIGNAL)) - data["spk_cut"] = (wires.IsIndexCut(WIRE_RECEIVE) || wires.IsIndexCut(WIRE_SIGNAL)) + data["mic_cut"] = (wires.is_cut(WIRE_TRANSMIT) || wires.is_cut(WIRE_SIGNAL)) + data["spk_cut"] = (wires.is_cut(WIRE_RECEIVE) || wires.is_cut(WIRE_SIGNAL)) var/list/chanlist = list_channels(user) if(islist(chanlist) && chanlist.len) @@ -286,7 +286,7 @@ var/global/list/default_interrogation_channels = list( /obj/item/device/radio/proc/text_wires() if (b_stat) - return wires.GetInteractWindow() + return wires.get_status() return @@ -413,7 +413,7 @@ var/global/list/default_interrogation_channels = list( return FALSE if(!M || !message) return FALSE - if(wires.IsIndexCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact + if(wires.is_cut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact return FALSE if (iscarbon(M)) diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index bb314634e67..1fcd97f1995 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -30,7 +30,7 @@ to_chat(user, "You [open_panel ? "open" : "close"] the wire panel.") return TRUE else if(I.iswirecutter() || I.ismultitool() || istype(I, /obj/item/device/assembly/signaler )) - wires.Interact(user) + wires.interact(user) return TRUE else return ..() diff --git a/code/game/objects/items/weapons/ipc_scanner.dm b/code/game/objects/items/weapons/ipc_scanner.dm index 7a9fa0ea7c6..83f713807cf 100644 --- a/code/game/objects/items/weapons/ipc_scanner.dm +++ b/code/game/objects/items/weapons/ipc_scanner.dm @@ -55,7 +55,7 @@ user.visible_message(SPAN_WARNING("\The [user] [wires_exposed ? "exposes the wiring" : "closes the panel"] on \the [src]."), SPAN_WARNING("You [wires_exposed ? "expose the wiring" : "close the panel"] on \the [src]."), 3) else if(W.iswirecutter() || W.ismultitool()) if(wires_exposed) - wires.Interact(user) + wires.interact(user) else to_chat(user, SPAN_WARNING("\The [src]'s wires aren't exposed.")) else diff --git a/code/game/objects/items/weapons/landmines.dm b/code/game/objects/items/weapons/landmines.dm index 6e475e7dbf3..d198dddafaa 100644 --- a/code/game/objects/items/weapons/landmines.dm +++ b/code/game/objects/items/weapons/landmines.dm @@ -376,7 +376,7 @@ user.drop_from_inventory(I, src) - trigger_wire.Attach("red", signaler) + trigger_wire.attach_assembly(WIRE_EXPLODE, signaler) else . = ..() diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 807894d01f4..c8c41100e0b 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -18,10 +18,10 @@ var/list/attached_overlays = null var/obj/item/device/assembly_holder/holder = null var/cooldown = 0 //To prevent spam - var/wires = WIRE_RECEIVE | WIRE_PULSE + var/wires = WIRE_RECEIVE_ASSEMBLY | WIRE_PULSE_ASSEMBLY - var/const/WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate() - var/const/WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder + var/const/WIRE_RECEIVE_ASSEMBLY = 1 //Allows Pulsed(0) to call Activate() + var/const/WIRE_PULSE_ASSEMBLY = 2 //Allows Pulse(0) to act on the holder var/const/WIRE_PULSE_SPECIAL = 4 //Allows Pulse(0) to act on the holders special assembly var/const/WIRE_RADIO_RECEIVE = 8 //Allows Pulsed(1) to call Activate() var/const/WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message @@ -39,7 +39,7 @@ // Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs /obj/item/device/assembly/proc/pulsed(var/radio = 0) - if(holder && (wires & WIRE_RECEIVE)) + if(holder && (wires & WIRE_RECEIVE_ASSEMBLY)) activate() if(radio && (wires & WIRE_RADIO_RECEIVE)) activate() @@ -47,7 +47,7 @@ // Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct /obj/item/device/assembly/proc/pulse(var/radio = 0) - if(holder && (wires & WIRE_PULSE)) + if(holder && (wires & WIRE_PULSE_ASSEMBLY)) holder.process_activation(src, TRUE, FALSE) if(holder && (wires & WIRE_PULSE_SPECIAL)) holder.process_activation(src, FALSE, TRUE) diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index ac418d29878..ed478d3d86a 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -7,7 +7,7 @@ origin_tech = list(TECH_MAGNET = 1) matter = list(DEFAULT_WALL_MATERIAL = 800, MATERIAL_GLASS = 200) movable_flags = MOVABLE_FLAG_PROXMOVE - wires = WIRE_PULSE + wires = WIRE_PULSE_ASSEMBLY secured = FALSE diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index b9a4e38967c..101f238beb9 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -7,7 +7,7 @@ pickup_sound = 'sound/items/pickup/component.ogg' origin_tech = list(TECH_MAGNET = 1) matter = list(DEFAULT_WALL_MATERIAL = 1000, MATERIAL_GLASS = 200) - wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE + wires = WIRE_RECEIVE_ASSEMBLY | WIRE_PULSE_ASSEMBLY | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE secured = TRUE @@ -92,7 +92,7 @@ /obj/item/device/assembly/signaler/pulse(var/radio = FALSE) if(connected && wires) - connected.Pulse(src) + connected.pulse_assembly(src) else if(holder) holder.process_activation(src, 1, 0) else if(machine) diff --git a/code/modules/assembly/timer.dm b/code/modules/assembly/timer.dm index 26f301a92c4..dd7b66408af 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -7,7 +7,7 @@ origin_tech = list(TECH_MAGNET = 1) matter = list(DEFAULT_WALL_MATERIAL = 500, MATERIAL_GLASS = 50) - wires = WIRE_PULSE + wires = WIRE_PULSE_ASSEMBLY secured = FALSE var/timing = FALSE diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index c256e6f6643..e71a35e6665 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -1036,22 +1036,12 @@ qdel(module) -//Fiddles with some wires to possibly make the suit malfunction a little -//Had to use numeric literals here, the wire defines in rig_wiring.dm weren't working -//Possibly due to being defined in a later file, or undef'd somewhere +//Fiddles with some wires to possibly make the suit malfunction a little. /obj/item/rig/proc/misconfigure(var/probability) if (prob(probability)) - wires.UpdatePulsed(1)//Fiddle with access + wires.emp_pulse() if (prob(probability)) - wires.UpdatePulsed(2)//frustrate the AI - if (prob(probability)) - wires.UpdateCut(4)//break the suit - if (prob(probability)) - wires.UpdatePulsed(8) - if (prob(probability)) - wires.UpdateCut(16) - if (prob(probability)) - subverted = 1 + wires.emp_pulse() //Drains, rigs or removes the cell /obj/item/rig/proc/sabotage_cell() diff --git a/code/modules/clothing/spacesuits/rig/rig_attackby.dm b/code/modules/clothing/spacesuits/rig/rig_attackby.dm index f8d5fc23e24..a4f130c7cb9 100644 --- a/code/modules/clothing/spacesuits/rig/rig_attackby.dm +++ b/code/modules/clothing/spacesuits/rig/rig_attackby.dm @@ -46,7 +46,7 @@ if(W.iswirecutter() || W.ismultitool()) if(open) - wires.Interact(user) + wires.interact(user) else to_chat(user, "You can't reach the wiring.") diff --git a/code/modules/clothing/spacesuits/rig/rig_wiring.dm b/code/modules/clothing/spacesuits/rig/rig_wiring.dm index c525232ceb7..490a49d685e 100644 --- a/code/modules/clothing/spacesuits/rig/rig_wiring.dm +++ b/code/modules/clothing/spacesuits/rig/rig_wiring.dm @@ -1,7 +1,6 @@ /datum/wires/rig random = 1 holder_type = /obj/item/rig - wire_count = 5 #define RIG_SECURITY 1 #define RIG_AI_OVERRIDE 2 @@ -15,29 +14,29 @@ * Interface lock can be pulsed to toggle whether or not the interface can be accessed. */ -/datum/wires/rig/UpdateCut(var/index, var/mended) +/datum/wires/rig/on_cut(wire, mend, source) var/obj/item/rig/rig = holder - switch(index) + switch(wire) if(RIG_SECURITY) - if(mended) + if(mend) rig.req_access = initial(rig.req_access) rig.req_one_access = initial(rig.req_one_access) if(RIG_INTERFACE_SHOCK) - rig.electrified = mended ? 0 : -1 + rig.electrified = mend ? 0 : -1 rig.shock(usr,100) if(RIG_SYSTEM_CONTROL) - if(mended) + if(mend) rig.malfunctioning = 0 rig.malfunction_delay = 0 else rig.malfunctioning += 10 rig.malfunction_delay = 10000000000 -/datum/wires/rig/UpdatePulsed(var/index) +/datum/wires/rig/on_pulse(wire) var/obj/item/rig/rig = holder - switch(index) + switch(wire) if(RIG_SECURITY) rig.security_check_enabled = !rig.security_check_enabled rig.visible_message("\The [rig] twitches as several suit locks [rig.security_check_enabled?"close":"open"].") @@ -57,8 +56,10 @@ rig.electrified = 30 rig.shock(usr,100) -/datum/wires/rig/CanUse(var/mob/living/L) +/datum/wires/rig/interactable(var/mob/living/L) + if(!..()) + return FALSE var/obj/item/rig/rig = holder if(rig.open) - return 1 - return 0 + return TRUE + return FALSE diff --git a/code/modules/clothing/suits/hoodies.dm b/code/modules/clothing/suits/hoodies.dm index c8efc364f8d..16a08228f95 100644 --- a/code/modules/clothing/suits/hoodies.dm +++ b/code/modules/clothing/suits/hoodies.dm @@ -65,7 +65,7 @@ . = ..() if(isclothing(loc)) RegisterSignal(loc, COMSIG_ITEM_REMOVE, PROC_REF(RemoveHood)) - RegisterSignal(loc, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/datum, Destroy)) + RegisterSignal(loc, COMSIG_QDELETING, TYPE_PROC_REF(/datum, Destroy)) RegisterSignal(loc, COMSIG_ITEM_STATE_CHECK, PROC_REF(hooded)) RegisterSignal(loc, COMSIG_ITEM_UPDATE_STATE, PROC_REF(change_hood)) RegisterSignal(loc, COMSIG_ITEM_ICON_UPDATE, TYPE_PROC_REF(/atom, update_icon)) diff --git a/code/modules/cooking/machinery/smartfridge.dm b/code/modules/cooking/machinery/smartfridge.dm index 79c840e6b4b..1366005edba 100644 --- a/code/modules/cooking/machinery/smartfridge.dm +++ b/code/modules/cooking/machinery/smartfridge.dm @@ -386,7 +386,7 @@ /obj/machinery/smartfridge/attack_hand(mob/user) if(stat & (NOPOWER|BROKEN)) return - wires.Interact(user) + wires.interact(user) ui_interact(user) /******************* diff --git a/code/modules/events/camera_damage.dm b/code/modules/events/camera_damage.dm index 971aaa7bd25..d99625d240d 100644 --- a/code/modules/events/camera_damage.dm +++ b/code/modules/events/camera_damage.dm @@ -17,9 +17,9 @@ if(prob(2*severity)) cam.destroy() else - cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0) + cam.wires.cut(WIRE_POWER, src) if(prob(5*severity)) - cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) + cam.wires.cut(WIRE_ALARM, src) /datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5) if(!cameranet.cameras.len) diff --git a/code/modules/heavy_vehicle/equipment/utility.dm b/code/modules/heavy_vehicle/equipment/utility.dm index 3fc60643e08..ce537620383 100644 --- a/code/modules/heavy_vehicle/equipment/utility.dm +++ b/code/modules/heavy_vehicle/equipment/utility.dm @@ -521,8 +521,8 @@ var/obj/machinery/autolathe/mounted/lathe /obj/item/mecha_equipment/autolathe/get_hardpoint_maptext() - if(lathe?.build_item) - return lathe.build_item.name + if(lathe?.currently_printing) + return lathe.currently_printing.recipe.name . = ..() /obj/item/mecha_equipment/autolathe/Initialize() diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index f369e0b66bd..711621a3201 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -67,7 +67,7 @@ /mob/living/silicon/robot/handle_regular_status_updates() if(camera && !scrambled_codes) - if(stat == DEAD || wires.IsIndexCut(BORG_WIRE_CAMERA)) + if(stat == DEAD || wires.is_cut(WIRE_CAMERA)) camera.set_status(0) else camera.set_status(1) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 2151bc8aabe..de288219968 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -169,7 +169,7 @@ camera.replace_networks(list(NETWORK_STATION, NETWORK_ROBOTS)) else camera.replace_networks(list(NETWORK_MERCENARY)) - if(wires.IsIndexCut(BORG_WIRE_CAMERA)) + if(wires.is_cut(WIRE_CAMERA)) camera.status = FALSE init() @@ -659,7 +659,7 @@ to_chat(user, SPAN_NOTICE("You close \the [src]'s maintenance hatch.")) opened = FALSE handle_panel_overlay() - else if(wires_exposed && wires.IsAllCut()) + else if(wires_exposed && wires.is_all_cut()) //Cell is out, wires are exposed, remove MMI, produce damaged chassis, baleet original mob. if(!mmi) to_chat(user, SPAN_WARNING("\The [src] has no brain to remove.")) // me irl - geeves @@ -742,7 +742,7 @@ handle_panel_overlay() else if(W.iswirecutter() || W.ismultitool()) if(wires_exposed) - wires.Interact(user) + wires.interact(user) else to_chat(user, SPAN_WARNING("\The [src]'s wires aren't exposed.")) return diff --git a/code/modules/overmap/ships/identification.dm b/code/modules/overmap/ships/identification.dm index d7c88646f68..2efeb1a4a46 100644 --- a/code/modules/overmap/ships/identification.dm +++ b/code/modules/overmap/ships/identification.dm @@ -29,7 +29,7 @@ if(panel_open) if(O.ismultitool() || O.iswirecutter()) if(panel_open) - wires.Interact(user) + wires.interact(user) else to_chat(user, SPAN_WARNING("\The [src]'s wires aren't exposed.")) return TRUE diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index fe2599034f5..b5c73f70170 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -843,7 +843,7 @@ else if(hacker) to_chat(user, SPAN_WARNING("Access denied.")) else - if(allowed(usr) && !isWireCut(APC_WIRE_IDSCAN)) + if(allowed(usr) && !isWireCut(WIRE_IDSCAN)) locked = !locked to_chat(user, "You [ locked ? "lock" : "unlock"] the APC interface.") update_icon() @@ -1109,7 +1109,7 @@ user.visible_message(SPAN_WARNING("[user.name] slashes at the [name]!"), SPAN_NOTICE("You slash at the [name]!")) playsound(loc, 'sound/weapons/slash.ogg', 100, 1) - var/allcut = wires.IsAllCut() + var/allcut = wires.is_all_cut() if(beenhit >= pick(3, 4) && !wiresexposed) wiresexposed = TRUE @@ -1117,7 +1117,7 @@ visible_message(SPAN_WARNING("The [name]'s cover flies open, exposing the wires!")) else if(wiresexposed && !allcut) - wires.CutAll() + wires.cut_all() update_icon() visible_message(SPAN_WARNING("The [name]'s wires are shredded!")) else @@ -1146,7 +1146,7 @@ return if(wiresexposed && !isAI(user)) - wires.Interact(user) + wires.interact(user) return ui_interact(user) @@ -1197,7 +1197,7 @@ area.power_change() /obj/machinery/power/apc/proc/isWireCut(var/wireIndex) - return wires.IsIndexCut(wireIndex) + return wires.is_cut(wireIndex) /obj/machinery/power/apc/proc/can_use(mob/user, var/loud = 0) //used by attack_hand() and Topic() if(inoperable()) diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index 319e4e80628..8a0fdee383a 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -37,7 +37,7 @@ if(construction_state >= 3) interact(user) else if(construction_state == 2) // Wires exposed - wires.Interact(user) + wires.interact(user) /obj/machinery/particle_accelerator/control_box/update_state() if(construction_state < 3) @@ -92,17 +92,17 @@ return if(href_list["togglep"]) - if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE)) + if(!wires.is_cut(WIRE_POWER)) src.toggle_power(usr) else if(href_list["scan"]) src.part_scan() else if(href_list["strengthup"]) - if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE)) + if(!wires.is_cut(WIRE_STRENGTH)) add_strength() else if(href_list["strengthdown"]) - if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE)) + if(!wires.is_cut(WIRE_STRENGTH)) remove_strength() src.updateDialog() diff --git a/code/modules/power/smes_construction.dm b/code/modules/power/smes_construction.dm index eee050998c8..65429678cbb 100644 --- a/code/modules/power/smes_construction.dm +++ b/code/modules/power/smes_construction.dm @@ -182,7 +182,7 @@ // Cyborgs standing next to the SMES can play with the wiring. if(istype(usr, /mob/living/silicon/robot) && Adjacent(usr) && open_hatch) - wires.Interact(usr) + wires.interact(usr) // Proc: Initialize() // Parameters: 2 (dir - direction machine should face, install_coils - if coils should be spawned) @@ -207,7 +207,7 @@ /obj/machinery/power/smes/buildable/attack_hand() ..() if(open_hatch) - wires.Interact(usr) + wires.interact(usr) // Proc: recalc_coils() // Parameters: None diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index e5a6180d3cb..511636363dd 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -168,7 +168,7 @@ to_chat(user, SPAN_WARNING("You need more welding fuel to complete this task.")) return TRUE else if(I.ismultitool() || I.iswirecutter() || issignaler(I)) - wires.Interact(user) + wires.interact(user) return TRUE if(istype(I, /obj/item/melee/energy/blade)) diff --git a/code/modules/research/designs/designs.dm b/code/modules/research/designs/designs.dm index de2dc7767d5..2d419a34a37 100644 --- a/code/modules/research/designs/designs.dm +++ b/code/modules/research/designs/designs.dm @@ -53,8 +53,8 @@ other types of metals and chemistry for reagents). /datum/design/proc/AssembleDesignDesc() if(!desc) - var/atom/build_item = build_path - desc = initial(build_item.desc) + var/atom/currently_printing = build_path + desc = initial(currently_printing.desc) //Returns a new instance of the item for this design //This is to allow additional initialization to be performed, including possibly additional contructor arguments. diff --git a/html/changelogs/mattatlas-carolinen.yml b/html/changelogs/mattatlas-carolinen.yml new file mode 100644 index 00000000000..25daee01ba5 --- /dev/null +++ b/html/changelogs/mattatlas-carolinen.yml @@ -0,0 +1,43 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "The autolathe interface is now a TGUI. A queueing system and a search bar have also been added." + - rscadd: "Turned the wires panel into a TGUI. Some hacking may be slightly more difficult as the dud wire logic has been reworked - more items should have more dud wires." + - rscadd: "Holding blueprints in hand while looking at a wires panel will now reveal what each wire does. Doesn't work on randomized wires." diff --git a/maps/runtime/runtime-1.dmm b/maps/runtime/runtime-1.dmm index eef48dd11bd..86e8f8be029 100644 --- a/maps/runtime/runtime-1.dmm +++ b/maps/runtime/runtime-1.dmm @@ -1564,6 +1564,12 @@ }, /turf/simulated/floor/plating, /area/maintenance/maintcentral) +"oo" = ( +/obj/structure/table/rack, +/obj/item/stack/material/steel/full, +/obj/item/stack/material/glass/full, +/turf/simulated/floor/plating, +/area/construction) "pv" = ( /obj/structure/cable{ d1 = 4; @@ -1608,6 +1614,10 @@ /obj/effect/landmark/entry_point/aft, /turf/simulated/wall/r_wall, /area/shuttle/runtime) +"qH" = ( +/obj/machinery/autolathe, +/turf/simulated/floor/plating, +/area/construction) "sf" = ( /obj/machinery/computer/ship/sensors/terminal, /turf/simulated/floor/tiled, @@ -5955,8 +5965,8 @@ bJ bJ cM cU -de -de +qH +oo de de de diff --git a/tgui/packages/tgui/interfaces/Autolathe.tsx b/tgui/packages/tgui/interfaces/Autolathe.tsx new file mode 100644 index 00000000000..7eb10a3ea36 --- /dev/null +++ b/tgui/packages/tgui/interfaces/Autolathe.tsx @@ -0,0 +1,267 @@ +import { round } from '../../common/math'; +import { BooleanLike } from '../../common/react'; +import { capitalizeAll } from '../../common/string'; +import { useBackend, useLocalState } from '../backend'; +import { Box, Button, Input, LabeledList, NoticeBox, ProgressBar, Section, Stack, Table, Tabs } from '../components'; +import { Window } from '../layouts'; + +export type AutolatheData = { + disabled: BooleanLike; + material_efficiency: number; + build_time: number; + materials: Material[]; + recipes: Recipe[]; + categories: string[]; + queue: QueueItem[]; + currently_printing: string; +}; + +type Material = { + material: string; + stored: number; + max_capacity: number; +}; + +type Recipe = { + name: string; + category: string; + resources: string; + max_sheets: number; + sheets: number; + can_make: BooleanLike; + recipe: string; + hidden: BooleanLike; +}; + +type QueueItem = { + ref: string; + order: string; + path: string; + multiplier: number; + build_time: number; + progress: number; +}; + +export const Autolathe = (props, context) => { + const { act, data } = useBackend(context); + const [tab, setTab] = useLocalState(context, 'tab', 'All'); + + return ( + + + + +
+ + {data.materials.map((material) => ( + + {capitalizeAll(material.material)} + + }> + + {material.stored} / {material.max_capacity} + + + ))} + +
+
+ + + + {data.categories.map((category) => ( + setTab(category)}> + {category} + + ))} + + + + {tab ? : 'No category selected.'} + + + + + +
+
+
+ ); +}; + +export const CategoryData = (props, context) => { + const { act, data } = useBackend(context); + const [tab, setTab] = useLocalState(context, 'tab', 'All'); + const [searchTerm, setSearchTerm] = useLocalState( + context, + `searchTerm`, + `` + ); + const [amount, setAmount] = useLocalState(context, 'amount', 1); + + return ( +
{ + setSearchTerm(value); + }} + value={searchTerm} + /> + }> + + + Recipe + Resources + + {data.recipes + .filter( + (c) => c.name?.toLowerCase().indexOf(searchTerm.toLowerCase()) > -1 + ) + .map((recipe) => + recipe.category === tab || tab === 'All' ? ( + + +
+
+ ); +}; + +export const QueueData = (props, context) => { + const { act, data } = useBackend(context); + + return ( +
+ + {data.queue && data.queue.length ? ( + data.queue.map((queue_item) => ( + + + {round(queue_item.progress, 1)} / {queue_item.build_time} +
+ ); +}; diff --git a/tgui/packages/tgui/interfaces/Wires.tsx b/tgui/packages/tgui/interfaces/Wires.tsx new file mode 100644 index 00000000000..6b406bc63b2 --- /dev/null +++ b/tgui/packages/tgui/interfaces/Wires.tsx @@ -0,0 +1,117 @@ +import { BooleanLike } from 'common/react'; +import { useBackend } from '../backend'; +import { Box, Button, LabeledList, NoticeBox, Section, Stack } from '../components'; +import { Window } from '../layouts'; +import { capitalize } from '../../common/string'; + +type Data = { + manufacturer: string; + proper_name: string; + wires: Wire[]; + status: string[]; + tamper_resistance: BooleanLike; +}; + +type Wire = { + color: string; + cut: BooleanLike; + attached: BooleanLike; + wire: string; +}; + +export const Wires = (props, context) => { + const { data } = useBackend(context); + const { proper_name, status = [], wires = [] } = data; + const dynamicHeight = 150 + wires.length * 30 + (proper_name ? 30 : 0); + + return ( + + + + {!!proper_name && ( + + + {proper_name} Wire Configuration + + + )} + +
+ +
+
+ {!!status.length && ( + +
+ {status.map((status) => ( + {status} + ))} +
+
+ )} +
+
+
+ ); +}; + +/** Returns a labeled list of wires */ +const WireMap = (props, context) => { + const { act, data } = useBackend(context); + const { wires } = data; + + return ( + <> + + {wires.map((wire) => ( + +