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

Remove data systems in favor of global datums #82943

Merged
merged 8 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/__DEFINES/dcs/signals/signals_reagent.dm
Expand Up @@ -19,8 +19,8 @@
///from base of [/datum/reagent/proc/expose_atom]: (/turf, reac_volume)
#define COMSIG_REAGENT_EXPOSE_TURF "reagent_expose_turf"

///from base of [/datum/system/materials/proc/InitializeMaterial]: (/datum/material)
#define COMSIG_MATERIALS_INIT_MAT "DSmaterials_init_mat"
///from base of [/datum/materials_controller/proc/InitializeMaterial]: (/datum/material)
#define COMSIG_MATERIALS_INIT_MAT "SSmaterials_init_mat"

///from base of [/datum/component/multiple_lives/proc/respawn]: (mob/respawned_mob, gibbed, lives_left)
#define COMSIG_ON_MULTIPLE_LIVES_RESPAWN "on_multiple_lives_respawn"
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/construction.dm
Expand Up @@ -2,7 +2,7 @@
#define OPTIMAL_COST(cost)(max(1, round(cost)))

/// Wrapper for fetching material references. Exists exclusively so that people don't need to wrap everything in a list every time.
#define GET_MATERIAL_REF(arguments...) DSmaterials._GetMaterialRef(list(##arguments))
#define GET_MATERIAL_REF(arguments...) SSmaterials._GetMaterialRef(list(##arguments))

// Wrapper to convert material name into its source name
#define MATERIAL_SOURCE(mat) "[mat.name]_material"
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/global_lists.dm
Expand Up @@ -139,8 +139,8 @@
GLOB.crafting_recipes += recipe

var/list/material_stack_recipes = list(
DSmaterials.base_stack_recipes,
DSmaterials.rigid_stack_recipes,
SSmaterials.base_stack_recipes,
SSmaterials.rigid_stack_recipes,
)

for(var/list/recipe_list in material_stack_recipes)
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/mobs.dm
Expand Up @@ -238,7 +238,7 @@ GLOBAL_LIST_EMPTY(species_list)
var/atom/target_loc = target?.loc

var/drifting = FALSE
if(DSmove_manager.processing_on(user, SSspacedrift))
if(GLOB.move_manager.processing_on(user, SSspacedrift))
drifting = TRUE

var/holding = user.get_active_held_item()
Expand Down Expand Up @@ -267,7 +267,7 @@ GLOBAL_LIST_EMPTY(species_list)
if(!QDELETED(progbar))
progbar.update(world.time - starttime)

if(drifting && !DSmove_manager.processing_on(user, SSspacedrift))
if(drifting && !GLOB.move_manager.processing_on(user, SSspacedrift))
drifting = FALSE
user_loc = user.loc

Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/priority_announce.dm
Expand Up @@ -107,7 +107,7 @@
message.title = title
message.content = text

DScommunications.send_message(message)
GLOB.communications_controller.send_message(message)

/**
* Sends a minor annoucement to players.
Expand Down
6 changes: 3 additions & 3 deletions code/controllers/subsystem/dynamic/dynamic.dm
Expand Up @@ -317,7 +317,7 @@ SUBSYSTEM_DEF(dynamic)
SSticker.news_report = SSshuttle.emergency?.is_hijacked() ? SHUTTLE_HIJACK : STATION_EVACUATED

/datum/controller/subsystem/dynamic/proc/send_intercept()
if(DScommunications.block_command_report) //If we don't want the report to be printed just yet, we put it off until it's ready
if(GLOB.communications_controller.block_command_report) //If we don't want the report to be printed just yet, we put it off until it's ready
addtimer(CALLBACK(src, PROC_REF(send_intercept)), 10 SECONDS)
return

Expand Down Expand Up @@ -349,10 +349,10 @@ SUBSYSTEM_DEF(dynamic)
if(trait_list_strings.len > 0)
. += "<hr><b>Identified shift divergencies:</b><BR>" + trait_list_strings.Join()

if(length(DScommunications.command_report_footnotes))
if(length(GLOB.communications_controller.command_report_footnotes))
var/footnote_pile = ""

for(var/datum/command_footnote/footnote in DScommunications.command_report_footnotes)
for(var/datum/command_footnote/footnote in GLOB.communications_controller.command_report_footnotes)
footnote_pile += "[footnote.message]<BR>"
footnote_pile += "<i>[footnote.signature]</i><BR>"
footnote_pile += "<BR>"
Expand Down
@@ -1,12 +1,12 @@
/*! How material datums work
Materials are now instanced datums, with an associative list of them being kept in DSmaterials. We only instance the materials once and then re-use these instances for everything.
Materials are now instanced datums, with an associative list of them being kept in SSmaterials. We only instance the materials once and then re-use these instances for everything.

These materials call on_applied() on whatever item they are applied to, common effects are adding components, changing color and changing description. This allows us to differentiate items based on the material they are made out of.area

*/

DATASYSTEM_DEF(materials)
SUBSYSTEM_DEF(materials)
name = "Materials"
flags = SS_NO_FIRE | SS_NO_INIT
///Dictionary of material.id || material ref
var/list/materials
///Dictionary of type || list of material refs
Expand Down Expand Up @@ -36,7 +36,7 @@ DATASYSTEM_DEF(materials)
var/list/datum/dimension_theme/dimensional_themes

///Ran on initialize, populated the materials and materials_by_category dictionaries with their appropiate vars (See these variables for more info)
/datum/system/materials/proc/InitializeMaterials()
/datum/controller/subsystem/materials/proc/InitializeMaterials()
materials = list()
materials_by_type = list()
materialids_by_type = list()
Expand All @@ -57,7 +57,7 @@ DATASYSTEM_DEF(materials)
* - [arguments][/list]: The arguments to use to create the material datum
* - The first element is the type of material to initialize.
*/
/datum/system/materials/proc/InitializeMaterial(list/arguments)
/datum/controller/subsystem/materials/proc/InitializeMaterial(list/arguments)
var/datum/material/mat_type = arguments[1]
if(initial(mat_type.init_flags) & MATERIAL_INIT_BESPOKE)
arguments[1] = GetIdFromArguments(arguments)
Expand Down Expand Up @@ -89,13 +89,13 @@ DATASYSTEM_DEF(materials)
* - If the material type is bespoke a text ID is generated from the arguments list and used to load a material datum from the cache.
* - The following elements are used to generate bespoke IDs
*/
/datum/system/materials/proc/_GetMaterialRef(list/arguments)
/datum/controller/subsystem/materials/proc/_GetMaterialRef(list/arguments)
if(!materials)
InitializeMaterials()

var/datum/material/key = arguments[1]
if(istype(key))
return key // We are assuming here that the only thing allowed to create material datums is [/datum/system/materials/proc/InitializeMaterial]
return key // We are assuming here that the only thing allowed to create material datums is [/datum/controller/subsystem/materials/proc/InitializeMaterial]

if(istext(key)) // Handle text id
. = materials[key]
Expand Down Expand Up @@ -123,7 +123,7 @@ DATASYSTEM_DEF(materials)
* Named arguments can appear in any order and we need them to appear after ordered arguments
* We assume that no one will pass in a named argument with a value of null
**/
/datum/system/materials/proc/GetIdFromArguments(list/arguments)
/datum/controller/subsystem/materials/proc/GetIdFromArguments(list/arguments)
var/datum/material/mattype = arguments[1]
var/list/fullid = list("[initial(mattype.id) || mattype]")
var/list/named_arguments = list()
Expand All @@ -149,7 +149,7 @@ DATASYSTEM_DEF(materials)


/// Returns a list to be used as an object's custom_materials. Lists will be cached and re-used based on the parameters.
/datum/system/materials/proc/FindOrCreateMaterialCombo(list/materials_declaration, multiplier)
/datum/controller/subsystem/materials/proc/FindOrCreateMaterialCombo(list/materials_declaration, multiplier)
if(!LAZYLEN(materials_declaration))
return null // If we get a null we pass it right back, we don't want to generate stack traces just because something is clearing out its materials list.

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/movement/cliff_falling.dm
Expand Up @@ -10,7 +10,7 @@ MOVEMENT_SUBSYSTEM_DEF(cliff_falling)

/datum/controller/subsystem/movement/cliff_falling/proc/start_falling(atom/movable/faller, turf/open/cliff/cliff)
// Make them move
var/mover = DSmove_manager.move(moving = faller, direction = cliff.fall_direction, delay = cliff.fall_speed, subsystem = src, priority = MOVEMENT_ABOVE_SPACE_PRIORITY, flags = MOVEMENT_LOOP_OUTSIDE_CONTROL | MOVEMENT_LOOP_NO_DIR_UPDATE)
var/mover = GLOB.move_manager.move(moving = faller, direction = cliff.fall_direction, delay = cliff.fall_speed, subsystem = src, priority = MOVEMENT_ABOVE_SPACE_PRIORITY, flags = MOVEMENT_LOOP_OUTSIDE_CONTROL | MOVEMENT_LOOP_NO_DIR_UPDATE)

cliff_grinders[faller] = mover

Expand Down
28 changes: 14 additions & 14 deletions code/controllers/subsystem/movement/movement_types.dm
Expand Up @@ -162,7 +162,7 @@
status &= ~MOVELOOP_STATUS_PAUSED

///Removes the atom from some movement subsystem. Defaults to SSmovement
/datum/system/move_manager/proc/stop_looping(atom/movable/moving, datum/controller/subsystem/movement/subsystem = SSmovement)
/datum/move_manager/proc/stop_looping(atom/movable/moving, datum/controller/subsystem/movement/subsystem = SSmovement)
var/datum/movement_packet/our_info = moving.move_packet
if(!our_info)
return FALSE
Expand All @@ -183,7 +183,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move(moving, direction, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move(moving, direction, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/move, priority, flags, extra_info, delay, timeout, direction)

///Replacement for walk()
Expand Down Expand Up @@ -224,7 +224,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/force_move_dir(moving, direction, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/force_move_dir(moving, direction, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/move/force, priority, flags, extra_info, delay, timeout, direction)

/datum/move_loop/move/force
Expand Down Expand Up @@ -281,7 +281,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/force_move(moving, chasing, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/force_move(moving, chasing, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/has_target/force_move, priority, flags, extra_info, delay, timeout, chasing)

///Used for force-move loops
Expand Down Expand Up @@ -315,7 +315,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/jps_move(moving,
/datum/move_manager/proc/jps_move(moving,
chasing,
delay,
timeout,
Expand Down Expand Up @@ -493,7 +493,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move_to(moving, chasing, min_dist, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move_to(moving, chasing, min_dist, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/has_target/dist_bound/move_to, priority, flags, extra_info, delay, timeout, chasing, min_dist)

///Wrapper around walk_to()
Expand Down Expand Up @@ -527,7 +527,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move_away(moving, chasing, max_dist, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move_away(moving, chasing, max_dist, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/has_target/dist_bound/move_away, priority, flags, extra_info, delay, timeout, chasing, max_dist)

///Wrapper around walk_away()
Expand Down Expand Up @@ -562,7 +562,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move_towards(moving, chasing, delay, home, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move_towards(moving, chasing, delay, home, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/has_target/move_towards, priority, flags, extra_info, delay, timeout, chasing, home)

/**
Expand All @@ -581,7 +581,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/home_onto(moving, chasing, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/home_onto(moving, chasing, delay, timeout, subsystem, priority, flags, datum/extra_info)
return move_towards(moving, chasing, delay, TRUE, timeout, subsystem, priority, flags, extra_info)

///Used as a alternative to walk_towards
Expand Down Expand Up @@ -717,7 +717,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move_towards_legacy(moving, chasing, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move_towards_legacy(moving, chasing, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/has_target/move_towards_budget, priority, flags, extra_info, delay, timeout, chasing)

///The actual implementation of walk_towards()
Expand All @@ -743,7 +743,7 @@
* priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*/
/datum/system/move_manager/proc/freeze(moving, halted_turf, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/freeze(moving, halted_turf, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/freeze, priority, flags, extra_info, delay, timeout, halted_turf)

/// As close as you can get to a "do-nothing" move loop, the pure intention of this is to absolutely resist all and any automated movement until the move loop times out.
Expand All @@ -767,7 +767,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move_rand(moving, directions, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move_rand(moving, directions, delay, timeout, subsystem, priority, flags, datum/extra_info)
if(!directions)
directions = GLOB.alldirs
return add_to_loop(moving, subsystem, /datum/move_loop/move_rand, priority, flags, extra_info, delay, timeout, directions)
Expand Down Expand Up @@ -819,7 +819,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move_to_rand(moving, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move_to_rand(moving, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/move_to_rand, priority, flags, extra_info, delay, timeout)

///Wrapper around step_rand
Expand All @@ -845,7 +845,7 @@
* flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm
*
**/
/datum/system/move_manager/proc/move_disposals(moving, delay, timeout, subsystem, priority, flags, datum/extra_info)
/datum/move_manager/proc/move_disposals(moving, delay, timeout, subsystem, priority, flags, datum/extra_info)
return add_to_loop(moving, subsystem, /datum/move_loop/disposal_holder, priority, flags, extra_info, delay, timeout)

/// Disposal holders need to move through a chain of pipes
Expand Down
1 change: 0 additions & 1 deletion code/controllers/subsystem/statpanel.dm
Expand Up @@ -168,7 +168,6 @@ SUBSYSTEM_DEF(statpanels)
list("World Time:", "[world.time]"),
list("Globals:", GLOB.stat_entry(), text_ref(GLOB)),
list("[config]:", config.stat_entry(), text_ref(config)),
list("Datasystem Manager:", "Edit", text_ref(SysMgr)),
list("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%)) (Internal Tick Usage: [round(MAPTICK_LAST_INTERNAL_TICK_USAGE,0.1)]%)"),
list("Master Controller:", Master.stat_entry(), text_ref(Master)),
list("Failsafe Controller:", Failsafe.stat_entry(), text_ref(Failsafe)),
Expand Down
6 changes: 3 additions & 3 deletions code/datums/actions/mobs/charge.dm
Expand Up @@ -44,7 +44,7 @@

if(charger in charging)
// Stop any existing charging, this'll clean things up properly
DSmove_manager.stop_looping(charger)
GLOB.move_manager.stop_looping(charger)

charging += charger
actively_moving = FALSE
Expand All @@ -60,7 +60,7 @@

var/time_to_hit = min(get_dist(charger, target), charge_distance) * charge_speed

var/datum/move_loop/new_loop = DSmove_manager.home_onto(charger, target, delay = charge_speed, timeout = time_to_hit, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
var/datum/move_loop/new_loop = GLOB.move_manager.home_onto(charger, target, delay = charge_speed, timeout = time_to_hit, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
if(!new_loop)
return
RegisterSignal(new_loop, COMSIG_MOVELOOP_PREPROCESS_CHECK, PROC_REF(pre_move), override = TRUE)
Expand Down Expand Up @@ -96,7 +96,7 @@
/datum/action/cooldown/mob_cooldown/charge/update_status_on_signal(mob/source, new_stat, old_stat)
. = ..()
if(new_stat == DEAD)
DSmove_manager.stop_looping(source) //This will cause the loop to qdel, triggering an end to our charging
GLOB.move_manager.stop_looping(source) //This will cause the loop to qdel, triggering an end to our charging

/datum/action/cooldown/mob_cooldown/charge/proc/do_charge_indicator(atom/charger, atom/charge_target)
var/turf/target_turf = get_turf(charge_target)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/_ai_controller.dm
Expand Up @@ -279,7 +279,7 @@ multiple modular subtrees with behaviors
/datum/ai_controller/process(seconds_per_tick)

if(!able_to_run())
DSmove_manager.stop_looping(pawn) //stop moving
GLOB.move_manager.stop_looping(pawn) //stop moving
return //this should remove them from processing in the future through event-based stuff.

if(!LAZYLEN(current_behaviors) && idle_behavior)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/ai/monkey/monkey_behaviors.dm
Expand Up @@ -120,7 +120,7 @@
break

if(target)
DSmove_manager.move_away(living_pawn, target, max_dist=MONKEY_ENEMY_VISION, delay=5)
GLOB.move_manager.move_away(living_pawn, target, max_dist=MONKEY_ENEMY_VISION, delay=5)
return AI_BEHAVIOR_DELAY
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED

Expand Down Expand Up @@ -161,7 +161,7 @@
controller.clear_blackboard_key(target_key)
if(QDELETED(living_pawn)) // pawn can be null at this point
return
DSmove_manager.stop_looping(living_pawn)
GLOB.move_manager.stop_looping(living_pawn)

/// attack using a held weapon otherwise bite the enemy, then if we are angry there is a chance we might calm down a little
/datum/ai_behavior/monkey_attack_mob/proc/monkey_attack(datum/ai_controller/controller, mob/living/target, seconds_per_tick, disarm)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/movement/_ai_movement.dm
Expand Up @@ -17,7 +17,7 @@
moving_controllers -= controller
// We got deleted as we finished an action
if(!QDELETED(controller.pawn))
DSmove_manager.stop_looping(controller.pawn, SSai_movement)
GLOB.move_manager.stop_looping(controller.pawn, SSai_movement)

/datum/ai_movement/proc/increment_pathing_failures(datum/ai_controller/controller)
controller.consecutive_pathing_attempts++
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/movement/ai_movement_basic_avoidance.dm
Expand Up @@ -9,7 +9,7 @@
var/atom/movable/moving = controller.pawn
var/min_dist = controller.blackboard[BB_CURRENT_MIN_MOVE_DISTANCE]
var/delay = controller.movement_delay
var/datum/move_loop/loop = DSmove_manager.move_to(moving, current_movement_target, min_dist, delay, flags = move_flags, subsystem = SSai_movement, extra_info = controller)
var/datum/move_loop/loop = GLOB.move_manager.move_to(moving, current_movement_target, min_dist, delay, flags = move_flags, subsystem = SSai_movement, extra_info = controller)
RegisterSignal(loop, COMSIG_MOVELOOP_PREPROCESS_CHECK, PROC_REF(pre_move))
RegisterSignal(loop, COMSIG_MOVELOOP_POSTPROCESS, PROC_REF(post_move))

Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/movement/ai_movement_complete_stop.dm
Expand Up @@ -8,7 +8,7 @@
var/stopping_time = controller.blackboard[BB_STATIONARY_SECONDS]
var/delay_time = (stopping_time * 0.5) // no real reason to fire any more often than this really
// assume that the current_movement_target is our location
var/datum/move_loop/loop = DSmove_manager.freeze(moving, current_movement_target, delay = delay_time, timeout = stopping_time, subsystem = SSai_movement, extra_info = controller)
var/datum/move_loop/loop = GLOB.move_manager.freeze(moving, current_movement_target, delay = delay_time, timeout = stopping_time, subsystem = SSai_movement, extra_info = controller)
RegisterSignal(loop, COMSIG_MOVELOOP_PREPROCESS_CHECK, PROC_REF(pre_move))

/datum/ai_movement/complete_stop/allowed_to_move(datum/move_loop/source)
Expand Down