/tg/ Station 13 - Modules - TypesVar Details - Proc Details

cell_tracker

Spatial gridmap, cell tracking

This datum exists to make the large, repeated "everything in some range" pattern faster Rather then just refreshing against everything, we track all the cells in range of the passed in "window" This lets us do entered/left logic, and make ordinarially quite expensive logic much cheaper

Note: This system should not be used for things who have strict requirements about what is NOT in their processed entries It should instead only be used for logic that only really cares about limiting how much gets "entered" in any one call Because we apply this limitation, we can do things to make our code much less prone to unneeded work

Vars

inner_window_x_radiusThe height (y radius) of our inner window
inner_window_y_radiusThe width (x radius) of our inner window
outer_window_x_radiusThe height (y radius) of our outer window
outer_window_y_radiusThe width (x radius) of our outer window

Procs

NewAccepts a width and height to use for this tracker Also accepts the ratio to use between inner and outer window. Optional, defaults to 2
recalculate_cellsRecalculates our member list, returns a list in the form list(new members, old members) for reaction Accepts the turf to use as our "center"
recalculate_type_membersReturns a list of newly and formerly joined spatial grid managed objects of type [type] in the form list(new, old) Takes the center of our window as input
set_boundsTakes a width and height, and uses them to set the inner window, and interpolate the outer window

Var Details

inner_window_x_radius

The height (y radius) of our inner window

inner_window_y_radius

The width (x radius) of our inner window

outer_window_x_radius

The height (y radius) of our outer window

outer_window_y_radius

The width (x radius) of our outer window

Proc Details

New

Accepts a width and height to use for this tracker Also accepts the ratio to use between inner and outer window. Optional, defaults to 2

recalculate_cells

Recalculates our member list, returns a list in the form list(new members, old members) for reaction Accepts the turf to use as our "center"

recalculate_type_members

Returns a list of newly and formerly joined spatial grid managed objects of type [type] in the form list(new, old) Takes the center of our window as input

set_bounds

Takes a width and height, and uses them to set the inner window, and interpolate the outer window