docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
44
annot-toclients.html
Normal file
44
annot-toclients.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>@ToClients — Ludic</title>
|
||||
<meta name="description" content="A remote event broadcast from the server to clients — a server→clients notification.">
|
||||
<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">@ToClients</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-annotation">annotation</span>
|
||||
<h1 id="top">@ToClients</h1>
|
||||
</div>
|
||||
<code class="sig">@ToClients event Name { … }</code>
|
||||
<div class="desc"><p><code>@ToClients</code> marks an <code>event</code> as a directional remote event that travels from the authority down to clients — a broadcast, again the ordinary event bus with a direction flag. When the server <code>emit</code>s it, the POD payload is serialized as an event id plus its packed fields and sent through the transport seam to the clients; each client's pump re-emits it into normal <code>@On</code> dispatch, so an <code>@On(Name)</code> handler on every client reacts. Use it for authoritative notifications a client should present but not decide — an explosion happened, a round ended, a pickup was granted. Its mirror is <code>@ToServer</code>, which carries client requests the other way.</p></div>
|
||||
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program ExplosionBroadcast {
|
||||
property EffectLog { count: int = 0 }
|
||||
model Client { EffectLog }
|
||||
|
||||
@ToClients event Boom { column: int = 0, row: int = 0 } # server -> clients broadcast
|
||||
|
||||
@On(Boom) handler PlayExplosion { # every client reacts
|
||||
for (EffectLog) in query [EffectLog, {Client}] {
|
||||
EffectLog.count = EffectLog.count + 1
|
||||
}
|
||||
}
|
||||
|
||||
entry {
|
||||
spawn Client { EffectLog { count: 0 } }
|
||||
emit Boom(column: 8, row: 3) # serialized to clients, re-emitted on arrival
|
||||
}
|
||||
}</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