mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
1119 lines
38 KiB
HTML
1119 lines
38 KiB
HTML
|
|
|
|
<!doctype html>
|
|
<html class="no-js" lang="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<title>utils.event module</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="../spectre.min.css" type="text/css" />
|
|
<link rel="stylesheet" href="../spectre-icons.min.css" type="text/css" />
|
|
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container grid-1280">
|
|
<div class="columns">
|
|
|
|
<!-- sidebar start -->
|
|
|
|
<div id="sidebar" class="column col-3 col-sm-12">
|
|
|
|
<div class="sidebar-custom">
|
|
|
|
<div class="project-infobox">
|
|
|
|
<!-- project title -->
|
|
|
|
<a href="../index.html"><h1>ExpGaming Scenario</h1></a>
|
|
|
|
<!-- project description -->
|
|
<p class="project-desc">Explosive Gaming's server scenario for 0.17</p>
|
|
|
|
<!-- project full description -->
|
|
</div>
|
|
|
|
|
|
<!-- sidebar navigation -->
|
|
<!-- list of items in a module -->
|
|
<ul class="nav nav-module-contents">
|
|
<li class="nav-item">
|
|
<h2>Sections</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><a href="#Functions"><span class="fragment-hashtag">#</span> Functions</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Modules</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config._file_loader.html"><span class="module-name-item">config._file_loader</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.action_buttons.html"><span class="module-name-item">config.action_buttons</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.advanced_start.html"><span class="module-name-item">config.advanced_start</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.bonuses.html"><span class="module-name-item">config.bonuses</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.chat_reply.html"><span class="module-name-item">config.chat_reply</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.death_logger.html"><span class="module-name-item">config.death_logger</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.discord_alerts.html"><span class="module-name-item">config.discord_alerts</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.expcore-commands.auth_admin.html"><span class="module-name-item">config.expcore-commands.auth_admin</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.expcore-commands.auth_roles.html"><span class="module-name-item">config.expcore-commands.auth_roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.expcore-commands.auth_runtime_disable.html"><span class="module-name-item">config.expcore-commands.auth_runtime_disable</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.expcore-commands.parse_general.html"><span class="module-name-item">config.expcore-commands.parse_general</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.expcore-commands.parse_roles.html"><span class="module-name-item">config.expcore-commands.parse_roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.permission_groups.html"><span class="module-name-item">config.permission_groups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.popup_messages.html"><span class="module-name-item">config.popup_messages</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.rockets.html"><span class="module-name-item">config.rockets</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.roles.html"><span class="module-name-item">config.roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.scorched_earth.html"><span class="module-name-item">config.scorched_earth</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.spawn_area.html"><span class="module-name-item">config.spawn_area</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.warnings.html"><span class="module-name-item">config.warnings</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/config.warps.html"><span class="module-name-item">config.warps</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/control.html"><span class="module-name-item">control</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.commands.html"><span class="module-name-item">expcore.commands</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.common.html"><span class="module-name-item">expcore.common</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.html"><span class="module-name-item">expcore.gui</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.concepts.center.html"><span class="module-name-item">expcore.gui.concepts.center</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.concepts.left.html"><span class="module-name-item">expcore.gui.concepts.left</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.concepts.popups.html"><span class="module-name-item">expcore.gui.concepts.popups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.concepts.toolbar.html"><span class="module-name-item">expcore.gui.concepts.toolbar</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.core.html"><span class="module-name-item">expcore.gui.core</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.elements.buttons.html"><span class="module-name-item">expcore.gui.elements.buttons</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.elements.checkboxs.html"><span class="module-name-item">expcore.gui.elements.checkboxs</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.elements.dropdown.html"><span class="module-name-item">expcore.gui.elements.dropdown</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.elements.elem-button.html"><span class="module-name-item">expcore.gui.elements.elem-button</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.elements.progress-bar.html"><span class="module-name-item">expcore.gui.elements.progress-bar</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.elements.slider.html"><span class="module-name-item">expcore.gui.elements.slider</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.elements.text.html"><span class="module-name-item">expcore.gui.elements.text</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.instances.html"><span class="module-name-item">expcore.gui.instances</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.prototype.html"><span class="module-name-item">expcore.gui.prototype</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.gui.test.html"><span class="module-name-item">expcore.gui.test</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.permission_groups.html"><span class="module-name-item">expcore.permission_groups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.roles.html"><span class="module-name-item">expcore.roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.store.html"><span class="module-name-item">expcore.store</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/expcore.sudo.html"><span class="module-name-item">expcore.sudo</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.addons.advanced-start.html"><span class="module-name-item">modules.addons.advanced-start</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.addons.chat-popups.html"><span class="module-name-item">modules.addons.chat-popups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.addons.damage-popups.html"><span class="module-name-item">modules.addons.damage-popups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.gui.player-list.html"><span class="module-name-item">modules.gui.player-list</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.gui.rocket-info.html"><span class="module-name-item">modules.gui.rocket-info</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.gui.science-info.html"><span class="module-name-item">modules.gui.science-info</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/modules.gui.task-list.html"><span class="module-name-item">modules.gui.task-list</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.alien_evolution_progress.html"><span class="module-name-item">utils.alien_evolution_progress</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.core.html"><span class="module-name-item">utils.core</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.debug.html"><span class="module-name-item">utils.debug</span></a></div></li>
|
|
<li class="nav-item active"><div class="nav-item-block-active block"><a href="../modules/utils.event.html"><span class="module-name-item">utils.event</span></a><i class="icon icon-arrow-left icon-arrow-left-custom"></i></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.event_core.html"><span class="module-name-item">utils.event_core</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.math.html"><span class="module-name-item">utils.math</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.recipe_locker.html"><span class="module-name-item">utils.recipe_locker</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.state_machine.html"><span class="module-name-item">utils.state_machine</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.table.html"><span class="module-name-item">utils.table</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.task.html"><span class="module-name-item">utils.task</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.timestamp.html"><span class="module-name-item">utils.timestamp</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Control</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Jail.html"><span class="module-name-item">Jail</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Production.html"><span class="module-name-item">Production</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Reports.html"><span class="module-name-item">Reports</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Rockets.html"><span class="module-name-item">Rockets</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Tasks.html"><span class="module-name-item">Tasks</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Warnings.html"><span class="module-name-item">Warnings</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Topics</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../topics/readme.md.html"><span class="module-name-item">readme.md</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../topics/license.html"><span class="module-name-item">license</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
<div class="up-to-top">
|
|
<!-- list of items in a module -->
|
|
<ul class="nav nav-module-contents">
|
|
<li class="nav-item">
|
|
<h4>Jump to Section</h4>
|
|
<ul class="nav">
|
|
<li class="nav-item"><a href="#Functions"><span class="fragment-hashtag">#</span> Functions</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<a href="#">Top <i class="icon icon-upward"></i></a>
|
|
</div>
|
|
</div>
|
|
<!-- sidebar end -->
|
|
|
|
<!-- content body start -->
|
|
<div class="column col-9 col-sm-12">
|
|
|
|
<!-- module list on the main page start -->
|
|
<!-- module list on the main page end -->
|
|
|
|
<!-- module contents -->
|
|
|
|
<!-- module content header start -->
|
|
|
|
<h2><span class="body-module-name"><strong><em>utils.event</em></strong></span> module</h2>
|
|
<p>This Module allows for registering multiple handlers to the same event, overcoming the limitation of script.register.</p>
|
|
<p>
|
|
<p> ** Event.add(event_name, handler) **
|
|
<p> Handlers added with Event.add must be added at the control stage or in Event.on_init or Event.on_load.
|
|
Remember that for each player, on_init or on_load is run, never both. So if you can't add the handler in the
|
|
control stage add the handler in both on_init and on_load.
|
|
Handlers added with Event.add cannot be removed.
|
|
For handlers that need to be removed or added at runtime use Event.add_removable.</p>
|
|
|
|
|
|
<!-- module info start -->
|
|
<!-- module info end -->
|
|
|
|
<!-- module usage start -->
|
|
<h3>Usage</h3>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="keyword">local</span> Event = <span class="global">require</span> <span class="string">'utils.event'</span>
|
|
Event.add(
|
|
defines.events.on_built_entity,
|
|
<span class="keyword">function</span>(event)
|
|
game.<span class="global">print</span>(serpent.block(event)) <span class="comment">-- prints the content of the event table to console.
|
|
</span> <span class="keyword">end</span>
|
|
)
|
|
|
|
** Event.add_removable(event_name, token) **
|
|
|
|
For conditional event handlers. Event.add_removable can be safely called at runtime without desync risk.
|
|
Only use this <span class="keyword">if</span> you need to add the handler at runtime <span class="keyword">or</span> need to remove the handler, otherwise use Event.add
|
|
|
|
Event.add_removable can be safely used at the control stage <span class="keyword">or</span> <span class="keyword">in</span> Event.on_init. If used <span class="keyword">in</span> on_init you don<span class="string">'t
|
|
need to also add in on_load (unlike Event.add).
|
|
Event.add_removable cannot be called in on_load, doing so will crash the game on loading.
|
|
Token is used because it'</span>s a desync risk to store closures inside the global <span class="global">table</span>.</code></pre>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="keyword">local</span> Token = <span class="global">require</span> <span class="string">'utils.token'</span>
|
|
<span class="keyword">local</span> Event = <span class="global">require</span> <span class="string">'utils.event'</span>
|
|
|
|
Token.register must <span class="keyword">not</span> be called inside an event handler.
|
|
<span class="keyword">local</span> handler =
|
|
Token.register(
|
|
<span class="keyword">function</span>(event)
|
|
game.<span class="global">print</span>(serpent.block(event)) <span class="comment">-- prints the content of the event table to console.
|
|
</span> <span class="keyword">end</span>
|
|
)
|
|
|
|
The below code would typically be inside another event <span class="keyword">or</span> a custom command.
|
|
Event.add_removable(defines.events.on_built_entity, handler)
|
|
|
|
When you no longer need the handler.
|
|
Event.remove_removable(defines.events.on_built_entity, handler)
|
|
|
|
It<span class="string">'s not an error to register the same token multiple times to the same event, however when
|
|
removing only the first occurrence is removed.
|
|
|
|
** Event.add_removable_function(event_name, func) **
|
|
|
|
Only use this function if you can'</span>t use Event.add_removable. i.e you are registering the handler at the console.
|
|
The same restrictions that apply to Event.add_removable also apply to Event.add_removable_function.
|
|
func cannot be a closure <span class="keyword">in</span> this case, as there is no safe way to store closures <span class="keyword">in</span> the global <span class="global">table</span>.
|
|
A closure is a <span class="keyword">function</span> that uses a <span class="keyword">local</span> variable <span class="keyword">not</span> defined <span class="keyword">in</span> the <span class="keyword">function</span>.</code></pre>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="keyword">local</span> Event = <span class="global">require</span> <span class="string">'utils.event'</span>
|
|
|
|
If you want to remove the handler you will need to keep a reference to it.
|
|
global.handler = <span class="keyword">function</span>(event)
|
|
game.<span class="global">print</span>(serpent.block(event)) <span class="comment">-- prints the content of the event table to console.
|
|
</span> <span class="keyword">end</span>
|
|
|
|
The below code would typically be used at the command console.
|
|
Event.add_removable_function(defines.events.on_built_entity, global.handler)
|
|
|
|
When you no longer need the handler.
|
|
Event.remove_removable_function(defines.events.on_built_entity, global.handler)
|
|
|
|
** Other Events **
|
|
|
|
Use Event.on_init(handler) <span class="keyword">for</span> script.on_init(handler)
|
|
Use Event.on_load(handler) <span class="keyword">for</span> script.on_load(handler)
|
|
|
|
Use Event.on_nth_tick(tick, handler) <span class="keyword">for</span> script.on_nth_tick(tick, handler)
|
|
Favour this event over Event.add(defines.events.on_tick, handler)
|
|
There are also Event.add_removable_nth_tick(tick, token) <span class="keyword">and</span> Event.add_removable_nth_tick_function(tick, func)
|
|
That work the same as above.
|
|
|
|
** Custom Scenario Events **
|
|
|
|
<span class="keyword">local</span> Event = <span class="global">require</span> <span class="string">'utils.event'</span>
|
|
|
|
<span class="keyword">local</span> event_id = script.generate_event_name()
|
|
|
|
Event.add(
|
|
event_id,
|
|
<span class="keyword">function</span>(event)
|
|
game.<span class="global">print</span>(serpent.block(event)) <span class="comment">-- prints the content of the event table to console.
|
|
</span> <span class="keyword">end</span>
|
|
)
|
|
|
|
The <span class="global">table</span> contains extra information that you want to pass to the handler.
|
|
script.raise_event(event_id, {extra = <span class="string">'data'</span>})</code></pre>
|
|
<!-- module usage end -->
|
|
|
|
<!-- module content header end -->
|
|
|
|
<!-- module section list start -->
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Functions">Functions</a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#Event.add">Event.add(event_name, handler)</a></td>
|
|
<td class="summary">Register a handler for the event_name event.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.on_init">Event.on_init(handler)</a></td>
|
|
<td class="summary">Register a handler for the script.on_init event.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.on_load">Event.on_load(handler)</a></td>
|
|
<td class="summary">Register a handler for the script.on_load event.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.on_nth_tick">Event.on_nth_tick(tick, handler)</a></td>
|
|
<td class="summary">Register a handler for the nth_tick event.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.add_removable">Event.add_removable(event_name, token)</a></td>
|
|
<td class="summary">Register a token handler that can be safely added and removed at runtime.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.remove_removable">Event.remove_removable(event_name, token)</a></td>
|
|
<td class="summary">Removes a token handler for the given event_name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.add_removable_function">Event.add_removable_function(event_name, func)</a></td>
|
|
<td class="summary">Register a handler that can be safely added and removed at runtime.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.remove_removable_function">Event.remove_removable_function(event_name, func)</a></td>
|
|
<td class="summary">Removes a handler for the given event_name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.add_removable_nth_tick">Event.add_removable_nth_tick(tick, token)</a></td>
|
|
<td class="summary">Register a token handler for the nth tick that can be safely added and removed at runtime.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.remove_removable_nth_tick">Event.remove_removable_nth_tick(tick, token)</a></td>
|
|
<td class="summary">Removes a token handler for the nth tick.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.add_removable_nth_tick_function">Event.add_removable_nth_tick_function(tick, func)</a></td>
|
|
<td class="summary">Register a handler for the nth tick that can be safely added and removed at runtime.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Event.remove_removable_nth_tick_function">Event.remove_removable_nth_tick_function(tick, func)</a></td>
|
|
<td class="summary">Removes a handler for the nth tick.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<!-- module section list end -->
|
|
|
|
<br />
|
|
|
|
<!-- section start -->
|
|
<h3><span id="Functions" class="section-title"><a href="#Functions">Functions</a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.add" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.add">Event.add(event_name, handler)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a handler for the event_name event.</p>
|
|
<p class="section-item-description">
|
|
This function must be called in the control stage or in Event.on_init or Event.on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>event_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.on_init" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.on_init">Event.on_init(handler)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a handler for the script.on_init event.</p>
|
|
<p class="section-item-description">
|
|
This function must be called in the control stage or in Event.on_init or Event.on_load
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.on_load" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.on_load">Event.on_load(handler)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a handler for the script.on_load event.</p>
|
|
<p class="section-item-description">
|
|
This function must be called in the control stage or in Event.on_init or Event.on_load
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.on_nth_tick" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.on_nth_tick">Event.on_nth_tick(tick, handler)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a handler for the nth_tick event.</p>
|
|
<p class="section-item-description">
|
|
This function must be called in the control stage or in Event.on_init or Event.on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tick</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number> The handler will be called every nth tick
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>handler</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.add_removable" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.add_removable">Event.add_removable(event_name, token)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a token handler that can be safely added and removed at runtime.</p>
|
|
<p class="section-item-description">
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>event_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>token</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.remove_removable" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.remove_removable">Event.remove_removable(event_name, token)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Removes a token handler for the given event_name.</p>
|
|
<p class="section-item-description">
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>event_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>token</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.add_removable_function" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.add_removable_function">Event.add_removable_function(event_name, func)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a handler that can be safely added and removed at runtime.</p>
|
|
<p class="section-item-description">
|
|
The handler must not be a closure, as that is a desync risk.
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>event_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>func</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.remove_removable_function" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.remove_removable_function">Event.remove_removable_function(event_name, func)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Removes a handler for the given event_name.</p>
|
|
<p class="section-item-description">
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>event_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>func</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.add_removable_nth_tick" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.add_removable_nth_tick">Event.add_removable_nth_tick(tick, token)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a token handler for the nth tick that can be safely added and removed at runtime.</p>
|
|
<p class="section-item-description">
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tick</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>token</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.remove_removable_nth_tick" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.remove_removable_nth_tick">Event.remove_removable_nth_tick(tick, token)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Removes a token handler for the nth tick.</p>
|
|
<p class="section-item-description">
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tick</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>token</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.add_removable_nth_tick_function" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.add_removable_nth_tick_function">Event.add_removable_nth_tick_function(tick, func)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Register a handler for the nth tick that can be safely added and removed at runtime.</p>
|
|
<p class="section-item-description">
|
|
The handler must not be a closure, as that is a desync risk.
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tick</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>func</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Event.remove_removable_nth_tick_function" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Event.remove_removable_nth_tick_function">Event.remove_removable_nth_tick_function(tick, func)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Removes a handler for the nth tick.</p>
|
|
<p class="section-item-description">
|
|
Do NOT call this method during on_load.
|
|
See documentation at top of file for details on using events.</p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tick</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<number>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>func</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
|
|
<function>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
<!-- section end -->
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer container grid-1280">
|
|
<div class="divider divider-custom"></div>
|
|
<div class="footer-columns columns">
|
|
<div class="sidebar-footer column col-3 col-sm-12">
|
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
|
|
</div>
|
|
<div class="content-footer column col-9 col-sm-12">
|
|
<i>Last updated 2019-07-21 23:06:47 UTC</i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|