dirt 
Vars | |
| human_template | The plain human template, kept for the round once built: underclothes coverage is judged on it (dirt_underclothes_on()). Admins can't edit it (vv_edit_var()). |
|---|---|
| mask_jobs | Mask jobs waiting, by request key: kept apart from masks, so newer asks can't drop one while it waits. Admins
can't edit it (vv_edit_var()). |
| masks | Masks by request key: /datum/dirt_masks, or FALSE when they can't be made. The newest DIRT_MASK_CACHE_SIZE are kept. Admins can't edit it (vv_edit_var()). |
| max_fire_cost | The longest a fire has taken this round, in ms: one piece can't be split. |
| metric_job | The job building human_template and measuring metrics, while it waits. |
| metrics | What dirt_metric() returns, once measured. Admins can't edit it (vv_edit_var()). |
| queue | Jobs waiting, oldest first. The first may be part made. |
| rasters | Each splat's rasters on a template and surface, by "template key|surface kind|zone:level:variant": one text of its /datum/dirt_pixels/proc/drawn() in each direction (fetch_direction()). Masks asked for again with one more splat rasterise only that one. Admins can't edit it (vv_edit_var()). |
| redraws | Bodies to draw again for finished masks, by weak reference -> DIRT_REDRAW_* flags. |
| serial | The last serial next_serial() gave. |
| sprite_facings | The directions sprites have pixels in (dirt_sprite_facings()), the newest DIRT_SPRITE_FACINGS. Admins can't edit it (vv_edit_var()). |
| sprite_reads | Whole sprite directions read (dirt_sprite_pixels()), the DIRT_SPRITE_READS read most lately. Admins can't edit it (vv_edit_var()). |
| template_jobs | Template jobs waiting, by template key. Admins can't edit it (vv_edit_var()). |
| templates | Built templates by key, or FALSE when one can't be. About 220 KB each, so only the DIRT_TEMPLATE_CACHE_SIZE asked for most lately are kept; one dropped is built again when masks on it are next asked for. A job holds its own template, so one dropped while the job waits is still drawn on, and taken back from the job when asked for meanwhile (held_template()). Admins can't edit it (vv_edit_var()). |
Procs | |
| Initialize | Builds the plain human template in the background from the start, so the first landing never waits for it. |
| Recover | Takes over the queue, the bodies waiting to be drawn again and the caches from the subsystem it replaces, and fires while any wait. |
| Shutdown | Drops the jobs still waiting, so nothing waits on them forever. |
| add | Queues a job. |
| finish_all | Makes every queued job now and draws the bodies waiting for them again, as masks made as they're asked for would have: for tests, and anything else that has to see mess drawn at once. In a round the queue's own pace keeps ticks short instead. |
| fire | Draws again the bodies left waiting by the last fire, then makes queued jobs in order while the tick has room, then draws again the bodies waiting for those. Each loop goes round at most once for each entry its list had when it began, so none can go round forever; what is added meanwhile waits for a later fire. Stops firing while there's nothing to do (add()). |
| held_template | Returns a built template a queued mask job holds, or null. |
| human_surface | Returns one direction of the plain human template, or null until that direction is built. |
| make_piece | Makes the next piece of a job. A piece that runtimes fails its job, so it can't hold up the jobs queued after it. |
| masks_for | Returns a request's masks, or null while they're made or when they can't be. Masks not made yet are queued, behind
their template and the measure if those aren't made either, and redraw_body is drawn again once they are; without
DIRT_MASKS_DEFERRED they're made now. |
| next_serial | Returns the next splat serial: the order splats landed in, across every body and item. |
| note_cost | Notes what a fire took, for max_fire_cost. |
| queue_human_template | Queues the plain human template, which metrics is measured from and human_template keeps, in the directions read:
south and east for the measure (dirt_metric_directions()), north and south for underclothes (dirt_zone_facing()). |
| redraw_later | Draws again on a body at the next fire, once whatever changed it this tick is done: several changes draw it once. |
| redraw_next | Draws again the body that has waited longest for its masks, if it's still around. |
| redraw_waiting | Draws again the bodies waiting for finished masks, longest waiting first, until the tick runs short. |
| run_now | Makes a job now, start to end, as finish_all() does. |
| stat_entry | Shows how many jobs wait, how many bodies wait to be drawn again, and the longest fire this round. |
| template_for | Returns the template built from a body's sprites, queueing it if it isn't built or queued yet; without DIRT_MASKS_DEFERRED it's built now. One the cache dropped that a queued job still holds goes back in the cache rather than being built a second time. |
| vv_edit_var | Refuses admin edits of the caches and the jobs waiting: a mask, template or measure edited by hand would be drawn for the rest of the round, and a list of jobs replaced would break masks_for() for the round. |
| work_on | Makes pieces of a job until it's done or, when yielding, until the tick runs short. A job that runs past its
most_pieces(), counted across every fire, is dropped as failed. |
Var Details
human_template 
The plain human template, kept for the round once built: underclothes coverage is judged on it (dirt_underclothes_on()). Admins can't edit it (vv_edit_var()).
mask_jobs 
Mask jobs waiting, by request key: kept apart from masks, so newer asks can't drop one while it waits. Admins
can't edit it (vv_edit_var()).
masks 
Masks by request key: /datum/dirt_masks, or FALSE when they can't be made. The newest DIRT_MASK_CACHE_SIZE are kept. Admins can't edit it (vv_edit_var()).
max_fire_cost 
The longest a fire has taken this round, in ms: one piece can't be split.
metric_job 
The job building human_template and measuring metrics, while it waits.
metrics 
What dirt_metric() returns, once measured. Admins can't edit it (vv_edit_var()).
queue 
Jobs waiting, oldest first. The first may be part made.
rasters 
Each splat's rasters on a template and surface, by "template key|surface kind|zone:level:variant": one text of its /datum/dirt_pixels/proc/drawn() in each direction (fetch_direction()). Masks asked for again with one more splat rasterise only that one. Admins can't edit it (vv_edit_var()).
redraws 
Bodies to draw again for finished masks, by weak reference -> DIRT_REDRAW_* flags.
serial 
The last serial next_serial() gave.
sprite_facings 
The directions sprites have pixels in (dirt_sprite_facings()), the newest DIRT_SPRITE_FACINGS. Admins can't edit it (vv_edit_var()).
sprite_reads 
Whole sprite directions read (dirt_sprite_pixels()), the DIRT_SPRITE_READS read most lately. Admins can't edit it (vv_edit_var()).
template_jobs 
Template jobs waiting, by template key. Admins can't edit it (vv_edit_var()).
templates 
Built templates by key, or FALSE when one can't be. About 220 KB each, so only the DIRT_TEMPLATE_CACHE_SIZE asked for most lately are kept; one dropped is built again when masks on it are next asked for. A job holds its own template, so one dropped while the job waits is still drawn on, and taken back from the job when asked for meanwhile (held_template()). Admins can't edit it (vv_edit_var()).
Proc Details
Initialize
Builds the plain human template in the background from the start, so the first landing never waits for it.
Recover
Takes over the queue, the bodies waiting to be drawn again and the caches from the subsystem it replaces, and fires while any wait.
Shutdown
Drops the jobs still waiting, so nothing waits on them forever.
add
Queues a job.
Arguments:
- job: The job.
finish_all
Makes every queued job now and draws the bodies waiting for them again, as masks made as they're asked for would have: for tests, and anything else that has to see mess drawn at once. In a round the queue's own pace keeps ticks short instead.
fire
Draws again the bodies left waiting by the last fire, then makes queued jobs in order while the tick has room, then draws again the bodies waiting for those. Each loop goes round at most once for each entry its list had when it began, so none can go round forever; what is added meanwhile waits for a later fire. Stops firing while there's nothing to do (add()).
held_template
Returns a built template a queued mask job holds, or null.
Arguments:
- key: The template's key.
human_surface
Returns one direction of the plain human template, or null until that direction is built.
Arguments:
- direction: The direction.
make_piece
Makes the next piece of a job. A piece that runtimes fails its job, so it can't hold up the jobs queued after it.
Arguments:
- job: The job.
Returns whether the job is done.
masks_for
Returns a request's masks, or null while they're made or when they can't be. Masks not made yet are queued, behind
their template and the measure if those aren't made either, and redraw_body is drawn again once they are; without
DIRT_MASKS_DEFERRED they're made now.
Arguments:
- request: What the masks are made from.
- redraw_body: The body drawing them, drawn again once they're made.
- redraw_flags: DIRT_REDRAW_* flags, what to draw again on it.
next_serial
Returns the next splat serial: the order splats landed in, across every body and item.
note_cost
Notes what a fire took, for max_fire_cost.
Arguments:
- started: TICK_USAGE when it began.
queue_human_template
Queues the plain human template, which metrics is measured from and human_template keeps, in the directions read:
south and east for the measure (dirt_metric_directions()), north and south for underclothes (dirt_zone_facing()).
redraw_later
Draws again on a body at the next fire, once whatever changed it this tick is done: several changes draw it once.
Arguments:
- body: The body.
- redraw_flags: DIRT_REDRAW_* flags, what to draw again.
redraw_next
Draws again the body that has waited longest for its masks, if it's still around.
redraw_waiting
Draws again the bodies waiting for finished masks, longest waiting first, until the tick runs short.
Returns TRUE if the tick ran short.
run_now
Makes a job now, start to end, as finish_all() does.
Arguments:
- job: The job.
stat_entry
Shows how many jobs wait, how many bodies wait to be drawn again, and the longest fire this round.
template_for
Returns the template built from a body's sprites, queueing it if it isn't built or queued yet; without DIRT_MASKS_DEFERRED it's built now. One the cache dropped that a queued job still holds goes back in the cache rather than being built a second time.
Arguments:
- zone_sources: The body's sprites, as dirt_zone_sources() returns them.
Returns:
- /datum/dirt_template: The template.
- /datum/dirt_template_job: The job building it, queued.
- FALSE: It can't be built.
vv_edit_var
Refuses admin edits of the caches and the jobs waiting: a mask, template or measure edited by hand would be drawn for the rest of the round, and a list of jobs replaced would break masks_for() for the round.
Arguments:
- var_name: The var.
- var_value: Its new value.
Returns:
- TRUE/FALSE: Whether the var was edited.
work_on
Makes pieces of a job until it's done or, when yielding, until the tick runs short. A job that runs past its
most_pieces(), counted across every fire, is dropped as failed.
Arguments:
- job: The job.
- yielding: Whether to stop when the tick runs short, as a fire does.
Returns whether the job is done.