docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
43
fn-world_has.html
Normal file
43
fn-world_has.html
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>world_has — Ludic</title>
|
||||
<meta name="description" content="Test whether a model instance currently carries a property.">
|
||||
<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#ecs">Entities & the ECS</a> <span>›</span> <span class="here">world_has</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-builtin">function</span>
|
||||
<h1 id="top">world_has</h1>
|
||||
</div>
|
||||
<code class="sig">world_has(target, property) -> bool</code>
|
||||
<div class="desc"><p><code>world_has</code> tests whether a model instance currently carries a given property, returning a boolean. It is the reflection-ABI equivalent of the membership test a <code>query</code> performs implicitly, and the safe guard to run before a <code>world_get</code>/<code>world_set</code> on a property an instance might not have. A property that has been <code>disable</code>d reads as absent here (its has-flag is clear), while one that is merely present with default values reads as present. Pass the target instance and the property id from <code>world_prop_id</code>.</p></div>
|
||||
<div class="params"><h2>Parameters</h2><div class="param" id="param-target"><code class="pname">target</code><span class="pdesc">the model instance to test, an <code>entity</code> handle</span></div><div class="param" id="param-property"><code class="pname">property</code><span class="pdesc">the property id, from <code>world_prop_id</code></span></div></div>
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program CheckProperty {
|
||||
property Position { column: int = 0, row: int = 0 }
|
||||
property Shield { amount: int = 0 }
|
||||
model Player { Position, Shield }
|
||||
|
||||
handler Boot phase Start {
|
||||
spawn Hero { Position { column: 1, row: 1 }; Shield { amount: 2 } }
|
||||
}
|
||||
|
||||
handler Inspect phase Update {
|
||||
let shield_property = world_prop_id("Shield")
|
||||
for (position) in query [Position, {Player}] {
|
||||
if world_has(self(), shield_property) { Screen.status("shielded") }
|
||||
}
|
||||
}
|
||||
}</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