code/global.dm => code/_global_vars/ (#17244)

* 1

* Full conversion

* .

* .

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
Selis
2025-04-21 05:55:25 -04:00
committed by GitHub
co-authored by Kashargul
parent 5d21a53dfa
commit 28e969778c
448 changed files with 1339 additions and 1346 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
//like orange but only checks north/south/east/west for one step
/proc/cardinalrange(var/center)
var/list/things = list()
for(var/direction in cardinal)
for(var/direction in GLOB.cardinal)
var/turf/T = get_step(center, direction)
if(!T) continue
things += T.contents
@@ -112,7 +112,7 @@
/obj/machinery/am_shielding/update_icon()
cut_overlays()
for(var/direction in alldirs)
for(var/direction in GLOB.alldirs)
var/machine = locate(/obj/machinery, get_step(loc, direction))
if((istype(machine, /obj/machinery/am_shielding) && machine:control_unit == control_unit)||(istype(machine, /obj/machinery/power/am_control_unit) && machine == control_unit))
add_overlay("shield_[direction]")
@@ -144,7 +144,7 @@
//Scans cards for shields or the control unit and if all there it
/obj/machinery/am_shielding/proc/core_check()
for(var/direction in alldirs)
for(var/direction in GLOB.alldirs)
var/machine = locate(/obj/machinery, get_step(loc, direction))
if(!machine) return 0//Need all for a core
if(!istype(machine, /obj/machinery/am_shielding) && !istype(machine, /obj/machinery/power/am_control_unit)) return 0
+3 -3
View File
@@ -326,7 +326,7 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
// merge with the powernets of power objects in the given direction
/obj/structure/cable/proc/mergeConnectedNetworks(var/direction)
var/fdir = direction ? reverse_dir[direction] : 0 //flip the direction, to match with the source position on its turf
var/fdir = direction ? GLOB.reverse_dir[direction] : 0 //flip the direction, to match with the source position on its turf
if(!(d1 == direction || d2 == direction)) //if the cable is not pointed in this direction, do nothing
return
@@ -406,13 +406,13 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
for(var/cable_dir in list(d1, d2))
if(cable_dir == 0)
continue
var/reverse = reverse_dir[cable_dir]
var/reverse = GLOB.reverse_dir[cable_dir]
T = get_zstep(src, cable_dir)
if(T)
for(var/obj/structure/cable/C in T)
if(C.d1 == reverse || C.d2 == reverse)
. += C
if(cable_dir & (cable_dir - 1)) // Diagonal, check for /\/\/\ style cables along cardinal directions
if(cable_dir & (cable_dir - 1)) // Diagonal, check for /\/\/\ style cables along GLOB.cardinal directions
for(var/pair in list(NORTH|SOUTH, EAST|WEST))
T = get_step(src, cable_dir & pair)
if(T)
+4 -4
View File
@@ -17,7 +17,7 @@
to_chat(usr, "Error: you are not an admin!")
return
if(!(locate(/obj/machinery/power/fusion_core/mapped) in machines))
if(!(locate(/obj/machinery/power/fusion_core/mapped) in GLOB.machines))
to_chat(usr, "This map is not appropriate for this verb.")
return
@@ -31,16 +31,16 @@
log_and_message_admins("## FUSION CORE SETUP - Setup initiated by [usr].")
for(var/obj/machinery/fusion_fuel_injector/mapped/injector in machines)
for(var/obj/machinery/fusion_fuel_injector/mapped/injector in GLOB.machines)
injector.cur_assembly = new /obj/item/fuel_assembly/deuterium(injector)
injector.BeginInjecting()
var/obj/machinery/power/fusion_core/mapped/core = locate() in machines
var/obj/machinery/power/fusion_core/mapped/core = locate() in GLOB.machines
if(core.jumpstart(15000))
var/list/delayed_objects = list()
// SETUP PHASE
for(var/obj/effect/engine_setup/S in machines)
for(var/obj/effect/engine_setup/S in GLOB.machines)
var/result = S.activate(0)
switch(result)
if(SETUP_OK)
+1 -1
View File
@@ -46,7 +46,7 @@ GLOBAL_LIST_EMPTY(fusion_cores)
connect_to_network()
/obj/machinery/power/fusion_core/Destroy()
for(var/obj/machinery/computer/fusion_core_control/FCC in machines)
for(var/obj/machinery/computer/fusion_core_control/FCC in GLOB.machines)
FCC.connected_devices -= src
if(FCC.cur_viewed_device == src)
FCC.cur_viewed_device = null
+7 -7
View File
@@ -530,10 +530,10 @@
var/stablemessage = "Containment field returning to stable conditions."
if(percent_unstable >= warnpoint) //we're unstable, start warning engineering
global_announcer.autosay(warnmessage, "Field Stability Monitor", "Engineering")
GLOB.global_announcer.autosay(warnmessage, "Field Stability Monitor", "Engineering")
stable = FALSE //we know we're not stable, so let's not state the safe message.
else if(percent_unstable < warnpoint && stable == 0) //The field is stable again. Let's set our safe variable and state the safe message.
global_announcer.autosay(stablemessage, "Field Stability Monitor", "Engineering")
GLOB.global_announcer.autosay(stablemessage, "Field Stability Monitor", "Engineering")
stable = TRUE
return
@@ -592,7 +592,7 @@
visible_message(span_danger("\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!"))
set_light(15, 15, "#CCCCFF")
empulse(get_turf(src), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
GLOB.global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
RadiateAll()
var/list/things_in_range = range(10, owned_core)
var/list/turfs_in_range = list()
@@ -617,7 +617,7 @@
/obj/effect/fusion_em_field/proc/MRC() //spews electromagnetic pulses in an area around the core.
visible_message(span_danger("\The [src] glows an extremely bright pink and flares out of existance!"))
global_announcer.autosay("Warning! Magnetic Resonance Cascade detected! Brace for electronic system distruption.", "Field Stability Monitor")
GLOB.global_announcer.autosay("Warning! Magnetic Resonance Cascade detected! Brace for electronic system distruption.", "Field Stability Monitor")
set_light(15, 15, "#ff00d8")
var/list/things_in_range = range(15, owned_core)
var/list/turfs_in_range = list()
@@ -630,7 +630,7 @@
return
/obj/effect/fusion_em_field/proc/QuantumFluxCascade() //spews hot phoron and oxygen in a radius around the RUST. Will probably set fire to things
global_announcer.autosay("Warning! Quantum fluxuation detected! Flammable gas release expected.", "Field Stability Monitor")
GLOB.global_announcer.autosay("Warning! Quantum fluxuation detected! Flammable gas release expected.", "Field Stability Monitor")
var/list/things_in_range = range(15, owned_core)
var/list/turfs_in_range = list()
for (var/turf/T in things_in_range)
@@ -650,7 +650,7 @@
return
/obj/effect/fusion_em_field/proc/MagneticQuench() //standard hard shutdown. dumps hot oxygen/phoron into the core's area and releases an EMP in the area around the core.
global_announcer.autosay("Warning! Magnetic Quench event detected, engaging hard shutdown.", "Field Stability Monitor")
GLOB.global_announcer.autosay("Warning! Magnetic Quench event detected, engaging hard shutdown.", "Field Stability Monitor")
empulse(owned_core, 10, 15)
var/turf/TT = get_turf(owned_core)
if(istype(TT))
@@ -670,7 +670,7 @@
visible_message(span_danger("\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!"))
set_light(15, 15, "#CCCCFF")
empulse(get_turf(src), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
GLOB.global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
RadiateAll()
var/list/things_in_range = range(10, owned_core)
var/list/turfs_in_range = list()
+1 -1
View File
@@ -42,7 +42,7 @@ GLOBAL_LIST_EMPTY(all_turbines)
GLOB.all_turbines -= src
return ..()
//generators connect in dir and reverse_dir(dir) directions
//generators connect in dir and GLOB.reverse_dir(dir) directions
//mnemonic to determine circulator/generator directions: the cirulators orbit clockwise around the generator
//so a circulator to the NORTH of the generator connects first to the EAST, then to the WEST
//and a circulator to the WEST of the generator connects first to the NORTH, then to the SOUTH
+1 -1
View File
@@ -113,7 +113,7 @@
for(var/area/A in gravity_generator:localareas)
var/obj/machinery/gravity_generator/G
for(G in machines)
for(G in GLOB.machines)
if((A in G.localareas) && (G.on))
break
if(!G)
+3 -3
View File
@@ -138,7 +138,7 @@
var/cdir
var/turf/T
for(var/card in cardinal)
for(var/card in GLOB.cardinal)
T = get_step(loc,card)
cdir = get_dir(T,loc)
@@ -157,7 +157,7 @@
var/cdir
var/turf/T
for(var/card in cardinal)
for(var/card in GLOB.cardinal)
T = get_step(loc,card)
cdir = get_dir(T,loc)
@@ -186,7 +186,7 @@
/proc/power_list(var/turf/T, var/source, var/d, var/unmarked=0, var/cable_only = 0)
. = list()
var/reverse = d ? reverse_dir[d] : 0
var/reverse = d ? GLOB.reverse_dir[d] : 0
for(var/AM in T)
if(AM == source) continue //we don't want to return source
@@ -43,7 +43,7 @@
/obj/machinery/power/sensor/Destroy()
. = ..()
// TODO - Switch power_monitor to register deletion events instead of this.
for(var/obj/machinery/computer/power_monitor/PM in machines)
for(var/obj/machinery/computer/power_monitor/PM in GLOB.machines)
if(PM.power_monitor)
PM.power_monitor.refresh_sensors()
history.Cut()
@@ -347,7 +347,7 @@
//I want to avoid using global variables.
spawn(1)
var/temp = 1 //stops spam
for(var/obj/singularity/O in machines)
for(var/obj/singularity/O in GLOB.machines)
if(O.last_warning && temp)
if((world.time - O.last_warning) > 50) //to stop message-spam
temp = 0
@@ -37,7 +37,7 @@ GLOBAL_LIST_BOILERPLATE(all_singularities, /obj/singularity)
. = ..()
energy = starting_energy
START_PROCESSING(SSobj, src)
for(var/obj/machinery/power/singularity_beacon/singubeacon in machines)
for(var/obj/machinery/power/singularity_beacon/singubeacon in GLOB.machines)
if(singubeacon.active)
target = singubeacon
break
@@ -282,7 +282,7 @@ GLOBAL_LIST_BOILERPLATE(all_singularities, /obj/singularity)
if(!move_self)
return 0
var/movement_dir = pick(alldirs - last_failed_movement)
var/movement_dir = pick(GLOB.alldirs - last_failed_movement)
if(force_move)
movement_dir = force_move
@@ -203,7 +203,7 @@
A.energy_fail(round(DETONATION_SHUTDOWN_APC * random_change))
// Effect 3: Break solar arrays
for(var/obj/machinery/power/solar/S in machines)
for(var/obj/machinery/power/solar/S in GLOB.machines)
if(!(S.z in affected_z))
continue
if(prob(DETONATION_SOLAR_BREAK_CHANCE))
@@ -256,11 +256,11 @@
else
alert_msg = null
if(alert_msg)
global_announcer.autosay(alert_msg, "Supermatter Monitor", "Engineering")
GLOB.global_announcer.autosay(alert_msg, "Supermatter Monitor", "Engineering")
log_game("SUPERMATTER([x],[y],[z]) Emergency engineering announcement. Power:[power], Oxygen:[oxygen], Damage:[damage], Integrity:[get_integrity()]")
//Public alerts
if((damage > emergency_point) && !public_alert)
global_announcer.autosay("WARNING: SUPERMATTER CRYSTAL DELAMINATION IMMINENT!", "Supermatter Monitor")
GLOB.global_announcer.autosay("WARNING: SUPERMATTER CRYSTAL DELAMINATION IMMINENT!", "Supermatter Monitor")
for(var/mob/M in player_list) // Rykka adds SM Delam alarm
if(!isnewplayer(M) && !isdeaf(M)) // Rykka adds SM Delam alarm
M << message_sound // Rykka adds SM Delam alarm
@@ -268,7 +268,7 @@
public_alert = TRUE
log_game("SUPERMATTER([x],[y],[z]) Emergency PUBLIC announcement. Power:[power], Oxygen:[oxygen], Damage:[damage], Integrity:[get_integrity()]")
else if(safe_warned && public_alert)
global_announcer.autosay(alert_msg, "Supermatter Monitor")
GLOB.global_announcer.autosay(alert_msg, "Supermatter Monitor")
public_alert = FALSE
/obj/machinery/power/supermatter/process()
+1 -1
View File
@@ -75,7 +75,7 @@
//we face the last thing we zapped, so this lets us favor that direction a bit
var/move_bias = dir
for(var/i in 0 to move_amount)
var/move_dir = pick(global.alldirs + move_bias) //ensures large-ball teslas don't just sit around
var/move_dir = pick(global.GLOB.alldirs + move_bias) //ensures large-ball teslas don't just sit around
if(target && prob(10))
move_dir = get_dir(src,target)
var/turf/T = get_step(src, move_dir)
+2 -2
View File
@@ -328,11 +328,11 @@
/obj/machinery/computer/turbine_computer/proc/locate_machinery()
if(!id)
return
for(var/obj/machinery/compressor/C in machines)
for(var/obj/machinery/compressor/C in GLOB.machines)
if(C.comp_id == id)
compressor = C
LAZYINITLIST(doors)
for(var/obj/machinery/door/blast/P in machines)
for(var/obj/machinery/door/blast/P in GLOB.machines)
if(P.id == id)
doors += P