graffiti_paint_job 
A spray can painting a saved piece onto a wall, a floor or a full-tile window over time: a do_after while each layer appears in turn from the bottom, left to right in strips, the surface recomposited at each step. The can is charged once, as the piece's paint first shows. Stopping leaves the paint revealed so far, and puts the piece in the painter's Unfinished slot, ready to resume on that surface, unless a pane loosened under it, which drops the piece's paint whole.
The steps are costly work that SScustom_sprite_work runs within its overrun budget, as it runs the editors' composites, so under load they come late rather than at their time; the finish shows the whole piece when the do_after ends.
Make one, then start() it. A player runs one at a time, kept in SSgraffiti.paint_jobs while it runs.
Vars | |
| can | The spray can painting. |
|---|---|
| layer_records | Each layer of the piece decoded by graffiti_layer_records(), once, so that the steps only merge them. |
| paid | Whether the can has paid for the piece: once its paint has shown, this job's or the stopped job's it resumes. |
| piece | The canonical piece painted, the job's own copy. |
| piece_id | The library piece painted, or "unfinished" for the Unfinished slot's piece. |
| placement | The piece's placement on the surface, packed as SSgraffiti keeps it, or null until its art has paint. The left half of a two-tile piece. |
| placement2 | The right half's placement of a two-tile piece, packed, or null. |
| reveal | list("progress" = strips revealed, "due" = strips the step timer has reached, which the next step reveals, "total" = strips in the piece, "per_step" = strips each tick of the step timer adds, "delay" = time between the ticks, "duration" = the do_after's time from where the job starts, before do_after applies the painter's action speed). |
| spray_cooldown | When the last spray sound ends. |
| step_timer | The timer whose ticks make the next strips due. |
| surface | The wall, floor or window tile painted: the left tile of a two-tile piece. |
| user | The painter. |
Procs | |
| New | Sets a job up, continuing a stopped one where resume is for this surface and the paint it left is still there,
which paid for the piece. |
| advance | The step timer's tick: the next strips are due, and the job asks SScustom_sprite_work to reveal them as costly work. Ticks that come while a step waits for the subsystem's overrun budget add their strips to it. The last strip waits for finish(), so a job stopped early never shows the whole piece; the tick that reaches it stops the timer. |
| await | Waits out the job in a do_after on the surface, then finishes it, or stops it when the painter couldn't keep at it. |
| charge | Charges the can for the piece once, never refused, as its paint first shows, so a job stopped short of its last strip pays too. |
| costly_work_due | A step that is due merges the revealed layers and recomposites the surface: costly work, which waits for its turn among every painter's composites (SSgraffiti's composite_turn()). |
| credit_surface | Marks each tile the finished piece is on as the painter's work (graffiti_credit_painter()). |
| finish | Completes the job: the whole piece on the surface, the can charged unless it has paid (charge()), each tile's graffiti counted as the painter's art and the painter given the graffiti achievement. A piece painted from the Unfinished slot leaves it. |
| interrupt | Stops the job, leaving the paint revealed so far. The piece goes in the painter's Unfinished slot, with where to resume it while that paint is still on the surface. A pane loosened under the piece drops all of the paint revealed, both halves of a two-tile piece, and the piece goes in the slot with nowhere to resume. |
| owner_ckey | Returns the account the job paints for, which keeps its placements and its Unfinished piece even when the painter's body loses its player. |
| paint | Shows the piece on its tiles as far as progress reveals it: new art for each tile's placement, or, once a tile's art
has paint, a new placement on top of its stack. Its time counts against every painter's composites
(SSgraffiti's spend_composite()). The halves of a two-tile piece share one placement id. The first step whose paint
shows charges the can (charge()). A step whose paint took the painter's own oldest pieces past their caps says so
once, even one that stops the job. |
| piece_records | Returns the piece's layers decoded, once, for the steps to merge. |
| release_surface | Lets go of the surface as the job ends: its tiles' decals let go of their merges. |
| run_deferred_work | Reveals the strips that are due on the surface, with the spray sound. A step that has to wait for the overrun budget waits in SScustom_sprite_work's queue before this runs. Each step counts as one of the painter's composites for the round, as a freehand session's do. |
| start | Starts painting: the can shakes, the strips start appearing and the do_after runs. Nothing is placed before a strip with paint shows, and a resumed job goes on with the placements it left. |
| still_valid | Whether the painter can keep painting: holding the uncapped can and able to use it, with the surface, both tiles of a two-tile piece and of one kind, still taking graffiti and the paint revealed so far still on it. |
| stopped_resume | Returns where a stopped piece resumes: on its tiles while the paint revealed so far is still there. A pane loosened under the piece drops all of that paint, both halves of a two-tile piece, and it resumes nowhere. |
| surface_valid | Whether the surface still takes the job's paint: both tiles of a two-tile piece and of one kind, still taking graffiti, with the paint revealed so far still on them. |
| tile_arts | Returns the art of each of the piece's tiles as far as progress reveals it. |
Var Details
can 
The spray can painting.
layer_records 
Each layer of the piece decoded by graffiti_layer_records(), once, so that the steps only merge them.
paid 
Whether the can has paid for the piece: once its paint has shown, this job's or the stopped job's it resumes.
piece 
The canonical piece painted, the job's own copy.
piece_id 
The library piece painted, or "unfinished" for the Unfinished slot's piece.
placement 
The piece's placement on the surface, packed as SSgraffiti keeps it, or null until its art has paint. The left half of a two-tile piece.
placement2 
The right half's placement of a two-tile piece, packed, or null.
reveal 
list("progress" = strips revealed, "due" = strips the step timer has reached, which the next step reveals, "total" = strips in the piece, "per_step" = strips each tick of the step timer adds, "delay" = time between the ticks, "duration" = the do_after's time from where the job starts, before do_after applies the painter's action speed).
spray_cooldown 
When the last spray sound ends.
step_timer 
The timer whose ticks make the next strips due.
surface 
The wall, floor or window tile painted: the left tile of a two-tile piece.
user 
The painter.
Proc Details
New
Sets a job up, continuing a stopped one where resume is for this surface and the paint it left is still there,
which paid for the piece.
The job takes GRAFFITI_REVEAL_BASE plus GRAFFITI_REVEAL_PER_PIXEL for each painted pixel, half that for taggers, at the painter's action speed as its do_after does. Its steps come about every GRAFFITI_REVEAL_MIN_STEP at most, a quick piece revealing several strips a step, and spread over the whole job. A resumed job takes what is left of that.
Arguments:
- user: The painter.
- can: The spray can, in the painter's hand.
- surface: The wall, floor or window tile, the left tile of a two-tile piece.
- piece: A copy of the canonical piece to paint.
- resume: The Unfinished slot's resume data, or null.
- piece_id: The library piece painted, or "unfinished" for the Unfinished slot's piece.
advance
The step timer's tick: the next strips are due, and the job asks SScustom_sprite_work to reveal them as costly work. Ticks that come while a step waits for the subsystem's overrun budget add their strips to it. The last strip waits for finish(), so a job stopped early never shows the whole piece; the tick that reaches it stops the timer.
await
Waits out the job in a do_after on the surface, then finishes it, or stops it when the painter couldn't keep at it.
charge
Charges the can for the piece once, never refused, as its paint first shows, so a job stopped short of its last strip pays too.
costly_work_due
A step that is due merges the revealed layers and recomposites the surface: costly work, which waits for its turn among every painter's composites (SSgraffiti's composite_turn()).
credit_surface
Marks each tile the finished piece is on as the painter's work (graffiti_credit_painter()).
finish
Completes the job: the whole piece on the surface, the can charged unless it has paid (charge()), each tile's graffiti counted as the painter's art and the painter given the graffiti achievement. A piece painted from the Unfinished slot leaves it.
interrupt
Stops the job, leaving the paint revealed so far. The piece goes in the painter's Unfinished slot, with where to resume it while that paint is still on the surface. A pane loosened under the piece drops all of the paint revealed, both halves of a two-tile piece, and the piece goes in the slot with nowhere to resume.
Arguments:
- keep: Whether the piece goes in the Unfinished slot. An admin deleting its paint stops the job with nothing kept.
owner_ckey
Returns the account the job paints for, which keeps its placements and its Unfinished piece even when the painter's body loses its player.
Returns:
- text: The ckey the job runs under in SSgraffiti.paint_jobs, or the painter's before it starts.
paint
Shows the piece on its tiles as far as progress reveals it: new art for each tile's placement, or, once a tile's art
has paint, a new placement on top of its stack. Its time counts against every painter's composites
(SSgraffiti's spend_composite()). The halves of a two-tile piece share one placement id. The first step whose paint
shows charges the can (charge()). A step whose paint took the painter's own oldest pieces past their caps says so
once, even one that stops the job.
Arguments:
- progress: Strips revealed, at least 1.
Returns:
- TRUE/FALSE: FALSE when a placement is gone or the surface refused the paint, which stops the job.
piece_records
Returns the piece's layers decoded, once, for the steps to merge.
Arguments:
- piece: The canonical piece.
Returns:
- list: graffiti_layer_records() of the piece.
release_surface
Lets go of the surface as the job ends: its tiles' decals let go of their merges.
run_deferred_work
Reveals the strips that are due on the surface, with the spray sound. A step that has to wait for the overrun budget waits in SScustom_sprite_work's queue before this runs. Each step counts as one of the painter's composites for the round, as a freehand session's do.
Returns:
- TRUE/FALSE: FALSE while the step waits for its turn among every painter's composites, so it stays queued.
start
Starts painting: the can shakes, the strips start appearing and the do_after runs. Nothing is placed before a strip with paint shows, and a resumed job goes on with the placements it left.
Returns:
- TRUE/FALSE: Whether the job started. It doesn't while the painter has another running, or when a two-tile piece has no surface to the right.
still_valid
Whether the painter can keep painting: holding the uncapped can and able to use it, with the surface, both tiles of a two-tile piece and of one kind, still taking graffiti and the paint revealed so far still on it.
Returns:
- TRUE/FALSE
stopped_resume
Returns where a stopped piece resumes: on its tiles while the paint revealed so far is still there. A pane loosened under the piece drops all of that paint, both halves of a two-tile piece, and it resumes nowhere.
Returns:
- list: The Unfinished slot's resume data.
- null: It resumes nowhere, and starts over wherever it is next painted.
surface_valid
Whether the surface still takes the job's paint: both tiles of a two-tile piece and of one kind, still taking graffiti, with the paint revealed so far still on them.
Returns:
- TRUE/FALSE
tile_arts
Returns the art of each of the piece's tiles as far as progress reveals it.
Arguments:
- progress: Strips revealed, at least 1.
- decoded_out: When given, filled with each tile's art decoded, in the same order.
Returns:
- list: The left tile's art, then for a two-tile piece the right tile's.