mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
Some missed mirrors (#13415)
* Refactors firestacks into status effects (#66573) This PR refactors firestacks into two status effects: fire_stacks, which behave like normal firestacks you have right now, and wet_stacks, which are your negative fire stacks right now. This allows for custom fires with custom behaviors and icons to be made. Some fire related is moved away from species(what the fuck was it even doing there) into these as well. Oh and I fixed the bug where monkeys on fire had a human fire overlay, why wasn't this fixed already, it's like ancient. Also changed some related proc names to be snake_case like everything should be. This allows for custom fire types with custom behaviours, like freezing freon fire or radioactive tritium fire. Removing vars from living and moving them to status effects for modularity is also good. Nothing to argue about since there's nothing player-facing * Hud Image Culling By Z Level: Theft edition (#65189) * makes hud images only apply by z level * makes some of the atom_hud procs have better names * fixes warning with the hud_user list and adds better documentation * better docs for hud_images * removes TODOs * docs for hud_list * adds support for linked z levels so mobs can see lower ones * fixes merge conflict and shittily makes only shocked airlocks get added * adds support for setting images in the hud as active and inactive * gets rid of unatomic spatial grid change * maybe i should actually try COMPILING my changes * fixes merge skew and makes it compile again * fixes huds refusing to remove from users who changed z level * improves z level and registration logic * fixes antag huds not appearing * Fixes antag huds not properly setting. We now use hud_list in init, so it needs to be set before the new call, not after. Not sure why the use of appearance key was split like this, but none else knows either so none can stop me * Ensures that hiding a basic appearance also hides the atom's active list too * Fixes antag huds going poof Ensures that remove_atom_from_hud will return false if the passed atom isn't managed by it This fixes antag huds disappearing randomly, since they assumed that if the parent call of remove_atom_from_hud returned true, we should delete ourselves. This is a safe assumption for them to make, since they should only ever have one atom. Does kinda bork if we call remove_atom_from_hud in a way that is unsure if the passed atom is actually in that list. We were forced into doing this by how atom huds use the qdeleting signal. * makes basic alternate_appearance's only update themselves when setting their hud image to active and makes them not add themselves to the global huds_by_category list * fixes mistake with hud_users list being set non associatively (bad) * as anything in bot path loops * Fixes merge skew problems * Makes bot paths non global This way they can show themselves to only the bot that "owns" them, ya feel me? * Fixes huds not showing up sometimes, cleans up some code Post Kapu's limb refactor, we were calling prepare_huds twice in a human init call chain. What was happening was this: call prepare_huds() // Human I gained a new hud image I set active hud icons to mirror it call prepare_huds() // Living I overwrote the new hud image I attempted to set active hud icons, which failed because it assumes this can never happen *cries* * Renames add_hud_to_atom to show_to My hope is this will make understanding hud code a bit easier, by tying the behavior to a "verb" more closely. Also renamed a few vars * remove_hud_from_mob -> hide_from * Nitpicks a few comments * Whoops/fuck/shit/damn it all/hhhhhhhhhhhh * Moves check down, improves stack trace a bit Co-authored-by: KylerAce <kylerlumpkin1@gmail.com> * small touch-up * this should do it Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: KylerAce <kylerlumpkin1@gmail.com>
This commit is contained in:
co-authored by
KylerAce
SmArtKar
LemonInTheDark
parent
cd45c0f943
commit
cca7f8ee4c
@@ -11,10 +11,10 @@ SUBSYSTEM_DEF(icon_smooth)
|
||||
var/list/deferred = list()
|
||||
|
||||
/datum/controller/subsystem/icon_smooth/fire()
|
||||
var/list/cached = smooth_queue
|
||||
while(length(cached))
|
||||
var/atom/smoothing_atom = cached[length(cached)]
|
||||
cached.len--
|
||||
var/list/smooth_queue_cache = smooth_queue
|
||||
while(length(smooth_queue_cache))
|
||||
var/atom/smoothing_atom = smooth_queue_cache[length(smooth_queue_cache)]
|
||||
smooth_queue_cache.len--
|
||||
if(QDELETED(smoothing_atom) || !(smoothing_atom.smoothing_flags & SMOOTH_QUEUED))
|
||||
continue
|
||||
if(smoothing_atom.flags_1 & INITIALIZED_1)
|
||||
@@ -24,10 +24,10 @@ SUBSYSTEM_DEF(icon_smooth)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
if (!cached.len)
|
||||
if (!length(smooth_queue_cache))
|
||||
if (deferred.len)
|
||||
smooth_queue = deferred
|
||||
deferred = cached
|
||||
deferred = smooth_queue_cache
|
||||
else
|
||||
can_fire = FALSE
|
||||
|
||||
@@ -49,8 +49,7 @@ SUBSYSTEM_DEF(icon_smooth)
|
||||
queue = blueprint_queue
|
||||
blueprint_queue = null
|
||||
|
||||
for(var/item in queue)
|
||||
var/atom/movable/movable_item = item
|
||||
for(var/atom/movable/movable_item as anything in queue)
|
||||
if(!isturf(movable_item.loc))
|
||||
continue
|
||||
var/turf/item_loc = movable_item.loc
|
||||
|
||||
@@ -40,6 +40,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
// Z-manager stuff
|
||||
var/station_start // should only be used for maploading-related tasks
|
||||
var/space_levels_so_far = 0
|
||||
///list of all the z level datums created representing the z levels in the world
|
||||
var/list/z_list
|
||||
var/datum/space_level/transit
|
||||
var/datum/space_level/empty_space
|
||||
|
||||
@@ -1,32 +1,6 @@
|
||||
///the subsystem creates this many [/mob/oranges_ear] mob instances during init. allocations that require more than this create more.
|
||||
#define NUMBER_OF_PREGENERATED_ORANGES_EARS 2500
|
||||
|
||||
// macros meant specifically to add/remove movables from the hearing_contents and client_contents lists of
|
||||
// /datum/spatial_grid_cell, when empty they become references to a single list in SSspatial_grid and when filled they become their own list
|
||||
// this is to save memory without making them lazylists as that slows down iteration through them
|
||||
#define GRID_CELL_ADD(cell_contents_list, movable_or_list) \
|
||||
if(!length(cell_contents_list)) { \
|
||||
cell_contents_list = list(); \
|
||||
cell_contents_list += movable_or_list; \
|
||||
} else { \
|
||||
cell_contents_list += movable_or_list; \
|
||||
};
|
||||
|
||||
#define GRID_CELL_SET(cell_contents_list, movable_or_list) \
|
||||
if(!length(cell_contents_list)) { \
|
||||
cell_contents_list = list(); \
|
||||
cell_contents_list += movable_or_list; \
|
||||
} else { \
|
||||
cell_contents_list |= movable_or_list; \
|
||||
};
|
||||
|
||||
//dont use these outside of SSspatial_grid's scope use the procs it has for this purpose
|
||||
#define GRID_CELL_REMOVE(cell_contents_list, movable_or_list) \
|
||||
cell_contents_list -= movable_or_list; \
|
||||
if(!length(cell_contents_list)) {\
|
||||
cell_contents_list = dummy_list; \
|
||||
};
|
||||
|
||||
/**
|
||||
* # Spatial Grid Cell
|
||||
*
|
||||
@@ -64,7 +38,6 @@
|
||||
if(length(dummy_list))
|
||||
dummy_list.Cut()
|
||||
stack_trace("SSspatial_grid.dummy_list had something inserted into it at some point! this is a problem as it is supposed to stay empty")
|
||||
|
||||
hearing_contents = dummy_list
|
||||
client_contents = dummy_list
|
||||
|
||||
@@ -296,6 +269,7 @@ SUBSYSTEM_DEF(spatial_grid)
|
||||
|
||||
//technically THIS list only contains lists, but inside those lists are grid cell datums and we can go without a SINGLE var init if we do this
|
||||
var/list/datum/spatial_grid_cell/grid_level = grids_by_z_level[center_turf.z]
|
||||
|
||||
switch(type)
|
||||
if(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS)
|
||||
for(var/row in BOUNDING_BOX_MIN(center_y) to BOUNDING_BOX_MAX(center_y, cells_on_y_axis))
|
||||
@@ -363,15 +337,15 @@ SUBSYSTEM_DEF(spatial_grid)
|
||||
|
||||
var/datum/spatial_grid_cell/intersecting_cell = grids_by_z_level[z_index][y_index][x_index]
|
||||
|
||||
if(new_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
|
||||
if(new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
|
||||
GRID_CELL_SET(intersecting_cell.client_contents, new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
|
||||
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(RECURSIVE_CONTENTS_CLIENT_MOBS), new_target)
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS), new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
|
||||
|
||||
if(new_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
|
||||
GRID_CELL_SET(intersecting_cell.hearing_contents, new_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
|
||||
if(new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
|
||||
GRID_CELL_SET(intersecting_cell.hearing_contents, new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
|
||||
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(RECURSIVE_CONTENTS_HEARING_SENSITIVE), new_target)
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(SPATIAL_GRID_CONTENTS_TYPE_HEARING), new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
|
||||
|
||||
/**
|
||||
* find the spatial map cell that target used to belong to, then subtract target's important_recusive_contents from it.
|
||||
@@ -385,35 +359,54 @@ SUBSYSTEM_DEF(spatial_grid)
|
||||
if(!initialized)
|
||||
return
|
||||
if(!target_turf || !old_target?.important_recursive_contents)
|
||||
CRASH("/datum/controller/subsystem/spatial_grid/proc/exit_cell() was given null arguments or a new_target without important_recursive_contents!")
|
||||
stack_trace("/datum/controller/subsystem/spatial_grid/proc/exit_cell() was given null arguments or a new_target without important_recursive_contents!")
|
||||
return FALSE
|
||||
|
||||
var/x_index = ROUND_UP(target_turf.x / SPATIAL_GRID_CELLSIZE)
|
||||
var/y_index = ROUND_UP(target_turf.y / SPATIAL_GRID_CELLSIZE)
|
||||
var/z_index = target_turf.z
|
||||
|
||||
var/list/grid = grids_by_z_level[z_index]
|
||||
var/datum/spatial_grid_cell/intersecting_cell = grid[y_index][x_index]
|
||||
var/datum/spatial_grid_cell/intersecting_cell = grids_by_z_level[z_index][y_index][x_index]
|
||||
var/list/old_target_contents = old_target.important_recursive_contents //cache for sanic speeds (lists are references anyways)
|
||||
|
||||
if(exclusive_type && old_target.important_recursive_contents[exclusive_type])
|
||||
switch(exclusive_type)
|
||||
if(RECURSIVE_CONTENTS_CLIENT_MOBS)
|
||||
GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
|
||||
if(old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
|
||||
GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
|
||||
|
||||
if(RECURSIVE_CONTENTS_HEARING_SENSITIVE)
|
||||
GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS), old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
|
||||
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(exclusive_type), old_target)
|
||||
return
|
||||
if(old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
|
||||
GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
|
||||
|
||||
if(old_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
|
||||
GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(SPATIAL_GRID_CONTENTS_TYPE_HEARING), old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
|
||||
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS), old_target)
|
||||
return TRUE
|
||||
|
||||
if(old_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
|
||||
GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
|
||||
///acts like exit_cell() but only removes the target from the specified type of grid cell contents list
|
||||
/datum/controller/subsystem/spatial_grid/proc/remove_single_contents_type(atom/movable/old_target, turf/target_turf, exclusive_type)
|
||||
if(!target_turf || !old_target?.important_recursive_contents || !exclusive_type)
|
||||
stack_trace("/datum/controller/subsystem/spatial_grid/proc/remove_single_contents_type() was given null arguments or a new_target without important_recursive_contents!")
|
||||
return FALSE
|
||||
|
||||
if(!old_target.important_recursive_contents[exclusive_type])
|
||||
return FALSE
|
||||
|
||||
var/x_index = ROUND_UP(target_turf.x / SPATIAL_GRID_CELLSIZE)
|
||||
var/y_index = ROUND_UP(target_turf.y / SPATIAL_GRID_CELLSIZE)
|
||||
var/z_index = target_turf.z
|
||||
|
||||
var/datum/spatial_grid_cell/intersecting_cell = grids_by_z_level[z_index][y_index][x_index]
|
||||
|
||||
switch(exclusive_type)
|
||||
if(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS)
|
||||
GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
|
||||
|
||||
if(SPATIAL_GRID_CONTENTS_TYPE_HEARING)
|
||||
GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
|
||||
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(exclusive_type), old_target)
|
||||
|
||||
return TRUE
|
||||
|
||||
SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(RECURSIVE_CONTENTS_HEARING_SENSITIVE), old_target)
|
||||
|
||||
///find the cell this movable is associated with and removes it from all lists
|
||||
/datum/controller/subsystem/spatial_grid/proc/force_remove_from_cell(atom/movable/to_remove, datum/spatial_grid_cell/input_cell)
|
||||
|
||||
Reference in New Issue
Block a user