Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makes a few things managed globals #5656

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions code/__DEFINES/singletons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

/// Get a singleton instance according to path P. Creates it if necessary. Null if abstract or not a singleton.
#define GET_SINGLETON(P)\
(ispath(P, /singleton) ? (Singletons.resolved_instances[P] ? Singletons.instances[P] : Singletons.GetInstance(P)) : null)
(ispath(P, /singleton) ? (GLOB.Singletons.resolved_instances[P] ? GLOB.Singletons.instances[P] : GLOB.Singletons.GetInstance(P)) : null)

/// Get a (path = instance) map of valid singletons according to typesof(P).
#define GET_SINGLETON_TYPE_MAP(P)\
(ispath(P, /singleton) ? (Singletons.resolved_type_maps[P] ? Singletons.type_maps[P] : Singletons.GetTypeMap(P)) : list())
(ispath(P, /singleton) ? (GLOB.Singletons.resolved_type_maps[P] ? GLOB.Singletons.type_maps[P] : GLOB.Singletons.GetTypeMap(P)) : list())

/// Get a (path = instance) map of valid singletons according to subtypesof(P).
#define GET_SINGLETON_SUBTYPE_MAP(P)\
(ispath(P, /singleton) ? (Singletons.resolved_subtype_maps[P] ? Singletons.subtype_maps[P] : Singletons.GetSubtypeMap(P)) : list())
(ispath(P, /singleton) ? (GLOB.Singletons.resolved_subtype_maps[P] ? GLOB.Singletons.subtype_maps[P] : GLOB.Singletons.GetSubtypeMap(P)) : list())

/// Get a list of valid singletons according to typesof(path).
#define GET_SINGLETON_TYPE_LIST(P)\
(ispath(P, /singleton) ? (Singletons.resolved_type_lists[P] ? Singletons.type_lists[P] : Singletons.GetTypeList(P)) : list())
(ispath(P, /singleton) ? (GLOB.Singletons.resolved_type_lists[P] ? GLOB.Singletons.type_lists[P] : GLOB.Singletons.GetTypeList(P)) : list())

/// Get a list of valid singletons according to subtypesof(path).
#define GET_SINGLETON_SUBTYPE_LIST(P)\
(ispath(P, /singleton) ? (Singletons.resolved_subtype_lists[P] ? Singletons.subtype_lists[P] : Singletons.GetSubtypeList(P)) : list())
(ispath(P, /singleton) ? (GLOB.Singletons.resolved_subtype_lists[P] ? GLOB.Singletons.subtype_lists[P] : GLOB.Singletons.GetSubtypeList(P)) : list())
4 changes: 2 additions & 2 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0

if (isnull(icon_state))
icon_state = A.icon_state
if (!(icon_state in icon_states(I, 1)))
if (!(icon_state in fast_icon_states(I, 1)))
icon_state = initial(A.icon_state)
if (isnull(dir))
dir = initial(A.dir)
Expand Down Expand Up @@ -1141,7 +1141,7 @@ GLOBAL_LIST_EMPTY(icon_exists_cache)
if(GLOB.icon_exists_cache[file]?[state] == FALSE)
return FALSE

var/list/states = icon_states(file)
var/list/states = fast_icon_states(file)

if(!GLOB.icon_exists_cache[file])
GLOB.icon_exists_cache[file] = list()
Expand Down
8 changes: 4 additions & 4 deletions code/__HELPERS/icons/flatten.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
var/state = A.icon_state
var/none = !icon
if(!none)
var/list/states = icon_states(icon)
var/list/states = fast_icon_states(icon)
if(!(state in states))
if(!("" in states))
none = TRUE
Expand All @@ -97,9 +97,9 @@
dir = A.dir
var/ourdir = dir
if(!none && ourdir != SOUTH)
if(length(icon_states(icon(icon, state, NORTH))))
else if(length(icon_states(icon(icon, state, EAST))))
else if(length(icon_states(icon(icon, state, WEST))))
if(length(fast_icon_states(icon(icon, state, NORTH))))
else if(length(fast_icon_states(icon(icon, state, EAST))))
else if(length(fast_icon_states(icon(icon, state, WEST))))
else
ourdir = SOUTH

Expand Down
4 changes: 2 additions & 2 deletions code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#define CanDefaultInteract(user) (CanUseTopic(user, DefaultTopicState()) == UI_INTERACTIVE)

#define sequential_id(key) uniqueness_repository.Generate(/datum/uniqueness_generator/id_sequential, key)
#define sequential_id(key) GLOB.uniqueness_repository.Generate(/datum/uniqueness_generator/id_sequential, key)

#define random_id(key,min_id,max_id) uniqueness_repository.Generate(/datum/uniqueness_generator/id_random, key, min_id, max_id)
#define random_id(key,min_id,max_id) GLOB.uniqueness_repository.Generate(/datum/uniqueness_generator/id_random, key, min_id, max_id)

#define JOINTEXT(X) jointext(X, null)
2 changes: 1 addition & 1 deletion code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ so as to remain in compliance with the most up-to-date laws."
for(var/i = 1, i <= alerts.len, i++)
var/atom/movable/screen/alert/alert = alerts[alerts[i]]

if(alert.icon_state in icon_states(ui_style))
if(alert.icon_state in fast_icon_states(ui_style))
alert.icon = ui_style

else if(!alert.no_underlay)
Expand Down
2 changes: 1 addition & 1 deletion code/_rendering/atom_huds/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
holder.icon_state = "syndicate"

/proc/RoundHealth(health, icon = GLOB.hud_icon_files[LIFE_HUD])
var/list/icon_states = icon_states(icon)
var/list/icon_states = fast_icon_states(icon)
for(var/icon_state in icon_states)
if(health >= text2num(icon_state))
return icon_state
Expand Down
12 changes: 6 additions & 6 deletions code/controllers/subsystem/alarm.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// We manually initialize the alarm handlers instead of looping over all existing types
// to make it possible to write: camera_alarm.triggerAlarm() rather than SSalarms.managers[datum/alarm_handler/camera].triggerAlarm() or a variant thereof.
/var/global/datum/alarm_handler/atmosphere/atmosphere_alarm = new()
/var/global/datum/alarm_handler/camera/camera_alarm = new()
/var/global/datum/alarm_handler/fire/fire_alarm = new()
/var/global/datum/alarm_handler/motion/motion_alarm = new()
/var/global/datum/alarm_handler/power/power_alarm = new()
GLOBAL_DATUM_INIT(atmosphere_alarm, /datum/alarm_handler/atmosphere, new)
GLOBAL_DATUM_INIT(camera_alarm, /datum/alarm_handler/camera, new)
GLOBAL_DATUM_INIT(fire_alarm, /datum/alarm_handler/fire, new)
GLOBAL_DATUM_INIT(motion_alarm, /datum/alarm_handler/motion, new)
GLOBAL_DATUM_INIT(power_alarm, /datum/alarm_handler/power, new)

SUBSYSTEM_DEF(alarms)
name = "Alarms"
Expand All @@ -16,7 +16,7 @@ SUBSYSTEM_DEF(alarms)
var/static/list/active_alarm_cache = list()

/datum/controller/subsystem/alarms/Initialize()
SSalarms.all_handlers = list(atmosphere_alarm, camera_alarm, fire_alarm, motion_alarm, power_alarm)
SSalarms.all_handlers = list(GLOB.atmosphere_alarm, GLOB.camera_alarm, GLOB.fire_alarm, GLOB.motion_alarm, GLOB.power_alarm)
. = ..()

/datum/controller/subsystem/alarms/fire(resumed = FALSE)
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/plants.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SUBSYSTEM_DEF(plants)
*/
/datum/controller/subsystem/plants/proc/setup()
//Build the icon lists.
for(var/icostate in icon_states('icons/obj/hydroponics_growing.dmi'))
for(var/icostate in fast_icon_states('icons/obj/hydroponics_growing.dmi'))
var/split = findtext(icostate,"-")
if(!split)
//Invalid icon_state
Expand All @@ -60,7 +60,7 @@ SUBSYSTEM_DEF(plants)
if(!(plant_sprites[base]) || (plant_sprites[base]<ikey))
plant_sprites[base] = ikey

for(var/icostate in icon_states('icons/obj/hydroponics_products.dmi'))
for(var/icostate in fast_icon_states('icons/obj/hydroponics_products.dmi'))
var/split = findtext(icostate,"-")
if(split)
plant_product_sprites |= copytext(icostate,1,split)
Expand Down
95 changes: 0 additions & 95 deletions code/datums/components/archaeology.dm

This file was deleted.

40 changes: 0 additions & 40 deletions code/datums/components/art.dm

This file was deleted.

45 changes: 0 additions & 45 deletions code/datums/components/bane.dm

This file was deleted.

60 changes: 0 additions & 60 deletions code/datums/components/beetlejuice.dm

This file was deleted.

Loading