mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-27 15:01:04 +01:00
Turn more unmanaged global vars into GLOB (#20446)
Turned a ton of unmanaged globals into managed globals. Refactored some UT output. Removed some unused things, including vars. Added a test to ensure people don't keep adding new unmanaged vars.
This commit is contained in:
@@ -59,8 +59,9 @@ GLOBAL_LIST_EMPTY(map_templates)
|
||||
I.pixel_x = 5*i + 2
|
||||
overlays += I
|
||||
|
||||
//list used to track which zlevels are being 'moved' by the proc below
|
||||
var/list/moving_levels = list()
|
||||
///list used to track which zlevels are being 'moved' by the `toggle_move_stars` proc
|
||||
GLOBAL_LIST_EMPTY(moving_levels)
|
||||
|
||||
//Proc to 'move' stars in spess
|
||||
//yes it looks ugly, but it should only fire when state actually change.
|
||||
//null direction stops movement
|
||||
@@ -76,8 +77,8 @@ var/list/moving_levels = list()
|
||||
if(!direction)
|
||||
gen_dir = null
|
||||
|
||||
if (moving_levels["[zlevel]"] != gen_dir)
|
||||
moving_levels["[zlevel]"] = gen_dir
|
||||
if (GLOB.moving_levels["[zlevel]"] != gen_dir)
|
||||
GLOB.moving_levels["[zlevel]"] = gen_dir
|
||||
|
||||
var/list/spaceturfs = block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel))
|
||||
for(var/turf/space/T in spaceturfs)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//Overmap object representing zlevel(s)
|
||||
//===================================================================================
|
||||
/// Global object used to locate the overmap area.
|
||||
var/global/area/overmap/map_overmap
|
||||
GLOBAL_DATUM(map_overmap, /area/overmap)
|
||||
|
||||
/obj/effect/overmap/visitable
|
||||
name = "map object"
|
||||
@@ -293,7 +293,7 @@ var/global/area/overmap/map_overmap
|
||||
|
||||
log_module_sectors("Putting overmap on [SSatlas.current_map.overmap_z]")
|
||||
var/area/overmap/A = new
|
||||
global.map_overmap = A
|
||||
GLOB.map_overmap = A
|
||||
for (var/square in block(locate(1,1,SSatlas.current_map.overmap_z), locate(SSatlas.current_map.overmap_size,SSatlas.current_map.overmap_size,SSatlas.current_map.overmap_z)))
|
||||
var/turf/T = square
|
||||
if(T.x == SSatlas.current_map.overmap_size || T.y == SSatlas.current_map.overmap_size)
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/ship/helm/proc/get_known_sectors()
|
||||
var/area/overmap/map = global.map_overmap
|
||||
var/area/overmap/map = GLOB.map_overmap
|
||||
if(!map)
|
||||
return
|
||||
for(var/obj/effect/overmap/visitable/sector/S in map)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//Engine component object
|
||||
|
||||
var/list/ship_engines = list()
|
||||
GLOBAL_LIST_INIT_TYPED(ship_engines, /datum/ship_engine, list())
|
||||
|
||||
/datum/ship_engine
|
||||
var/name = "ship engine"
|
||||
var/obj/machinery/holder //actual engine object
|
||||
@@ -8,7 +9,7 @@ var/list/ship_engines = list()
|
||||
/datum/ship_engine/New(var/obj/machinery/_holder)
|
||||
..()
|
||||
holder = _holder
|
||||
ship_engines += src
|
||||
GLOB.ship_engines += src
|
||||
|
||||
/datum/ship_engine/proc/can_burn()
|
||||
return 0
|
||||
@@ -40,7 +41,7 @@ var/list/ship_engines = list()
|
||||
return 1
|
||||
|
||||
/datum/ship_engine/Destroy()
|
||||
ship_engines -= src
|
||||
GLOB.ship_engines -= src
|
||||
for(var/obj/effect/overmap/visitable/ship/S in SSshuttle.ships)
|
||||
S.engines -= src
|
||||
holder = null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var/const/OVERMAP_SPEED_CONSTANT = (1 SECOND)
|
||||
#define OVERMAP_SPEED_CONSTANT (1 SECOND)
|
||||
#define SHIP_MOVE_RESOLUTION 0.00001
|
||||
#define MOVING(speed) abs(speed) >= min_speed
|
||||
#define SANITIZE_SPEED(speed) SIGN(speed) * clamp(abs(speed), 0, max_speed)
|
||||
@@ -290,7 +290,7 @@ var/const/OVERMAP_SPEED_CONSTANT = (1 SECOND)
|
||||
S.attempt_hook_up(src)
|
||||
for(var/obj/machinery/computer/shuttle_control/explore/C in SSmachinery.machinery)
|
||||
C.attempt_hook_up(src)
|
||||
for(var/datum/ship_engine/E in ship_engines)
|
||||
for(var/datum/ship_engine/E in GLOB.ship_engines)
|
||||
if(check_ownership(E.holder))
|
||||
engines |= E
|
||||
|
||||
@@ -387,6 +387,7 @@ var/const/OVERMAP_SPEED_CONSTANT = (1 SECOND)
|
||||
/obj/effect/overmap/visitable/ship/proc/get_speed_sensor_increase()
|
||||
return min(get_speed() * 1000, 50) //Engines should never increase sensor visibility by more than 50.
|
||||
|
||||
#undef OVERMAP_SPEED_CONSTANT
|
||||
#undef MOVING
|
||||
#undef SANITIZE_SPEED
|
||||
#undef CHANGE_SPEED_BY
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//list used to cache empty zlevels to avoid nedless map bloat
|
||||
var/list/cached_space = list()
|
||||
///list used to cache empty zlevels to avoid nedless map bloat
|
||||
GLOBAL_LIST_INIT_TYPED(cached_space, /obj/effect/overmap/visitable/sector/temporary, list())
|
||||
|
||||
//Space stragglers go here
|
||||
|
||||
@@ -33,9 +33,9 @@ var/list/cached_space = list()
|
||||
var/obj/effect/overmap/visitable/sector/temporary/res = locate(x, y, SSatlas.current_map.overmap_z)
|
||||
if(istype(res))
|
||||
return res
|
||||
else if(cached_space.len)
|
||||
res = cached_space[cached_space.len]
|
||||
cached_space -= res
|
||||
else if(GLOB.cached_space.len)
|
||||
res = GLOB.cached_space[GLOB.cached_space.len]
|
||||
GLOB.cached_space -= res
|
||||
res.x = x
|
||||
res.y = y
|
||||
return res
|
||||
@@ -112,4 +112,4 @@ var/list/cached_space = list()
|
||||
if (source.can_die())
|
||||
testing("Caching [M] for future use")
|
||||
source.forceMove(null)
|
||||
cached_space += source
|
||||
GLOB.cached_space += source
|
||||
|
||||
Reference in New Issue
Block a user