/tg/ Station 13 - Modules - Types — Var Details - Proc Details

character_preview

The character preview every tab of character setup shows: the preview mob, facing each way, drawn into one image and sent in the window's data. Height and body size, which a flatten leaves out, go with it for the page to draw, as the game draws them.

It is drawn again whenever the preview mob changes and a window is open to show it, and the window asks for it when it opens, saying which drawing it holds. A lone change is drawn in SScharacter_preview's next fire, after whatever made it has finished: one action can change the look more than once, like taking one hat off to put another on, and only its last look is drawn, as a map only ever showed what a tick ended with. Changes that come while a drawing is under way, or within CHARACTER_PREVIEW_SETTLE of the last answer, wait in a single slot: each newer one takes its place and pushes the answer back, until they stop for CHARACTER_PREVIEW_SETTLE or CHARACTER_PREVIEW_MAX_WAIT has passed since the first of them. Then the latest look is drawn once. The page shows a loader while one waits.

While a window is open, a change doesn't rebuild the preview mob itself: the drawing does, first, once for everything an action changed, and in turn with other characters when many change at once. See rebuilds.dm.

Answers reach the page as small updates of their own, so none of them rebuilds the preferences data, and the drawing travels inside the data rather than as a file: BYOND keeps every file a client is sent in its cache for good.

While the window has its lights off, a look with something that glows is drawn with its glow beside each facing, for the page to light it as the game does in the dark; see glow.dm. Otherwise no glow is drawn at all.

A look with something animated, like a halo or a galaxy suit, carries patches of what moves for the page to play over each facing; see animation.dm. An animated icon state is read once a round, in SScharacter_preview's spare time, and a look drawn still while one waited to be read is drawn again once it has been.

Vars

animation_readSet when animated icon states a drawing drew still have been read since, so the look draws again, moving.
answer_dueSet while an answer waits for SScharacter_preview to start it; changes until then fold into it.
answer_timerSettling callback owned by the current window, cancelled when it closes.
drawingSet while a drawing is in progress; another waits for it.
drawn_lights_offWhether the look last drawn was drawn with what glows.
drawn_lookThe look last drawn, held rather than its ref kept, so the ref can't be reused.
lights_offWhether the window has its lights off, so drawings carry what glows.
previewThe drawing as the page reads it: its image, frame size, each facing's offset, and what the page draws over them. Null until drawn.
preview_cooldownAn answer just given; changes in its wake wait to be folded into one.
preview_keyEverything that drawing shows, so a new one that changes none of it keeps the one the page has.
preview_on_pageThe number of the drawing the page last said it holds, or was last sent.
preview_serialHow many drawings this character has had, which numbers each one.
waiting_sinceWhen the oldest change still waiting for its answer came, or null when none is waiting.
window_generationA close ends the window's work even when the same preferences immediately open another window.

Procs

answer_soonAsks SScharacter_preview for an answer, which it starts once whatever made the change has finished.
answer_waitingThe end of a burst of changes: the latest look, drawn once.
catch_upRebuilds the preview mob if a change left it stale: at once if there's room, and otherwise once its turn comes, while the page shows its loader. A change after its turn waits for the next drawing, which it asked for. See rebuilds.dm.
draw_changedRebuilds the preview mob if a change left it stale, draws it if its look has changed since it was last drawn, and makes the page's preview from the drawing. Everything the page is sent is read from the mob in one go, before the drawing is waited on, so it all shows the same look.
draw_previewDraws a walk's facings into one strip with iconforge, or finds the same look already drawn, and returns the page's data for the strip, or null if it couldn't be drawn.
drawing_staleWhether a drawing begun for view in window, in session generation, no longer belongs to the open window - setup may have closed, or reopened with another view, while it waited.
forget_unshownForgets a drawing no character shows, like one made for a window that closed while it was drawn.
open_windowThe open character setup window, or null. A window still loading can't take a drawing yet, and asks for one once it has loaded.
preview_changedSomething to draw: once whatever changed the look has finished, or once a burst of changes settles.
release_drawingThis character stops showing a drawing. Once no character shows it, it is forgotten.
request_previewThe window asks for the preview, saying which drawing it holds.
send_preview_updateSends the page only these keys. tgui merges them into the data it has, which keeps them until they are sent again.
session_overWhether the window session that generation was read in has closed since, or this middleware has gone.
set_lightsThe window turns its lights off, or on again. Off, a drawing made without what glows is drawn again with it; on, the page just stops lighting what it has, and later drawings leave the glow out.
start_answerSScharacter_preview starts an answer asked for with answer_soon(); changes from here on ask for another. Draws the preview if it has changed, and tells the page whether a newer drawing is waiting, sending it the latest drawing if it holds another.
update_previewDraws the preview mob if its look has changed since it was last drawn. One update at a time; another waits for it.
window_closedThe window closed, and the preview mob went with it. So does its drawing: a window opened later asks for a new one.

Var Details

animation_read

Set when animated icon states a drawing drew still have been read since, so the look draws again, moving.

answer_due

Set while an answer waits for SScharacter_preview to start it; changes until then fold into it.

answer_timer

Settling callback owned by the current window, cancelled when it closes.

drawing

Set while a drawing is in progress; another waits for it.

drawn_lights_off

Whether the look last drawn was drawn with what glows.

drawn_look

The look last drawn, held rather than its ref kept, so the ref can't be reused.

lights_off

Whether the window has its lights off, so drawings carry what glows.

preview

The drawing as the page reads it: its image, frame size, each facing's offset, and what the page draws over them. Null until drawn.

preview_cooldown

An answer just given; changes in its wake wait to be folded into one.

preview_key

Everything that drawing shows, so a new one that changes none of it keeps the one the page has.

preview_on_page

The number of the drawing the page last said it holds, or was last sent.

preview_serial

How many drawings this character has had, which numbers each one.

waiting_since

When the oldest change still waiting for its answer came, or null when none is waiting.

window_generation

A close ends the window's work even when the same preferences immediately open another window.

Proc Details

answer_soon

Asks SScharacter_preview for an answer, which it starts once whatever made the change has finished.

answer_waiting

The end of a burst of changes: the latest look, drawn once.

catch_up

Rebuilds the preview mob if a change left it stale: at once if there's room, and otherwise once its turn comes, while the page shows its loader. A change after its turn waits for the next drawing, which it asked for. See rebuilds.dm.

draw_changed

Rebuilds the preview mob if a change left it stale, draws it if its look has changed since it was last drawn, and makes the page's preview from the drawing. Everything the page is sent is read from the mob in one go, before the drawing is waited on, so it all shows the same look.

draw_preview

Draws a walk's facings into one strip with iconforge, or finds the same look already drawn, and returns the page's data for the strip, or null if it couldn't be drawn.

drawing_stale

Whether a drawing begun for view in window, in session generation, no longer belongs to the open window - setup may have closed, or reopened with another view, while it waited.

forget_unshown

Forgets a drawing no character shows, like one made for a window that closed while it was drawn.

open_window

The open character setup window, or null. A window still loading can't take a drawing yet, and asks for one once it has loaded.

preview_changed

Something to draw: once whatever changed the look has finished, or once a burst of changes settles.

release_drawing

This character stops showing a drawing. Once no character shows it, it is forgotten.

request_preview

The window asks for the preview, saying which drawing it holds.

send_preview_update

Sends the page only these keys. tgui merges them into the data it has, which keeps them until they are sent again.

session_over

Whether the window session that generation was read in has closed since, or this middleware has gone.

set_lights

The window turns its lights off, or on again. Off, a drawing made without what glows is drawn again with it; on, the page just stops lighting what it has, and later drawings leave the glow out.

start_answer

SScharacter_preview starts an answer asked for with answer_soon(); changes from here on ask for another. Draws the preview if it has changed, and tells the page whether a newer drawing is waiting, sending it the latest drawing if it holds another.

update_preview

Draws the preview mob if its look has changed since it was last drawn. One update at a time; another waits for it.

window_closed

The window closed, and the preview mob went with it. So does its drawing: a window opened later asks for a new one.