docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
46
annot-onenable.html
Normal file
46
annot-onenable.html
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>@OnEnable — Ludic</title>
|
||||
<meta name="description" content="Run a handler when a paused property is re-enabled on an instance.">
|
||||
<link rel="stylesheet" href="base.css">
|
||||
<link rel="stylesheet" href="docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||||
<main class="wrap item">
|
||||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="api.html#annotations">Annotations</a> <span>›</span> <span class="here">@OnEnable</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-annotation">annotation</span>
|
||||
<h1 id="top">@OnEnable</h1>
|
||||
</div>
|
||||
<code class="sig">@OnEnable(Property) handler Name { … }</code>
|
||||
<div class="desc"><p><code>@OnEnable(Property)</code> fires when a property that is present but disabled is turned back on with <code>enable P on e</code>. Unlike <code>@OnAttach</code>, the property's data was never destroyed — enable/disable only pause and resume a property that already exists, keeping its fields intact — so this hook is about a capability becoming active again rather than being created. The body runs in the instance's context and can read the retained field values. Use the enable/disable pair for a capability that toggles repeatedly (a power-up, a stun) where re-seeding on every toggle would be wrong. Add <code>@Public</code> to also emit a <code>prop_<Property>_enable</code> event.</p></div>
|
||||
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program EnableHook {
|
||||
property Tag { value: int = 0 }
|
||||
property Shield { amount: int = 0 }
|
||||
model Unit { Tag, Shield }
|
||||
|
||||
@OnEnable(Shield) handler ShieldBackOnline { # fires when Shield is re-enabled
|
||||
print(Shield.amount) # 5 — the retained amount, not re-seeded
|
||||
}
|
||||
|
||||
handler Seed phase Start {
|
||||
spawn Unit { Tag { value: 1 }, Shield { amount: 5 } }
|
||||
for (unit) in query [Unit] { disable Shield on self() }
|
||||
}
|
||||
|
||||
handler Reactivate phase Render {
|
||||
for (unit) in query [Unit] { enable Shield on self() } # triggers @OnEnable
|
||||
quit()
|
||||
}
|
||||
}</pre></div>
|
||||
|
||||
<a class="back" href="api.html">← All symbols</a>
|
||||
</main>
|
||||
<script src="ludic-highlight.js"></script>
|
||||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||||
</body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue