mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
3162 lines
97 KiB
HTML
3162 lines
97 KiB
HTML
|
|
|
|
<!doctype html>
|
|
<html class="no-js" lang="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<title>Roles core</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="#Dependencies"><span class="fragment-hashtag">#</span> Dependencies</a></li>
|
|
<li class="nav-item"><a href="#Getter"><span class="fragment-hashtag">#</span> Getter </a></li>
|
|
<li class="nav-item"><a href="#Assinment"><span class="fragment-hashtag">#</span> Assinment </a></li>
|
|
<li class="nav-item"><a href="#Checks"><span class="fragment-hashtag">#</span> Checks </a></li>
|
|
<li class="nav-item"><a href="#Definations"><span class="fragment-hashtag">#</span> Definations </a></li>
|
|
<li class="nav-item"><a href="#Role_Actions"><span class="fragment-hashtag">#</span> Role Actions </a></li>
|
|
<li class="nav-item"><a href="#Role_Flags"><span class="fragment-hashtag">#</span> Role Flags </a></li>
|
|
<li class="nav-item"><a href="#Role_Properties"><span class="fragment-hashtag">#</span> Role Properties </a></li>
|
|
<li class="nav-item"><a href="#Role_Players"><span class="fragment-hashtag">#</span> Role Players </a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Core</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Commands.html"><span class="module-name-item">Commands</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Common-Library.html"><span class="module-name-item">Common-Library</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Gui.html"><span class="module-name-item">Gui</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Permissions-Groups.html"><span class="module-name-item">Permissions-Groups</span></a></div></li>
|
|
<li class="nav-item active"><div class="nav-item-block-active block"><a href="../core/Roles.html"><span class="module-name-item">Roles</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="../core/Store.html"><span class="module-name-item">Store</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Sudo.html"><span class="module-name-item">Sudo</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../core/Toolbar.html"><span class="module-name-item">Toolbar</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Addons</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Advanced-Start.html"><span class="module-name-item">Advanced-Start</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Chat-Popups.html"><span class="module-name-item">Chat-Popups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Chat-Reply.html"><span class="module-name-item">Chat-Reply</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Compilatron.html"><span class="module-name-item">Compilatron</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Damage-Popups.html"><span class="module-name-item">Damage-Popups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Death-Logger.html"><span class="module-name-item">Death-Logger</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Discord-Alerts.html"><span class="module-name-item">Discord-Alerts</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Pollution-Grading.html"><span class="module-name-item">Pollution-Grading</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Player-Colours.html"><span class="module-name-item">Player-Colours</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Scorched-Earth.html"><span class="module-name-item">Scorched-Earth</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../addons/Spawn-Area.html"><span class="module-name-item">Spawn-Area</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Commands</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Admin-Chat.html"><span class="module-name-item">Admin-Chat</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Bonus.html"><span class="module-name-item">Bonus</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Cheat-Mode.html"><span class="module-name-item">Cheat-Mode</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Clear-Inventory.html"><span class="module-name-item">Clear-Inventory</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Debug.html"><span class="module-name-item">Debug</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Find.html"><span class="module-name-item">Find</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Help.html"><span class="module-name-item">Help</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Home.html"><span class="module-name-item">Home</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Interface.html"><span class="module-name-item">Interface</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/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="../commands/Kill.html"><span class="module-name-item">Kill</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Me.html"><span class="module-name-item">Me</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Rainbow.html"><span class="module-name-item">Rainbow</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Repair.html"><span class="module-name-item">Repair</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Reports.html"><span class="module-name-item">Reports</span></a></div></li>
|
|
<li class="nav-item active"><div class="nav-item-block-active block"><a href="../commands/Roles.html"><span class="module-name-item">Roles</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="../commands/Spawn.html"><span class="module-name-item">Spawn</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Tag.html"><span class="module-name-item">Tag</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/Teleport.html"><span class="module-name-item">Teleport</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../commands/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>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>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../control/Warps.html"><span class="module-name-item">Warps</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Guis</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Player-List.html"><span class="module-name-item">Player-List</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Rocket-Info.html"><span class="module-name-item">Rocket-Info</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Science-Info.html"><span class="module-name-item">Science-Info</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Task-List.html"><span class="module-name-item">Task-List</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../guis/Warps-List.html"><span class="module-name-item">Warps-List</span></a></div></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-modules">
|
|
<li class="nav-item">
|
|
<h2>Configs</h2>
|
|
<ul class="nav">
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/File-Loader.html"><span class="module-name-item">File-Loader</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Player-List.html"><span class="module-name-item">Player-List</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Advanced-Start.html"><span class="module-name-item">Advanced-Start</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Bonuses.html"><span class="module-name-item">Bonuses</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Chat-Reply.html"><span class="module-name-item">Chat-Reply</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Compilatron.html"><span class="module-name-item">Compilatron</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Death-Logger.html"><span class="module-name-item">Death-Logger</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Discord-Alerts.html"><span class="module-name-item">Discord-Alerts</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Auth-Admin.html"><span class="module-name-item">Commands-Auth-Admin</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Auth-Roles.html"><span class="module-name-item">Commands-Auth-Roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Auth-Runtime-Disable.html"><span class="module-name-item">Commands-Auth-Runtime-Disable</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Parse.html"><span class="module-name-item">Commands-Parse</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Commands-Parse-Roles.html"><span class="module-name-item">Commands-Parse-Roles</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Permission-Groups.html"><span class="module-name-item">Permission-Groups</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Pollution-Grading.html"><span class="module-name-item">Pollution-Grading</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Popup-Messages.html"><span class="module-name-item">Popup-Messages</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Preset-Player-Colours.html"><span class="module-name-item">Preset-Player-Colours</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Repair.html"><span class="module-name-item">Repair</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Rockets.html"><span class="module-name-item">Rockets</span></a></div></li>
|
|
<li class="nav-item active"><div class="nav-item-block-active block"><a href="../configs/Roles.html"><span class="module-name-item">Roles</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="../configs/Science.html"><span class="module-name-item">Science</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Scorched-Earth.html"><span class="module-name-item">Scorched-Earth</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Spawn-Area.html"><span class="module-name-item">Spawn-Area</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/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="../configs/Warnings.html"><span class="module-name-item">Warnings</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../configs/Warps.html"><span class="module-name-item">Warps</span></a></div></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/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/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"><div class="nav-item-block-inactive block"><a href="../modules/utils.dump_env.html"><span class="module-name-item">utils.dump_env</span></a></div></li>
|
|
<li class="nav-item"><div class="nav-item-block-inactive block"><a href="../modules/utils.event.html"><span class="module-name-item">utils.event</span></a></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>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="#Dependencies"><span class="fragment-hashtag">#</span> Dependencies</a></li>
|
|
<li class="nav-item"><a href="#Getter"><span class="fragment-hashtag">#</span> Getter </a></li>
|
|
<li class="nav-item"><a href="#Assinment"><span class="fragment-hashtag">#</span> Assinment </a></li>
|
|
<li class="nav-item"><a href="#Checks"><span class="fragment-hashtag">#</span> Checks </a></li>
|
|
<li class="nav-item"><a href="#Definations"><span class="fragment-hashtag">#</span> Definations </a></li>
|
|
<li class="nav-item"><a href="#Role_Actions"><span class="fragment-hashtag">#</span> Role Actions </a></li>
|
|
<li class="nav-item"><a href="#Role_Flags"><span class="fragment-hashtag">#</span> Role Flags </a></li>
|
|
<li class="nav-item"><a href="#Role_Properties"><span class="fragment-hashtag">#</span> Role Properties </a></li>
|
|
<li class="nav-item"><a href="#Role_Players"><span class="fragment-hashtag">#</span> Role Players </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>Roles</em></strong></span> core</h2>
|
|
<p>Core Module - Roles
|
|
- Factorio role system to manage custom permissions.</p>
|
|
<p></p>
|
|
|
|
|
|
<!-- module info start -->
|
|
<!-- module info end -->
|
|
|
|
<!-- module usage start -->
|
|
<h3>Usage</h3>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="comment">---- Using Role System (Frontend):
|
|
</span> When a map first starts you will want to define on mass all the players you expect to join <span class="keyword">and</span> the roles to give them:
|
|
Roles.override_player_roles{
|
|
Cooldude2606 = {<span class="string">'Owner'</span>,<span class="string">'Admin'</span>,<span class="string">'Member'</span>},
|
|
NotCooldude2606 = {<span class="string">'Member'</span>}
|
|
}
|
|
|
|
Once the game is running you still want to be able to give role <span class="keyword">and</span> remove them which is when you would use:
|
|
Roles.assign_player(player,<span class="string">'Admin'</span>,by_player_name) <span class="comment">-- this will give the "Admin" role to the player
|
|
</span> Roles.unassign_player(player,{<span class="string">'Admin'</span>,<span class="string">'Moderator'</span>},by_player_name) <span class="comment">-- this will remove "Admin" and "Moderator" role in one go
|
|
</span></code></pre>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="comment">---- Using Role System (Backend):
|
|
</span> To comparer two players you can comparer the index of they highest roles, can be used when you want to allow a <span class="string">"write"</span> down <span class="global">type</span> system:
|
|
Roles.get_player_highest_role(playerOne).index < Roles.get_player_highest_role(playerTwo).index <span class="comment">-- remember that less means a higher role
|
|
</span>
|
|
Listing all of a players roles can also be useful which is when you would want to use:
|
|
Roles.get_player_roles(player) <span class="comment">-- the return is an array that can be looped over however this is not in particular order
|
|
</span>
|
|
Finally you may want to test <span class="keyword">if</span> a player has a certain role, flag <span class="keyword">or</span> action allowed which is when you would use:
|
|
Roles.player_has_role(player,<span class="string">'Admin'</span>) <span class="comment">-- you can provide a role name if you only want a name based system
|
|
</span> Roles.player_has_flag(player,<span class="string">'is_donator'</span>) <span class="comment">-- your roles can be grouped together with flags such as is_donator
|
|
</span> Roles.player_allowed(player,<span class="string">'game modifiers'</span>) <span class="comment">-- or you can have an action based system where each action is something the player can do
|
|
</span></code></pre>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="comment">---- Example Flag Define:
|
|
</span> Flags can be used to group multiple roles <span class="keyword">and</span> actions under one catch all, <span class="keyword">for</span> example <span class="keyword">if</span> you want a piece of code to only
|
|
be active <span class="keyword">for</span> your donators <span class="keyword">then</span> you would add a <span class="string">"is_donator"</span> flag to all your donator roles <span class="keyword">and</span> <span class="keyword">then</span> <span class="keyword">in</span> the code test <span class="keyword">if</span>
|
|
a player has that tag present:
|
|
|
|
<span class="comment">-- give you donators a speed boost when they join; these functions aren't required but can be useful
|
|
</span> Roles.define_flag_trigger(<span class="string">'is_donator'</span>,<span class="keyword">function</span>(player,state)
|
|
<span class="keyword">if</span> state <span class="keyword">then</span>
|
|
player.character_running_speed_modifier = <span class="number">1.5</span>
|
|
<span class="keyword">else</span>
|
|
player.character_running_speed_modifier = <span class="number">1</span>
|
|
<span class="keyword">end</span>
|
|
<span class="keyword">end</span>)
|
|
|
|
<span class="comment">-- then on all your donator roles you would add
|
|
</span> Roles.new_role(<span class="string">'Donator'</span>)
|
|
:set_flag(<span class="string">'is_donator'</span>)
|
|
|
|
<span class="comment">-- and in your code you would test for
|
|
</span> <span class="keyword">if</span> Roles.player_has_flag(player,<span class="string">'is_donator'</span>) <span class="keyword">then</span>
|
|
<span class="comment">-- some donator only code
|
|
</span> <span class="keyword">end</span></code></pre>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="comment">---- Example Role Define:
|
|
</span> You can<span class="string">'t use a role system without any roles so first you must define your roles; each role has a minimum of a name with
|
|
the option for a shorthand:
|
|
Roles.new_role('</span>Administrator<span class="string">','</span>Admin<span class="string">')
|
|
|
|
Next you will want to add any extras you want to have, such as a tag, colour, permission group or any custom flags:
|
|
Roles.new_role('</span>Administrator<span class="string">','</span>Admin<span class="string">')
|
|
:set_custom_tag('</span>[Admin]<span class="string">')
|
|
:set_custom_color('</span>red<span class="string">') -- this can be {r=0,g=0,b=0} or a predefined value
|
|
:set_permission_group('</span>Staff<span class="string">') -- a second argument can be added if you have not used the custom permission group config
|
|
:set_flag('</span>is_admin<span class="string">')
|
|
|
|
You will then want to decide if you want to allow all actions, this should of course be used sparely:
|
|
Roles.new_role('</span>Administrator<span class="string">','</span>Admin<span class="string">')
|
|
...extras...
|
|
:set_allow_all()
|
|
|
|
If you don'</span>t <span class="keyword">do</span> this want this as i would advise you <span class="keyword">do</span> <span class="keyword">then</span> you will want to define what the role can <span class="keyword">do</span>; this comes with
|
|
an optional inheritance system <span class="keyword">if</span> you like those sort of things <span class="keyword">in</span> which case disallow may also be of some use to you:
|
|
Roles.new_role(<span class="string">'Administrator'</span>,<span class="string">'Admin'</span>)
|
|
...extras...
|
|
:set_parent(<span class="string">'Moderator'</span>) <span class="comment">-- the admin can do anything that a moderator can do
|
|
</span> :allow{ <span class="comment">-- these actions can be anything just try to keep them without conflicts
|
|
</span> <span class="string">'command/kill'</span>,
|
|
<span class="string">'gui/game settings'</span>
|
|
}
|
|
|
|
Here is what the finished admin role would look like:
|
|
Roles.new_role(<span class="string">'Administrator'</span>,<span class="string">'Admin'</span>)
|
|
:set_custom_tag(<span class="string">'[Admin]'</span>)
|
|
:set_custom_color(<span class="string">'red'</span>)
|
|
:set_permission_group(<span class="string">'Staff'</span>)
|
|
:set_flag(<span class="string">'is_admin'</span>)
|
|
:set_parent(<span class="string">'Moderator'</span>)
|
|
:allow{
|
|
<span class="string">'command/kill'</span>,
|
|
<span class="string">'gui/game settings'</span>
|
|
}</code></pre>
|
|
<pre class="code" data-lang="Lua"><code>
|
|
<span class="comment">---- Example System Define:
|
|
</span> Once all roles are defined these steps must be done to ensure the system is ready to use, this includes setting a default
|
|
role, assigning a root (all permission) role that the server/system will use <span class="keyword">and</span> the linear order that the roles fall into:
|
|
|
|
Roles.set_default(<span class="string">'Guest'</span>)
|
|
Roles.set_root(<span class="string">'System'</span>)
|
|
|
|
Roles.define_role_order{
|
|
<span class="string">'System'</span>,
|
|
<span class="string">'Administrator'</span>,
|
|
<span class="string">'Moderator'</span>,
|
|
<span class="string">'Donator'</span>,
|
|
<span class="string">'Guest'</span>
|
|
}
|
|
|
|
Just remember that <span class="keyword">in</span> this example all these roles have <span class="keyword">not</span> been defined; so make sure all your roles that are used are defined
|
|
before hand; a config file on <span class="global">load</span> is useful <span class="keyword">for</span> this to ensure that its loaded before the first player even joins.</code></pre>
|
|
<!-- module usage end -->
|
|
|
|
<!-- module content header end -->
|
|
|
|
<!-- module section list start -->
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Dependencies">Dependencies</a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#utils.game">utils.game</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#utils.global">utils.global</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#utils.event">utils.event</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#expcore.permission_groups">expcore.permission_groups</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#expcore.sudo">expcore.sudo</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#resources.color_presets">resources.color_presets</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#expcore.common">expcore.common</a></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Getter">Getter </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#debug">debug()</a></td>
|
|
<td class="summary">Returns a string which contains all roles in index order displaying all data for them</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#print_to_roles">print_to_roles(roles, message)</a></td>
|
|
<td class="summary">Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#print_to_roles_higher">print_to_roles_higher(role, message)</a></td>
|
|
<td class="summary">Prints a message to all players who have the given role or one which is higher (excluding default)</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#print_to_roles_lower">print_to_roles_lower(role, message)</a></td>
|
|
<td class="summary">Prints a message to all players who have the given role or one which is lower (excluding default)</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_role_by_name">get_role_by_name(name)</a></td>
|
|
<td class="summary">Get a role for the given name</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_role_by_order">get_role_by_order(index)</a></td>
|
|
<td class="summary">Get a role with the given order index</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_role_from_any">get_role_from_any(any)</a></td>
|
|
<td class="summary">Gets a role from a name,index or role object (where it is just returned)
|
|
nb: this function is used for the input for most outward facing functions</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_player_roles">get_player_roles(player)</a></td>
|
|
<td class="summary">Gets all the roles of the given player, this will always contain the default role</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#get_player_highest_role">get_player_highest_role(player)</a></td>
|
|
<td class="summary">Gets the highest role which the player has, can be used to compeer one player to another</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Assinment">Assinment </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#assign_player">assign_player(player, roles[, by_player_name=<server>][, silent=false])</a></td>
|
|
<td class="summary">Gives a player the given role(s) with an option to pass a by player name used in the log</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#unassign_player">unassign_player(player, roles[, by_player_name=<server>][, silent=false])</a></td>
|
|
<td class="summary">Removes a player from the given role(s) with an option to pass a by player name used in the log</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#override_player_roles">override_player_roles(roles)</a></td>
|
|
<td class="summary">Overrides all player roles with the given table of roles, useful to mass set roles on game start</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Checks">Checks </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#player_has_role">player_has_role(player, search_role)</a></td>
|
|
<td class="summary">A test for weather a player has the given role</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#player_has_flag">player_has_flag(player, flag_name)</a></td>
|
|
<td class="summary">A test for weather a player has the given flag true for at least one of they roles</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#player_allowed">player_allowed(player, action)</a></td>
|
|
<td class="summary">A test for weather a player has at least one role which is allowed the given action</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Definations">Definations </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#define_role_order">define_role_order(order)</a></td>
|
|
<td class="summary">Used to set the role order, higher in the list is better, must be called at least once in config
|
|
nb: function also re links parents due to expected position in the config file</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#define_flag_trigger">define_flag_trigger(name, callback)</a></td>
|
|
<td class="summary">Defines a new trigger for when a tag is added or removed from a player</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#set_default">set_default(name)</a></td>
|
|
<td class="summary">Sets the default role which every player will have, this needs to be called at least once</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#set_root">set_root(name)</a></td>
|
|
<td class="summary">Sets the root role which will always have all permissions, any server actions act from this role</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#new_role">new_role(name[, short_hand=name])</a></td>
|
|
<td class="summary">Defines a new role and returns the prototype to allow configuration</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Role_Actions">Role Actions </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_allow_all">Roles._prototype:set_allow_all([state=true])</a></td>
|
|
<td class="summary">Sets the default allow state of the role, true will allow all actions</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:allow">Roles._prototype:allow(actions)</a></td>
|
|
<td class="summary">Sets the allow actions for this role, actions in this list will be allowed for this role</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:disallow">Roles._prototype:disallow(actions)</a></td>
|
|
<td class="summary">Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:is_allowed">Roles._prototype:is_allowed(action)</a></td>
|
|
<td class="summary">Test for if a role is allowed the given action, mostly internal see Roles.player_allowed</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Role_Flags">Role Flags </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_flag">Roles._prototype:set_flag(name[, value=true])</a></td>
|
|
<td class="summary">Sets the state of a flag for a role, flags can be used to apply effects to players</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:clear_flags">Roles._prototype:clear_flags()</a></td>
|
|
<td class="summary">Clears all flags from this role, individual flags can be removed with set_flag(name,false)</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:has_flag">Roles._prototype:has_flag(name)</a></td>
|
|
<td class="summary">A test for if the role has a flag set</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Role_Properties">Role Properties </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_custom_tag">Roles._prototype:set_custom_tag(tag)</a></td>
|
|
<td class="summary">Sets a custom player tag for the role, can be accessed by other code</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_custom_color">Roles._prototype:set_custom_color(color)</a></td>
|
|
<td class="summary">Sets a custom colour for the role, can be accessed by other code</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_permission_group">Roles._prototype:set_permission_group(name[, use_factorio_api=false])</a></td>
|
|
<td class="summary">Sets the permission group for this role, players will be moved to the group of they highest role</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_parent">Roles._prototype:set_parent(role)</a></td>
|
|
<td class="summary">Sets the parent for a role, any action not in allow or disallow will be looked for in its parents
|
|
nb: this is a recursive action, and changing the allows and disallows will effect all children roles</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_auto_promote_condition">Roles._prototype:set_auto_promote_condition(callback)</a></td>
|
|
<td class="summary">Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will receive the role
|
|
nb: this is one way, failing false after already gaining the role will not revoke the role</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:set_block_auto_promote">Roles._prototype:set_block_auto_promote([state=true])</a></td>
|
|
<td class="summary">Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table class="section-content-list">
|
|
<thead>
|
|
<h3><a href="#Role_Players">Role Players </a></h3>
|
|
<span></span>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:add_player">Roles._prototype:add_player(player, skip_check, skip_event)</a></td>
|
|
<td class="summary">Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:remove_player">Roles._prototype:remove_player(player, skip_check, skip_event)</a></td>
|
|
<td class="summary">Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:get_players">Roles._prototype:get_players([online=nil])</a></td>
|
|
<td class="summary">Returns an array of all the players who have this role, can be filtered by online status</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#Roles._prototype:print">Roles._prototype:print(message)</a></td>
|
|
<td class="summary">Will print a message to all players with this role</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<!-- module section list end -->
|
|
|
|
<br />
|
|
|
|
<!-- section start -->
|
|
<h3><span id="Dependencies" class="section-title"><a href="#Dependencies">Dependencies</a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#utils.game" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="utils.game">utils.game</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- 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="#utils.global" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="utils.global">utils.global</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- 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="#utils.event" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="utils.event">utils.event</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- 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="#expcore.permission_groups" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="expcore.permission_groups">expcore.permission_groups</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- 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="#expcore.sudo" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="expcore.sudo">expcore.sudo</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- 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="#resources.color_presets" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="resources.color_presets">resources.color_presets</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- 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="#expcore.common" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="expcore.common">expcore.common</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Getter" class="section-title"><a href="#Getter">Getter </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#debug" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="debug">debug()</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Returns a string which contains all roles in index order displaying all data for them</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
<span class="return-text">the debug output string</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#print_to_roles" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="print_to_roles">print_to_roles(roles, message)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>roles</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
table a of roles which to send the message to
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>message</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the message to send to the players
|
|
|
|
</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="#print_to_roles_higher" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="print_to_roles_higher">print_to_roles_higher(role, message)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Prints a message to all players who have the given role or one which is higher (excluding default)</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>role</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the role to send the message to
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>message</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the message to send to the players
|
|
|
|
</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="#print_to_roles_lower" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="print_to_roles_lower">print_to_roles_lower(role, message)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Prints a message to all players who have the given role or one which is lower (excluding default)</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>role</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the role to send the message to
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>message</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the message to send to the players
|
|
|
|
</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="#get_role_by_name" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_role_by_name">get_role_by_name(name)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Get a role for the given name</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the role to get
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">the role with that name or nil</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#get_role_by_order" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_role_by_order">get_role_by_order(index)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Get a role with the given order index</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>index</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
|
|
the place in the order list of the role to get
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">the role with that index in the order list or nil</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#get_role_from_any" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_role_from_any">get_role_from_any(any)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Gets a role from a name,index or role object (where it is just returned)
|
|
nb: this function is used for the input for most outward facing functions</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>any</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a>, <a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
the value used to find the role
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">the role that was found or nil see above</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#get_player_roles" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_player_roles">get_player_roles(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Gets all the roles of the given player, this will always contain the default role</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player to get the roles of
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">a table where the values are the roles which the player has</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#get_player_highest_role" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="get_player_highest_role">get_player_highest_role(player)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Gets the highest role which the player has, can be used to compeer one player to another</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player to get the highest role of
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">the</span></span>)
|
|
<span class="return-text">role with the highest order index which this player has</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Assinment" class="section-title"><a href="#Assinment">Assinment </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#assign_player" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="assign_player">assign_player(player, roles[, by_player_name=<server>][, silent=false])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Gives a player the given role(s) with an option to pass a by player name used in the log</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that will be assigned the roles
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>roles</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
table a of roles that the player will be given, can be one role and can be role names
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>by_player_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the player that will be shown in the log
|
|
|
|
(<em>default</em>: <server>)
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>silent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true there will be no game message printed
|
|
|
|
(<em>default</em>: false)
|
|
</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="#unassign_player" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="unassign_player">unassign_player(player, roles[, by_player_name=<server>][, silent=false])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Removes a player from the given role(s) with an option to pass a by player name used in the log</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that will have the roles removed
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>roles</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
table a of roles to be removed from the player, can be one role and can be role names
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>by_player_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the player that will be shown in the logs
|
|
|
|
(<em>default</em>: <server>)
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>silent</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true there will be no game message printed
|
|
|
|
(<em>default</em>: false)
|
|
</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="#override_player_roles" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="override_player_roles">override_player_roles(roles)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Overrides all player roles with the given table of roles, useful to mass set roles on game start</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>roles</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
table a which is indexed by case sensitive player names and has the value of a table of role names
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Checks" class="section-title"><a href="#Checks">Checks </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#player_has_role" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="player_has_role">player_has_role(player, search_role)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">A test for weather a player has the given role</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player to test the roles of
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>search_role</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a>, <a class="type" href="https://www.lua.org/pil/2.3.html">number</a> or <a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
a pointer to the role that is being searched for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if the player has the role, false otherwise, nil for errors</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#player_has_flag" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="player_has_flag">player_has_flag(player, flag_name)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">A test for weather a player has the given flag true for at least one of they roles</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player to test the roles of
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>flag_name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the flag that is being looked for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if the player has at least one role which has the flag set to true, false otherwise, nil for errors</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#player_allowed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="player_allowed">player_allowed(player, action)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">A test for weather a player has at least one role which is allowed the given action</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player to test the roles of
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>action</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the action that is being tested for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if the player has at least one role which is allowed this action, false otherwise, nil for errors</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Definations" class="section-title"><a href="#Definations">Definations </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#define_role_order" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="define_role_order">define_role_order(order)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Used to set the role order, higher in the list is better, must be called at least once in config
|
|
nb: function also re links parents due to expected position in the config file</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>order</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
table a which is keyed only by numbers (start 1) and values are roles in order with highest first
|
|
|
|
</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="#define_flag_trigger" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="define_flag_trigger">define_flag_trigger(name, callback)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Defines a new trigger for when a tag is added or removed from a player</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the flag which the roles will have
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>callback</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
the function that is called when roles are assigned
|
|
flag param - player - the player that has had they roles changed
|
|
flag param - state - the state of the flag, aka if the flag is present
|
|
|
|
</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="#set_default" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="set_default">set_default(name)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the default role which every player will have, this needs to be called at least once</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the default role
|
|
|
|
</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="#set_root" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="set_root">set_root(name)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the root role which will always have all permissions, any server actions act from this role</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the root role
|
|
|
|
</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="#new_role" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="new_role">new_role(name[, short_hand=name])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Defines a new role and returns the prototype to allow configuration</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the new role, must be unique
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>short_hand</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the shortened version of the name
|
|
|
|
(<em>default</em>: name)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">the start of the config chain for this role</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Role_Actions" class="section-title"><a href="#Role_Actions">Role Actions </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Roles._prototype:set_allow_all" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_allow_all">Roles._prototype:set_allow_all([state=true])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the default allow state of the role, true will allow all actions</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>state</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
true will allow all actions
|
|
|
|
(<em>default</em>: true)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:allow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:allow">Roles._prototype:allow(actions)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the allow actions for this role, actions in this list will be allowed for this role</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>actions</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
indexed with numbers and is an array of action names, order has no effect
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:disallow" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:disallow">Roles._prototype:disallow(actions)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>actions</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
indexed with numbers and is an array of action names, order has no effect
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:is_allowed" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:is_allowed">Roles._prototype:is_allowed(action)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Test for if a role is allowed the given action, mostly internal see Roles.player_allowed</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>action</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the action to test if it is allowed
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if action is allowed, false otherwise</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Role_Flags" class="section-title"><a href="#Role_Flags">Role Flags </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Roles._prototype:set_flag" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_flag">Roles._prototype:set_flag(name[, value=true])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the state of a flag for a role, flags can be used to apply effects to players</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the flag to set the value of
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>value</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
the state to set the flag to
|
|
|
|
(<em>default</em>: true)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:clear_flags" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:clear_flags">Roles._prototype:clear_flags()</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Clears all flags from this role, individual flags can be removed with set_flag(name,false)</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:has_flag" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:has_flag">Roles._prototype:has_flag(name)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">A test for if the role has a flag set</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the flag to test for
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if the flag is set, false otherwise</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Role_Properties" class="section-title"><a href="#Role_Properties">Role Properties </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Roles._prototype:set_custom_tag" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_custom_tag">Roles._prototype:set_custom_tag(tag)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets a custom player tag for the role, can be accessed by other code</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>tag</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the value that the tag will be
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:set_custom_color" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_custom_color">Roles._prototype:set_custom_color(color)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets a custom colour for the role, can be accessed by other code</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>color</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
|
|
?string|table can either be and rgb colour or the name of a colour defined in the presets
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:set_permission_group" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_permission_group">Roles._prototype:set_permission_group(name[, use_factorio_api=false])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the permission group for this role, players will be moved to the group of they highest role</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>name</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the permission group to have players moved to
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>use_factorio_api</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true the custom permission group module is ignored
|
|
|
|
(<em>default</em>: false)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:set_parent" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_parent">Roles._prototype:set_parent(role)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the parent for a role, any action not in allow or disallow will be looked for in its parents
|
|
nb: this is a recursive action, and changing the allows and disallows will effect all children roles</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>role</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the name of the role that will be the parent; has imminent effect if role is already defined
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:set_auto_promote_condition" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_auto_promote_condition">Roles._prototype:set_auto_promote_condition(callback)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will receive the role
|
|
nb: this is one way, failing false after already gaining the role will not revoke the role</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>callback</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.6.html">function</a></span>)
|
|
|
|
receives only one param which is player to promote, return true to promote the player
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:set_block_auto_promote" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:set_block_auto_promote">Roles._prototype:set_block_auto_promote([state=true])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>state</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true the players with this role will not be auto promoted
|
|
|
|
(<em>default</em>: true)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><span class="type">Roles._prototype</span></span>)
|
|
<span class="return-text">allows chaining</span>
|
|
</li>
|
|
</ul>
|
|
<!-- returns end -->
|
|
|
|
|
|
<!-- see also start -->
|
|
<!-- see also end -->
|
|
|
|
<!-- usage start -->
|
|
<!-- usage end -->
|
|
|
|
</dd>
|
|
</dl>
|
|
<h3><span id="Role_Players" class="section-title"><a href="#Role_Players">Role Players </a></span></h3>
|
|
<dl class="section-body-container">
|
|
<dt>
|
|
<div class="divider divider-custom"></div>
|
|
<div class="block section-item-header">
|
|
<a href="#Roles._prototype:add_player" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:add_player">Roles._prototype:add_player(player, skip_check, skip_event)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that will be given this role
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>skip_check</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true player will be taken as the player name (use when player has not yet joined)
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>skip_event</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true the event emit will be skipped, this is used internally with Roles.assign
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if the player was added successfully</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:remove_player" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:remove_player">Roles._prototype:remove_player(player, skip_check, skip_event)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>player</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/LuaPlayer.html">LuaPlayer</a></span>)
|
|
|
|
the player that will lose this role
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>skip_check</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true player will be taken as the player name (use when player has not yet joined)
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>skip_event</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when true the event emit will be skipped, this is used internally with Roles.unassign
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
<span class="return-text">true if the player was removed successfully</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:get_players" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:get_players">Roles._prototype:get_players([online=nil])</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Returns an array of all the players who have this role, can be filtered by online status</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>online</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#boolean">boolean</a></span>)
|
|
|
|
when given will filter by this online state, nil will return all players
|
|
|
|
(<em>default</em>: nil)
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.5.html">table</a></span>)
|
|
<span class="return-text">all the players who have this role, indexed order is meaningless</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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="#Roles._prototype:print" class="fragment-hashtag">#</a>
|
|
<span class="section-item-title" id="Roles._prototype:print">Roles._prototype:print(message)</span>
|
|
</div>
|
|
</dt>
|
|
<dd>
|
|
<div class="section-item-body">
|
|
|
|
<p class="section-item-summary">Will print a message to all players with this role</p>
|
|
<p class="section-item-description"></p>
|
|
|
|
<!-- parameters start -->
|
|
<strong>Parameters:</strong>
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
<li class="section-subitem-li">
|
|
|
|
<strong><em>message</em></strong>
|
|
|
|
<strong> : </strong>
|
|
|
|
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a></span>)
|
|
|
|
the message that will be printed to the players
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- parameters end -->
|
|
|
|
<!-- returns start -->
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li>
|
|
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
|
|
<span class="return-text">the number of players who received the message</span>
|
|
</li>
|
|
</ul>
|
|
<!-- 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-09-22 17:34:57 UTC</i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|