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

[PORT TG] PORTS IMPORTANT RECURSIVE CONTENT AND SPATIAL GRID. FINAL ATTEMPT #22810

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6eaf096
Another byond min max update
wonderinghost Feb 26, 2024
93c1f55
wat
wonderinghost Apr 6, 2024
7b50998
Merge branch 'master' of https://github.com/wonderinghost/Yogstation
wonderinghost Apr 6, 2024
f3a76b6
Merge branch 'master' of https://github.com/wonderinghost/Yogstation
wonderinghost Apr 6, 2024
37f15c8
Merge branch 'master' of https://github.com/wonderinghost/Yogstation
wonderinghost Jul 7, 2024
a9d4b35
Merge branch 'master' of https://github.com/wonderinghost/Yogstation
wonderinghost Sep 9, 2024
8fae2c2
Merge branch 'master' of https://github.com/wonderinghost/Yogstation
wonderinghost Sep 9, 2024
a8b1798
Merge branch 'master' of https://github.com/wonderinghost/Yogstation
wonderinghost Sep 21, 2024
565f461
Merge branch 'yogstation13:master' into the_spatial_grid
wonderinghost Oct 27, 2024
49f10c1
atoms_movable (spatial)
wonderinghost Nov 5, 2024
e0eecc2
atoms_movable (spatial) + recursive implement
wonderinghost Nov 6, 2024
54c6e39
Merge branch 'the_spatial_grid' of https://github.com/wonderinghost/Y…
wonderinghost Nov 6, 2024
c8b4ff6
radio magic
wonderinghost Nov 16, 2024
30dca83
almost set
wonderinghost Nov 17, 2024
6de763c
Merge branch 'yogstation13:master' into the_spatial_grid
wonderinghost Nov 17, 2024
1f756a7
less muck
wonderinghost Nov 18, 2024
b878dc7
shouldnt be mad
wonderinghost Nov 18, 2024
bbb54c0
weird runtime
wonderinghost Nov 18, 2024
f44246c
shell city
wonderinghost Nov 18, 2024
63d7ea3
please let it not runtime
wonderinghost Nov 18, 2024
a49f618
lints fixed
wonderinghost Nov 18, 2024
e94cba9
strange
wonderinghost Nov 18, 2024
3dc3e1e
w
wonderinghost Nov 18, 2024
9f2b7f4
wa
wonderinghost Nov 18, 2024
3b38a4a
waz
wonderinghost Nov 18, 2024
cce08ca
lints stuff
wonderinghost Nov 18, 2024
dac7aa9
checking if clears runtime
wonderinghost Nov 19, 2024
d029f93
fixed?
wonderinghost Nov 19, 2024
2b396c5
does this clear?
wonderinghost Nov 20, 2024
7cf3537
hmm
wonderinghost Nov 20, 2024
8243a86
hmm
wonderinghost Nov 20, 2024
79ff61b
fixes borg radio
wonderinghost Nov 22, 2024
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
15 changes: 15 additions & 0 deletions code/__DEFINES/_helpers.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Stuff that is relatively "core" and is used in other defines/helpers

/**
* The game's world.icon_size. \
* Ideally divisible by 16. \
* Ideally a number, but it
* can be a string ("32x32"), so more exotic coders
* will be sad if you use this in math.
*/
#define ICON_SIZE_ALL 32
/// The X/Width dimension of ICON_SIZE. This will more than likely be the bigger axis.
#define ICON_SIZE_X 32
/// The Y/Height dimension of ICON_SIZE. This will more than likely be the smaller axis.
#define ICON_SIZE_Y 32

/// Takes a datum as input, returns its ref string
#define text_ref(datum) ref(datum)

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/dcs/signals/signals_global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@
#define COMSIG_DARKSPAWN_ASCENSION "!darkspawn_ascension"
/// Global signal sent when the backrooms finishes initailizing: (No arguments)
#define COMSIG_BACKROOMS_INITIALIZE "!backrooms_initialize"

6 changes: 6 additions & 0 deletions code/__DEFINES/dcs/signals/signals_spatial_grid.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//spatial grid signals

///Called from base of /datum/controller/subsystem/spatial_grid/proc/enter_cell: (/atom/movable)
#define SPATIAL_GRID_CELL_ENTERED(contents_type) "spatial_grid_cell_entered_[contents_type]"
///Called from base of /datum/controller/subsystem/spatial_grid/proc/exit_cell: (/atom/movable)
#define SPATIAL_GRID_CELL_EXITED(contents_type) "spatial_grid_cell_exited_[contents_type]"
36 changes: 17 additions & 19 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,45 +28,43 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204

/// item has priority to check when entering or leaving
#define ON_BORDER_1 (1<<1)
/// This flag is what recursive_hear_check() uses to determine wether to add an item to the hearer list or not.
#define HEAR_1 (1<<2)
/// Projectiels will check ricochet on things impacted that have this.
#define CHECK_RICOCHET_1 (1<<3)
#define CHECK_RICOCHET_1 (1<<2)
///specifies that this atom is a hologram that isnt real
#define HOLOGRAM_1 (1<<4)
#define HOLOGRAM_1 (1<<3)
///Whether /atom/Initialize(mapload) has already run for the object
#define INITIALIZED_1 (1<<5)
#define INITIALIZED_1 (1<<4)
/// was this spawned by an admin? used for stat tracking stuff.
#define ADMIN_SPAWNED_1 (1<<6)
#define ADMIN_SPAWNED_1 (1<<5)
/// For machines and structures that should not break into parts, eg, holodeck stuff
#define NODECONSTRUCT_1 (1<<7)
#define NODECONSTRUCT_1 (1<<6)
/// Prevent clicking things below it on the same turf eg. doors/ fulltile windows
#define PREVENT_CLICK_UNDER_1 (1<<9)
#define PREVENT_CLICK_UNDER_1 (1<<7)
/// Can players recolor this in-game via vendors (and maybe more if support is added)?
#define IS_PLAYER_COLORABLE_1 (1<<10)
#define IS_PLAYER_COLORABLE_1 (1<<8)
/// TESLA_IGNORE grants immunity from being targeted by tesla-style electricity
#define TESLA_IGNORE_1 (1<<11)
#define TESLA_IGNORE_1 (1<<9)
/// If a turf can be made dirty at roundstart. This is also used in areas.
#define CAN_BE_DIRTY_1 (1<<12)
#define CAN_BE_DIRTY_1 (1<<10)
/// Should we use the initial icon for display? Mostly used by overlay only objects
#define HTML_USE_INITAL_ICON_1 (1<<13)
#define HTML_USE_INITAL_ICON_1 (1<<11)
/// conducts electricity (metal etc.)
#define CONDUCT_1 (1<<14)
#define CONDUCT_1 (1<<12)
/// should not get harmed if this gets caught by an explosion?
#define PREVENT_CONTENTS_EXPLOSION_1 (1<<15)
#define PREVENT_CONTENTS_EXPLOSION_1 (1<<13)
/// should the contents of this atom be acted upon
#define RAD_PROTECT_CONTENTS_1 (1<<16)
#define RAD_PROTECT_CONTENTS_1 (1<<14)
/// should this object be allowed to be contaminated
#define RAD_NO_CONTAMINATE_1 (1<<17)
#define RAD_NO_CONTAMINATE_1 (1<<15)
/// Prevents most radiation on this turf from leaving it
#define RAD_CONTAIN_CONTENTS (1<<18)
#define RAD_CONTAIN_CONTENTS (1<<16)
/// Is the thing currently spinning?
#define IS_SPINNING_1 (1<<19)
#define IS_SPINNING_1 (1<<17)
/// If this atom has experienced a decal element "init finished" sourced appearance update
/// We use this to ensure stacked decals don't double up appearance updates for no rasin
/// Flag as an optimization, don't make this a trait without profiling
/// Yes I know this is a stupid flag, no you can't take him from me
#define DECAL_INIT_UPDATE_EXPERIENCED_1 (1<<20)
#define DECAL_INIT_UPDATE_EXPERIENCED_1 (1<<18)

//TURF FLAGS
/// If a turf cant be jaunted through.
Expand Down
9 changes: 9 additions & 0 deletions code/__DEFINES/important_recursive_contents.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
///the area channel of the important_recursive_contents list, everything in here will be sent a signal when their last holding object changes areas
#define RECURSIVE_CONTENTS_AREA_SENSITIVE "recursive_contents_area_sensitive"
///the hearing channel of the important_recursive_contents list, everything in here will count as a hearing atom
#define RECURSIVE_CONTENTS_HEARING_SENSITIVE "recursive_contents_hearing_sensitive"
///the client mobs channel of the important_recursive_contents list, everything in here will be a mob with an attached client
///this is given to both a clients mob, and a clients eye, both point to the clients mob
#define RECURSIVE_CONTENTS_CLIENT_MOBS "recursive_contents_client_mobs"
///the parent of storage components currently shown to some client mob get this. gets removed when nothing is viewing the parent
#define RECURSIVE_CONTENTS_ACTIVE_STORAGE "recursive_contents_active_storage"
17 changes: 17 additions & 0 deletions code/__DEFINES/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,20 @@
#define REQ_DEP_TYPE_ASSISTANCE (1<<0)
#define REQ_DEP_TYPE_SUPPLIES (1<<1)
#define REQ_DEP_TYPE_INFORMATION (1<<2)

///give this to can_receive to specify that there is no restriction on what z level this signal is sent to
#define RADIO_NO_Z_LEVEL_RESTRICTION 0

/// Radio frequency is unlocked and can be ajusted by anyone
#define RADIO_FREQENCY_UNLOCKED 0
/// Radio frequency is locked, unchangeable by players
#define RADIO_FREQENCY_LOCKED 1
/// Radio frequency is locked and unchangeable, but can be unlocked by an emag
#define RADIO_FREQENCY_EMAGGABLE_LOCK 2

///Bitflag for if a headset can use the syndicate radio channel
#define RADIO_SPECIAL_SYNDIE (1<<0)
///Bitflag for if a headset can use the centcom radio channel
#define RADIO_SPECIAL_CENTCOM (1<<1)
///Bitflag for if a headset can use the binary radio channel
#define RADIO_SPECIAL_BINARY (1<<2)
55 changes: 55 additions & 0 deletions code/__DEFINES/spatial_gridmap.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/// each cell in a spatial_grid is this many turfs in length and width (with world.max(x or y) being 255, 15 of these fit on each side of a z level)
#define SPATIAL_GRID_CELLSIZE 17
/// Takes a coordinate, and spits out the spatial grid index (x or y) it's inside
#define GET_SPATIAL_INDEX(coord) ROUND_UP((coord) / SPATIAL_GRID_CELLSIZE)
/// changes the cell_(x or y) vars on /datum/spatial_grid_cell to the x or y coordinate on the map for the LOWER LEFT CORNER of the grid cell.
/// index is from 1 to SPATIAL_GRID_CELLS_PER_SIDE
#define GRID_INDEX_TO_COORDS(index) ((((index) - 1) * SPATIAL_GRID_CELLSIZE) + 1)
/// number of grid cells per x or y side of all z levels. pass in world.maxx or world.maxy
#define SPATIAL_GRID_CELLS_PER_SIDE(world_bounds) GET_SPATIAL_INDEX(world_bounds)

//grid contents channels

///everything that is hearing sensitive is stored in this channel
#define SPATIAL_GRID_CONTENTS_TYPE_HEARING RECURSIVE_CONTENTS_HEARING_SENSITIVE
///every movable that has a client in it is stored in this channel
#define SPATIAL_GRID_CONTENTS_TYPE_CLIENTS RECURSIVE_CONTENTS_CLIENT_MOBS
///all atmos machines are stored in this channel (I'm sorry kyler)
#define SPATIAL_GRID_CONTENTS_TYPE_ATMOS "spatial_grid_contents_type_atmos"

#define ALL_CONTENTS_OF_CELL(cell) (cell.hearing_contents | cell.client_contents | cell.atmos_contents)

///whether movable is itself or containing something which should be in one of the spatial grid channels.
#define HAS_SPATIAL_GRID_CONTENTS(movable) (movable.spatial_grid_key)

// macros meant specifically to add/remove movables from the internal 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; \
};

///remove from every list
#define GRID_CELL_REMOVE_ALL(cell, movable) \
GRID_CELL_REMOVE(cell.hearing_contents, movable) \
GRID_CELL_REMOVE(cell.client_contents, movable) \
GRID_CELL_REMOVE(cell.atmos_contents, movable)
3 changes: 2 additions & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
#define INIT_ORDER_INPUT 85
#define INIT_ORDER_SOUNDS 83
#define INIT_ORDER_INSTRUMENTS 82
#define INIT_ORDER_GREYSCALE 81
#define INIT_ORDER_GREYSCALE 81
#define INIT_ORDER_VIS 80
#define INIT_ORDER_SECURITY_LEVEL 79
#define INIT_ORDER_MATERIALS 76
Expand All @@ -149,6 +149,7 @@
#define INIT_ORDER_TICKER 55
#define INIT_ORDER_MAPPING 50
#define INIT_ORDER_EARLY_ASSETS 48
#define INIT_ORDER_SPATIAL_GRID 43
#define INIT_ORDER_ECONOMY 40
#define INIT_ORDER_OUTPUTS 35
#define INIT_ORDER_ATOMS 30
Expand Down
4 changes: 4 additions & 0 deletions code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
#define LAZYINITLIST(L) if (!L) { L = list(); }
///If the provided list is empty, set it to null
#define UNSETEMPTY(L) if (L && !length(L)) L = null
///If the provided key -> list is empty, remove it from the list
#define ASSOC_UNSETEMPTY(L, K) if (!length(L[K])) L -= K;
///Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled
#define LAZYLISTDUPLICATE(L) (L ? L.Copy() : null )
///Remove an item from the list, set the list to null if empty
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } }
///Add an item to the list, if the list is null it will initialize it
Expand Down
Loading
Loading