Updated warps

This commit is contained in:
Cooldude2606
2019-10-13 00:25:31 +01:00
parent cf1515c1c8
commit 06030ff2c2
99 changed files with 1517 additions and 1120 deletions

View File

@@ -348,7 +348,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -349,7 +349,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -376,7 +376,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -585,7 +585,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -349,7 +349,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -460,7 +460,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -320,7 +320,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -376,7 +376,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -500,7 +500,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -361,7 +361,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -365,7 +365,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -360,7 +360,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -458,7 +458,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -416,7 +416,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -611,7 +611,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -389,7 +389,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -360,7 +360,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -321,7 +321,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -585,7 +585,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -557,7 +557,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -389,7 +389,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -443,7 +443,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -484,7 +484,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -569,7 +569,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -506,7 +506,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -237,7 +237,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -485,7 +485,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -294,7 +294,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -320,7 +320,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -442,7 +442,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -354,7 +354,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -338,7 +338,7 @@ see ./expcore/commands.lua for more details</p>
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -354,7 +354,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -416,7 +416,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -237,7 +237,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -240,7 +240,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -295,7 +295,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -812,7 +812,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -384,7 +384,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -414,7 +414,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -324,7 +324,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -414,7 +414,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -834,7 +834,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -292,7 +292,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -354,7 +354,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -744,7 +744,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -384,7 +384,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -355,7 +355,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -684,7 +684,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1208,7 +1208,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1329,7 +1329,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1110,7 +1110,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -984,7 +984,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -288,7 +288,7 @@ Tasks.update_task(task_id,<span class="string">'We need more iron!'</span>,game.
</thead>
<tbody>
<tr>
<td class="name"><a href="#add_task">add_task(force_name[, task_number][, player_name])</a></td>
<td class="name"><a href="#add_task">add_task(force_name[, task_number][, player_name][, task_message])</a></td>
<td class="summary">Add a new task for a force, the task can be placed into a certain position for that force</td>
</tr>
<tr>
@@ -597,7 +597,7 @@ Tasks.update_task(task_id,<span class="string">'We need more iron!'</span>,game.
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#add_task" class="fragment-hashtag">#</a>
<span class="section-item-title" id="add_task">add_task(force_name[, task_number][, player_name])</span>
<span class="section-item-title" id="add_task">add_task(force_name[, task_number][, player_name][, task_message])</span>
</div>
</dt>
<dd>
@@ -662,6 +662,23 @@ Tasks.update_task(task_id,<span class="string">'We need more iron!'</span>,game.
</li>
<li class="section-subitem-li">
<strong><em>task_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 is used for this task, if not given default is used
(<em>optional</em>)
</li>
</ul>
<!-- parameters end -->
@@ -981,7 +998,7 @@ Tasks.update_task(task_id,<span class="string">'We need more iron!'</span>,game.
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1465,7 +1465,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -1972,7 +1972,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -2746,7 +2746,7 @@ Common.table_insert(tbl,<span class="number">50</span>,tbl2)</code></pre>
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -10987,7 +10987,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1432,7 +1432,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -3152,7 +3152,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -362,8 +362,12 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<td class="summary">Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present</td>
</tr>
<tr>
<td class="name"><a href="#trigger">trigger(store[, key][, value])</a></td>
<td class="summary">Used to trigger any watchers that are on this store, the key and value are passed to the watcher functions</td>
<td class="name"><a href="#trigger">trigger(store[, key])</a></td>
<td class="summary">Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set</td>
</tr>
<tr>
<td class="name"><a href="#raw_trigger">raw_trigger(store[, key][, value])</a></td>
<td class="summary">Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct</td>
</tr>
</tbody>
</table>
@@ -1252,13 +1256,87 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#trigger" class="fragment-hashtag">#</a>
<span class="section-item-title" id="trigger">trigger(store[, key][, value])</span>
<span class="section-item-title" id="trigger">trigger(store[, key])</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary">Used to trigger any watchers that are on this store, the key and value are passed to the watcher functions</p>
<p class="section-item-summary">Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set</p>
<p class="section-item-description"></p>
<!-- parameters start -->
<strong>Parameters:</strong>
<ul>
<li class="section-subitem-li">
<strong><em>store</em></strong>
<strong> : </strong>
(<span class="types"><a class="type" href="https://www.lua.org/pil/2.3.html">number</a></span>)
the uid of the store that you want to trigger
</li>
<li class="section-subitem-li">
<strong><em>key</em></strong>
<strong> : </strong>
(<span class="types"><a class="type" href="http://lua-api.factorio.com/latest/Builtin-Types.html#string">string</a> or <span class="type">any</span></span>)
the key that you want to trigger, must be a string unless you have a serializer
(<em>optional</em>)
</li>
</ul>
<!-- parameters end -->
<!-- returns start -->
<!-- returns end -->
<!-- see also start -->
<!-- see also end -->
<!-- usage start -->
<strong>Usage:</strong>
<pre class="code" data-lang="Lua"><code><span class="comment">-- Faking the update to a store
</span><span class="comment">-- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting
</span><span class="keyword">local</span> scenario_diffculty = Store.register()
<span class="comment">-- Trigger the watchers with a fake change of diffculty
</span>Store.trigger(scenario_diffculty)</code></pre>
<!-- usage end -->
</dd>
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#raw_trigger" class="fragment-hashtag">#</a>
<span class="section-item-title" id="raw_trigger">raw_trigger(store[, key][, value])</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary">Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct</p>
<p class="section-item-description"></p>
<!-- parameters start -->
@@ -1336,7 +1414,7 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<span class="comment">-- Trigger the watchers with a fake change of diffculty
</span><span class="comment">-- This is mostly used internally but it can be useful in other cases
</span>Store.trigger(scenario_diffculty,<span class="keyword">nil</span>,<span class="string">'normal'</span>)</code></pre>
</span>Store.raw_trigger(scenario_diffculty,<span class="keyword">nil</span>,<span class="string">'normal'</span>)</code></pre>
<!-- usage end -->
</dd>
@@ -1355,7 +1433,7 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -544,7 +544,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -626,7 +626,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -629,7 +629,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -449,7 +449,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -632,7 +632,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -837,7 +837,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -118,7 +118,7 @@
<tr>
<td class="name"><a href="control/Warps.html">Warps</a></td>
<td class="summary"><span>Control Module - Warps
- Stores warps for each force.</span></td>
- Stores warps for each force.</span></td>
</tr>
</table>
<h2>Addons</h2>
@@ -514,7 +514,7 @@ see ./expcore/commands.lua for more details</span></td>
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -351,7 +351,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -419,7 +419,7 @@ fraction will decide a chance to spawn. 1 alien for 2 spawner's will have 50% on
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1164,7 +1164,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -654,7 +654,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -323,7 +323,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1292,7 +1292,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -434,7 +434,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -353,7 +353,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -441,7 +441,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -752,7 +752,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -1418,7 +1418,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -651,7 +651,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -442,7 +442,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -789,7 +789,7 @@ Public License instead of this License. But first, please read
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -333,7 +333,7 @@
<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-10-11 23:24:57 UTC</i>
<i>Last updated 2019-10-13 00:25:15 UTC</i>
</div>
</div>
</div>

View File

@@ -98,11 +98,7 @@ function Constructor.store(sync,callback)
if not sync then
categorize = location
location = Store.uid_location()
end
if Store.is_registered(location) then
return error('Location for store is already registered: '..location,2)
location = Store.register()
end
self.store = location
@@ -110,7 +106,7 @@ function Constructor.store(sync,callback)
Instances.register(self.name,self.categorize)
Store.register(self.store,sync,function(value,category)
Store.watch(self.store,function(value,category)
self:raise_event('on_store_update',value,category)
if Instances.is_registered(self.name) then

View File

@@ -650,8 +650,8 @@ end)
Event.add(defines.events.on_tick,function()
progressbar_one:increment()
progressbar_three:decrement()
local categories = Store.get_children(progressbar_two.store)
for _,category in pairs(categories) do
local categories = Store.get(progressbar_two.store) or {}
for category,_ in pairs(categories) do
progressbar_two:increment(1,category)
end
end)

View File

@@ -99,7 +99,7 @@ function Store.validate(store,key,error_stack)
if not success then
-- Serializer casued an error while serializing the key
error('Store watcher casued an error: '..key,error_stack+1)
error('Store watcher casued an error:\n\t'..key,error_stack+1)
elseif type(key) ~= 'string' then
-- Serializer was successful but failed to return a string value
error('Store key serializer did not return a string; recived type '..type(key),error_stack+1)
@@ -227,7 +227,12 @@ function Store.get(store,key)
-- Get the data from the data store
local data = data_store[store]
if key then
return data[key]
if type(data) ~= 'table' then
data_store[store] = {_value = data_store[store]}
return nil
else
return data[key]
end
end
-- Return all data if there is no key
@@ -269,7 +274,7 @@ function Store.clear(store,key)
end
-- Trigger any watch functions
Store.trigger(store,key,nil)
Store.raw_trigger(store,key,nil)
end
--[[-- Used to set the data in a store, will trigger any watchers, key is optional depending on if you are using them
@@ -321,7 +326,7 @@ function Store.set(store,key,value)
end
-- Trigger any watchers
Store.trigger(store,key,value)
Store.raw_trigger(store,key,value)
end
--[[-- Used to update the data in a store, use this with tables, will trigger any watchers, key is optional depending on if you are using them
@@ -396,7 +401,7 @@ function Store.update(store,key,updater)
end
-- Trigger any watchers
Store.trigger(store,key,value)
Store.raw_trigger(store,key,value)
end
--[[-- Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present
@@ -439,11 +444,34 @@ function Store.map(store,updater)
if rtn then
data[key] = rtn
end
Store.trigger(store,key,data[key])
Store.raw_trigger(store,key,data[key])
end
end
--[[-- Used to trigger any watchers that are on this store, the key and value are passed to the watcher functions
--[[-- Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set
@tparam number store the uid of the store that you want to trigger
@tparam[opt] ?string|any key the key that you want to trigger, must be a string unless you have a serializer
@usage-- Faking the update to a store
-- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting
local scenario_diffculty = Store.register()
-- Trigger the watchers with a fake change of diffculty
Store.trigger(scenario_diffculty)
]]
function Store.trigger(store,key)
key = Store.validate(store,key,2)
-- Get the data from the data store
local data = data_store[store]
if key then
Store.raw_trigger(store,key,data[key])
else
Store.raw_trigger(store,key,data)
end
end
--[[-- Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct
@tparam number store the uid of the store that you want to trigger
@tparam[opt] ?string|any key the key that you want to trigger, must be a string unless you have a serializer
@tparam[opt] any value the new value that is at this key or store, passed directly to the watcher
@@ -454,18 +482,18 @@ local scenario_diffculty = Store.register()
-- Trigger the watchers with a fake change of diffculty
-- This is mostly used internally but it can be useful in other cases
Store.trigger(scenario_diffculty,nil,'normal')
Store.raw_trigger(scenario_diffculty,nil,'normal')
]]
function Store.trigger(store,key,value)
function Store.raw_trigger(store,key,value)
key = Store.validate(store,key,2)
-- Get the watchers and then loop over them
local watchers = Store.watchers[store]
local watchers = Store.watchers[store] or {}
for _,watcher in pairs(watchers) do
local success, err = pcall(watcher,value,key)
if not success then
error('Store watcher casued an error: '..err)
error('Store watcher casued an error:\n\t'..err)
end
end
end

View File

@@ -34,15 +34,17 @@ Tasks.store = task_store
@tparam string force_name the name of the force to add the task for
@tparam[opt] number task_number the order place to add the task to, appends to end if omited
@tparam[opt] string player_name the player who added this task, will cause them to be listed under editing
@tparam[opt] string task_message the message that is used for this task, if not given default is used
@treturn string the uid of the task which was created
@usage-- Adding a new task for your force
local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name)
]]
function Tasks.add_task(force_name,task_number,player_name)
function Tasks.add_task(force_name,task_number,player_name,task_message)
-- Get a new task id
local task_id = tostring(Token.uid())
task_message = task_message or 'New Task'
-- Get the existing tasks for this force
local tasks = force_tasks[force_name]
@@ -68,7 +70,7 @@ function Tasks.add_task(force_name,task_number,player_name)
Store.set(task_store,task_id,{
task_id = task_id,
force_name = force_name,
message = 'New Task',
message = task_message,
last_edit_name = player_name or '<server>',
last_edit_time = game.tick,
curently_editing = editing

View File

@@ -1,27 +1,23 @@
--[[-- Control Module - Warps
- Stores warps for each force.
@control Warps
@alias Warps
- Stores warps for each force.
@control Warps
@alias Warps
@usage
-- import the module from the control modules
local Warps = require 'modules.control.warps' --- @dep modules.control.warps
@usage-- Making a new spawn warp
local player = game.player
local force = player.force
local spawn_id = Warps.add_warp(force.name,player.surface,player.position,player.name,'Spawn')
-- Adding a warp require a force, surface and postion, and the option to set this as the spawn
-- this function will also create the warp area unless set other wise
Warps.new_warp('player',surface,{x=0,y=0})
Warps.set_spawn_warp(spawn_id, force)
Warps.make_warp_tag(spawn_id)
-- You can then update the warp information, name and icon, with the update function
Warps.update_warp(warp_id,'Best Warp','iron-plate')
@usage-- Making a new warp with a warp area
local player = game.player
local force = player.force
local warp_id = Warps.add_warp(force.name,player.surface,player.position,player.name)
-- Removeing a warp will restore the land that as under it, and remove any data linked with it
Warps.remove_warp(warp_id)
-- You can get the deatils for a warp which include last edit and postion
Warps.get_details(warp_id)
-- You can teleport a player to a warp, note that there is no limit on this action
Warps.teleport_player(warp_id,player)
Warps.make_warp_area(warp_id)
Warps.make_warp_tag(warp_id)
]]
@@ -31,153 +27,139 @@ local Token = require 'utils.token' --- @dep utils.token
local config = require 'config.warps' --- @dep config.warps
local table_values,table_keysort = ext_require('expcore.common','table_values','table_keysort') --- @dep expcore.common
local Warps = {
store = {
names = 'gui.left.warps.names',
icons = 'gui.left.warps.tags'
},
details = {},
forces = {},
handlers = {}
}
local Warps = {}
local warp_details = Warps.details
local force_warps = Warps.forces
Global.register({
warp_details=warp_details,
force_warps=force_warps
},function(tbl)
Warps.details = tbl.warp_details
Warps.forces = tbl.force_warps
warp_details = Warps.details
force_warps = Warps.forces
-- Global lookup table for force name to task ids
local force_warps = {}
Global.register(force_warps,function(tbl)
force_warps = tbl
end)
local warp_names = Warps.store.names
Store.register(warp_names,function(value,warp_id)
local details = warp_details[warp_id]
local force_name = details.force
local force = game.forces[force_name]
local warps = force_warps[force_name]
local spawn_id = warps.spawn
-- Warp store is keyed by warp id, value is a table
local warp_store = Store.register()
Warps.store = warp_store
local names = {}
for _,next_warp_id in pairs(warps) do
local warp_name = Store.get(warp_names,next_warp_id)
if next_warp_id ~= spawn_id then
names[warp_name..next_warp_id] = next_warp_id
-- When a warp is updated change its chat tag and resort the warp order
Store.watch(warp_store,function(warp,warp_id)
if warp then
-- Update the map chart tag if there is one
if warp.tag then
Warps.make_warp_tag(warp_id)
end
end
force_warps[force_name] = table_values(table_keysort(names))
table.insert(force_warps[force.name],1,spawn_id)
force_warps[force_name].spawn = spawn_id
-- Check that the name of the warp has been changed
if warp.name == warp.old_name then return end
for _,handler in pairs(Warps.handlers) do
handler(force,warp_id)
-- Get the names of all the warp points for this force
local force_name = warp.force_name
local warp_ids = force_warps[force_name]
local spawn_id = warp_ids.spawn
local warp_names = {}
for _,next_warp_id in pairs(warp_ids) do
local next_warp = Store.get(warp_store,next_warp_id)
if next_warp_id ~= spawn_id then
warp_names[next_warp.name..next_warp_id] = next_warp_id
end
end
-- Sort the warp names in alphabetical order
local new_warp_ids = table_values(table_keysort(warp_names))
table.insert(new_warp_ids,1,spawn_id)
new_warp_ids.spawn = spawn_id
force_warps[force_name] = new_warp_ids
end
end)
local warp_icons = Warps.store.icons
Store.register(warp_icons,function(value,warp_id)
if value then
Warps.make_chart_tag(warp_id)
else
local warp = warp_details[warp_id]
if warp.tag and warp.tag.valid then warp.tag.destroy() end
end
end)
--- Generators.
--- Map Intergration.
-- functions used to create and alter warps with in the map
-- @section generators
-- @section mapIntergration
--- Adds or updates the chart tag for a warp
-- @tparam string warp_id the uid of the warp you want to make the chart tag for
-- @treturn boolean true if a new tag was made, false if it was updated
function Warps.make_chart_tag(warp_id)
local warp = warp_details[warp_id]
--[[-- Add or update the chat tag for this warp
@tparam string warp_id the uid of the warp you want the chart tag for
@treturn boolean true if a new tag was made, false if it was updated
local name = Store.get(warp_names,warp_id)
local icon = Store.get(warp_icons,warp_id)
@usage-- Adding a chart tag for a new warp
local tag_added = Warps.make_warp_tag(warp_id)
if warp.tag and warp.tag.valid then
warp.tag.text = 'Warp: '..name
warp.tag.icon = {type='item',name=icon}
]]
function Warps.make_warp_tag(warp_id)
local warp = Store.get(warp_store,warp_id)
local name = warp.name
local icon = warp.icon
-- Edit the existing tag if it is present
local tag = warp.tag
if tag and tag.valid then
tag.text = 'Warp: '..name
tag.icon = {type='item',name=icon}
return false
end
local force = game.forces[warp.force]
-- Make a new tag if one did not exist
local force = game.forces[warp.force_name]
local surface = warp.surface
local position = warp.position
local tag = force.add_chart_tag(surface,{
position={position.x+0.5,position.y+0.5},
text='Warp: '..name,
icon={type='item',name=icon}
tag = force.add_chart_tag(surface,{
position = {position.x+0.5,position.y+0.5},
text = 'Warp: '..name,
icon = {type='item',name=icon}
})
-- Add the tag to this warp, store.update not needed as we dont want it to trigger
warp.tag = tag
return true
end
--- Adds a new warp to a force and makes the in game warp area
-- @tparam string force_name the name of the force to add a new warp for
-- @tparam LuaSurface surface the surface to add the warp to
-- @tparam Position position the postion to have the warp go to
-- @tparam[opt='server'] string player_name the name of the player who added this warp
-- @tparam[opt='New warp'] string warp_name the name of the warp that will be made
-- @tparam[opt=false] boolean block_generation when true a in game area will not be made
-- @tparam[opt=false] boolean set_spawn when true this warp will become the spawn for the force
function Warps.new_warp(force_name,surface,position,player_name,warp_name,block_generation,set_spawn)
local warp_id = tostring(Token.uid())
warp_name = warp_name or 'New warp'
--[[-- Remove the chart tag for this warp
@tparam string warp_id the uid for the warp that you want to remove the chart tag from
@treturn boolean true if the tag was valid and was removed, false if the tag was invalid
if not force_warps[force_name] then
force_warps[force_name] = {}
end
table.insert(force_warps[force_name],warp_id)
@usage-- Removing the chart tag from a warp
local removed = Warps.remove_warp_tag(warp_id)
warp_details[warp_id] = {
warp_id = warp_id,
force = force_name,
position = {
x=math.floor(position.x),
y=math.floor(position.y)
},
surface = surface,
last_edit_player=player_name or '<server>',
last_edit_time=game.tick,
editing={}
}
]]
function Warps.remove_warp_tag(warp_id)
local warp = Store.get(warp_store,warp_id)
local warp = warp_details[warp_id]
if player_name then
warp.editing[player_name] = true
-- Check there is a tag to remove
local tag = warp.tag
if not tag or not tag.valid then
warp.tag = nil
return false
end
if set_spawn then
force_warps[force_name].spawn = warp_id
game.forces[force_name].set_spawn_position(position,surface)
end
-- Remove the warp chart tag if it is valid
tag.destroy()
warp.tag = nil
Store.set(warp_names,warp_id,warp_name)
Store.set(warp_icons,warp_id,config.default_icon)
return true
end
if block_generation then return warp_id end
--[[-- Add a warp area for the warp, purely cosmetic
@tparam string warp_id the uid of the warp you want the area for
@usage-- Adding a warp area for a warp
Warps.make_warp_area(warp_id)
]]
function Warps.make_warp_area(warp_id)
local warp = Store.get(warp_store,warp_id)
local surface = warp.surface
local position = warp.position
local posx = position.x
local posy = position.y
local radius = config.activation_range
local radius2 = radius^2
-- Get the tile that is being replaced, store.update not needed as we dont want it to trigger
local old_tile = surface.get_tile(position).name
warp.old_tile = old_tile
-- Make a circle that acts as a base for the warp structure
local base_tile = config.base_tile
local base_tiles = {}
-- this makes a base plate to make the warp point
for x = -radius, radius do
local x2 = x^2
for y = -radius, radius do
@@ -189,14 +171,14 @@ function Warps.new_warp(force_name,surface,position,player_name,warp_name,block_
end
surface.set_tiles(base_tiles)
-- this adds the tile pattern
-- Add a tile patern ontop of the base
local tiles = {}
for _,pos in pairs(config.tiles) do
table.insert(tiles,{name=base_tile,position={pos[1]+posx,pos[2]+posy}})
end
surface.set_tiles(tiles)
-- this adds the enitites
-- Add entities to the warp structure
for _,entity in pairs(config.entities) do
entity = surface.create_entity{
name=entity[1],
@@ -208,29 +190,28 @@ function Warps.new_warp(force_name,surface,position,player_name,warp_name,block_
entity.minable = false
entity.rotatable = false
end
return warp_id
end
--- Removes a warp and clears the area where it was added
-- @tparam string warp_id the uid of the warp that you want to remove
function Warps.remove_warp(warp_id)
local force_name = warp_details[warp_id].force
local warps = force_warps[force_name]
local key = table.index_of(warps,warp_id)
warps[key] = nil
Store.clear(warp_names,warp_id)
Store.clear(warp_icons,warp_id)
--[[-- Remove the warp area for a warp
@tparam string warp_id the uid of the warp that you want to remove the area for
local warp = warp_details[warp_id]
@usage-- Remove the warp area for a warp
Warps.remove_warp_area(warp_id)
]]
function Warps.remove_warp_area(warp_id)
local warp = Store.get(warp_store,warp_id)
local position = warp.position
local surface = warp.surface
local radius = config.activation_range
local radius2 = radius^2
-- Check that a warp area was created previously
local base_tile = warp.old_tile
if not base_tile then return end
-- Reset all the tiles that were replaced
local tiles = {}
-- clears the area where the warp was
for x = -radius, radius do
local x2 = x^2
for y = -radius, radius do
@@ -242,7 +223,7 @@ function Warps.remove_warp(warp_id)
end
surface.set_tiles(tiles)
-- removes all entites (in the area) on the neutral force
-- Remove all the entites that are in the area
local entities = surface.find_entities_filtered{
force='neutral',
area={
@@ -251,108 +232,230 @@ function Warps.remove_warp(warp_id)
}
}
for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end
warp_details[warp_id] = nil
end
--- Setters.
-- functions used to created and alter warps
-- @section setters
--[[-- Set a warp to be the spawn point for a force, force must own this warp
@tparam string warp_id the uid of the warp that you want to be the spawn for the force
@tparam LuaForce force the force that you want to set the spawn for
--- Adds a new handler for when a warp is updated
-- @tparam function callback the callback which is ran when a warp is updated
-- @treturn boolean true if the callback was added
function Warps.add_handler(callback)
if type(callback) == 'function' then
table.insert(Warps.handlers,callback)
return true
@usage-- Set your forces spawn to a warp
Warps.set_spawn_warp(warp_id,game.player.force)
]]
function Warps.set_spawn_warp(warp_id,force)
-- Check the force owns this warp
local warp = Store.get(warp_store,warp_id)
if warp.force_name ~= force.name then return end
-- Set this warp as the spawn
local warp_ids = force_warps[warp.force_name]
if not warp_ids then
warp_ids = {}
force_warps[warp.force_name] = warp_ids
end
return false
warp_ids.spawn = warp_id
-- Set the forces spawn to this warp
force.set_spawn_position(warp.position, warp.surface)
end
--- Sets a player to be editing this warp, used with is_editing
-- @tparam string warp_id the uid of the warp that you want to editing for
-- @tparam string player_name the name of the player you want to set editing for
-- @tparam[opt] boolean state the new state to set editing to
function Warps.set_editing(warp_id,player_name,state)
local details = warp_details[warp_id]
details.editing[player_name] = state
end
--[[-- Teleport a player to a warp point
@tparam string warp_id the uid of the warp to send the player to
@tparam LuaPlayer player the player to teleport to the warp
--- Updates a warp to a differecnt name and icon, both must be given
-- @tparam string warp_id the uid of the warp that you want to update
-- @tparam string name the name that you want the warp to have
-- @tparam string icon the new icon that you want the warp to have
-- @tparam[opt='server'] string player_name the name of the player that is updating the warp
function Warps.update_warp(warp_id,name,icon,player_name)
local warp = warp_details[warp_id]
warp.last_edit_player = player_name or '<server>'
warp.last_edit_time = game.tick
Store.set(warp_icons,warp_id,icon)
Store.set(warp_names,warp_id,name)
end
@usage-- Teleport yourself to a warp point
Warps.teleport_player(warp_id,game.player)
--- Getters.
-- function used to get information about warps
-- @section getters
--- Gets the name of a warp
-- @tparam string warp_id the uid of the warp you want to get
-- @treturn string the warp name that was stored here
function Warps.get_warp_name(warp_id)
return Store.get(warp_names,warp_id)
end
--- Gets the icon of a warp
-- @tparam string warp_id the uid of the warp you want to get
-- @treturn string the warp icon that was stored here
function Warps.get_warp_icon(warp_id)
return Store.get(warp_icons,warp_id) or config.default_icon
end
--- Gets the task details stored at this id
-- @tparam string warp_id the uid of the warp you want to get
-- @treturn table the warp details that was stored here
function Warps.get_details(warp_id)
return warp_details[warp_id]
end
--- Gets all warps for a force
-- @tparam string force_name the name of the force to get the warps for
-- @treturn table an array of warp ids that belong to this force, spawn key is included
function Warps.get_warps(force_name)
return force_warps[force_name] or {}
end
--- Gets all warps from all forces
-- @treturn table array of all warp details
function Warps.get_all_warps()
return warp_details
end
--- Gets if a player is currently editing this warp
-- @tparam string warp_id the uid of the warp you want to check
-- @tparam string player_name the name of the player that you want to check
-- @treturn boolean weather the player is currently editing this warp
function Warps.is_editing(warp_id,player_name)
local details = warp_details[warp_id]
return details.editing[player_name]
end
--- Teleports a player to a warp point
-- @tparam string warp_id the uid of the warp to send the player to
-- @tparam LuaPlayer player the player to teleport to the warp
]]
function Warps.teleport_player(warp_id,player)
local warp = warp_details[warp_id]
local warp = Store.get(warp_store,warp_id)
local surface = warp.surface
local position = {
x=warp.position.x+0.5,
y=warp.position.y+0.5
}
-- Teleport the player
local goto_position = surface.find_non_colliding_position('character',position,32,1)
if player.driving then player.driving = false end
player.teleport(goto_position,surface)
end
--- Setters.
-- functions used to created and alter warps
-- @section setters
--[[-- Add a new warp for a force, the warp must have a surface and a position
@tparam string force_name the name of the force to add the warp for
@tparam LuaSurface surface the surface that the warp will be on
@tparam Concepts.Position position the position that the warp will be on
@tparam[opt] string player_name the name of the player that is adding the warp
@tparam[opt] string warp_name the name of the warp that is being added, if omited default is used
@treturn string the uid of the warp which was created
@usage-- Adding a new warp for your force at your position
local player = game.player
local warp_id = Warps.add_warp(player.force.name,player.surface,player.position,player.name)
]]
function Warps.add_warp(force_name,surface,position,player_name,warp_name)
-- Get new warp id
local warp_id = tostring(Token.uid())
warp_name = warp_name or 'New warp'
-- Get the existing warps for this force
local warps = force_warps[force_name]
if not warps then
force_warps[force_name] = {}
warps = force_warps[force_name]
end
-- Insert the warp id into the force warps
table.insert(warps,warp_id)
-- Create the editing table
local editing = {}
if player_name then
editing[player_name] = true
end
-- Add the new warp to the store
Store.set(warp_store,warp_id,{
warp_id = warp_id,
force_name = force_name,
name = warp_name,
icon = config.default_icon,
surface = surface,
position = {
x = math.floor(position.x),
y = math.floor(position.y)
},
last_edit_name = player_name or '<server>',
last_edit_time = game.tick,
currently_editing = editing
})
return warp_id
end
--[[-- Removes a warp and any data linked to it
@tparam string warp_id the uid of the warp that you want to remove
@usage-- Removing a warp
Warps.remove_warp(warp_id)
]]
function Warps.remove_warp(warp_id)
local warp = Store.get(warp_store,warp_id)
local force_name = warp.force_name
Warps.remove_warp_tag(warp_id)
Warps.remove_warp_area(warp_id)
Store.clear(warp_store,warp_id)
table.remove_element(force_warps[force_name],warp_id)
end
--[[-- Update the name and icon for a warp
@tparam string warp_id the uid of the warp that you want to update
@tparam[opt] string new_name the new name that you want the warp to have
@tparam[opt] string new_icon the new icon that you want the warp to have
@tparam[opt='server'] string player_name the name of the player that made the edit
@usage-- Changing the name and icon for a warp
Warps.update_warp(warp_id,'My Warp','iron-plate',game.player.name)
]]
function Warps.update_warp(warp_id,new_name,new_icon,player_name)
Store.update(warp_store,warp_id,function(warp)
warp.last_edit_name = player_name or '<server>'
warp.last_edit_time = game.tick
warp.old_name = warp.name
warp.name = new_name or warp.name
warp.icon = new_icon or warp.icon
end)
end
--[[-- Set the editing state for a player, can be used as a warning or to display a text field
@tparam string warp_id the uid of the warp that you want to effect
@tparam string player_name the name of the player you want to set the state for
@tparam boolean state the new state to set editing to
@usage-- Setting your editing state to true
Warps.set_editing(warp_id,game.player.name,true)
]]
function Warps.set_editing(warp_id,player_name,state)
Store.update(warp_store,warp_id,function(warp)
warp.currently_editing[player_name] = state
end)
end
--[[-- Adds an update handler for when a warp is added, removed, or updated
@tparam function handler the handler which is called when a warp is updated
@usage-- Add a game print when a warp is updated
Warps.on_update(function(warp)
game.print(warp.force_name..' now has the warp: '..warp.name)
end)
]]
function Warps.on_update(handler)
Store.watch(warp_store,handler)
end
--- Getters.
-- function used to get information about warps
-- @section getters
--[[-- Gets the warp information that is linked with this id
@tparam string warp_id the uid of the warp you want to get
@treturn table the warp information
@usage-- Getting warp information outside of on_update
local warp = Warps.get_warp(warp_id)
]]
function Warps.get_warp(warp_id)
return Store.get(warp_store,warp_id)
end
--[[-- Gets all the warp ids that a force has
@tparam string force_name the name of the force that you want the warp ids for
@treturn table an array of all the warp ids
@usage-- Getting the warp ids for a force
local warp_ids = Warps.get_force_warp_ids(game.player.force.name)
]]
function Warps.get_force_warp_ids(force_name)
return force_warps[force_name] or {}
end
--[[-- Get the id of the spawn warp
@tparam string force_name the name of the force that you want to get the spawn warp for
@treturn ?string|nil the uid of the spawn warp for this force if there is one
@usage-- Getting the spawn warp id
local spawn_id = Warps.get_spawn_warp_id(game.player.force.name)
]]
function Warps.get_spawn_warp_id(force_name)
local warp_ids = force_warps[force_name] or {}
return warp_ids.spawn
end
--[[-- Gets the editing state for a player
@tparam string warp_id the uid of the warp you want to check
@tparam string player_name the name of the player that you want to check
@treturn boolean weather the player is currently editing this warp
@usage-- Check if a player is editing a warp or not
local editing = Warps.get_editing(warp_id,game.player.name)
]]
function Warps.get_editing(warp_id,player_name)
local warp = Store.get(warp_store,warp_id)
return warp.currently_editing[player_name]
end
-- Module return
return Warps

View File

@@ -14,7 +14,7 @@ local Tasks = require 'modules.control.tasks' --- @dep modules.control.tasks
--- If a player is allowed to use the edit buttons
local function player_allowed_edit(player,task)
if task then
if config.user_can_edit_own_tasks and task.last_edit_player == player.name then
if config.user_can_edit_own_tasks and task.last_edit_name == player.name then
return true
end
else

View File

@@ -15,22 +15,25 @@ local config = require 'config.warps' --- @dep config.warps
local format_time,table_keys = ext_require('expcore.common','format_time','table_keys') --- @dep expcore.common
local Warps = require 'modules.control.warps' --- @dep modules.control.warps
local warp_player_in_range_store = 'gui.left.warps.in_range'
-- Stores a boolean value indexed by player name
local player_in_range_store = Store.register(function(player)
return player.name
end)
local keep_open = {}
Global.register(keep_open,function(tbl)
keep_open = tbl
-- Table that stores a boolean value of weather to keep the warp gui open
local keep_gui_open = {}
Global.register(keep_gui_open,function(tbl)
keep_gui_open = tbl
end)
--- Returns if a player is allowed to edit the given warp
local function player_allowed_edit(player,warp_id)
if warp_id then
local details = Warps.get_details(warp_id)
local warps = Warps.get_warps(player.force.name)
if warps.spawn == warp_id then
local function player_allowed_edit(player,warp)
if warp then
local spawn_id = Warps.get_spawn_warp_id(player.force.name)
if spawn_id == warp.warp_id then
return false
end
if config.user_can_edit_own_warps and details.last_edit_player == player.name then
if config.user_can_edit_own_warps and warp.last_edit_name == player.name then
return true
end
else
@@ -55,7 +58,7 @@ end
local zoom_to_map_name = Gui.uid_name()
Gui.on_click(zoom_to_map_name,function(event)
local warp_id = event.element.parent.name
local warp = Warps.get_details(warp_id)
local warp = Warps.get_warp(warp_id)
local position = warp.position
event.player.zoom_to_world(position,1.5)
end)
@@ -73,9 +76,7 @@ Gui.new_progressbar()
style.color = Colors.light_blue
end)
:on_store_complete(function(player_name,reset)
-- this is to force an update of the button
local in_range = Store.get(warp_player_in_range_store,player_name)
Store.set(warp_player_in_range_store,player_name,in_range)
Store.trigger(player_in_range_store,player_name)
end)
--- When the button is clicked it will teleport the player
@@ -92,11 +93,10 @@ end)
local warp_id = element.parent.caption
Warps.teleport_player(warp_id,player)
-- Reset the warp cooldown if the player does not have unlimited warps
if config.bypass_warp_limits_permision and not Roles.player_allowed(player,config.bypass_warp_limits_permision) then
warp_timer:set_store(player.name,0)
-- this is to force an update of the buttons
local in_range = Store.get(warp_player_in_range_store,player.name)
Store.set(warp_player_in_range_store,player.name,in_range)
Store.trigger(player_in_range_store,player)
end
end)
@@ -112,22 +112,28 @@ Gui.new_button()
style.width = 20
end)
:on_click(function(player,element)
local force_name = player.force.name
local surface = player.surface
local position = player.position
local px = position.x
local py = position.y
local dist2 = config.minimum_distance^2
local warps = Warps.get_all_warps()
for warp_id,warp in pairs(warps) do
-- Check the distance to all existing warps
local warp_ids = Warps.get_force_warp_ids(force_name)
for _,warp_id in pairs(warp_ids) do
local warp = Warps.get_warp(warp_id)
local pos = warp.position
if (px-pos.x)^2+(py-pos.y)^2 < dist2 then
local warp_name = Warps.get_warp_name(warp_id)
player.print{'warp-list.too-close',warp_name}
if surface == warp.surface and (px-pos.x)^2+(py-pos.y)^2 < dist2 then
player.print{'warp-list.too-close',warp.name}
return
end
end
Warps.new_warp(player.force.name,player.surface,position,player.name)
-- Add the new warp
local warp_id = Warps.add_warp(force_name,surface,position,player.name)
Warps.make_warp_tag(warp_id)
Warps.make_warp_area(warp_id)
end)
--- Confirms the edit to name or icon of the warp
@@ -151,7 +157,6 @@ end)
--- Cancels the editing changes of the selected warp name or icon
-- @element cancel_edit
local generate_warp
local cancel_edit =
Gui.new_button()
:set_sprites('utility/close_black')
@@ -164,7 +169,6 @@ end)
:on_click(function(player,element)
local warp_id = element.parent.name
Warps.set_editing(warp_id,player.name)
generate_warp(player,element.parent.parent,warp_id)
end)
--- Removes a warp from the list, including the physical area and map tag
@@ -197,7 +201,6 @@ end)
:on_click(function(player,element)
local warp_id = element.parent.name
Warps.set_editing(warp_id,player.name,true)
generate_warp(player,element.parent.parent.parent,warp_id)
end)
--[[ Generates each warp, handles both view and edit mode
@@ -213,23 +216,22 @@ end)
>>> edit_warp
>>> discard_warp
]]
function generate_warp(player,element,warp_id)
local warp_name = Warps.get_warp_name(warp_id)
local warp_icon = Warps.get_warp_icon(warp_id)
local warp = Warps.get_details(warp_id)
local editing = Warps.is_editing(warp_id,player.name)
local last_edit_player = warp.last_edit_player
local last_edit_time = warp.last_edit_time
local position = warp.position
if not warp_name then
local function generate_warp(player,element,warp_id)
local warp = Warps.get_warp(warp_id)
if not warp then
-- warp is nil so remove it from the list
Gui.destroy_if_valid(element['icon-'..warp_id])
Gui.destroy_if_valid(element['edit-'..warp_id])
Gui.destroy_if_valid(element[warp_id])
else
local warp_name = warp.name
local warp_icon = warp.icon
local editing = warp.currently_editing[player.name]
local last_edit_name = warp.last_edit_name
local last_edit_time = warp.last_edit_time
local position = warp.position
-- if it is not already present then add it now
local warp_area = element[warp_id]
local icon_area = element['icon-'..warp_id]
@@ -261,8 +263,8 @@ function generate_warp(player,element,warp_id)
end
local edit_area = element['edit-'..warp_id][warp_id]
local players = warp.editing and table_keys(warp.editing) or {}
local allowed = player_allowed_edit(player,warp_id)
local players = warp.currently_editing and table_keys(warp.currently_editing) or {}
local allowed = player_allowed_edit(player,warp)
edit_area.visible = allowed
@@ -278,7 +280,7 @@ function generate_warp(player,element,warp_id)
if not editing and element_type == 'label' then
-- update the label already present
label_element.caption = warp_name
label_element.tooltip = {'warp-list.last-edit',last_edit_player,format_time(last_edit_time)}
label_element.tooltip = {'warp-list.last-edit',last_edit_name,format_time(last_edit_time)}
icon_area[goto_warp.name].sprite = 'item/'..warp_icon
elseif not editing then
@@ -295,7 +297,7 @@ function generate_warp(player,element,warp_id)
btn.tooltip = {'warp-list.goto-tooltip',position.x,position.y}
local timer = warp_timer:get_store(player.name)
local enabled = not timer and Store.get(warp_player_in_range_store,player.name)
local enabled = not timer and Store.get(player_in_range_store,player)
or Roles.player_allowed(player,config.bypass_warp_limits_permission)
if not enabled then
btn.enabled = false
@@ -310,7 +312,7 @@ function generate_warp(player,element,warp_id)
name=zoom_to_map_name,
type='label',
caption=warp_name,
tooltip={'warp-list.last-edit',last_edit_player,format_time(last_edit_time)}
tooltip={'warp-list.last-edit',last_edit_name,format_time(last_edit_time)}
}
label.style.single_line = false
label.style.maximal_width = 150
@@ -412,38 +414,30 @@ Gui.new_left_frame('gui/warp-list')
:set_direction('vertical')
:on_creation(function(player,element)
local data_table = generate_container(player,element)
local warps = Warps.get_warps(player.force.name)
local warp_ids = Warps.get_force_warp_ids(player.force.name)
for key,warp_id in pairs(warps) do
if key ~= 'spawn' then
generate_warp(player,data_table,warp_id)
end
for _,warp_id in ipairs(warp_ids) do
generate_warp(player,data_table,warp_id)
end
end)
:on_update(function(player,element)
local data_table = element.container.scroll.table
local warps = Warps.get_warps(player.force.name)
local warp_ids = Warps.get_force_warp_ids(player.force.name)
data_table.clear()
for key,warp_id in pairs(warps) do
if key ~= 'spawn' then
generate_warp(player,data_table,warp_id)
end
for _,warp_id in ipairs(warp_ids) do
generate_warp(player,data_table,warp_id)
end
end)
:on_player_toggle(function(player,element,visible)
keep_open[player.name] = visible
keep_gui_open[player.name] = visible
end)
--- When the name of a warp is updated this is triggered
Warps.add_handler(function(force,warp_id)
for _,player in pairs(force.players) do
warp_list:update(player)
end
end)
Warps.on_update(warp_list 'update_all')
--- When the player leaves or enters range of a warp this is triggered
Store.register(warp_player_in_range_store,function(value,player_name)
Store.register(player_in_range_store,function(value,player_name)
local player = game.players[player_name]
local force = player.force
local frame = warp_list:get_frame(player_name)
@@ -451,7 +445,7 @@ Store.register(warp_player_in_range_store,function(value,player_name)
local timer = warp_timer:get_store(player_name)
local state = not timer and value
if not keep_open[player.name] then
if not keep_gui_open[player.name] then
Gui.toggle_left_frame(warp_list.name,player,value)
end
@@ -459,8 +453,8 @@ Store.register(warp_player_in_range_store,function(value,player_name)
return
end
local warps = Warps.get_warps(force.name)
for _,warp_id in pairs(warps) do
local warp_ids = Warps.get_force_warp_ids(force.name)
for _,warp_id in pairs(warp_ids) do
local element = table_area['icon-'..warp_id][goto_warp.name]
if element and element.valid then
element.enabled = state
@@ -478,38 +472,59 @@ end)
local r2 = config.activation_range^2
local rs2 = config.spawn_activation_range^2
Event.on_nth_tick(math.floor(60/config.update_smoothing),function()
local categories = Store.get_keys(warp_timer.store)
for _,category in pairs(categories) do
local categories = Store.get(warp_timer.store) or {}
for category,_ in pairs(categories) do
warp_timer:increment(1,category)
end
local force_warps = {}
local warps = {}
for _,player in pairs(game.connected_players) do
local was_in_range = Store.get(warp_player_in_range_store,player.name)
local force = player.force
local warps = Warps.get_warps(force.name)
local was_in_range = Store.get(player_in_range_store,player)
if #warps > 0 then
local surface = player.surface.index
-- Get the ids of all the warps on the players force
local force_name = player.force
local warp_ids = force_warps[force_name]
if not warp_ids then
warp_ids = Warps.get_force_warp_ids(force_name)
force_warps[force_name] = warp_ids
end
-- Check if the force has any warps
if #warp_ids > 0 then
local surface = player.surface
local pos = player.position
local px,py = pos.x,pos.y
for _,warp_id in pairs(warps) do
local warp = Warps.get_details(warp_id)
-- Loop over each warp
for _,warp_id in pairs(warp_ids) do
-- Check if warp id is chached
local warp = warps[warp_id]
if not warp then
warp = Warps.get(warp_id)
warps[warp_id] = warp
end
-- Check if the player is within range
local warp_pos = warp.position
if warp.surface.index == surface then
local dx,dy = px-warp_pos.x,py-warp_pos.y
if not warp.editing and (dx*dx)+(dy*dy) < rs2 or (dx*dx)+(dy*dy) < r2 then
if warp.surface == surface then
local dx, dy = px-warp_pos.x, py-warp_pos.y
if (dx*dx)+(dy*dy) < rs2 or (dx*dx)+(dy*dy) < r2 then
-- Set in range to true if the player was preiovusly out of range
if not was_in_range then
Store.set(warp_player_in_range_store,player.name,true)
Store.set(player_in_range_store,player,true)
end
return
break
end
end
end
if was_in_range then
Store.set(warp_player_in_range_store,player.name,false)
end
end
-- Set in range to false if the player was preiovusly in range
if was_in_range then
Store.set(player_in_range_store,player,false)
end
end
end
@@ -519,30 +534,38 @@ end)
Event.add(defines.events.on_player_created,function(event)
local player = Game.get_player_by_index(event.player_index)
-- Check if a player is allowed unlimited warps
local allowed = config.bypass_warp_limits_permission and Roles.player_allowed(player,config.bypass_warp_limits_permission) or false
Store.set(warp_player_in_range_store,player.name,allowed)
Store.set(player_in_range_store,player,allowed)
if allowed then
warp_timer:set_store(player.name,1)
end
-- If the force has no spawn then make a spawn warp
local force = player.force
if not Warps.forces[force.name] then
local spawn_id = Warps.get_spawn_warp_id(force.name)
if not spawn_id then
local spawn_position = force.get_spawn_position(player.surface)
Warps.new_warp(force.name,player.surface,spawn_position,nil,'Spawn',true,true)
spawn_id = Warps.add_warp(force.name,player.surface,spawn_position,nil,'Spawn')
Warps.set_spawn_warp(spawn_id,force)
Store.trigger(Warps.store,spawn_id)
Warps.make_warp_tag(spawn_id)
end
end)
local function maintain_tag(event)
if not event.player_index then return end
local tag = event.tag
local force = event.force
local warps = Warps.get_warps(force.name)
for _,warp_id in pairs(warps) do
local warp = Warps.get_warps(force.name)
if not warp.tag or not warp.tag.valid or warp.tag == tag then
local force_name = event.force.name
local warp_ids = Warps.get_force_warp_ids(force_name)
for _,warp_id in pairs(warp_ids) do
local warp = Warps.get_warp(warp_id)
local wtag = warp.tag
if not wtag or not wtag.valid or wtag == tag then
if event.name == defines.events.on_chart_tag_removed then
warp.tag = nil
end
Warps.make_chart_tag(warp_id)
Warps.make_warp_tag(warp_id)
end
end
end