102 lines
5.4 KiB
HTML
102 lines
5.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" data-theme="dark">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Spearhead API</title>
|
|
<link rel="stylesheet" href="../style/style.css">
|
|
<script src="../js/site.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<header>
|
|
<div class="header-box">
|
|
<a class="logo" href="../index.html">Spearhead</a>
|
|
<div class="header-right">
|
|
<nav>
|
|
<a href="../index.html">Home</a>
|
|
<a href="../pages/tutorials.html">Tutorials</a>
|
|
<a href="../pages/persistence.html">Persistence</a>
|
|
<a href="../pages/reference.html">Reference</a>
|
|
<a href="../pages/spearheadapi.html">API</a>
|
|
</nav>
|
|
<button id="theme-toggle" class="theme-toggle" title="Toggle light/dark theme">
|
|
<svg id="moon-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
<path d="M12 11.807A9.002 9.002 0 0 1 10.049 2a9.942 9.942 0 0 0-5.12 2.735c-3.905 3.905-3.905 10.237 0 14.142 3.906 3.906 10.237 3.905 14.143 0a9.946 9.946 0 0 0 2.735-5.119A9.003 9.003 0 0 1 12 11.807z"/>
|
|
</svg>
|
|
<svg id="sun-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="display: none;">
|
|
<path d="M6.995 12c0 2.761 2.246 5.007 5.007 5.007s5.007-2.246 5.007-5.007-2.246-5.007-5.007-5.007S6.995 9.239 6.995 12zM12 8.993c1.658 0 3.007 1.349 3.007 3.007S13.658 15.007 12 15.007 8.993 13.658 8.993 12 10.342 8.993 12 8.993zM10.998 19H12.998V22H10.998zM10.998 2H12.998V5H10.998zM1.998 11H4.998V13H1.998zM18.998 11H21.998V13H18.998z"/>
|
|
<path transform="rotate(-45.017 5.986 18.01)" d="M4.986 17.01H6.986V19.01H4.986z"/>
|
|
<path transform="rotate(-45.001 18.008 5.99)" d="M17.008 4.99H19.008V6.99H17.008z"/>
|
|
<path transform="rotate(-134.983 5.988 5.99)" d="M4.988 4.99H6.988V6.99H4.988z"/>
|
|
<path transform="rotate(134.999 18.008 18.01)" d="M17.008 17.01H19.008V19.01H17.008z"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<main>
|
|
<div class="reference-container">
|
|
<div class="side-nav">
|
|
<h4 class="side-nav-title"></h4>
|
|
<ul>
|
|
<li><a href="#introduction" class="side-nav-h2">Introduction</a></li>
|
|
<li><a href="#stages" class="side-nav-h2">Stages</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="content-wrapper">
|
|
<h1>Spearhead API</h1>
|
|
|
|
<div class="note">
|
|
<p><strong>NOTE:</strong> The Spearhead.API space is only released in the Beta branch at the moment.</p>
|
|
</div>
|
|
|
|
<h2 id="introduction">Introduction</h2>
|
|
<p>
|
|
The <span class="inline-lua"><span class="lua-variable">Spearhead.API</span></span> space is specifically created to make sure mission makers can interact with the framework.
|
|
</p>
|
|
<p>
|
|
Simply alter logic, get the current state in Spearhead, and give the whole Mission Editor more control.
|
|
</p>
|
|
<p>
|
|
For example, late activate the entire framework by calling <span class="inline-lua"><span class="lua-function">Spearhead.API.Stages.changeStage</span>(<span class="lua-variable">1</span>)</span> later or on demand and setting the starting config stage to -1 in the Spearhead configuration file.
|
|
</p>
|
|
|
|
<h2 id="stages">Stages</h2>
|
|
<pre>
|
|
<span class="lua-comment">---Changes the active stage of spearhead.
|
|
--- All other stages will change based on the normal logic. (CAP, BLUE etc.)
|
|
---@param stageNumber number the stage number you want changed
|
|
---@return boolean success indicator of success
|
|
---@return string message error message</span>
|
|
<span class="lua-variable">Spearhead.API.Stages</span>.<span class="lua-function">changeStage</span> <span class="lua-operator">=</span> <span class="lua-keyword">function</span>(<span class="lua-variable">stageNumber</span>) <span class="lua-keyword">end</span>
|
|
|
|
<span class="lua-comment">---Returns the current stange number
|
|
---Returns nil when the stagenumber was not set and spearhead is not started.
|
|
---@return number | nil</span>
|
|
<span class="lua-variable">Spearhead.API.Stages</span>.<span class="lua-function">getCurrentStage</span> <span class="lua-operator">=</span> <span class="lua-keyword">function</span>() <span class="lua-keyword">end</span>
|
|
|
|
|
|
<span class="lua-comment">---returns whether a stage (by index) is complete.
|
|
---@param stageNumber number
|
|
---@return boolean | nil
|
|
---@return string</span>
|
|
<span class="lua-variable">Spearhead.API.Stages</span>.<span class="lua-function">isStageComplete</span> <span class="lua-operator">=</span> <span class="lua-keyword">function</span>(<span class="lua-variable">stageNumber</span>) <span class="lua-keyword">end</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<footer>
|
|
<p>© 2025 Spearhead Project</p>
|
|
</footer>
|
|
<style>
|
|
.side-nav a.active {
|
|
font-weight: bold;
|
|
color: #4fc3f7;
|
|
}
|
|
</style>
|
|
</body>
|
|
|
|
</html> |