CardMachine
One-paragraph description of what this component does and what it attaches to. Mention any required sibling components (e.g. Model, Transform).
CardMachine
One-paragraph description of what this component does and what it attaches to. Mention any required sibling components (e.g. Model, Transform).
Public fields
exampleNumber: number— what it controls, units, valid range.exampleString: string— what it controls.exampleBool: boolean— what it controls.
Methods
:methodName(arg)— what it does and when to call it.
Lifecycle
awake()— same-frame attach hook. What initial state this component sets up.start()— first-frame-after-awake hook. Cross-component setup that needs the other components on the entity to have finishedawake.update(dt)— per-frame while the gameplay clock runs. What this component does each tick.onDestroy()— cleanup performed on detach / entity despawn.
See man components for the full hook list (onEnable, fixedUpdate,
onPropertyChanged, etc.) and the timing details.
Usage
entity(id).component.add("CardMachine", { exampleNumber = 1.0 })
entity(id).component.get("CardMachine"):methodName("foo")
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2Card Machine 1978 — the machine itself. One component on one entity in the scene is the whole game: it owns the screen, the run in progress, the phase the cabinet is in, and every callback a widget fires. Nothing else in the world needs to know it exists. The screen is immediate mode — the tree is a pure function of `App` — so the rule here is that NOTHING reads the UI to decide what happens. A press changes `App`, and the next frame draws the consequence.
toast(key: string, vars: any?) → void
| arg | type | description |
|---|---|---|
| key | string | |
| vars | any? |
selectedList( ) → void
selectedCount( ) → number
clearSelection( ) → void
size( ) → void
buildTree( ) → void
collectFocus(node: any, list: { string }, seen: { [string]: boolean }) → void
Read off the tree rather than reported by the builders: whatever carries a callback IS a control, in the order it paints, and nothing has to remember to register itself. The walk cannot drift from the screen because it is taken from the screen.
| arg | type | description |
|---|---|---|
| node | any | |
| list | { string } | |
| seen | { [string]: boolean } |
refresh( ) → void
startRun(deckId: string, saved: any?) → void
| arg | type | description |
|---|---|---|
| deckId | string | |
| saved | any? |
award(fresh: { any }) → void
| arg | type | description |
|---|---|---|
| fresh | { any } |
foldRun(won: boolean) → void
| arg | type | description |
|---|---|---|
| won | boolean |
beginPlayAnimation(res: any) → void
`run:play` has already resolved everything by the time this returns — the score, the money, the draws, the cards that shattered. What is left is to SHOW it: the log becomes a queue of steps, and the board plays them one at a time so the player watches their own arithmetic happen.
| arg | type | description |
|---|---|---|
| res | any |
stepAnimation(dt: number) → void
| arg | type | description |
|---|---|---|
| dt | number |
afterPlay( ) → void
A hand that has finished resolving hands the cabinet on to the next thing: the payout, or the loss. A loss is the end of a run, and the end of a run is where the lifetime counters are written down for good.
handle(id: string, data: any) → void
Every id a screen can fire. The naming is the contract: "nav:", "act:", "card:", "joker:", "cons:", "buy:", "take:", "deck:".
| arg | type | description |
|---|---|---|
| id | string | |
| data | any |
awake( ) → void
navKeys( ) → void
handleKeys( ) → void
tick(dt: number) → void
| arg | type | description |
|---|---|---|
| dt | number |
update(dt: ?) → void
| arg | type | description |
|---|---|---|
| dt | ? |
editorUpdate(dt: ?) → void
| arg | type | description |
|---|---|---|
| dt | ? |
start( ) → void
onModuleReload(path: ?) → void
| arg | type | description |
|---|---|---|
| path | ? |
public_rebuild( ) → void
--!desc Rebuild the cabinet on the next tick. --!example entity(id).component.get("CardMachine"):rebuild()
onCallback(callbackId: string, data: any) → void
| arg | type | description |
|---|---|---|
| callbackId | string | |
| data | any |
onDestroy( ) → void
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.