Clean up subsystem Initialize(), require an explicit result returned, give a formal way to fail (for SSlua) (#69775)

* cleanup SS API, give SSlua a proper way to error out

* New SS_INIT_ system
This commit is contained in:
Tastyfish
2022-09-14 23:52:10 -04:00
committed by GitHub
parent b07cfcf129
commit 4733643f39
72 changed files with 229 additions and 155 deletions
@@ -102,12 +102,13 @@ SUBSYSTEM_DEF(spatial_grid)
///how many pregenerated /mob/oranges_ear instances currently exist. this should hopefully never exceed its starting value
var/number_of_oranges_ears = NUMBER_OF_PREGENERATED_ORANGES_EARS
/datum/controller/subsystem/spatial_grid/Initialize(start_timeofday)
. = ..()
/datum/controller/subsystem/spatial_grid/Initialize()
cells_on_x_axis = SPATIAL_GRID_CELLS_PER_SIDE(world.maxx)
cells_on_y_axis = SPATIAL_GRID_CELLS_PER_SIDE(world.maxy)
// enter_cell only runs if 'initialized'
initialized = TRUE
for(var/datum/space_level/z_level as anything in SSmapping.z_list)
propogate_spatial_grid_to_new_z(null, z_level)
CHECK_TICK
@@ -126,6 +127,7 @@ SUBSYSTEM_DEF(spatial_grid)
RegisterSignal(SSdcs, COMSIG_GLOB_NEW_Z, .proc/propogate_spatial_grid_to_new_z)
RegisterSignal(SSdcs, COMSIG_GLOB_EXPANDED_WORLD_BOUNDS, .proc/after_world_bounds_expanded)
return SS_INIT_SUCCESS
///add a movable to the pre init queue for whichever type is specified so that when the subsystem initializes they get added to the grid
/datum/controller/subsystem/spatial_grid/proc/enter_pre_init_queue(atom/movable/waiting_movable, type)