spraycan 
Vars | |
| direct_color_types | Types which use their color var for additional logic, so we need to avoid using transition filters on them. |
|---|---|
| graffiti_armed | What a click on a wall, a floor, a full-tile window or a poster paints: null for the stencil, "freehand" for a live editor on it, "unfinished" for the Unfinished slot's piece, or a library piece's id. |
| graffiti_sent_revision | The graffiti library revision the window's static data last carried, or 0 while it carries none. |
| graffiti_tab | The window's tab: "stencils" or "graffiti". |
Procs | |
| examine | Adds what an armed can paints to its examine. Only its holder, whose library the armed piece is from, sees it named. |
| graffiti_armed_name | Returns the name of the piece the can is armed with, from the library of the player holding it. |
| graffiti_enabled | Whether the can paints custom graffiti: every spray can that paints, but not the hellcan, lubecan or mimecan. |
| graffiti_open_editor | Swaps the can's window for a graffiti editor, which reuses its place on screen. |
| graffiti_reopen | Opens the can's window on a tab, as a graffiti editor hands back to it. |
| ui_act | Handles the Custom Graffiti tab's actions, after the crayon's own. Picking a stencil also clears what the can was set to paint. |
| ui_data | Adds the can's graffiti state to the window's data. |
| ui_interact | Opens the window, or refreshes the open one. Opening it afresh clears what the can was set to paint. A refresh after the player's graffiti library changed sends the static data too, which carries the library, while its tab is open. |
| ui_static_data | Adds the player's graffiti library to the window's static data while the Custom Graffiti tab is open, and only then: 50 pieces' thumbnails take 40 KB as typical art and up to 1.5 MB as adversarial art, which a window open on the stencils would carry for nothing. It is sent again once the library changes or the tab opens. |
| use_on | Paints with an armed can. A click on an adjacent wall or floor, a full-tile window fastened down, or graffiti on one, on the static station (graffiti_static_station(), else "can't paint here!" and the can stays armed), opens a freehand session there, continues a freehand draft on its own tile, or starts a paint job of the armed piece. A session that starts uses the arming up, and a job keeps it. An Unfinished piece whose paint still shows goes on only there: a click on another surface is refused ("wrong wall!") and starts no cooldown. Each attempt waits out GRAFFITI_START_COOLDOWN from the last, refused or not, and is refused before any costly work: by an empty can, a paint job already running, or a two-tile piece without a surface like this one to the right. A two-tile piece that paints nothing on its right tile paints one tile. A click on a poster that isn't ripped paints over the poster itself, one painter at a time, and only on its own pixels; it takes no two-tile piece ("too wide!"), and nothing resumes there. A click on anything else clears the arming and sprays as usual, as does an unarmed can, which tints a window or a poster. |
Var Details
direct_color_types 
Types which use their color var for additional logic, so we need to avoid using transition filters on them.
graffiti_armed 
What a click on a wall, a floor, a full-tile window or a poster paints: null for the stencil, "freehand" for a live editor on it, "unfinished" for the Unfinished slot's piece, or a library piece's id.
graffiti_sent_revision 
The graffiti library revision the window's static data last carried, or 0 while it carries none.
graffiti_tab 
The window's tab: "stencils" or "graffiti".
Proc Details
examine
Adds what an armed can paints to its examine. Only its holder, whose library the armed piece is from, sees it named.
Arguments:
- user: The examiner.
Returns:
- list: The examine lines.
graffiti_armed_name
Returns the name of the piece the can is armed with, from the library of the player holding it.
Arguments:
- user: The player.
Returns:
- text: The piece's name, escaped as the library keeps it.
- null: The can paints freehand or isn't armed, the player isn't holding it, or the library no longer has the piece.
graffiti_enabled
Whether the can paints custom graffiti: every spray can that paints, but not the hellcan, lubecan or mimecan.
Returns:
- TRUE/FALSE
graffiti_open_editor
Swaps the can's window for a graffiti editor, which reuses its place on screen.
Arguments:
- user: The player.
- piece: A copy of the canonical piece to open, or null for a blank one.
- piece_id: The library piece it is, or null.
- surface: The wall, floor or window tile to paint live, or a poster's tile, or null for a studio session.
- kept: The placements a freehand draft left on the surface, from graffiti_resume_placements(), which the session goes on painting, or null.
- poster: The poster to paint live, or null.
graffiti_reopen
Opens the can's window on a tab, as a graffiti editor hands back to it.
Arguments:
- user: The player.
- tab: "stencils" or "graffiti".
ui_act
Handles the Custom Graffiti tab's actions, after the crayon's own. Picking a stencil also clears what the can was set to paint.
Arguments:
- action: The action.
- params: Its params, as the window sent them.
- ui: The window.
- state: The window's state.
Returns:
- TRUE/FALSE: Whether the window updates.
ui_data
Adds the can's graffiti state to the window's data.
Arguments:
- user: The player.
Returns:
- list: The data, with "graffiti": "armed", "armedName", "tab" and "hasEditor".
ui_interact
Opens the window, or refreshes the open one. Opening it afresh clears what the can was set to paint. A refresh after the player's graffiti library changed sends the static data too, which carries the library, while its tab is open.
Arguments:
- user: The player.
- ui: The open window, when tgui refreshes it.
ui_static_data
Adds the player's graffiti library to the window's static data while the Custom Graffiti tab is open, and only then: 50 pieces' thumbnails take 40 KB as typical art and up to 1.5 MB as adversarial art, which a window open on the stencils would carry for nothing. It is sent again once the library changes or the tab opens.
Arguments:
- user: The player.
Returns:
- list: The static data, with "graffitiLibrary": "entries", "unfinished", "count", "cap" and "defaultPalette" while the tab is open.
use_on
Paints with an armed can. A click on an adjacent wall or floor, a full-tile window fastened down, or graffiti on one, on the static station (graffiti_static_station(), else "can't paint here!" and the can stays armed), opens a freehand session there, continues a freehand draft on its own tile, or starts a paint job of the armed piece. A session that starts uses the arming up, and a job keeps it. An Unfinished piece whose paint still shows goes on only there: a click on another surface is refused ("wrong wall!") and starts no cooldown. Each attempt waits out GRAFFITI_START_COOLDOWN from the last, refused or not, and is refused before any costly work: by an empty can, a paint job already running, or a two-tile piece without a surface like this one to the right. A two-tile piece that paints nothing on its right tile paints one tile. A click on a poster that isn't ripped paints over the poster itself, one painter at a time, and only on its own pixels; it takes no two-tile piece ("too wide!"), and nothing resumes there. A click on anything else clears the arming and sprays as usual, as does an unarmed can, which tints a window or a poster.
Arguments:
- target: What was clicked.
- user: The painter.
- modifiers: The click's modifiers.
Returns:
- ITEM_INTERACT_SUCCESS or ITEM_INTERACT_BLOCKING, as the parent returns them.