diff --git a/code/__DEFINES/_helpers.dm b/code/__DEFINES/_helpers.dm index 59daf48edc7..fdbfde60822 100644 --- a/code/__DEFINES/_helpers.dm +++ b/code/__DEFINES/_helpers.dm @@ -17,6 +17,14 @@ /// Until a condition is true, sleep #define UNTIL(X) while(!(X)) stoplag() +/// Sleep if we haven't been deleted +/// Otherwise, return +#define SLEEP_NOT_DEL(time) \ + if(QDELETED(src)) { \ + return; \ + } \ + sleep(time); + #ifdef EXPERIMENT_515_DONT_CACHE_REF /// Takes a datum as input, returns its ref string #define text_ref(datum) ref(datum) diff --git a/code/__DEFINES/wires.dm b/code/__DEFINES/wires.dm index 85b1d398e06..c064dcce602 100644 --- a/code/__DEFINES/wires.dm +++ b/code/__DEFINES/wires.dm @@ -1,3 +1,7 @@ +/// 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 diff --git a/code/datums/wires/_wires.dm b/code/datums/wires/_wires.dm index 499a83245e8..e107076d8bb 100644 --- a/code/datums/wires/_wires.dm +++ b/code/datums/wires/_wires.dm @@ -116,7 +116,8 @@ randomize() /datum/wires/proc/repair() - cut_wires.Cut()//a negative times a negative equals a positive + for(var/wire in cut_wires) + cut(wire) // I KNOW I KNOW OK /datum/wires/proc/get_wire(color) return colors[color] @@ -155,9 +156,11 @@ /datum/wires/proc/cut(wire) if(is_cut(wire)) cut_wires -= wire + SEND_SIGNAL(src, COMSIG_MEND_WIRE(wire), wire) on_cut(wire, mend = TRUE) else cut_wires += wire + SEND_SIGNAL(src, COMSIG_CUT_WIRE(wire), wire) on_cut(wire, mend = FALSE) /datum/wires/proc/cut_color(color) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index a013f7a1319..c2836c0db54 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -623,6 +623,10 @@ /atom/proc/HasProximity(atom/movable/proximity_check_mob as mob|obj) return +/// Sets the wire datum of an atom +/atom/proc/set_wires(datum/wires/new_wires) + wires = new_wires + /** * React to an EMP of the given severity * diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 60fd0711426..4860340c77d 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -24,7 +24,7 @@ /obj/machinery/autolathe/Initialize(mapload) AddComponent(/datum/component/material_container, SSmaterials.materials_by_category[MAT_CATEGORY_ITEM_MATERIAL], 0, MATCONTAINER_EXAMINE, _after_insert = CALLBACK(src, PROC_REF(AfterMaterialInsert))) . = ..() - wires = new /datum/wires/autolathe(src) + set_wires(new /datum/wires/autolathe(src)) if(!GLOB.autounlock_techwebs[/datum/techweb/autounlocking/autolathe]) GLOB.autounlock_techwebs[/datum/techweb/autounlocking/autolathe] = new /datum/techweb/autounlocking/autolathe stored_research = GLOB.autounlock_techwebs[/datum/techweb/autounlocking/autolathe] diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index b3c7f096400..c2a99762a2a 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -97,26 +97,37 @@ ///The type of door frame to drop during deconstruction var/assemblytype = /obj/structure/door_assembly - var/security_level = 0 //How much are wires secured - var/aiControlDisabled = AI_WIRE_NORMAL //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. - var/hackProof = FALSE // if true, this door can't be hacked by the AI - var/secondsMainPowerLost = 0 //The number of seconds until power is restored. - var/secondsBackupPowerLost = 0 //The number of seconds until power is restored. - var/spawnPowerRestoreRunning = FALSE - var/lights = TRUE // bolt lights show by default + /// How much are wires secured + var/security_level = 0 + /// 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. + var/aiControlDisabled = AI_WIRE_NORMAL + /// If true, this door can't be hacked by the AI + var/hackProof = FALSE + /// Timer id, active when we are actively waiting for the main power to be restored + var/main_power_timer = 0 + /// Paired with main_power_timer. Records its remaining time when something happens to interrupt power regen + var/main_power_time + /// Timer id, active when we are actively waiting for the backup power to be restored + var/backup_power_timer = 0 + /// Paired with backup_power_timer. Records its remaining time when something happens to interrupt power regen + var/backup_power_time + /// Bolt lights show by default + var/lights = TRUE var/aiDisabledIdScanner = FALSE var/aiHacking = FALSE - var/closeOtherId //Cyclelinking for airlocks that aren't on the same x or y coord as the target. + /// Cyclelinking for airlocks that aren't on the same x or y coord as the target. + var/closeOtherId var/obj/machinery/door/airlock/closeOther var/list/obj/machinery/door/airlock/close_others = list() var/obj/item/electronics/airlock/electronics COOLDOWN_DECLARE(shockCooldown) - var/obj/item/note //Any papers pinned to the airlock + /// Any papers pinned to the airlock + var/obj/item/note /// The seal on the airlock var/obj/item/seal var/detonated = FALSE var/abandoned = FALSE - ///Controls if the door closes quickly or not. FALSE = the door autocloses in 1.5 seconds, TRUE = 8 seconds - see autoclose_in() + /// Controls if the door closes quickly or not. FALSE = the door autocloses in 1.5 seconds, TRUE = 8 seconds - see autoclose_in() var/normalspeed = TRUE var/cutAiWire = FALSE var/autoname = FALSE @@ -126,20 +137,25 @@ var/boltUp = 'sound/machines/boltsup.ogg' var/boltDown = 'sound/machines/boltsdown.ogg' var/noPower = 'sound/machines/doorclick.ogg' - var/previous_airlock = /obj/structure/door_assembly //what airlock assembly mineral plating was applied to - var/airlock_material //material of inner filling; if its an airlock with glass, this should be set to "glass" + /// What airlock assembly mineral plating was applied to + var/previous_airlock = /obj/structure/door_assembly + /// Material of inner filling; if its an airlock with glass, this should be set to "glass" + var/airlock_material var/overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi' - var/note_overlay_file = 'icons/obj/doors/airlocks/station/overlays.dmi' //Used for papers and photos pinned to the airlock + /// Used for papers and photos pinned to the airlock + var/note_overlay_file = 'icons/obj/doors/airlocks/station/overlays.dmi' var/cyclelinkeddir = 0 var/obj/machinery/door/airlock/cyclelinkedairlock var/shuttledocked = 0 - var/delayed_close_requested = FALSE // TRUE means the door will automatically close the next time it's opened. - var/air_tight = FALSE //TRUE means density will be set as soon as the door begins to close + /// TRUE means the door will automatically close the next time it's opened. + var/delayed_close_requested = FALSE + /// TRUE means density will be set as soon as the door begins to close + var/air_tight = FALSE var/prying_so_hard = FALSE - ///Logging for door electrification. + /// Logging for door electrification. var/shockedby - ///How many seconds remain until the door is no longer electrified. -1/MACHINE_ELECTRIFIED_PERMANENT = permanently electrified until someone fixes it. + /// How many seconds remain until the door is no longer electrified. -1/MACHINE_ELECTRIFIED_PERMANENT = permanently electrified until someone fixes it. var/secondsElectrified = MACHINE_NOT_ELECTRIFIED flags_1 = HTML_USE_INITAL_ICON_1 @@ -147,7 +163,7 @@ /obj/machinery/door/airlock/Initialize(mapload) . = ..() - wires = set_wires() + set_wires(get_wires()) if(glass) airlock_material = "glass" if(security_level > AIRLOCK_SECURITY_IRON) @@ -317,7 +333,7 @@ return ((aiControlDisabled == AI_WIRE_DISABLED) && (!hackProof) && (!isAllPowerCut())); /obj/machinery/door/airlock/hasPower() - return ((!secondsMainPowerLost || !secondsBackupPowerLost) && !(machine_stat & NOPOWER)) + return ((!remaining_main_outage() || !remaining_backup_outage()) && !(machine_stat & NOPOWER)) /obj/machinery/door/airlock/requiresID() return !(wires.is_cut(WIRE_IDSCAN) || aiDisabledIdScanner) @@ -326,51 +342,127 @@ if((wires.is_cut(WIRE_POWER1) || wires.is_cut(WIRE_POWER2)) && (wires.is_cut(WIRE_BACKUP1) || wires.is_cut(WIRE_BACKUP2))) return TRUE -/obj/machinery/door/airlock/proc/regainMainPower() - if(secondsMainPowerLost > 0) - secondsMainPowerLost = 0 - update_appearance() +/// Returns the amount of time we have to wait before main power comes back +/// Assuming it was actively regenerating +/// Returns 0 if it is active +/obj/machinery/door/airlock/proc/remaining_main_outage() + if(main_power_timer) + return timeleft(main_power_timer) + return main_power_time -/obj/machinery/door/airlock/proc/handlePowerRestore() - var/cont = TRUE - while (cont) - sleep(1 SECONDS) - if(QDELETED(src)) - return - cont = FALSE - if(secondsMainPowerLost>0) - if(!wires.is_cut(WIRE_POWER1) && !wires.is_cut(WIRE_POWER2)) - secondsMainPowerLost -= 1 - cont = TRUE - if(secondsBackupPowerLost>0) - if(!wires.is_cut(WIRE_BACKUP1) && !wires.is_cut(WIRE_BACKUP2)) - secondsBackupPowerLost -= 1 - cont = TRUE - spawnPowerRestoreRunning = FALSE - update_appearance() +/// Returns the amount of time we have to wait before backup power comes back +/// Assuming it was actively regenerating +/// Returns 0 if it is active +/obj/machinery/door/airlock/proc/remaining_backup_outage() + if(backup_power_timer) + return timeleft(backup_power_timer) + return backup_power_time + +/obj/machinery/door/airlock/proc/set_main_outage(delay) + // Clear out the timer so we don't accidentially take from it later + if(main_power_timer) + deltimer(main_power_timer) + main_power_timer = null + var/old_time = main_power_time + main_power_time = delay + handle_main_power() + if(!!old_time != !!delay) + update_appearance() + +/obj/machinery/door/airlock/proc/set_backup_outage(delay) + // Clear out the timer so we don't accidentially take from it later + if(backup_power_timer) + deltimer(backup_power_timer) + backup_power_timer = null + var/old_time = backup_power_time + backup_power_time = delay + handle_backup_power() + if(!!old_time != !!delay) + update_appearance() + +/// Call to update our main power outage timer +/// Will trigger a proper timer if we're actively restoring power, if not we'll dump the remaining time in a var on the airlock +/obj/machinery/door/airlock/proc/handle_main_power() + if(main_power_time <= 0) + deltimer(main_power_timer) + main_power_timer = null + return + + // If we can, we'll start a timer that hits when we're done + if(!wires.is_cut(WIRE_POWER1) && !wires.is_cut(WIRE_POWER2)) + if(!main_power_timer || timeleft(main_power_timer) != main_power_time) + main_power_timer = addtimer(CALLBACK(src, PROC_REF(regainMainPower)), main_power_time, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE|TIMER_DELETE_ME) + // Otherwise, we'll ensure the timer matches main_power_time + else if(main_power_timer) + main_power_time = timeleft(main_power_timer) + deltimer(main_power_timer) + main_power_timer = null + +/// Call to update our backup power outage timer +/// Will trigger a proper timer if we're actively restoring power, if not we'll dump the remaining time in a var on the airlock +/obj/machinery/door/airlock/proc/handle_backup_power() + if(backup_power_time <= 0) + deltimer(backup_power_timer) + backup_power_timer = null + return + + // If we can, we'll start a timer that hits when we're done + if(!wires.is_cut(WIRE_BACKUP1) && !wires.is_cut(WIRE_BACKUP2)) + if(!backup_power_timer || timeleft(backup_power_timer) != backup_power_time) + backup_power_timer = addtimer(CALLBACK(src, PROC_REF(regainBackupPower)), backup_power_time, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE|TIMER_DELETE_ME) + // Otherwise, we'll ensure the timer matches backup_power_time + else if(backup_power_timer) + backup_power_time = timeleft(backup_power_timer) + deltimer(backup_power_timer) + backup_power_timer = null + +// Alright, we're gonna do a meme here +/obj/machinery/door/airlock/set_wires(datum/wires/new_wires) + if(wires) + UnregisterSignal(wires, list( + COMSIG_CUT_WIRE(WIRE_POWER1), + COMSIG_CUT_WIRE(WIRE_POWER2), + COMSIG_CUT_WIRE(WIRE_BACKUP1), + COMSIG_CUT_WIRE(WIRE_BACKUP2), + COMSIG_MEND_WIRE(WIRE_POWER1), + COMSIG_MEND_WIRE(WIRE_POWER2), + COMSIG_MEND_WIRE(WIRE_BACKUP1), + COMSIG_MEND_WIRE(WIRE_BACKUP2), + )) + . = ..() + if(new_wires) + RegisterSignals(new_wires, list( + COMSIG_CUT_WIRE(WIRE_POWER1), + COMSIG_CUT_WIRE(WIRE_POWER2), + COMSIG_CUT_WIRE(WIRE_BACKUP1), + COMSIG_CUT_WIRE(WIRE_BACKUP2), + COMSIG_MEND_WIRE(WIRE_POWER1), + COMSIG_MEND_WIRE(WIRE_POWER2), + COMSIG_MEND_WIRE(WIRE_BACKUP1), + COMSIG_MEND_WIRE(WIRE_BACKUP2), + ), PROC_REF(power_wires_changed)) + +/// If our power wires have changed, then our backup/main power regen may have failed, so let's just check in yeah? +/obj/machinery/door/airlock/proc/power_wires_changed(datum/source, wire) + SIGNAL_HANDLER + handle_main_power() + handle_backup_power() + +/obj/machinery/door/airlock/proc/regainMainPower() + set_main_outage(0 SECONDS) /obj/machinery/door/airlock/proc/loseMainPower() - if(secondsMainPowerLost <= 0) - secondsMainPowerLost = 60 - if(secondsBackupPowerLost < 10) - secondsBackupPowerLost = 10 - if(!spawnPowerRestoreRunning) - spawnPowerRestoreRunning = TRUE - INVOKE_ASYNC(src, PROC_REF(handlePowerRestore)) - update_appearance() + if(!remaining_main_outage()) + set_main_outage(60 SECONDS) + if(remaining_backup_outage() < 10 SECONDS) + set_backup_outage(10 SECONDS) /obj/machinery/door/airlock/proc/loseBackupPower() - if(secondsBackupPowerLost < 60) - secondsBackupPowerLost = 60 - if(!spawnPowerRestoreRunning) - spawnPowerRestoreRunning = TRUE - INVOKE_ASYNC(src, PROC_REF(handlePowerRestore)) - update_appearance() + if(remaining_backup_outage() < 60 SECONDS) + set_backup_outage(60 SECONDS) /obj/machinery/door/airlock/proc/regainBackupPower() - if(secondsBackupPowerLost > 0) - secondsBackupPowerLost = 0 - update_appearance() + set_backup_outage(0 SECONDS) // shock user with probability prb (if all connections & power are working) // returns TRUE if shocked, FALSE otherwise @@ -1476,10 +1568,10 @@ var/list/data = list() var/list/power = list() - power["main"] = secondsMainPowerLost ? 0 : 2 // boolean - power["main_timeleft"] = secondsMainPowerLost - power["backup"] = secondsBackupPowerLost ? 0 : 2 // boolean - power["backup_timeleft"] = secondsBackupPowerLost + power["main"] = remaining_main_outage() ? 0 : 2 // boolean + power["main_timeleft"] = remaining_main_outage() + power["backup"] = remaining_backup_outage() ? 0 : 2 // boolean + power["backup_timeleft"] = remaining_backup_outage() data["power"] = power data["shock"] = secondsElectrified == MACHINE_NOT_ELECTRIFIED ? 2 : 0 @@ -1517,14 +1609,14 @@ return switch(action) if("disrupt-main") - if(!secondsMainPowerLost) + if(remaining_main_outage()) loseMainPower() update_appearance() else to_chat(usr, span_warning("Main power is already offline.")) . = TRUE if("disrupt-backup") - if(!secondsBackupPowerLost) + if(remaining_backup_outage()) loseBackupPower() update_appearance() else @@ -1629,7 +1721,7 @@ * Returns a new /datum/wires/ with the appropriate wire layout based on the airlock_wires * of the area the airlock is in. */ -/obj/machinery/door/airlock/proc/set_wires() +/obj/machinery/door/airlock/proc/get_wires() var/area/source_area = get_area(src) return source_area?.airlock_wires ? new source_area.airlock_wires(src) : new /datum/wires/airlock(src) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 39691a77632..bb8dd36df47 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -382,10 +382,10 @@ use_power(active_power_usage) do_animate("opening") set_opacity(0) - sleep(0.5 SECONDS) + SLEEP_NOT_DEL(0.5 SECONDS) set_density(FALSE) flags_1 &= ~PREVENT_CLICK_UNDER_1 - sleep(0.5 SECONDS) + SLEEP_NOT_DEL(0.5 SECONDS) layer = initial(layer) update_appearance() set_opacity(0) @@ -419,10 +419,10 @@ do_animate("closing") layer = closingLayer - sleep(0.5 SECONDS) + SLEEP_NOT_DEL(0.5 SECONDS) set_density(TRUE) flags_1 |= PREVENT_CLICK_UNDER_1 - sleep(0.5 SECONDS) + SLEEP_NOT_DEL(0.5 SECONDS) update_appearance() if(visible && !glass) set_opacity(1) diff --git a/code/game/machinery/ecto_sniffer.dm b/code/game/machinery/ecto_sniffer.dm index fe0e3c78390..54d2b5e6f1e 100644 --- a/code/game/machinery/ecto_sniffer.dm +++ b/code/game/machinery/ecto_sniffer.dm @@ -16,7 +16,7 @@ /obj/machinery/ecto_sniffer/Initialize(mapload) . = ..() - wires = new/datum/wires/ecto_sniffer(src) + set_wires(new/datum/wires/ecto_sniffer(src)) /obj/machinery/ecto_sniffer/attack_ghost(mob/user) . = ..() diff --git a/code/game/machinery/modular_shield.dm b/code/game/machinery/modular_shield.dm index 2d018fdab82..44390766ef2 100644 --- a/code/game/machinery/modular_shield.dm +++ b/code/game/machinery/modular_shield.dm @@ -99,7 +99,7 @@ /obj/machinery/modular_shield_generator/Initialize(mapload) . = ..() - wires = new /datum/wires/modular_shield_generator(src) + set_wires(new /datum/wires/modular_shield_generator(src)) if(mapload && active && anchored) activate_shields() diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm index 21cc20728bb..e6b93f316ce 100644 --- a/code/game/machinery/roulette_machine.dm +++ b/code/game/machinery/roulette_machine.dm @@ -58,7 +58,7 @@ /obj/machinery/roulette/Initialize(mapload) . = ..() jackpot_loop = new(src, FALSE) - wires = new /datum/wires/roulette(src) + set_wires(new /datum/wires/roulette(src)) /obj/machinery/roulette/Destroy() QDEL_NULL(jackpot_loop) diff --git a/code/game/machinery/scan_gate.dm b/code/game/machinery/scan_gate.dm index d519dae8a57..d2278d680ad 100644 --- a/code/game/machinery/scan_gate.dm +++ b/code/game/machinery/scan_gate.dm @@ -49,7 +49,7 @@ /obj/machinery/scanner_gate/Initialize(mapload) . = ..() - wires = new /datum/wires/scanner_gate(src) + set_wires(new /datum/wires/scanner_gate(src)) set_scanline("passive") var/static/list/loc_connections = list( COMSIG_ATOM_ENTERED = PROC_REF(on_entered), @@ -58,7 +58,7 @@ /obj/machinery/scanner_gate/Destroy() qdel(wires) - wires = null + set_wires(null) . = ..() /obj/machinery/scanner_gate/examine(mob/user) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index b91daa083a4..56874562d68 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -172,7 +172,7 @@ . = ..() set_access() - wires = new /datum/wires/suit_storage_unit(src) + set_wires(new /datum/wires/suit_storage_unit(src)) if(suit_type) suit = new suit_type(src) if(helmet_type) diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index ce3d1abe11b..29a450a1782 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -99,7 +99,7 @@ /obj/machinery/syndicatebomb/Initialize(mapload) . = ..() - wires = new /datum/wires/syndicatebomb(src) + set_wires(new /datum/wires/syndicatebomb(src)) if(payload) payload = new payload(src) update_appearance() diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 00296d5c53b..0f337f99b72 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -91,7 +91,7 @@ VAR_PRIVATE/should_update_icon = FALSE /obj/item/radio/Initialize(mapload) - wires = new /datum/wires/radio(src) + set_wires(new /datum/wires/radio(src)) secure_radio_connections = list() . = ..() diff --git a/code/game/objects/items/grenades/chem_grenade.dm b/code/game/objects/items/grenades/chem_grenade.dm index 1e54d11f830..5eccf08d06e 100644 --- a/code/game/objects/items/grenades/chem_grenade.dm +++ b/code/game/objects/items/grenades/chem_grenade.dm @@ -32,7 +32,7 @@ AddElement(/datum/element/empprotection, EMP_PROTECT_WIRES) create_reagents(casing_holder_volume) stage_change() // If no argument is set, it will change the stage to the current stage, useful for stock grenades that start READY. - wires = new /datum/wires/explosive/chem_grenade(src) + set_wires(new /datum/wires/explosive/chem_grenade(src)) /obj/item/grenade/chem_grenade/Destroy(force) QDEL_NULL(wires) diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index 363bd3e1765..b9f84691367 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -27,11 +27,11 @@ . = ..() AddElement(/datum/element/empprotection, EMP_PROTECT_WIRES) plastic_overlay = mutable_appearance(icon, "[inhand_icon_state]2", HIGH_OBJ_LAYER) - wires = new /datum/wires/explosive/c4(src) + set_wires(new /datum/wires/explosive/c4(src)) /obj/item/grenade/c4/Destroy() qdel(wires) - wires = null + set_wires(null) target = null return ..() diff --git a/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm b/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm index 0aa32f06691..6faacc2c059 100644 --- a/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm +++ b/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm @@ -85,7 +85,7 @@ GLOBAL_LIST_EMPTY_TYPED(air_alarms, /obj/machinery/airalarm) /obj/machinery/airalarm/Initialize(mapload, ndir, nbuild) . = ..() - wires = new /datum/wires/airalarm(src) + set_wires(new /datum/wires/airalarm(src)) if(ndir) setDir(ndir) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index 59d0a731512..cb9de7e5e91 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -51,7 +51,7 @@ /obj/machinery/microwave/Initialize(mapload) . = ..() - wires = new /datum/wires/microwave(src) + set_wires(new /datum/wires/microwave(src)) create_reagents(100) soundloop = new(src, FALSE) update_appearance(UPDATE_ICON) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 92006b7caac..2bf6f7da947 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -221,7 +221,7 @@ if(open && !bomb) if(!user.transferItemToLoc(I, src)) return - wires = new /datum/wires/explosive/pizza(src) + set_wires(new /datum/wires/explosive/pizza(src)) register_bomb(I) balloon_alert(user, "bomb placed") update_appearance() @@ -300,7 +300,7 @@ /obj/item/pizzabox/proc/unprocess() STOP_PROCESSING(SSobj, src) qdel(wires) - wires = null + set_wires(null) update_appearance() /obj/item/pizzabox/bomb/Initialize(mapload) @@ -309,7 +309,7 @@ var/randompizza = pick(subtypesof(/obj/item/food/pizza)) pizza = new randompizza(src) register_bomb(new /obj/item/bombcore/miniature/pizza(src)) - wires = new /datum/wires/explosive/pizza(src) + set_wires(new /datum/wires/explosive/pizza(src)) /obj/item/pizzabox/bomb/armed bomb_timer = 5 diff --git a/code/modules/jobs/job_types/security_officer.dm b/code/modules/jobs/job_types/security_officer.dm index cd258484260..8cb3564a10a 100644 --- a/code/modules/jobs/job_types/security_officer.dm +++ b/code/modules/jobs/job_types/security_officer.dm @@ -235,7 +235,7 @@ GLOBAL_LIST_EMPTY(security_officer_distribution) /obj/item/radio/headset/headset_sec/alt/department/Initialize(mapload) . = ..() - wires = new/datum/wires/radio(src) + set_wires(new/datum/wires/radio(src)) secure_radio_connections = list() recalculateChannels() diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index a408108b95a..f81941aa975 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -245,13 +245,13 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ /obj/item/gibtonite/Destroy() qdel(wires) - wires = null + set_wires(null) return ..() /obj/item/gibtonite/attackby(obj/item/I, mob/user, params) if(!wires && isigniter(I)) user.visible_message(span_notice("[user] attaches [I] to [src]."), span_notice("You attach [I] to [src].")) - wires = new /datum/wires/explosive/gibtonite(src) + set_wires(new /datum/wires/explosive/gibtonite(src)) attacher = key_name(user) qdel(I) add_overlay("Gibtonite_igniter") diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index d2aafa50802..8399a85e1c6 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -14,7 +14,7 @@ roleplay_emotes = list(/datum/emote/silicon/buzz, /datum/emote/silicon/buzz2, /datum/emote/living/beep), \ roleplay_callback = CALLBACK(src, PROC_REF(untip_roleplay))) - wires = new /datum/wires/robot(src) + set_wires(new /datum/wires/robot(src)) AddElement(/datum/element/empprotection, EMP_PROTECT_WIRES) AddElement(/datum/element/ridable, /datum/component/riding/creature/cyborg) RegisterSignal(src, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, PROC_REF(charge)) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index df85d6d7d4a..fcfefe5e2cc 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -68,7 +68,7 @@ if(prob(0.666) && mapload) new /mob/living/simple_animal/bot/mulebot/paranormal(loc) return INITIALIZE_HINT_QDEL - wires = new /datum/wires/mulebot(src) + set_wires(new /datum/wires/mulebot(src)) // Doing this hurts my soul, but simplebot access reworks are for another day. var/datum/id_trim/job/cargo_trim = SSid_access.trim_singletons_by_path[/datum/id_trim/job/cargo_technician] diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm index ea3b3ef5f3d..15daad640bf 100644 --- a/code/modules/mod/mod_control.dm +++ b/code/modules/mod/mod_control.dm @@ -105,7 +105,7 @@ complexity_max = theme.complexity_max ui_theme = theme.ui_theme charge_drain = theme.charge_drain - wires = new /datum/wires/mod(src) + set_wires(new /datum/wires/mod(src)) if(length(req_access)) locked = TRUE new_core?.install(src) diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm index f871f94bf92..13fbecb006c 100644 --- a/code/modules/paperwork/fax.dm +++ b/code/modules/paperwork/fax.dm @@ -61,7 +61,7 @@ GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department fax_id = assign_random_name() if (!fax_name) fax_name = "Unregistered fax " + fax_id - wires = new /datum/wires/fax(src) + set_wires(new /datum/wires/fax(src)) register_context() special_networks["nanotrasen"]["fax_name"] = GLOB.nt_fax_department diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 59fa92aba32..bc1b589669a 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -175,7 +175,7 @@ name = "\improper [get_area_name(area, TRUE)] APC" //Initialize its electronics - wires = new /datum/wires/apc(src) + set_wires(new /datum/wires/apc(src)) alarm_manager = new(src) AddElement(/datum/element/atmos_sensitive, mapload) // for apcs created during map load make them fully functional diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index d165bf237f2..430d7691d31 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -60,7 +60,7 @@ /obj/machinery/power/emitter/Initialize(mapload) . = ..() RefreshParts() - wires = new /datum/wires/emitter(src) + set_wires(new /datum/wires/emitter(src)) if(welded) if(!anchored) set_anchored(TRUE) diff --git a/code/modules/power/tesla/coil.dm b/code/modules/power/tesla/coil.dm index c8d082f3928..cfc58579da7 100644 --- a/code/modules/power/tesla/coil.dm +++ b/code/modules/power/tesla/coil.dm @@ -36,7 +36,7 @@ /obj/machinery/power/energy_accumulator/tesla_coil/Initialize(mapload) . = ..() - wires = new /datum/wires/tesla_coil(src) + set_wires(new /datum/wires/tesla_coil(src)) /obj/machinery/power/energy_accumulator/tesla_coil/RefreshParts() . = ..() diff --git a/code/modules/recycling/conveyor.dm b/code/modules/recycling/conveyor.dm index ff8c6abd2fd..20abb6c4be4 100644 --- a/code/modules/recycling/conveyor.dm +++ b/code/modules/recycling/conveyor.dm @@ -334,7 +334,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) update_appearance() LAZYADD(GLOB.conveyors_by_id[id], src) - wires = new /datum/wires/conveyor(src) + set_wires(new /datum/wires/conveyor(src)) AddComponent(/datum/component/usb_port, list( /obj/item/circuit_component/conveyor_switch, )) diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index 4deb1e9ec46..bb19fb34817 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -22,7 +22,7 @@ . = ..() if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research) connect_techweb(SSresearch.science_tech) - wires = new /datum/wires/rnd(src) + set_wires(new /datum/wires/rnd(src)) /obj/machinery/rnd/Destroy() if(stored_research) diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index eb6d894ebb2..15ff09ef513 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -206,7 +206,7 @@ circuit = null build_inv = TRUE . = ..() - wires = new /datum/wires/vending(src) + set_wires(new /datum/wires/vending(src)) if(SStts.tts_enabled) var/static/vendor_voice_by_type = list() diff --git a/code/modules/wiremod/shell/airlock.dm b/code/modules/wiremod/shell/airlock.dm index e330d5a58a5..ea7d9662cfc 100644 --- a/code/modules/wiremod/shell/airlock.dm +++ b/code/modules/wiremod/shell/airlock.dm @@ -35,7 +35,7 @@ return TRUE return isAdminGhostAI(user) -/obj/machinery/door/airlock/shell/set_wires() +/obj/machinery/door/airlock/shell/get_wires() return new /datum/wires/airlock/shell(src) /obj/item/circuit_component/airlock