mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-12 16:35:11 +09:00
Compare commits
549
Commits
main
..
26ee6cee64
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26ee6cee64 | ||
|
|
ea70b81bcf | ||
|
|
debf40be81 | ||
|
|
b0c2e722ed | ||
|
|
a1ca42e44d | ||
|
|
9e86796cb9 | ||
|
|
19a63fad1e | ||
|
|
e27a623fdf | ||
|
|
0703807f1d | ||
|
|
fc04da8748 | ||
|
|
2bdf18305f | ||
|
|
4ac29ce955 | ||
|
|
4fcaea613c | ||
|
|
613be4986b | ||
|
|
f1e6869db0 | ||
|
|
9b91ca4461 | ||
|
|
b467a7af64 | ||
|
|
1adbfd58d4 | ||
|
|
7552cd4cdd | ||
|
|
183f6b8807 | ||
|
|
d989526e6e | ||
|
|
b901ed040b | ||
|
|
2167008c0c | ||
|
|
ee934ed1df | ||
|
|
a67c9ae738 | ||
|
|
212a4ed1bc | ||
|
|
c03d707087 | ||
|
|
3340e4c28d | ||
|
|
26dfcf586f | ||
|
|
50a367f0ee | ||
|
|
cad9da0ba2 | ||
|
|
1ae3bbbce3 | ||
|
|
1a63c3ec09 | ||
|
|
c673ab6984 | ||
|
|
39d3890215 | ||
|
|
a12260dd87 | ||
|
|
27a9247436 | ||
|
|
d0e022a0cf | ||
|
|
250af62abe | ||
|
|
bcb7a5816b | ||
|
|
fb29f27755 | ||
|
|
c7cfba2685 | ||
|
|
befe2131f1 | ||
|
|
49eccb36b1 | ||
|
|
d2e7dedf54 | ||
|
|
ded7b33716 | ||
|
|
d1a4e25274 | ||
|
|
ed51b75671 | ||
|
|
0d689790de | ||
|
|
b1db4657f4 | ||
|
|
b8f466816f | ||
|
|
78033ccca9 | ||
|
|
0ef169b596 | ||
|
|
e99a5befff | ||
|
|
85631f4fef | ||
|
|
167b6b083f | ||
|
|
b6cc2bd2e3 | ||
|
|
b75fc72a22 | ||
|
|
d475793c61 | ||
|
|
fcf0d05a55 | ||
|
|
0a4f4f35a1 | ||
|
|
2daca9024a | ||
|
|
37afd11c24 | ||
|
|
3a85a15e7a | ||
|
|
255cf1e51b | ||
|
|
afc3c94b13 | ||
|
|
a32095ae2d | ||
|
|
0dae21dfcb | ||
|
|
7ff37d5dd2 | ||
|
|
d2332dfa47 | ||
|
|
d75abf7a10 | ||
|
|
92a077a895 | ||
|
|
54f3aed411 | ||
|
|
1ccf766c63 | ||
|
|
fc8adaceda | ||
|
|
a6aad24c77 | ||
|
|
b7fa20439b | ||
|
|
010d7caa0a | ||
|
|
c00470e58c | ||
|
|
0a97ac4ed3 | ||
|
|
b69653e85f | ||
|
|
19e2f819ff | ||
|
|
d917c50e3e | ||
|
|
0d519700b6 | ||
|
|
3891e48acd | ||
|
|
b8c437fca1 | ||
|
|
301d8647ec | ||
|
|
52261a06fd | ||
|
|
9771ea8ce4 | ||
|
|
6df40ac157 | ||
|
|
8cc3805656 | ||
|
|
703d2981d0 | ||
|
|
65d3c75032 | ||
|
|
6ba8316cff | ||
|
|
524654e935 | ||
|
|
6add30adf3 | ||
|
|
f36403997a | ||
|
|
a42802f509 | ||
|
|
b26cec6fae | ||
|
|
0fa264ab0a | ||
|
|
5914aced5e | ||
|
|
cf2b4476d5 | ||
|
|
f79408d37c | ||
|
|
268feab5f7 | ||
|
|
d61f163170 | ||
|
|
c36b92c401 | ||
|
|
d851c11e39 | ||
|
|
686efd2b30 | ||
|
|
2b3a49391f | ||
|
|
9a6e056008 | ||
|
|
350f8c3f8d | ||
|
|
e405bd70ac | ||
|
|
90a3510068 | ||
|
|
41dd7517d8 | ||
|
|
ee2b2b429d | ||
|
|
29bb17ed55 | ||
|
|
61644d1aef | ||
|
|
4365facdb5 | ||
|
|
f0da6a6507 | ||
|
|
9e0ccf87e4 | ||
|
|
0afd445da9 | ||
|
|
e368278d3b | ||
|
|
e808e11dd4 | ||
|
|
0f54eaee0b | ||
|
|
7983992371 | ||
|
|
717955608f | ||
|
|
e78920c4e6 | ||
|
|
24aafc36da | ||
|
|
93ea19e290 | ||
|
|
8ad47a1673 | ||
|
|
02774919cb | ||
|
|
c6848b7a6e | ||
|
|
01269ec755 | ||
|
|
4e51816a69 | ||
|
|
bfc91902c9 | ||
|
|
e2667ada9f | ||
|
|
f64d17772c | ||
|
|
f09f3f2b8a | ||
|
|
79f67e0442 | ||
|
|
0efefab723 | ||
|
|
c292004fc1 | ||
|
|
83f5d71225 | ||
|
|
b9df5beb94 | ||
|
|
034973bed9 | ||
|
|
d344131a74 | ||
|
|
b05f7ee04f | ||
|
|
26d4f150d1 | ||
|
|
0020b79c1f | ||
|
|
cd362e233f | ||
|
|
7da432dada | ||
|
|
b2e0423655 | ||
|
|
388b25ca6b | ||
|
|
bd8c2c19c0 | ||
|
|
7b7effd6ab | ||
|
|
dcf9a58c21 | ||
|
|
b2e5f6cb83 | ||
|
|
06529f5536 | ||
|
|
9cf7d7d7a2 | ||
|
|
f88f348efc | ||
|
|
6c6a14376c | ||
|
|
02fb1c53e7 | ||
|
|
edbc7de2d5 | ||
|
|
36ff0c4dcf | ||
|
|
a13e0d0c11 | ||
|
|
0c143d9d2d | ||
|
|
981e5b9c2e | ||
|
|
2bb77fbd04 | ||
|
|
c95b812f5d | ||
|
|
15d0f02ea1 | ||
|
|
6ce37fb677 | ||
|
|
9d03982688 | ||
|
|
9190733d82 | ||
|
|
abcfc8f9ee | ||
|
|
4fa34c31d1 | ||
|
|
5939ff8e59 | ||
|
|
e07a971e7d | ||
|
|
e047c7ecf6 | ||
|
|
23d88c197e | ||
|
|
76cfb66d68 | ||
|
|
33b7b7ffa0 | ||
|
|
8ccaf47f6f | ||
|
|
704dd73df4 | ||
|
|
860cacf16f | ||
|
|
2c0040a033 | ||
|
|
aa3976090f | ||
|
|
03e30caeda | ||
|
|
f7805ae2a7 | ||
|
|
fbf91f4310 | ||
|
|
3a8b217f8d | ||
|
|
1cfcdddfa5 | ||
|
|
8880eb6a57 | ||
|
|
07fe643d03 | ||
|
|
17b53a6695 | ||
|
|
51d266a667 | ||
|
|
36c65cbea0 | ||
|
|
32723e388b | ||
|
|
609796070f | ||
|
|
67ce09f96e | ||
|
|
082ee900f4 | ||
|
|
4e7776bc2d | ||
|
|
36931d9bb1 | ||
|
|
9786c95eda | ||
|
|
261041edd3 | ||
|
|
5800d4a590 | ||
|
|
60279c4a49 | ||
|
|
52c6887887 | ||
|
|
8b000613a2 | ||
|
|
766e96a9fc | ||
|
|
510a119741 | ||
|
|
73d1352ac5 | ||
|
|
b3c70e7700 | ||
|
|
85f9ebd7d0 | ||
|
|
5add829a78 | ||
|
|
ce73946885 | ||
|
|
88da422f9e | ||
|
|
5a006eaa25 | ||
|
|
63e21e1332 | ||
|
|
1ad8b3edd7 | ||
|
|
005a5501d8 | ||
|
|
62d818605a | ||
|
|
aacbfa7c3b | ||
|
|
a3fbdd195b | ||
|
|
63345c753c | ||
|
|
f5d23e9a07 | ||
|
|
e3a1b1f4fe | ||
|
|
2ec3813e2c | ||
|
|
4350cfad8d | ||
|
|
e759ca3c48 | ||
|
|
2ab8a8ae66 | ||
|
|
eb69977365 | ||
|
|
6bc077ed3e | ||
|
|
b026a84e67 | ||
|
|
6da76c548e | ||
|
|
2a0b4f2bfb | ||
|
|
6ed3a8bd49 | ||
|
|
35631f45c6 | ||
|
|
822258eee0 | ||
|
|
9e0ed189ee | ||
|
|
29f997bde2 | ||
|
|
5f24583e90 | ||
|
|
cea58693f9 | ||
|
|
3f2bb631f8 | ||
|
|
7b61c8b690 | ||
|
|
823af41ad4 | ||
|
|
2720c6938e | ||
|
|
95bdc0f0f3 | ||
|
|
20e98d4b13 | ||
|
|
a900440fc4 | ||
|
|
2f1be9762f | ||
|
|
02561e36c6 | ||
|
|
dfeec22b64 | ||
|
|
3059199512 | ||
|
|
f332cd649a | ||
|
|
6934d44b1d | ||
|
|
dcfb034b69 | ||
|
|
2f2389f1ea | ||
|
|
127aace0ae | ||
|
|
d219ef85f3 | ||
|
|
adda5c0f9d | ||
|
|
1fc3047116 | ||
|
|
df3daafc03 | ||
|
|
3ed1589e7e | ||
|
|
8ac99a0aa7 | ||
|
|
544782e65e | ||
|
|
fa16c66f1e | ||
|
|
13d1452f42 | ||
|
|
3f6fb51383 | ||
|
|
71e8f39361 | ||
|
|
3174efafed | ||
|
|
af241f2f17 | ||
|
|
413083e03a | ||
|
|
c241fbef0d | ||
|
|
4093d30ee5 | ||
|
|
432d29cc89 | ||
|
|
725ae0d7b3 | ||
|
|
c7280169a4 | ||
|
|
de5462662f | ||
|
|
0fea8692af | ||
|
|
a1a9745319 | ||
|
|
f261e1fbf4 | ||
|
|
abfa6b6aba | ||
|
|
66cbb71c67 | ||
|
|
d3b8c3252c | ||
|
|
374c727a4a | ||
|
|
c3da0363f3 | ||
|
|
1df8fd0359 | ||
|
|
d5803bed8d | ||
|
|
c74121bdd4 | ||
|
|
52a94b7bd3 | ||
|
|
0a9d4f4c8c | ||
|
|
a763d30e2b | ||
|
|
6318425f80 | ||
|
|
c6d32f07b5 | ||
|
|
fbd52f9943 | ||
|
|
c8216806ea | ||
|
|
1e6d1b19de | ||
|
|
05eee28bb1 | ||
|
|
d2eb463d21 | ||
|
|
5552e17715 | ||
|
|
96ac299263 | ||
|
|
5ebf2eb0bc | ||
|
|
31ec0afa5b | ||
|
|
f0adfa3e32 | ||
|
|
04d55cec4a | ||
|
|
08fbb1fd84 | ||
|
|
39dbcfeaca | ||
|
|
2b66965d08 | ||
|
|
d4e76de5fd | ||
|
|
aeb1538095 | ||
|
|
cbd776966e | ||
|
|
1daef1f216 | ||
|
|
e34b6682ed | ||
|
|
8da7ab8586 | ||
|
|
fb2a409d4c | ||
|
|
a933eec9e3 | ||
|
|
61494e9c48 | ||
|
|
5241a41ff3 | ||
|
|
2c4316a53b | ||
|
|
f40fd155ab | ||
|
|
e42d1a8280 | ||
|
|
68e523bc56 | ||
|
|
dd20b145ab | ||
|
|
946cc583b1 | ||
|
|
a3f3ec3991 | ||
|
|
b94e5e4dad | ||
|
|
7da0cf78a8 | ||
|
|
31154f007e | ||
|
|
29395fe161 | ||
|
|
d7c761d138 | ||
|
|
c8ca527005 | ||
|
|
f63ebf8e7c | ||
|
|
f7549b8017 | ||
|
|
52e50fbb06 | ||
|
|
cd3cdda4bf | ||
|
|
8c727876bb | ||
|
|
84cdc45362 | ||
|
|
7c9592bbb1 | ||
|
|
8680e5fbfb | ||
|
|
6d19f8304d | ||
|
|
40bf727e49 | ||
|
|
8407c1357d | ||
|
|
c62cfc413d | ||
|
|
fd5d95bcd8 | ||
|
|
4c257d1497 | ||
|
|
cc590372de | ||
|
|
fc7c9d41ad | ||
|
|
9e1f7530e2 | ||
|
|
8c79c0363c | ||
|
|
d12ad7ed2e | ||
|
|
8f230bb393 | ||
|
|
97c6f7f3c3 | ||
|
|
dbe3c873f6 | ||
|
|
be6ccb27f1 | ||
|
|
1d4af30843 | ||
|
|
a59f5830f2 | ||
|
|
8ae03a7ee1 | ||
|
|
ddd6dc474f | ||
|
|
3ae1b7c1f8 | ||
|
|
d475a55460 | ||
|
|
4bc18e10f5 | ||
|
|
bbe25ec120 | ||
|
|
1aaae3fa13 | ||
|
|
a7a0e85a95 | ||
|
|
c2089a89ba | ||
|
|
94b3bd8c20 | ||
|
|
a86a625d62 | ||
|
|
42fe79ef91 | ||
|
|
6890226f13 | ||
|
|
c682b8b81b | ||
|
|
403bace3ab | ||
|
|
c00f5b54a8 | ||
|
|
cea73d7ab8 | ||
|
|
bf29c1ccd9 | ||
|
|
6520014c47 | ||
|
|
064dead08c | ||
|
|
16574b5908 | ||
|
|
0eaa2b1542 | ||
|
|
1f7ac1ace5 | ||
|
|
357eba0e64 | ||
|
|
991d26510e | ||
|
|
d4b4f50618 | ||
|
|
852cf45d0c | ||
|
|
5e1c27d52f | ||
|
|
b297b0d0b7 | ||
|
|
733c70823a | ||
|
|
fe901c5f11 | ||
|
|
112d5b7bda | ||
|
|
3914e4594d | ||
|
|
b8f78835d0 | ||
|
|
70625f0888 | ||
|
|
3382250a34 | ||
|
|
4ab3fb0b4d | ||
|
|
d101dc1f11 | ||
|
|
9b72f9e127 | ||
|
|
8376f240bb | ||
|
|
e3d42442d4 | ||
|
|
30f9e32550 | ||
|
|
3c876d4873 | ||
|
|
ab12a8be52 | ||
|
|
f95f5faad9 | ||
|
|
f21586192d | ||
|
|
7b7482b70d | ||
|
|
79f6747f79 | ||
|
|
111c6e9b29 | ||
|
|
c56f8b4f27 | ||
|
|
e9635796fa | ||
|
|
e291759cb7 | ||
|
|
3f351df82d | ||
|
|
3fd2876ba7 | ||
|
|
e2173cc57d | ||
|
|
55fe9b6069 | ||
|
|
be2ae106f5 | ||
|
|
f9405b930d | ||
|
|
cff86b07f2 | ||
|
|
8ad24b3afd | ||
|
|
9fb1af24d2 | ||
|
|
736df61152 | ||
|
|
7784dbf3ad | ||
|
|
29abf08b70 | ||
|
|
7c87cfc8bc | ||
|
|
781760d67e | ||
|
|
fdf0cb66cf | ||
|
|
967225ebe9 | ||
|
|
d7dc4040c8 | ||
|
|
ff5987d7f6 | ||
|
|
d1cb929c6d | ||
|
|
843de85206 | ||
|
|
c10de39a89 | ||
|
|
bfe5110254 | ||
|
|
4fa1ea4fb3 | ||
|
|
9e44de8850 | ||
|
|
de6474dc76 | ||
|
|
8b67491d8c | ||
|
|
da323d5152 | ||
|
|
0d8712dd6b | ||
|
|
cf2f6cfb8c | ||
|
|
2ed7235f3d | ||
|
|
c9700414c7 | ||
|
|
6bcd3bc641 | ||
|
|
a6ddf0c427 | ||
|
|
68e21db03a | ||
|
|
5373b9d9bb | ||
|
|
eadca324e7 | ||
|
|
3632738501 | ||
|
|
645d693583 | ||
|
|
ea04b93c7c | ||
|
|
518f1fc561 | ||
|
|
803192e01c | ||
|
|
8dac727396 | ||
|
|
7a5577452c | ||
|
|
8f5d3e4a65 | ||
|
|
6603a14fd3 | ||
|
|
46f35eadcc | ||
|
|
4136b5018b | ||
|
|
965c1c7712 | ||
|
|
82e858975b | ||
|
|
f94e9bf17d | ||
|
|
10bf61247c | ||
|
|
bd488aef76 | ||
|
|
397661728f | ||
|
|
5c15bbbe7c | ||
|
|
62ac9a6406 | ||
|
|
f0172f6270 | ||
|
|
64ca88a198 | ||
|
|
6d44936364 | ||
|
|
dee2600eec | ||
|
|
0a61893f68 | ||
|
|
dd655807c4 | ||
|
|
f1868e883c | ||
|
|
91ddb5530a | ||
|
|
65e6647068 | ||
|
|
f0b066cdfe | ||
|
|
b9de395a44 | ||
|
|
46bb73b927 | ||
|
|
c168095249 | ||
|
|
a02975853d | ||
|
|
64910c2821 | ||
|
|
b56b53c268 | ||
|
|
292870bf8c | ||
|
|
72c1d73a20 | ||
|
|
055c9bb6ad | ||
|
|
7e7bf5708c | ||
|
|
e250610273 | ||
|
|
9265479565 | ||
|
|
b3c19b8010 | ||
|
|
a6da3a74c2 | ||
|
|
ce146be986 | ||
|
|
a03df60302 | ||
|
|
723f535ab6 | ||
|
|
db70decbf3 | ||
|
|
a38708c203 | ||
|
|
664c9e67c0 | ||
|
|
11eb7152bd | ||
|
|
155721938e | ||
|
|
251e41bba5 | ||
|
|
fa3168e1ac | ||
|
|
baf9e3f2df | ||
|
|
b60045d70e | ||
|
|
3e570b1599 | ||
|
|
81d9f59e81 | ||
|
|
98f1dc6a29 | ||
|
|
eb97893b3e | ||
|
|
599339f805 | ||
|
|
b920c2984d | ||
|
|
4a14972412 | ||
|
|
f5a830d1c6 | ||
|
|
9a82000792 | ||
|
|
fb01bc1644 | ||
|
|
d049126a54 | ||
|
|
890019ca98 | ||
|
|
fe53b474a0 | ||
|
|
8192ebdd3c | ||
|
|
a65a04c810 | ||
|
|
2749df9f08 | ||
|
|
a991142279 | ||
|
|
cb6ea27391 | ||
|
|
6b88725af2 | ||
|
|
118b99f521 | ||
|
|
25f495b4dd | ||
|
|
6d6e44f0da | ||
|
|
7555de476e | ||
|
|
cf900d46cd | ||
|
|
2944e730b0 | ||
|
|
1eb7a27c71 | ||
|
|
3ab5becf16 | ||
|
|
a0c0169a4b | ||
|
|
dfd3f85975 | ||
|
|
4a1a451ff2 | ||
|
|
d73688dd37 | ||
|
|
15141e98e0 | ||
|
|
51961d2aea | ||
|
|
3266f444cd | ||
|
|
c5395e37b2 | ||
|
|
d2e2e2d6c9 | ||
|
|
bd5b217909 | ||
|
|
5ae20ac21c | ||
|
|
3830a464f8 | ||
|
|
4362b48106 | ||
|
|
43f61909e8 | ||
|
|
596ea47082 | ||
|
|
80cd1245e5 | ||
|
|
3e4318fcab | ||
|
|
47e900f735 | ||
|
|
d88def830f | ||
|
|
b32e854398 | ||
|
|
e9f82db154 | ||
|
|
0a4b392cf3 | ||
|
|
87dbf0db57 | ||
|
|
f5d548e709 |
@@ -1,34 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
|
|
||||||
"runtime": {
|
|
||||||
"version": "Lua5.2",
|
|
||||||
"requirePattern": [ "?", "?.lua" ]
|
|
||||||
},
|
|
||||||
"workspace": {
|
|
||||||
"$comment-moduleMap": "Replaces the fmtk --clusterio-modules plugin, rewrites each file's own module path rather than the require string",
|
|
||||||
"$comment-library": "clusterio is outside this repo, set CLUSTERIO to your checkout. The factorio typedefs come from .luarc.json, which the factoriomod-debug extension manages",
|
|
||||||
"library": [ "$CLUSTERIO/packages/host" ],
|
|
||||||
"ignoreDir": [ ".github", "web", "dist", "factorio" ],
|
|
||||||
"ignoreGlobs": [ "**/node_modules/**", "**/dist/**", "**/campaigns/**" ],
|
|
||||||
"moduleMap": [
|
|
||||||
{ "pattern": "^([^.]+)\\.module\\.module_exports$", "replace": "modules.$1" },
|
|
||||||
{ "pattern": "^([^.]+)\\.module\\.(.+)$", "replace": "modules.$1.$2" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"doc": {
|
|
||||||
"privateName": [ "__*" ]
|
|
||||||
},
|
|
||||||
"$comment-disable": "Carried over from the luals config, which had these as editor only rather than checked in ci",
|
|
||||||
"$comment-unnecessary-if": "Disabled by the config fmtk generates for itself, the api union types make it unreliable",
|
|
||||||
"diagnostics": {
|
|
||||||
"globals": [ "__DebugAdapter", "__Profiler" ],
|
|
||||||
"disable": [
|
|
||||||
"assign-type-mismatch",
|
|
||||||
"param-type-mismatch",
|
|
||||||
"preferred-local-alias",
|
|
||||||
"unnecessary-assert",
|
|
||||||
"unnecessary-if",
|
|
||||||
"unused"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+34
-52
@@ -1,94 +1,76 @@
|
|||||||
name: Lua Lint
|
name: FMTK Lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
|
||||||
EMMYLUA_CHECK_VERSION: "0.24.0"
|
|
||||||
CLUSTERIO: ${{ github.workspace }}/.clusterio
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Checkout clusterio modules
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: clusterio/clusterio
|
|
||||||
path: .clusterio
|
|
||||||
sparse-checkout: packages/host/modules
|
|
||||||
sparse-checkout-cone-mode: false
|
|
||||||
- uses: pnpm/action-setup@v4
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: lts/*
|
node-version: lts/*
|
||||||
- name: Generate Factorio typedefs
|
cache: "pnpm"
|
||||||
|
- name: Install FMTK
|
||||||
run: |
|
run: |
|
||||||
pnpm install factoriomod-debug
|
pnpm install factoriomod-debug
|
||||||
pnpm exec fmtk luals-addon "$RUNNER_TEMP"
|
pnpm exec fmtk luals-addon
|
||||||
- name: Install emmylua_check
|
jq '.["workspace.library"] += ["${{ github.workspace }}/factorio/library"] | .["runtime.plugin"] = "${{ github.workspace }}/factorio/plugin.lua"' .luarc.json > temp.luarc.json
|
||||||
|
jq -s '.[0] * .[1].settings' temp.luarc.json ${{ github.workspace }}/factorio/config.json > check.luarc.json
|
||||||
|
- name: Install LuaLS
|
||||||
run: |
|
run: |
|
||||||
curl -fsSL "https://github.com/EmmyLuaLs/emmylua-analyzer-rust/releases/download/${EMMYLUA_CHECK_VERSION}/emmylua_check-linux-x64.tar.gz" \
|
wget https://github.com/LuaLS/lua-language-server/releases/download/3.15.0/lua-language-server-3.15.0-linux-x64.tar.gz -q -O lusls.tar.gz
|
||||||
| tar -xz -C "$RUNNER_TEMP"
|
mkdir luals && tar -xf lusls.tar.gz -C luals && rm lusls.tar.gz
|
||||||
- name: Run Lint Report
|
- name: Run Lint Report
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# The typedefs are generated per run, clusterio comes from CLUSTERIO above
|
./luals/bin/lua-language-server --check=. --logpath=. --configpath=check.luarc.json --checklevel=Information --check_out_path=check.json
|
||||||
jq -n --arg lib "$RUNNER_TEMP/factorio/library" \
|
|
||||||
'{ workspace: { library: [ $lib ], ignoreGlobs: [ ".clusterio/**" ] } }' \
|
|
||||||
> "$RUNNER_TEMP/ci.emmyrc.json"
|
|
||||||
|
|
||||||
# Exits non zero on error severity, so the gate below is used instead
|
|
||||||
"$RUNNER_TEMP/emmylua_check" . --config ".emmyrc.json,$RUNNER_TEMP/ci.emmyrc.json" \
|
|
||||||
--output-format json --output check.json || true
|
|
||||||
|
|
||||||
# Credit to https://github.com/Krealle/luals-check-action/blob/main/action.yml
|
# Credit to https://github.com/Krealle/luals-check-action/blob/main/action.yml
|
||||||
# Although some minor fixes were needed
|
# Although some minor fixes were needed
|
||||||
|
|
||||||
# Format and print the messages (would be nice to format as a table, but that's too complex for jq)
|
# Format and print the messages (would be nice to format as a table, but that's too complex for jq)
|
||||||
jq -r --arg root "$PWD/" \
|
cat check.json | \
|
||||||
'.[] | (.file | ltrimstr($root)) as $file | .diagnostics[] |
|
jq -r \
|
||||||
|
'to_entries | map(.key as $file | .value[] |
|
||||||
{
|
{
|
||||||
file: $file,
|
file: $file | sub("file://${{ github.workspace }}/./"; ""),
|
||||||
code: .code,
|
code: .code,
|
||||||
line: .range.start.line,
|
line: .range.start.line,
|
||||||
message: (.message | split("\n")
|
message: (.message | split("\n")
|
||||||
| map(if startswith("- ") then .[2:] else . end)
|
| map(if startswith("- ") then .[2:] else . end)
|
||||||
| join("\n")),
|
| join("\n")),
|
||||||
severity: (if .severity <= 1 then "ERR" else "WARN" end)
|
severity: (if .severity <= 1 then "ERR" else "WARN" end)
|
||||||
} |
|
}) |
|
||||||
"**[\(.severity)] \(.code):** \(.file)#L\(.line + 1)<br><code>\(.message)</code>"' \
|
map("**[\(.severity)] \(.code):** \(.file)#L\(.line)<br><code>\(.message)</code>") | .[]' \
|
||||||
check.json > "$GITHUB_STEP_SUMMARY"
|
> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Github Annotations (limited to 10)
|
# Github Annotations (limited to 10)
|
||||||
jq -r --arg root "$PWD/" \
|
cat check.json | \
|
||||||
'.[] | (.file | ltrimstr($root)) as $file | .diagnostics[] |
|
jq -r \
|
||||||
{
|
'to_entries | map(.key as $file | .value[] |
|
||||||
file: $file,
|
{
|
||||||
title: .code,
|
file: $file | sub("file://${{ github.workspace }}/./"; ""),
|
||||||
line: .range.start.line,
|
title: .code,
|
||||||
endLine: .range.end.line,
|
line: .range.start.line,
|
||||||
col: .range.start.character,
|
endLine: .range.end.line,
|
||||||
endColumn: .range.end.character,
|
col: .range.start.character,
|
||||||
message: (.message | gsub("\n"; "%0A"; "m")),
|
endColumn: .range.end.character,
|
||||||
level: (if .severity <= 1 then "error" else "warning" end)
|
message: .message | gsub("\n"; "%0A"; "m"),
|
||||||
} |
|
level: (if .severity <= 1 then "error" else "warning" end)
|
||||||
"::\(.level) file=\(.file),line=\(.line + 1),endLine=\(.endLine + 1),col=\(.col + 1),endColumn=\(.endColumn + 1),title=\(.title)::\(.message) (\(.title))"' \
|
}) |
|
||||||
check.json
|
map("::\(.level) file=\(.file),line=\(.line+1),endLine=\(.line+1),col=\(.col+1),endColumn=\(.endColumn+1),title=\(.title)::\(.message) (\(.title))") | .[]'
|
||||||
|
|
||||||
# An entry is emitted for every file checked, including clean ones, so
|
if [[ $(wc -l < check.json) > 1 ]] ; then
|
||||||
# the gate counts diagnostics and asserts the workspace was actually read
|
|
||||||
if [[ $(jq 'length' check.json) -lt 100 ]] ; then
|
|
||||||
echo "::error::Only $(jq 'length' check.json) files were checked, expected the whole workspace"
|
|
||||||
exit 1
|
|
||||||
elif [[ $(jq '[.[].diagnostics[]] | length' check.json) -gt 0 ]] ; then
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "✅ All checks succeeded!" | tee "$GITHUB_STEP_SUMMARY"
|
echo "✅ All checks succeeded!" | tee $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
+5
-1
@@ -1,4 +1,8 @@
|
|||||||
dist/
|
dist/
|
||||||
node_modules/
|
node_modules/
|
||||||
.vscode
|
.vscode
|
||||||
.luarc.json
|
exp_util/node-compile-cache/
|
||||||
|
exp_commands/node-compile-cache/
|
||||||
|
exp_groups/node-compile-cache/
|
||||||
|
exp_legacy/node-compile-cache/
|
||||||
|
exp_scenario/node-compile-cache/
|
||||||
|
|||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||||
|
"workspace.ignoreDir": [
|
||||||
|
".vscode", ".github", "luals", "factorio"
|
||||||
|
],
|
||||||
|
"completion.requireSeparator": "/",
|
||||||
|
"runtime.pluginArgs": [
|
||||||
|
"--clusterio-modules"
|
||||||
|
],
|
||||||
|
"doc": {
|
||||||
|
"regengine": "glob",
|
||||||
|
"privateName": [ "__*" ],
|
||||||
|
"packageName": [ "_*" ]
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"checkTableShape": true,
|
||||||
|
"inferParamType": true
|
||||||
|
},
|
||||||
|
"$comment-name-style-check": "Disabled below until config issue fixed: https://github.com/LuaLS/lua-language-server/issues/2643",
|
||||||
|
"$comment-type-mismatch": "Disabled unless opened due to performance concerns, time reduced to 10s from 400s",
|
||||||
|
"diagnostics": {
|
||||||
|
"unusedLocalExclude": [ "_*", "i", "j", "k", "v" ],
|
||||||
|
"groupFileStatus": {
|
||||||
|
"ambiguity": "Any",
|
||||||
|
"await": "None",
|
||||||
|
"codestyle": "Opened",
|
||||||
|
"conventions": "Any",
|
||||||
|
"duplicate": "Any",
|
||||||
|
"global": "Any",
|
||||||
|
"luadoc": "Opened",
|
||||||
|
"redefined": "Opened",
|
||||||
|
"strict": "Any",
|
||||||
|
"strong": "Any",
|
||||||
|
"type-check": "Any",
|
||||||
|
"unbalanced": "Opened",
|
||||||
|
"unused": "Opened"
|
||||||
|
},
|
||||||
|
"neededFileStatus": {
|
||||||
|
"no-unknown": "None!",
|
||||||
|
"spell-check": "None!",
|
||||||
|
"name-style-check": "None!",
|
||||||
|
"assign-type-mismatch": "Opened!",
|
||||||
|
"return-type-mismatch": "Opened!",
|
||||||
|
"param-type-mismatch": "Opened!"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nameStyle.config": {
|
||||||
|
"local_name_style": [{
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "snake_case"
|
||||||
|
}],
|
||||||
|
"module_local_name_style": [{
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "snake_case"
|
||||||
|
}, {
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "upper_snake_case"
|
||||||
|
}, {
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "pascal_case"
|
||||||
|
}],
|
||||||
|
"function_param_name_style": [{
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "snake_case"
|
||||||
|
}],
|
||||||
|
"function_name_style": [{
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "snake_case"
|
||||||
|
}],
|
||||||
|
"local_function_name_style": [{
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "snake_case"
|
||||||
|
}],
|
||||||
|
"table_field_name_style": [{
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "snake_case"
|
||||||
|
}],
|
||||||
|
"global_variable_name_style": [{
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "snake_case"
|
||||||
|
}, {
|
||||||
|
"type" : "pattern",
|
||||||
|
"param": "_?_?(\\S*)",
|
||||||
|
"$1": "upper_snake_case"
|
||||||
|
}],
|
||||||
|
"module_name_style": [ "pascal_case", "snake_case" ],
|
||||||
|
"require_module_name_style": [ "pascal_case", "snake_case" ],
|
||||||
|
"class_name_style": "pascal_case",
|
||||||
|
"const_variable_name_style": "upper_snake_case"
|
||||||
|
},
|
||||||
|
"format.defaultConfig": {
|
||||||
|
"continuation_indent.in_expr": "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,8 +5,6 @@ All are welcome to make bug reports, feature requests, and pull requests for our
|
|||||||
For developers wanting to add features please follow these guidelines:
|
For developers wanting to add features please follow these guidelines:
|
||||||
|
|
||||||
- All lua code is documented using ldoc.
|
- All lua code is documented using ldoc.
|
||||||
- Set the `CLUSTERIO` environment variable to your clusterio development install path, the lint needs it to resolve `modules/clusterio/*`.
|
|
||||||
- Lua is checked with [emmylua](https://github.com/EmmyLuaLs/emmylua-analyzer-rust), configured by `.emmyrc.json`. Install the EmmyLua extension rather than sumnekolua / luals, and use factoriomod-debug to generate the factorio api types. Note that an inline cast must be written `--[[@as T]]`, the spaced form is not parsed.
|
|
||||||
- Changes should be made on your own fork and merged into `main` through a pull request.
|
- Changes should be made on your own fork and merged into `main` through a pull request.
|
||||||
- Each pull request should be limited to one feature or a few bug fixes and link to the related issue page.
|
- Each pull request should be limited to one feature or a few bug fixes and link to the related issue page.
|
||||||
- Pull requests are automatically linted and documentation checked.
|
- Pull requests are automatically linted and documentation checked.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ The default permission authorities controlled by the flags: admin_only, system_o
|
|||||||
|
|
||||||
local Storage = require("modules/exp_util/storage")
|
local Storage = require("modules/exp_util/storage")
|
||||||
|
|
||||||
local Commands = require("modules/exp_commands") --- @class (partial) Commands
|
local Commands = require("modules/exp_commands") --- @class Commands
|
||||||
local add, allow, deny = Commands.add_permission_authority, Commands.status.success, Commands.status.unauthorised
|
local add, allow, deny = Commands.add_permission_authority, Commands.status.success, Commands.status.unauthorised
|
||||||
|
|
||||||
local authorities = {}
|
local authorities = {}
|
||||||
@@ -28,13 +28,13 @@ end)
|
|||||||
--- Allow a player access to system commands, use for debug purposes only
|
--- Allow a player access to system commands, use for debug purposes only
|
||||||
--- @param player_name string? The name of the player to give access to, default is the current player
|
--- @param player_name string? The name of the player to give access to, default is the current player
|
||||||
function Commands.unlock_system_commands(player_name)
|
function Commands.unlock_system_commands(player_name)
|
||||||
system_players[player_name or assert(game.player).name] = true
|
system_players[player_name or game.player.name] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Remove access from system commands for a player, use for debug purposes only
|
--- Remove access from system commands for a player, use for debug purposes only
|
||||||
--- @param player_name string? The name of the player to give access to, default is the current player
|
--- @param player_name string? The name of the player to give access to, default is the current player
|
||||||
function Commands.lock_system_commands(player_name)
|
function Commands.lock_system_commands(player_name)
|
||||||
system_players[player_name or assert(game.player).name] = nil
|
system_players[player_name or game.player.name] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get a list of all players who have system commands unlocked
|
--- Get a list of all players who have system commands unlocked
|
||||||
|
|||||||
@@ -25,18 +25,18 @@ end)
|
|||||||
--- @param page_size number The number of requests to show per page
|
--- @param page_size number The number of requests to show per page
|
||||||
--- @return LocalisedString[][], number
|
--- @return LocalisedString[][], number
|
||||||
local function format_as_pages(commands, page_size)
|
local function format_as_pages(commands, page_size)
|
||||||
local current_page = {}
|
local pages = { {} }
|
||||||
local pages = { current_page }
|
|
||||||
local page_length = 0
|
local page_length = 0
|
||||||
|
local current_page = 1
|
||||||
local total = 0
|
local total = 0
|
||||||
|
|
||||||
for _, command in pairs(commands) do
|
for _, command in pairs(commands) do
|
||||||
total = total + 1
|
total = total + 1
|
||||||
page_length = page_length + 1
|
page_length = page_length + 1
|
||||||
if page_length > page_size then
|
if page_length > page_size then
|
||||||
|
current_page = current_page + 1
|
||||||
|
pages[current_page] = {}
|
||||||
page_length = 1
|
page_length = 1
|
||||||
current_page = {}
|
|
||||||
pages[#pages + 1] = current_page
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local description
|
local description
|
||||||
@@ -48,7 +48,7 @@ local function format_as_pages(commands, page_size)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local aliases = #command.aliases > 0 and { "exp-commands_help.aliases", table.concat(command.aliases, ", ") } or ""
|
local aliases = #command.aliases > 0 and { "exp-commands_help.aliases", table.concat(command.aliases, ", ") } or ""
|
||||||
current_page[page_length] = { "exp-commands_help.format", command.name, description, aliases }
|
pages[current_page][page_length] = { "exp-commands_help.format", command.name, description, aliases }
|
||||||
end
|
end
|
||||||
|
|
||||||
return pages, total
|
return pages, total
|
||||||
@@ -71,7 +71,7 @@ Commands.new("commands", { "exp-commands_help.description" })
|
|||||||
page = as_number
|
page = as_number
|
||||||
end
|
end
|
||||||
|
|
||||||
keyword = tostring(keyword):lower()
|
keyword = keyword:lower()
|
||||||
local pages, found
|
local pages, found
|
||||||
if cache and cache.keyword == keyword then
|
if cache and cache.keyword == keyword then
|
||||||
-- Cached value found, no search is needed
|
-- Cached value found, no search is needed
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ local ExpUtil = require("modules/exp_util")
|
|||||||
local Async = require("modules/exp_util/async")
|
local Async = require("modules/exp_util/async")
|
||||||
local Storage = require("modules/exp_util/storage")
|
local Storage = require("modules/exp_util/storage")
|
||||||
|
|
||||||
local Commands = require("modules/exp_commands") --- @class (partial) Commands
|
local Commands = require("modules/exp_commands") --- @class Commands
|
||||||
|
|
||||||
local rcon_env = {} --- @type table<string, any>
|
local rcon_env = {} --- @type table<string, any>
|
||||||
local rcon_static = {} --- @type table<string, any>
|
local rcon_static = {} --- @type table<string, any>
|
||||||
@@ -21,10 +21,12 @@ setmetatable(rcon_static, { __index = _G })
|
|||||||
setmetatable(rcon_env, { __index = rcon_static })
|
setmetatable(rcon_env, { __index = rcon_static })
|
||||||
|
|
||||||
--- Some common static values which can be added now
|
--- Some common static values which can be added now
|
||||||
|
--- @diagnostic disable: name-style-check
|
||||||
rcon_static.Async = Async
|
rcon_static.Async = Async
|
||||||
rcon_static.ExpUtil = ExpUtil
|
rcon_static.ExpUtil = ExpUtil
|
||||||
rcon_static.Commands = Commands
|
rcon_static.Commands = Commands
|
||||||
rcon_static.print = Commands.print
|
rcon_static.print = Commands.print
|
||||||
|
--- @diagnostic enable: name-style-check
|
||||||
|
|
||||||
--- Some common callback values which are useful when a player uses the command
|
--- Some common callback values which are useful when a player uses the command
|
||||||
--- @alias ExpCommand.RconDynamic fun(player: LuaPlayer?): any
|
--- @alias ExpCommand.RconDynamic fun(player: LuaPlayer?): any
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Commands.new("_sudo", { "exp-commands_sudo.description" })
|
|||||||
--- @cast command ExpCommand
|
--- @cast command ExpCommand
|
||||||
--- @cast parameter string
|
--- @cast parameter string
|
||||||
|
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line: invisible
|
||||||
return Commands._event_handler{
|
return Commands._event_handler{
|
||||||
name = command.name,
|
name = command.name,
|
||||||
tick = game.tick,
|
tick = game.tick,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ local Commands = require("modules/exp_commands")
|
|||||||
local add, parse = Commands.add_data_type, Commands.parse_input
|
local add, parse = Commands.add_data_type, Commands.parse_input
|
||||||
local valid, invalid = Commands.status.success, Commands.status.invalid_input
|
local valid, invalid = Commands.status.success, Commands.status.invalid_input
|
||||||
|
|
||||||
local types = {} --- @class (partial) Commands.types
|
local types = {} --- @class Commands.types
|
||||||
|
|
||||||
--- A boolean value where true is one of: yes, y, true, 1
|
--- A boolean value where true is one of: yes, y, true, 1
|
||||||
types.boolean =
|
types.boolean =
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ force=Invalid Force Name.
|
|||||||
surface=Invalid Surface Name.
|
surface=Invalid Surface Name.
|
||||||
planet=Invalid Planet Name.
|
planet=Invalid Planet Name.
|
||||||
color=Invalid Color Name.
|
color=Invalid Color Name.
|
||||||
|
role=Invalid Role Name.
|
||||||
|
|
||||||
[exp-commands-authorities]
|
[exp-commands-authorities]
|
||||||
character-only=This command can not be used in remote view.
|
character-only=This command can not be used in remote view.
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ force=勢力名稱錯誤。
|
|||||||
surface=地表名稱錯誤。
|
surface=地表名稱錯誤。
|
||||||
planet=星球名稱錯誤。
|
planet=星球名稱錯誤。
|
||||||
color=顏色名稱錯誤。
|
color=顏色名稱錯誤。
|
||||||
|
role=權限組名稱錯誤。
|
||||||
|
|
||||||
[exp-commands-authorities]
|
[exp-commands-authorities]
|
||||||
character-only=該命令不能在遠端視圖中使用。
|
character-only=該命令不能在遠端視圖中使用。
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ force=勢力名稱錯誤。
|
|||||||
surface=地表名稱錯誤。
|
surface=地表名稱錯誤。
|
||||||
planet=星球名稱錯誤。
|
planet=星球名稱錯誤。
|
||||||
color=顏色名稱錯誤。
|
color=顏色名稱錯誤。
|
||||||
|
role=權限組名稱錯誤。
|
||||||
|
|
||||||
[exp-commands-authorities]
|
[exp-commands-authorities]
|
||||||
character-only=該命令不能在遠端視圖中使用。
|
character-only=該命令不能在遠端視圖中使用。
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ local Search = require("modules/exp_commands/search")
|
|||||||
--- @type LuaPlayer?
|
--- @type LuaPlayer?
|
||||||
local _print_player
|
local _print_player
|
||||||
|
|
||||||
--- @class (partial) Commands
|
--- @class Commands
|
||||||
local Commands = {
|
local Commands = {
|
||||||
color = ExpUtil.color,
|
color = ExpUtil.color,
|
||||||
format_rich_text_color = ExpUtil.format_rich_text_color,
|
format_rich_text_color = ExpUtil.format_rich_text_color,
|
||||||
@@ -84,7 +84,7 @@ local Commands = {
|
|||||||
--- Contains the different status values a command can return
|
--- Contains the different status values a command can return
|
||||||
Commands.status = {}
|
Commands.status = {}
|
||||||
|
|
||||||
--- @class (partial) Commands.types: table<string, Commands.InputParser<any> | Commands.InputParserFactory<any>>
|
--- @class Commands.types: table<string, Commands.InputParser | Commands.InputParserFactory>
|
||||||
--- Stores all input parsers and validators for different data types
|
--- Stores all input parsers and validators for different data types
|
||||||
Commands.types = {}
|
Commands.types = {}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ end
|
|||||||
--- @class Commands.Argument
|
--- @class Commands.Argument
|
||||||
--- @field name string The name of the argument
|
--- @field name string The name of the argument
|
||||||
--- @field description LocalisedString? The description of the argument
|
--- @field description LocalisedString? The description of the argument
|
||||||
--- @field input_parser Commands.InputParser<any> The input parser for the argument
|
--- @field input_parser Commands.InputParser The input parser for the argument
|
||||||
--- @field optional boolean True when the argument is optional
|
--- @field optional boolean True when the argument is optional
|
||||||
--- @field default any? The default value of the argument
|
--- @field default any? The default value of the argument
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ Commands.server = setmetatable({
|
|||||||
Commands.error("Command does not support rcon usage, requires LuaPlayer." .. key)
|
Commands.error("Command does not support rcon usage, requires LuaPlayer." .. key)
|
||||||
error("Command does not support rcon usage, requires LuaPlayer." .. key)
|
error("Command does not support rcon usage, requires LuaPlayer." .. key)
|
||||||
end,
|
end,
|
||||||
}) --[[@as LuaPlayer]]
|
}) --[[ @as LuaPlayer ]]
|
||||||
|
|
||||||
--- Status Returns.
|
--- Status Returns.
|
||||||
-- Return values used by command callbacks
|
-- Return values used by command callbacks
|
||||||
@@ -170,8 +170,7 @@ Commands.server = setmetatable({
|
|||||||
--- @param msg LocalisedString? An optional message to be included when a command completes (only has an effect in command callbacks)
|
--- @param msg LocalisedString? An optional message to be included when a command completes (only has an effect in command callbacks)
|
||||||
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
||||||
function Commands.status.success(msg)
|
function Commands.status.success(msg)
|
||||||
if msg == nil then return Commands.status.success, { "exp-commands.success" } end
|
return Commands.status.success, msg == nil and { "exp-commands.success" } or msg
|
||||||
return Commands.status.success, msg
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to signal an error has occurred in a command, data type parser, or permission authority
|
--- Used to signal an error has occurred in a command, data type parser, or permission authority
|
||||||
@@ -179,8 +178,7 @@ end
|
|||||||
--- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided
|
--- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided
|
||||||
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
||||||
function Commands.status.error(msg)
|
function Commands.status.error(msg)
|
||||||
if msg == nil then msg = { "exp-commands.error-default" } end
|
return Commands.status.error, { "exp-commands.error", msg == nil and { "exp-commands.error-default" } or msg }
|
||||||
return Commands.status.error, { "exp-commands.error", msg }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to signal the player is unauthorised to use a command, primarily used by permission authorities but can be used in a command callback
|
--- Used to signal the player is unauthorised to use a command, primarily used by permission authorities but can be used in a command callback
|
||||||
@@ -188,8 +186,7 @@ end
|
|||||||
--- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided
|
--- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided
|
||||||
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
||||||
function Commands.status.unauthorised(msg)
|
function Commands.status.unauthorised(msg)
|
||||||
if msg == nil then msg = { "exp-commands.unauthorized-default" } end
|
return Commands.status.unauthorised, { "exp-commands.unauthorized", msg == nil and { "exp-commands.unauthorized-default" } or msg }
|
||||||
return Commands.status.unauthorised, { "exp-commands.unauthorized", msg }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to signal the player provided invalid input to an command, primarily used by data type parsers but can be used in a command callback
|
--- Used to signal the player provided invalid input to an command, primarily used by data type parsers but can be used in a command callback
|
||||||
@@ -197,16 +194,15 @@ end
|
|||||||
--- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided
|
--- @param msg LocalisedString? An optional error message to be included in the output, a generic message is used if not provided
|
||||||
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
||||||
function Commands.status.invalid_input(msg)
|
function Commands.status.invalid_input(msg)
|
||||||
if msg == nil then return Commands.status.invalid_input, { "exp-commands.invalid-input" } end
|
return Commands.status.invalid_input, msg == nil and { "exp-commands.invalid-input" } or msg
|
||||||
return Commands.status.invalid_input, msg
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to signal an internal error has occurred, this is reserved for internal use only
|
--- Used to signal an internal error has occurred, this is reserved for internal use only
|
||||||
--- @param msg LocalisedString? A message detailing the error which has occurred, will be logged and outputted
|
--- @param msg LocalisedString A message detailing the error which has occurred, will be logged and outputted
|
||||||
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
--- @return Commands.Status, LocalisedString # Should be returned directly without modification
|
||||||
--- @package
|
--- @package
|
||||||
function Commands.status.internal_error(msg)
|
function Commands.status.internal_error(msg)
|
||||||
return Commands.status.internal_error, { "exp-commands.internal-error", msg or "" }
|
return Commands.status.internal_error, { "exp-commands.internal-error", msg }
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @type table<Commands.Status, string>
|
--- @type table<Commands.Status, string>
|
||||||
@@ -285,7 +281,7 @@ end
|
|||||||
--- @alias Commands.InputParserFactory<T> fun(...: any): Commands.InputParser<T>
|
--- @alias Commands.InputParserFactory<T> fun(...: any): Commands.InputParser<T>
|
||||||
|
|
||||||
--- Add a new input parser to the command library, this method validates that it does not already exist
|
--- Add a new input parser to the command library, this method validates that it does not already exist
|
||||||
--- @generic T : Commands.InputParser<any> | Commands.InputParserFactory<any>
|
--- @generic T : Commands.InputParser | Commands.InputParserFactory
|
||||||
--- @param data_type string The name of the data type the input parser reads in and validates, becomes a key of Commands.types
|
--- @param data_type string The name of the data type the input parser reads in and validates, becomes a key of Commands.types
|
||||||
--- @param input_parser T The function used to parse and validate the data type
|
--- @param input_parser T The function used to parse and validate the data type
|
||||||
--- @return T # The function which was provided as the second argument
|
--- @return T # The function which was provided as the second argument
|
||||||
@@ -299,7 +295,7 @@ function Commands.add_data_type(data_type, input_parser)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Remove an input parser for a data type, must be the same string that was passed to add_input_parser
|
--- Remove an input parser for a data type, must be the same string that was passed to add_input_parser
|
||||||
--- @param data_type string | Commands.InputParser<any> | Commands.InputParserFactory<any> The data type or input parser you want to remove the input parser for
|
--- @param data_type string | Commands.InputParser | Commands.InputParserFactory The data type or input parser you want to remove the input parser for
|
||||||
function Commands.remove_data_type(data_type)
|
function Commands.remove_data_type(data_type)
|
||||||
Commands.types[data_type] = nil
|
Commands.types[data_type] = nil
|
||||||
for k, v in pairs(Commands.types) do
|
for k, v in pairs(Commands.types) do
|
||||||
@@ -437,7 +433,7 @@ end
|
|||||||
--- Add a new required argument to the command of the given data type
|
--- Add a new required argument to the command of the given data type
|
||||||
--- @param name string The name of the argument being added
|
--- @param name string The name of the argument being added
|
||||||
--- @param description LocalisedString? The description of the argument being added
|
--- @param description LocalisedString? The description of the argument being added
|
||||||
--- @param input_parser Commands.InputParser<any> The input parser to be used for the argument
|
--- @param input_parser Commands.InputParser The input parser to be used for the argument
|
||||||
--- @return ExpCommand
|
--- @return ExpCommand
|
||||||
function Commands._prototype:argument(name, description, input_parser)
|
function Commands._prototype:argument(name, description, input_parser)
|
||||||
assert_command_mutable(self)
|
assert_command_mutable(self)
|
||||||
@@ -458,7 +454,7 @@ end
|
|||||||
--- Add a new optional argument to the command of the given data type
|
--- Add a new optional argument to the command of the given data type
|
||||||
--- @param name string The name of the argument being added
|
--- @param name string The name of the argument being added
|
||||||
--- @param description LocalisedString? The description of the argument being added
|
--- @param description LocalisedString? The description of the argument being added
|
||||||
--- @param input_parser Commands.InputParser<any> The input parser to be used for the argument
|
--- @param input_parser Commands.InputParser The input parser to be used for the argument
|
||||||
--- @return ExpCommand
|
--- @return ExpCommand
|
||||||
function Commands._prototype:optional(name, description, input_parser)
|
function Commands._prototype:optional(name, description, input_parser)
|
||||||
assert_command_mutable(self)
|
assert_command_mutable(self)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ local Search = {}
|
|||||||
local Storage = require("modules/exp_util/storage")
|
local Storage = require("modules/exp_util/storage")
|
||||||
|
|
||||||
--- Setup the storage to contain the pending translations and the completed ones
|
--- Setup the storage to contain the pending translations and the completed ones
|
||||||
local pending = {} --- @type table<uint, [string, string]>
|
local pending = {} --- @type { [1]: string, [2]: string }[]
|
||||||
local translations = {} --- @type table<string, table<string, string>>
|
local translations = {} --- @type table<string, table<string, string>>
|
||||||
Storage.register({
|
Storage.register({
|
||||||
pending,
|
pending,
|
||||||
@@ -50,7 +50,6 @@ function Search.prepare(custom_commands)
|
|||||||
name = name,
|
name = name,
|
||||||
description = locale_desc,
|
description = locale_desc,
|
||||||
help_text = locale_desc,
|
help_text = locale_desc,
|
||||||
usage = locale_desc,
|
|
||||||
aliases = {},
|
aliases = {},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -66,7 +65,7 @@ function Search.on_player_locale_changed(event)
|
|||||||
local ids = player.request_translations(required_translations)
|
local ids = player.request_translations(required_translations)
|
||||||
assert(ids, "Translation ids was nil")
|
assert(ids, "Translation ids was nil")
|
||||||
for i, command_name in ipairs(command_names) do
|
for i, command_name in ipairs(command_names) do
|
||||||
pending[assert(ids[i])] = { locale, command_name }
|
pending[ids[i]] = { locale, command_name }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@expcluster/lib_commands",
|
"name": "@expcluster/lib_commands",
|
||||||
"version": "6.5.0",
|
"version": "0.1.0",
|
||||||
"description": "Clusterio plugin providing a Lua command processing library.",
|
"description": "Clusterio plugin providing a Lua command processing library.",
|
||||||
"author": "Cooldude2606 <https://github.com/Cooldude2606>",
|
"author": "Cooldude2606 <https://github.com/Cooldude2606>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@clusterio/lib": "workspace:^"
|
"@clusterio/lib": "catalog:"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@clusterio/lib": "workspace:^",
|
"@clusterio/lib": "catalog:",
|
||||||
"@types/node": "catalog:",
|
"@types/node": "catalog:",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"webpack": "catalog:",
|
"webpack": "catalog:",
|
||||||
|
|||||||
@@ -1,434 +0,0 @@
|
|||||||
import { BaseControllerPlugin } from "@clusterio/controller";
|
|
||||||
import * as lib from "@clusterio/lib";
|
|
||||||
import * as messages from "./messages";
|
|
||||||
import * as path from "node:path";
|
|
||||||
|
|
||||||
export class ControllerPlugin extends BaseControllerPlugin {
|
|
||||||
groups!: lib.SubscribableDatastore<messages.GroupRecord>;
|
|
||||||
roleMappings!: lib.SubscribableDatastore<messages.RoleMappingRecord>;
|
|
||||||
manualAssignments!: lib.SubscribableDatastore<messages.AssignmentRecord>;
|
|
||||||
resolvedAssignments!: lib.SubscribableDatastore<messages.AssignmentRecord>;
|
|
||||||
|
|
||||||
async init() {
|
|
||||||
const databaseDirectory = this.controller.config.get("controller.database_directory");
|
|
||||||
|
|
||||||
this.groups = new lib.SubscribableDatastore(
|
|
||||||
...await new lib.JsonIdDatastoreProvider(
|
|
||||||
path.join(databaseDirectory, "exp_groups", "groups.json"),
|
|
||||||
messages.GroupRecord.fromJSON.bind(messages.GroupRecord),
|
|
||||||
).bootstrap()
|
|
||||||
);
|
|
||||||
|
|
||||||
this.roleMappings = new lib.SubscribableDatastore(
|
|
||||||
...await new lib.JsonIdDatastoreProvider(
|
|
||||||
path.join(databaseDirectory, "exp_groups", "role_mappings.json"),
|
|
||||||
messages.RoleMappingRecord.fromJSON.bind(messages.RoleMappingRecord),
|
|
||||||
).bootstrap()
|
|
||||||
);
|
|
||||||
|
|
||||||
this.manualAssignments = new lib.SubscribableDatastore(
|
|
||||||
...await new lib.JsonIdDatastoreProvider(
|
|
||||||
path.join(databaseDirectory, "exp_groups", "assignments.json"),
|
|
||||||
messages.AssignmentRecord.fromJSON.bind(messages.AssignmentRecord),
|
|
||||||
).bootstrap()
|
|
||||||
);
|
|
||||||
|
|
||||||
this.resolvedAssignments = new lib.SubscribableDatastore();
|
|
||||||
|
|
||||||
this.controller.subscriptions.handle(messages.GroupUpdatedEvent, this.handleGroupSubscription.bind(this));
|
|
||||||
this.controller.subscriptions.handle(messages.RoleMappingUpdatedEvent, this.handleRoleMappingSubscription.bind(this));
|
|
||||||
this.controller.subscriptions.handle(messages.ManualAssignmentUpdatedEvent, this.handleManualAssignmentSubscription.bind(this));
|
|
||||||
this.controller.subscriptions.handle(messages.ResolvedAssignmentUpdatedEvent, this.handleResolvedAssignmentSubscription.bind(this));
|
|
||||||
|
|
||||||
this.groups.on("update", this.groupsUpdated.bind(this));
|
|
||||||
this.roleMappings.on("update", this.roleMappingsUpdated.bind(this));
|
|
||||||
this.manualAssignments.on("update", this.manualAssignmentsUpdated.bind(this));
|
|
||||||
this.resolvedAssignments.on("update", this.resolvedAssignmentsUpdated.bind(this));
|
|
||||||
|
|
||||||
this.controller.handle(messages.GroupCreateRequest, this.handleGroupCreateRequest.bind(this));
|
|
||||||
this.controller.handle(messages.GroupUpdateRequest, this.handleGroupUpdateRequest.bind(this));
|
|
||||||
this.controller.handle(messages.GroupDeleteRequest, this.handleGroupDeleteRequest.bind(this));
|
|
||||||
this.controller.handle(messages.GroupGetRequest, this.handleGroupGetRequest.bind(this));
|
|
||||||
this.controller.handle(messages.GroupListRequest, this.handleGroupListRequest.bind(this));
|
|
||||||
|
|
||||||
this.controller.handle(messages.AssignmentCreateRequest, this.handleAssignmentCreateRequest.bind(this));
|
|
||||||
this.controller.handle(messages.AssignmentUpdateRequest, this.handleAssignmentUpdateRequest.bind(this));
|
|
||||||
this.controller.handle(messages.AssignmentDeleteRequest, this.handleAssignmentDeleteRequest.bind(this));
|
|
||||||
this.controller.handle(messages.AssignmentGetRequest, this.handleAssignmentGetRequest.bind(this));
|
|
||||||
this.controller.handle(messages.AssignmentListRequest, this.handleAssignmentListRequest.bind(this));
|
|
||||||
|
|
||||||
this.controller.handle(messages.RoleMappingCreateRequest, this.handleRoleMappingCreateRequest.bind(this));
|
|
||||||
this.controller.handle(messages.RoleMappingUpdateRequest, this.handleRoleMappingUpdateRequest.bind(this));
|
|
||||||
this.controller.handle(messages.RoleMappingDeleteRequest, this.handleRoleMappingDeleteRequest.bind(this));
|
|
||||||
this.controller.handle(messages.RoleMappingGetRequest, this.handleRoleMappingGetRequest.bind(this));
|
|
||||||
this.controller.handle(messages.RoleMappingListRequest, this.handleRoleMappingListRequest.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
async onShutdown() {
|
|
||||||
await Promise.all([
|
|
||||||
this.groups.save(),
|
|
||||||
this.manualAssignments.save(),
|
|
||||||
this.roleMappings.save(),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Subscriptions
|
|
||||||
*/
|
|
||||||
|
|
||||||
async groupsUpdated(groups: messages.GroupRecord[]) {
|
|
||||||
this.controller.subscriptions.broadcast(new messages.GroupUpdatedEvent(groups));
|
|
||||||
|
|
||||||
// We need to do extra work if the group was deleted
|
|
||||||
const deletedGroupIds = groups.filter(g => g.isDeleted).map(g => g.id);
|
|
||||||
if (!deletedGroupIds.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cascade the delete down to affected role mappings
|
|
||||||
const mappingsToDelete = [];
|
|
||||||
for (const mapping of this.roleMappings.values()) {
|
|
||||||
if (deletedGroupIds.includes(mapping.groupId)) {
|
|
||||||
mappingsToDelete.push(mapping);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mappingsToDelete.length) {
|
|
||||||
this.roleMappings.deleteMany(mappingsToDelete);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cascade the delete down to affected manual assignments
|
|
||||||
const affectedPlayers = new Set<string>();
|
|
||||||
const assignmentsToDelete = [];
|
|
||||||
for (const assignment of this.manualAssignments.values()) {
|
|
||||||
if (deletedGroupIds.includes(assignment.groupId)) {
|
|
||||||
assignmentsToDelete.push(assignment);
|
|
||||||
affectedPlayers.add(assignment.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (assignmentsToDelete.length) {
|
|
||||||
this.manualAssignments.deleteMany(assignmentsToDelete);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find all the affected players who were assigned to this group
|
|
||||||
for (const resolved of this.resolvedAssignments.values()) {
|
|
||||||
if (deletedGroupIds.includes(resolved.groupId)) {
|
|
||||||
affectedPlayers.add(resolved.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (affectedPlayers.size) {
|
|
||||||
this.resolvedAssignments.setMany(await this.computeResolvedAssignments([...affectedPlayers]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupSubscription(request: lib.SubscriptionRequest) {
|
|
||||||
const groups = [...this.groups.values()]
|
|
||||||
.filter(group => group.updatedAtMs > request.lastRequestTimeMs);
|
|
||||||
return groups.length ? new messages.GroupUpdatedEvent(groups) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async roleMappingsUpdated(roleMappings: messages.RoleMappingRecord[]) {
|
|
||||||
this.controller.subscriptions.broadcast(new messages.RoleMappingUpdatedEvent(roleMappings));
|
|
||||||
|
|
||||||
// Mappings pointing to a deleted group have already been handled
|
|
||||||
// But if any are active, then we still must recompute all assignments
|
|
||||||
let hasActiveGroup = false;
|
|
||||||
for (const roleMapping of roleMappings) {
|
|
||||||
const group = this.groups.get(roleMapping.groupId);
|
|
||||||
if (group && !group.isDeleted) {
|
|
||||||
hasActiveGroup = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasActiveGroup) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Affected players are those without manual assignments
|
|
||||||
const affectedPlayers = [];
|
|
||||||
for (const resolved of this.resolvedAssignments.values()) {
|
|
||||||
if (!this.manualAssignments.has(resolved.name)) {
|
|
||||||
affectedPlayers.push(resolved.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (affectedPlayers.length) {
|
|
||||||
this.resolvedAssignments.setMany(await this.computeResolvedAssignments(affectedPlayers));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleRoleMappingSubscription(request: lib.SubscriptionRequest) {
|
|
||||||
const mappings = [...this.roleMappings.values()]
|
|
||||||
.filter(mapping => mapping.updatedAtMs > request.lastRequestTimeMs);
|
|
||||||
return mappings.length ? new messages.RoleMappingUpdatedEvent(mappings) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async manualAssignmentsUpdated(assignments: messages.AssignmentRecord[]) {
|
|
||||||
this.controller.subscriptions.broadcast(new messages.ManualAssignmentUpdatedEvent(assignments));
|
|
||||||
|
|
||||||
// Assignments pointing to a deleted group have already been handled
|
|
||||||
const affectedPlayers: string[] = [];
|
|
||||||
for (const assignment of assignments) {
|
|
||||||
const group = this.groups.get(assignment.groupId);
|
|
||||||
if (!group || group.isDeleted) continue;
|
|
||||||
affectedPlayers.push(assignment.name);
|
|
||||||
}
|
|
||||||
if (affectedPlayers.length) {
|
|
||||||
this.resolvedAssignments.setMany(await this.computeResolvedAssignments(affectedPlayers));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleManualAssignmentSubscription(request: lib.SubscriptionRequest) {
|
|
||||||
const assignments = [...this.resolvedAssignments.values()]
|
|
||||||
.filter(a => a.updatedAtMs > request.lastRequestTimeMs);
|
|
||||||
return assignments.length ? new messages.ManualAssignmentUpdatedEvent(assignments) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
resolvedAssignmentsUpdated(assignments: messages.AssignmentRecord[]) {
|
|
||||||
this.controller.subscriptions.broadcast(
|
|
||||||
new messages.ResolvedAssignmentUpdatedEvent(assignments),
|
|
||||||
assignments.map(assignment => assignment.name),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleResolvedAssignmentSubscription(request: lib.SubscriptionRequest) {
|
|
||||||
// Check for any missing assignments to be computed on demand
|
|
||||||
const filters = request.filters.toJSON();
|
|
||||||
if (filters.length) {
|
|
||||||
const missing = filters.filter(name => !this.resolvedAssignments.has(name));
|
|
||||||
if (missing.length) {
|
|
||||||
this.resolvedAssignments.setMany(await this.computeResolvedAssignments(missing));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter the assignments
|
|
||||||
const assignments = (filters.length
|
|
||||||
? filters.map(name => this.resolvedAssignments.get(name)).filter(Boolean)
|
|
||||||
: [...this.resolvedAssignments.values()]
|
|
||||||
).filter(a => a.updatedAtMs > request.lastRequestTimeMs);
|
|
||||||
|
|
||||||
return assignments.length ? new messages.ResolvedAssignmentUpdatedEvent(assignments) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Groups
|
|
||||||
*/
|
|
||||||
|
|
||||||
async handleGroupListRequest() {
|
|
||||||
return [...this.groups.values()];
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupCreateRequest(request: messages.GroupCreateRequest) {
|
|
||||||
if ([...this.groups.values()].some(g => g.name === request.name)) {
|
|
||||||
throw new lib.RequestError(`Group with name '${request.name}' already exists`);
|
|
||||||
}
|
|
||||||
|
|
||||||
let id = Math.random() * 2**31 | 0;
|
|
||||||
while (this.groups.has(id)) {
|
|
||||||
id = Math.random() * 2**31 | 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const group = new messages.GroupRecord(id, request.name, request.permissions);
|
|
||||||
this.groups.set(group);
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupUpdateRequest(request: messages.GroupUpdateRequest) {
|
|
||||||
const group = request.group;
|
|
||||||
if (group.id === undefined || !this.groups.has(group.id)) {
|
|
||||||
throw new lib.RequestError(`Group with ID ${group.id} does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.groups.set(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupDeleteRequest(request: messages.GroupDeleteRequest) {
|
|
||||||
const { groupId } = request;
|
|
||||||
|
|
||||||
const group = this.groups.getMutable(groupId);
|
|
||||||
if (!group) {
|
|
||||||
throw new lib.RequestError(`Group with ID ${groupId} does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.groups.delete(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupGetRequest(request: messages.GroupGetRequest) {
|
|
||||||
const group = this.groups.get(request.groupId);
|
|
||||||
if (!group) {
|
|
||||||
throw new lib.RequestError(`Group with ID ${request.groupId} does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Groups
|
|
||||||
*/
|
|
||||||
|
|
||||||
async handleAssignmentListRequest() {
|
|
||||||
return [...this.manualAssignments.values()];
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleAssignmentCreateRequest(request: messages.AssignmentCreateRequest) {
|
|
||||||
const { name, groupId } = request;
|
|
||||||
if (this.manualAssignments.has(name)) {
|
|
||||||
throw new lib.RequestError(`Assignment for '${name}' already exists`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const assignment = new messages.AssignmentRecord(name, groupId);
|
|
||||||
this.manualAssignments.set(assignment);
|
|
||||||
return assignment;
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleAssignmentUpdateRequest(request: messages.AssignmentUpdateRequest) {
|
|
||||||
const assignment = request.assignment;
|
|
||||||
if (!this.manualAssignments.has(assignment.name)) {
|
|
||||||
throw new lib.RequestError(`Assignment for '${assignment.name}' does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.manualAssignments.set(assignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleAssignmentDeleteRequest(request: messages.AssignmentDeleteRequest) {
|
|
||||||
const { name } = request;
|
|
||||||
|
|
||||||
const assignment = this.manualAssignments.getMutable(name);
|
|
||||||
if (!assignment) {
|
|
||||||
throw new lib.RequestError(`Assignment for '${name}' does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.manualAssignments.delete(assignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleAssignmentGetRequest(request: messages.AssignmentGetRequest) {
|
|
||||||
if (request.resolve) {
|
|
||||||
let assignment = this.resolvedAssignments.get(request.name);
|
|
||||||
if (!assignment) {
|
|
||||||
assignment = await this.computeResolvedAssignment(request.name);
|
|
||||||
this.resolvedAssignments.set(assignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
return assignment;
|
|
||||||
}
|
|
||||||
|
|
||||||
const assignment = this.manualAssignments.get(request.name);
|
|
||||||
if (!assignment) {
|
|
||||||
throw new lib.RequestError(`Assignment for '${request.name}' does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return assignment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Role mappings
|
|
||||||
*/
|
|
||||||
|
|
||||||
async handleRoleMappingListRequest() {
|
|
||||||
return [...this.roleMappings.values()];
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleRoleMappingCreateRequest(request: messages.RoleMappingCreateRequest) {
|
|
||||||
let id = Math.random() * 2**31 | 0;
|
|
||||||
while (this.roleMappings.has(id)) {
|
|
||||||
id = Math.random() * 2**31 | 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
let priority = request.priority;
|
|
||||||
const existing = new Set([...this.roleMappings.values()].map(m => m.priority));
|
|
||||||
while (existing.has(priority)) {
|
|
||||||
priority++;
|
|
||||||
}
|
|
||||||
|
|
||||||
const roleMapping = new messages.RoleMappingRecord(
|
|
||||||
id, new Set(request.roleIds), request.groupId, priority, request.enabled,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.roleMappings.set(roleMapping);
|
|
||||||
return roleMapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleRoleMappingUpdateRequest(request: messages.RoleMappingUpdateRequest) {
|
|
||||||
const roleMapping = request.roleMapping;
|
|
||||||
if (roleMapping.id === undefined || !this.roleMappings.has(roleMapping.id)) {
|
|
||||||
throw new lib.RequestError(`Role mapping with ID ${roleMapping.id} does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const existing = new Set(
|
|
||||||
[...this.roleMappings.values()]
|
|
||||||
.filter(m => m.id !== roleMapping.id)
|
|
||||||
.map(m => m.priority)
|
|
||||||
);
|
|
||||||
|
|
||||||
let priority = roleMapping.priority;
|
|
||||||
while (existing.has(priority)) {
|
|
||||||
priority++;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.roleMappings.set(roleMapping);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleRoleMappingDeleteRequest(request: messages.RoleMappingDeleteRequest) {
|
|
||||||
const { id } = request;
|
|
||||||
|
|
||||||
const mapping = this.roleMappings.getMutable(id);
|
|
||||||
if (!mapping) {
|
|
||||||
throw new lib.RequestError(`Role mapping with ID ${id} does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.roleMappings.delete(mapping);
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleRoleMappingGetRequest(request: messages.RoleMappingGetRequest) {
|
|
||||||
const mapping = this.roleMappings.get(request.id);
|
|
||||||
if (!mapping) {
|
|
||||||
throw new lib.RequestError(`Role mapping with ID ${request.id} does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Calculating assignments
|
|
||||||
*/
|
|
||||||
|
|
||||||
async computeResolvedAssignment(playerName: string): Promise<messages.AssignmentRecord> {
|
|
||||||
// 1) Manual override
|
|
||||||
const manual = this.manualAssignments.get(playerName);
|
|
||||||
if (manual) {
|
|
||||||
return manual;
|
|
||||||
}
|
|
||||||
|
|
||||||
const user = this.controller.users.getByName(playerName);
|
|
||||||
const userRoles = user?.roleIds ?? new Set<number>();
|
|
||||||
|
|
||||||
// 2) Role mappings
|
|
||||||
let best: messages.RoleMappingRecord | null = null;
|
|
||||||
for (const mapping of this.roleMappings.values()) {
|
|
||||||
if (!mapping.enabled) continue;
|
|
||||||
|
|
||||||
let matches = true;
|
|
||||||
for (const roleId of mapping.roleIds) {
|
|
||||||
if (!userRoles.has(roleId)) {
|
|
||||||
matches = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!matches) continue;
|
|
||||||
|
|
||||||
if (!best || mapping.priority > best.priority) {
|
|
||||||
best = mapping;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (best) {
|
|
||||||
return new messages.AssignmentRecord(playerName, best.groupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3) Default (deleted assignment, assigns to 'Default' in game)
|
|
||||||
return new messages.AssignmentRecord(playerName, 0, 0, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
async computeResolvedAssignments(playerNames: string[]): Promise<messages.AssignmentRecord[]> {
|
|
||||||
return Promise.all(playerNames.map(name => this.computeResolvedAssignment(name)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,183 +0,0 @@
|
|||||||
import * as lib from "@clusterio/lib";
|
|
||||||
import * as messages from "./messages";
|
|
||||||
|
|
||||||
declare module "@clusterio/lib" {
|
|
||||||
export interface InstanceConfigFields {
|
|
||||||
"exp_groups.sync_mode": "enabled" | "disabled" | "bidirectional"
|
|
||||||
}
|
|
||||||
export interface ControllerConfigFields {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Group permissions
|
|
||||||
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.group.get",
|
|
||||||
title: "Get Groups",
|
|
||||||
description: "Retrieve a specific Factorio permission group by ID.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.group.list",
|
|
||||||
title: "List Groups",
|
|
||||||
description: "List all Factorio permission groups.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.group.subscribe",
|
|
||||||
title: "Subscribe to Group Updates",
|
|
||||||
description: "Receive updates when Factorio permission groups change.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.group.create",
|
|
||||||
title: "Create Groups",
|
|
||||||
description: "Create new Factorio permission groups.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.group.update",
|
|
||||||
title: "Update Groups",
|
|
||||||
description: "Modify existing Factorio permission groups.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.group.delete",
|
|
||||||
title: "Delete Groups",
|
|
||||||
description: "Delete Factorio permission groups.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assignment permissions
|
|
||||||
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.assignment.get",
|
|
||||||
title: "Get Assignments",
|
|
||||||
description: "Retrieve a specific manual group assignment for a player.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.assignment.list",
|
|
||||||
title: "List Assignments",
|
|
||||||
description: "List all manual group assignments.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.assignment.subscribe",
|
|
||||||
title: "Subscribe to Assignment Updates",
|
|
||||||
description: "Receive updates when manual group assignments change.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.assignment.create",
|
|
||||||
title: "Create Assignments",
|
|
||||||
description: "Manually assign players to groups, overriding role mappings.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.assignment.update",
|
|
||||||
title: "Update Assignments",
|
|
||||||
description: "Modify existing manual group assignments.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.assignment.delete",
|
|
||||||
title: "Delete Assignments",
|
|
||||||
description: "Remove manual group assignments.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Role mapping permissions
|
|
||||||
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.role_mapping.get",
|
|
||||||
title: "Get Role Mappings",
|
|
||||||
description: "Retrieve a specific role mapping rule.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.role_mapping.list",
|
|
||||||
title: "List Role Mappings",
|
|
||||||
description: "List all role mapping rules.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.role_mapping.subscribe",
|
|
||||||
title: "Subscribe to Role Mapping Updates",
|
|
||||||
description: "Receive updates when role mapping rules change.",
|
|
||||||
grantByDefault: true,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.role_mapping.create",
|
|
||||||
title: "Create Role Mappings",
|
|
||||||
description: "Create rules that map user roles to Factorio permission groups.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.role_mapping.update",
|
|
||||||
title: "Update Role Mappings",
|
|
||||||
description: "Modify existing role mapping rules.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
lib.definePermission({
|
|
||||||
name: "exp_groups.role_mapping.delete",
|
|
||||||
title: "Delete Role Mappings",
|
|
||||||
description: "Delete role mapping rules.",
|
|
||||||
grantByDefault: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const plugin: lib.PluginDeclaration = {
|
|
||||||
name: "exp_groups",
|
|
||||||
title: "ExpGaming - Permission Groups",
|
|
||||||
description: "Clusterio plugin providing syncing of permission groups",
|
|
||||||
|
|
||||||
features: [
|
|
||||||
"SavePatching",
|
|
||||||
"ScriptCommands",
|
|
||||||
],
|
|
||||||
|
|
||||||
messages: [
|
|
||||||
messages.GroupUpdatedEvent,
|
|
||||||
messages.ManualAssignmentUpdatedEvent,
|
|
||||||
messages.ResolvedAssignmentUpdatedEvent,
|
|
||||||
messages.RoleMappingUpdatedEvent,
|
|
||||||
|
|
||||||
messages.GroupCreateRequest,
|
|
||||||
messages.GroupUpdateRequest,
|
|
||||||
messages.GroupDeleteRequest,
|
|
||||||
messages.GroupGetRequest,
|
|
||||||
messages.GroupListRequest,
|
|
||||||
|
|
||||||
messages.AssignmentCreateRequest,
|
|
||||||
messages.AssignmentUpdateRequest,
|
|
||||||
messages.AssignmentDeleteRequest,
|
|
||||||
messages.AssignmentGetRequest,
|
|
||||||
messages.AssignmentListRequest,
|
|
||||||
|
|
||||||
messages.RoleMappingCreateRequest,
|
|
||||||
messages.RoleMappingUpdateRequest,
|
|
||||||
messages.RoleMappingDeleteRequest,
|
|
||||||
messages.RoleMappingGetRequest,
|
|
||||||
messages.RoleMappingListRequest,
|
|
||||||
],
|
|
||||||
|
|
||||||
instanceEntrypoint: "./dist/node/instance",
|
|
||||||
instanceConfigFields: {
|
|
||||||
"exp_groups.sync_mode": {
|
|
||||||
description: "Synchronize permission groups with the controller",
|
|
||||||
type: "string",
|
|
||||||
enum: ["disabled", "enabled", "bidirectional"],
|
|
||||||
initialValue: "bidirectional",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
controllerEntrypoint: "./dist/node/controller",
|
|
||||||
controllerConfigFields: {
|
|
||||||
},
|
|
||||||
|
|
||||||
webEntrypoint: "./web",
|
|
||||||
routes: [
|
|
||||||
"/permission_groups",
|
|
||||||
"/permission_groups/:id/view",
|
|
||||||
]
|
|
||||||
};
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
import { BaseInstancePlugin } from "@clusterio/host";
|
|
||||||
import * as lib from "@clusterio/lib";
|
|
||||||
import * as messages from "./messages";
|
|
||||||
|
|
||||||
export type IpcGroupUpdated = {
|
|
||||||
group_name: string,
|
|
||||||
group_id: number | undefined,
|
|
||||||
permissions: { is_blacklist: boolean, permissions: string[] | undefined },
|
|
||||||
};
|
|
||||||
|
|
||||||
export type IpcGroupDeleted = {
|
|
||||||
group_name: string,
|
|
||||||
group_id: number | undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type IpcPlayerAssignments = {
|
|
||||||
assignments: Record<string, number>,
|
|
||||||
};
|
|
||||||
|
|
||||||
export class InstancePlugin extends BaseInstancePlugin {
|
|
||||||
// Once only, don't send permissions for these groups
|
|
||||||
// This is used for groups created on this instance that only need the controller generated id
|
|
||||||
skipSendingPermissions = new Set<string>();
|
|
||||||
// This is used for groups updated / deleted on this instance to stop cycles
|
|
||||||
skipSendingUpdate = new Set<number>();
|
|
||||||
// Track known online players so that we only apply assignment updates for them
|
|
||||||
onlinePlayers = new Set<string>();
|
|
||||||
|
|
||||||
async init() {
|
|
||||||
this.instance.handle(messages.GroupUpdatedEvent, this.handleGroupUpdatedEvent.bind(this));
|
|
||||||
this.instance.handle(messages.ResolvedAssignmentUpdatedEvent, this.handleResolvedAssignmentUpdatedEvent.bind(this));
|
|
||||||
this.instance.server.handle(`exp_group:group_updated`, this.handleGroupUpdatedIPC.bind(this))
|
|
||||||
this.instance.server.handle(`exp_group:group_deleted`, this.handleGroupDeletedIPC.bind(this))
|
|
||||||
this.instance.server.handle(`exp_group:player_assignments`, this.handlePlayerAssignmentsIPC.bind(this))
|
|
||||||
}
|
|
||||||
|
|
||||||
async onInstanceConfigFieldChanged(field: string, curr: unknown, prev: unknown) {
|
|
||||||
switch(field) {
|
|
||||||
case "exp_groups.sync_mode":
|
|
||||||
await this.luaSetEmitEvents(curr == "bidirectional")
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async onStart() {
|
|
||||||
// We use Date.now() because we need to manually initialise the groups on the lua side
|
|
||||||
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
|
||||||
`exp_groups:${messages.GroupUpdatedEvent.name}`, "subscribe", Date.now()
|
|
||||||
));
|
|
||||||
const groups = await this.instance.sendTo("controller", new messages.GroupListRequest())
|
|
||||||
await this.luaSendInitialGroups(groups);
|
|
||||||
await this.luaSetEmitEvents(this.instance.config.get("exp_groups.sync_mode") == "bidirectional")
|
|
||||||
}
|
|
||||||
|
|
||||||
async onPlayerEvent(event: lib.PlayerEvent) {
|
|
||||||
switch(event.type) {
|
|
||||||
case "join":
|
|
||||||
this.onlinePlayers.add(event.name);
|
|
||||||
await this.subscribePlayerAssignment(event.name);
|
|
||||||
break;
|
|
||||||
case "leave":
|
|
||||||
this.onlinePlayers.delete(event.name);
|
|
||||||
await this.unsubscribePlayerAssignment(event.name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupUpdatedEvent(event: messages.GroupUpdatedEvent) {
|
|
||||||
for (const group of event.updates) {
|
|
||||||
await this.luaSendGroupUpdate(group);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleResolvedAssignmentUpdatedEvent(event: messages.ManualAssignmentUpdatedEvent) {
|
|
||||||
for (const assignment of event.updates) {
|
|
||||||
if (this.onlinePlayers.has(assignment.name)) {
|
|
||||||
await this.luaSendAssignmentUpdate(assignment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupUpdatedIPC(event: IpcGroupUpdated) {
|
|
||||||
const permissions = new messages.GroupPermissions(
|
|
||||||
event.permissions.is_blacklist,
|
|
||||||
event.permissions.permissions ?? [],
|
|
||||||
)
|
|
||||||
|
|
||||||
if (event.group_id === undefined) {
|
|
||||||
this.skipSendingPermissions.add(event.group_name);
|
|
||||||
await this.instance.sendTo("controller",
|
|
||||||
new messages.GroupCreateRequest(event.group_name, permissions),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.skipSendingUpdate.add(event.group_id);
|
|
||||||
await this.instance.sendTo("controller", new messages.GroupUpdateRequest(
|
|
||||||
new messages.GroupRecord(event.group_id, event.group_name, permissions),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleGroupDeletedIPC(event: IpcGroupDeleted) {
|
|
||||||
if (event.group_id === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.skipSendingUpdate.add(event.group_id);
|
|
||||||
await this.instance.sendTo("controller", new messages.GroupDeleteRequest(event.group_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
async handlePlayerAssignmentsIPC(event: IpcPlayerAssignments) {
|
|
||||||
await Promise.all(
|
|
||||||
Object.entries(event.assignments).map(([playerName, groupId]) =>
|
|
||||||
this.instance.sendTo("controller",
|
|
||||||
new messages.AssignmentUpdateRequest(new messages.AssignmentRecord(playerName, groupId)),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async subscribePlayerAssignment(playerName: string) {
|
|
||||||
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
|
||||||
`exp_groups:${messages.ResolvedAssignmentUpdatedEvent.name}`, "subscribe", 0, lib.SubscriptionFilters.fromShorthand(playerName)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
async unsubscribePlayerAssignment(playerName: string) {
|
|
||||||
await this.instance.sendTo("controller", new lib.SubscriptionRequest(
|
|
||||||
`exp_groups:${messages.ResolvedAssignmentUpdatedEvent.name}`, "unsubscribe", 0, lib.SubscriptionFilters.fromShorthand(playerName)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
async luaSendInitialGroups(groups: messages.GroupRecord[]) {
|
|
||||||
if (this.instance.config.get("exp_groups.sync_mode") === "disabled") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await this.luaSend("initialise_groups", groups);
|
|
||||||
}
|
|
||||||
|
|
||||||
async luaSendGroupUpdate(group: messages.GroupRecord) {
|
|
||||||
if (this.instance.config.get("exp_groups.sync_mode") === "disabled") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.skipSendingUpdate.has(group.id)) {
|
|
||||||
this.skipSendingUpdate.delete(group.id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const json = group.toJSON();
|
|
||||||
if (this.skipSendingPermissions.has(group.name)) {
|
|
||||||
this.skipSendingPermissions.delete(group.name);
|
|
||||||
delete (json as any).permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.luaSend("receive_group_update", json);
|
|
||||||
}
|
|
||||||
|
|
||||||
async luaSendAssignmentUpdate(assignment: messages.AssignmentRecord) {
|
|
||||||
if (this.instance.config.get("exp_groups.sync_mode") === "disabled") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await this.luaSend("receive_assignment_update", assignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
async luaSetEmitEvents(emitEvents: boolean) {
|
|
||||||
await this.luaSend("set_emit_events", emitEvents);
|
|
||||||
}
|
|
||||||
|
|
||||||
async luaSend(receiver: string, json: any) {
|
|
||||||
await this.instance.sendRcon(`/sc exp_groups.${receiver}(helpers.json_to_table[=[${JSON.stringify(json)}]=])`, true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,692 +0,0 @@
|
|||||||
import * as lib from "@clusterio/lib";
|
|
||||||
import { Type, Static } from "@sinclair/typebox";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Data records
|
|
||||||
*/
|
|
||||||
|
|
||||||
export class GroupPermissions {
|
|
||||||
constructor(
|
|
||||||
public isBlacklist: boolean,
|
|
||||||
public permissions: string[],
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
is_blacklist: Type.Boolean(),
|
|
||||||
permissions: Type.Array(Type.String()),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON(): Static<typeof GroupPermissions.jsonSchema> {
|
|
||||||
return {
|
|
||||||
is_blacklist: this.isBlacklist,
|
|
||||||
permissions: this.permissions,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
json.is_blacklist,
|
|
||||||
json.permissions,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GroupRecord {
|
|
||||||
constructor(
|
|
||||||
public id: number,
|
|
||||||
public name: string,
|
|
||||||
public permissions: GroupPermissions,
|
|
||||||
public updatedAtMs: number = 0,
|
|
||||||
public isDeleted: boolean = false,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
id: Type.Integer(),
|
|
||||||
name: Type.String(),
|
|
||||||
permissions: GroupPermissions.jsonSchema,
|
|
||||||
updated_at_ms: Type.Optional(Type.Number()),
|
|
||||||
is_deleted: Type.Optional(Type.Boolean()),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
let json: Static<typeof GroupRecord.jsonSchema> = {
|
|
||||||
id: this.id,
|
|
||||||
name: this.name,
|
|
||||||
permissions: this.permissions.toJSON(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.updatedAtMs) {
|
|
||||||
json.updated_at_ms = this.updatedAtMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isDeleted) {
|
|
||||||
json.is_deleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
json.id,
|
|
||||||
json.name,
|
|
||||||
GroupPermissions.fromJSON(json.permissions),
|
|
||||||
json.updated_at_ms ?? 0,
|
|
||||||
json.is_deleted ?? false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssignmentRecord {
|
|
||||||
constructor(
|
|
||||||
public name: string,
|
|
||||||
public groupId: number,
|
|
||||||
public updatedAtMs: number = 0,
|
|
||||||
public isDeleted: boolean = false,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
get id() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
name: Type.String(),
|
|
||||||
group_id: Type.Integer(),
|
|
||||||
updated_at_ms: Type.Optional(Type.Number()),
|
|
||||||
is_deleted: Type.Optional(Type.Boolean()),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON(): Static<typeof AssignmentRecord.jsonSchema> {
|
|
||||||
let json: Static<typeof AssignmentRecord.jsonSchema> = {
|
|
||||||
name: this.name,
|
|
||||||
group_id: this.groupId,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.updatedAtMs) {
|
|
||||||
json.updated_at_ms = this.updatedAtMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isDeleted) {
|
|
||||||
json.is_deleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
json.name,
|
|
||||||
json.group_id,
|
|
||||||
json.updated_at_ms ?? 0,
|
|
||||||
json.is_deleted ?? false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoleMappingRecord {
|
|
||||||
constructor(
|
|
||||||
public id: number,
|
|
||||||
public roleIds: Set<number>,
|
|
||||||
public groupId: number,
|
|
||||||
public priority: number,
|
|
||||||
public enabled: boolean,
|
|
||||||
public updatedAtMs: number = 0,
|
|
||||||
public isDeleted: boolean = false,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
id: Type.Integer(),
|
|
||||||
role_ids: Type.Array(Type.Integer()),
|
|
||||||
group_id: Type.Integer(),
|
|
||||||
priority: Type.Number(),
|
|
||||||
enabled: Type.Boolean(),
|
|
||||||
updated_at_ms: Type.Optional(Type.Number()),
|
|
||||||
is_deleted: Type.Optional(Type.Boolean()),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON(): Static<typeof RoleMappingRecord.jsonSchema> {
|
|
||||||
let json: Static<typeof RoleMappingRecord.jsonSchema> = {
|
|
||||||
id: this.id,
|
|
||||||
role_ids: [...this.roleIds],
|
|
||||||
group_id: this.groupId,
|
|
||||||
priority: this.priority,
|
|
||||||
enabled: this.enabled,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.updatedAtMs) {
|
|
||||||
json.updated_at_ms = this.updatedAtMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isDeleted) {
|
|
||||||
json.is_deleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
json.id,
|
|
||||||
new Set(json.role_ids),
|
|
||||||
json.group_id,
|
|
||||||
json.priority,
|
|
||||||
json.enabled,
|
|
||||||
json.updated_at_ms ?? 0,
|
|
||||||
json.is_deleted ?? false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Update events
|
|
||||||
*/
|
|
||||||
|
|
||||||
export class GroupUpdatedEvent {
|
|
||||||
declare ["constructor"]: typeof GroupUpdatedEvent;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "event" as const;
|
|
||||||
static src = "controller" as const;
|
|
||||||
static dst = ["control", "instance"] as const;
|
|
||||||
static permission = "exp_groups.group.subscribe" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public updates: GroupRecord[],
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
updates: Type.Array(GroupRecord.jsonSchema),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return { updates: this.updates.map(group => group.toJSON()) };
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.updates.map(group => GroupRecord.fromJSON(group)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ManualAssignmentUpdatedEvent {
|
|
||||||
declare ["constructor"]: typeof ManualAssignmentUpdatedEvent;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "event" as const;
|
|
||||||
static src = "controller" as const;
|
|
||||||
static dst = ["control", "instance"] as const;
|
|
||||||
static permission = "exp_groups.assignment.subscribe" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public updates: AssignmentRecord[],
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
updates: Type.Array(AssignmentRecord.jsonSchema),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return { updates: this.updates.map(assignment => assignment.toJSON()) };
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.updates.map(assignment => AssignmentRecord.fromJSON(assignment)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ResolvedAssignmentUpdatedEvent {
|
|
||||||
declare ["constructor"]: typeof ResolvedAssignmentUpdatedEvent;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "event" as const;
|
|
||||||
static src = "controller" as const;
|
|
||||||
static dst = ["control", "instance"] as const;
|
|
||||||
static permission = "exp_groups.assignment.subscribe" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public updates: AssignmentRecord[],
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
updates: Type.Array(AssignmentRecord.jsonSchema),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return { updates: this.updates.map(assignment => assignment.toJSON()) };
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.updates.map(assignment => AssignmentRecord.fromJSON(assignment)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoleMappingUpdatedEvent {
|
|
||||||
declare ["constructor"]: typeof RoleMappingUpdatedEvent;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "event" as const;
|
|
||||||
static src = "controller" as const;
|
|
||||||
static dst = "control" as const;
|
|
||||||
static permission = "exp_groups.role_mapping.subscribe" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public updates: RoleMappingRecord[],
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
updates: Type.Array(RoleMappingRecord.jsonSchema),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return { updates: this.updates.map(roleMapping => roleMapping.toJSON()) };
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.updates.map(roleMapping => RoleMappingRecord.fromJSON(roleMapping)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Group requests
|
|
||||||
*/
|
|
||||||
|
|
||||||
export class GroupCreateRequest {
|
|
||||||
declare ["constructor"]: typeof GroupCreateRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.group.create" as const;
|
|
||||||
static Response = GroupRecord;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public name: string,
|
|
||||||
public permissions: GroupPermissions,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
name: Type.String(),
|
|
||||||
permissions: GroupPermissions.jsonSchema,
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
name: this.name,
|
|
||||||
permissions: this.permissions.toJSON(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
json.name,
|
|
||||||
GroupPermissions.fromJSON(json.permissions),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GroupUpdateRequest {
|
|
||||||
declare ["constructor"]: typeof GroupUpdateRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.group.update" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public group: GroupRecord,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
group: GroupRecord.jsonSchema,
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
group: this.group.toJSON(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
GroupRecord.fromJSON(json.group),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GroupDeleteRequest {
|
|
||||||
declare ["constructor"]: typeof GroupDeleteRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.group.delete" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public groupId: number,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
group_id: Type.Integer(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
group_id: this.groupId,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.group_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GroupGetRequest {
|
|
||||||
declare ["constructor"]: typeof GroupGetRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.group.get" as const;
|
|
||||||
static Response = GroupRecord;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public groupId: number,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
group_id: Type.Integer(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
group_id: this.groupId,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.group_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GroupListRequest {
|
|
||||||
declare ["constructor"]: typeof GroupListRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.group.list" as const;
|
|
||||||
static Response = lib.jsonArray(GroupRecord);
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Assignment requests
|
|
||||||
*/
|
|
||||||
|
|
||||||
export class AssignmentCreateRequest {
|
|
||||||
declare ["constructor"]: typeof AssignmentCreateRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.assignment.create" as const;
|
|
||||||
static Response = AssignmentRecord;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public name: string,
|
|
||||||
public groupId: number,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
name: Type.String(),
|
|
||||||
group_id: Type.Integer(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
name: this.name,
|
|
||||||
group_id: this.groupId,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.name, json.group_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssignmentUpdateRequest {
|
|
||||||
declare ["constructor"]: typeof AssignmentUpdateRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.assignment.update" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public assignment: AssignmentRecord,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
assignment: AssignmentRecord.jsonSchema,
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
assignment: this.assignment.toJSON(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
AssignmentRecord.fromJSON(json.assignment),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssignmentDeleteRequest {
|
|
||||||
declare ["constructor"]: typeof AssignmentDeleteRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.assignment.delete" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public name: string,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
name: Type.String(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
name: this.name,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssignmentGetRequest {
|
|
||||||
declare ["constructor"]: typeof AssignmentGetRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.assignment.get" as const;
|
|
||||||
static Response = AssignmentRecord;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public name: string,
|
|
||||||
public resolve: boolean = false,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
name: Type.String(),
|
|
||||||
resolve: Type.Boolean(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
name: this.name,
|
|
||||||
resolve: this.resolve,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.name, json.resolve);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AssignmentListRequest {
|
|
||||||
declare ["constructor"]: typeof AssignmentListRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.assignment.list" as const;
|
|
||||||
static Response = lib.jsonArray(AssignmentRecord);
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Role mapping requests
|
|
||||||
*/
|
|
||||||
|
|
||||||
export class RoleMappingCreateRequest {
|
|
||||||
declare ["constructor"]: typeof RoleMappingCreateRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.role_mapping.create" as const;
|
|
||||||
static Response = RoleMappingRecord;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public roleIds: number[],
|
|
||||||
public groupId: number,
|
|
||||||
public priority: number,
|
|
||||||
public enabled: boolean,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
role_ids: Type.Array(Type.Integer()),
|
|
||||||
group_id: Type.Integer(),
|
|
||||||
priority: Type.Number(),
|
|
||||||
enabled: Type.Boolean(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
role_ids: this.roleIds,
|
|
||||||
group_id: this.groupId,
|
|
||||||
priority: this.priority,
|
|
||||||
enabled: this.enabled,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
json.role_ids,
|
|
||||||
json.group_id,
|
|
||||||
json.priority,
|
|
||||||
json.enabled,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoleMappingUpdateRequest {
|
|
||||||
declare ["constructor"]: typeof RoleMappingUpdateRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.role_mapping.update" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public roleMapping: RoleMappingRecord,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
role_mapping: RoleMappingRecord.jsonSchema,
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
role_mapping: this.roleMapping.toJSON(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(
|
|
||||||
RoleMappingRecord.fromJSON(json.role_mapping),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoleMappingDeleteRequest {
|
|
||||||
declare ["constructor"]: typeof RoleMappingDeleteRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.role_mapping.delete" as const;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public id: number,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
id: Type.Integer(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
id: this.id,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoleMappingGetRequest {
|
|
||||||
declare ["constructor"]: typeof RoleMappingGetRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.role_mapping.get" as const;
|
|
||||||
static Response = RoleMappingRecord;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public id: number,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
|
||||||
id: Type.Integer(),
|
|
||||||
});
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
id: this.id,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
||||||
return new this(json.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoleMappingListRequest {
|
|
||||||
declare ["constructor"]: typeof RoleMappingListRequest;
|
|
||||||
static plugin = "exp_groups" as const;
|
|
||||||
static type = "request" as const;
|
|
||||||
static src = ["control", "instance"] as const;
|
|
||||||
static dst = "controller" as const;
|
|
||||||
static permission = "exp_groups.role_mapping.list" as const;
|
|
||||||
static Response = lib.jsonArray(RoleMappingRecord);
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
}
|
|
||||||
@@ -1,438 +0,0 @@
|
|||||||
--[[-- ExpGroups
|
|
||||||
Adds permission group syncing to clusterio
|
|
||||||
]]
|
|
||||||
|
|
||||||
local clusterio_api = require("modules/clusterio/api")
|
|
||||||
local compat = require("modules/clusterio/compat") --[[@as LibCompat]]
|
|
||||||
|
|
||||||
--- Top level module table, contains event handlers and public methods
|
|
||||||
--- @class ExpGroups
|
|
||||||
local ExpGroups = {}
|
|
||||||
|
|
||||||
--- @class ExpPermissionGroups.GroupPermissions
|
|
||||||
--- @field is_blacklist boolean
|
|
||||||
--- @field permissions string[]?
|
|
||||||
|
|
||||||
--- @class ExpPermissionGroups.GroupRecord
|
|
||||||
--- @field id number
|
|
||||||
--- @field name string
|
|
||||||
--- @field permissions ExpPermissionGroups.GroupPermissions?
|
|
||||||
--- @field is_deleted boolean
|
|
||||||
|
|
||||||
--- @class ExpPermissionGroups.AssignmentRecord
|
|
||||||
--- @field name string
|
|
||||||
--- @field group_id number
|
|
||||||
--- @field is_deleted boolean
|
|
||||||
|
|
||||||
--- @class ExpPermissionGroups.ScriptData
|
|
||||||
--- @field factorio_to_clusterio_id table<number, number?>
|
|
||||||
--- @field clusterio_id_to_group table<number, LuaPermissionGroup?>
|
|
||||||
--- @field dirty_groups table<number, LuaPermissionGroup>
|
|
||||||
--- @field dirty_players table<string, LuaPlayer>
|
|
||||||
--- @field emit_updates boolean
|
|
||||||
local script_data = {}
|
|
||||||
|
|
||||||
local function setup_script_data()
|
|
||||||
if compat.script_data["exp_groups"] == nil then
|
|
||||||
--- @type ExpPermissionGroups.ScriptData
|
|
||||||
compat.script_data["exp_groups"] = {
|
|
||||||
factorio_to_clusterio_id = {},
|
|
||||||
clusterio_id_to_group = {},
|
|
||||||
dirty_groups = {},
|
|
||||||
dirty_players = {},
|
|
||||||
emit_updates = false,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
ExpGroups.on_load()
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Helper methods
|
|
||||||
]]
|
|
||||||
|
|
||||||
--- Get the default factorio permission group
|
|
||||||
--- @return LuaPermissionGroup
|
|
||||||
local function get_default_group()
|
|
||||||
return assert(game.permissions.get_group("Default"))
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Move all players from one group to another
|
|
||||||
--- @param group_src LuaPermissionGroup
|
|
||||||
--- @param group_dst LuaPermissionGroup
|
|
||||||
local function move_players(group_src, group_dst)
|
|
||||||
local add_player = group_dst.add_player
|
|
||||||
for _, player in pairs(group_src.players) do
|
|
||||||
add_player(player)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Apply an encoded permission definition to a group
|
|
||||||
--- @param group LuaPermissionGroup
|
|
||||||
--- @param permissions ExpPermissionGroups.GroupPermissions
|
|
||||||
local function decode_group_permissions(group, permissions)
|
|
||||||
-- Construct a hash map for faster lookup
|
|
||||||
local action_map = {}
|
|
||||||
for _, input_action_name in pairs(assert(permissions.permissions)) do
|
|
||||||
action_map[input_action_name] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Apply the whitelist / backlist to the group
|
|
||||||
local is_blacklist = permissions.is_blacklist
|
|
||||||
local action_allowed = not is_blacklist
|
|
||||||
for input_action_name, input_action in pairs(defines.input_action) do
|
|
||||||
if action_map[input_action_name] then
|
|
||||||
group.set_allows_action(input_action, action_allowed)
|
|
||||||
else
|
|
||||||
group.set_allows_action(input_action, is_blacklist)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Encode the permissions of a group in a shorthand format
|
|
||||||
--- @param group LuaPermissionGroup
|
|
||||||
--- @return ExpPermissionGroups.GroupPermissions
|
|
||||||
local function encode_group_permissions(group)
|
|
||||||
local whitelist = {} --- @type string[]
|
|
||||||
local blacklist = {} --- @type string[]
|
|
||||||
local whitelist_index = 0
|
|
||||||
local blacklist_index = 0
|
|
||||||
|
|
||||||
-- Construct the whitelist and blacklist
|
|
||||||
local allows_action = group.allows_action
|
|
||||||
for input_action_name, input_action in pairs(defines.input_action) do
|
|
||||||
if allows_action(input_action) then
|
|
||||||
whitelist[whitelist_index] = input_action_name
|
|
||||||
whitelist_index = whitelist_index + 1
|
|
||||||
else
|
|
||||||
blacklist[blacklist_index] = input_action_name
|
|
||||||
blacklist_index = blacklist_index + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Return the whitelist if it is smaller
|
|
||||||
if blacklist_index > whitelist_index then
|
|
||||||
return whitelist_index > 0
|
|
||||||
and { is_blacklist = false, permissions = whitelist }
|
|
||||||
or { is_blacklist = false }
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Otherwise return the blacklist as it is smaller
|
|
||||||
return blacklist_index > 0
|
|
||||||
and { is_blacklist = true, permissions = blacklist }
|
|
||||||
or { is_blacklist = true }
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
State handlers
|
|
||||||
]]
|
|
||||||
|
|
||||||
--- Update the factorio permission group
|
|
||||||
--- @param group_record ExpPermissionGroups.GroupRecord
|
|
||||||
local function update_group(group_record)
|
|
||||||
assert(not group_record.is_deleted)
|
|
||||||
|
|
||||||
-- Try find the group by id and then then name
|
|
||||||
local group = script_data.clusterio_id_to_group[group_record.id]
|
|
||||||
if not group then
|
|
||||||
group = game.permissions.get_group(group_record.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create a new group or update the found group
|
|
||||||
if not group or not group.valid then
|
|
||||||
group = assert(game.permissions.create_group(group_record.name))
|
|
||||||
else
|
|
||||||
group.name = group_record.name
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Update the permissions for the group
|
|
||||||
if group_record.permissions then
|
|
||||||
decode_group_permissions(group, group_record.permissions)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Update the script data
|
|
||||||
script_data.factorio_to_clusterio_id[group.group_id] = group_record.id
|
|
||||||
script_data.clusterio_id_to_group[group_record.id] = group
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Delete the factorio permission group
|
|
||||||
--- @param group_record ExpPermissionGroups.GroupRecord
|
|
||||||
local function delete_group(group_record)
|
|
||||||
assert(group_record.is_deleted)
|
|
||||||
|
|
||||||
local default_group = get_default_group()
|
|
||||||
local group = script_data.clusterio_id_to_group[group_record.id]
|
|
||||||
if group then
|
|
||||||
move_players(group, default_group)
|
|
||||||
group.destroy()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Update an assignment by moving the player to their new group
|
|
||||||
--- @param assignment_record ExpPermissionGroups.AssignmentRecord
|
|
||||||
local function update_assignment(assignment_record)
|
|
||||||
assert(not assignment_record.is_deleted)
|
|
||||||
|
|
||||||
local group = script_data.clusterio_id_to_group[assignment_record.group_id]
|
|
||||||
local player = assert(game.get_player(assignment_record.name))
|
|
||||||
if group then
|
|
||||||
group.add_player(player)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Clear an assignment by moving the player to the default group
|
|
||||||
--- @param assignment_record ExpPermissionGroups.AssignmentRecord
|
|
||||||
local function delete_assignment(assignment_record)
|
|
||||||
assert(assignment_record.is_deleted)
|
|
||||||
|
|
||||||
local default_group = get_default_group()
|
|
||||||
local player = assert(game.get_player(assignment_record.name))
|
|
||||||
default_group.add_player(player)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Public methods
|
|
||||||
]]
|
|
||||||
|
|
||||||
--- Restore local references to persistent script data after load
|
|
||||||
function ExpGroups.on_load()
|
|
||||||
script_data = compat.script_data["exp_groups"]
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Enable or disable emitting lua changes back to the instance plugin
|
|
||||||
--- @param enabled boolean?
|
|
||||||
function ExpGroups.set_emit_events(enabled)
|
|
||||||
script_data.emit_updates = enabled ~= false
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Replace local state with expected controller state on startup
|
|
||||||
--- @param group_records ExpPermissionGroups.GroupRecord[]
|
|
||||||
function ExpGroups.initialise_groups(group_records)
|
|
||||||
local _emit_events = script_data.emit_updates
|
|
||||||
script_data.emit_updates = false
|
|
||||||
|
|
||||||
-- Update all the received groups
|
|
||||||
local seen_clusterio_ids = {} --- @type table<number, boolean>
|
|
||||||
for _, group_record in pairs(group_records) do
|
|
||||||
update_group(group_record)
|
|
||||||
seen_clusterio_ids[group_record.id] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Cleanup the script data, removing stale group ids
|
|
||||||
local factorio_to_clusterio_id = script_data.factorio_to_clusterio_id
|
|
||||||
local clusterio_id_to_group = script_data.clusterio_id_to_group
|
|
||||||
for factorio_id, clusterio_id in pairs(factorio_to_clusterio_id) do
|
|
||||||
if not seen_clusterio_ids[clusterio_id] then
|
|
||||||
factorio_to_clusterio_id[factorio_id] = nil
|
|
||||||
clusterio_id_to_group[clusterio_id] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove all other groups
|
|
||||||
local default_group = get_default_group()
|
|
||||||
local default_group_id = default_group.group_id
|
|
||||||
for _, group in pairs(game.permissions.groups) do
|
|
||||||
if not factorio_to_clusterio_id[group.group_id] and group.group_id ~= default_group_id then
|
|
||||||
move_players(group, default_group)
|
|
||||||
group.destroy()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
script_data.emit_updates = _emit_events
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Receive an updated version of a group record
|
|
||||||
--- @param group_record ExpPermissionGroups.GroupRecord
|
|
||||||
function ExpGroups.receive_group_update(group_record)
|
|
||||||
local _emit_events = script_data.emit_updates
|
|
||||||
script_data.emit_updates = false
|
|
||||||
|
|
||||||
if group_record.is_deleted then
|
|
||||||
delete_group(group_record)
|
|
||||||
else
|
|
||||||
update_group(group_record)
|
|
||||||
end
|
|
||||||
|
|
||||||
script_data.emit_updates = _emit_events
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Receive an updated version of a assignment record
|
|
||||||
--- @param assignment_record ExpPermissionGroups.AssignmentRecord
|
|
||||||
function ExpGroups.receive_assignment_update(assignment_record)
|
|
||||||
local _emit_events = script_data.emit_updates
|
|
||||||
script_data.emit_updates = false
|
|
||||||
|
|
||||||
if assignment_record.is_deleted then
|
|
||||||
delete_assignment(assignment_record)
|
|
||||||
else
|
|
||||||
update_assignment(assignment_record)
|
|
||||||
end
|
|
||||||
|
|
||||||
script_data.emit_updates = _emit_events
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Get the current script data for debugging purposes
|
|
||||||
--- @package
|
|
||||||
function ExpGroups._script_data()
|
|
||||||
return script_data
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
IPC events
|
|
||||||
]]
|
|
||||||
|
|
||||||
--- Emit a group update to the instance plugin
|
|
||||||
--- @param group LuaPermissionGroup
|
|
||||||
local function emit_group_update(group)
|
|
||||||
clusterio_api.send_json("exp_group:group_updated", {
|
|
||||||
group_name = group.name,
|
|
||||||
group_id = script_data.factorio_to_clusterio_id[group.group_id],
|
|
||||||
permissions = encode_group_permissions(group),
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Emit a group deletion to the instance plugin
|
|
||||||
--- @param group_id number
|
|
||||||
--- @param group_name string
|
|
||||||
local function emit_group_delete(group_id, group_name)
|
|
||||||
clusterio_api.send_json("exp_group:group_deleted", {
|
|
||||||
group_name = group_name,
|
|
||||||
group_id = script_data.factorio_to_clusterio_id[group_id],
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Emit a player assignment to the instance plugin
|
|
||||||
--- @param assignments table<string, number>
|
|
||||||
local function emit_player_assignments(assignments)
|
|
||||||
clusterio_api.send_json("exp_group:player_assignments", {
|
|
||||||
assignments = assignments
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
IPC event queuing
|
|
||||||
]]
|
|
||||||
|
|
||||||
--- Mark a group as changed
|
|
||||||
--- @param group LuaPermissionGroup
|
|
||||||
local function mark_group_dirty(group)
|
|
||||||
script_data.dirty_groups[group.group_id] = group
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Mark a player as changed
|
|
||||||
--- @param player LuaPlayer
|
|
||||||
local function mark_player_dirty(player)
|
|
||||||
script_data.dirty_players[player.name] = player
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Flush queued group updates to the instance plugin
|
|
||||||
local function flush_group_updates()
|
|
||||||
-- Check if updates should be updated
|
|
||||||
if not script_data.emit_updates then
|
|
||||||
script_data.dirty_groups = {}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get all the groups and emit their updates
|
|
||||||
for _, group in pairs(script_data.dirty_groups) do
|
|
||||||
if group.valid then
|
|
||||||
emit_group_update(group)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
script_data.dirty_groups = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Flush queued player updates to the instance plugin
|
|
||||||
local function flush_player_updates()
|
|
||||||
-- Check if updates should be updated
|
|
||||||
if not script_data.emit_updates then
|
|
||||||
script_data.dirty_players = {}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Construct the update payload
|
|
||||||
local assignments = {} --- @type table<string, number>
|
|
||||||
for player_name, player in pairs(script_data.dirty_players) do
|
|
||||||
local group = player.valid and player.permission_group
|
|
||||||
if group then
|
|
||||||
assignments[player_name] = script_data.factorio_to_clusterio_id[group.group_id]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
emit_player_assignments(assignments)
|
|
||||||
|
|
||||||
script_data.dirty_players = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Factorio events
|
|
||||||
]]
|
|
||||||
|
|
||||||
--- Handle clusterio server startup
|
|
||||||
local function on_server_startup()
|
|
||||||
setup_script_data()
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Handle creation of permission groups
|
|
||||||
--- @param event EventData.on_permission_group_added
|
|
||||||
local function on_permission_group_added(event)
|
|
||||||
-- Check if updates should be updated
|
|
||||||
if not script_data.emit_updates then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
mark_group_dirty(event.group)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Handle deletion of permission groups
|
|
||||||
--- @param event EventData.on_permission_group_deleted
|
|
||||||
local function on_permission_group_deleted(event)
|
|
||||||
-- Check if updates should be updated
|
|
||||||
if not script_data.emit_updates then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
emit_group_delete(event.id, event.group_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Handle edits make to permission groups
|
|
||||||
--- @param event EventData.on_permission_group_edited
|
|
||||||
local function on_permission_group_edited(event)
|
|
||||||
-- Check if updates should be updated
|
|
||||||
if not script_data.emit_updates then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if this is a player or group event
|
|
||||||
if event.type == "add-player" or event.type == "remove-player" then
|
|
||||||
local player = assert(game.get_player(event.other_player_index))
|
|
||||||
mark_player_dirty(player)
|
|
||||||
else
|
|
||||||
mark_group_dirty(event.group)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Periodically flush queued changes
|
|
||||||
local function on_nth_tick_flush()
|
|
||||||
flush_group_updates()
|
|
||||||
flush_player_updates()
|
|
||||||
end
|
|
||||||
|
|
||||||
local e = defines.events
|
|
||||||
|
|
||||||
local events = {
|
|
||||||
[clusterio_api.events.on_server_startup] = on_server_startup,
|
|
||||||
[e.on_multiplayer_init] = on_server_startup,
|
|
||||||
[e.on_permission_group_added] = on_permission_group_added,
|
|
||||||
[e.on_permission_group_deleted] = on_permission_group_deleted,
|
|
||||||
[e.on_permission_group_edited] = on_permission_group_edited,
|
|
||||||
}
|
|
||||||
|
|
||||||
local on_nth_tick = {
|
|
||||||
[300] = on_nth_tick_flush,
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpGroups.events = events --- @package
|
|
||||||
ExpGroups.on_nth_tick = on_nth_tick --- @package
|
|
||||||
return ExpGroups
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--[[
|
|
||||||
It is best practice to not expose any globals because all modules share a global environment
|
|
||||||
However, sometimes you need globals, for example to access functions within rcon commands
|
|
||||||
Therefore, we advise that this should be the only file in your module to expose globals
|
|
||||||
Typically this would be your control file as shown in the example below
|
|
||||||
]]
|
|
||||||
|
|
||||||
--- @diagnostic disable: global-in-non-module
|
|
||||||
|
|
||||||
-- Access using `/sc exp_groups.foo()`
|
|
||||||
exp_groups = require("modules/exp_groups/control")
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "exp_groups",
|
|
||||||
"load": [
|
|
||||||
"control.lua"
|
|
||||||
],
|
|
||||||
"require": [
|
|
||||||
"globals.lua"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"clusterio": "*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
-- Access the exports from other modules using require("modules/exp_groups")
|
|
||||||
return require("modules/exp_groups/control")
|
|
||||||
+11
-19
@@ -1,49 +1,41 @@
|
|||||||
{
|
{
|
||||||
"name": "@expcluster/permission-groups",
|
"name": "@expcluster/permission_groups",
|
||||||
"version": "6.5.0",
|
"private": true,
|
||||||
"description": "Clusterio plugin providing syncing of permission groups",
|
"version": "0.0.0",
|
||||||
"author": "Cooldude2606 <https://github.com/Cooldude2606>",
|
"description": "Example Description. Package. Change me in package.json",
|
||||||
"license": "MIT",
|
|
||||||
"repository": "explosivegaming/ExpCluster",
|
|
||||||
"main": "dist/node/index.js",
|
"main": "dist/node/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "tsc --build && webpack-cli --env production"
|
"$prepare": "tsc --build && webpack-cli --env production"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@clusterio/controller": "workspace:^",
|
"@clusterio/lib": "catalog:"
|
||||||
"@clusterio/host": "workspace:^",
|
|
||||||
"@clusterio/lib": "workspace:^",
|
|
||||||
"@clusterio/web_ui": "workspace:^"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ant-design/icons": "^6.2.3",
|
"@clusterio/lib": "catalog:",
|
||||||
"@clusterio/controller": "workspace:^",
|
"@clusterio/web_ui": "catalog:",
|
||||||
"@clusterio/host": "workspace:^",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@clusterio/lib": "workspace:^",
|
|
||||||
"@clusterio/web_ui": "workspace:^",
|
|
||||||
"@types/node": "catalog:",
|
"@types/node": "catalog:",
|
||||||
"@types/react": "catalog:",
|
"@types/react": "catalog:",
|
||||||
"antd": "catalog:",
|
"antd": "catalog:",
|
||||||
"react": "catalog:",
|
"react": "catalog:",
|
||||||
"react-dom": "catalog:",
|
"react-dom": "catalog:",
|
||||||
"react-router-dom": "catalog:",
|
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"webpack": "catalog:",
|
"webpack": "catalog:",
|
||||||
"webpack-cli": "catalog:",
|
"webpack-cli": "catalog:",
|
||||||
"webpack-merge": "catalog:"
|
"webpack-merge": "catalog:"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sinclair/typebox": "catalog:"
|
"@sinclair/typebox": "catalog:",
|
||||||
|
"fs-extra": "^11.3.3"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"clusterio",
|
"clusterio",
|
||||||
"clusterio-plugin",
|
|
||||||
"factorio"
|
"factorio"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../tsconfig.browser.json",
|
|
||||||
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"files": [],
|
|
||||||
"references": [
|
|
||||||
{ "path": "./tsconfig.node.json" },
|
|
||||||
{ "path": "./tsconfig.browser.json" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../tsconfig.node.json",
|
|
||||||
"include": ["./**/*.ts"],
|
|
||||||
"exclude": ["test/*", "./dist/*"],
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
import React, { useContext, useEffect } from "react";
|
|
||||||
import { Modal, Form, Select } from "antd";
|
|
||||||
|
|
||||||
import { ControlContext, useUsers } from "@clusterio/web_ui";
|
|
||||||
import * as messages from "../../messages";
|
|
||||||
import type { WebPlugin } from "..";
|
|
||||||
|
|
||||||
export default function AssignmentForm({ open, setOpen, initial }: {
|
|
||||||
open: boolean,
|
|
||||||
setOpen: (open: boolean) => void,
|
|
||||||
initial?: messages.AssignmentRecord,
|
|
||||||
}) {
|
|
||||||
const control = useContext(ControlContext);
|
|
||||||
const plugin = control.plugins.get("exp_groups") as WebPlugin;
|
|
||||||
|
|
||||||
const [groups] = plugin.useGroups();
|
|
||||||
const [users] = useUsers();
|
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
function submit(values: any) {
|
|
||||||
if (initial) {
|
|
||||||
control.send(new messages.AssignmentUpdateRequest(
|
|
||||||
new messages.AssignmentRecord(
|
|
||||||
values.name,
|
|
||||||
values.groupId,
|
|
||||||
)
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
control.send(new messages.AssignmentCreateRequest(
|
|
||||||
values.name,
|
|
||||||
values.groupId,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
setOpen(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (open) {
|
|
||||||
form.resetFields();
|
|
||||||
form.setFieldsValue(initial);
|
|
||||||
}
|
|
||||||
}, [open, initial]);
|
|
||||||
|
|
||||||
return <Modal
|
|
||||||
title={initial ? "Edit Assignment" : "Create Assignment"}
|
|
||||||
open={open}
|
|
||||||
onCancel={() => setOpen(false)}
|
|
||||||
onOk={() => form.submit()}
|
|
||||||
>
|
|
||||||
<Form form={form} onFinish={submit}>
|
|
||||||
<Form.Item name="name" label="Player" rules={[{ required: true }]}>
|
|
||||||
<Select disabled={Boolean(initial)} showSearch>
|
|
||||||
{[...users.values()].map(u => (
|
|
||||||
<Select.Option key={u.name} value={u.name}>
|
|
||||||
{u.name}
|
|
||||||
</Select.Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item name="groupId" label="Group" rules={[{ required: true }]}>
|
|
||||||
<Select>
|
|
||||||
{[...groups.values()].map(g => (
|
|
||||||
<Select.Option key={g.id} value={g.id}>
|
|
||||||
{g.name}
|
|
||||||
</Select.Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</Modal>;
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
import React, { useContext, useState, useRef } from "react";
|
|
||||||
import { Table, Button, Space, Input, InputRef } from "antd";
|
|
||||||
import { EditOutlined, SearchOutlined } from "@ant-design/icons";
|
|
||||||
|
|
||||||
import { ControlContext, useAccount } from "@clusterio/web_ui";
|
|
||||||
import { AssignmentDeleteRequest, AssignmentRecord } from "../../messages";
|
|
||||||
import type { WebPlugin } from "..";
|
|
||||||
|
|
||||||
import AssignmentForm from "./AssignmentForm";
|
|
||||||
import DeletedConfirm from "./DeleteConfirm";
|
|
||||||
|
|
||||||
const strcmp = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }).compare;
|
|
||||||
|
|
||||||
export default function AssignmentsTable() {
|
|
||||||
const control = useContext(ControlContext);
|
|
||||||
const plugin = control.plugins.get("exp_groups") as WebPlugin;
|
|
||||||
const account = useAccount();
|
|
||||||
|
|
||||||
const searchInput = useRef<InputRef>(null);
|
|
||||||
|
|
||||||
const [assignments, assignmentsSynced] = plugin.useAssignments();
|
|
||||||
const [groups, groupsSynced] = plugin.useGroups();
|
|
||||||
|
|
||||||
const [editing, setEditing] = useState<AssignmentRecord | undefined>();
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
|
|
||||||
const assignmentsArray = [...assignments.values()];
|
|
||||||
|
|
||||||
const groupFilters = [...groups.values()]
|
|
||||||
.filter(group => assignmentsArray.some(assignment => assignment.groupId === group.id))
|
|
||||||
.map(group => ({ text: group.name, value: group.id }))
|
|
||||||
|
|
||||||
return <>
|
|
||||||
<Table
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
title: "Player",
|
|
||||||
dataIndex: "name",
|
|
||||||
sorter: (a: AssignmentRecord, b: AssignmentRecord) => strcmp(a.name, b.name),
|
|
||||||
filterIcon: (filtered: boolean) => (
|
|
||||||
<SearchOutlined style={{ color: filtered ? "#1677ff" : undefined }} />
|
|
||||||
),
|
|
||||||
onFilter: (value, record: AssignmentRecord) => (
|
|
||||||
record.name.toLowerCase().includes(String(value).toLowerCase())
|
|
||||||
),
|
|
||||||
filterDropdownProps: {
|
|
||||||
onOpenChange: (open: boolean) => open && setTimeout(() => searchInput.current?.select(), 100),
|
|
||||||
},
|
|
||||||
filterDropdown: ({ selectedKeys, setSelectedKeys, confirm, clearFilters }) => (
|
|
||||||
<div style={{ padding: 4 }} onKeyDown={(e) => e.stopPropagation()}>
|
|
||||||
<Input.Search
|
|
||||||
allowClear
|
|
||||||
ref={searchInput}
|
|
||||||
placeholder={"Search username"}
|
|
||||||
value={selectedKeys[0]}
|
|
||||||
onChange={(e) => setSelectedKeys([e.target.value])}
|
|
||||||
onSearch={() => confirm({ closeDropdown: false })}
|
|
||||||
onClear={() => {
|
|
||||||
clearFilters?.({ closeDropdown: false });
|
|
||||||
confirm({ closeDropdown: true });
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Group",
|
|
||||||
width: "40%",
|
|
||||||
filters: groupFilters,
|
|
||||||
onFilter: (value, record: AssignmentRecord) => (
|
|
||||||
record.groupId === value
|
|
||||||
),
|
|
||||||
render: (_: any, a: any) => (
|
|
||||||
groups.get(a.groupId)?.name ?? a.groupId
|
|
||||||
),
|
|
||||||
},
|
|
||||||
...(account.hasAnyPermission(
|
|
||||||
"exp_groups.assignment.update",
|
|
||||||
"exp_groups.assignment.delete",
|
|
||||||
) ? [{
|
|
||||||
title: "Actions",
|
|
||||||
width: "10%",
|
|
||||||
render: (_: any, record: AssignmentRecord) => (
|
|
||||||
<Space>
|
|
||||||
{account.hasPermission("exp_groups.assignment.update") &&
|
|
||||||
<Button icon={<EditOutlined />} onClick={() => {
|
|
||||||
setEditing(record);
|
|
||||||
setOpen(true);
|
|
||||||
}} />
|
|
||||||
}
|
|
||||||
{account.hasPermission("exp_groups.assignment.delete") && <DeletedConfirm
|
|
||||||
onConfirm={() => control.send(new AssignmentDeleteRequest(record.name))}
|
|
||||||
/>}
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}] : []),
|
|
||||||
]}
|
|
||||||
dataSource={assignmentsArray}
|
|
||||||
loading={!assignmentsSynced || !groupsSynced}
|
|
||||||
rowKey={(a) => a.name}
|
|
||||||
pagination={{
|
|
||||||
defaultPageSize: 50,
|
|
||||||
showSizeChanger: true,
|
|
||||||
pageSizeOptions: ["10", "20", "50", "100", "200"],
|
|
||||||
showTotal: (total: number) => `${total} Assignments`,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<AssignmentForm open={open} setOpen={setOpen} initial={editing} />
|
|
||||||
</>;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { Button, Popconfirm } from "antd";
|
|
||||||
import { DeleteOutlined } from "@ant-design/icons";
|
|
||||||
import { TooltipPlacement } from "antd/es/tooltip";
|
|
||||||
|
|
||||||
export default function DeletedConfirm(props: { onConfirm: () => void, placement?: TooltipPlacement }) {
|
|
||||||
return <Popconfirm
|
|
||||||
title="Delete?"
|
|
||||||
okText="Delete"
|
|
||||||
okButtonProps={{ danger: true }}
|
|
||||||
onConfirm={props.onConfirm}
|
|
||||||
placement={props.placement}
|
|
||||||
>
|
|
||||||
<Button danger icon={<DeleteOutlined />} />
|
|
||||||
</Popconfirm>
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
import React, { useContext, useEffect } from "react";
|
|
||||||
import { Modal, Form, Input, Switch } from "antd";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
import { ControlContext } from "@clusterio/web_ui";
|
|
||||||
import * as messages from "../../messages";
|
|
||||||
|
|
||||||
export default function GroupForm({ open, setOpen }: {
|
|
||||||
open: boolean,
|
|
||||||
setOpen: (open: boolean) => void,
|
|
||||||
}) {
|
|
||||||
const control = useContext(ControlContext);
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
async function submit(values: any) {
|
|
||||||
const group = await control.send(new messages.GroupCreateRequest(
|
|
||||||
values.name, new messages.GroupPermissions(Boolean(values.isBlacklist), [])
|
|
||||||
));
|
|
||||||
navigate(`/permission_groups/${group.id}/view`);
|
|
||||||
setOpen(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (open) form.resetFields();
|
|
||||||
}, [open]);
|
|
||||||
|
|
||||||
return <Modal
|
|
||||||
title="Create Group"
|
|
||||||
open={open}
|
|
||||||
onCancel={() => setOpen(false)}
|
|
||||||
onOk={() => form.submit()}
|
|
||||||
>
|
|
||||||
<Form form={form} onFinish={submit}>
|
|
||||||
<Form.Item name="name" label="Name" rules={[{ required: true }]}>
|
|
||||||
<Input />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item name="isBlacklist" label="Grant all by default" valuePropName="checked">
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</Modal>;
|
|
||||||
}
|
|
||||||
@@ -1,287 +0,0 @@
|
|||||||
import React, { useContext, useEffect, useMemo, useState } from "react";
|
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
|
||||||
import { Button, Checkbox, Input, Space, Spin, Alert } from "antd";
|
|
||||||
|
|
||||||
import { ControlContext, useAccount, useDefaultModPack, PageLayout, PageHeader, notifyErrorHandler } from "@clusterio/web_ui";
|
|
||||||
import DeletedConfirm from "./DeleteConfirm";
|
|
||||||
|
|
||||||
import * as messages from "../../messages";
|
|
||||||
import type { WebPlugin } from "..";
|
|
||||||
|
|
||||||
const DOMAIN_MAPPING = {
|
|
||||||
"Admin": ["admin", "cheat", "permission", "infinity", "editor", "spawn"],
|
|
||||||
"Building & Crafting": ["mining", "build", "craft", "deconstruct", "rotate", "entity"],
|
|
||||||
"Inventory": ["inventory", "stack", "cursor", "slot", "quick_bar", "item", "equipment"],
|
|
||||||
"Blueprints": ["blueprint", "copy", "paste", "undo", "redo", "upgrade"],
|
|
||||||
"Trains": ["train", "station", "schedule", "interrupt", "rolling_stock"],
|
|
||||||
"Circuit Network": ["combinator", "circuit", "signal", "wire", "cable", "speaker", "display_panel"],
|
|
||||||
"GUI": ["gui", "open"],
|
|
||||||
"Pins & Alerts": ["pin", "alert", "tag"],
|
|
||||||
"Logistics": ["logistic", "filter", "request"],
|
|
||||||
"Space": ["space", "surface", "planet", "rocket"],
|
|
||||||
"Toggles": ["toggle", "switch", "swap", "set"],
|
|
||||||
};
|
|
||||||
|
|
||||||
function getDomain(name: string) {
|
|
||||||
const n = name.toLowerCase();
|
|
||||||
|
|
||||||
for (const [domain, keywords] of Object.entries(DOMAIN_MAPPING)) {
|
|
||||||
if (keywords.some(k => n.includes(k))) return domain;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "Other";
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function GroupViewPage() {
|
|
||||||
const control = useContext(ControlContext);
|
|
||||||
const plugin = control.plugins.get("exp_groups") as WebPlugin;
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const account = useAccount();
|
|
||||||
|
|
||||||
const { id } = useParams();
|
|
||||||
const groupId = Number(id);
|
|
||||||
|
|
||||||
const [groups, synced] = plugin.useGroups();
|
|
||||||
const group = groups.get(groupId);
|
|
||||||
|
|
||||||
const [name, setName] = useState("");
|
|
||||||
|
|
||||||
const defaultModPack = useDefaultModPack();
|
|
||||||
const [definesJson, setDefinesJson] = useState<Record<string, number> | null>(null);
|
|
||||||
|
|
||||||
const [permissionState, setPermissionState] = useState<Record<string, boolean>>({});
|
|
||||||
const [baselineState, setBaselineState] = useState<Record<string, boolean>>({});
|
|
||||||
const [search, setSearch] = useState("");
|
|
||||||
|
|
||||||
const canUpdate = Boolean(account.hasPermission("exp_groups.group.update"));
|
|
||||||
const canDelete = Boolean(account.hasPermission("exp_groups.group.delete"));
|
|
||||||
|
|
||||||
// fetch defines
|
|
||||||
useEffect(() => {
|
|
||||||
if (!defaultModPack?.exportManifest?.assets?.defines) return;
|
|
||||||
if (definesJson) return;
|
|
||||||
|
|
||||||
const assetName = defaultModPack.exportManifest.assets.defines;
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const response = await fetch(`${staticRoot}static/${assetName}`);
|
|
||||||
const json = await response.json();
|
|
||||||
setDefinesJson(json.input_action ?? {});
|
|
||||||
})().catch(notifyErrorHandler("Failed to load permissions"));
|
|
||||||
}, [defaultModPack]);
|
|
||||||
|
|
||||||
// initialise permissions
|
|
||||||
useEffect(() => {
|
|
||||||
if (!group || !definesJson) return;
|
|
||||||
if (Object.keys(permissionState).length) return;
|
|
||||||
|
|
||||||
const { isBlacklist, permissions } = group.permissions;
|
|
||||||
|
|
||||||
const base = Object.fromEntries(
|
|
||||||
Object.keys(definesJson).map(p => [
|
|
||||||
p, isBlacklist !== permissions.includes(p)
|
|
||||||
])
|
|
||||||
);
|
|
||||||
|
|
||||||
setPermissionState(base);
|
|
||||||
setBaselineState(base);
|
|
||||||
}, [group, definesJson]);
|
|
||||||
|
|
||||||
// sync name
|
|
||||||
useEffect(() => {
|
|
||||||
if (group) setName(group.name);
|
|
||||||
}, [group]);
|
|
||||||
|
|
||||||
// derived data
|
|
||||||
const allPermissions = useMemo(() => (
|
|
||||||
Object.keys(definesJson ?? {})
|
|
||||||
), [definesJson]);
|
|
||||||
|
|
||||||
const filtered = useMemo(() => allPermissions.filter(p =>
|
|
||||||
p.toLowerCase().includes(search.toLowerCase())
|
|
||||||
), [allPermissions, search]);
|
|
||||||
|
|
||||||
const grouped = useMemo(() => {
|
|
||||||
const map = new Map<string, string[]>();
|
|
||||||
|
|
||||||
for (const p of filtered) {
|
|
||||||
const domain = getDomain(p);
|
|
||||||
if (!map.has(domain)) map.set(domain, []);
|
|
||||||
map.get(domain)!.push(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
const sorted = [...map.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
||||||
|
|
||||||
for (const [, perms] of sorted) {
|
|
||||||
perms.sort((a, b) => a.localeCompare(b));
|
|
||||||
}
|
|
||||||
|
|
||||||
return sorted;
|
|
||||||
}, [filtered]);
|
|
||||||
|
|
||||||
const permissionChanged = Object.keys(permissionState).some(
|
|
||||||
k => permissionState[k] !== baselineState[k]
|
|
||||||
);
|
|
||||||
const metaChanged = group ? name !== group.name : false;
|
|
||||||
const edited = permissionChanged || metaChanged;
|
|
||||||
|
|
||||||
function applyChanges() {
|
|
||||||
if (!group) return;
|
|
||||||
|
|
||||||
const whitelist: string[] = [];
|
|
||||||
const blacklist: string[] = [];
|
|
||||||
|
|
||||||
for (const [perm, enabled] of Object.entries(permissionState)) {
|
|
||||||
if (enabled) whitelist.push(perm);
|
|
||||||
else blacklist.push(perm);
|
|
||||||
}
|
|
||||||
|
|
||||||
const isBlacklist = blacklist.length < whitelist.length;
|
|
||||||
const permissions = isBlacklist ? blacklist : whitelist;
|
|
||||||
|
|
||||||
control.send(new messages.GroupUpdateRequest(
|
|
||||||
new messages.GroupRecord(group.id, name, new messages.GroupPermissions(isBlacklist, permissions))
|
|
||||||
))
|
|
||||||
.then(() => setBaselineState(permissionState))
|
|
||||||
.catch(notifyErrorHandler("Error applying changes"));
|
|
||||||
}
|
|
||||||
|
|
||||||
function revertChanges() {
|
|
||||||
if (!group) return;
|
|
||||||
setPermissionState(baselineState);
|
|
||||||
setName(group.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!synced) {
|
|
||||||
return <PageLayout nav={[{ name: "exp_groups" }, { name: String(groupId) }]}>
|
|
||||||
<Spin />
|
|
||||||
</PageLayout>;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!group) {
|
|
||||||
return <PageLayout nav={[{ name: "exp_groups" }, { name: String(groupId) }]}>
|
|
||||||
<PageHeader title="Group not found" />
|
|
||||||
</PageLayout>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <PageLayout nav={[{ name: "Permission Groups", path: "/permission_groups" }, { name: group.name }]}>
|
|
||||||
<PageHeader
|
|
||||||
title={group.name}
|
|
||||||
extra={<Space wrap>
|
|
||||||
{canDelete && <DeletedConfirm placement="bottomRight" onConfirm={async () => {
|
|
||||||
control.send(new messages.GroupDeleteRequest(group.id));
|
|
||||||
navigate(`/permission_groups`);
|
|
||||||
}}/>}
|
|
||||||
</Space>}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{edited && (
|
|
||||||
<div style={{
|
|
||||||
position: "fixed",
|
|
||||||
bottom: 24,
|
|
||||||
left: "50%",
|
|
||||||
transform: "translateX(-50%)",
|
|
||||||
background: "#2a1912",
|
|
||||||
borderRadius: 8,
|
|
||||||
padding: "10px 14px",
|
|
||||||
display: "flex",
|
|
||||||
gap: 12,
|
|
||||||
zIndex: 1000,
|
|
||||||
}}>
|
|
||||||
<span>You have unsaved changes</span>
|
|
||||||
<Space>
|
|
||||||
<Button onClick={revertChanges}>Revert</Button>
|
|
||||||
<Button type="primary" onClick={applyChanges}>Apply</Button>
|
|
||||||
</Space>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div style={{ marginBottom: 16, display: "flex", gap: 12 }}>
|
|
||||||
<label style={{ width: 110 }}>Name</label>
|
|
||||||
<Input value={name} disabled={!canUpdate} onChange={e => setName(e.target.value)} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>Permissions</h3>
|
|
||||||
|
|
||||||
{!defaultModPack?.exportManifest?.assets?.defines && (
|
|
||||||
<Alert
|
|
||||||
type="warning"
|
|
||||||
message="Missing export"
|
|
||||||
description="An export of the default mod pack is required to modify permissions."
|
|
||||||
style={{ marginBottom: 16 }}
|
|
||||||
showIcon
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{defaultModPack?.exportManifest?.assets?.defines && !definesJson && <Spin />}
|
|
||||||
|
|
||||||
{definesJson && <>
|
|
||||||
<Input.Search
|
|
||||||
placeholder="Search permissions"
|
|
||||||
allowClear
|
|
||||||
onChange={e => setSearch(e.target.value)}
|
|
||||||
style={{ marginBottom: 16 }}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
|
||||||
{grouped.map(([groupName, permissions]) => (
|
|
||||||
<div key={groupName} style={{ border: "1px solid #424242", padding: 12, borderRadius: 6 }}>
|
|
||||||
|
|
||||||
<Space style={{ width: "100%", justifyContent: "space-between" }}>
|
|
||||||
<strong>{groupName}</strong>
|
|
||||||
<Space>
|
|
||||||
<Button
|
|
||||||
size="small"
|
|
||||||
disabled={!canUpdate}
|
|
||||||
onClick={() => {
|
|
||||||
setPermissionState(prev => {
|
|
||||||
const next = { ...prev };
|
|
||||||
for (const p of permissions) next[p] = true;
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Select all
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
size="small"
|
|
||||||
disabled={!canUpdate}
|
|
||||||
onClick={() => {
|
|
||||||
setPermissionState(prev => {
|
|
||||||
const next = { ...prev };
|
|
||||||
for (const p of permissions) next[p] = false;
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Clear
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
</Space>
|
|
||||||
|
|
||||||
<div style={{
|
|
||||||
marginTop: 12,
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateColumns: "repeat(auto-fill, minmax(250px, 1fr))",
|
|
||||||
gap: 8,
|
|
||||||
}}>
|
|
||||||
{permissions.map(p => (
|
|
||||||
<Checkbox
|
|
||||||
key={p}
|
|
||||||
checked={permissionState[p]}
|
|
||||||
disabled={!canUpdate}
|
|
||||||
onChange={e =>
|
|
||||||
setPermissionState(prev => ({ ...prev, [p]: e.target.checked }))
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{p}
|
|
||||||
</Checkbox>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</Space>
|
|
||||||
</>}
|
|
||||||
</PageLayout>;
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import React, { useContext, useState } from "react";
|
|
||||||
import { Table } from "antd";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
import { ControlContext } from "@clusterio/web_ui";
|
|
||||||
import { GroupRecord } from "../../messages";
|
|
||||||
import type { WebPlugin } from "..";
|
|
||||||
|
|
||||||
import GroupForm from "./GroupForm";
|
|
||||||
|
|
||||||
const strcmp = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }).compare;
|
|
||||||
|
|
||||||
export default function GroupsTable() {
|
|
||||||
const control = useContext(ControlContext);
|
|
||||||
const plugin = control.plugins.get("exp_groups") as WebPlugin;
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [groups, synced] = plugin.useGroups();
|
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
|
|
||||||
return <>
|
|
||||||
<Table
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
title: "Name",
|
|
||||||
dataIndex: "name",
|
|
||||||
sorter: (a: any, b: GroupRecord) => strcmp(a.name, b.name),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Permissions",
|
|
||||||
width: "50%",
|
|
||||||
render: (_: any, g: GroupRecord) => (
|
|
||||||
`${g.permissions.permissions.length} ${g.permissions.isBlacklist ? "Disallowed" : "Allowed"}`
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
dataSource={[...groups.values()]}
|
|
||||||
loading={!synced}
|
|
||||||
rowKey={(g) => g.id}
|
|
||||||
pagination={false}
|
|
||||||
onRow={(g) => ({
|
|
||||||
onClick: () => navigate(`/permission_groups/${g.id}/view`),
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<GroupForm open={open} setOpen={setOpen} />
|
|
||||||
</>;
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
import React, { useContext, useEffect } from "react";
|
|
||||||
import { Modal, Form, Select, InputNumber, Switch, Alert } from "antd";
|
|
||||||
|
|
||||||
import { ControlContext, useRoles } from "@clusterio/web_ui";
|
|
||||||
import { RoleMappingRecord, RoleMappingCreateRequest, RoleMappingUpdateRequest } from "../../messages";
|
|
||||||
import type { WebPlugin } from "..";
|
|
||||||
|
|
||||||
export default function RoleMappingForm({ open, setOpen, initial }: {
|
|
||||||
open: boolean,
|
|
||||||
setOpen: (open: boolean) => void,
|
|
||||||
initial?: RoleMappingRecord,
|
|
||||||
}) {
|
|
||||||
const control = useContext(ControlContext);
|
|
||||||
const plugin = control.plugins.get("exp_groups") as WebPlugin;
|
|
||||||
|
|
||||||
const [groups] = plugin.useGroups();
|
|
||||||
const [roles] = useRoles();
|
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
function submit(values: any) {
|
|
||||||
if (initial) {
|
|
||||||
control.send(new RoleMappingUpdateRequest(
|
|
||||||
new RoleMappingRecord(
|
|
||||||
initial.id,
|
|
||||||
new Set(values.roleIds),
|
|
||||||
values.groupId,
|
|
||||||
values.priority,
|
|
||||||
values.enabled,
|
|
||||||
)
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
control.send(new RoleMappingCreateRequest(
|
|
||||||
values.roleIds,
|
|
||||||
values.groupId,
|
|
||||||
values.priority,
|
|
||||||
values.enabled,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
setOpen(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (open) {
|
|
||||||
form.resetFields();
|
|
||||||
form.setFieldsValue({
|
|
||||||
...initial,
|
|
||||||
roleIds: initial ? [...initial.roleIds] : [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, [open, initial]);
|
|
||||||
|
|
||||||
return <Modal
|
|
||||||
title={initial ? "Edit Role Mapping" : "Create Role Mapping"}
|
|
||||||
open={open}
|
|
||||||
onCancel={() => setOpen(false)}
|
|
||||||
onOk={() => form.submit()}
|
|
||||||
>
|
|
||||||
<Alert
|
|
||||||
type="info"
|
|
||||||
showIcon
|
|
||||||
message="How role mappings work"
|
|
||||||
style={{ marginBottom: 16 }}
|
|
||||||
description={
|
|
||||||
<ul style={{ paddingLeft: 16, margin: 0 }}>
|
|
||||||
<li>Manual assignments always take priority.</li>
|
|
||||||
<li>Mappings are checked in priority order (highest first).</li>
|
|
||||||
<li>A mapping applies only if the user has <b>all listed roles</b>.</li>
|
|
||||||
<li>The first matching mapping assigns the group.</li>
|
|
||||||
<li>If none match, the player is given all permissions.</li>
|
|
||||||
</ul>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Form form={form} onFinish={submit}>
|
|
||||||
<Form.Item name="groupId" label="Group" rules={[{ required: true }]}>
|
|
||||||
<Select>
|
|
||||||
{[...groups.values()].map(g => (
|
|
||||||
<Select.Option key={g.id} value={g.id}>
|
|
||||||
{g.name}
|
|
||||||
</Select.Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item name="roleIds" label="Roles" rules={[{ required: true }]}>
|
|
||||||
<Select mode="multiple">
|
|
||||||
{[...roles.values()].map(r => (
|
|
||||||
<Select.Option key={r.id} value={r.id}>
|
|
||||||
{r.name}
|
|
||||||
</Select.Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item name="priority" label="Priority" initialValue={100}>
|
|
||||||
<InputNumber style={{ width: "100%" }} />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item name="enabled" label="Enabled" valuePropName="checked" initialValue={true}>
|
|
||||||
<Switch />
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</Modal>;
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
import React, { useContext, useState } from "react";
|
|
||||||
import { Table, Button, Space, Tag } from "antd";
|
|
||||||
import { EditOutlined } from "@ant-design/icons";
|
|
||||||
|
|
||||||
import { ControlContext, useAccount, useRoles } from "@clusterio/web_ui";
|
|
||||||
import { RoleMappingRecord, RoleMappingDeleteRequest } from "../../messages";
|
|
||||||
import type { WebPlugin } from "..";
|
|
||||||
|
|
||||||
import RoleMappingForm from "./RoleMappingForm";
|
|
||||||
import DeletedConfirm from "./DeleteConfirm";
|
|
||||||
|
|
||||||
export default function RoleMappingsTable() {
|
|
||||||
const control = useContext(ControlContext);
|
|
||||||
const plugin = control.plugins.get("exp_groups") as WebPlugin;
|
|
||||||
const account = useAccount();
|
|
||||||
|
|
||||||
const [roleMappings, roleMappingsSynced] = plugin.useRoleMappings();
|
|
||||||
const [groups, groupsSynced] = plugin.useGroups();
|
|
||||||
const [roles, rolesSynced] = useRoles();
|
|
||||||
|
|
||||||
const [editing, setEditing] = useState<RoleMappingRecord | undefined>();
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
|
|
||||||
const roleMappingArray = [...roleMappings.values()];
|
|
||||||
|
|
||||||
const roleFilters = [...roles.values()]
|
|
||||||
.filter(role => roleMappingArray.some(mapping => mapping.roleIds.has(role.id)))
|
|
||||||
.map(role => ({ text: role.name, value: role.id }));
|
|
||||||
|
|
||||||
const groupFilters = [...groups.values()]
|
|
||||||
.filter(group => roleMappingArray.some(mapping => mapping.groupId === group.id))
|
|
||||||
.map(group => ({ text: group.name, value: group.id }))
|
|
||||||
|
|
||||||
return <>
|
|
||||||
<Table
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
title: "Priority",
|
|
||||||
dataIndex: "priority",
|
|
||||||
width: "10%",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Roles",
|
|
||||||
filters: roleFilters,
|
|
||||||
onFilter: (value, record: RoleMappingRecord) => (
|
|
||||||
record.roleIds.has(value as number)
|
|
||||||
),
|
|
||||||
render: (_: any, record: RoleMappingRecord) => (
|
|
||||||
[...record.roleIds].map(id => <Tag key={id}>{roles.get(id)?.name ?? id}</Tag>)
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Group",
|
|
||||||
width: "30%",
|
|
||||||
filters: groupFilters,
|
|
||||||
onFilter: (value, record: RoleMappingRecord) => (
|
|
||||||
record.groupId === value
|
|
||||||
),
|
|
||||||
render: (_: any, record: RoleMappingRecord) => (
|
|
||||||
groups.get(record.groupId)?.name ?? record.groupId
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Enabled",
|
|
||||||
width: "10%",
|
|
||||||
filters: [
|
|
||||||
{ text: "Enabled", value: true },
|
|
||||||
{ text: "Disabled", value: false },
|
|
||||||
],
|
|
||||||
onFilter: (value, record: RoleMappingRecord) => (
|
|
||||||
record.enabled === value
|
|
||||||
),
|
|
||||||
render: (_: any, record: RoleMappingRecord) => (
|
|
||||||
record.enabled ? "Yes" : "No"
|
|
||||||
),
|
|
||||||
},
|
|
||||||
...(account.hasAnyPermission(
|
|
||||||
"exp_groups.role_mapping.update",
|
|
||||||
"exp_groups.role_mapping.delete",
|
|
||||||
) ? [{
|
|
||||||
title: "Actions",
|
|
||||||
width: "10%",
|
|
||||||
render: (_: any, record: any) => (
|
|
||||||
<Space>
|
|
||||||
{account.hasPermission("exp_groups.role_mapping.update") && <Button
|
|
||||||
icon={<EditOutlined />}
|
|
||||||
onClick={() => {
|
|
||||||
setEditing(record);
|
|
||||||
setOpen(true);
|
|
||||||
}}
|
|
||||||
/>}
|
|
||||||
{account.hasPermission("exp_groups.role_mapping.delete") && <DeletedConfirm
|
|
||||||
onConfirm={() => control.send(new RoleMappingDeleteRequest(record.id))}
|
|
||||||
/>}
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}] : []),
|
|
||||||
]}
|
|
||||||
dataSource={roleMappingArray.sort((a, b) => b.priority - a.priority)}
|
|
||||||
loading={!roleMappingsSynced || !groupsSynced || !rolesSynced}
|
|
||||||
rowKey={(m) => m.id}
|
|
||||||
pagination={false}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<RoleMappingForm open={open} setOpen={setOpen} initial={editing} />
|
|
||||||
</>;
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
import React, { useState, useCallback, useSyncExternalStore } from "react";
|
|
||||||
import { BaseWebPlugin, PageLayout, PageHeader, useAccount, SectionHeader } from "@clusterio/web_ui";
|
|
||||||
import { Button } from "antd";
|
|
||||||
|
|
||||||
import * as messages from "../messages";
|
|
||||||
import * as lib from "@clusterio/lib";
|
|
||||||
|
|
||||||
import GroupsTable from "./components/GroupsTable";
|
|
||||||
import AssignmentsTable from "./components/AssignmentsTable";
|
|
||||||
import RoleMappingsTable from "./components/RoleMappingsTable";
|
|
||||||
import GroupViewPage from "./components/GroupViewPage";
|
|
||||||
import GroupForm from "./components/GroupForm";
|
|
||||||
import RoleMappingForm from "./components/RoleMappingForm";
|
|
||||||
import AssignmentForm from "./components/AssignmentForm";
|
|
||||||
|
|
||||||
|
|
||||||
function ExpGroupsPage() {
|
|
||||||
const account = useAccount();
|
|
||||||
|
|
||||||
const [groupOpen, setGroupOpen] = useState(false);
|
|
||||||
const [assignmentOpen, setAssignmentOpen] = useState(false);
|
|
||||||
const [roleMappingOpen, setRoleMappingOpen] = useState(false);
|
|
||||||
|
|
||||||
return <PageLayout nav={[{ name: "Permission Groups" }]}>
|
|
||||||
<PageHeader title="Permission Groups" />
|
|
||||||
|
|
||||||
{account.hasPermission("exp_groups.group.list") && <>
|
|
||||||
<SectionHeader
|
|
||||||
title="Groups"
|
|
||||||
extra={
|
|
||||||
account.hasPermission("exp_groups.group.create")
|
|
||||||
? <Button type="primary" onClick={() => setGroupOpen(true)}>Create</Button>
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<GroupsTable />
|
|
||||||
<GroupForm open={groupOpen} setOpen={setGroupOpen} />
|
|
||||||
</>}
|
|
||||||
|
|
||||||
{account.hasPermission("exp_groups.role_mapping.list") && <>
|
|
||||||
<SectionHeader
|
|
||||||
title="Role Mappings"
|
|
||||||
extra={
|
|
||||||
account.hasPermission("exp_groups.role_mapping.create")
|
|
||||||
? <Button type="primary" onClick={() => setRoleMappingOpen(true)}>Create</Button>
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<RoleMappingsTable />
|
|
||||||
<RoleMappingForm open={roleMappingOpen} setOpen={setRoleMappingOpen} />
|
|
||||||
</>}
|
|
||||||
|
|
||||||
{account.hasPermission("exp_groups.assignment.list") && <>
|
|
||||||
<SectionHeader
|
|
||||||
title="Assignments"
|
|
||||||
extra={
|
|
||||||
account.hasPermission("exp_groups.assignment.create")
|
|
||||||
? <Button type="primary" onClick={() => setAssignmentOpen(true)}>Create</Button>
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<AssignmentsTable />
|
|
||||||
<AssignmentForm open={assignmentOpen} setOpen={setAssignmentOpen} />
|
|
||||||
</>}
|
|
||||||
</PageLayout>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class WebPlugin extends BaseWebPlugin {
|
|
||||||
groups = new lib.MapSubscriber(messages.GroupUpdatedEvent, this.control);
|
|
||||||
assignments = new lib.MapSubscriber(messages.ManualAssignmentUpdatedEvent, this.control);
|
|
||||||
roleMappings = new lib.MapSubscriber(messages.RoleMappingUpdatedEvent, this.control);
|
|
||||||
|
|
||||||
async init() {
|
|
||||||
this.pages = [
|
|
||||||
{
|
|
||||||
path: "/permission_groups",
|
|
||||||
sidebarName: "Permission Groups",
|
|
||||||
permission: (account => account.hasAnyPermission(
|
|
||||||
"exp_groups.group.list",
|
|
||||||
"exp_groups.assignment.list",
|
|
||||||
"exp_groups.role_mapping.list",
|
|
||||||
)),
|
|
||||||
content: <ExpGroupsPage />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/permission_groups/:id/view",
|
|
||||||
sidebarPath: "/permission_groups",
|
|
||||||
permission: "exp_groups.group.get",
|
|
||||||
content: <GroupViewPage />,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
useGroups() {
|
|
||||||
const subscribe = useCallback((cb: () => void) => this.groups.subscribe(cb), []);
|
|
||||||
return useSyncExternalStore(subscribe, () => this.groups.getSnapshot());
|
|
||||||
}
|
|
||||||
|
|
||||||
useAssignments() {
|
|
||||||
const subscribe = useCallback((cb: () => void) => this.assignments.subscribe(cb), []);
|
|
||||||
return useSyncExternalStore(subscribe, () => this.assignments.getSnapshot());
|
|
||||||
}
|
|
||||||
|
|
||||||
useRoleMappings() {
|
|
||||||
const subscribe = useCallback((cb: () => void) => this.roleMappings.subscribe(cb), []);
|
|
||||||
return useSyncExternalStore(subscribe, () => this.roleMappings.getSnapshot());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const path = require("path");
|
|
||||||
const webpack = require("webpack");
|
|
||||||
const { merge } = require("webpack-merge");
|
|
||||||
|
|
||||||
const common = require("@clusterio/web_ui/webpack.common");
|
|
||||||
|
|
||||||
module.exports = (env = {}) => merge(common(env), {
|
|
||||||
context: __dirname,
|
|
||||||
entry: "./web/index.tsx",
|
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, "dist", "web"),
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.container.ModuleFederationPlugin({
|
|
||||||
name: "exp_groups",
|
|
||||||
library: { type: "window", name: "plugin_exp_groups" },
|
|
||||||
exposes: {
|
|
||||||
"./": "./index.ts",
|
|
||||||
"./package.json": "./package.json",
|
|
||||||
"./web": "./web/index.tsx",
|
|
||||||
},
|
|
||||||
shared: {
|
|
||||||
"@clusterio/lib": { import: false },
|
|
||||||
"@clusterio/web_ui": { import: false },
|
|
||||||
"antd": { import: false },
|
|
||||||
"react": { import: false },
|
|
||||||
"react-dom": { import: false },
|
|
||||||
"react-router": { import: false },
|
|
||||||
"react-router-dom": { import: false },
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
+12
-17
@@ -16,7 +16,7 @@ Storage.register(player_elements, function(tbl)
|
|||||||
player_elements = tbl
|
player_elements = tbl
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--- @class (partial) Gui
|
--- @class Gui
|
||||||
local Gui = {
|
local Gui = {
|
||||||
define = ExpElement.new,
|
define = ExpElement.new,
|
||||||
from_argument = ExpElement.from_argument,
|
from_argument = ExpElement.from_argument,
|
||||||
@@ -46,11 +46,9 @@ end
|
|||||||
--- @return LuaPlayer
|
--- @return LuaPlayer
|
||||||
function Gui.get_player(input)
|
function Gui.get_player(input)
|
||||||
if type(input) == "table" and not input.player_index then
|
if type(input) == "table" and not input.player_index then
|
||||||
--- @cast input { element: LuaGuiElement }
|
return assert(game.get_player(input.element.player_index))
|
||||||
return (assert(game.get_player(input.element.player_index)))
|
|
||||||
end
|
end
|
||||||
--- @cast input LuaGuiElement | { player_index: uint }
|
return assert(game.get_player(input.player_index))
|
||||||
return (assert(game.get_player(input.player_index)))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Toggle the enable state of an element
|
--- Toggle the enable state of an element
|
||||||
@@ -90,7 +88,7 @@ end
|
|||||||
--- @param define ExpElement
|
--- @param define ExpElement
|
||||||
--- @param visible Gui.VisibleCallback | boolean | nil
|
--- @param visible Gui.VisibleCallback | boolean | nil
|
||||||
function Gui.add_top_element(define, visible)
|
function Gui.add_top_element(define, visible)
|
||||||
assert(Gui.top_elements[define] == nil, "Element is already added to the top flow")
|
assert(Gui.top_elements[define.name] == nil, "Element is already added to the top flow")
|
||||||
Gui.top_elements[define] = visible or false
|
Gui.top_elements[define] = visible or false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -98,7 +96,7 @@ end
|
|||||||
--- @param define ExpElement
|
--- @param define ExpElement
|
||||||
--- @param visible Gui.VisibleCallback | boolean | nil
|
--- @param visible Gui.VisibleCallback | boolean | nil
|
||||||
function Gui.add_left_element(define, visible)
|
function Gui.add_left_element(define, visible)
|
||||||
assert(Gui.left_elements[define] == nil, "Element is already added to the left flow")
|
assert(Gui.left_elements[define.name] == nil, "Element is already added to the left flow")
|
||||||
Gui.left_elements[define] = visible or false
|
Gui.left_elements[define] = visible or false
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -107,7 +105,7 @@ end
|
|||||||
--- @param define ExpElement
|
--- @param define ExpElement
|
||||||
--- @param visible Gui.VisibleCallback | boolean | nil
|
--- @param visible Gui.VisibleCallback | boolean | nil
|
||||||
function Gui.add_relative_element(define, visible)
|
function Gui.add_relative_element(define, visible)
|
||||||
assert(Gui.relative_elements[define] == nil, "Element is already added to the relative flow")
|
assert(Gui.relative_elements[define.name] == nil, "Element is already added to the relative flow")
|
||||||
Gui.relative_elements[define] = visible or false
|
Gui.relative_elements[define] = visible or false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -116,8 +114,7 @@ end
|
|||||||
--- @param player LuaPlayer
|
--- @param player LuaPlayer
|
||||||
--- @return LuaGuiElement
|
--- @return LuaGuiElement
|
||||||
function Gui.get_top_element(define, player)
|
function Gui.get_top_element(define, player)
|
||||||
local elements = assert(player_elements[player.index])
|
return assert(player_elements[player.index].top[define.name], "Element is not on the top flow")
|
||||||
return (assert(elements.top[define.name], "Element is not on the top flow"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Register a element define to be drawn to the left flow on join
|
--- Register a element define to be drawn to the left flow on join
|
||||||
@@ -125,8 +122,7 @@ end
|
|||||||
--- @param player LuaPlayer
|
--- @param player LuaPlayer
|
||||||
--- @return LuaGuiElement
|
--- @return LuaGuiElement
|
||||||
function Gui.get_left_element(define, player)
|
function Gui.get_left_element(define, player)
|
||||||
local elements = assert(player_elements[player.index])
|
return assert(player_elements[player.index].left[define.name], "Element is not on the left flow")
|
||||||
return (assert(elements.left[define.name], "Element is not on the left flow"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Register a element define to be drawn to the relative flow on join
|
--- Register a element define to be drawn to the relative flow on join
|
||||||
@@ -134,8 +130,7 @@ end
|
|||||||
--- @param player LuaPlayer
|
--- @param player LuaPlayer
|
||||||
--- @return LuaGuiElement
|
--- @return LuaGuiElement
|
||||||
function Gui.get_relative_element(define, player)
|
function Gui.get_relative_element(define, player)
|
||||||
local elements = assert(player_elements[player.index])
|
return assert(player_elements[player.index].relative[define.name], "Element is not on the relative flow")
|
||||||
return (assert(elements.relative[define.name], "Element is not on the relative flow"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Ensure all the correct elements are visible and exist
|
--- Ensure all the correct elements are visible and exist
|
||||||
@@ -193,9 +188,9 @@ function Gui._ensure_consistency(event)
|
|||||||
|
|
||||||
-- This check isn't needed, but allows the toolbar file to be deleted without modifying any lib code
|
-- This check isn't needed, but allows the toolbar file to be deleted without modifying any lib code
|
||||||
if Gui.toolbar then
|
if Gui.toolbar then
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
Gui.toolbar._create_elements(player)
|
Gui.toolbar._create_elements(player)
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
Gui.toolbar._ensure_consistency(player)
|
Gui.toolbar._ensure_consistency(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -216,7 +211,7 @@ local function on_gui_opened(event)
|
|||||||
|
|
||||||
if visible then
|
if visible then
|
||||||
event.element = element
|
event.element = element
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
define:raise_event(event)
|
define:raise_event(event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ local GuiData = {
|
|||||||
--- @field player_data table<uint, any>
|
--- @field player_data table<uint, any>
|
||||||
--- @field force_data table<uint, any>
|
--- @field force_data table<uint, any>
|
||||||
--- @field global_data table
|
--- @field global_data table
|
||||||
--- @field [DataKey] any
|
|
||||||
-- This class has no prototype methods
|
-- This class has no prototype methods
|
||||||
-- Same as raw but __index ensures the values exist
|
-- Same as raw but __index ensures the values exist
|
||||||
|
|
||||||
@@ -90,16 +89,13 @@ function GuiData._metatable.__index(self, key)
|
|||||||
assert(type(key) == "userdata", "Index type '" .. ExpUtil.get_class_name(key) .. "' given to GuiData. Must be of type userdata.")
|
assert(type(key) == "userdata", "Index type '" .. ExpUtil.get_class_name(key) .. "' given to GuiData. Must be of type userdata.")
|
||||||
local object_name = key.object_name --- @diagnostic disable-line assign-type-mismatch
|
local object_name = key.object_name --- @diagnostic disable-line assign-type-mismatch
|
||||||
if object_name == "LuaGuiElement" then
|
if object_name == "LuaGuiElement" then
|
||||||
--- @cast key LuaGuiElement
|
|
||||||
local data = self._raw.element_data
|
local data = self._raw.element_data
|
||||||
local player_elements = data and data[key.player_index]
|
local player_elements = data and data[key.player_index]
|
||||||
return player_elements and player_elements[key.index]
|
return player_elements and player_elements[key.index]
|
||||||
elseif object_name == "LuaPlayer" then
|
elseif object_name == "LuaPlayer" then
|
||||||
--- @cast key LuaPlayer
|
|
||||||
local data = self._raw.player_data
|
local data = self._raw.player_data
|
||||||
return data and data[key.index]
|
return data and data[key.index]
|
||||||
elseif object_name == "LuaForce" then
|
elseif object_name == "LuaForce" then
|
||||||
--- @cast key LuaForce
|
|
||||||
local data = self._raw.force_data
|
local data = self._raw.force_data
|
||||||
return data and data[key.index]
|
return data and data[key.index]
|
||||||
else
|
else
|
||||||
@@ -157,7 +153,7 @@ end
|
|||||||
--- @param scope string
|
--- @param scope string
|
||||||
--- @return GuiData
|
--- @return GuiData
|
||||||
function GuiData.get(scope)
|
function GuiData.get(scope)
|
||||||
return GuiData._scopes[scope] --[[@as GuiData]]
|
return GuiData._scopes[scope] --[[ @as GuiData ]]
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Used to clean up data from destroyed elements
|
--- Used to clean up data from destroyed elements
|
||||||
@@ -172,7 +168,7 @@ local function on_object_destroyed(event)
|
|||||||
for _, scope in pairs(registered_scopes) do
|
for _, scope in pairs(registered_scopes) do
|
||||||
local data = scope._raw.element_data
|
local data = scope._raw.element_data
|
||||||
local player_elements = data and data[player_index]
|
local player_elements = data and data[player_index]
|
||||||
if data and player_elements then
|
if player_elements then
|
||||||
player_elements[element_index] = nil
|
player_elements[element_index] = nil
|
||||||
if not next(player_elements) then
|
if not next(player_elements) then
|
||||||
data[player_index] = nil
|
data[player_index] = nil
|
||||||
|
|||||||
+17
-17
@@ -1,4 +1,4 @@
|
|||||||
--- @class (partial) Gui
|
--- @class Gui
|
||||||
local Gui = require("modules/exp_gui")
|
local Gui = require("modules/exp_gui")
|
||||||
|
|
||||||
--- @class Gui.elements
|
--- @class Gui.elements
|
||||||
@@ -28,7 +28,7 @@ Elements.aligned_flow = Gui.define("aligned_flow")
|
|||||||
vertically_stretchable = vertical_align ~= "center",
|
vertically_stretchable = vertical_align ~= "center",
|
||||||
horizontally_stretchable = horizontal_align ~= "center",
|
horizontally_stretchable = horizontal_align ~= "center",
|
||||||
}
|
}
|
||||||
end) --[[@as any]]
|
end) --[[ @as any ]]
|
||||||
|
|
||||||
--- A solid horizontal white bar element
|
--- A solid horizontal white bar element
|
||||||
--- @class Gui.elements.bar: ExpElement
|
--- @class Gui.elements.bar: ExpElement
|
||||||
@@ -48,11 +48,11 @@ Elements.bar = Gui.define("bar")
|
|||||||
else
|
else
|
||||||
style.horizontally_stretchable = true
|
style.horizontally_stretchable = true
|
||||||
end
|
end
|
||||||
end) --[[@as any]]
|
end) --[[ @as any ]]
|
||||||
|
|
||||||
--- A label which is centered
|
--- A label which is centered
|
||||||
--- @class Gui.elements.centered_label: ExpElement
|
--- @class Gui.elements.centered_label: ExpElement
|
||||||
--- @overload fun(parent: LuaGuiElement, width: number, caption: LocalisedString?, tooltip: LocalisedString?): LuaGuiElement
|
--- @overload fun(parent: LuaGuiElement, width: number, caption: LocalisedString, tooltip: LocalisedString?): LuaGuiElement
|
||||||
Elements.centered_label = Gui.define("centered_label")
|
Elements.centered_label = Gui.define("centered_label")
|
||||||
:draw{
|
:draw{
|
||||||
type = "label",
|
type = "label",
|
||||||
@@ -63,7 +63,7 @@ Elements.centered_label = Gui.define("centered_label")
|
|||||||
horizontal_align = "center",
|
horizontal_align = "center",
|
||||||
single_line = false,
|
single_line = false,
|
||||||
width = Gui.from_argument(1),
|
width = Gui.from_argument(1),
|
||||||
} --[[@as any]]
|
} --[[ @as any ]]
|
||||||
|
|
||||||
--- A label which has two white bars on either side of it
|
--- A label which has two white bars on either side of it
|
||||||
--- @class Gui.elements.title_label: ExpElement
|
--- @class Gui.elements.title_label: ExpElement
|
||||||
@@ -91,7 +91,7 @@ Elements.title_label = Gui.define("title_label")
|
|||||||
Elements.bar(flow)
|
Elements.bar(flow)
|
||||||
|
|
||||||
return label
|
return label
|
||||||
end) --[[@as any]]
|
end) --[[ @as any ]]
|
||||||
|
|
||||||
--- A fixed size vertical scroll pane
|
--- A fixed size vertical scroll pane
|
||||||
--- @class Gui.elements.scroll_pane: ExpElement
|
--- @class Gui.elements.scroll_pane: ExpElement
|
||||||
@@ -109,7 +109,7 @@ Elements.scroll_pane = Gui.define("scroll_pane")
|
|||||||
padding = { 1, 3 },
|
padding = { 1, 3 },
|
||||||
maximal_height = Gui.from_argument(1),
|
maximal_height = Gui.from_argument(1),
|
||||||
horizontally_stretchable = true,
|
horizontally_stretchable = true,
|
||||||
} --[[@as any]]
|
} --[[ @as any ]]
|
||||||
|
|
||||||
--- A fixed size vertical scroll pane containing a table
|
--- A fixed size vertical scroll pane containing a table
|
||||||
--- @class Gui.elements.scroll_table: ExpElement
|
--- @class Gui.elements.scroll_table: ExpElement
|
||||||
@@ -132,7 +132,7 @@ Elements.scroll_table = Gui.define("scroll_table")
|
|||||||
cell_padding = 1,
|
cell_padding = 1,
|
||||||
vertical_align = "center",
|
vertical_align = "center",
|
||||||
horizontally_stretchable = true,
|
horizontally_stretchable = true,
|
||||||
} --[[@as any]]
|
} --[[ @as any ]]
|
||||||
|
|
||||||
--- A container frame
|
--- A container frame
|
||||||
--- @class Gui.elements.container: ExpElement
|
--- @class Gui.elements.container: ExpElement
|
||||||
@@ -159,13 +159,13 @@ Elements.container = Gui.define("container")
|
|||||||
vertically_stretchable = false,
|
vertically_stretchable = false,
|
||||||
horizontally_stretchable = false,
|
horizontally_stretchable = false,
|
||||||
minimal_width = Gui.from_argument(1),
|
minimal_width = Gui.from_argument(1),
|
||||||
} --[[@as any]]
|
} --[[ @as any ]]
|
||||||
|
|
||||||
--- Get the root element of a container
|
--- Get the root element of a container
|
||||||
--- @param container LuaGuiElement
|
--- @param container LuaGuiElement
|
||||||
--- @return LuaGuiElement
|
--- @return LuaGuiElement
|
||||||
function Elements.container.get_root_element(container)
|
function Elements.container.get_root_element(container)
|
||||||
return assert(container.parent)
|
return container.parent
|
||||||
end
|
end
|
||||||
|
|
||||||
--- A frame within a container
|
--- A frame within a container
|
||||||
@@ -183,7 +183,7 @@ Elements.subframe_base = Gui.define("container_subframe")
|
|||||||
padding = { 3, 6, 0, 6 },
|
padding = { 3, 6, 0, 6 },
|
||||||
use_header_filler = false,
|
use_header_filler = false,
|
||||||
horizontally_stretchable = true,
|
horizontally_stretchable = true,
|
||||||
} --[[@as any]]
|
} --[[ @as any ]]
|
||||||
|
|
||||||
--- @class Gui.elements.header.opts
|
--- @class Gui.elements.header.opts
|
||||||
--- @field name string?
|
--- @field name string?
|
||||||
@@ -212,7 +212,7 @@ Elements.header = Gui.define("container_header")
|
|||||||
subframe.add{ type = "empty-widget" }.style.horizontally_stretchable = true
|
subframe.add{ type = "empty-widget" }.style.horizontally_stretchable = true
|
||||||
|
|
||||||
return subframe
|
return subframe
|
||||||
end) --[[@as any]]
|
end) --[[ @as any ]]
|
||||||
|
|
||||||
--- @class Gui.elements.footer.opts
|
--- @class Gui.elements.footer.opts
|
||||||
--- @field name string?
|
--- @field name string?
|
||||||
@@ -241,7 +241,7 @@ Elements.footer = Gui.define("container_footer")
|
|||||||
subframe.add{ type = "empty-widget" }.style.horizontally_stretchable = true
|
subframe.add{ type = "empty-widget" }.style.horizontally_stretchable = true
|
||||||
|
|
||||||
return subframe
|
return subframe
|
||||||
end) --[[@as any]]
|
end) --[[ @as any ]]
|
||||||
|
|
||||||
--- A button used to destroy its target when clicked, intended for screen frames
|
--- A button used to destroy its target when clicked, intended for screen frames
|
||||||
--- @class Gui.elements.screen_frame_close: ExpElement
|
--- @class Gui.elements.screen_frame_close: ExpElement
|
||||||
@@ -259,7 +259,7 @@ Elements.screen_frame_close = Gui.define("screen_frame_close")
|
|||||||
:on_click(function(def, player, element, event)
|
:on_click(function(def, player, element, event)
|
||||||
--- @cast def Gui.elements.screen_frame_close
|
--- @cast def Gui.elements.screen_frame_close
|
||||||
Gui.destroy_if_valid(def.data[element])
|
Gui.destroy_if_valid(def.data[element])
|
||||||
end) --[[@as any]]
|
end) --[[ @as any ]]
|
||||||
|
|
||||||
--- A draggable frame with close button and button flow
|
--- A draggable frame with close button and button flow
|
||||||
--- @class Gui.elements.screen_frame: ExpElement
|
--- @class Gui.elements.screen_frame: ExpElement
|
||||||
@@ -313,20 +313,20 @@ Elements.screen_frame = Gui.define("screen_frame")
|
|||||||
direction = "vertical",
|
direction = "vertical",
|
||||||
style = "inside_shallow_frame_packed",
|
style = "inside_shallow_frame_packed",
|
||||||
}
|
}
|
||||||
end) --[[@as any]]
|
end) --[[ @as any ]]
|
||||||
|
|
||||||
--- Get the button flow for a screen frame
|
--- Get the button flow for a screen frame
|
||||||
--- @param screen_frame LuaGuiElement
|
--- @param screen_frame LuaGuiElement
|
||||||
--- @return LuaGuiElement
|
--- @return LuaGuiElement
|
||||||
function Elements.screen_frame.get_button_flow(screen_frame)
|
function Elements.screen_frame.get_button_flow(screen_frame)
|
||||||
return (assert(Elements.screen_frame.data[assert(screen_frame.parent)], "Screen frame has no button flow"))
|
return assert(Elements.screen_frame.data[screen_frame.parent], "Screen frame has no button flow")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get the root element of a screen frame
|
--- Get the root element of a screen frame
|
||||||
--- @param screen_frame LuaGuiElement
|
--- @param screen_frame LuaGuiElement
|
||||||
--- @return LuaGuiElement
|
--- @return LuaGuiElement
|
||||||
function Elements.screen_frame.get_root_element(screen_frame)
|
function Elements.screen_frame.get_root_element(screen_frame)
|
||||||
return assert(screen_frame.parent)
|
return screen_frame.parent
|
||||||
end
|
end
|
||||||
|
|
||||||
return Elements
|
return Elements
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ end
|
|||||||
function GuiIter.get_tracked_elements(scope, filter)
|
function GuiIter.get_tracked_elements(scope, filter)
|
||||||
local class_name = ExpUtil.get_class_name(filter)
|
local class_name = ExpUtil.get_class_name(filter)
|
||||||
if class_name == "nil" then
|
if class_name == "nil" then
|
||||||
|
--- @cast filter nil
|
||||||
return GuiIter.all_elements(scope)
|
return GuiIter.all_elements(scope)
|
||||||
elseif class_name == "LuaPlayer" then
|
elseif class_name == "LuaPlayer" then
|
||||||
--- @cast filter LuaPlayer
|
--- @cast filter LuaPlayer
|
||||||
@@ -188,6 +189,7 @@ end
|
|||||||
function GuiIter.get_online_elements(scope, filter)
|
function GuiIter.get_online_elements(scope, filter)
|
||||||
local class_name = ExpUtil.get_class_name(filter)
|
local class_name = ExpUtil.get_class_name(filter)
|
||||||
if class_name == "nil" then
|
if class_name == "nil" then
|
||||||
|
--- @cast filter nil
|
||||||
return GuiIter.filtered_elements(scope, game.connected_players)
|
return GuiIter.filtered_elements(scope, game.connected_players)
|
||||||
elseif class_name == "LuaPlayer" then
|
elseif class_name == "LuaPlayer" then
|
||||||
--- @cast filter LuaPlayer
|
--- @cast filter LuaPlayer
|
||||||
@@ -233,7 +235,7 @@ end
|
|||||||
function GuiIter.remove_element(scope, player_index, element_index)
|
function GuiIter.remove_element(scope, player_index, element_index)
|
||||||
local scope_elements = registered_scopes[scope]
|
local scope_elements = registered_scopes[scope]
|
||||||
if not scope_elements then return end
|
if not scope_elements then return end
|
||||||
local player_elements = scope_elements[player_index]
|
local player_elements = registered_scopes[player_index]
|
||||||
if not player_elements then return end
|
if not player_elements then return end
|
||||||
player_elements[element_index] = nil
|
player_elements[element_index] = nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
[exp-gui]
|
[exp-gui]
|
||||||
clear-left-flow=Hide all open windows.
|
clear-left-flow=Hide all open windows.
|
||||||
close-toolbar=__CONTROL_LEFT_CLICK__: Toggle Settings\n__CONTROL_RIGHT_CLICK__: Close Toolbar
|
close-toolbar=__CONTROL_LEFT_CLICK__: Toggle Settings\n__CONTROL_RIGHT_CLICK__: Close Toolbar
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ ExpElement.events = {}
|
|||||||
--- @field _force_data ExpElement.PostDrawCallback?
|
--- @field _force_data ExpElement.PostDrawCallback?
|
||||||
--- @field _global_data ExpElement.PostDrawCallback?
|
--- @field _global_data ExpElement.PostDrawCallback?
|
||||||
--- @field _events table<defines.events, ExpElement.EventHandler<EventData>[]>
|
--- @field _events table<defines.events, ExpElement.EventHandler<EventData>[]>
|
||||||
--- @field _has_handlers boolean
|
|
||||||
--- @field _track_elements boolean
|
|
||||||
--- @overload fun(parent: LuaGuiElement, ...: any): LuaGuiElement
|
--- @overload fun(parent: LuaGuiElement, ...: any): LuaGuiElement
|
||||||
ExpElement._prototype = {
|
ExpElement._prototype = {
|
||||||
_track_elements = false,
|
_track_elements = false,
|
||||||
@@ -160,7 +158,7 @@ function ExpElement.new(name)
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpElement._elements[element_name] = instance --[[@as ExpElement]]
|
ExpElement._elements[element_name] = instance --[[ @as ExpElement ]]
|
||||||
return setmetatable(instance, ExpElement._metatable)
|
return setmetatable(instance, ExpElement._metatable)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -168,7 +166,7 @@ end
|
|||||||
--- @param name string
|
--- @param name string
|
||||||
--- @return ExpElement
|
--- @return ExpElement
|
||||||
function ExpElement.get(name)
|
function ExpElement.get(name)
|
||||||
return (assert(ExpElement._elements[name], "ExpElement is not defined: " .. tostring(name)))
|
return assert(ExpElement._elements[name], "ExpElement is not defined: " .. tostring(name))
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a new instance of this element definition
|
--- Create a new instance of this element definition
|
||||||
@@ -276,7 +274,6 @@ function ExpElement._prototype:draw(definition)
|
|||||||
|
|
||||||
if not next(signals) then
|
if not next(signals) then
|
||||||
-- If no signals then skip var arg
|
-- If no signals then skip var arg
|
||||||
--- @cast definition LuaGuiElement.add_param
|
|
||||||
self._draw = function(_, parent)
|
self._draw = function(_, parent)
|
||||||
return parent.add(definition)
|
return parent.add(definition)
|
||||||
end
|
end
|
||||||
@@ -462,7 +459,7 @@ function ExpElement._prototype:raise_event(event)
|
|||||||
for _, handler in ipairs(handlers) do
|
for _, handler in ipairs(handlers) do
|
||||||
-- All gui elements will contain player and element, other events might have these as nil
|
-- All gui elements will contain player and element, other events might have these as nil
|
||||||
-- Therefore only the signature of on_event has these values as optional
|
-- Therefore only the signature of on_event has these values as optional
|
||||||
handler(self, player --[[@as LuaPlayer]], event.element, event --[[@as EventData]])
|
handler(self, player --[[ @as LuaPlayer ]], event.element, event --[[ @as EventData ]])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- @class (partial) Gui
|
--- @class Gui
|
||||||
local Gui = require("modules/exp_gui")
|
local Gui = require("modules/exp_gui")
|
||||||
|
|
||||||
--- @class Gui.styles
|
--- @class Gui.styles
|
||||||
|
|||||||
+16
-18
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
--- @class (partial) Gui
|
--- @class Gui
|
||||||
local Gui = require("modules/exp_gui")
|
local Gui = require("modules/exp_gui")
|
||||||
local ExpElement = require("modules/exp_gui/prototype")
|
local ExpElement = require("modules/exp_gui/prototype")
|
||||||
local mod_gui = require("mod-gui")
|
local mod_gui = require("mod-gui")
|
||||||
@@ -29,7 +29,7 @@ Toolbar.on_gui_button_toggled = script.generate_event_name()
|
|||||||
--- @class _ExpElement._prototype
|
--- @class _ExpElement._prototype
|
||||||
--- @field on_button_toggled ExpElement.OnEventAdder<EventData.on_gui_button_toggled>
|
--- @field on_button_toggled ExpElement.OnEventAdder<EventData.on_gui_button_toggled>
|
||||||
|
|
||||||
--- @diagnostic disable-next-line: access-invisible, inject-field
|
--- @diagnostic disable-next-line: invisible, inject-field
|
||||||
function ExpElement._prototype.on_button_toggled(self, handler)
|
function ExpElement._prototype.on_button_toggled(self, handler)
|
||||||
return self:on_event(Toolbar.on_gui_button_toggled, handler)
|
return self:on_event(Toolbar.on_gui_button_toggled, handler)
|
||||||
end
|
end
|
||||||
@@ -85,7 +85,7 @@ function Toolbar.set_button_toggled_state(define, player, state, _from_left)
|
|||||||
button.style = state and toolbar_button_active_style or toolbar_button_default_style
|
button.style = state and toolbar_button_active_style or toolbar_button_default_style
|
||||||
|
|
||||||
-- Make the extra required adjustments
|
-- Make the extra required adjustments
|
||||||
local style = button.style --[[@as LuaStyle]]
|
local style = button.style
|
||||||
style.minimal_width = original_width
|
style.minimal_width = original_width
|
||||||
style.maximal_height = original_height
|
style.maximal_height = original_height
|
||||||
if button.type == "sprite-button" then
|
if button.type == "sprite-button" then
|
||||||
@@ -335,10 +335,9 @@ Below here is the toolbar settings GUI and its associated functions
|
|||||||
--- @param dst LuaGuiElement
|
--- @param dst LuaGuiElement
|
||||||
local function copy_style(src, dst)
|
local function copy_style(src, dst)
|
||||||
dst.style = src.style.name
|
dst.style = src.style.name
|
||||||
local style = dst.style --[[@as LuaStyle]]
|
dst.style.height = toolbar_button_small
|
||||||
style.height = toolbar_button_small
|
dst.style.width = toolbar_button_small
|
||||||
style.width = toolbar_button_small
|
dst.style.padding = -2
|
||||||
style.padding = -2
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Reorder the buttons relative to each other, this will update the datastore
|
--- Reorder the buttons relative to each other, this will update the datastore
|
||||||
@@ -351,7 +350,7 @@ local function move_toolbar_button(player, item, offset)
|
|||||||
|
|
||||||
-- Swap the position in the list
|
-- Swap the position in the list
|
||||||
local list = assert(item.parent)
|
local list = assert(item.parent)
|
||||||
local other_item = assert(list.children[new_index])
|
local other_item = list.children[new_index]
|
||||||
list.swap_children(old_index, new_index)
|
list.swap_children(old_index, new_index)
|
||||||
|
|
||||||
-- Swap the position in the top flow, offset by 1 because of settings button
|
-- Swap the position in the top flow, offset by 1 because of settings button
|
||||||
@@ -366,7 +365,7 @@ local function move_toolbar_button(player, item, offset)
|
|||||||
local other_element = Gui.get_left_element(other_left_element, player)
|
local other_element = Gui.get_left_element(other_left_element, player)
|
||||||
local left_index = element.get_index_in_parent()
|
local left_index = element.get_index_in_parent()
|
||||||
local other_index = other_element.get_index_in_parent()
|
local other_index = other_element.get_index_in_parent()
|
||||||
assert(element.parent).swap_children(left_index, other_index)
|
element.parent.swap_children(left_index, other_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If we are moving in/out of first/last place we need to update the move buttons
|
-- If we are moving in/out of first/last place we need to update the move buttons
|
||||||
@@ -394,7 +393,7 @@ end
|
|||||||
--- @param player LuaPlayer
|
--- @param player LuaPlayer
|
||||||
--- @param order Gui.ToolbarOrder
|
--- @param order Gui.ToolbarOrder
|
||||||
function Toolbar.set_order(player, order)
|
function Toolbar.set_order(player, order)
|
||||||
local list = elements.toolbar_settings.data[player] --[[@as LuaGuiElement]]
|
local list = elements.toolbar_settings.data[player] --[[ @as LuaGuiElement ]]
|
||||||
local left_flow = Gui.get_left_flow(player)
|
local left_flow = Gui.get_left_flow(player)
|
||||||
local top_flow = Gui.get_top_flow(player)
|
local top_flow = Gui.get_top_flow(player)
|
||||||
|
|
||||||
@@ -467,7 +466,7 @@ end
|
|||||||
function Toolbar.get_state(player)
|
function Toolbar.get_state(player)
|
||||||
-- Get the order of toolbar buttons
|
-- Get the order of toolbar buttons
|
||||||
local order = {}
|
local order = {}
|
||||||
local list = elements.toolbar_settings.data[player] --[[@as LuaGuiElement]]
|
local list = elements.toolbar_settings.data[player] --[[ @as LuaGuiElement ]]
|
||||||
for index, item in pairs(list.children) do
|
for index, item in pairs(list.children) do
|
||||||
order[index] = { name = item.name, favourite = elements.toolbar_list_item.data[item].set_favourite.state }
|
order[index] = { name = item.name, favourite = elements.toolbar_list_item.data[item].set_favourite.state }
|
||||||
end
|
end
|
||||||
@@ -488,7 +487,7 @@ end
|
|||||||
--- @param player LuaPlayer
|
--- @param player LuaPlayer
|
||||||
function Toolbar._create_elements(player)
|
function Toolbar._create_elements(player)
|
||||||
-- Add any missing items to the gui
|
-- Add any missing items to the gui
|
||||||
local toolbar_list = elements.toolbar_settings.data[player] --[[@as LuaGuiElement]]
|
local toolbar_list = elements.toolbar_settings.data[player] --[[ @as LuaGuiElement ]]
|
||||||
local previous_last_index = #toolbar_list.children_names
|
local previous_last_index = #toolbar_list.children_names
|
||||||
for define in pairs(Gui.top_elements) do
|
for define in pairs(Gui.top_elements) do
|
||||||
if define ~= elements.close_toolbar and toolbar_list[define.name] == nil then
|
if define ~= elements.close_toolbar and toolbar_list[define.name] == nil then
|
||||||
@@ -500,8 +499,7 @@ function Toolbar._create_elements(player)
|
|||||||
-- Reset the state of the previous last child
|
-- Reset the state of the previous last child
|
||||||
local children = toolbar_list.children
|
local children = toolbar_list.children
|
||||||
if previous_last_index > 0 then
|
if previous_last_index > 0 then
|
||||||
local previous_last = assert(children[previous_last_index])
|
elements.toolbar_list_item.data[children[previous_last_index]].move_item_down.enabled = true
|
||||||
elements.toolbar_list_item.data[previous_last].move_item_down.enabled = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set the state of the move buttons for the first and last element
|
-- Set the state of the move buttons for the first and last element
|
||||||
@@ -515,7 +513,7 @@ end
|
|||||||
--- @param player LuaPlayer
|
--- @param player LuaPlayer
|
||||||
function Toolbar._ensure_consistency(player)
|
function Toolbar._ensure_consistency(player)
|
||||||
-- Update the toolbar buttons
|
-- Update the toolbar buttons
|
||||||
local list = elements.toolbar_settings.data[player] --[[@as LuaGuiElement]]
|
local list = elements.toolbar_settings.data[player] --[[ @as LuaGuiElement ]]
|
||||||
for _, button in ipairs(toolbar_buttons) do
|
for _, button in ipairs(toolbar_buttons) do
|
||||||
-- Update the visible state based on if the player is allowed the button
|
-- Update the visible state based on if the player is allowed the button
|
||||||
local element = Gui.get_top_element(button, player)
|
local element = Gui.get_top_element(button, player)
|
||||||
@@ -621,7 +619,7 @@ elements.move_item_up = Gui.define("move_item_up")
|
|||||||
size = toolbar_button_small,
|
size = toolbar_button_small,
|
||||||
})
|
})
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
local item = assert(assert(element.parent).parent)
|
local item = assert(element.parent.parent)
|
||||||
move_toolbar_button(player, item, -1)
|
move_toolbar_button(player, item, -1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -636,7 +634,7 @@ elements.move_item_down = Gui.define("move_item_down")
|
|||||||
size = toolbar_button_small,
|
size = toolbar_button_small,
|
||||||
})
|
})
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
local item = assert(assert(element.parent).parent)
|
local item = assert(element.parent.parent)
|
||||||
move_toolbar_button(player, item, 1)
|
move_toolbar_button(player, item, 1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -660,7 +658,7 @@ elements.set_favourite = Gui.define("set_favourite")
|
|||||||
width = 180,
|
width = 180,
|
||||||
}
|
}
|
||||||
:on_checked_state_changed(function(def, player, element)
|
:on_checked_state_changed(function(def, player, element)
|
||||||
local define = ExpElement.get(element.tags.element_name --[[@as string]])
|
local define = ExpElement.get(element.tags.element_name --[[ @as string ]])
|
||||||
local top_element = Gui.get_top_element(define, player)
|
local top_element = Gui.get_top_element(define, player)
|
||||||
local had_visible = Toolbar.has_visible_buttons(player)
|
local had_visible = Toolbar.has_visible_buttons(player)
|
||||||
top_element.visible = element.state
|
top_element.visible = element.state
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@expcluster/lib_gui",
|
"name": "@expcluster/lib_gui",
|
||||||
"version": "6.5.0",
|
"version": "0.1.0",
|
||||||
"description": "Clusterio plugin providing a Lua GUI definition library.",
|
"description": "Clusterio plugin providing a Lua GUI definition library.",
|
||||||
"author": "Cooldude2606 <https://github.com/Cooldude2606>",
|
"author": "Cooldude2606 <https://github.com/Cooldude2606>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@clusterio/lib": "workspace:^"
|
"@clusterio/lib": "catalog:"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@clusterio/lib": "workspace:^",
|
"@clusterio/lib": "catalog:",
|
||||||
"@types/node": "catalog:",
|
"@types/node": "catalog:",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"webpack": "catalog:",
|
"webpack": "catalog:",
|
||||||
|
|||||||
@@ -16,15 +16,19 @@ return {
|
|||||||
"modules.data.quickbar",
|
"modules.data.quickbar",
|
||||||
"modules.data.alt-view",
|
"modules.data.alt-view",
|
||||||
"modules.data.tag",
|
"modules.data.tag",
|
||||||
|
-- 'modules.data.bonus',
|
||||||
|
"modules.data.personal-logistic",
|
||||||
"modules.data.language",
|
"modules.data.language",
|
||||||
--"modules.data.toolbar",
|
--"modules.data.toolbar",
|
||||||
|
|
||||||
--- GUI
|
--- GUI
|
||||||
|
"modules.gui.readme",
|
||||||
"modules.gui.warp-list",
|
"modules.gui.warp-list",
|
||||||
|
"modules.gui.player-list",
|
||||||
"modules.gui.vlayer",
|
"modules.gui.vlayer",
|
||||||
"modules.gui._role_updates",
|
"modules.gui._role_updates",
|
||||||
|
|
||||||
"modules.graftorio.require", -- graftorio
|
-- "modules.graftorio.require", -- graftorio
|
||||||
--- Config Files
|
--- Config Files
|
||||||
"config.expcore.permission_groups", -- loads some predefined permission groups
|
"config.expcore.permission_groups", -- loads some predefined permission groups
|
||||||
"config.expcore.roles", -- loads some predefined roles
|
"config.expcore.roles", -- loads some predefined roles
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
--- These are called factories because they return another function
|
--- These are called factories because they return another function
|
||||||
-- use these as a simple methods of adding new items
|
-- use these as a simple methods of adding new items
|
||||||
-- they will do most of the work for you
|
-- they will do most of the work for you
|
||||||
-- ['item-name'] = factory(params)
|
-- ["item-name"] = factory(params)
|
||||||
-- luacheck:ignore 212/amount_made 212/items_made 212/player
|
-- luacheck:ignore 212/amount_made 212/items_made 212/player
|
||||||
|
|
||||||
-- Use these to adjust for ticks ie game.tick < 5*minutes
|
-- Use these to adjust for ticks ie game.tick < 5*minutes
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
local seconds, minutes, hours = 60, 3600, 216000
|
local seconds, minutes, hours = 60, 3600, 216000
|
||||||
|
|
||||||
--- Use to make a split point for the number of items given based on time
|
--- Use to make a split point for the number of items given based on time
|
||||||
-- ['stone-furnace']=cutoff_time(5*minutes, 4,0) -- before 5 minutes give four items after 5 minutes give none
|
-- ["stone-furnace"]=cutoff_time(5*minutes, 4,0) -- before 5 minutes give four items after 5 minutes give none
|
||||||
local function cutoff_time(time, before, after)
|
local function cutoff_time(time, before, after)
|
||||||
return function(amount_made, items_made, player)
|
return function(amount_made, items_made, player)
|
||||||
if game.tick < time then
|
if game.tick < time then
|
||||||
@@ -24,7 +24,8 @@ local function cutoff_time(time, before, after)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Use to make a split point for the number of items given based on amount made
|
--- Use to make a split point for the number of items given based on amount made
|
||||||
-- ['firearm-magazine']=cutoff_amount_made(100, 10, 0) -- give 10 items until 100 items have been made
|
-- ["firearm-magazine"]=cutoff_amount_made(100, 10, 0) -- give 10 items until 100 items have been made
|
||||||
|
--[[
|
||||||
local function cutoff_amount_made(amount, before, after)
|
local function cutoff_amount_made(amount, before, after)
|
||||||
return function(amount_made, items_made, player)
|
return function(amount_made, items_made, player)
|
||||||
if amount_made < amount then
|
if amount_made < amount then
|
||||||
@@ -34,9 +35,11 @@ local function cutoff_amount_made(amount, before, after)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
--- Same as above but will not give any items if x amount has been made of another item, useful for tiers
|
--- Same as above but will not give any items if x amount has been made of another item, useful for tiers
|
||||||
-- ['light-armor']=cutoff_amount_made_unless(5, 0,1,'heavy-armor',5) -- give light armor once 5 have been made unless 5 heavy armor has been made
|
-- ["light-armor"]=cutoff_amount_made_unless(5, 0,1,"heavy-armor",5) -- give light armor once 5 have been made unless 5 heavy armor has been made
|
||||||
|
--[[
|
||||||
local function cutoff_amount_made_unless(amount, before, after, second_item, second_amount)
|
local function cutoff_amount_made_unless(amount, before, after, second_item, second_amount)
|
||||||
return function(amount_made, items_made, player)
|
return function(amount_made, items_made, player)
|
||||||
if items_made(second_item) < second_amount then
|
if items_made(second_item) < second_amount then
|
||||||
@@ -50,9 +53,11 @@ local function cutoff_amount_made_unless(amount, before, after, second_item, sec
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
-- Use for mass production items where you want the amount to change based on the amount already made
|
-- Use for mass production items where you want the amount to change based on the amount already made
|
||||||
-- ['iron-plate']=scale_amount_made(5*minutes, 10, 10) -- for first 5 minutes give 10 items then after apply a factor of 10
|
-- ["iron-plate"]=scale_amount_made(5*minutes, 10, 10) -- for first 5 minutes give 10 items then after apply a factor of 10
|
||||||
|
--[[
|
||||||
local function scale_amount_made(amount, before, scalar)
|
local function scale_amount_made(amount, before, scalar)
|
||||||
return function(amount_made, items_made, player)
|
return function(amount_made, items_made, player)
|
||||||
if amount_made < amount then
|
if amount_made < amount then
|
||||||
@@ -62,12 +67,13 @@ local function scale_amount_made(amount, before, scalar)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Common values
|
Common values
|
||||||
game.tick is the amount of time the game has been on for
|
game.tick is the amount of time the game has been on for
|
||||||
amount_made is the amount of that item which has been made
|
amount_made is the amount of that item which has been made
|
||||||
items_made('item-name') will return the amount of any item made
|
items_made("item-name") will return the amount of any item made
|
||||||
player is the player who just spawned
|
player is the player who just spawned
|
||||||
hours, minutes, seconds are the number of ticks in each unit of time
|
hours, minutes, seconds are the number of ticks in each unit of time
|
||||||
]]
|
]]
|
||||||
@@ -78,35 +84,30 @@ return {
|
|||||||
friendly_fire = false, --- @setting friendly_fire weather players will be able to attack each other on the same force
|
friendly_fire = false, --- @setting friendly_fire weather players will be able to attack each other on the same force
|
||||||
disable_crashsite = true, --- @setting disable_crashsite weather to disable creation of the crashsite
|
disable_crashsite = true, --- @setting disable_crashsite weather to disable creation of the crashsite
|
||||||
enemy_expansion = false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load
|
enemy_expansion = false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load
|
||||||
chart_radius = 10 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts
|
chart_radius = 16 * 32, --- @setting chart_radius the number of tiles that will be charted when the map starts
|
||||||
items = { --- @setting items items and there condition for being given
|
items = { --- @setting items items and there condition for being given
|
||||||
-- ['item-name'] = function(amount_made, production_stats, player) return <Number> end -- 0 means no items given
|
["iron-ore"] = cutoff_time(20 * minutes, 80, 0),
|
||||||
-- Plates
|
["stone"] = cutoff_time(20 * minutes, 20, 0),
|
||||||
["iron-plate"] = scale_amount_made(100, 10, 10),
|
["coal"] = cutoff_time(20 * minutes, 20, 0),
|
||||||
["copper-plate"] = scale_amount_made(100, 0, 8),
|
-- ["burner-mining-drill"]=cutoff_time(20 * minutes, 8, 0),
|
||||||
["steel-plate"] = scale_amount_made(100, 0, 4),
|
-- ["stone-furnace"]=cutoff_time(20 * minutes, 8, 0),
|
||||||
-- Secondary Items
|
["submachine-gun"] = 1,
|
||||||
["electronic-circuit"] = scale_amount_made(1000, 0, 6),
|
["piercing-rounds-magazine"] = 20,
|
||||||
["iron-gear-wheel"] = scale_amount_made(1000, 0, 6),
|
["construction-robot"] = 10,
|
||||||
-- Starting Items
|
["modular-armor"] = 1,
|
||||||
["burner-mining-drill"] = cutoff_time(10 * minutes, 4, 0),
|
["solar-panel-equipment"] = 16,
|
||||||
["stone-furnace"] = cutoff_time(10 * minutes, 4, 0),
|
["belt-immunity-equipment"] = 1,
|
||||||
-- Armor
|
["battery-equipment"] = 2,
|
||||||
["light-armor"] = cutoff_amount_made_unless(5, 0, 1, "heavy-armor", 5),
|
["personal-roboport-equipment"] = 1
|
||||||
["heavy-armor"] = cutoff_amount_made(5, 0, 1),
|
|
||||||
-- Weapon
|
|
||||||
["pistol"] = cutoff_amount_made_unless(0, 1, 1, "submachine-gun", 5),
|
|
||||||
["submachine-gun"] = cutoff_amount_made(5, 0, 1),
|
|
||||||
-- Ammo
|
|
||||||
["firearm-magazine"] = cutoff_amount_made_unless(100, 10, 0, "piercing-rounds-magazine", 100),
|
|
||||||
["piercing-rounds-magazine"] = cutoff_amount_made(100, 0, 10),
|
|
||||||
--[[
|
--[[
|
||||||
['construction-robot'] = 10,
|
["construction-robot"] = 50,
|
||||||
['modular-armor'] = 1,
|
["spidertron"] = 1,
|
||||||
['solar-panel-equipment'] = 16,
|
["spidertron-remote"] = 1,
|
||||||
['belt-immunity-equipment'] = 1,
|
["modular-armor"] = 1,
|
||||||
['battery-equipment'] = 2,
|
["solar-panel-equipment"] = 60,
|
||||||
['personal-roboport-equipment'] = 1
|
["belt-immunity-equipment"] = 1,
|
||||||
|
["battery-equipment"] = 6,
|
||||||
|
["personal-roboport-equipment"] = 5
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,21 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
--[[
|
--[[
|
||||||
|
TODO
|
||||||
|
force bonus
|
||||||
|
quick health regeneration
|
||||||
|
|
||||||
Base point is equal to the amount of standard value in each parameter.
|
Base point is equal to the amount of standard value in each parameter.
|
||||||
|
|
||||||
CMMS CRS CCS CISB CHB CRDB PBR
|
CMMS CRS CCS CISB CHB CRDB PBR
|
||||||
STD 20 60 24 10 12 8 40
|
STD 30 90 32 20 16 12 60
|
||||||
= 174
|
= 260
|
||||||
|
|
||||||
MAX 40 120 48 20 24 16 80
|
MAX 60 180 64 40 32 24 120
|
||||||
= 348
|
= 480
|
||||||
]]
|
]]
|
||||||
points = {
|
points = {
|
||||||
base = 174,
|
base = 260,
|
||||||
increase_percentage_per_role_level = 0.03,
|
increase_percentage_per_role_level = 0.03,
|
||||||
role_name = "Member",
|
role_name = "Member",
|
||||||
},
|
},
|
||||||
@@ -23,7 +27,8 @@ return {
|
|||||||
name = "character_mining_speed_modifier",
|
name = "character_mining_speed_modifier",
|
||||||
scale = 1,
|
scale = 1,
|
||||||
cost = 10,
|
cost = 10,
|
||||||
max_value = 4,
|
max_value = 6,
|
||||||
|
initial_value = 3,
|
||||||
value_step = 0.5,
|
value_step = 0.5,
|
||||||
is_percentage = true,
|
is_percentage = true,
|
||||||
},
|
},
|
||||||
@@ -31,7 +36,8 @@ return {
|
|||||||
name = "character_running_speed_modifier",
|
name = "character_running_speed_modifier",
|
||||||
scale = 1,
|
scale = 1,
|
||||||
cost = 60,
|
cost = 60,
|
||||||
max_value = 2,
|
max_value = 3,
|
||||||
|
initial_value = 1.5,
|
||||||
value_step = 0.25,
|
value_step = 0.25,
|
||||||
is_percentage = true,
|
is_percentage = true,
|
||||||
},
|
},
|
||||||
@@ -39,29 +45,33 @@ return {
|
|||||||
name = "character_crafting_speed_modifier",
|
name = "character_crafting_speed_modifier",
|
||||||
scale = 1,
|
scale = 1,
|
||||||
cost = 4,
|
cost = 4,
|
||||||
max_value = 12,
|
max_value = 16,
|
||||||
|
initial_value = 8,
|
||||||
value_step = 1,
|
value_step = 1,
|
||||||
is_percentage = true,
|
is_percentage = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "character_inventory_slots_bonus",
|
name = "character_inventory_slots_bonus",
|
||||||
scale = 10,
|
|
||||||
cost = 2,
|
cost = 2,
|
||||||
max_value = 100,
|
scale = 10,
|
||||||
|
max_value = 200,
|
||||||
|
initial_value = 100,
|
||||||
value_step = 10,
|
value_step = 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "character_health_bonus",
|
name = "character_health_bonus",
|
||||||
scale = 50,
|
scale = 50,
|
||||||
cost = 4,
|
cost = 4,
|
||||||
max_value = 300,
|
max_value = 400,
|
||||||
|
initial_value = 200,
|
||||||
value_step = 50,
|
value_step = 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "character_reach_distance_bonus",
|
name = "character_reach_distance_bonus",
|
||||||
scale = 1,
|
|
||||||
cost = 1,
|
cost = 1,
|
||||||
max_value = 16,
|
scale = 1,
|
||||||
|
max_value = 24,
|
||||||
|
initial_value = 12,
|
||||||
value_step = 2,
|
value_step = 2,
|
||||||
combined_bonus = {
|
combined_bonus = {
|
||||||
"character_resource_reach_distance_bonus",
|
"character_resource_reach_distance_bonus",
|
||||||
@@ -70,15 +80,104 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "personal_battery_recharge",
|
name = "personal_battery_recharge",
|
||||||
|
initial_value = 6,
|
||||||
|
max_value = 12,
|
||||||
|
value_step = 1,
|
||||||
scale = 4,
|
scale = 4,
|
||||||
cost = 40,
|
cost = 40,
|
||||||
max_value = 8,
|
|
||||||
value_step = 1,
|
|
||||||
is_special = true,
|
is_special = true,
|
||||||
},
|
},
|
||||||
|
--[[
|
||||||
|
['character_item_pickup_distance_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 20,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['character_loot_pickup_distance_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 20,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['character_item_drop_distance_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 20,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
}
|
||||||
|
]]
|
||||||
},
|
},
|
||||||
force_bonus = {
|
force_bonus = {
|
||||||
|
--[[
|
||||||
|
['character_mining_speed_modifier'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 6,
|
||||||
|
value_step = 0.5,
|
||||||
|
scale = 1,
|
||||||
|
cost = 10,
|
||||||
|
is_percentage = true
|
||||||
|
},
|
||||||
|
['character_running_speed_modifier'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 3,
|
||||||
|
value_step = 0.25,
|
||||||
|
scale = 1,
|
||||||
|
cost = 40,
|
||||||
|
is_percentage = true
|
||||||
|
},
|
||||||
|
['character_crafting_speed_modifier'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 16,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 4,
|
||||||
|
is_percentage = true
|
||||||
|
},
|
||||||
|
['character_inventory_slots_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 200,
|
||||||
|
value_step = 10,
|
||||||
|
scale = 100,
|
||||||
|
cost = 2,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['character_health_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 400,
|
||||||
|
value_step = 50,
|
||||||
|
cost = 4,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['character_reach_distance_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 24,
|
||||||
|
value_step = 2,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false,
|
||||||
|
combined_bonus = {
|
||||||
|
'character_resource_reach_distance_bonus',
|
||||||
|
'character_build_distance_bonus'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
['worker_robots_speed_modifier'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
]]
|
||||||
["worker_robots_battery_modifier"] = {
|
["worker_robots_battery_modifier"] = {
|
||||||
|
initial_value = 1,
|
||||||
max_value = 1,
|
max_value = 1,
|
||||||
value_step = 1,
|
value_step = 1,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
@@ -86,6 +185,7 @@ return {
|
|||||||
is_percentage = false,
|
is_percentage = false,
|
||||||
},
|
},
|
||||||
["worker_robots_storage_bonus"] = {
|
["worker_robots_storage_bonus"] = {
|
||||||
|
initial_value = 1,
|
||||||
max_value = 1,
|
max_value = 1,
|
||||||
value_step = 1,
|
value_step = 1,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
@@ -93,13 +193,114 @@ return {
|
|||||||
is_percentage = false,
|
is_percentage = false,
|
||||||
},
|
},
|
||||||
["following_robots_lifetime_modifier"] = {
|
["following_robots_lifetime_modifier"] = {
|
||||||
|
initial_value = 1,
|
||||||
max_value = 1,
|
max_value = 1,
|
||||||
value_step = 1,
|
value_step = 1,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
cost = 1,
|
cost = 1,
|
||||||
is_percentage = false,
|
is_percentage = false,
|
||||||
},
|
},
|
||||||
|
--[[
|
||||||
|
['character_item_pickup_distance_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 20,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['character_loot_pickup_distance_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 20,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['character_item_drop_distance_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 20,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['character_trash_slot_count'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['mining_drill_productivity_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['train_braking_force_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['laboratory_speed_modifier'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['laboratory_productivity_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['inserter_stack_size_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['stack_inserter_capacity_bonus'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
},
|
||||||
|
['artillery_range_modifier'] = {
|
||||||
|
initial_value = 0,
|
||||||
|
max_value = 0,
|
||||||
|
value_step = 0,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
}
|
||||||
|
]]
|
||||||
},
|
},
|
||||||
surface_bonus = {
|
surface_bonus = {
|
||||||
|
--[[
|
||||||
|
['solar_power_multiplier'] = {
|
||||||
|
initial_value = 1,
|
||||||
|
max_value = 1000,
|
||||||
|
value_step = 1,
|
||||||
|
scale = 1,
|
||||||
|
cost = 1,
|
||||||
|
is_percentage = false
|
||||||
|
}
|
||||||
|
]]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -24,15 +24,11 @@ local afk_time_units = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
--- @type table<string, LocalisedString | fun(player: LuaPlayer, is_command: boolean): LocalisedString>
|
|
||||||
messages = { --- @setting messages will trigger when ever the word is said
|
messages = { --- @setting messages will trigger when ever the word is said
|
||||||
["discord"] = { "info.discord" },
|
["discord"] = { "info.discord" },
|
||||||
["expgaming"] = { "info.website" },
|
["aperx"] = { "info.website" },
|
||||||
["website"] = { "info.website" },
|
["website"] = { "info.website" },
|
||||||
["status"] = { "info.status" },
|
|
||||||
["github"] = { "info.github" },
|
["github"] = { "info.github" },
|
||||||
["patreon"] = { "info.patreon" },
|
|
||||||
["donate"] = { "info.patreon" },
|
|
||||||
["command"] = { "info.custom-commands" },
|
["command"] = { "info.custom-commands" },
|
||||||
["commands"] = { "info.custom-commands" },
|
["commands"] = { "info.custom-commands" },
|
||||||
["softmod"] = { "info.softmod" },
|
["softmod"] = { "info.softmod" },
|
||||||
@@ -67,7 +63,6 @@ return {
|
|||||||
command_admin_only = false, --- @setting command_admin_only when true will only allow chat commands for admins
|
command_admin_only = false, --- @setting command_admin_only when true will only allow chat commands for admins
|
||||||
command_permission = "command/chat-commands", --- @setting command_permission the permission used to allow command prefixes
|
command_permission = "command/chat-commands", --- @setting command_permission the permission used to allow command prefixes
|
||||||
command_prefix = "!", --- @setting command_prefix prefix used for commands below and to print to all players (if enabled above)
|
command_prefix = "!", --- @setting command_prefix prefix used for commands below and to print to all players (if enabled above)
|
||||||
--- @type table<string, LocalisedString | fun(player: LuaPlayer, is_command: boolean): LocalisedString>
|
|
||||||
commands = { --- @setting commands will trigger only when command prefix is given
|
commands = { --- @setting commands will trigger only when command prefix is given
|
||||||
["dev"] = { "exp_chat-auto-reply.reply-dev" },
|
["dev"] = { "exp_chat-auto-reply.reply-dev" },
|
||||||
["magic"] = { "exp_chat-auto-reply.reply-magic" },
|
["magic"] = { "exp_chat-auto-reply.reply-magic" },
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ return {
|
|||||||
player_kicks = true,
|
player_kicks = true,
|
||||||
player_promotes = false,
|
player_promotes = false,
|
||||||
player_jail = true,
|
player_jail = true,
|
||||||
["config"] = true,
|
['config']=false,
|
||||||
["purge"] = true,
|
['purge']=false,
|
||||||
["c"] = true,
|
['c']=false,
|
||||||
["command"] = true,
|
['sc']=false,
|
||||||
["silent-command"] = true,
|
['command']=false,
|
||||||
["measured-command"] = true,
|
['silent-command']=false,
|
||||||
["banlist"] = true,
|
['measured-command']=false,
|
||||||
["permissions"] = true,
|
['banlist']=false,
|
||||||
["editor"] = true,
|
['permissions']=false,
|
||||||
["cheat"] = true,
|
['editor']=false,
|
||||||
["open"] = false,
|
['cheat']=false,
|
||||||
|
['open']=false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
--- Use this file to add new permission groups to the game;
|
--- Use this file to add new permission groups to the game;
|
||||||
-- start with Permission_Groups.new_group('name');
|
-- start with Permission_Groups.new_group("name");
|
||||||
-- then use either :allow_all() or :disallow_all() to set the default for non specified actions;
|
-- then use either :allow_all() or :disallow_all() to set the default for non specified actions;
|
||||||
-- then use :allow{} and :disallow{} to specify certain actions to allow/disallow
|
-- then use :allow{} and :disallow{} to specify certain actions to allow/disallow
|
||||||
-- @config Permission-Groups
|
-- @config Permission-Groups
|
||||||
@@ -9,6 +9,9 @@ local Groups = require("modules.exp_legacy.expcore.permission_groups") --- @dep
|
|||||||
|
|
||||||
Groups.new_group("Admin")
|
Groups.new_group("Admin")
|
||||||
:allow_all()
|
:allow_all()
|
||||||
|
|
||||||
|
Groups.new_group("Mod")
|
||||||
|
:allow_all()
|
||||||
:disallow{
|
:disallow{
|
||||||
"add_permission_group", -- admin
|
"add_permission_group", -- admin
|
||||||
"delete_permission_group",
|
"delete_permission_group",
|
||||||
@@ -17,11 +20,6 @@ Groups.new_group("Admin")
|
|||||||
"map_editor_action",
|
"map_editor_action",
|
||||||
"toggle_map_editor",
|
"toggle_map_editor",
|
||||||
"change_multiplayer_config",
|
"change_multiplayer_config",
|
||||||
"set_heat_interface_mode",
|
|
||||||
"set_heat_interface_temperature",
|
|
||||||
"set_infinity_container_filter_item",
|
|
||||||
"set_infinity_container_remove_unfiltered_items",
|
|
||||||
"set_infinity_pipe_filter",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Groups.new_group("Trusted")
|
Groups.new_group("Trusted")
|
||||||
@@ -34,12 +32,12 @@ Groups.new_group("Trusted")
|
|||||||
"map_editor_action",
|
"map_editor_action",
|
||||||
"toggle_map_editor",
|
"toggle_map_editor",
|
||||||
"change_multiplayer_config",
|
"change_multiplayer_config",
|
||||||
"set_heat_interface_mode",
|
"set_heat_interface_mode", -- trusted
|
||||||
"set_heat_interface_temperature",
|
"set_heat_interface_temperature",
|
||||||
"set_infinity_container_filter_item",
|
"set_infinity_container_filter_item",
|
||||||
"set_infinity_container_remove_unfiltered_items",
|
"set_infinity_container_remove_unfiltered_items",
|
||||||
"set_infinity_pipe_filter",
|
"set_infinity_pipe_filter",
|
||||||
"admin_action", -- trusted
|
"admin_action",
|
||||||
}
|
}
|
||||||
|
|
||||||
Groups.new_group("Standard")
|
Groups.new_group("Standard")
|
||||||
@@ -58,10 +56,8 @@ Groups.new_group("Standard")
|
|||||||
"set_infinity_container_remove_unfiltered_items",
|
"set_infinity_container_remove_unfiltered_items",
|
||||||
"set_infinity_pipe_filter",
|
"set_infinity_pipe_filter",
|
||||||
"admin_action", -- trusted
|
"admin_action", -- trusted
|
||||||
|
"delete_space_platform",
|
||||||
"change_programmable_speaker_alert_parameters", -- standard
|
"change_programmable_speaker_alert_parameters", -- standard
|
||||||
"drop_item",
|
|
||||||
"open_new_platform_button_from_rocket_silo",
|
|
||||||
"set_rocket_silo_send_to_orbit_automated_mode",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Groups.new_group("Guest")
|
Groups.new_group("Guest")
|
||||||
@@ -80,21 +76,24 @@ Groups.new_group("Guest")
|
|||||||
"set_infinity_container_remove_unfiltered_items",
|
"set_infinity_container_remove_unfiltered_items",
|
||||||
"set_infinity_pipe_filter",
|
"set_infinity_pipe_filter",
|
||||||
"admin_action", -- trusted
|
"admin_action", -- trusted
|
||||||
|
"delete_space_platform",
|
||||||
"change_programmable_speaker_alert_parameters", -- standard
|
"change_programmable_speaker_alert_parameters", -- standard
|
||||||
|
"change_programmable_speaker_circuit_parameters", -- guest
|
||||||
|
"change_programmable_speaker_parameters",
|
||||||
"drop_item",
|
"drop_item",
|
||||||
"open_new_platform_button_from_rocket_silo",
|
|
||||||
"set_rocket_silo_send_to_orbit_automated_mode",
|
"set_rocket_silo_send_to_orbit_automated_mode",
|
||||||
"change_programmable_speaker_parameters", -- guest
|
"open_new_platform_button_from_rocket_silo",
|
||||||
|
"instantly_create_space_platform",
|
||||||
|
"cancel_delete_space_platform",
|
||||||
|
"rename_space_platform",
|
||||||
|
-- "launch_rocket",
|
||||||
"change_train_stop_station",
|
"change_train_stop_station",
|
||||||
-- 'deconstruct',
|
-- "deconstruct",
|
||||||
"remove_cables",
|
"remove_cables",
|
||||||
"remove_train_station",
|
"remove_train_station",
|
||||||
"reset_assembling_machine",
|
"reset_assembling_machine",
|
||||||
"rotate_entity",
|
"rotate_entity",
|
||||||
-- 'use_artillery_remote', -- not in 2.0
|
|
||||||
"launch_rocket",
|
|
||||||
"cancel_research",
|
"cancel_research",
|
||||||
-- 'activate_cut', -- not in 2.0
|
|
||||||
"flush_opened_entity_fluid",
|
"flush_opened_entity_fluid",
|
||||||
"flush_opened_entity_specific_fluid",
|
"flush_opened_entity_specific_fluid",
|
||||||
}
|
}
|
||||||
@@ -108,15 +107,15 @@ Groups.new_group("Restricted")
|
|||||||
local trusted_time = 60*60*60*10 -- 10 hour
|
local trusted_time = 60*60*60*10 -- 10 hour
|
||||||
local standard_time = 60*60*60*3 -- 3 hour
|
local standard_time = 60*60*60*3 -- 3 hour
|
||||||
local function assign_group(player)
|
local function assign_group(player)
|
||||||
local current_group_name = player.permission_group and player.permission_group.name or 'None'
|
local current_group_name = player.permission_group and player.permission_group.name or "None"
|
||||||
if player.admin then
|
if player.admin then
|
||||||
Permission_Groups.set_player_group(player,'Admin')
|
Permission_Groups.set_player_group(player,"Admin")
|
||||||
elseif player.online_time > trusted_time or current_group_name == 'Trusted' then
|
elseif player.online_time > trusted_time or current_group_name == "Trusted" then
|
||||||
Permission_Groups.set_player_group(player,'Trusted')
|
Permission_Groups.set_player_group(player,"Trusted")
|
||||||
elseif player.online_time > standard_time or current_group_name == 'Standard' then
|
elseif player.online_time > standard_time or current_group_name == "Standard" then
|
||||||
Permission_Groups.set_player_group(player,'Standard')
|
Permission_Groups.set_player_group(player,"Standard")
|
||||||
else
|
else
|
||||||
Permission_Groups.set_player_group(player,'Guest')
|
Permission_Groups.set_player_group(player,"Guest")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Roles.define_flag_trigger("is_spectator", function(player, state)
|
|||||||
end)
|
end)
|
||||||
Roles.define_flag_trigger("is_jail", function(player, state)
|
Roles.define_flag_trigger("is_jail", function(player, state)
|
||||||
if player.character then
|
if player.character then
|
||||||
player.character.disabled_by_script = not state
|
player.character.active = not state
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ Roles.new_role("System", "SYS")
|
|||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_flag("report-immune")
|
:set_flag("report-immune")
|
||||||
:set_flag("instant-respawn")
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
:set_allow_all()
|
:set_allow_all()
|
||||||
|
|
||||||
Roles.new_role("Senior Administrator", "SAdmin")
|
Roles.new_role("Senior Administrator", "SAdmin")
|
||||||
@@ -36,13 +37,9 @@ Roles.new_role("Senior Administrator", "SAdmin")
|
|||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_flag("report-immune")
|
:set_flag("report-immune")
|
||||||
:set_flag("instant-respawn")
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
:set_parent("Administrator")
|
:set_parent("Administrator")
|
||||||
:allow{
|
:set_allow_all()
|
||||||
"command/_rcon",
|
|
||||||
"command/debug",
|
|
||||||
"command/set-cheat-mode",
|
|
||||||
"command/research-all",
|
|
||||||
}
|
|
||||||
|
|
||||||
Roles.new_role("Administrator", "Admin")
|
Roles.new_role("Administrator", "Admin")
|
||||||
:set_permission_group("Admin")
|
:set_permission_group("Admin")
|
||||||
@@ -51,62 +48,57 @@ Roles.new_role("Administrator", "Admin")
|
|||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_flag("report-immune")
|
:set_flag("report-immune")
|
||||||
:set_flag("instant-respawn")
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_parent("Senior Moderator")
|
||||||
|
:allow{
|
||||||
|
"command/_rcon",
|
||||||
|
"command/debug",
|
||||||
|
"command/set-cheat-mode",
|
||||||
|
"command/research-all"
|
||||||
|
}
|
||||||
|
|
||||||
|
Roles.new_role("Senior Moderator", "SMod")
|
||||||
|
:set_permission_group("Mod")
|
||||||
|
:set_custom_color{ r = 0, g = 170, b = 0 }
|
||||||
|
:set_flag("is_admin")
|
||||||
|
:set_flag("is_system")
|
||||||
|
:set_flag("is_spectator")
|
||||||
|
:set_flag("report-immune")
|
||||||
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
:set_parent("Moderator")
|
:set_parent("Moderator")
|
||||||
:allow{
|
:allow{
|
||||||
"gui/warp-list/bypass-proximity",
|
"gui/warp-list/bypass-proximity",
|
||||||
"gui/warp-list/bypass-cooldown",
|
"gui/warp-list/bypass-cooldown",
|
||||||
"command/connect-all",
|
"command/connect-all"
|
||||||
}
|
}
|
||||||
|
|
||||||
Roles.new_role("Moderator", "Mod")
|
Roles.new_role("Moderator", "Mod")
|
||||||
:set_permission_group("Admin")
|
:set_permission_group("Mod")
|
||||||
:set_custom_color{ r = 0, g = 170, b = 0 }
|
:set_custom_color{ r = 0, g = 170, b = 0 }
|
||||||
:set_flag("is_admin")
|
:set_flag("is_admin")
|
||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_flag("report-immune")
|
:set_flag("report-immune")
|
||||||
:set_flag("instant-respawn")
|
:set_flag("instant-respawn")
|
||||||
:set_parent("Trainee")
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_parent("Trainee Moderator")
|
||||||
:allow{
|
:allow{
|
||||||
"command/assign-role",
|
|
||||||
"command/unassign-role",
|
|
||||||
"command/repair",
|
|
||||||
"command/kill/always",
|
|
||||||
"command/clear-tag/always",
|
|
||||||
"command/spawn/always",
|
|
||||||
"command/clear-reports",
|
|
||||||
"command/clear-warnings",
|
|
||||||
"command/clear-script-warnings",
|
|
||||||
"command/clear-last-warnings",
|
|
||||||
"command/clear-inventory",
|
|
||||||
"command/kill-enemies",
|
|
||||||
"command/remove-enemies",
|
|
||||||
"command/home",
|
|
||||||
"command/set-home",
|
|
||||||
"command/get-home",
|
|
||||||
"command/return",
|
|
||||||
"command/connect-player",
|
|
||||||
"command/set-bot-queue",
|
|
||||||
"command/set-game-speed",
|
|
||||||
"command/set-friendly-fire",
|
|
||||||
"command/set-always-day",
|
|
||||||
"command/set-pollution-enabled",
|
|
||||||
"command/clear-pollution",
|
|
||||||
"gui/rocket-info/toggle-active",
|
|
||||||
"gui/rocket-info/remote_launch",
|
|
||||||
"gui/bonus",
|
|
||||||
"fast-tree-decon",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Roles.new_role("Trainee", "TrMod")
|
Roles.new_role("Trainee Moderator", "Trainee")
|
||||||
:set_permission_group("Admin")
|
:set_permission_group("Mod")
|
||||||
:set_custom_color{ r = 0, g = 170, b = 0 }
|
:set_custom_color{ r = 0, g = 170, b = 0 }
|
||||||
:set_flag("is_admin")
|
:set_flag("is_admin")
|
||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_flag("report-immune")
|
:set_flag("report-immune")
|
||||||
:set_parent("Veteran")
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_parent("Board Member")
|
||||||
:allow{
|
:allow{
|
||||||
|
"command/assign-role",
|
||||||
|
"command/unassign-role",
|
||||||
"command/admin-chat",
|
"command/admin-chat",
|
||||||
"command/goto",
|
"command/protect-tag",
|
||||||
"command/teleport",
|
"command/teleport",
|
||||||
"command/bring",
|
"command/bring",
|
||||||
"command/create-warning",
|
"command/create-warning",
|
||||||
@@ -114,19 +106,30 @@ Roles.new_role("Trainee", "TrMod")
|
|||||||
"command/get-reports",
|
"command/get-reports",
|
||||||
"command/protect-entity",
|
"command/protect-entity",
|
||||||
"command/protect-area",
|
"command/protect-area",
|
||||||
"command/protect-tag",
|
|
||||||
"command/jail",
|
|
||||||
"command/unjail",
|
|
||||||
"command/kick",
|
"command/kick",
|
||||||
"command/ban",
|
"command/ban",
|
||||||
"command/spectate",
|
|
||||||
"command/follow",
|
|
||||||
"command/search",
|
"command/search",
|
||||||
"command/search-online",
|
"command/search-online",
|
||||||
"command/search-amount",
|
"command/search-amount",
|
||||||
"command/search-recent",
|
"command/search-recent",
|
||||||
"command/clear-blueprints-surface",
|
"command/clear-pollution",
|
||||||
"gui/playerdata",
|
"command/set-pollution-enabled",
|
||||||
|
"command/set-bot-queue",
|
||||||
|
"command/set-game-speed",
|
||||||
|
"command/kill-enemies",
|
||||||
|
"command/remove-enemies",
|
||||||
|
"command/set-friendly-fire",
|
||||||
|
"command/set-always-day",
|
||||||
|
"command/clear-reports",
|
||||||
|
"command/clear-warnings",
|
||||||
|
"command/clear-script-warnings",
|
||||||
|
"command/clear-last-warnings",
|
||||||
|
"command/clear-inventory",
|
||||||
|
"command/connect-player",
|
||||||
|
"command/kill/always",
|
||||||
|
-- "command/clear-tag/always",
|
||||||
|
"command/spawn/always",
|
||||||
|
"gui/playerdata"
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Trusted Roles
|
--- Trusted Roles
|
||||||
@@ -136,79 +139,95 @@ Roles.new_role("Board Member", "Board")
|
|||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_flag("report-immune")
|
:set_flag("report-immune")
|
||||||
:set_flag("instant-respawn")
|
:set_flag("instant-respawn")
|
||||||
:set_parent("Sponsor")
|
:set_flag("deconlog-bypass")
|
||||||
:allow{
|
|
||||||
"command/goto",
|
|
||||||
"command/repair",
|
|
||||||
"command/spectate",
|
|
||||||
"command/follow",
|
|
||||||
"gui/playerdata",
|
|
||||||
}
|
|
||||||
|
|
||||||
Roles.new_role("Senior Backer", "Backer")
|
|
||||||
:set_permission_group("Trusted")
|
|
||||||
:set_custom_color{ r = 238, g = 172, b = 44 }
|
|
||||||
:set_flag("is_spectator")
|
|
||||||
:set_flag("report-immune")
|
|
||||||
:set_flag("instant-respawn")
|
|
||||||
:set_parent("Sponsor")
|
|
||||||
:allow{
|
|
||||||
}
|
|
||||||
|
|
||||||
Roles.new_role("Sponsor", "Spon")
|
|
||||||
:set_permission_group("Trusted")
|
|
||||||
:set_custom_color{ r = 238, g = 172, b = 44 }
|
|
||||||
:set_flag("is_spectator")
|
|
||||||
:set_flag("report-immune")
|
|
||||||
:set_flag("instant-respawn")
|
|
||||||
:set_parent("Supporter")
|
:set_parent("Supporter")
|
||||||
:allow{
|
:allow{
|
||||||
"gui/rocket-info/toggle-active",
|
|
||||||
"gui/rocket-info/remote_launch",
|
|
||||||
"gui/bonus",
|
|
||||||
"command/home",
|
|
||||||
"command/set-home",
|
|
||||||
"command/get-home",
|
|
||||||
"command/return",
|
|
||||||
"fast-tree-decon",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Roles.new_role("Supporter", "Sup")
|
Roles.new_role("Supporter", "Sup")
|
||||||
:set_permission_group("Trusted")
|
:set_permission_group("Trusted")
|
||||||
:set_custom_color{ r = 230, g = 99, b = 34 }
|
:set_custom_color{ r = 230, g = 99, b = 34 }
|
||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_parent("Veteran")
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_parent("Partner")
|
||||||
:allow{
|
:allow{
|
||||||
"command/tag-color",
|
|
||||||
"command/jail",
|
|
||||||
"command/unjail",
|
|
||||||
"command/set-join-message",
|
|
||||||
"command/remove-join-message",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Roles.new_role("Partner", "Part")
|
Roles.new_role("Partner", "Part")
|
||||||
:set_permission_group("Trusted")
|
:set_permission_group("Trusted")
|
||||||
:set_custom_color{ r = 140, g = 120, b = 200 }
|
:set_custom_color{ r = 24, g = 172, b = 188 }
|
||||||
:set_flag("is_spectator")
|
:set_flag("is_spectator")
|
||||||
:set_parent("Veteran")
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_parent("Senior Member")
|
||||||
:allow{
|
:allow{
|
||||||
"command/jail",
|
|
||||||
"command/unjail",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local hours10, hours250 = 10 * 216000, 250 * 60
|
Roles.new_role("Senior Member", "SMem")
|
||||||
|
:set_permission_group("Trusted")
|
||||||
|
:set_custom_color{ r = 24, g = 172, b = 188 }
|
||||||
|
:set_flag("is_spectator")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_flag("instant-respawn")
|
||||||
|
:set_parent("Member")
|
||||||
|
:allow{
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Standard User Roles
|
||||||
|
Roles.new_role("Member", "Mem")
|
||||||
|
:set_permission_group("Trusted")
|
||||||
|
:set_custom_color{ r = 24, g = 172, b = 188 }
|
||||||
|
:set_flag("instant-respawn")
|
||||||
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_parent("Veteran")
|
||||||
|
:allow{
|
||||||
|
"command/set-join-message",
|
||||||
|
"command/remove-join-message",
|
||||||
|
"gui/vlayer-edit",
|
||||||
|
"gui/rocket-info/toggle-active",
|
||||||
|
"gui/rocket-info/remote_launch",
|
||||||
|
"gui/tool",
|
||||||
|
-- "command/tag-color",
|
||||||
|
"command/clear-blueprints",
|
||||||
|
--"command/bonus",
|
||||||
|
"gui/bonus",
|
||||||
|
"command/personal-logistic",
|
||||||
|
"command/home",
|
||||||
|
"command/set-home",
|
||||||
|
"command/get-home",
|
||||||
|
"command/return",
|
||||||
|
"command/goto",
|
||||||
|
"command/jail",
|
||||||
|
"command/unjail",
|
||||||
|
"command/spectate",
|
||||||
|
"command/follow",
|
||||||
|
"command/repair",
|
||||||
|
"fast-tree-decon"
|
||||||
|
}
|
||||||
|
|
||||||
|
local hours6, hours250 = 6 * 216000, 250 * 60
|
||||||
Roles.new_role("Veteran", "Vet")
|
Roles.new_role("Veteran", "Vet")
|
||||||
:set_permission_group("Trusted")
|
:set_permission_group("Trusted")
|
||||||
:set_custom_color{ r = 140, g = 120, b = 200 }
|
:set_custom_color{ r = 140, g = 120, b = 200 }
|
||||||
:set_parent("Member")
|
:set_flag("deconlog-bypass")
|
||||||
|
:set_parent("Regular")
|
||||||
:allow{
|
:allow{
|
||||||
|
"gui/surveillance",
|
||||||
|
"gui/warp-list/add",
|
||||||
|
"gui/warp-list/edit",
|
||||||
|
"command/chat-bot",
|
||||||
"command/chat-commands",
|
"command/chat-commands",
|
||||||
"command/clear-ground-items",
|
"command/clear-ground-items",
|
||||||
"command/clear-blueprints",
|
"command/clear-blueprints-radius",
|
||||||
"command/set-trains-to-automatic",
|
"command/set-trains-to-automatic",
|
||||||
|
"command/set-auto-research",
|
||||||
|
"command/lawnmower",
|
||||||
|
"command/waterfill",
|
||||||
|
"command/artillery"
|
||||||
}
|
}
|
||||||
:set_auto_assign_condition(function(player)
|
:set_auto_assign_condition(function(player)
|
||||||
if player.online_time >= hours10 then
|
if player.online_time >= hours6 then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
local stats = Statistics:get(player, {})
|
local stats = Statistics:get(player, {})
|
||||||
@@ -217,43 +236,25 @@ Roles.new_role("Veteran", "Vet")
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--- Standard User Roles
|
local hours1, hours15 = 1 * 216000, 15 * 60
|
||||||
Roles.new_role("Member", "Mem")
|
|
||||||
:set_permission_group("Standard")
|
|
||||||
:set_custom_color{ r = 24, g = 172, b = 188 }
|
|
||||||
:set_flag("deconlog-bypass")
|
|
||||||
:set_parent("Regular")
|
|
||||||
:allow{
|
|
||||||
"gui/task-list/add",
|
|
||||||
"gui/task-list/edit",
|
|
||||||
"gui/warp-list/add",
|
|
||||||
"gui/warp-list/edit",
|
|
||||||
"gui/surveillance",
|
|
||||||
"gui/vlayer-edit",
|
|
||||||
"gui/tool",
|
|
||||||
"command/save-quickbar",
|
|
||||||
"command/vlayer-info",
|
|
||||||
"command/lawnmower",
|
|
||||||
"command/waterfill",
|
|
||||||
"command/artillery",
|
|
||||||
}
|
|
||||||
|
|
||||||
local hours3, hours15 = 3 * 216000, 15 * 60
|
|
||||||
Roles.new_role("Regular", "Reg")
|
Roles.new_role("Regular", "Reg")
|
||||||
:set_permission_group("Standard")
|
:set_permission_group("Standard")
|
||||||
:set_custom_color{ r = 79, g = 155, b = 163 }
|
:set_custom_color{ r = 79, g = 155, b = 163 }
|
||||||
:set_parent("Guest")
|
:set_parent("Guest")
|
||||||
:allow{
|
:allow{
|
||||||
|
"gui/task-list/add",
|
||||||
|
"gui/task-list/edit",
|
||||||
"command/kill",
|
"command/kill",
|
||||||
"command/rainbow",
|
"command/rainbow",
|
||||||
"command/spawn",
|
"command/spawn",
|
||||||
"command/me",
|
"command/me",
|
||||||
|
"command/vlayer-info",
|
||||||
"standard-decon",
|
"standard-decon",
|
||||||
"bypass-entity-protection",
|
"bypass-entity-protection",
|
||||||
"bypass-nukeprotect",
|
"bypass-nukeprotect"
|
||||||
}
|
}
|
||||||
:set_auto_assign_condition(function(player)
|
:set_auto_assign_condition(function(player)
|
||||||
if player.online_time >= hours3 then
|
if player.online_time >= hours1 then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
local stats = Statistics:get(player, {})
|
local stats = Statistics:get(player, {})
|
||||||
@@ -267,8 +268,8 @@ local default = Roles.new_role("Guest", "")
|
|||||||
:set_permission_group("Guest")
|
:set_permission_group("Guest")
|
||||||
:set_custom_color{ r = 185, g = 187, b = 160 }
|
:set_custom_color{ r = 185, g = 187, b = 160 }
|
||||||
:allow{
|
:allow{
|
||||||
"command/tag",
|
-- "command/tag",
|
||||||
"command/tag-clear",
|
-- "command/tag-clear",
|
||||||
"command/commands",
|
"command/commands",
|
||||||
"command/get-roles",
|
"command/get-roles",
|
||||||
"command/locate",
|
"command/locate",
|
||||||
@@ -276,10 +277,11 @@ local default = Roles.new_role("Guest", "")
|
|||||||
"command/ratio",
|
"command/ratio",
|
||||||
"command/server-ups",
|
"command/server-ups",
|
||||||
"command/save-data",
|
"command/save-data",
|
||||||
|
"command/save-quickbar",
|
||||||
"command/data-preference",
|
"command/data-preference",
|
||||||
"command/connect",
|
"command/connect",
|
||||||
"gui/player-list",
|
"gui/player-list",
|
||||||
"gui/rocket-info",
|
--"gui/rocket-info",
|
||||||
"gui/science-info",
|
"gui/science-info",
|
||||||
"gui/task-list",
|
"gui/task-list",
|
||||||
"gui/warp-list",
|
"gui/warp-list",
|
||||||
@@ -307,57 +309,69 @@ Roles.define_role_order{
|
|||||||
"System", -- Best to keep root at top
|
"System", -- Best to keep root at top
|
||||||
"Senior Administrator",
|
"Senior Administrator",
|
||||||
"Administrator",
|
"Administrator",
|
||||||
|
"Senior Moderator",
|
||||||
"Moderator",
|
"Moderator",
|
||||||
"Trainee",
|
"Trainee Moderator",
|
||||||
"Board Member",
|
"Board Member",
|
||||||
"Senior Backer",
|
|
||||||
"Sponsor",
|
|
||||||
"Supporter",
|
"Supporter",
|
||||||
"Partner",
|
"Partner",
|
||||||
"Veteran",
|
"Senior Member",
|
||||||
"Member",
|
"Member",
|
||||||
|
"Veteran",
|
||||||
"Regular",
|
"Regular",
|
||||||
"Jail",
|
"Jail",
|
||||||
"Guest", -- Default must be last if you want to apply restrictions to other roles
|
"Guest" -- Default must be last if you want to apply restrictions to other roles
|
||||||
}
|
}
|
||||||
|
|
||||||
Roles.override_player_roles{
|
Roles.override_player_roles{
|
||||||
["PHIDIAS0303"] = { "Moderator", "Board Member", "Member" },
|
["PHIDIAS0303"] = { "Senior Administrator" },
|
||||||
["aldldl"] = { "Administrator", "Moderator", "Member" },
|
["7h3w1z4rd"] = { "Moderator" },
|
||||||
["arty714"] = { "Senior Administrator", "Moderator", "Member" },
|
["aldldl"] = { "Moderator" },
|
||||||
["Cooldude2606"] = { "Senior Administrator", "Moderator", "Member" },
|
["arty714"] = { "Moderator" },
|
||||||
["Drahc_pro"] = { "Administrator", "Moderator", "Member" },
|
["AssemblyStorm"] = { "Moderator" },
|
||||||
["mark9064"] = { "Administrator", "Moderator", "Member" },
|
["banakeg"] = { "Moderator" },
|
||||||
["7h3w1z4rd"] = { "Moderator", "Member" },
|
["connormkii"] = { "Moderator" },
|
||||||
["FlipHalfling90"] = { "Moderator", "Member" },
|
["cydes"] = { "Moderator" },
|
||||||
["hamsterbryan"] = { "Moderator", "Member" },
|
["Cooldude2606"] = { "Moderator" },
|
||||||
["HunterOfGames"] = { "Moderator", "Member" },
|
["darklich14"] = { "Moderator" },
|
||||||
["NextIdea"] = { "Moderator", "Member" },
|
["Drahc_pro"] = { "Moderator" },
|
||||||
["TheKernel32"] = { "Moderator", "Member" },
|
["facere"] = { "Moderator" },
|
||||||
["TheKernel64"] = { "Moderator", "Member" },
|
["freek18"] = { "Moderator" },
|
||||||
["tovernaar123"] = { "Moderator", "Member" },
|
["FlipHalfling90"] = { "Moderator" },
|
||||||
["UUBlueFire"] = { "Moderator", "Member" },
|
["Gizan"] = { "Moderator" },
|
||||||
["AssemblyStorm"] = { "Moderator", "Member" },
|
["hamsterbryan"] = { "Moderator" },
|
||||||
["banakeg"] = { "Moderator", "Member" },
|
["hidden_relic"] = { "Moderator" },
|
||||||
["connormkii"] = { "Moderator", "Member" },
|
["Hova"] = { "Moderator" },
|
||||||
["cydes"] = { "Moderator", "Member" },
|
["HunterOfGames"] = { "Moderator" },
|
||||||
["darklich14"] = { "Moderator", "Member" },
|
["LoicB"] = { "Moderator" },
|
||||||
["facere"] = { "Moderator", "Member" },
|
["M74132"] = { "Moderator" },
|
||||||
["freek18"] = { "Moderator", "Member" },
|
["MadKatz"] = { "Moderator" },
|
||||||
["Gizan"] = { "Moderator", "Member" },
|
["mafisch3"] = { "Moderator" },
|
||||||
["LoicB"] = { "Moderator", "Member" },
|
["maplesyrup01"] = { "Moderator" },
|
||||||
["M74132"] = { "Moderator", "Member" },
|
["mark9064"] = { "Moderator" },
|
||||||
["mafisch3"] = { "Moderator", "Member" },
|
["nallaj"] = { "Moderator" },
|
||||||
["maplesyrup01"] = { "Moderator", "Member" },
|
["NextIdea"] = { "Moderator" },
|
||||||
["ookl"] = { "Moderator", "Member" },
|
["oof2win2"] = { "Moderator" },
|
||||||
["Phoenix27833"] = { "Moderator", "Member" },
|
["ookl"] = { "Moderator" },
|
||||||
["porelos"] = { "Moderator", "Member" },
|
["Phoenix27833"] = { "Moderator" },
|
||||||
["Ruuyji"] = { "Moderator", "Member" },
|
["porelos"] = { "Moderator" },
|
||||||
["samy115"] = { "Moderator", "Member" },
|
["Ruuyji"] = { "Moderator" },
|
||||||
["SilentLog"] = { "Moderator", "Member" },
|
["samy115"] = { "Moderator" },
|
||||||
["Tcheko"] = { "Moderator", "Member" },
|
["SilentLog"] = { "Moderator" },
|
||||||
["thadius856"] = { "Moderator", "Member" },
|
["Tcheko"] = { "Moderator" },
|
||||||
["whoami32"] = { "Moderator", "Member" },
|
["thadius856"] = { "Moderator" },
|
||||||
["Windbomb"] = { "Moderator", "Member" },
|
["TheKernel32"] = { "Moderator" },
|
||||||
["XenoCyber"] = { "Moderator", "Member" },
|
["TheKernel64"] = { "Moderator" },
|
||||||
|
["tovernaar123"] = { "Moderator" },
|
||||||
|
["UUBlueFire"] = { "Moderator" },
|
||||||
|
["whoami32"] = { "Moderator" },
|
||||||
|
["Windbomb"] = { "Moderator" },
|
||||||
|
["Windsinger"] = { "Moderator" },
|
||||||
|
["XenoCyber"] = { "Moderator" },
|
||||||
|
["Athenaa"] = { "Trainee Moderator" },
|
||||||
|
["hihicome3"] = { "Trainee Moderator" },
|
||||||
|
["JamesJung"] = { "Trainee Moderator" },
|
||||||
|
["konohaScarlet_"] = { "Trainee Moderator" },
|
||||||
|
["majoro"] = { "Trainee Moderator" },
|
||||||
|
["rongli"] = { "Trainee Moderator" },
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,9 @@ local Jail = require("modules.exp_legacy.modules.control.jail") --- @dep modules
|
|||||||
local Colors = require("modules/exp_util/include/color")
|
local Colors = require("modules/exp_util/include/color")
|
||||||
local format_player_name = ExpUtil.format_player_name_locale
|
local format_player_name = ExpUtil.format_player_name_locale
|
||||||
|
|
||||||
--- Accessors injected by the gui so the actions can read the selected player and set the selected action
|
local SelectedPlayer, SelectedAction
|
||||||
local get_selected_player --- @type fun(player: LuaPlayer): LuaPlayer
|
local function set_datastores(player, action)
|
||||||
local set_selected_action --- @type fun(player: LuaPlayer, action: string?)
|
SelectedPlayer, SelectedAction = player, action
|
||||||
local function set_accessors(player_getter, action_setter)
|
|
||||||
get_selected_player, set_selected_action = player_getter, action_setter
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- auth that will only allow when on player's of lower roles
|
-- auth that will only allow when on player's of lower roles
|
||||||
@@ -31,10 +29,11 @@ local function auth_lower_role(player, selected_player_name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- gets the action player and a coloured name for the action to be used on
|
-- gets the action player and a coloured name for the action to be used on
|
||||||
local function get_action_player(player)
|
local function get_action_player_name(player)
|
||||||
local selected_player = get_selected_player(player) --[[@as LuaPlayer]]
|
local selected_player_name = SelectedPlayer:get(player)
|
||||||
|
local selected_player = game.players[selected_player_name]
|
||||||
local selected_player_color = format_player_name(selected_player)
|
local selected_player_color = format_player_name(selected_player)
|
||||||
return selected_player, selected_player_color
|
return selected_player_name, selected_player_color
|
||||||
end
|
end
|
||||||
|
|
||||||
-- teleports one player to another
|
-- teleports one player to another
|
||||||
@@ -64,11 +63,12 @@ end
|
|||||||
|
|
||||||
--- Teleports the user to the action player
|
--- Teleports the user to the action player
|
||||||
-- @element goto_player
|
-- @element goto_player
|
||||||
local goto_player = new_button("utility/export", { "exp-gui_player-list.goto-player" })
|
local goto_player = new_button("utility/export", { "player-list.goto-player" })
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
local selected_player = get_action_player(player)
|
local selected_player_name = get_action_player_name(player)
|
||||||
|
local selected_player = game.players[selected_player_name]
|
||||||
if not player.character or not selected_player.character then
|
if not player.character or not selected_player.character then
|
||||||
player.print({ "exp-commands-parse.player-alive" }, Colors.orange_red)
|
player.print({ "expcore-commands.reject-player-alive" }, Colors.orange_red)
|
||||||
else
|
else
|
||||||
teleport(player, selected_player)
|
teleport(player, selected_player)
|
||||||
end
|
end
|
||||||
@@ -76,11 +76,12 @@ local goto_player = new_button("utility/export", { "exp-gui_player-list.goto-pla
|
|||||||
|
|
||||||
--- Teleports the action player to the user
|
--- Teleports the action player to the user
|
||||||
-- @element bring_player
|
-- @element bring_player
|
||||||
local bring_player = new_button("utility/import", { "exp-gui_player-list.bring-player" })
|
local bring_player = new_button("utility/import", { "player-list.bring-player" })
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
local selected_player = get_action_player(player)
|
local selected_player_name = get_action_player_name(player)
|
||||||
|
local selected_player = game.players[selected_player_name]
|
||||||
if not player.character or not selected_player.character then
|
if not player.character or not selected_player.character then
|
||||||
player.print({ "exp-commands-parse.player-alive" }, Colors.orange_red)
|
player.print({ "expcore-commands.reject-player-alive" }, Colors.orange_red)
|
||||||
else
|
else
|
||||||
teleport(selected_player, player)
|
teleport(selected_player, player)
|
||||||
end
|
end
|
||||||
@@ -88,83 +89,83 @@ local bring_player = new_button("utility/import", { "exp-gui_player-list.bring-p
|
|||||||
|
|
||||||
--- Reports the action player, requires a reason to be given
|
--- Reports the action player, requires a reason to be given
|
||||||
-- @element report_player
|
-- @element report_player
|
||||||
local report_player = new_button("utility/spawn_flag", { "exp-gui_player-list.report-player" })
|
local report_player = new_button("utility/spawn_flag", { "player-list.report-player" })
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
local selected_player = get_action_player(player)
|
local selected_player_name = get_action_player_name(player)
|
||||||
if Reports.is_reported(selected_player.name, player.name) then
|
if Reports.is_reported(selected_player_name, player.name) then
|
||||||
player.print({ "exp-commands_report.already-reported" }, Colors.orange_red)
|
player.print({ "exp-commands_report.already-reported" }, Colors.orange_red)
|
||||||
else
|
else
|
||||||
set_selected_action(player, "command/report")
|
SelectedAction:set(player, "command/report")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function report_player_callback(player, reason)
|
local function report_player_callback(player, reason)
|
||||||
local selected_player, selected_player_color = get_action_player(player)
|
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||||
local by_player_name_color = format_player_name(player)
|
local by_player_name_color = format_player_name(player)
|
||||||
game.print{ "exp-commands_reports.response", selected_player_color, reason }
|
game.print{ "exp-commands_reports.response", selected_player_color, reason }
|
||||||
Roles.print_to_roles_higher("Trainee", { "exp-commands_reports.response-admin", selected_player_color, by_player_name_color, reason })
|
Roles.print_to_roles_higher("Trainee", { "exp-commands_reports.response-admin", selected_player_color, by_player_name_color, reason })
|
||||||
Reports.report_player(selected_player.name, player.name, reason)
|
Reports.report_player(selected_player_name, player.name, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gives the action player a warning, requires a reason
|
--- Gives the action player a warning, requires a reason
|
||||||
-- @element warn_player
|
-- @element warn_player
|
||||||
local warn_player = new_button("utility/spawn_flag", { "exp-gui_player-list.warn-player" })
|
local warn_player = new_button("utility/spawn_flag", { "player-list.warn-player" })
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
set_selected_action(player, "command/give-warning")
|
SelectedAction:set(player, "command/give-warning")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function warn_player_callback(player, reason)
|
local function warn_player_callback(player, reason)
|
||||||
local selected_player, selected_player_color = get_action_player(player)
|
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||||
local by_player_name_color = format_player_name(player)
|
local by_player_name_color = format_player_name(player)
|
||||||
game.print{ "exp-commands_warnings.create", selected_player_color, by_player_name_color, reason }
|
game.print{ "exp-commands_warnings.create", selected_player_color, by_player_name_color, reason }
|
||||||
Warnings.add_warning(selected_player.name, player.name, reason)
|
Warnings.add_warning(selected_player_name, player.name, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Jails the action player, requires a reason
|
--- Jails the action player, requires a reason
|
||||||
-- @element jail_player
|
-- @element jail_player
|
||||||
local jail_player = new_button("utility/multiplayer_waiting_icon", { "exp-gui_player-list.jail-player" })
|
local jail_player = new_button("utility/multiplayer_waiting_icon", { "player-list.jail-player" })
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
local selected_player, selected_player_color = get_action_player(player)
|
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||||
if Jail.is_jailed(selected_player.name) then
|
if Jail.is_jailed(selected_player_name) then
|
||||||
player.print({ "exp-commands_jail.already-jailed", selected_player_color }, Colors.orange_red)
|
player.print({ "exp-commands_jail.already-jailed", selected_player_color }, Colors.orange_red)
|
||||||
else
|
else
|
||||||
set_selected_action(player, "command/jail")
|
SelectedAction:set(player, "command/jail")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function jail_player_callback(player, reason)
|
local function jail_player_callback(player, reason)
|
||||||
local selected_player, selected_player_color = get_action_player(player)
|
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||||
local by_player_name_color = format_player_name(player)
|
local by_player_name_color = format_player_name(player)
|
||||||
game.print{ "exp-commands_jail.jailed", selected_player_color, by_player_name_color, reason }
|
game.print{ "exp-commands_jail.jailed", selected_player_color, by_player_name_color, reason }
|
||||||
Jail.jail_player(selected_player.name, player.name, reason)
|
Jail.jail_player(selected_player_name, player.name, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Kicks the action player, requires a reason
|
--- Kicks the action player, requires a reason
|
||||||
-- @element kick_player
|
-- @element kick_player
|
||||||
local kick_player = new_button("utility/warning_icon", { "exp-gui_player-list.kick-player" })
|
local kick_player = new_button("utility/warning_icon", { "player-list.kick-player" })
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
set_selected_action(player, "command/kick")
|
SelectedAction:set(player, "command/kick")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function kick_player_callback(player, reason)
|
local function kick_player_callback(player, reason)
|
||||||
local selected_player = get_action_player(player)
|
local selected_player = get_action_player_name(player)
|
||||||
game.kick_player(selected_player, reason)
|
game.kick_player(selected_player, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Bans the action player, requires a reason
|
--- Bans the action player, requires a reason
|
||||||
-- @element ban_player
|
-- @element ban_player
|
||||||
local ban_player = new_button("utility/danger_icon", { "exp-gui_player-list.ban-player" })
|
local ban_player = new_button("utility/danger_icon", { "player-list.ban-player" })
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
set_selected_action(player, "command/ban")
|
SelectedAction:set(player, "command/ban")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function ban_player_callback(player, reason)
|
local function ban_player_callback(player, reason)
|
||||||
local selected_player = get_action_player(player)
|
local selected_player = get_action_player_name(player)
|
||||||
game.ban_player(selected_player, reason)
|
game.ban_player(selected_player, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
set_accessors = set_accessors,
|
set_datastores = set_datastores,
|
||||||
buttons = {
|
buttons = {
|
||||||
["command/teleport"] = {
|
["command/teleport"] = {
|
||||||
auth = function(player, selected_player)
|
auth = function(player, selected_player)
|
||||||
|
|||||||
@@ -1,8 +1,2 @@
|
|||||||
return {
|
return {
|
||||||
Cooldude2606 = "Lua lets you set metatables on numbers, did you know that? Cooldude2606 knows this.",
|
|
||||||
samy115 = "Tremble in fear as the banhammer is now here, its owner: samy115",
|
|
||||||
XenoCyber = '"Fire Fire Fire" oops wrong game, have no fear XenoCyber is here',
|
|
||||||
HunterOfGames = "Unable to support HunterOfGames. You must construct additional miners.",
|
|
||||||
ookl = 'ookl says: "Pineapples are amazing, hello everyone!"',
|
|
||||||
arty714 = "Arty\'s Potato made it!",
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,4 @@
|
|||||||
return {
|
return {
|
||||||
fluid = true, --- @setting fluid When true, checks for for fluid pipes when removing miners
|
fluid = true, --- @setting fluid When true, checks for for fluid pipes when removing miners
|
||||||
chest = true, --- @setting chest When true, checks for for chest when removing miners
|
chest = true, --- @setting chest When true, checks for for chest when removing miners
|
||||||
beacon = true, --- @setting beacon When true, checks for for beacon when removing miners
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,13 +5,15 @@ return {
|
|||||||
repeat_lifetime = 3600 * 20, --- @setting repeat_lifetime The length of time, in ticks, that protected removals will be remembered for
|
repeat_lifetime = 3600 * 20, --- @setting repeat_lifetime The length of time, in ticks, that protected removals will be remembered for
|
||||||
refresh_rate = 3600 * 5, --- @setting refresh_rate How often the age of protected removals are checked against repeat_lifetime
|
refresh_rate = 3600 * 5, --- @setting refresh_rate How often the age of protected removals are checked against repeat_lifetime
|
||||||
always_protected_names = { --- @setting always_protected_names Names of entities which are always protected
|
always_protected_names = { --- @setting always_protected_names Names of entities which are always protected
|
||||||
|
|
||||||
},
|
},
|
||||||
always_protected_types = { --- @setting always_protected_types Types of entities which are always protected
|
always_protected_types = { --- @setting always_protected_types Types of entities which are always protected
|
||||||
"boiler", "generator", "offshore-pump", "reactor", "heat-exchanger", "heat-pipe", "fusion-reactor", "fusion-generator", "power-switch", "rocket-silo",
|
"boiler", "generator", "offshore-pump", "power-switch", "reactor", "rocket-silo",
|
||||||
},
|
},
|
||||||
always_trigger_repeat_names = { --- @setting always_trigger_repeat_names Names of entities which always trigger repeated removal protection
|
always_trigger_repeat_names = { --- @setting always_trigger_repeat_names Names of entities which always trigger repeated removal protection
|
||||||
|
|
||||||
},
|
},
|
||||||
always_trigger_repeat_types = { --- @setting always_trigger_repeat_types Types of entities which always trigger repeated removal protection
|
always_trigger_repeat_types = { --- @setting always_trigger_repeat_types Types of entities which always trigger repeated removal protection
|
||||||
"reactor", "fusion-reactor", "rocket-silo",
|
"reactor", "rocket-silo",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
-- @config Repair
|
-- @config Repair
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
disallow = { --- @setting disallow items in this list will never be repaired
|
||||||
|
["loader"] = true,
|
||||||
|
["fast-loader"] = true,
|
||||||
|
["express-loader"] = true,
|
||||||
|
["electric-energy-interface"] = true,
|
||||||
|
["infinity-chest"] = true,
|
||||||
|
},
|
||||||
|
max_range = 50, --- @setting max_range the max range that can be used with the repair command
|
||||||
allow_blueprint_repair = false, --- @setting allow_blueprint_repair when true will allow blueprints (things not destroyed by biters) to be build instantly using the repair command
|
allow_blueprint_repair = false, --- @setting allow_blueprint_repair when true will allow blueprints (things not destroyed by biters) to be build instantly using the repair command
|
||||||
allow_ghost_revive = true, --- @setting allow_ghost_revive when true will allow ghosts (things destroyed by biters) to be build instantly using the repair command
|
allow_ghost_revive = true, --- @setting allow_ghost_revive when true will allow ghosts (things destroyed by biters) to be build instantly using the repair command
|
||||||
allow_heal_entities = true, --- @setting allow_heal_entities when true will heal entities to full health that are within range
|
allow_heal_entities = true, --- @setting allow_heal_entities when true will heal entities to full health that are within range
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ return {
|
|||||||
-- this enable 20 more inventory for each mining productivity level up to 4
|
-- this enable 20 more inventory for each mining productivity level up to 4
|
||||||
bonus_inventory = {
|
bonus_inventory = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
log = {
|
||||||
|
["base"] = {
|
||||||
|
["name"] = "mining-productivity-4",
|
||||||
|
["level"] = 4
|
||||||
|
},
|
||||||
|
["space-age"] = {
|
||||||
|
["name"] = "mining-productivity-3",
|
||||||
|
["level"] = 3
|
||||||
|
},
|
||||||
|
},
|
||||||
res = {
|
res = {
|
||||||
-- Mining Productivity
|
-- Mining Productivity
|
||||||
["mining-productivity"] = true,
|
["mining-productivity"] = true,
|
||||||
@@ -23,19 +33,7 @@ return {
|
|||||||
rate = 5,
|
rate = 5,
|
||||||
limit = 20,
|
limit = 20,
|
||||||
},
|
},
|
||||||
file = {
|
file_name = "log/research.log",
|
||||||
name = "log/research.log",
|
|
||||||
final_res = {
|
|
||||||
["base"] = {
|
|
||||||
["name"] = "mining-productivity-4",
|
|
||||||
["level"] = 4
|
|
||||||
},
|
|
||||||
["space-age"] = {
|
|
||||||
["name"] = "mining-productivity-3",
|
|
||||||
["level"] = 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
milestone = {
|
milestone = {
|
||||||
["base"] = {
|
["base"] = {
|
||||||
["automation"] = 600,
|
["automation"] = 600,
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
return {
|
return {
|
||||||
spawn_area = { --- @setting spawn_area Settings relating to the whole spawn area
|
spawn_area = { --- @setting spawn_area Settings relating to the whole spawn area
|
||||||
-- Enable predefined patches: 128, else: 32
|
-- Enable predefined patches: 128, else: 32
|
||||||
deconstruction_radius = 20, -- @setting deconstruction_radius All entities within this radius will be removed
|
deconstruction_radius = 12, -- @setting deconstruction_radius All entities within this radius will be removed
|
||||||
tile_radius = 20,
|
deconstruction_tile = "refined-concrete", --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen
|
||||||
deconstruction_tile = "concrete", --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen
|
tile_radius = 14,
|
||||||
landfill_radius = 50, --- @setting pattern_radius All water within this radius will be land filled
|
landfill_radius = 16, --- @setting pattern_radius All water within this radius will be land filled
|
||||||
},
|
},
|
||||||
turrets = { --- @setting turrets Settings relating to adding turrets to spawn
|
turrets = { --- @setting turrets Settings relating to adding turrets to spawn
|
||||||
enabled = true, --- @setting enabled Whether turrets will be added to spawn
|
enabled = true, --- @setting enabled Whether turrets will be added to spawn
|
||||||
@@ -15,10 +15,10 @@ return {
|
|||||||
refill_time = 60 * 60 * 5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues
|
refill_time = 60 * 60 * 5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues
|
||||||
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to turrets
|
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to turrets
|
||||||
locations = { --- @setting locations The locations of all turrets, this list can change during runtime
|
locations = { --- @setting locations The locations of all turrets, this list can change during runtime
|
||||||
{ -3, -3 },
|
{ -2, -2 },
|
||||||
{ 3, -3 },
|
{ 2, -2 },
|
||||||
{ -3, 3 },
|
{ -2, 2 },
|
||||||
{ 3, 3 },
|
{ 2, 2 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
afk_belts = { --- @setting afk_belts Settings relating to adding afk belts to spawn
|
afk_belts = { --- @setting afk_belts Settings relating to adding afk belts to spawn
|
||||||
@@ -27,9 +27,11 @@ return {
|
|||||||
protected = true, --- @setting protected Whether belts will be protected from player interaction
|
protected = true, --- @setting protected Whether belts will be protected from player interaction
|
||||||
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to afk belts
|
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to afk belts
|
||||||
locations = { --- @setting locations The locations to spawn afk belts at, given as the top left position
|
locations = { --- @setting locations The locations to spawn afk belts at, given as the top left position
|
||||||
{ -5, -5 }, { 5, -5 },
|
{ 4, 4 },
|
||||||
{ -5, 5 }, { 5, 5 },
|
{ 4, -4 },
|
||||||
},
|
{ -4, 4 },
|
||||||
|
{ -4, -4 }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
water = { --- @setting water Settings relating to adding water to spawn
|
water = { --- @setting water Settings relating to adding water to spawn
|
||||||
enabled = true, --- @setting enabled Whether water tiles will be added to spawn
|
enabled = true, --- @setting enabled Whether water tiles will be added to spawn
|
||||||
@@ -37,147 +39,45 @@ return {
|
|||||||
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to water tiles
|
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to water tiles
|
||||||
locations = { --- @setting locations The location of the water tiles {x,y}
|
locations = { --- @setting locations The location of the water tiles {x,y}
|
||||||
-- Each is a 3x3 with the closest tile to 0,0 removed
|
-- Each is a 3x3 with the closest tile to 0,0 removed
|
||||||
{ 7, 8 }, { 7, 9 }, { 8, 7 }, { 8, 8 }, { 8, 9 }, { 9, 7 }, { 9, 8 }, { 9, 9 }, -- Bottom Right
|
{ 5, 6 }, { 5, 7 }, { 6, 5 }, { 6, 6 }, { 6, 7 }, { 7, 5 }, { 7, 6 }, { 7, 7 },
|
||||||
{ 7, -9 }, { 7, -10 }, { 8, -8 }, { 8, -9 }, { 8, -10 }, { 9, -8 }, { 9, -9 }, { 9, -10 }, -- Top Right
|
{ 5, -7 }, { 5, -8 }, { 6, -6 }, { 6, -7 }, { 6, -8 }, { 7, -6 }, { 7, -7 }, { 7, -8 },
|
||||||
{ -8, -9 }, { -8, -10 }, { -9, -8 }, { -9, -9 }, { -9, -10 }, { -10, -8 }, { -10, -9 }, { -10, -10 }, -- Top Left
|
{ -6, 6 }, { -6, 7 }, { -7, 5 }, { -7, 6 }, { -7, 7 }, { -8, 5 }, { -8, 6 }, { -8, 7 },
|
||||||
{ -8, 8 }, { -8, 9 }, { -9, 7 }, { -9, 8 }, { -9, 9 }, { -10, 7 }, { -10, 8 }, { -10, 9 }, -- Bottom Left
|
{ -6, -7 }, { -6, -8 }, { -7, -6 }, { -7, -7 }, { -7, -8 }, { -8, -6 }, { -8, -7 }, { -8, -8 },
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
entities = { --- @setting entities Settings relating to adding entities to spawn
|
entities = { --- @setting entities Settings relating to adding entities to spawn
|
||||||
enabled = true, --- @setting enabled Whether entities will be added to spawn
|
enabled = true, --- @setting enabled Whether entities will be added to spawn
|
||||||
protected = true, --- @setting protected Whether entities will be protected from player interaction
|
protected = true, --- @setting protected Whether entities will be protected from player interaction
|
||||||
operable = true, --- @setting operable Whether entities can be opened by players, must be true if chests are used
|
operable = true, --- @setting operable Whether entities can be opened by players, must be true if chests are used
|
||||||
offset = { x = 0, y = -2 }, --- @setting offset The position offset to apply to entities
|
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to entities
|
||||||
locations = { --- @setting locations The location and names of entities {name,x,y}
|
locations = { --- @setting locations The location and names of entities {name,x,y}
|
||||||
{ "stone-wall", -10, -5 }, { "stone-wall", -10, -4 }, { "stone-wall", -10, -3 }, { "stone-wall", -10, -2 }, { "stone-wall", -10, -1 }, { "stone-wall", -10, 0 }, { "stone-wall", -10, 3 }, { "stone-wall", -10, 4 }, { "stone-wall", -10, 5 },
|
{ "steel-chest", 1, 3 }, { "steel-chest", 1, 4 }, { "steel-chest", 1, 5 },
|
||||||
{ "stone-wall", -10, 6 }, { "stone-wall", -10, 7 }, { "stone-wall", -10, 8 }, { "small-lamp", -8, -4 }, { "small-lamp", -8, -1 }, { "iron-chest", -8, 0 }, { "iron-chest", -8, 3 }, { "small-lamp", -8, 4 },
|
{ "steel-chest", 3, 1 }, { "steel-chest", 4, 1 }, { "steel-chest", 5, 1 },
|
||||||
{ "small-lamp", -8, 7 }, { "stone-wall", -7, -8 }, { "small-electric-pole", -7, -2 }, { "iron-chest", -7, 0 }, { "iron-chest", -7, 3 }, { "small-electric-pole", -7, 5 }, { "stone-wall", -7, 11 }, { "stone-wall", -6, -8 }, { "small-lamp", -6, -6 },
|
{ "steel-chest", 1, -4 }, { "steel-chest", 1, -5 }, { "steel-chest", 1, -6 },
|
||||||
{ "iron-chest", -6, 0 }, { "iron-chest", -6, 3 }, { "small-lamp", -6, 9 }, { "stone-wall", -6, 11 }, { "stone-wall", -5, -8 }, { "small-lamp", -5, -1 }, { "iron-chest", -5, 0 }, { "iron-chest", -5, 3 }, { "small-lamp", -5, 4 }, { "stone-wall", -5, 11 },
|
{ "steel-chest", 3, -2 }, { "steel-chest", 4, -2 }, { "steel-chest", 5, -2 },
|
||||||
{ "stone-wall", -4, -8 }, { "small-electric-pole", -4, -5 }, { "iron-chest", -4, 0 }, { "iron-chest", -4, 3 }, { "small-electric-pole", -4, 8 }, { "stone-wall", -4, 11 }, { "stone-wall", -3, -8 }, { "small-lamp", -3, -6 }, { "small-lamp", -3, -3 }, { "small-lamp", -3, 6 },
|
{ "steel-chest", -2, 3 }, { "steel-chest", -2, 4 }, { "steel-chest", -2, 5 },
|
||||||
{ "small-lamp", -3, 9 }, { "stone-wall", -3, 11 }, { "stone-wall", -2, -8 }, { "iron-chest", -2, -6 }, { "iron-chest", -2, -5 }, { "iron-chest", -2, -4 }, { "iron-chest", -2, -3 }, { "iron-chest", -2, -2 }, { "iron-chest", -2, 5 }, { "iron-chest", -2, 6 },
|
{ "steel-chest", -4, 1 }, { "steel-chest", -5, 1 }, { "steel-chest", -6, 1 },
|
||||||
{ "iron-chest", -2, 7 }, { "iron-chest", -2, 8 }, { "iron-chest", -2, 9 }, { "stone-wall", -2, 11 }, { "stone-wall", 1, -8 }, { "iron-chest", 1, -6 },
|
{ "steel-chest", -2, -4 }, { "steel-chest", -2, -5 }, { "steel-chest", -2, -6 },
|
||||||
{ "iron-chest", 1, -5 }, { "iron-chest", 1, -4 }, { "iron-chest", 1, -3 }, { "iron-chest", 1, -2 }, { "iron-chest", 1, 5 }, { "iron-chest", 1, 6 }, { "iron-chest", 1, 7 }, { "iron-chest", 1, 8 }, { "iron-chest", 1, 9 }, { "stone-wall", 1, 11 },
|
{ "steel-chest", -4, -2 }, { "steel-chest", -5, -2 }, { "steel-chest", -6, -2 },
|
||||||
{ "stone-wall", 2, -8 }, { "small-lamp", 2, -6 }, { "small-lamp", 2, -3 }, { "small-lamp", 2, 6 }, { "small-lamp", 2, 9 }, { "stone-wall", 2, 11 }, { "stone-wall", 3, -8 }, { "small-electric-pole", 3, -5 }, { "iron-chest", 3, 0 }, { "iron-chest", 3, 3 },
|
{ "medium-electric-pole", 2, 3 }, { "medium-electric-pole", 2, -4 }, { "medium-electric-pole", -3, 3 }, { "medium-electric-pole", -3, -4 },
|
||||||
{ "small-electric-pole", 3, 8 }, { "stone-wall", 3, 11 }, { "stone-wall", 4, -8 }, { "small-lamp", 4, -1 }, { "iron-chest", 4, 0 }, { "iron-chest", 4, 3 }, { "small-lamp", 4, 4 }, { "stone-wall", 4, 11 }, { "stone-wall", 5, -8 }, { "small-lamp", 5, -6 },
|
{ "small-lamp", 2, 4 }, { "small-lamp", 2, -5 }, { "small-lamp", -3, 4 }, { "small-lamp", -3, -5 },
|
||||||
{ "iron-chest", 5, 0 }, { "iron-chest", 5, 3 }, { "small-lamp", 5, 9 }, { "stone-wall", 5, 11 }, { "stone-wall", 6, -8 }, { "small-electric-pole", 6, -2 }, { "iron-chest", 6, 0 }, { "iron-chest", 6, 3 }, { "small-electric-pole", 6, 5 }, { "stone-wall", 6, 11 },
|
{ "small-lamp", 4, 2 }, { "small-lamp", 4, -3 }, { "small-lamp", -5, 2 }, { "small-lamp", -5, -3 },
|
||||||
{ "small-lamp", 7, -4 }, { "small-lamp", 7, -1 }, { "iron-chest", 7, 0 }, { "iron-chest", 7, 3 }, { "small-lamp", 7, 4 }, { "small-lamp", 7, 7 }, { "stone-wall", 9, -5 },
|
{ "stone-wall", 1, 7 }, { "stone-wall", 2, 7 }, { "stone-wall", 3, 7 }, { "stone-wall", 4, 7 },
|
||||||
{ "stone-wall", 9, -4 }, { "stone-wall", 9, -3 }, { "stone-wall", 9, -2 }, { "stone-wall", 9, -1 }, { "stone-wall", 9, 0 }, { "stone-wall", 9, 3 }, { "stone-wall", 9, 4 }, { "stone-wall", 9, 5 }, { "stone-wall", 9, 6 }, { "stone-wall", 9, 7 },
|
{ "stone-wall", 7, 1 }, { "stone-wall", 7, 2 }, { "stone-wall", 7, 3 }, { "stone-wall", 7, 4 },
|
||||||
{ "stone-wall", 9, 8 },
|
{ "stone-wall", 1, -8 }, { "stone-wall", 2, -8 }, { "stone-wall", 3, -8 }, { "stone-wall", 4, -8 },
|
||||||
},
|
{ "stone-wall", 7, -2 }, { "stone-wall", 7, -3 }, { "stone-wall", 7, -4 }, { "stone-wall", 7, -5 },
|
||||||
|
{ "stone-wall", -2, 7 }, { "stone-wall", -3, 7 }, { "stone-wall", -4, 7 }, { "stone-wall", -5, 7 },
|
||||||
|
{ "stone-wall", -8, 1 }, { "stone-wall", -8, 2 }, { "stone-wall", -8, 3 }, { "stone-wall", -8, 4 },
|
||||||
|
{ "stone-wall", -2, -8 }, { "stone-wall", -3, -8 }, { "stone-wall", -4, -8 }, { "stone-wall", -5, -8 },
|
||||||
|
{ "stone-wall", -8, -2 }, { "stone-wall", -8, -3 }, { "stone-wall", -8, -4 }, { "stone-wall", -8, -5 },
|
||||||
|
}
|
||||||
},
|
},
|
||||||
pattern = {
|
pattern = {
|
||||||
enabled = true, --- @setting enabled Whether pattern tiles will be added to spawn
|
enabled = false, --- @setting enabled Whether pattern tiles will be added to spawn
|
||||||
pattern_tile = "stone-path", --- @setting pattern_tile The tile to be used for the pattern
|
pattern_tile = "refined-concrete", --- @setting pattern_tile The tile to be used for the pattern
|
||||||
offset = { x = 0, y = -2 }, --- @setting offset The position offset to apply to pattern tiles
|
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to pattern tiles
|
||||||
locations = { --- @setting locations The location of the pattern tiles {x,y}
|
locations = { --- @setting locations The location of the pattern tiles {x,y}
|
||||||
{ -49, -3 }, { -49, -2 }, { -49, 1 }, { -49, 2 }, { -49, 5 }, { -49, 6 }, { -48, -4 }, { -48, -3 }, { -48, -2 }, { -48, 1 }, { -48, 2 }, { -48, 5 }, { -48, 6 }, { -48, 7 }, { -47, -7 }, { -47, -6 }, { -47, -5 }, { -47, -4 }, { -47, -3 }, { -47, -2 }, { -47, 5 }, { -47, 6 }, { -47, 7 }, { -47, 8 }, { -47, 9 }, { -47, 10 }, { -46, -8 }, { -46, -7 }, { -46, -6 }, { -46, -5 },
|
}
|
||||||
{ -46, -4 }, { -46, -3 }, { -46, -2 }, { -46, -1 }, { -46, 4 }, { -46, 5 }, { -46, 6 }, { -46, 7 }, { -46, 8 }, { -46, 9 }, { -46, 10 }, { -46, 11 }, { -45, -17 }, { -45, -16 }, { -45, -15 }, { -45, -14 }, { -45, -13 }, { -45, -12 }, { -45, -9 }, { -45, -8 }, { -45, -7 }, { -45, -2 }, { -45, -1 }, { -45, 0 }, { -45, 1 }, { -45, 2 }, { -45, 3 }, { -45, 4 }, { -45, 5 }, { -45, 10 },
|
|
||||||
{ -45, 11 }, { -45, 12 }, { -45, 15 }, { -45, 16 }, { -45, 17 }, { -45, 18 }, { -45, 19 }, { -45, 20 }, { -44, -18 }, { -44, -17 }, { -44, -16 }, { -44, -15 }, { -44, -14 }, { -44, -13 }, { -44, -12 }, { -44, -9 }, { -44, -8 }, { -44, -1 }, { -44, 0 }, { -44, 1 }, { -44, 2 }, { -44, 3 }, { -44, 4 }, { -44, 11 }, { -44, 12 }, { -44, 15 }, { -44, 16 }, { -44, 17 }, { -44, 18 }, { -44, 19 },
|
|
||||||
{ -44, 20 }, { -44, 21 }, { -43, -19 }, { -43, -18 }, { -43, -17 }, { -43, -1 }, { -43, 0 }, { -43, 1 }, { -43, 2 }, { -43, 3 }, { -43, 4 }, { -43, 20 }, { -43, 21 }, { -43, 22 }, { -42, -19 }, { -42, -18 }, { -42, -1 }, { -42, 0 }, { -42, 1 }, { -42, 2 }, { -42, 3 }, { -42, 4 }, { -42, 21 }, { -42, 22 }, { -41, -25 }, { -41, -24 }, { -41, -19 }, { -41, -18 }, { -41, -13 }, { -41, -12 },
|
|
||||||
{ -41, -11 }, { -41, -10 }, { -41, -5 }, { -41, -4 }, { -41, 7 }, { -41, 8 }, { -41, 13 }, { -41, 14 }, { -41, 15 }, { -41, 16 }, { -41, 21 }, { -41, 22 }, { -41, 27 }, { -41, 28 }, { -40, -26 }, { -40, -25 }, { -40, -24 }, { -40, -20 }, { -40, -19 }, { -40, -18 }, { -40, -13 }, { -40, -12 }, { -40, -11 }, { -40, -10 }, { -40, -5 }, { -40, -4 }, { -40, 7 }, { -40, 8 }, { -40, 13 }, { -40, 14 },
|
|
||||||
{ -40, 15 }, { -40, 16 }, { -40, 21 }, { -40, 22 }, { -40, 23 }, { -40, 27 }, { -40, 28 }, { -40, 29 }, { -39, -27 }, { -39, -26 }, { -39, -25 }, { -39, -24 }, { -39, -21 }, { -39, -20 }, { -39, -19 }, { -39, -13 }, { -39, -12 }, { -39, -5 }, { -39, -4 }, { -39, -3 }, { -39, -2 }, { -39, -1 }, { -39, 0 }, { -39, 1 }, { -39, 2 }, { -39, 3 }, { -39, 4 }, { -39, 5 }, { -39, 6 }, { -39, 7 },
|
|
||||||
{ -39, 8 }, { -39, 15 }, { -39, 16 }, { -39, 22 }, { -39, 23 }, { -39, 24 }, { -39, 27 }, { -39, 28 }, { -39, 29 }, { -39, 30 }, { -38, -27 }, { -38, -26 }, { -38, -25 }, { -38, -24 }, { -38, -21 }, { -38, -20 }, { -38, -13 }, { -38, -12 }, { -38, -5 }, { -38, -4 }, { -38, -3 }, { -38, -2 }, { -38, -1 }, { -38, 0 }, { -38, 1 }, { -38, 2 }, { -38, 3 }, { -38, 4 }, { -38, 5 }, { -38, 6 },
|
|
||||||
{ -38, 7 }, { -38, 8 }, { -38, 15 }, { -38, 16 }, { -38, 23 }, { -38, 24 }, { -38, 27 }, { -38, 28 }, { -38, 29 }, { -38, 30 }, { -37, -17 }, { -37, -16 }, { -37, -13 }, { -37, -12 }, { -37, -11 }, { -37, -10 }, { -37, -4 }, { -37, -3 }, { -37, -2 }, { -37, -1 }, { -37, 0 }, { -37, 3 }, { -37, 4 }, { -37, 5 }, { -37, 6 }, { -37, 7 }, { -37, 13 }, { -37, 14 }, { -37, 15 }, { -37, 16 },
|
|
||||||
{ -37, 19 }, { -37, 20 }, { -36, -17 }, { -36, -16 }, { -36, -13 }, { -36, -12 }, { -36, -11 }, { -36, -10 }, { -36, -9 }, { -36, -3 }, { -36, -2 }, { -36, -1 }, { -36, 0 }, { -36, 3 }, { -36, 4 }, { -36, 5 }, { -36, 6 }, { -36, 12 }, { -36, 13 }, { -36, 14 }, { -36, 15 }, { -36, 16 }, { -36, 19 }, { -36, 20 }, { -35, -29 }, { -35, -28 }, { -35, -23 }, { -35, -22 }, { -35, -17 }, { -35, -16 },
|
|
||||||
{ -35, -12 }, { -35, -11 }, { -35, -10 }, { -35, -9 }, { -35, -8 }, { -35, 11 }, { -35, 12 }, { -35, 13 }, { -35, 14 }, { -35, 15 }, { -35, 19 }, { -35, 20 }, { -35, 25 }, { -35, 26 }, { -35, 31 }, { -35, 32 }, { -34, -30 }, { -34, -29 }, { -34, -28 }, { -34, -23 }, { -34, -22 }, { -34, -17 }, { -34, -16 }, { -34, -15 }, { -34, -11 }, { -34, -10 }, { -34, -9 }, { -34, -8 }, { -34, 11 }, { -34, 12 },
|
|
||||||
{ -34, 13 }, { -34, 14 }, { -34, 18 }, { -34, 19 }, { -34, 20 }, { -34, 25 }, { -34, 26 }, { -34, 31 }, { -34, 32 }, { -34, 33 }, { -33, -31 }, { -33, -30 }, { -33, -29 }, { -33, -28 }, { -33, -23 }, { -33, -22 }, { -33, -16 }, { -33, -15 }, { -33, -14 }, { -33, -5 }, { -33, -4 }, { -33, -1 }, { -33, 0 }, { -33, 3 }, { -33, 4 }, { -33, 7 }, { -33, 8 }, { -33, 17 }, { -33, 18 }, { -33, 19 },
|
|
||||||
{ -33, 25 }, { -33, 26 }, { -33, 31 }, { -33, 32 }, { -33, 33 }, { -33, 34 }, { -32, -32 }, { -32, -31 }, { -32, -30 }, { -32, -29 }, { -32, -28 }, { -32, -27 }, { -32, -23 }, { -32, -22 }, { -32, -21 }, { -32, -15 }, { -32, -14 }, { -32, -6 }, { -32, -5 }, { -32, -4 }, { -32, -1 }, { -32, 0 }, { -32, 3 }, { -32, 4 }, { -32, 7 }, { -32, 8 }, { -32, 9 }, { -32, 17 }, { -32, 18 }, { -32, 24 },
|
|
||||||
{ -32, 25 }, { -32, 26 }, { -32, 30 }, { -32, 31 }, { -32, 32 }, { -32, 33 }, { -32, 34 }, { -32, 35 }, { -31, -33 }, { -31, -32 }, { -31, -31 }, { -31, -30 }, { -31, -29 }, { -31, -28 }, { -31, -27 }, { -31, -26 }, { -31, -22 }, { -31, -21 }, { -31, -20 }, { -31, -19 }, { -31, -18 }, { -31, -11 }, { -31, -10 }, { -31, -9 }, { -31, -8 }, { -31, -7 }, { -31, -6 }, { -31, -5 }, { -31, -1 }, { -31, 0 },
|
|
||||||
{ -31, 1 }, { -31, 2 }, { -31, 3 }, { -31, 4 }, { -31, 8 }, { -31, 9 }, { -31, 10 }, { -31, 11 }, { -31, 12 }, { -31, 13 }, { -31, 14 }, { -31, 21 }, { -31, 22 }, { -31, 23 }, { -31, 24 }, { -31, 25 }, { -31, 29 }, { -31, 30 }, { -31, 31 }, { -31, 32 }, { -31, 33 }, { -31, 34 }, { -31, 35 }, { -31, 36 }, { -30, -33 }, { -30, -32 }, { -30, -31 }, { -30, -30 }, { -30, -29 }, { -30, -28 },
|
|
||||||
{ -30, -27 }, { -30, -26 }, { -30, -21 }, { -30, -20 }, { -30, -19 }, { -30, -18 }, { -30, -11 }, { -30, -10 }, { -30, -9 }, { -30, -8 }, { -30, -7 }, { -30, -6 }, { -30, -1 }, { -30, 0 }, { -30, 1 }, { -30, 2 }, { -30, 3 }, { -30, 4 }, { -30, 9 }, { -30, 10 }, { -30, 11 }, { -30, 12 }, { -30, 13 }, { -30, 14 }, { -30, 21 }, { -30, 22 }, { -30, 23 }, { -30, 24 }, { -30, 29 }, { -30, 30 },
|
|
||||||
{ -30, 31 }, { -30, 32 }, { -30, 33 }, { -30, 34 }, { -30, 35 }, { -30, 36 }, { -29, -37 }, { -29, -36 }, { -29, -30 }, { -29, -29 }, { -29, -28 }, { -29, -27 }, { -29, -26 }, { -29, -15 }, { -29, -14 }, { -29, -10 }, { -29, -9 }, { -29, -8 }, { -29, -7 }, { -29, 10 }, { -29, 11 }, { -29, 12 }, { -29, 13 }, { -29, 17 }, { -29, 18 }, { -29, 29 }, { -29, 30 }, { -29, 31 }, { -29, 32 }, { -29, 33 },
|
|
||||||
{ -29, 39 }, { -29, 40 }, { -28, -38 }, { -28, -37 }, { -28, -36 }, { -28, -29 }, { -28, -28 }, { -28, -27 }, { -28, -26 }, { -28, -16 }, { -28, -15 }, { -28, -14 }, { -28, -9 }, { -28, -8 }, { -28, 11 }, { -28, 12 }, { -28, 17 }, { -28, 18 }, { -28, 19 }, { -28, 29 }, { -28, 30 }, { -28, 31 }, { -28, 32 }, { -28, 39 }, { -28, 40 }, { -28, 41 }, { -27, -39 }, { -27, -38 }, { -27, -37 }, { -27, -36 },
|
|
||||||
{ -27, -23 }, { -27, -22 }, { -27, -19 }, { -27, -18 }, { -27, -17 }, { -27, -16 }, { -27, -15 }, { -27, -5 }, { -27, -4 }, { -27, -1 }, { -27, 0 }, { -27, 1 }, { -27, 2 }, { -27, 3 }, { -27, 4 }, { -27, 7 }, { -27, 8 }, { -27, 18 }, { -27, 19 }, { -27, 20 }, { -27, 21 }, { -27, 22 }, { -27, 25 }, { -27, 26 }, { -27, 39 }, { -27, 40 }, { -27, 41 }, { -27, 42 }, { -26, -39 }, { -26, -38 },
|
|
||||||
{ -26, -37 }, { -26, -36 }, { -26, -24 }, { -26, -23 }, { -26, -22 }, { -26, -19 }, { -26, -18 }, { -26, -17 }, { -26, -16 }, { -26, -6 }, { -26, -5 }, { -26, -4 }, { -26, -1 }, { -26, 0 }, { -26, 1 }, { -26, 2 }, { -26, 3 }, { -26, 4 }, { -26, 7 }, { -26, 8 }, { -26, 9 }, { -26, 19 }, { -26, 20 }, { -26, 21 }, { -26, 22 }, { -26, 25 }, { -26, 26 }, { -26, 27 }, { -26, 39 }, { -26, 40 },
|
|
||||||
{ -26, 41 }, { -26, 42 }, { -25, -33 }, { -25, -32 }, { -25, -31 }, { -25, -30 }, { -25, -25 }, { -25, -24 }, { -25, -23 }, { -25, -22 }, { -25, -19 }, { -25, -18 }, { -25, -17 }, { -25, -9 }, { -25, -8 }, { -25, -7 }, { -25, -6 }, { -25, -5 }, { -25, -4 }, { -25, -1 }, { -25, 0 }, { -25, 1 }, { -25, 2 }, { -25, 3 }, { -25, 4 }, { -25, 7 }, { -25, 8 }, { -25, 9 }, { -25, 10 }, { -25, 11 },
|
|
||||||
{ -25, 12 }, { -25, 20 }, { -25, 21 }, { -25, 22 }, { -25, 25 }, { -25, 26 }, { -25, 27 }, { -25, 28 }, { -25, 33 }, { -25, 34 }, { -25, 35 }, { -25, 36 }, { -24, -33 }, { -24, -32 }, { -24, -31 }, { -24, -30 }, { -24, -29 }, { -24, -25 }, { -24, -24 }, { -24, -23 }, { -24, -22 }, { -24, -19 }, { -24, -18 }, { -24, -9 }, { -24, -8 }, { -24, -7 }, { -24, -6 }, { -24, -5 }, { -24, -4 }, { -24, -1 },
|
|
||||||
{ -24, 0 }, { -24, 1 }, { -24, 2 }, { -24, 3 }, { -24, 4 }, { -24, 7 }, { -24, 8 }, { -24, 9 }, { -24, 10 }, { -24, 11 }, { -24, 12 }, { -24, 21 }, { -24, 22 }, { -24, 25 }, { -24, 26 }, { -24, 27 }, { -24, 28 }, { -24, 32 }, { -24, 33 }, { -24, 34 }, { -24, 35 }, { -24, 36 }, { -23, -37 }, { -23, -36 }, { -23, -30 }, { -23, -29 }, { -23, -28 }, { -23, -19 }, { -23, -18 }, { -23, -15 },
|
|
||||||
{ -23, -14 }, { -23, -9 }, { -23, -8 }, { -23, -7 }, { -23, -6 }, { -23, -5 }, { -23, 0 }, { -23, 1 }, { -23, 2 }, { -23, 3 }, { -23, 8 }, { -23, 9 }, { -23, 10 }, { -23, 11 }, { -23, 12 }, { -23, 17 }, { -23, 18 }, { -23, 21 }, { -23, 22 }, { -23, 31 }, { -23, 32 }, { -23, 33 }, { -23, 39 }, { -23, 40 }, { -22, -38 }, { -22, -37 }, { -22, -36 }, { -22, -29 }, { -22, -28 }, { -22, -19 },
|
|
||||||
{ -22, -18 }, { -22, -15 }, { -22, -14 }, { -22, -13 }, { -22, -9 }, { -22, -8 }, { -22, -7 }, { -22, -6 }, { -22, 1 }, { -22, 2 }, { -22, 9 }, { -22, 10 }, { -22, 11 }, { -22, 12 }, { -22, 16 }, { -22, 17 }, { -22, 18 }, { -22, 21 }, { -22, 22 }, { -22, 31 }, { -22, 32 }, { -22, 39 }, { -22, 40 }, { -22, 41 }, { -21, -41 }, { -21, -40 }, { -21, -39 }, { -21, -38 }, { -21, -37 }, { -21, -29 },
|
|
||||||
{ -21, -28 }, { -21, -25 }, { -21, -24 }, { -21, -23 }, { -21, -22 }, { -21, -21 }, { -21, -20 }, { -21, -19 }, { -21, -18 }, { -21, -15 }, { -21, -14 }, { -21, -13 }, { -21, -12 }, { -21, -3 }, { -21, -2 }, { -21, 5 }, { -21, 6 }, { -21, 15 }, { -21, 16 }, { -21, 17 }, { -21, 18 }, { -21, 21 }, { -21, 22 }, { -21, 23 }, { -21, 24 }, { -21, 25 }, { -21, 26 }, { -21, 27 }, { -21, 28 }, { -21, 31 },
|
|
||||||
{ -21, 32 }, { -21, 40 }, { -21, 41 }, { -21, 42 }, { -21, 43 }, { -21, 44 }, { -20, -42 }, { -20, -41 }, { -20, -40 }, { -20, -39 }, { -20, -38 }, { -20, -29 }, { -20, -28 }, { -20, -25 }, { -20, -24 }, { -20, -23 }, { -20, -22 }, { -20, -21 }, { -20, -20 }, { -20, -19 }, { -20, -18 }, { -20, -15 }, { -20, -14 }, { -20, -13 }, { -20, -12 }, { -20, -3 }, { -20, -2 }, { -20, -1 }, { -20, 4 }, { -20, 5 },
|
|
||||||
{ -20, 6 }, { -20, 15 }, { -20, 16 }, { -20, 17 }, { -20, 18 }, { -20, 21 }, { -20, 22 }, { -20, 23 }, { -20, 24 }, { -20, 25 }, { -20, 26 }, { -20, 27 }, { -20, 28 }, { -20, 31 }, { -20, 32 }, { -20, 41 }, { -20, 42 }, { -20, 43 }, { -20, 44 }, { -20, 45 }, { -19, -43 }, { -19, -42 }, { -19, -41 }, { -19, -35 }, { -19, -34 }, { -19, -33 }, { -19, -32 }, { -19, -25 }, { -19, -24 }, { -19, -23 },
|
|
||||||
{ -19, -15 }, { -19, -14 }, { -19, -13 }, { -19, -9 }, { -19, -8 }, { -19, -7 }, { -19, -6 }, { -19, -2 }, { -19, -1 }, { -19, 0 }, { -19, 1 }, { -19, 2 }, { -19, 3 }, { -19, 4 }, { -19, 5 }, { -19, 9 }, { -19, 10 }, { -19, 11 }, { -19, 12 }, { -19, 16 }, { -19, 17 }, { -19, 18 }, { -19, 26 }, { -19, 27 }, { -19, 28 }, { -19, 35 }, { -19, 36 }, { -19, 37 }, { -19, 38 }, { -19, 44 },
|
|
||||||
{ -19, 45 }, { -19, 46 }, { -18, -43 }, { -18, -42 }, { -18, -35 }, { -18, -34 }, { -18, -33 }, { -18, -32 }, { -18, -31 }, { -18, -26 }, { -18, -25 }, { -18, -24 }, { -18, -15 }, { -18, -14 }, { -18, -10 }, { -18, -9 }, { -18, -8 }, { -18, -7 }, { -18, -6 }, { -18, -1 }, { -18, 0 }, { -18, 1 }, { -18, 2 }, { -18, 3 }, { -18, 4 }, { -18, 9 }, { -18, 10 }, { -18, 11 }, { -18, 12 }, { -18, 13 },
|
|
||||||
{ -18, 17 }, { -18, 18 }, { -18, 27 }, { -18, 28 }, { -18, 29 }, { -18, 34 }, { -18, 35 }, { -18, 36 }, { -18, 37 }, { -18, 38 }, { -18, 45 }, { -18, 46 }, { -17, -43 }, { -17, -42 }, { -17, -32 }, { -17, -31 }, { -17, -30 }, { -17, -27 }, { -17, -26 }, { -17, -25 }, { -17, -21 }, { -17, -20 }, { -17, -19 }, { -17, -18 }, { -17, -17 }, { -17, -16 }, { -17, -15 }, { -17, -14 }, { -17, -11 }, { -17, -10 },
|
|
||||||
{ -17, -9 }, { -17, -8 }, { -17, -7 }, { -17, -6 }, { -17, 0 }, { -17, 1 }, { -17, 2 }, { -17, 3 }, { -17, 9 }, { -17, 10 }, { -17, 11 }, { -17, 12 }, { -17, 13 }, { -17, 14 }, { -17, 17 }, { -17, 18 }, { -17, 19 }, { -17, 20 }, { -17, 21 }, { -17, 22 }, { -17, 23 }, { -17, 24 }, { -17, 28 }, { -17, 29 }, { -17, 30 }, { -17, 33 }, { -17, 34 }, { -17, 35 }, { -17, 45 }, { -17, 46 },
|
|
||||||
{ -16, -43 }, { -16, -42 }, { -16, -31 }, { -16, -30 }, { -16, -27 }, { -16, -26 }, { -16, -21 }, { -16, -20 }, { -16, -19 }, { -16, -18 }, { -16, -17 }, { -16, -16 }, { -16, -15 }, { -16, -14 }, { -16, -11 }, { -16, -10 }, { -16, -9 }, { -16, -8 }, { -16, -7 }, { -16, -6 }, { -16, 1 }, { -16, 2 }, { -16, 9 }, { -16, 10 }, { -16, 11 }, { -16, 12 }, { -16, 13 }, { -16, 14 }, { -16, 17 }, { -16, 18 },
|
|
||||||
{ -16, 19 }, { -16, 20 }, { -16, 21 }, { -16, 22 }, { -16, 23 }, { -16, 24 }, { -16, 29 }, { -16, 30 }, { -16, 33 }, { -16, 34 }, { -16, 45 }, { -16, 46 }, { -15, -43 }, { -15, -42 }, { -15, -39 }, { -15, -38 }, { -15, -37 }, { -15, -36 }, { -15, -35 }, { -15, -34 }, { -15, -20 }, { -15, -19 }, { -15, -18 }, { -15, -17 }, { -15, -10 }, { -15, -9 }, { -15, -8 }, { -15, -7 }, { -15, -3 }, { -15, -2 },
|
|
||||||
{ -15, 1 }, { -15, 2 }, { -15, 5 }, { -15, 6 }, { -15, 10 }, { -15, 11 }, { -15, 12 }, { -15, 13 }, { -15, 20 }, { -15, 21 }, { -15, 22 }, { -15, 23 }, { -15, 37 }, { -15, 38 }, { -15, 39 }, { -15, 40 }, { -15, 41 }, { -15, 42 }, { -15, 45 }, { -15, 46 }, { -14, -43 }, { -14, -42 }, { -14, -39 }, { -14, -38 }, { -14, -37 }, { -14, -36 }, { -14, -35 }, { -14, -34 }, { -14, -33 }, { -14, -19 },
|
|
||||||
{ -14, -18 }, { -14, -9 }, { -14, -8 }, { -14, -4 }, { -14, -3 }, { -14, -2 }, { -14, 1 }, { -14, 2 }, { -14, 5 }, { -14, 6 }, { -14, 7 }, { -14, 11 }, { -14, 12 }, { -14, 21 }, { -14, 22 }, { -14, 36 }, { -14, 37 }, { -14, 38 }, { -14, 39 }, { -14, 40 }, { -14, 41 }, { -14, 42 }, { -14, 45 }, { -14, 46 }, { -13, -39 }, { -13, -38 }, { -13, -35 }, { -13, -34 }, { -13, -33 }, { -13, -32 },
|
|
||||||
{ -13, -29 }, { -13, -28 }, { -13, -15 }, { -13, -14 }, { -13, -5 }, { -13, -4 }, { -13, -3 }, { -13, -2 }, { -13, 5 }, { -13, 6 }, { -13, 7 }, { -13, 8 }, { -13, 17 }, { -13, 18 }, { -13, 31 }, { -13, 32 }, { -13, 35 }, { -13, 36 }, { -13, 37 }, { -13, 38 }, { -13, 41 }, { -13, 42 }, { -12, -39 }, { -12, -38 }, { -12, -35 }, { -12, -34 }, { -12, -33 }, { -12, -32 }, { -12, -29 }, { -12, -28 },
|
|
||||||
{ -12, -27 }, { -12, -16 }, { -12, -15 }, { -12, -14 }, { -12, -13 }, { -12, -5 }, { -12, -4 }, { -12, -3 }, { -12, -2 }, { -12, 5 }, { -12, 6 }, { -12, 7 }, { -12, 8 }, { -12, 16 }, { -12, 17 }, { -12, 18 }, { -12, 19 }, { -12, 30 }, { -12, 31 }, { -12, 32 }, { -12, 35 }, { -12, 36 }, { -12, 37 }, { -12, 38 }, { -12, 41 }, { -12, 42 }, { -11, -43 }, { -11, -42 }, { -11, -34 }, { -11, -33 },
|
|
||||||
{ -11, -32 }, { -11, -29 }, { -11, -28 }, { -11, -27 }, { -11, -26 }, { -11, -23 }, { -11, -22 }, { -11, -21 }, { -11, -20 }, { -11, -17 }, { -11, -16 }, { -11, -15 }, { -11, -14 }, { -11, -13 }, { -11, -12 }, { -11, -9 }, { -11, -8 }, { -11, 1 }, { -11, 2 }, { -11, 11 }, { -11, 12 }, { -11, 15 }, { -11, 16 }, { -11, 17 }, { -11, 18 }, { -11, 19 }, { -11, 20 }, { -11, 23 }, { -11, 24 }, { -11, 25 },
|
|
||||||
{ -11, 26 }, { -11, 29 }, { -11, 30 }, { -11, 31 }, { -11, 32 }, { -11, 35 }, { -11, 36 }, { -11, 37 }, { -11, 45 }, { -11, 46 }, { -10, -44 }, { -10, -43 }, { -10, -42 }, { -10, -33 }, { -10, -32 }, { -10, -29 }, { -10, -28 }, { -10, -27 }, { -10, -26 }, { -10, -23 }, { -10, -22 }, { -10, -21 }, { -10, -20 }, { -10, -17 }, { -10, -16 }, { -10, -15 }, { -10, -14 }, { -10, -13 }, { -10, -12 }, { -10, -9 },
|
|
||||||
{ -10, -8 }, { -10, -7 }, { -10, 0 }, { -10, 1 }, { -10, 2 }, { -10, 3 }, { -10, 10 }, { -10, 11 }, { -10, 12 }, { -10, 15 }, { -10, 16 }, { -10, 17 }, { -10, 18 }, { -10, 19 }, { -10, 20 }, { -10, 23 }, { -10, 24 }, { -10, 25 }, { -10, 26 }, { -10, 29 }, { -10, 30 }, { -10, 31 }, { -10, 32 }, { -10, 35 }, { -10, 36 }, { -10, 45 }, { -10, 46 }, { -10, 47 }, { -9, -45 }, { -9, -44 },
|
|
||||||
{ -9, -43 }, { -9, -29 }, { -9, -28 }, { -9, -27 }, { -9, -23 }, { -9, -22 }, { -9, -21 }, { -9, -20 }, { -9, -17 }, { -9, -16 }, { -9, -15 }, { -9, -14 }, { -9, -13 }, { -9, -8 }, { -9, -7 }, { -9, -6 }, { -9, -5 }, { -9, -1 }, { -9, 0 }, { -9, 1 }, { -9, 2 }, { -9, 3 }, { -9, 4 }, { -9, 8 }, { -9, 9 }, { -9, 10 }, { -9, 11 }, { -9, 16 }, { -9, 17 }, { -9, 18 },
|
|
||||||
{ -9, 19 }, { -9, 20 }, { -9, 23 }, { -9, 24 }, { -9, 25 }, { -9, 26 }, { -9, 30 }, { -9, 31 }, { -9, 32 }, { -9, 46 }, { -9, 47 }, { -9, 48 }, { -8, -45 }, { -8, -44 }, { -8, -30 }, { -8, -29 }, { -8, -28 }, { -8, -24 }, { -8, -23 }, { -8, -22 }, { -8, -21 }, { -8, -20 }, { -8, -17 }, { -8, -16 }, { -8, -15 }, { -8, -14 }, { -8, -7 }, { -8, -6 }, { -8, -5 }, { -8, -4 },
|
|
||||||
{ -8, -1 }, { -8, 0 }, { -8, 1 }, { -8, 2 }, { -8, 3 }, { -8, 4 }, { -8, 7 }, { -8, 8 }, { -8, 9 }, { -8, 10 }, { -8, 17 }, { -8, 18 }, { -8, 19 }, { -8, 20 }, { -8, 23 }, { -8, 24 }, { -8, 25 }, { -8, 26 }, { -8, 27 }, { -8, 31 }, { -8, 32 }, { -8, 33 }, { -8, 47 }, { -8, 48 }, { -7, -45 }, { -7, -44 }, { -7, -39 }, { -7, -38 }, { -7, -37 }, { -7, -36 },
|
|
||||||
{ -7, -31 }, { -7, -30 }, { -7, -29 }, { -7, -25 }, { -7, -24 }, { -7, -23 }, { -7, -22 }, { -7, -21 }, { -7, -11 }, { -7, -10 }, { -7, -7 }, { -7, -6 }, { -7, -5 }, { -7, -4 }, { -7, 7 }, { -7, 8 }, { -7, 9 }, { -7, 10 }, { -7, 13 }, { -7, 14 }, { -7, 24 }, { -7, 25 }, { -7, 26 }, { -7, 27 }, { -7, 28 }, { -7, 32 }, { -7, 33 }, { -7, 34 }, { -7, 39 }, { -7, 40 },
|
|
||||||
{ -7, 41 }, { -7, 42 }, { -7, 47 }, { -7, 48 }, { -6, -46 }, { -6, -45 }, { -6, -44 }, { -6, -39 }, { -6, -38 }, { -6, -37 }, { -6, -36 }, { -6, -35 }, { -6, -31 }, { -6, -30 }, { -6, -25 }, { -6, -24 }, { -6, -23 }, { -6, -22 }, { -6, -12 }, { -6, -11 }, { -6, -10 }, { -6, -6 }, { -6, -5 }, { -6, 8 }, { -6, 9 }, { -6, 13 }, { -6, 14 }, { -6, 15 }, { -6, 25 }, { -6, 26 },
|
|
||||||
{ -6, 27 }, { -6, 28 }, { -6, 33 }, { -6, 34 }, { -6, 38 }, { -6, 39 }, { -6, 40 }, { -6, 41 }, { -6, 42 }, { -6, 47 }, { -6, 48 }, { -6, 49 }, { -5, -47 }, { -5, -46 }, { -5, -45 }, { -5, -44 }, { -5, -37 }, { -5, -36 }, { -5, -35 }, { -5, -34 }, { -5, -19 }, { -5, -18 }, { -5, -13 }, { -5, -12 }, { -5, -11 }, { -5, -10 }, { -5, -1 }, { -5, 0 }, { -5, 1 }, { -5, 2 },
|
|
||||||
{ -5, 3 }, { -5, 4 }, { -5, 13 }, { -5, 14 }, { -5, 15 }, { -5, 16 }, { -5, 21 }, { -5, 22 }, { -5, 37 }, { -5, 38 }, { -5, 39 }, { -5, 40 }, { -5, 47 }, { -5, 48 }, { -5, 49 }, { -5, 50 }, { -4, -47 }, { -4, -46 }, { -4, -45 }, { -4, -44 }, { -4, -43 }, { -4, -37 }, { -4, -36 }, { -4, -35 }, { -4, -34 }, { -4, -19 }, { -4, -18 }, { -4, -17 }, { -4, -13 }, { -4, -12 },
|
|
||||||
{ -4, -11 }, { -4, -10 }, { -4, -2 }, { -4, -1 }, { -4, 0 }, { -4, 1 }, { -4, 2 }, { -4, 3 }, { -4, 4 }, { -4, 5 }, { -4, 13 }, { -4, 14 }, { -4, 15 }, { -4, 16 }, { -4, 20 }, { -4, 21 }, { -4, 22 }, { -4, 37 }, { -4, 38 }, { -4, 39 }, { -4, 40 }, { -4, 46 }, { -4, 47 }, { -4, 48 }, { -4, 49 }, { -4, 50 }, { -3, -44 }, { -3, -43 }, { -3, -42 }, { -3, -41 },
|
|
||||||
{ -3, -40 }, { -3, -37 }, { -3, -36 }, { -3, -35 }, { -3, -34 }, { -3, -31 }, { -3, -30 }, { -3, -29 }, { -3, -28 }, { -3, -25 }, { -3, -24 }, { -3, -23 }, { -3, -22 }, { -3, -18 }, { -3, -17 }, { -3, -16 }, { -3, -7 }, { -3, -6 }, { -3, -3 }, { -3, -2 }, { -3, -1 }, { -3, 0 }, { -3, 3 }, { -3, 4 }, { -3, 5 }, { -3, 6 }, { -3, 9 }, { -3, 10 }, { -3, 19 }, { -3, 20 },
|
|
||||||
{ -3, 21 }, { -3, 25 }, { -3, 26 }, { -3, 27 }, { -3, 28 }, { -3, 31 }, { -3, 32 }, { -3, 33 }, { -3, 34 }, { -3, 37 }, { -3, 38 }, { -3, 39 }, { -3, 40 }, { -3, 43 }, { -3, 44 }, { -3, 45 }, { -3, 46 }, { -3, 47 }, { -2, -43 }, { -2, -42 }, { -2, -41 }, { -2, -40 }, { -2, -37 }, { -2, -36 }, { -2, -35 }, { -2, -34 }, { -2, -31 }, { -2, -30 }, { -2, -29 }, { -2, -28 },
|
|
||||||
{ -2, -25 }, { -2, -24 }, { -2, -23 }, { -2, -22 }, { -2, -21 }, { -2, -17 }, { -2, -16 }, { -2, -15 }, { -2, -8 }, { -2, -7 }, { -2, -6 }, { -2, -3 }, { -2, -2 }, { -2, -1 }, { -2, 0 }, { -2, 3 }, { -2, 4 }, { -2, 5 }, { -2, 6 }, { -2, 9 }, { -2, 10 }, { -2, 11 }, { -2, 18 }, { -2, 19 }, { -2, 20 }, { -2, 24 }, { -2, 25 }, { -2, 26 }, { -2, 27 }, { -2, 28 },
|
|
||||||
{ -2, 31 }, { -2, 32 }, { -2, 33 }, { -2, 34 }, { -2, 37 }, { -2, 38 }, { -2, 39 }, { -2, 40 }, { -2, 43 }, { -2, 44 }, { -2, 45 }, { -2, 46 }, { -1, -47 }, { -1, -46 }, { -1, -43 }, { -1, -42 }, { -1, -41 }, { -1, -40 }, { -1, -37 }, { -1, -36 }, { -1, -29 }, { -1, -28 }, { -1, -25 }, { -1, -24 }, { -1, -23 }, { -1, -22 }, { -1, -21 }, { -1, -20 }, { -1, -17 }, { -1, -16 },
|
|
||||||
{ -1, -15 }, { -1, -14 }, { -1, -13 }, { -1, -12 }, { -1, -9 }, { -1, -8 }, { -1, -7 }, { -1, -6 }, { -1, -3 }, { -1, -2 }, { -1, 5 }, { -1, 6 }, { -1, 9 }, { -1, 10 }, { -1, 11 }, { -1, 12 }, { -1, 15 }, { -1, 16 }, { -1, 17 }, { -1, 18 }, { -1, 19 }, { -1, 20 }, { -1, 23 }, { -1, 24 }, { -1, 25 }, { -1, 26 }, { -1, 27 }, { -1, 28 }, { -1, 31 }, { -1, 32 },
|
|
||||||
{ -1, 39 }, { -1, 40 }, { -1, 43 }, { -1, 44 }, { -1, 45 }, { -1, 46 }, { -1, 49 }, { -1, 50 }, { 0, -47 }, { 0, -46 }, { 0, -43 }, { 0, -42 }, { 0, -41 }, { 0, -40 }, { 0, -37 }, { 0, -36 }, { 0, -29 }, { 0, -28 }, { 0, -25 }, { 0, -24 }, { 0, -23 }, { 0, -22 }, { 0, -21 }, { 0, -20 }, { 0, -17 }, { 0, -16 }, { 0, -15 }, { 0, -14 }, { 0, -13 }, { 0, -12 },
|
|
||||||
{ 0, -9 }, { 0, -8 }, { 0, -7 }, { 0, -6 }, { 0, -3 }, { 0, -2 }, { 0, 5 }, { 0, 6 }, { 0, 9 }, { 0, 10 }, { 0, 11 }, { 0, 12 }, { 0, 15 }, { 0, 16 }, { 0, 17 }, { 0, 18 }, { 0, 19 }, { 0, 20 }, { 0, 23 }, { 0, 24 }, { 0, 25 }, { 0, 26 }, { 0, 27 }, { 0, 28 }, { 0, 31 }, { 0, 32 }, { 0, 39 }, { 0, 40 }, { 0, 43 }, { 0, 44 },
|
|
||||||
{ 0, 45 }, { 0, 46 }, { 0, 49 }, { 0, 50 }, { 1, -43 }, { 1, -42 }, { 1, -41 }, { 1, -40 }, { 1, -37 }, { 1, -36 }, { 1, -35 }, { 1, -34 }, { 1, -31 }, { 1, -30 }, { 1, -29 }, { 1, -28 }, { 1, -25 }, { 1, -24 }, { 1, -23 }, { 1, -22 }, { 1, -21 }, { 1, -17 }, { 1, -16 }, { 1, -15 }, { 1, -8 }, { 1, -7 }, { 1, -6 }, { 1, -3 }, { 1, -2 }, { 1, -1 },
|
|
||||||
{ 1, 0 }, { 1, 3 }, { 1, 4 }, { 1, 5 }, { 1, 6 }, { 1, 9 }, { 1, 10 }, { 1, 11 }, { 1, 18 }, { 1, 19 }, { 1, 20 }, { 1, 24 }, { 1, 25 }, { 1, 26 }, { 1, 27 }, { 1, 28 }, { 1, 31 }, { 1, 32 }, { 1, 33 }, { 1, 34 }, { 1, 37 }, { 1, 38 }, { 1, 39 }, { 1, 40 }, { 1, 43 }, { 1, 44 }, { 1, 45 }, { 1, 46 }, { 2, -44 }, { 2, -43 },
|
|
||||||
{ 2, -42 }, { 2, -41 }, { 2, -40 }, { 2, -37 }, { 2, -36 }, { 2, -35 }, { 2, -34 }, { 2, -31 }, { 2, -30 }, { 2, -29 }, { 2, -28 }, { 2, -25 }, { 2, -24 }, { 2, -23 }, { 2, -22 }, { 2, -18 }, { 2, -17 }, { 2, -16 }, { 2, -7 }, { 2, -6 }, { 2, -3 }, { 2, -2 }, { 2, -1 }, { 2, 0 }, { 2, 3 }, { 2, 4 }, { 2, 5 }, { 2, 6 }, { 2, 9 }, { 2, 10 },
|
|
||||||
{ 2, 19 }, { 2, 20 }, { 2, 21 }, { 2, 25 }, { 2, 26 }, { 2, 27 }, { 2, 28 }, { 2, 31 }, { 2, 32 }, { 2, 33 }, { 2, 34 }, { 2, 37 }, { 2, 38 }, { 2, 39 }, { 2, 40 }, { 2, 43 }, { 2, 44 }, { 2, 45 }, { 2, 46 }, { 2, 47 }, { 3, -47 }, { 3, -46 }, { 3, -45 }, { 3, -44 }, { 3, -43 }, { 3, -37 }, { 3, -36 }, { 3, -35 }, { 3, -34 }, { 3, -19 },
|
|
||||||
{ 3, -18 }, { 3, -17 }, { 3, -13 }, { 3, -12 }, { 3, -11 }, { 3, -10 }, { 3, -2 }, { 3, -1 }, { 3, 0 }, { 3, 1 }, { 3, 2 }, { 3, 3 }, { 3, 4 }, { 3, 5 }, { 3, 13 }, { 3, 14 }, { 3, 15 }, { 3, 16 }, { 3, 20 }, { 3, 21 }, { 3, 22 }, { 3, 37 }, { 3, 38 }, { 3, 39 }, { 3, 40 }, { 3, 46 }, { 3, 47 }, { 3, 48 }, { 3, 49 }, { 3, 50 },
|
|
||||||
{ 4, -47 }, { 4, -46 }, { 4, -45 }, { 4, -44 }, { 4, -37 }, { 4, -36 }, { 4, -35 }, { 4, -34 }, { 4, -19 }, { 4, -18 }, { 4, -13 }, { 4, -12 }, { 4, -11 }, { 4, -10 }, { 4, -1 }, { 4, 0 }, { 4, 1 }, { 4, 2 }, { 4, 3 }, { 4, 4 }, { 4, 13 }, { 4, 14 }, { 4, 15 }, { 4, 16 }, { 4, 21 }, { 4, 22 }, { 4, 37 }, { 4, 38 }, { 4, 39 }, { 4, 40 },
|
|
||||||
{ 4, 47 }, { 4, 48 }, { 4, 49 }, { 4, 50 }, { 5, -46 }, { 5, -45 }, { 5, -44 }, { 5, -39 }, { 5, -38 }, { 5, -37 }, { 5, -36 }, { 5, -35 }, { 5, -31 }, { 5, -30 }, { 5, -25 }, { 5, -24 }, { 5, -23 }, { 5, -22 }, { 5, -12 }, { 5, -11 }, { 5, -10 }, { 5, -6 }, { 5, -5 }, { 5, 8 }, { 5, 9 }, { 5, 13 }, { 5, 14 }, { 5, 15 }, { 5, 25 }, { 5, 26 },
|
|
||||||
{ 5, 27 }, { 5, 28 }, { 5, 33 }, { 5, 34 }, { 5, 38 }, { 5, 39 }, { 5, 40 }, { 5, 41 }, { 5, 42 }, { 5, 47 }, { 5, 48 }, { 5, 49 }, { 6, -45 }, { 6, -44 }, { 6, -39 }, { 6, -38 }, { 6, -37 }, { 6, -36 }, { 6, -31 }, { 6, -30 }, { 6, -29 }, { 6, -25 }, { 6, -24 }, { 6, -23 }, { 6, -22 }, { 6, -21 }, { 6, -11 }, { 6, -10 }, { 6, -7 }, { 6, -6 },
|
|
||||||
{ 6, -5 }, { 6, -4 }, { 6, 7 }, { 6, 8 }, { 6, 9 }, { 6, 10 }, { 6, 13 }, { 6, 14 }, { 6, 24 }, { 6, 25 }, { 6, 26 }, { 6, 27 }, { 6, 28 }, { 6, 32 }, { 6, 33 }, { 6, 34 }, { 6, 39 }, { 6, 40 }, { 6, 41 }, { 6, 42 }, { 6, 47 }, { 6, 48 }, { 7, -45 }, { 7, -44 }, { 7, -30 }, { 7, -29 }, { 7, -28 }, { 7, -24 }, { 7, -23 }, { 7, -22 },
|
|
||||||
{ 7, -21 }, { 7, -20 }, { 7, -17 }, { 7, -16 }, { 7, -15 }, { 7, -14 }, { 7, -7 }, { 7, -6 }, { 7, -5 }, { 7, -4 }, { 7, -1 }, { 7, 0 }, { 7, 1 }, { 7, 2 }, { 7, 3 }, { 7, 4 }, { 7, 7 }, { 7, 8 }, { 7, 9 }, { 7, 10 }, { 7, 17 }, { 7, 18 }, { 7, 19 }, { 7, 20 }, { 7, 23 }, { 7, 24 }, { 7, 25 }, { 7, 26 }, { 7, 27 }, { 7, 31 },
|
|
||||||
{ 7, 32 }, { 7, 33 }, { 7, 47 }, { 7, 48 }, { 8, -45 }, { 8, -44 }, { 8, -43 }, { 8, -29 }, { 8, -28 }, { 8, -27 }, { 8, -23 }, { 8, -22 }, { 8, -21 }, { 8, -20 }, { 8, -17 }, { 8, -16 }, { 8, -15 }, { 8, -14 }, { 8, -13 }, { 8, -8 }, { 8, -7 }, { 8, -6 }, { 8, -5 }, { 8, -1 }, { 8, 0 }, { 8, 1 }, { 8, 2 }, { 8, 3 }, { 8, 4 }, { 8, 8 },
|
|
||||||
{ 8, 9 }, { 8, 10 }, { 8, 11 }, { 8, 16 }, { 8, 17 }, { 8, 18 }, { 8, 19 }, { 8, 20 }, { 8, 23 }, { 8, 24 }, { 8, 25 }, { 8, 26 }, { 8, 30 }, { 8, 31 }, { 8, 32 }, { 8, 46 }, { 8, 47 }, { 8, 48 }, { 9, -44 }, { 9, -43 }, { 9, -42 }, { 9, -33 }, { 9, -32 }, { 9, -29 }, { 9, -28 }, { 9, -27 }, { 9, -26 }, { 9, -23 }, { 9, -22 }, { 9, -21 },
|
|
||||||
{ 9, -20 }, { 9, -17 }, { 9, -16 }, { 9, -15 }, { 9, -14 }, { 9, -13 }, { 9, -12 }, { 9, -9 }, { 9, -8 }, { 9, -7 }, { 9, 0 }, { 9, 1 }, { 9, 2 }, { 9, 3 }, { 9, 10 }, { 9, 11 }, { 9, 12 }, { 9, 15 }, { 9, 16 }, { 9, 17 }, { 9, 18 }, { 9, 19 }, { 9, 20 }, { 9, 23 }, { 9, 24 }, { 9, 25 }, { 9, 26 }, { 9, 29 }, { 9, 30 }, { 9, 31 },
|
|
||||||
{ 9, 32 }, { 9, 35 }, { 9, 36 }, { 9, 45 }, { 9, 46 }, { 9, 47 }, { 10, -43 }, { 10, -42 }, { 10, -34 }, { 10, -33 }, { 10, -32 }, { 10, -29 }, { 10, -28 }, { 10, -27 }, { 10, -26 }, { 10, -23 }, { 10, -22 }, { 10, -21 }, { 10, -20 }, { 10, -17 }, { 10, -16 }, { 10, -15 }, { 10, -14 }, { 10, -13 }, { 10, -12 }, { 10, -9 }, { 10, -8 }, { 10, 1 }, { 10, 2 }, { 10, 11 },
|
|
||||||
{ 10, 12 }, { 10, 15 }, { 10, 16 }, { 10, 17 }, { 10, 18 }, { 10, 19 }, { 10, 20 }, { 10, 23 }, { 10, 24 }, { 10, 25 }, { 10, 26 }, { 10, 29 }, { 10, 30 }, { 10, 31 }, { 10, 32 }, { 10, 35 }, { 10, 36 }, { 10, 37 }, { 10, 45 }, { 10, 46 }, { 11, -39 }, { 11, -38 }, { 11, -35 }, { 11, -34 }, { 11, -33 }, { 11, -32 }, { 11, -29 }, { 11, -28 }, { 11, -27 }, { 11, -16 },
|
|
||||||
{ 11, -15 }, { 11, -14 }, { 11, -13 }, { 11, -5 }, { 11, -4 }, { 11, -3 }, { 11, -2 }, { 11, 5 }, { 11, 6 }, { 11, 7 }, { 11, 8 }, { 11, 16 }, { 11, 17 }, { 11, 18 }, { 11, 19 }, { 11, 30 }, { 11, 31 }, { 11, 32 }, { 11, 35 }, { 11, 36 }, { 11, 37 }, { 11, 38 }, { 11, 41 }, { 11, 42 }, { 12, -39 }, { 12, -38 }, { 12, -35 }, { 12, -34 }, { 12, -33 }, { 12, -32 },
|
|
||||||
{ 12, -29 }, { 12, -28 }, { 12, -15 }, { 12, -14 }, { 12, -5 }, { 12, -4 }, { 12, -3 }, { 12, -2 }, { 12, 5 }, { 12, 6 }, { 12, 7 }, { 12, 8 }, { 12, 17 }, { 12, 18 }, { 12, 31 }, { 12, 32 }, { 12, 35 }, { 12, 36 }, { 12, 37 }, { 12, 38 }, { 12, 41 }, { 12, 42 }, { 13, -43 }, { 13, -42 }, { 13, -39 }, { 13, -38 }, { 13, -37 }, { 13, -36 }, { 13, -35 }, { 13, -34 },
|
|
||||||
{ 13, -33 }, { 13, -19 }, { 13, -18 }, { 13, -9 }, { 13, -8 }, { 13, -4 }, { 13, -3 }, { 13, -2 }, { 13, 1 }, { 13, 2 }, { 13, 5 }, { 13, 6 }, { 13, 7 }, { 13, 11 }, { 13, 12 }, { 13, 21 }, { 13, 22 }, { 13, 36 }, { 13, 37 }, { 13, 38 }, { 13, 39 }, { 13, 40 }, { 13, 41 }, { 13, 42 }, { 13, 45 }, { 13, 46 }, { 14, -43 }, { 14, -42 }, { 14, -39 }, { 14, -38 },
|
|
||||||
{ 14, -37 }, { 14, -36 }, { 14, -35 }, { 14, -34 }, { 14, -20 }, { 14, -19 }, { 14, -18 }, { 14, -17 }, { 14, -10 }, { 14, -9 }, { 14, -8 }, { 14, -7 }, { 14, -3 }, { 14, -2 }, { 14, 1 }, { 14, 2 }, { 14, 5 }, { 14, 6 }, { 14, 10 }, { 14, 11 }, { 14, 12 }, { 14, 13 }, { 14, 20 }, { 14, 21 }, { 14, 22 }, { 14, 23 }, { 14, 37 }, { 14, 38 }, { 14, 39 }, { 14, 40 },
|
|
||||||
{ 14, 41 }, { 14, 42 }, { 14, 45 }, { 14, 46 }, { 15, -43 }, { 15, -42 }, { 15, -31 }, { 15, -30 }, { 15, -27 }, { 15, -26 }, { 15, -21 }, { 15, -20 }, { 15, -19 }, { 15, -18 }, { 15, -17 }, { 15, -16 }, { 15, -15 }, { 15, -14 }, { 15, -11 }, { 15, -10 }, { 15, -9 }, { 15, -8 }, { 15, -7 }, { 15, -6 }, { 15, 1 }, { 15, 2 }, { 15, 9 }, { 15, 10 }, { 15, 11 }, { 15, 12 },
|
|
||||||
{ 15, 13 }, { 15, 14 }, { 15, 17 }, { 15, 18 }, { 15, 19 }, { 15, 20 }, { 15, 21 }, { 15, 22 }, { 15, 23 }, { 15, 24 }, { 15, 29 }, { 15, 30 }, { 15, 33 }, { 15, 34 }, { 15, 45 }, { 15, 46 }, { 16, -43 }, { 16, -42 }, { 16, -32 }, { 16, -31 }, { 16, -30 }, { 16, -27 }, { 16, -26 }, { 16, -25 }, { 16, -21 }, { 16, -20 }, { 16, -19 }, { 16, -18 }, { 16, -17 }, { 16, -16 },
|
|
||||||
{ 16, -15 }, { 16, -14 }, { 16, -11 }, { 16, -10 }, { 16, -9 }, { 16, -8 }, { 16, -7 }, { 16, -6 }, { 16, 0 }, { 16, 1 }, { 16, 2 }, { 16, 3 }, { 16, 9 }, { 16, 10 }, { 16, 11 }, { 16, 12 }, { 16, 13 }, { 16, 14 }, { 16, 17 }, { 16, 18 }, { 16, 19 }, { 16, 20 }, { 16, 21 }, { 16, 22 }, { 16, 23 }, { 16, 24 }, { 16, 28 }, { 16, 29 }, { 16, 30 }, { 16, 33 },
|
|
||||||
{ 16, 34 }, { 16, 35 }, { 16, 45 }, { 16, 46 }, { 17, -43 }, { 17, -42 }, { 17, -35 }, { 17, -34 }, { 17, -33 }, { 17, -32 }, { 17, -31 }, { 17, -26 }, { 17, -25 }, { 17, -24 }, { 17, -15 }, { 17, -14 }, { 17, -10 }, { 17, -9 }, { 17, -8 }, { 17, -7 }, { 17, -6 }, { 17, -1 }, { 17, 0 }, { 17, 1 }, { 17, 2 }, { 17, 3 }, { 17, 4 }, { 17, 9 }, { 17, 10 }, { 17, 11 },
|
|
||||||
{ 17, 12 }, { 17, 13 }, { 17, 17 }, { 17, 18 }, { 17, 27 }, { 17, 28 }, { 17, 29 }, { 17, 34 }, { 17, 35 }, { 17, 36 }, { 17, 37 }, { 17, 38 }, { 17, 45 }, { 17, 46 }, { 18, -43 }, { 18, -42 }, { 18, -41 }, { 18, -35 }, { 18, -34 }, { 18, -33 }, { 18, -32 }, { 18, -25 }, { 18, -24 }, { 18, -23 }, { 18, -15 }, { 18, -14 }, { 18, -13 }, { 18, -9 }, { 18, -8 }, { 18, -7 },
|
|
||||||
{ 18, -6 }, { 18, -2 }, { 18, -1 }, { 18, 0 }, { 18, 1 }, { 18, 2 }, { 18, 3 }, { 18, 4 }, { 18, 5 }, { 18, 9 }, { 18, 10 }, { 18, 11 }, { 18, 12 }, { 18, 16 }, { 18, 17 }, { 18, 18 }, { 18, 26 }, { 18, 27 }, { 18, 28 }, { 18, 35 }, { 18, 36 }, { 18, 37 }, { 18, 38 }, { 18, 44 }, { 18, 45 }, { 18, 46 }, { 19, -42 }, { 19, -41 }, { 19, -40 }, { 19, -39 },
|
|
||||||
{ 19, -38 }, { 19, -29 }, { 19, -28 }, { 19, -25 }, { 19, -24 }, { 19, -23 }, { 19, -22 }, { 19, -21 }, { 19, -20 }, { 19, -19 }, { 19, -18 }, { 19, -15 }, { 19, -14 }, { 19, -13 }, { 19, -12 }, { 19, -3 }, { 19, -2 }, { 19, -1 }, { 19, 4 }, { 19, 5 }, { 19, 6 }, { 19, 15 }, { 19, 16 }, { 19, 17 }, { 19, 18 }, { 19, 21 }, { 19, 22 }, { 19, 23 }, { 19, 24 }, { 19, 25 },
|
|
||||||
{ 19, 26 }, { 19, 27 }, { 19, 28 }, { 19, 31 }, { 19, 32 }, { 19, 41 }, { 19, 42 }, { 19, 43 }, { 19, 44 }, { 19, 45 }, { 20, -41 }, { 20, -40 }, { 20, -39 }, { 20, -38 }, { 20, -37 }, { 20, -29 }, { 20, -28 }, { 20, -25 }, { 20, -24 }, { 20, -23 }, { 20, -22 }, { 20, -21 }, { 20, -20 }, { 20, -19 }, { 20, -18 }, { 20, -15 }, { 20, -14 }, { 20, -13 }, { 20, -12 }, { 20, -3 },
|
|
||||||
{ 20, -2 }, { 20, 5 }, { 20, 6 }, { 20, 15 }, { 20, 16 }, { 20, 17 }, { 20, 18 }, { 20, 21 }, { 20, 22 }, { 20, 23 }, { 20, 24 }, { 20, 25 }, { 20, 26 }, { 20, 27 }, { 20, 28 }, { 20, 31 }, { 20, 32 }, { 20, 40 }, { 20, 41 }, { 20, 42 }, { 20, 43 }, { 20, 44 }, { 21, -38 }, { 21, -37 }, { 21, -36 }, { 21, -29 }, { 21, -28 }, { 21, -19 }, { 21, -18 }, { 21, -15 },
|
|
||||||
{ 21, -14 }, { 21, -13 }, { 21, -9 }, { 21, -8 }, { 21, -7 }, { 21, -6 }, { 21, 1 }, { 21, 2 }, { 21, 9 }, { 21, 10 }, { 21, 11 }, { 21, 12 }, { 21, 16 }, { 21, 17 }, { 21, 18 }, { 21, 21 }, { 21, 22 }, { 21, 31 }, { 21, 32 }, { 21, 39 }, { 21, 40 }, { 21, 41 }, { 22, -37 }, { 22, -36 }, { 22, -30 }, { 22, -29 }, { 22, -28 }, { 22, -19 }, { 22, -18 }, { 22, -15 },
|
|
||||||
{ 22, -14 }, { 22, -9 }, { 22, -8 }, { 22, -7 }, { 22, -6 }, { 22, -5 }, { 22, 0 }, { 22, 1 }, { 22, 2 }, { 22, 3 }, { 22, 8 }, { 22, 9 }, { 22, 10 }, { 22, 11 }, { 22, 12 }, { 22, 17 }, { 22, 18 }, { 22, 21 }, { 22, 22 }, { 22, 31 }, { 22, 32 }, { 22, 33 }, { 22, 39 }, { 22, 40 }, { 23, -33 }, { 23, -32 }, { 23, -31 }, { 23, -30 }, { 23, -29 }, { 23, -25 },
|
|
||||||
{ 23, -24 }, { 23, -23 }, { 23, -22 }, { 23, -19 }, { 23, -18 }, { 23, -9 }, { 23, -8 }, { 23, -7 }, { 23, -6 }, { 23, -5 }, { 23, -4 }, { 23, -1 }, { 23, 0 }, { 23, 1 }, { 23, 2 }, { 23, 3 }, { 23, 4 }, { 23, 7 }, { 23, 8 }, { 23, 9 }, { 23, 10 }, { 23, 11 }, { 23, 12 }, { 23, 21 }, { 23, 22 }, { 23, 25 }, { 23, 26 }, { 23, 27 }, { 23, 28 }, { 23, 32 },
|
|
||||||
{ 23, 33 }, { 23, 34 }, { 23, 35 }, { 23, 36 }, { 24, -33 }, { 24, -32 }, { 24, -31 }, { 24, -30 }, { 24, -25 }, { 24, -24 }, { 24, -23 }, { 24, -22 }, { 24, -19 }, { 24, -18 }, { 24, -17 }, { 24, -9 }, { 24, -8 }, { 24, -7 }, { 24, -6 }, { 24, -5 }, { 24, -4 }, { 24, -1 }, { 24, 0 }, { 24, 1 }, { 24, 2 }, { 24, 3 }, { 24, 4 }, { 24, 7 }, { 24, 8 }, { 24, 9 },
|
|
||||||
{ 24, 10 }, { 24, 11 }, { 24, 12 }, { 24, 20 }, { 24, 21 }, { 24, 22 }, { 24, 25 }, { 24, 26 }, { 24, 27 }, { 24, 28 }, { 24, 33 }, { 24, 34 }, { 24, 35 }, { 24, 36 }, { 25, -39 }, { 25, -38 }, { 25, -37 }, { 25, -36 }, { 25, -24 }, { 25, -23 }, { 25, -22 }, { 25, -19 }, { 25, -18 }, { 25, -17 }, { 25, -16 }, { 25, -6 }, { 25, -5 }, { 25, -4 }, { 25, -1 }, { 25, 0 },
|
|
||||||
{ 25, 1 }, { 25, 2 }, { 25, 3 }, { 25, 4 }, { 25, 7 }, { 25, 8 }, { 25, 9 }, { 25, 19 }, { 25, 20 }, { 25, 21 }, { 25, 22 }, { 25, 25 }, { 25, 26 }, { 25, 27 }, { 25, 39 }, { 25, 40 }, { 25, 41 }, { 25, 42 }, { 26, -39 }, { 26, -38 }, { 26, -37 }, { 26, -36 }, { 26, -23 }, { 26, -22 }, { 26, -19 }, { 26, -18 }, { 26, -17 }, { 26, -16 }, { 26, -15 }, { 26, -5 },
|
|
||||||
{ 26, -4 }, { 26, -1 }, { 26, 0 }, { 26, 1 }, { 26, 2 }, { 26, 3 }, { 26, 4 }, { 26, 7 }, { 26, 8 }, { 26, 18 }, { 26, 19 }, { 26, 20 }, { 26, 21 }, { 26, 22 }, { 26, 25 }, { 26, 26 }, { 26, 39 }, { 26, 40 }, { 26, 41 }, { 26, 42 }, { 27, -38 }, { 27, -37 }, { 27, -36 }, { 27, -29 }, { 27, -28 }, { 27, -27 }, { 27, -26 }, { 27, -16 }, { 27, -15 }, { 27, -14 },
|
|
||||||
{ 27, -9 }, { 27, -8 }, { 27, 11 }, { 27, 12 }, { 27, 17 }, { 27, 18 }, { 27, 19 }, { 27, 29 }, { 27, 30 }, { 27, 31 }, { 27, 32 }, { 27, 39 }, { 27, 40 }, { 27, 41 }, { 28, -37 }, { 28, -36 }, { 28, -30 }, { 28, -29 }, { 28, -28 }, { 28, -27 }, { 28, -26 }, { 28, -15 }, { 28, -14 }, { 28, -10 }, { 28, -9 }, { 28, -8 }, { 28, -7 }, { 28, 10 }, { 28, 11 }, { 28, 12 },
|
|
||||||
{ 28, 13 }, { 28, 17 }, { 28, 18 }, { 28, 29 }, { 28, 30 }, { 28, 31 }, { 28, 32 }, { 28, 33 }, { 28, 39 }, { 28, 40 }, { 29, -33 }, { 29, -32 }, { 29, -31 }, { 29, -30 }, { 29, -29 }, { 29, -28 }, { 29, -27 }, { 29, -26 }, { 29, -21 }, { 29, -20 }, { 29, -19 }, { 29, -18 }, { 29, -11 }, { 29, -10 }, { 29, -9 }, { 29, -8 }, { 29, -7 }, { 29, -6 }, { 29, -1 }, { 29, 0 },
|
|
||||||
{ 29, 1 }, { 29, 2 }, { 29, 3 }, { 29, 4 }, { 29, 9 }, { 29, 10 }, { 29, 11 }, { 29, 12 }, { 29, 13 }, { 29, 14 }, { 29, 21 }, { 29, 22 }, { 29, 23 }, { 29, 24 }, { 29, 29 }, { 29, 30 }, { 29, 31 }, { 29, 32 }, { 29, 33 }, { 29, 34 }, { 29, 35 }, { 29, 36 }, { 30, -33 }, { 30, -32 }, { 30, -31 }, { 30, -30 }, { 30, -29 }, { 30, -28 }, { 30, -27 }, { 30, -26 },
|
|
||||||
{ 30, -22 }, { 30, -21 }, { 30, -20 }, { 30, -19 }, { 30, -18 }, { 30, -11 }, { 30, -10 }, { 30, -9 }, { 30, -8 }, { 30, -7 }, { 30, -6 }, { 30, -5 }, { 30, -1 }, { 30, 0 }, { 30, 1 }, { 30, 2 }, { 30, 3 }, { 30, 4 }, { 30, 8 }, { 30, 9 }, { 30, 10 }, { 30, 11 }, { 30, 12 }, { 30, 13 }, { 30, 14 }, { 30, 21 }, { 30, 22 }, { 30, 23 }, { 30, 24 }, { 30, 25 },
|
|
||||||
{ 30, 29 }, { 30, 30 }, { 30, 31 }, { 30, 32 }, { 30, 33 }, { 30, 34 }, { 30, 35 }, { 30, 36 }, { 31, -32 }, { 31, -31 }, { 31, -30 }, { 31, -29 }, { 31, -28 }, { 31, -27 }, { 31, -23 }, { 31, -22 }, { 31, -21 }, { 31, -15 }, { 31, -14 }, { 31, -6 }, { 31, -5 }, { 31, -4 }, { 31, -1 }, { 31, 0 }, { 31, 3 }, { 31, 4 }, { 31, 7 }, { 31, 8 }, { 31, 9 }, { 31, 17 },
|
|
||||||
{ 31, 18 }, { 31, 24 }, { 31, 25 }, { 31, 26 }, { 31, 30 }, { 31, 31 }, { 31, 32 }, { 31, 33 }, { 31, 34 }, { 31, 35 }, { 32, -31 }, { 32, -30 }, { 32, -29 }, { 32, -28 }, { 32, -23 }, { 32, -22 }, { 32, -16 }, { 32, -15 }, { 32, -14 }, { 32, -5 }, { 32, -4 }, { 32, -1 }, { 32, 0 }, { 32, 3 }, { 32, 4 }, { 32, 7 }, { 32, 8 }, { 32, 17 }, { 32, 18 }, { 32, 19 },
|
|
||||||
{ 32, 25 }, { 32, 26 }, { 32, 31 }, { 32, 32 }, { 32, 33 }, { 32, 34 }, { 33, -30 }, { 33, -29 }, { 33, -28 }, { 33, -23 }, { 33, -22 }, { 33, -17 }, { 33, -16 }, { 33, -15 }, { 33, -11 }, { 33, -10 }, { 33, -9 }, { 33, -8 }, { 33, 11 }, { 33, 12 }, { 33, 13 }, { 33, 14 }, { 33, 18 }, { 33, 19 }, { 33, 20 }, { 33, 25 }, { 33, 26 }, { 33, 31 }, { 33, 32 }, { 33, 33 },
|
|
||||||
{ 34, -29 }, { 34, -28 }, { 34, -23 }, { 34, -22 }, { 34, -17 }, { 34, -16 }, { 34, -12 }, { 34, -11 }, { 34, -10 }, { 34, -9 }, { 34, -8 }, { 34, 11 }, { 34, 12 }, { 34, 13 }, { 34, 14 }, { 34, 15 }, { 34, 19 }, { 34, 20 }, { 34, 25 }, { 34, 26 }, { 34, 31 }, { 34, 32 }, { 35, -17 }, { 35, -16 }, { 35, -13 }, { 35, -12 }, { 35, -11 }, { 35, -10 }, { 35, -9 }, { 35, -3 },
|
|
||||||
{ 35, -2 }, { 35, -1 }, { 35, 0 }, { 35, 3 }, { 35, 4 }, { 35, 5 }, { 35, 6 }, { 35, 12 }, { 35, 13 }, { 35, 14 }, { 35, 15 }, { 35, 16 }, { 35, 19 }, { 35, 20 }, { 36, -17 }, { 36, -16 }, { 36, -13 }, { 36, -12 }, { 36, -11 }, { 36, -10 }, { 36, -4 }, { 36, -3 }, { 36, -2 }, { 36, -1 }, { 36, 0 }, { 36, 3 }, { 36, 4 }, { 36, 5 }, { 36, 6 }, { 36, 7 },
|
|
||||||
{ 36, 13 }, { 36, 14 }, { 36, 15 }, { 36, 16 }, { 36, 19 }, { 36, 20 }, { 37, -27 }, { 37, -26 }, { 37, -25 }, { 37, -24 }, { 37, -21 }, { 37, -20 }, { 37, -13 }, { 37, -12 }, { 37, -5 }, { 37, -4 }, { 37, -3 }, { 37, -2 }, { 37, -1 }, { 37, 0 }, { 37, 1 }, { 37, 2 }, { 37, 3 }, { 37, 4 }, { 37, 5 }, { 37, 6 }, { 37, 7 }, { 37, 8 }, { 37, 15 }, { 37, 16 },
|
|
||||||
{ 37, 23 }, { 37, 24 }, { 37, 27 }, { 37, 28 }, { 37, 29 }, { 37, 30 }, { 38, -27 }, { 38, -26 }, { 38, -25 }, { 38, -24 }, { 38, -21 }, { 38, -20 }, { 38, -19 }, { 38, -13 }, { 38, -12 }, { 38, -5 }, { 38, -4 }, { 38, -3 }, { 38, -2 }, { 38, -1 }, { 38, 0 }, { 38, 1 }, { 38, 2 }, { 38, 3 }, { 38, 4 }, { 38, 5 }, { 38, 6 }, { 38, 7 }, { 38, 8 }, { 38, 15 },
|
|
||||||
{ 38, 16 }, { 38, 22 }, { 38, 23 }, { 38, 24 }, { 38, 27 }, { 38, 28 }, { 38, 29 }, { 38, 30 }, { 39, -26 }, { 39, -25 }, { 39, -24 }, { 39, -20 }, { 39, -19 }, { 39, -18 }, { 39, -13 }, { 39, -12 }, { 39, -11 }, { 39, -10 }, { 39, -5 }, { 39, -4 }, { 39, 7 }, { 39, 8 }, { 39, 13 }, { 39, 14 }, { 39, 15 }, { 39, 16 }, { 39, 21 }, { 39, 22 }, { 39, 23 }, { 39, 27 },
|
|
||||||
{ 39, 28 }, { 39, 29 }, { 40, -25 }, { 40, -24 }, { 40, -19 }, { 40, -18 }, { 40, -13 }, { 40, -12 }, { 40, -11 }, { 40, -10 }, { 40, -5 }, { 40, -4 }, { 40, 7 }, { 40, 8 }, { 40, 13 }, { 40, 14 }, { 40, 15 }, { 40, 16 }, { 40, 21 }, { 40, 22 }, { 40, 27 }, { 40, 28 }, { 41, -19 }, { 41, -18 }, { 41, -1 }, { 41, 0 }, { 41, 1 }, { 41, 2 }, { 41, 3 }, { 41, 4 },
|
|
||||||
{ 41, 21 }, { 41, 22 }, { 42, -19 }, { 42, -18 }, { 42, -17 }, { 42, -1 }, { 42, 0 }, { 42, 1 }, { 42, 2 }, { 42, 3 }, { 42, 4 }, { 42, 20 }, { 42, 21 }, { 42, 22 }, { 43, -18 }, { 43, -17 }, { 43, -16 }, { 43, -15 }, { 43, -14 }, { 43, -13 }, { 43, -12 }, { 43, -9 }, { 43, -8 }, { 43, -1 }, { 43, 0 }, { 43, 1 }, { 43, 2 }, { 43, 3 }, { 43, 4 }, { 43, 11 },
|
|
||||||
{ 43, 12 }, { 43, 15 }, { 43, 16 }, { 43, 17 }, { 43, 18 }, { 43, 19 }, { 43, 20 }, { 43, 21 }, { 44, -17 }, { 44, -16 }, { 44, -15 }, { 44, -14 }, { 44, -13 }, { 44, -12 }, { 44, -9 }, { 44, -8 }, { 44, -7 }, { 44, -2 }, { 44, -1 }, { 44, 0 }, { 44, 1 }, { 44, 2 }, { 44, 3 }, { 44, 4 }, { 44, 5 }, { 44, 10 }, { 44, 11 }, { 44, 12 }, { 44, 15 }, { 44, 16 },
|
|
||||||
{ 44, 17 }, { 44, 18 }, { 44, 19 }, { 44, 20 }, { 45, -8 }, { 45, -7 }, { 45, -6 }, { 45, -5 }, { 45, -4 }, { 45, -3 }, { 45, -2 }, { 45, -1 }, { 45, 4 }, { 45, 5 }, { 45, 6 }, { 45, 7 }, { 45, 8 }, { 45, 9 }, { 45, 10 }, { 45, 11 }, { 46, -7 }, { 46, -6 }, { 46, -5 }, { 46, -4 }, { 46, -3 }, { 46, -2 }, { 46, 5 }, { 46, 6 }, { 46, 7 }, { 46, 8 },
|
|
||||||
{ 46, 9 }, { 46, 10 }, { 47, -4 }, { 47, -3 }, { 47, -2 }, { 47, 1 }, { 47, 2 }, { 47, 5 }, { 47, 6 }, { 47, 7 }, { 48, -3 }, { 48, -2 }, { 48, 1 }, { 48, 2 }, { 48, 5 }, { 48, 6 },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
resource_tiles = {
|
resource_tiles = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
@@ -188,7 +88,7 @@ return {
|
|||||||
amount = 4000,
|
amount = 4000,
|
||||||
size = { 26, 27 },
|
size = { 26, 27 },
|
||||||
-- offset = {-64,-32}
|
-- offset = {-64,-32}
|
||||||
offset = { x = -64, y = -64 },
|
offset = { -64, -64 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled = false,
|
enabled = false,
|
||||||
@@ -196,7 +96,7 @@ return {
|
|||||||
amount = 4000,
|
amount = 4000,
|
||||||
size = { 26, 27 },
|
size = { 26, 27 },
|
||||||
-- offset = {-64, 0}
|
-- offset = {-64, 0}
|
||||||
offset = { x = 64, y = -64 },
|
offset = { 64, -64 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled = false,
|
enabled = false,
|
||||||
@@ -204,7 +104,7 @@ return {
|
|||||||
amount = 4000,
|
amount = 4000,
|
||||||
size = { 22, 20 },
|
size = { 22, 20 },
|
||||||
-- offset = {-64, 32}
|
-- offset = {-64, 32}
|
||||||
offset = { x = -64, y = 64 },
|
offset = { -64, 64 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled = false,
|
enabled = false,
|
||||||
@@ -212,7 +112,7 @@ return {
|
|||||||
amount = 4000,
|
amount = 4000,
|
||||||
size = { 22, 20 },
|
size = { 22, 20 },
|
||||||
-- offset = {-64, -64}
|
-- offset = {-64, -64}
|
||||||
offset = { x = 64, y = 64 },
|
offset = { 64, 64 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled = false,
|
enabled = false,
|
||||||
@@ -220,7 +120,7 @@ return {
|
|||||||
amount = 4000,
|
amount = 4000,
|
||||||
size = { 22, 20 },
|
size = { 22, 20 },
|
||||||
-- offset = {-64, -96}
|
-- offset = {-64, -96}
|
||||||
offset = { x = 0, y = 64 },
|
offset = { 0, 64 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -233,7 +133,7 @@ return {
|
|||||||
num_patches = 4,
|
num_patches = 4,
|
||||||
amount = 4000000,
|
amount = 4000000,
|
||||||
-- offset = {-80, -12},
|
-- offset = {-80, -12},
|
||||||
offset = { x = -12, y = 64 },
|
offset = { -12, 64 },
|
||||||
-- offset_next = {0, 6}
|
-- offset_next = {0, 6}
|
||||||
offset_next = { 6, 0 },
|
offset_next = { 6, 0 },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ return {
|
|||||||
|
|
||||||
unlimited_capacity = false, --- @setting unlimited_capacity When true the vlayer has an unlimited energy capacity, accumulators are not required
|
unlimited_capacity = false, --- @setting unlimited_capacity When true the vlayer has an unlimited energy capacity, accumulators are not required
|
||||||
unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required
|
unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required
|
||||||
modded_auto_downgrade = false, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered
|
modded_auto_downgrade = true, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered
|
||||||
power_on_space = false, --- @setting power_on_space When true allow on spaceship
|
power_on_space = true, --- @setting power_on_space When true allow on spaceship
|
||||||
power_on_space_research = { --- @setting power_on_space_research the research level needed to use power_on_space
|
power_on_space_research = { --- @setting power_on_space_research the research level needed to use power_on_space
|
||||||
name = "research-productivity",
|
name = "research-productivity",
|
||||||
level = 10
|
level = 10
|
||||||
@@ -29,26 +29,12 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created
|
interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created
|
||||||
energy = 1, -- >1 allows for disconnected power networks to receive power
|
energy = 100, -- >1 allows for disconnected power networks to receive power
|
||||||
circuit = 20, -- No caveats
|
circuit = 100, -- No caveats
|
||||||
storage_input = 20, -- No caveats
|
storage_input = 100, -- No caveats
|
||||||
storage_output = 1, -- >0 allows for item teleportation (allowed_items only)
|
storage_output = 100, -- >0 allows for item teleportation (allowed_items only)
|
||||||
},
|
},
|
||||||
|
|
||||||
--- @class Vlayer.ItemProperties
|
|
||||||
--- @field starting_value number
|
|
||||||
--- @field required_area number
|
|
||||||
--- @field production number?
|
|
||||||
--- @field discharge number?
|
|
||||||
--- @field capacity number?
|
|
||||||
--- @field surface_area number?
|
|
||||||
--- @field fuel_value number?
|
|
||||||
--- @field power boolean?
|
|
||||||
--- @field modded boolean? Set when the item is registered from a modded equivalent
|
|
||||||
--- @field base_game_equivalent string?
|
|
||||||
--- @field multiplier number?
|
|
||||||
|
|
||||||
--- @type table<string, Vlayer.ItemProperties>
|
|
||||||
allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties
|
allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties
|
||||||
--[[
|
--[[
|
||||||
Allowed properties:
|
Allowed properties:
|
||||||
@@ -87,22 +73,22 @@ return {
|
|||||||
required_area = 0,
|
required_area = 0,
|
||||||
surface_area = 0,
|
surface_area = 0,
|
||||||
fuel_value = 4, -- MJ
|
fuel_value = 4, -- MJ
|
||||||
power = false, -- turn all coal to power to reduce trash
|
power = true, -- turn all coal to power to reduce trash
|
||||||
},
|
},
|
||||||
["solid-fuel"] = {
|
["solid-fuel"] = {
|
||||||
starting_value = 0,
|
starting_value = 0,
|
||||||
required_area = 0,
|
required_area = 0,
|
||||||
surface_area = 0,
|
surface_area = 0,
|
||||||
fuel_value = 12, -- MJ
|
fuel_value = 12, -- MJ
|
||||||
power = false, -- turn all solid fuel to power to reduce trash
|
power = true, -- turn all solid fuel to power to reduce trash
|
||||||
},
|
},
|
||||||
["rocket-fuel"] = {
|
["rocket-fuel"] = {
|
||||||
starting_value = 0,
|
starting_value = 0,
|
||||||
required_area = 0,
|
required_area = 0,
|
||||||
surface_area = 0,
|
surface_area = 0,
|
||||||
fuel_value = 100, -- MJ
|
fuel_value = 100, -- MJ
|
||||||
power = false, -- turn all rocket fuel to power to reduce trash
|
power = true, -- turn all rocket fuel to power to reduce trash
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
modded_items = { --- @setting modded_items List of all modded items allowed in vlayer storage and their base game equivalent
|
modded_items = { --- @setting modded_items List of all modded items allowed in vlayer storage and their base game equivalent
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
-- @config Warnings
|
-- @config Warnings
|
||||||
|
|
||||||
return {
|
return {
|
||||||
--- @type (LocalisedString[] | fun(player: LuaPlayer, by_player_name: string, number_of_warnings: number))[]
|
|
||||||
actions = { --- @setting actions what actions are taking at number of warnings
|
actions = { --- @setting actions what actions are taking at number of warnings
|
||||||
-- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted)
|
-- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted)
|
||||||
{ "warnings.received", "" },
|
{ "warnings.received", "" },
|
||||||
|
|||||||
@@ -149,23 +149,9 @@ PlayerData.Statistics:combine('JoinCount')
|
|||||||
local Storage = require("modules/exp_util/storage")
|
local Storage = require("modules/exp_util/storage")
|
||||||
|
|
||||||
local DatastoreManager = {}
|
local DatastoreManager = {}
|
||||||
local Datastores = {} --- @type table<string, Datastore>
|
local Datastores = {}
|
||||||
local Data = {}
|
|
||||||
|
|
||||||
--- @class Datastore
|
|
||||||
--- @field name string
|
|
||||||
--- @field value_name string
|
|
||||||
--- @field auto_save boolean
|
|
||||||
--- @field save_to_disk boolean
|
|
||||||
--- @field propagate_changes boolean
|
|
||||||
--- @field serializer function | false
|
|
||||||
--- @field parent Datastore | false
|
|
||||||
--- @field children table<string, Datastore>
|
|
||||||
--- @field metadata table
|
|
||||||
--- @field events table<string, function[]>
|
|
||||||
--- @field data table
|
|
||||||
local Datastore = {}
|
local Datastore = {}
|
||||||
|
local Data = {}
|
||||||
local copy = table.deep_copy
|
local copy = table.deep_copy
|
||||||
local trace = debug.traceback
|
local trace = debug.traceback
|
||||||
local table_to_json = helpers.table_to_json
|
local table_to_json = helpers.table_to_json
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ end
|
|||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local ext --- @type table<string, any>
|
local ext, var
|
||||||
local var --- @type table<string, any>
|
|
||||||
local concat = table.concat
|
local concat = table.concat
|
||||||
|
|
||||||
local External = {}
|
local External = {}
|
||||||
@@ -30,13 +29,12 @@ end
|
|||||||
|
|
||||||
]]
|
]]
|
||||||
function External.valid()
|
function External.valid()
|
||||||
local stored = storage.ext
|
if storage.ext == nil then return false end
|
||||||
if stored == nil then return false end
|
if ext == storage.ext and var == ext.var then
|
||||||
if ext == stored and var == ext.var then
|
|
||||||
return var ~= nil
|
return var ~= nil
|
||||||
else
|
else
|
||||||
ext = stored
|
ext = storage.ext
|
||||||
var = stored.var
|
var = ext.var
|
||||||
return var ~= nil
|
return var ~= nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -50,7 +48,7 @@ local servers = External.get_servers()
|
|||||||
]]
|
]]
|
||||||
function External.get_servers()
|
function External.get_servers()
|
||||||
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
||||||
return (assert(ext.servers, "No server list was found, please ensure that the external service is running"))
|
return assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[-- Gets a table of all the servers filtered by name, key is the server id, value is the server details
|
--[[-- Gets a table of all the servers filtered by name, key is the server id, value is the server details
|
||||||
@@ -85,7 +83,7 @@ function External.get_current_server()
|
|||||||
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
||||||
local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
||||||
local server_id = assert(ext.current, "No current id was found, please ensure that the external service is running")
|
local server_id = assert(ext.current, "No current id was found, please ensure that the external service is running")
|
||||||
return (assert(servers[server_id], "No details found for server with id: " .. tostring(server_id)))
|
return assert(servers[server_id], "No details found for server with id: " .. tostring(server_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[-- Gets the details of the given server
|
--[[-- Gets the details of the given server
|
||||||
@@ -99,7 +97,7 @@ local server = External.get_server_details('eu-01')
|
|||||||
function External.get_server_details(server_id)
|
function External.get_server_details(server_id)
|
||||||
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
||||||
local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
||||||
return (assert(servers[server_id], "No details found for server with id: " .. tostring(server_id)))
|
return assert(servers[server_id], "No details found for server with id: " .. tostring(server_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[-- Gets the status of the given server
|
--[[-- Gets the status of the given server
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ group:set_action('toggle_map_editor', false)
|
|||||||
|
|
||||||
]]
|
]]
|
||||||
function PermissionsGroups._prototype:set_action(action, state)
|
function PermissionsGroups._prototype:set_action(action, state)
|
||||||
local input_action = defines.input_action[action] --[[@as defines.input_action?]]
|
local input_action = defines.input_action[action] --[[ @as defines.input_action? ]]
|
||||||
if input_action == nil then input_action = action end
|
if input_action == nil then input_action = action end
|
||||||
assert(type(input_action) == "number", tostring(action) .. " is not a valid input action")
|
assert(type(input_action) == "number", tostring(action) .. " is not a valid input action")
|
||||||
self.actions[input_action] = state
|
self.actions[input_action] = state
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ PlayerData:set_serializer(Datastore.name_serializer) -- use player name
|
|||||||
|
|
||||||
--- Store and enum for the data saving preference
|
--- Store and enum for the data saving preference
|
||||||
local DataSavingPreference = PlayerData:combine("DataSavingPreference")
|
local DataSavingPreference = PlayerData:combine("DataSavingPreference")
|
||||||
local PreferenceEnum = { "All", "Statistics", "Settings", "Required" } --- @type table<string | number, string | number>
|
local PreferenceEnum = { "All", "Statistics", "Settings", "Required" }
|
||||||
for k, v in ipairs(PreferenceEnum) do PreferenceEnum[v] = k end
|
for k, v in ipairs(PreferenceEnum) do PreferenceEnum[v] = k end
|
||||||
|
|
||||||
DataSavingPreference:set_default("All")
|
DataSavingPreference:set_default("All")
|
||||||
|
|||||||
@@ -117,28 +117,11 @@ local Groups = require("modules.exp_legacy.expcore.permission_groups")
|
|||||||
local Colours = ExpUtil.color
|
local Colours = ExpUtil.color
|
||||||
local write_json = ExpUtil.write_json
|
local write_json = ExpUtil.write_json
|
||||||
|
|
||||||
|
|
||||||
--- @class Roles.Role
|
|
||||||
--- @field name string
|
|
||||||
--- @field short_hand string
|
|
||||||
--- @field index number Position within the role order
|
|
||||||
--- @field allowed_actions table<string, boolean>
|
|
||||||
--- @field allow_all_actions boolean
|
|
||||||
--- @field flags table<string, boolean>
|
|
||||||
--- @field disallowed_actions table<string, boolean>?
|
|
||||||
--- @field permission_group ([boolean, string] | string)?
|
|
||||||
--- @field custom_tag string?
|
|
||||||
--- @field custom_color Color?
|
|
||||||
--- @field parent string?
|
|
||||||
--- @field block_auto_assign boolean?
|
|
||||||
--- @field auto_assign_condition function?
|
|
||||||
--- @field set_allow_all fun(self: Roles.Role, state: boolean?): Roles.Role Defined on Roles._prototype
|
|
||||||
|
|
||||||
local Roles = {
|
local Roles = {
|
||||||
_prototype = {},
|
_prototype = {},
|
||||||
config = {
|
config = {
|
||||||
order = {}, --- @type string[] Contains the order of the roles, lower index is better
|
order = {}, -- Contains the order of the roles, lower index is better
|
||||||
roles = {}, --- @type table<string, Roles.Role> Contains the raw info for the roles, indexed by role name
|
roles = {}, -- Contains the raw info for the roles, indexed by role name
|
||||||
flags = {}, -- Contains functions that run when a flag is added/removed from a player
|
flags = {}, -- Contains functions that run when a flag is added/removed from a player
|
||||||
internal = {}, -- Contains all internally accessed roles, such as root, default
|
internal = {}, -- Contains all internally accessed roles, such as root, default
|
||||||
players = {}, -- Contains the roles that players have
|
players = {}, -- Contains the roles that players have
|
||||||
@@ -217,7 +200,7 @@ function Roles.debug()
|
|||||||
local output = ""
|
local output = ""
|
||||||
for index, role_name in ipairs(Roles.config.order) do
|
for index, role_name in ipairs(Roles.config.order) do
|
||||||
local role = Roles.config.roles[role_name]
|
local role = Roles.config.roles[role_name]
|
||||||
local color = (role.custom_color or Colours.white) --[[@as Color.struct]]
|
local color = role.custom_color or Colours.white
|
||||||
local color_str = string.format("[color=%d, %d, %d]", color.r, color.g, color.b)
|
local color_str = string.format("[color=%d, %d, %d]", color.r, color.g, color.b)
|
||||||
output = output .. string.format("\n%s %s) %s[/color]", color_str, index, serpent.line(role))
|
output = output .. string.format("\n%s %s) %s[/color]", color_str, index, serpent.line(role))
|
||||||
end
|
end
|
||||||
@@ -304,7 +287,6 @@ local role = Roles.get_role_by_name(2)
|
|||||||
]]
|
]]
|
||||||
function Roles.get_role_by_order(index)
|
function Roles.get_role_by_order(index)
|
||||||
local name = Roles.config.order[index]
|
local name = Roles.config.order[index]
|
||||||
if not name then return end
|
|
||||||
return Roles.config.roles[name]
|
return Roles.config.roles[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -366,17 +348,16 @@ end
|
|||||||
local role = Roles.get_player_highest_role(game.player)
|
local role = Roles.get_player_highest_role(game.player)
|
||||||
|
|
||||||
]]
|
]]
|
||||||
--- @return Roles.Role
|
|
||||||
function Roles.get_player_highest_role(player)
|
function Roles.get_player_highest_role(player)
|
||||||
local roles = Roles.get_player_roles(player)
|
local roles = Roles.get_player_roles(player)
|
||||||
local highest --- @type Roles.Role?
|
local highest
|
||||||
for _, role in ipairs(roles) do
|
for _, role in ipairs(roles) do
|
||||||
if not highest or role.index < highest.index then
|
if not highest or role.index < highest.index then
|
||||||
highest = role
|
highest = role
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return (assert(highest, "Player has no roles"))
|
return highest
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Assignment.
|
--- Assignment.
|
||||||
@@ -477,7 +458,7 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen
|
|||||||
|
|
||||||
-- If the player has a role that needs to defer the role changes, save the roles that need to be unassigned later into a table
|
-- If the player has a role that needs to defer the role changes, save the roles that need to be unassigned later into a table
|
||||||
local defer_changes = Roles.player_has_flag(player, "defer_role_changes")
|
local defer_changes = Roles.player_has_flag(player, "defer_role_changes")
|
||||||
if defer_changes and valid_player then
|
if defer_changes then
|
||||||
local assign_later = Roles.config.deferred_roles[valid_player.name] or {}
|
local assign_later = Roles.config.deferred_roles[valid_player.name] or {}
|
||||||
for _, role in ipairs(role_objects) do
|
for _, role in ipairs(role_objects) do
|
||||||
local role_change = assign_later[role.name]
|
local role_change = assign_later[role.name]
|
||||||
@@ -738,7 +719,7 @@ local role = Roles.new_role('Moderator', 'Mod')
|
|||||||
]]
|
]]
|
||||||
function Roles.new_role(name, short_hand)
|
function Roles.new_role(name, short_hand)
|
||||||
ExpUtil.assert_not_runtime()
|
ExpUtil.assert_not_runtime()
|
||||||
if Roles.config.roles[name] then error("Role name is non unique") end
|
if Roles.config.roles[name] then return error("Role name is non unique") end
|
||||||
local role = setmetatable({
|
local role = setmetatable({
|
||||||
name = name,
|
name = name,
|
||||||
short_hand = short_hand or name,
|
short_hand = short_hand or name,
|
||||||
@@ -913,9 +894,10 @@ role:set_permission_group('Admin')
|
|||||||
function Roles._prototype:set_permission_group(name, use_factorio_api)
|
function Roles._prototype:set_permission_group(name, use_factorio_api)
|
||||||
ExpUtil.assert_not_runtime()
|
ExpUtil.assert_not_runtime()
|
||||||
if use_factorio_api then
|
if use_factorio_api then
|
||||||
self.permission_group = { true, name } --[[@as [boolean, string] ]]
|
self.permission_group = { true, name }
|
||||||
else
|
else
|
||||||
assert(Groups.get_group_by_name(name), "Permission group not found: " .. name)
|
local group = Groups.get_group_by_name(name)
|
||||||
|
if not group then return end
|
||||||
self.permission_group = name
|
self.permission_group = name
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -1133,9 +1115,8 @@ local function role_update(event)
|
|||||||
-- Updates the players permission group
|
-- Updates the players permission group
|
||||||
local highest = Roles.get_player_highest_role(player)
|
local highest = Roles.get_player_highest_role(player)
|
||||||
if highest.permission_group then
|
if highest.permission_group then
|
||||||
local permission_group = highest.permission_group --[[@as [boolean, string] ]]
|
if highest.permission_group[1] then
|
||||||
if permission_group[1] then
|
local group = game.permissions.get_group(highest.permission_group[2])
|
||||||
local group = game.permissions.get_group(permission_group[2])
|
|
||||||
if group then
|
if group then
|
||||||
Groups.add_to_permission_group_async(group, player)
|
Groups.add_to_permission_group_async(group, player)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
[links]
|
[links]
|
||||||
discord=https://discord.explosivegaming.nl
|
website=https://aperx.org
|
||||||
website=https://www.explosivegaming.nl
|
github=https://github.com/PHIDIAS0303/ExpCluster
|
||||||
status=https://status.explosivegaming.nl
|
discord=
|
||||||
github=https://github.com/explosivegaming/ExpCluster
|
|
||||||
patreon=https://www.patreon.com/ExpGaming
|
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
players-online=There are __1__ players online
|
players-online=There are __1__ players online
|
||||||
total-map-time=This map has been on for __1__
|
total-map-time=This map has been on for __1__
|
||||||
discord=Join us on our discord at: https://discord.explosivegaming.nl
|
website=Please visit our website at: https://aperx.org
|
||||||
website=Please visit our website at: https://www.explosivegaming.nl
|
github=Want to help improve our server with some extra features? Help us at: https://github.com/PHIDIAS0303/ExpCluster
|
||||||
status=Want to check if out servers are down? Visit: https://status.explosivegaming.nl
|
discord=
|
||||||
github=Want to help improve our server with some extra features? Help us at: https://github.com/explosivegaming/ExpCluster
|
|
||||||
patreon=Consider supporting our server at: https://www.patreon.com/ExpGaming
|
|
||||||
custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info.
|
custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info.
|
||||||
read-readme=Make sure you have read the information gui (It can be found through the info mark on the top left)
|
read-readme=Make sure you have read the information gui (It can be found through the info mark on the top left)
|
||||||
softmod=We run a softmod on our servers. A softmod is a custom scenario that runs on this server, an example is the player list.
|
softmod=We run a softmod on our servers. A softmod is a custom scenario that runs on this server, an example is the player list.
|
||||||
redmew=We don't talk about redmew here; they beat us to 1000 members ;-;
|
|
||||||
lhd=All trains must be LHD! This is a long standing rule on our servers, please respect this.
|
lhd=All trains must be LHD! This is a long standing rule on our servers, please respect this.
|
||||||
|
|
||||||
[warnings]
|
[warnings]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
description-add=Sets / Gets your custom join message.
|
description-add=Sets / Gets your custom join message.
|
||||||
description-remove=Removes you custom join message.
|
description-remove=Removes you custom join message.
|
||||||
arg-message=Your custom join message.
|
arg-message=Your custom join message.
|
||||||
greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color]
|
greet=[color=0,1,0] Welcome to APERX gaming community server! __1__[/color]
|
||||||
message-set=Your join message has been updated.
|
message-set=Your join message has been updated.
|
||||||
message-get=Your join message is: __1__
|
message-get=Your join message is: __1__
|
||||||
message-cleared=Your join message has been cleared.
|
message-cleared=Your join message has been cleared.
|
||||||
|
|||||||
@@ -14,6 +14,46 @@ ban-player=Ban player
|
|||||||
afk-time=__1__% of total map time\nLast moved __2__ ago
|
afk-time=__1__% of total map time\nLast moved __2__ ago
|
||||||
open-map=__1__ __2__\n__3__\nClick to open map
|
open-map=__1__ __2__\n__3__\nClick to open map
|
||||||
|
|
||||||
|
[rocket-info]
|
||||||
|
main-tooltip=Rocket Info
|
||||||
|
launch-tooltip=Launch rocket
|
||||||
|
launch-tooltip-disabled=Launch rocket (not ready)
|
||||||
|
toggle-rocket-tooltip=Disable auto launch
|
||||||
|
toggle-rocket-tooltip-disabled=Enable auto launch
|
||||||
|
toggle-section-tooltip=Expand Section
|
||||||
|
toggle-section-collapse-tooltip=Collapse Section
|
||||||
|
section-caption-stats=Statistics
|
||||||
|
section-tooltip-stats=Statistics about how rockets are launched
|
||||||
|
section-caption-milestones=Milestones
|
||||||
|
section-tooltip-milestones=The times when milestones were met
|
||||||
|
section-caption-progress=Build Progress
|
||||||
|
section-tooltip-progress=The progress for your rocket silos
|
||||||
|
progress-no-silos=You have no rocket silos
|
||||||
|
data-caption-first-launch=First Launch
|
||||||
|
data-tooltip-first-launch=The time of the first launch
|
||||||
|
data-caption-last-launch=Last Launch
|
||||||
|
data-tooltip-last-launch=The time of the last launch
|
||||||
|
data-caption-fastest-launch=Fastest Launch
|
||||||
|
data-tooltip-fastest-launch=The time taken for the fastest launch
|
||||||
|
data-caption-total-rockets=Total Launched
|
||||||
|
data-tooltip-total-rockets=Total number of rockets launched by your force
|
||||||
|
value-tooltip-total-rockets=__1__% of all rockets on this map
|
||||||
|
data-caption-avg-launch=Average Time
|
||||||
|
data-tooltip-avg-launch=The average amount of time taken to launch a rocket
|
||||||
|
data-caption-avg-launch-n=Average Time __1__
|
||||||
|
data-tooltip-avg-launch-n=The average amount of time taken to launch the last __1__ rockets
|
||||||
|
data-caption-milestone-n=Milestone __1__
|
||||||
|
data-tooltip-milestone-n=Time taken to each __1__ rockets
|
||||||
|
data-caption-milestone-next=N/A
|
||||||
|
data-tooltip-milestone-next=Not yet achieved
|
||||||
|
progress-x-pos=X __1__
|
||||||
|
progress-y-pos=Y __1__
|
||||||
|
progress-label-tooltip=View on map
|
||||||
|
progress-launched=Launched
|
||||||
|
progress-caption=__1__%
|
||||||
|
progress-tooltip=This silo has launched __1__ rockets
|
||||||
|
launch-failed=Failed to launch rocket, please wait a few seconds and try again.
|
||||||
|
|
||||||
[warp-list]
|
[warp-list]
|
||||||
main-caption=Warp List [img=info]
|
main-caption=Warp List [img=info]
|
||||||
main-tooltip=Warp List
|
main-tooltip=Warp List
|
||||||
@@ -45,6 +85,74 @@ goto-cooldown=You are on cooldown, wait for your cooldown to recharge
|
|||||||
goto-disabled=You are not on a warp point, walk to a warp point
|
goto-disabled=You are not on a warp point, walk to a warp point
|
||||||
goto-edit=Edit warp icon
|
goto-edit=Edit warp icon
|
||||||
|
|
||||||
|
[readme]
|
||||||
|
main-tooltip=Infomation
|
||||||
|
welcome-tab=Welcome
|
||||||
|
welcome-tooltip=Welcome to APERX
|
||||||
|
welcome-general=Welcome to APERX; we host many factorio servers. While you are here, we ask you to follow our rules. You can find these in the tab above. You can also find our custom commands and links to our other servers. This map has been online for __2__.\nPlease note that our servers reset periodically, the next reset is: __1__
|
||||||
|
welcome-roles=We run a custom role system to help protect the work of others. As a result you may not be able to use your deconstruction planner yet or drop item on the groud. Roles also give you access to some custom features such as adding tasks to our task list or making new warp points.\nYou have been assigned the roles: __1__
|
||||||
|
welcome-chat=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key (which is located under the “ESC key”) - If you would like to change the key, go to your Controls tab in options.\nThe setting you need to change is “Toggle chat (and Lua console)” you currently have it set to "__CONTROL__toggle-console__"
|
||||||
|
rules-tab=Rules
|
||||||
|
rules-tooltip=Rules for our server
|
||||||
|
rules-general=By playing on our servers you accept the rules below. If you are supected of breaking a rule then you will be questioned by one of our moderators. If required you will be banned from our servers, appeals can be made by contacting an Administrator on our discord.
|
||||||
|
rules-1=Hacking / cheating / abusing bugs will not be tolerated.
|
||||||
|
rules-2=Any bugs or exploits found should be reported to our staff members.
|
||||||
|
rules-3=Be respectful to other players in chat, this includes any other forms of communication.
|
||||||
|
rules-4=Taking all items from a belt or logistics network is forbidden: sharing resources is mandatory.
|
||||||
|
rules-5=Spamming of chat, bots, unlimited chests, or concrete is not allowed.
|
||||||
|
rules-6=Before removing major parts of the factory tell other players why you are removing it.
|
||||||
|
rules-7=Do not cause unnecessary lag by placing/removing tiles with bots or using active provider chests, if think some thing might cause lag please ask staff first.
|
||||||
|
rules-8=Do not walk in random directions with no reason, this is to reduce map download times.
|
||||||
|
rules-9=Do not use speakers on global or with alerts without prior permission, no one wants to hear your music at full volume without knowing where the off switch is.
|
||||||
|
rules-10=Do not rotate belts, deactivate belts with wires, or cause production to stop without good reason, this goes for inserters and spliters as well.
|
||||||
|
rules-11=Do not make train roundabouts. Other loops such as RoRo stations are allowed.
|
||||||
|
rules-12=When using trains, use the same size other players have used, many players use 1-2-1, 2-4-2, or 3-8-3, meaning 1 engine 2 cargo 1 engine.
|
||||||
|
rules-13=Trains are Left Hand Drive (LHD) only, this means trains drive on the left side of the tracks.
|
||||||
|
rules-14=Do not beg for roles, advertise other servers, or link to harmful sites.
|
||||||
|
rules-15=Use common sense, report rule breakers, and Administrators have the final word.
|
||||||
|
commands-tab=Commands
|
||||||
|
commands-tooltip=Commands which you are able to use
|
||||||
|
commands-general=We have lots of custom commands which you are able to use. Below you can find a list of all the commands that you are allowed to use and what they do. If you need more information or want to search for a command you can use our /search-help command.
|
||||||
|
servers-tab=Servers
|
||||||
|
servers-tooltip=Links to our other servers and sites
|
||||||
|
servers-general=This is only one of our servers for factorio, we host many of others as well. Below you can find details about all the servers that we host as well as links to our external services such as discord or github.
|
||||||
|
servers-factorio=Factorio Servers
|
||||||
|
servers-1=S1
|
||||||
|
servers-d1=This server resets regularly.
|
||||||
|
servers-2=S2
|
||||||
|
servers-d2=This server resets regularly.
|
||||||
|
servers-3=S3
|
||||||
|
servers-d3=This server resets regularly.
|
||||||
|
servers-5=S5
|
||||||
|
servers-d5=This server is only for members. Check discord for more details.
|
||||||
|
servers-6=S6
|
||||||
|
servers-d6=This server is only for members. Check discord for more details.
|
||||||
|
servers-8=S8
|
||||||
|
servers-d8=This server is only for event and others. Check discord for more details.
|
||||||
|
servers-connect-Offline=Server is currently offline
|
||||||
|
servers-connect-Current=This is your current server
|
||||||
|
servers-connect-Version=Server is on a different version: __1__
|
||||||
|
servers-connect-Password=Server requires a password
|
||||||
|
servers-connect-Modded=Server requires mods to be downloaded
|
||||||
|
servers-connect-Online=Server is online
|
||||||
|
servers-external=External Links
|
||||||
|
servers-open-in-browser=Open in your browser
|
||||||
|
backers-tab=Backers
|
||||||
|
backers-tooltip=People who have helped make our server
|
||||||
|
backers-general=We would like to thank all our staff and backers who have helped our community grow. Our staff have helped to keep our servers safe from trolls and a fun place to play. Our backers have helped us to cover our running costs and provide a great community for us all to enjoy together.
|
||||||
|
backers-management=Administrators
|
||||||
|
backers-staff=Staff Members
|
||||||
|
backers-backers=Board Members, Supporters, and Partners
|
||||||
|
backers-active=Active Players
|
||||||
|
data-tab=Data
|
||||||
|
data-tooltip=All of your stored player data
|
||||||
|
data-general=Our servers will save your player data so that we can sync it between servers. All of your data can be found below, if you wish to save a copy locally then use /save-data. If you want to change what data is saved then use /set-preference.
|
||||||
|
data-settings=Settings
|
||||||
|
data-statistics=Statistics
|
||||||
|
data-required=Required
|
||||||
|
data-misc=Miscellaneous
|
||||||
|
data-format=__1____2__
|
||||||
|
|
||||||
[bonus]
|
[bonus]
|
||||||
description=Get / Set the amount of bonus you receive.
|
description=Get / Set the amount of bonus you receive.
|
||||||
arg-amount=Amount to set your bonus to, 0 will disable bonus.
|
arg-amount=Amount to set your bonus to, 0 will disable bonus.
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
[links]
|
[links]
|
||||||
discord=https://discord.explosivegaming.nl
|
website=https://aperx.org
|
||||||
website=https://www.explosivegaming.nl
|
github=https://github.com/PHIDIAS0303/ExpCluster
|
||||||
status=https://status.explosivegaming.nl
|
discord=
|
||||||
github=https://github.com/explosivegaming/ExpCluster
|
|
||||||
patreon=https://www.patreon.com/ExpGaming
|
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
players-online=現在有 __1__ 人在線
|
players-online=現在有 __1__ 人在線
|
||||||
total-map-time=地圖時間為 __1__
|
total-map-time=地圖時間為 __1__
|
||||||
discord=加入社群: https://discord.explosivegaming.nl
|
website=訪問網站: https://aperx.org
|
||||||
website=訪問網站: https://www.explosivegaming.nl
|
github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster
|
||||||
status=伺服器狀態: https://status.explosivegaming.nl
|
discord=
|
||||||
github=增加功能或回報錯誤: https://github.com/explosivegaming/ExpCluster
|
|
||||||
patreon=支持我們: https://www.patreon.com/ExpGaming
|
|
||||||
custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。
|
custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。
|
||||||
read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。
|
read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。
|
||||||
softmod=這裹用了自設情境,是一種軟裝模組。
|
softmod=這裹用了自設情境,是一種軟裝模組。
|
||||||
redmew=
|
|
||||||
lhd=列車必須是左則通行。這是本服務器長久以來的規則。
|
lhd=列車必須是左則通行。這是本服務器長久以來的規則。
|
||||||
|
|
||||||
[warnings]
|
[warnings]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
description-add=設定 / 取得你的加入信息。
|
description-add=設定 / 取得你的加入信息。
|
||||||
description-remove=移除你的加入信息。
|
description-remove=移除你的加入信息。
|
||||||
arg-message=你的加入信息。
|
arg-message=你的加入信息。
|
||||||
greet=[color=0,1,0] 歡迎來到 EXP 的服務器! 若果你喜歡本服務器可加入 DISCORD: __1__ [/color]
|
greet=[color=0,1,0] 歡迎來到 APERX 的服務器! __1__[/color]
|
||||||
message-set=你的加入信息已更新。
|
message-set=你的加入信息已更新。
|
||||||
message-get=你的加入信息為: __1__
|
message-get=你的加入信息為: __1__
|
||||||
message-cleared=你的加入信息已清除。
|
message-cleared=你的加入信息已清除。
|
||||||
|
|||||||
@@ -14,6 +14,46 @@ ban-player=封禁用戶
|
|||||||
afk-time=__1__% 地圖時間\n上次移動: __2__
|
afk-time=__1__% 地圖時間\n上次移動: __2__
|
||||||
open-map=__1__ __2__\n__3__\n按下打開地圖
|
open-map=__1__ __2__\n__3__\n按下打開地圖
|
||||||
|
|
||||||
|
[rocket-info]
|
||||||
|
main-tooltip=火箭資訊
|
||||||
|
launch-tooltip=發射火箭
|
||||||
|
launch-tooltip-disabled=發射火箭 (未準備)
|
||||||
|
toggle-rocket-tooltip=取消自動發射
|
||||||
|
toggle-rocket-tooltip-disabled=啟用自動發射
|
||||||
|
toggle-section-tooltip=擴張欄
|
||||||
|
toggle-section-collapse-tooltip=收縮欄
|
||||||
|
section-caption-stats=數據
|
||||||
|
section-tooltip-stats=火箭發射數據
|
||||||
|
section-caption-milestones=里程碑
|
||||||
|
section-tooltip-milestones=里程碑達成次數
|
||||||
|
section-caption-progress=建造程度
|
||||||
|
section-tooltip-progress=火箭建造程度
|
||||||
|
progress-no-silos=你沒有火箭發射井
|
||||||
|
data-caption-first-launch=首次發射
|
||||||
|
data-tooltip-first-launch=首次發射時間
|
||||||
|
data-caption-last-launch=最後發射
|
||||||
|
data-tooltip-last-launch=最後發射時間
|
||||||
|
data-caption-fastest-launch=最快發射
|
||||||
|
data-tooltip-fastest-launch=最快發射時間
|
||||||
|
data-caption-total-rockets=總發射次數
|
||||||
|
data-tooltip-total-rockets=我方總發射次數
|
||||||
|
value-tooltip-total-rockets=__1__% 的火箭發射都在本地圖上。
|
||||||
|
data-caption-avg-launch=平均時間
|
||||||
|
data-tooltip-avg-launch=火箭發射平均時間
|
||||||
|
data-caption-avg-launch-n=平均時間 __1__
|
||||||
|
data-tooltip-avg-launch-n=__1__ 次火箭發射的平均時間
|
||||||
|
data-caption-milestone-n=里程碑 __1__
|
||||||
|
data-tooltip-milestone-n=__1__ 次火箭發射的時間
|
||||||
|
data-caption-milestone-next=N/A
|
||||||
|
data-tooltip-milestone-next=未達成
|
||||||
|
progress-x-pos=X __1__
|
||||||
|
progress-y-pos=Y __1__
|
||||||
|
progress-label-tooltip=在地圖上看
|
||||||
|
progress-launched=已發射
|
||||||
|
progress-caption=__1__ %
|
||||||
|
progress-tooltip=該火箭發射井發射了 __1__ 次
|
||||||
|
launch-failed=火箭發射失敗, 請過一會再試。
|
||||||
|
|
||||||
[warp-list]
|
[warp-list]
|
||||||
main-caption=傳送陣清單 [img=info]
|
main-caption=傳送陣清單 [img=info]
|
||||||
main-tooltip=傳送陣清單
|
main-tooltip=傳送陣清單
|
||||||
@@ -45,6 +85,74 @@ goto-cooldown=傳送冷卻中, 請等候冷卻
|
|||||||
goto-disabled=你不在傳送陣, 請移至任意傳送陣
|
goto-disabled=你不在傳送陣, 請移至任意傳送陣
|
||||||
goto-edit=修改傳送陣圖案
|
goto-edit=修改傳送陣圖案
|
||||||
|
|
||||||
|
[readme]
|
||||||
|
main-tooltip=資訊
|
||||||
|
welcome-tab=歡迎
|
||||||
|
welcome-tooltip=歡迎來到 APERX
|
||||||
|
welcome-general=歡迎來到 APERX; 你在這裏的時候要遵守規則。 你可以在左上方的介面找到更多資訊。 地圖時間 __2__。\n下次地圖重設: __1__
|
||||||
|
welcome-roles=我們有自訂的身份組來保護其他用戶。 所以你有機會不能使用拆除規劃器或掉東西。 身份組給予你各種權限\n你有以下身份組: __1__
|
||||||
|
welcome-chat=你可以使用 「重音符/抑音符」 鍵 (ESC 鍵 下方) - 你也可以在選項中修改按鍵。\n你目前設定為 「__CONTROL__toggle-console__」
|
||||||
|
rules-tab=規則
|
||||||
|
rules-tooltip=服務器規則
|
||||||
|
rules-general=你在本服務器遊玩即等同同意以下規則。管理員有機會就相關事項提問。你可能會因為違反規則而被封禁,你可以在 Discord 中提出反對。
|
||||||
|
rules-1=開掛或濫用漏洞將不會被容忍。
|
||||||
|
rules-2=當你找到漏洞可以通知職員。
|
||||||
|
rules-3=請在聊天室中尊重其他人。
|
||||||
|
rules-4=請不要把所有物品全部取走。
|
||||||
|
rules-5=請不要濫發信息,大量鋪設地磚,或不為箱子設置上限,浪費資源。
|
||||||
|
rules-6=當你想大量拆除原有設施前請通知其他用戶。
|
||||||
|
rules-7=請不要無故使用機器人來大量鋪設或拆除地磚,濫用主動出貨箱。
|
||||||
|
rules-8=請不要隨意移動來開大量地圖,這有助減少地圖下載時間。
|
||||||
|
rules-9=請不要無故使用全圖喇叭。
|
||||||
|
rules-10=請不要無故轉動傳送帶方向,停用傳送帶,或停止生產。
|
||||||
|
rules-11=請不要用迴旋處。 火車站尾返程則是例外。
|
||||||
|
rules-12=請跟其他人使用相同的火車組成。常用的有 1-2-1,2-4-2,或 3-8-3,即1個動車組拖2個貨車組再拖不同方向的1個動車組。
|
||||||
|
rules-13=火車必須是左上右下 (LHD)。
|
||||||
|
rules-14=禁止要求身份組,發廣告,發惡意連結。
|
||||||
|
rules-15=使用常識, 舉報違規人員,管理員有最終決定權。
|
||||||
|
commands-tab=指令
|
||||||
|
commands-tooltip=你可用的指令
|
||||||
|
commands-general=這裏有自訂的指令。你可以在下邊找到你可用的指令及其功能介紹。你可以用 /search-help 來取得更多資訊。
|
||||||
|
servers-tab=伺服器
|
||||||
|
servers-tooltip=到其他伺服器及網站的連結
|
||||||
|
servers-general=這是其中一個伺服器。你可以在下方找到其他同樣是由我們運行的伺服器資料。
|
||||||
|
servers-factorio=異星工廠伺服器
|
||||||
|
servers-1=S1
|
||||||
|
servers-d1=這個服務器定期重設。
|
||||||
|
servers-2=S2
|
||||||
|
servers-d2=這個服務器定期重設。
|
||||||
|
servers-3=S3
|
||||||
|
servers-d3=這個服務器定期重設。
|
||||||
|
servers-5=S5
|
||||||
|
servers-d5=這個服務器只為會員運行,可在 Discord 中得到更多資訊。
|
||||||
|
servers-6=S6
|
||||||
|
servers-d6=這個服務器只為會員運行,可在 Discord 中得到更多資訊。
|
||||||
|
servers-8=S8
|
||||||
|
servers-d8=這個服務器只在活動和其他時運行,可在 Discord 中得到更多資訊。
|
||||||
|
servers-connect-Offline=該服務器目前沒有在運行
|
||||||
|
servers-connect-Current=你目前所在的伺服器
|
||||||
|
servers-connect-Version=該服務器運行不同的遊戲版本: __1__
|
||||||
|
servers-connect-Password=該服務器需要密碼
|
||||||
|
servers-connect-Modded=該服務器需要下載模組
|
||||||
|
servers-connect-Online=該服務器在線
|
||||||
|
servers-external=外部連結
|
||||||
|
servers-open-in-browser=可在你的瀏覽器中打開
|
||||||
|
backers-tab=支持者
|
||||||
|
backers-tooltip=支持者
|
||||||
|
backers-general=他們為服務器運行提供了不少幫助。
|
||||||
|
backers-management=管理員
|
||||||
|
backers-staff=職員
|
||||||
|
backers-backers=議員,支持者,和夥伴
|
||||||
|
backers-active=活躍玩家
|
||||||
|
data-tab=資料
|
||||||
|
data-tooltip=所有已存資料
|
||||||
|
data-general=資料會自動存到各個服務器中。 你也可以用 /save-data 存一份副本。 也可用 /set-preference 來更改喜好。
|
||||||
|
data-settings=設定
|
||||||
|
data-statistics=數據
|
||||||
|
data-required=需要
|
||||||
|
data-misc=雜項
|
||||||
|
data-format=__1____2__
|
||||||
|
|
||||||
[bonus]
|
[bonus]
|
||||||
description=取得 / 設定 Bonus 量。
|
description=取得 / 設定 Bonus 量。
|
||||||
arg-amount=Bonus 數量, 0 來停用。
|
arg-amount=Bonus 數量, 0 來停用。
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
[links]
|
[links]
|
||||||
discord=https://discord.explosivegaming.nl
|
website=https://aperx.org
|
||||||
website=https://www.explosivegaming.nl
|
github=https://github.com/PHIDIAS0303/ExpCluster
|
||||||
status=https://status.explosivegaming.nl
|
discord=
|
||||||
github=https://github.com/explosivegaming/ExpCluster
|
|
||||||
patreon=https://www.patreon.com/ExpGaming
|
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
players-online=現在有 __1__ 人在線
|
players-online=現在有 __1__ 人在線
|
||||||
total-map-time=地圖時間為 __1__
|
total-map-time=地圖時間為 __1__
|
||||||
discord=加入社群: https://discord.explosivegaming.nl
|
website=訪問網站: https://aperx.org
|
||||||
website=訪問網站: https://www.explosivegaming.nl
|
github=增加功能或回報錯誤: https://github.com/PHIDIAS0303/ExpCluster
|
||||||
status=伺服器狀態: https://status.explosivegaming.nl
|
discord=
|
||||||
github=增加功能或回報錯誤: https://github.com/explosivegaming/ExpCluster
|
|
||||||
patreon=支持我們: https://www.patreon.com/ExpGaming
|
|
||||||
custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。
|
custom-commands=這裹使用了自制指令,如 /tag 和 /me。可使用 /chelp 查看更多。
|
||||||
read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。
|
read-readme=確保你已閱讀相關資訊。按左上 i 圖標可再次查看。
|
||||||
softmod=這裹用了自設情境,是一種軟裝模組。
|
softmod=這裹用了自設情境,是一種軟裝模組。
|
||||||
redmew=
|
|
||||||
lhd=列車必須是左則通行。這是本服務器長久以來的規則。
|
lhd=列車必須是左則通行。這是本服務器長久以來的規則。
|
||||||
|
|
||||||
[warnings]
|
[warnings]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
description-add=設定 / 取得你的加入信息。
|
description-add=設定 / 取得你的加入信息。
|
||||||
description-remove=移除你的加入信息。
|
description-remove=移除你的加入信息。
|
||||||
arg-message=你的加入信息。
|
arg-message=你的加入信息。
|
||||||
greet=[color=0,1,0] 歡迎來到 EXP 的服務器! 若果你喜歡本服務器可加入 DISCORD: __1__ [/color]
|
greet=[color=0,1,0] 歡迎來到 APERX 的服務器! __1__[/color]
|
||||||
message-set=你的加入信息已更新。
|
message-set=你的加入信息已更新。
|
||||||
message-get=你的加入信息為: __1__
|
message-get=你的加入信息為: __1__
|
||||||
message-cleared=你的加入信息已清除。
|
message-cleared=你的加入信息已清除。
|
||||||
|
|||||||
@@ -14,6 +14,46 @@ ban-player=封禁用戶
|
|||||||
afk-time=__1__% 地圖時間\n上次移動: __2__
|
afk-time=__1__% 地圖時間\n上次移動: __2__
|
||||||
open-map=__1__ __2__\n__3__\n按下打開地圖
|
open-map=__1__ __2__\n__3__\n按下打開地圖
|
||||||
|
|
||||||
|
[rocket-info]
|
||||||
|
main-tooltip=火箭資訊
|
||||||
|
launch-tooltip=發射火箭
|
||||||
|
launch-tooltip-disabled=發射火箭 (未準備)
|
||||||
|
toggle-rocket-tooltip=取消自動發射
|
||||||
|
toggle-rocket-tooltip-disabled=啟用自動發射
|
||||||
|
toggle-section-tooltip=擴張欄
|
||||||
|
toggle-section-collapse-tooltip=收縮欄
|
||||||
|
section-caption-stats=數據
|
||||||
|
section-tooltip-stats=火箭發射數據
|
||||||
|
section-caption-milestones=里程碑
|
||||||
|
section-tooltip-milestones=里程碑達成次數
|
||||||
|
section-caption-progress=建造程度
|
||||||
|
section-tooltip-progress=火箭建造程度
|
||||||
|
progress-no-silos=你沒有火箭發射井
|
||||||
|
data-caption-first-launch=首次發射
|
||||||
|
data-tooltip-first-launch=首次發射時間
|
||||||
|
data-caption-last-launch=最後發射
|
||||||
|
data-tooltip-last-launch=最後發射時間
|
||||||
|
data-caption-fastest-launch=最快發射
|
||||||
|
data-tooltip-fastest-launch=最快發射時間
|
||||||
|
data-caption-total-rockets=總發射次數
|
||||||
|
data-tooltip-total-rockets=我方總發射次數
|
||||||
|
value-tooltip-total-rockets=__1__% 的火箭發射都在本地圖上。
|
||||||
|
data-caption-avg-launch=平均時間
|
||||||
|
data-tooltip-avg-launch=火箭發射平均時間
|
||||||
|
data-caption-avg-launch-n=平均時間 __1__
|
||||||
|
data-tooltip-avg-launch-n=__1__ 次火箭發射的平均時間
|
||||||
|
data-caption-milestone-n=里程碑 __1__
|
||||||
|
data-tooltip-milestone-n=__1__ 次火箭發射的時間
|
||||||
|
data-caption-milestone-next=N/A
|
||||||
|
data-tooltip-milestone-next=未達成
|
||||||
|
progress-x-pos=X __1__
|
||||||
|
progress-y-pos=Y __1__
|
||||||
|
progress-label-tooltip=在地圖上看
|
||||||
|
progress-launched=已發射
|
||||||
|
progress-caption=__1__ %
|
||||||
|
progress-tooltip=該火箭發射井發射了 __1__ 次
|
||||||
|
launch-failed=火箭發射失敗, 請過一會再試。
|
||||||
|
|
||||||
[warp-list]
|
[warp-list]
|
||||||
main-caption=傳送陣清單 [img=info]
|
main-caption=傳送陣清單 [img=info]
|
||||||
main-tooltip=傳送陣清單
|
main-tooltip=傳送陣清單
|
||||||
@@ -45,6 +85,74 @@ goto-cooldown=傳送冷卻中, 請等候冷卻
|
|||||||
goto-disabled=你不在傳送陣, 請移至任意傳送陣
|
goto-disabled=你不在傳送陣, 請移至任意傳送陣
|
||||||
goto-edit=修改傳送陣圖案
|
goto-edit=修改傳送陣圖案
|
||||||
|
|
||||||
|
[readme]
|
||||||
|
main-tooltip=資訊
|
||||||
|
welcome-tab=歡迎
|
||||||
|
welcome-tooltip=歡迎來到 APERX
|
||||||
|
welcome-general=歡迎來到 APERX; 你在這裏的時候要遵守規則。 你可以在左上方的介面找到更多資訊。 地圖時間 __2__。\n下次地圖重設: __1__
|
||||||
|
welcome-roles=我們有自訂的身份組來保護其他用戶。 所以你有機會不能使用拆除規劃器或掉東西。 身份組給予你各種權限\n你有以下身份組: __1__
|
||||||
|
welcome-chat=你可以使用 「重音符/抑音符」 鍵 (ESC 鍵 下方) - 你也可以在選項中修改按鍵。\n你目前設定為 「__CONTROL__toggle-console__」
|
||||||
|
rules-tab=規則
|
||||||
|
rules-tooltip=服務器規則
|
||||||
|
rules-general=你在本服務器遊玩即等同同意以下規則。管理員有機會就相關事項提問。你可能會因為違反規則而被封禁,你可以在 Discord 中提出反對。
|
||||||
|
rules-1=開掛或濫用漏洞將不會被容忍。
|
||||||
|
rules-2=當你找到漏洞可以通知職員。
|
||||||
|
rules-3=請在聊天室中尊重其他人。
|
||||||
|
rules-4=請不要把所有物品全部取走。
|
||||||
|
rules-5=請不要濫發信息,大量鋪設地磚,或不為箱子設置上限,浪費資源。
|
||||||
|
rules-6=當你想大量拆除原有設施前請通知其他用戶。
|
||||||
|
rules-7=請不要無故使用機器人來大量鋪設或拆除地磚,濫用主動出貨箱。
|
||||||
|
rules-8=請不要隨意移動來開大量地圖,這有助減少地圖下載時間。
|
||||||
|
rules-9=請不要無故使用全圖喇叭。
|
||||||
|
rules-10=請不要無故轉動傳送帶方向,停用傳送帶,或停止生產。
|
||||||
|
rules-11=請不要用迴旋處。 火車站尾返程則是例外。
|
||||||
|
rules-12=請跟其他人使用相同的火車組成。常用的有 1-2-1,2-4-2,或 3-8-3,即1個動車組拖2個貨車組再拖不同方向的1個動車組。
|
||||||
|
rules-13=火車必須是左上右下 (LHD)。
|
||||||
|
rules-14=禁止要求身份組,發廣告,發惡意連結。
|
||||||
|
rules-15=使用常識, 舉報違規人員,管理員有最終決定權。
|
||||||
|
commands-tab=指令
|
||||||
|
commands-tooltip=你可用的指令
|
||||||
|
commands-general=這裏有自訂的指令。你可以在下邊找到你可用的指令及其功能介紹。你可以用 /search-help 來取得更多資訊。
|
||||||
|
servers-tab=伺服器
|
||||||
|
servers-tooltip=到其他伺服器及網站的連結
|
||||||
|
servers-general=這是其中一個伺服器。你可以在下方找到其他同樣是由我們運行的伺服器資料。
|
||||||
|
servers-factorio=異星工廠伺服器
|
||||||
|
servers-1=S1
|
||||||
|
servers-d1=這個服務器定期重設。
|
||||||
|
servers-2=S2
|
||||||
|
servers-d2=這個服務器定期重設。
|
||||||
|
servers-3=S3
|
||||||
|
servers-d3=這個服務器定期重設。
|
||||||
|
servers-5=S5
|
||||||
|
servers-d5=這個服務器只為會員運行,可在 Discord 中得到更多資訊。
|
||||||
|
servers-6=S6
|
||||||
|
servers-d6=這個服務器只為會員運行,可在 Discord 中得到更多資訊。
|
||||||
|
servers-8=S8
|
||||||
|
servers-d8=這個服務器只在活動和其他時運行,可在 Discord 中得到更多資訊。
|
||||||
|
servers-connect-Offline=該服務器目前沒有在運行
|
||||||
|
servers-connect-Current=你目前所在的伺服器
|
||||||
|
servers-connect-Version=該服務器運行不同的遊戲版本: __1__
|
||||||
|
servers-connect-Password=該服務器需要密碼
|
||||||
|
servers-connect-Modded=該服務器需要下載模組
|
||||||
|
servers-connect-Online=該服務器在線
|
||||||
|
servers-external=外部連結
|
||||||
|
servers-open-in-browser=可在你的瀏覽器中打開
|
||||||
|
backers-tab=支持者
|
||||||
|
backers-tooltip=支持者
|
||||||
|
backers-general=他們為服務器運行提供了不少幫助。
|
||||||
|
backers-management=管理員
|
||||||
|
backers-staff=職員
|
||||||
|
backers-backers=議員,支持者,和夥伴
|
||||||
|
backers-active=活躍玩家
|
||||||
|
data-tab=資料
|
||||||
|
data-tooltip=所有已存資料
|
||||||
|
data-general=資料會自動存到各個服務器中。 你也可以用 /save-data 存一份副本。 也可用 /set-preference 來更改喜好。
|
||||||
|
data-settings=設定
|
||||||
|
data-statistics=數據
|
||||||
|
data-required=需要
|
||||||
|
data-misc=雜項
|
||||||
|
data-format=__1____2__
|
||||||
|
|
||||||
[bonus]
|
[bonus]
|
||||||
description=取得 / 設定 Bonus 量。
|
description=取得 / 設定 Bonus 量。
|
||||||
arg-amount=Bonus 數量, 0 來停用。
|
arg-amount=Bonus 數量, 0 來停用。
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ for _, config_key in ipairs{ "always_protected_names", "always_protected_types",
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Require roles if a permission is assigned in the config
|
-- Require roles if a permission is assigned in the config
|
||||||
local Roles --- @type table<string, any>
|
local Roles
|
||||||
if config.ignore_permission then
|
if config.ignore_permission then
|
||||||
Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,204 @@
|
|||||||
|
--[[-- Control Module - Rockets
|
||||||
|
- Stores rocket stats for each force.
|
||||||
|
@control Rockets
|
||||||
|
@alias Rockets
|
||||||
|
|
||||||
|
@usage
|
||||||
|
-- import the module from the control modules
|
||||||
|
local Rockets = require("modules.exp_legacy.modules.control.rockets") --- @dep modules.control.rockets
|
||||||
|
|
||||||
|
-- Some basic information is stored for each silo that has been built
|
||||||
|
-- the data includes: the tick it was built, the rockets launched from it and more
|
||||||
|
Rockets.get_silo_data(rocket_silo_entity)
|
||||||
|
|
||||||
|
-- Some information is also stored for each force
|
||||||
|
Rockets.get_stats('player')
|
||||||
|
|
||||||
|
-- You can get the rocket data for all silos for a force by using get_silos
|
||||||
|
Rockets.get_silos('player')
|
||||||
|
|
||||||
|
-- You can get the launch time for a rocket, meaning what game tick the 50th rocket was launched
|
||||||
|
Rockets.get_rocket_time('player', 50)
|
||||||
|
|
||||||
|
-- The rolling average will work out the time to launch one rocket based on the last X rockets
|
||||||
|
Rockets.get_rolling_average('player', 10)
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||||
|
local Storage = require("modules/exp_util/storage")
|
||||||
|
local config = require("modules.exp_legacy.config.gui.rockets") --- @dep config.rockets
|
||||||
|
|
||||||
|
local largest_rolling_avg = 0
|
||||||
|
for _, avg_over in pairs(config.stats.rolling_avg) do
|
||||||
|
if avg_over > largest_rolling_avg then
|
||||||
|
largest_rolling_avg = avg_over
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local Rockets = {
|
||||||
|
times = {},
|
||||||
|
stats = {},
|
||||||
|
silos = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
local rocket_times = Rockets.times
|
||||||
|
local rocket_stats = Rockets.stats
|
||||||
|
local rocket_silos = Rockets.silos
|
||||||
|
Storage.register({
|
||||||
|
rocket_times = rocket_times,
|
||||||
|
rocket_stats = rocket_stats,
|
||||||
|
rocket_silos = rocket_silos,
|
||||||
|
}, function(tbl)
|
||||||
|
Rockets.times = tbl.rocket_times
|
||||||
|
Rockets.stats = tbl.rocket_stats
|
||||||
|
Rockets.silos = tbl.rocket_silos
|
||||||
|
rocket_times = Rockets.times
|
||||||
|
rocket_stats = Rockets.stats
|
||||||
|
rocket_silos = Rockets.silos
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- Gets the silo data for a given silo entity
|
||||||
|
--- @param silo LuaEntity Rocket silo entity
|
||||||
|
--- @return table # Data table for this silo, contains rockets launch, silo status, and its force
|
||||||
|
function Rockets.get_silo_data(silo)
|
||||||
|
return rocket_silos[silo.unit_number]
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the silo entity from its silo name, reverse to get_silo_data
|
||||||
|
--- @param silo_name string Silo name that is stored in its data
|
||||||
|
--- @return LuaEntity # Rocket silo entity
|
||||||
|
function Rockets.get_silo_entity(silo_name)
|
||||||
|
return rocket_silos[tonumber(silo_name)].entity
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the rocket stats for a force
|
||||||
|
--- @param force_name string Name of the force to get the stats for
|
||||||
|
--- @return table # Stats for the force
|
||||||
|
function Rockets.get_stats(force_name)
|
||||||
|
return rocket_stats[force_name] or {}
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets all the rocket silos that belong to a force
|
||||||
|
--- @param force_name string Name of the force to get the silos for
|
||||||
|
--- @return table # Array of silo data that all belong to this force
|
||||||
|
function Rockets.get_silos(force_name)
|
||||||
|
local rtn = {}
|
||||||
|
for _, silo_data in pairs(rocket_silos) do
|
||||||
|
if silo_data.force == force_name then
|
||||||
|
table.insert(rtn, silo_data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return rtn
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the launch time of a given rocket, due to cleaning not all counts are valid
|
||||||
|
--- @param force_name string Name of the force to get the count for
|
||||||
|
--- @param rocket_number number Number of the rocket to get the launch time for
|
||||||
|
--- @return number? # Game tick that the rocket was launched on
|
||||||
|
function Rockets.get_rocket_time(force_name, rocket_number)
|
||||||
|
return rocket_times[force_name] and rocket_times[force_name][rocket_number] or nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the number of rockets that a force has launched
|
||||||
|
--- @param force_name string the name of the force to get the count for
|
||||||
|
--- @return number # Number of rockets that the force has launched
|
||||||
|
function Rockets.get_rocket_count(force_name)
|
||||||
|
local force = game.forces[force_name]
|
||||||
|
return force.rockets_launched
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the total number of rockets launched by all forces
|
||||||
|
--- @return number # Total number of rockets launched this game
|
||||||
|
function Rockets.get_game_rocket_count()
|
||||||
|
local rtn = 0
|
||||||
|
for _, force in pairs(game.forces) do
|
||||||
|
rtn = rtn + force.rockets_launched
|
||||||
|
end
|
||||||
|
|
||||||
|
return rtn
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the rolling average time to launch a rocket
|
||||||
|
--- @param force_name string Name of the force to get the average for
|
||||||
|
--- @param count number Distance to get the rolling average over
|
||||||
|
--- @return number # Number of ticks required to launch one rocket
|
||||||
|
function Rockets.get_rolling_average(force_name, count)
|
||||||
|
local force = game.forces[force_name]
|
||||||
|
local rocket_count = force.rockets_launched
|
||||||
|
if rocket_count == 0 then return 0 end
|
||||||
|
local last_launch_time = rocket_times[force_name][rocket_count]
|
||||||
|
local start_rocket_time = 0
|
||||||
|
if count < rocket_count then
|
||||||
|
start_rocket_time = rocket_times[force_name][rocket_count - count + 1]
|
||||||
|
rocket_count = count
|
||||||
|
end
|
||||||
|
return math.floor((last_launch_time - start_rocket_time) / rocket_count)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- When a launch is trigger it will wait for the silo to reset
|
||||||
|
--- @param event EventData.on_rocket_launch_ordered
|
||||||
|
Event.add(defines.events.on_rocket_launch_ordered, function(event)
|
||||||
|
local silo_data = Rockets.get_silo_data(event.rocket_silo)
|
||||||
|
assert(silo_data, "Rocket silo missing data: " .. tostring(event.rocket_silo))
|
||||||
|
silo_data.launched = silo_data.launched + 1
|
||||||
|
silo_data.awaiting_reset = true
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- Event used to update the stats and the hui when a rocket is launched
|
||||||
|
--- @param event EventData.on_cargo_pod_finished_ascending
|
||||||
|
Event.add(defines.events.on_cargo_pod_finished_ascending, function(event)
|
||||||
|
local force = event.cargo_pod.force
|
||||||
|
local force_name = force.name
|
||||||
|
local rockets_launched = force.rockets_launched
|
||||||
|
|
||||||
|
--- Handles updates to the rocket stats
|
||||||
|
local stats = rocket_stats[force_name]
|
||||||
|
if not stats then
|
||||||
|
rocket_stats[force_name] = {}
|
||||||
|
stats = rocket_stats[force_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
if rockets_launched == 1 then
|
||||||
|
stats.first_launch = event.tick
|
||||||
|
stats.fastest_launch = event.tick
|
||||||
|
elseif event.tick - stats.last_launch < stats.fastest_launch then
|
||||||
|
stats.fastest_launch = event.tick - stats.last_launch
|
||||||
|
end
|
||||||
|
|
||||||
|
stats.last_launch = event.tick
|
||||||
|
|
||||||
|
--- Appends the new rocket into the array
|
||||||
|
if not rocket_times[force_name] then
|
||||||
|
rocket_times[force_name] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
rocket_times[force_name][rockets_launched] = event.tick
|
||||||
|
|
||||||
|
local remove_rocket = rockets_launched - largest_rolling_avg
|
||||||
|
if remove_rocket > 0 and not table.contains(config.milestones, remove_rocket) then
|
||||||
|
rocket_times[force_name][remove_rocket] = nil
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- Adds a silo to the list when it is built
|
||||||
|
--- @param event EventData.on_built_entity | EventData.on_robot_built_entity
|
||||||
|
local function on_built(event)
|
||||||
|
local entity = event.entity
|
||||||
|
if entity.valid and entity.name == "rocket-silo" then
|
||||||
|
rocket_silos[entity.unit_number] = {
|
||||||
|
name = tostring(entity.unit_number),
|
||||||
|
force = entity.force.name,
|
||||||
|
entity = entity,
|
||||||
|
launched = 0,
|
||||||
|
awaiting_reset = false,
|
||||||
|
built = game.tick,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Event.add(defines.events.on_built_entity, on_built)
|
||||||
|
Event.add(defines.events.on_robot_built_entity, on_built)
|
||||||
|
|
||||||
|
return Rockets
|
||||||
@@ -4,7 +4,7 @@ local Gui = require("modules/exp_gui")
|
|||||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||||
|
|
||||||
----- Locals -----
|
----- Locals -----
|
||||||
local follow_label --- @type ExpElement Gui constructor
|
local follow_label -- Gui constructor
|
||||||
local following = {}
|
local following = {}
|
||||||
local spectating = {}
|
local spectating = {}
|
||||||
local Public = {}
|
local Public = {}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ local mega = 1000000
|
|||||||
local vlayer = {}
|
local vlayer = {}
|
||||||
local vlayer_data = {
|
local vlayer_data = {
|
||||||
entity_interfaces = {
|
entity_interfaces = {
|
||||||
energy = {}, --- @type LuaEntity[]
|
energy = {},
|
||||||
circuit = {}, --- @type LuaEntity[]
|
circuit = {},
|
||||||
storage_input = {}, --- @type LuaEntity[]
|
storage_input = {},
|
||||||
storage_output = {}, --- @type LuaEntity[]
|
storage_output = {},
|
||||||
},
|
},
|
||||||
properties = {
|
properties = {
|
||||||
total_surface_area = 0,
|
total_surface_area = 0,
|
||||||
@@ -28,10 +28,10 @@ local vlayer_data = {
|
|||||||
capacity = 0,
|
capacity = 0,
|
||||||
},
|
},
|
||||||
storage = {
|
storage = {
|
||||||
items = {}, --- @type table<string, number>
|
items = {},
|
||||||
power_items = {}, --- @type table<string, { value: number, count: number }>
|
power_items = {},
|
||||||
energy = 0,
|
energy = 0,
|
||||||
unallocated = {}, --- @type table<string, number>
|
unallocated = {},
|
||||||
},
|
},
|
||||||
surface = table.deep_copy(config.surface),
|
surface = table.deep_copy(config.surface),
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ for name, properties in pairs(config.allowed_items) do
|
|||||||
|
|
||||||
if properties.power then
|
if properties.power then
|
||||||
vlayer_data.storage.power_items[name] = {
|
vlayer_data.storage.power_items[name] = {
|
||||||
value = assert(properties.fuel_value) * 1000000,
|
value = properties.fuel_value * 1000000,
|
||||||
count = 0,
|
count = 0,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -341,15 +341,15 @@ function vlayer.create_input_interface(surface, position, circuit, last_user)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if circuit then
|
if circuit then
|
||||||
for k, _ in pairs(circuit) do
|
for k, _ in pairs({ defines.wire_connector_id.circuit_red, defines.wire_connector_id.circuit_green }) do
|
||||||
for _, v in pairs(circuit[k]) do
|
for _, v in pairs(circuit.get_wire_connector{ wire_connector_id = k, or_create = false }.real_connections) do
|
||||||
interface.connect_neighbour{ wire = defines.wire_type[k], target_entity = v }
|
interface.connect_to{ target = v.target }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
interface.destructible = false
|
interface.destructible = false
|
||||||
interface.minable_flag = false
|
interface.minable = false
|
||||||
interface.operable = true
|
interface.operable = true
|
||||||
|
|
||||||
return interface
|
return interface
|
||||||
@@ -361,7 +361,7 @@ local function handle_input_interfaces()
|
|||||||
if not interface.valid then
|
if not interface.valid then
|
||||||
vlayer_data.entity_interfaces.storage_input[index] = nil
|
vlayer_data.entity_interfaces.storage_input[index] = nil
|
||||||
else
|
else
|
||||||
local inventory = assert(interface.get_inventory(defines.inventory.chest))
|
local inventory = interface.get_inventory(defines.inventory.chest)
|
||||||
|
|
||||||
for _, v in pairs(inventory.get_contents()) do
|
for _, v in pairs(inventory.get_contents()) do
|
||||||
if config.allowed_items[v.name] then
|
if config.allowed_items[v.name] then
|
||||||
@@ -384,9 +384,8 @@ local function handle_input_interfaces()
|
|||||||
|
|
||||||
if count_deduct and count_add then
|
if count_deduct and count_add then
|
||||||
if config.allowed_items[v.name].modded then
|
if config.allowed_items[v.name].modded then
|
||||||
local modded_item = assert(config.modded_items[v.name])
|
|
||||||
if config.modded_auto_downgrade then
|
if config.modded_auto_downgrade then
|
||||||
vlayer.insert_item(modded_item.base_game_equivalent, count_add * modded_item.multiplier)
|
vlayer.insert_item(config.modded_items[v.name].base_game_equivalent, count_add * config.modded_items[v.name].multiplier)
|
||||||
else
|
else
|
||||||
vlayer.insert_item(v.name, count_add)
|
vlayer.insert_item(v.name, count_add)
|
||||||
end
|
end
|
||||||
@@ -420,15 +419,15 @@ function vlayer.create_output_interface(surface, position, circuit, last_user)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if circuit then
|
if circuit then
|
||||||
for k, _ in pairs(circuit) do
|
for k, _ in pairs({ defines.wire_connector_id.circuit_red, defines.wire_connector_id.circuit_green }) do
|
||||||
for _, v in pairs(circuit[k]) do
|
for _, v in pairs(circuit.get_wire_connector{ wire_connector_id = k, or_create = false }.real_connections) do
|
||||||
interface.connect_neighbour{ wire = defines.wire_type[k], target_entity = v }
|
interface.connect_to{ target = v.target }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
interface.destructible = false
|
interface.destructible = false
|
||||||
interface.minable_flag = false
|
interface.minable = false
|
||||||
interface.operable = true
|
interface.operable = true
|
||||||
|
|
||||||
return interface
|
return interface
|
||||||
@@ -440,14 +439,14 @@ local function handle_output_interfaces()
|
|||||||
if not interface.valid then
|
if not interface.valid then
|
||||||
vlayer_data.entity_interfaces.storage_output[index] = nil
|
vlayer_data.entity_interfaces.storage_output[index] = nil
|
||||||
else
|
else
|
||||||
local inventory = assert(interface.get_inventory(defines.inventory.chest))
|
local inventory = interface.get_inventory(defines.inventory.chest)
|
||||||
local inventory_request_sections = assert(interface.get_logistic_sections()).sections
|
local inventory_request_sections = interface.get_logistic_sections().sections
|
||||||
|
|
||||||
for i = 1, #inventory_request_sections do
|
for i = 1, #inventory_request_sections do
|
||||||
for _, v in pairs(inventory_request_sections[i].filters) do
|
for _, v in pairs(inventory_request_sections[i].filters) do
|
||||||
if v.value and config.allowed_items[v.value.name] then
|
if v.value and config.allowed_items[v.value.name] then
|
||||||
local current_amount = inventory.get_item_count(v.value.name)
|
local current_amount = inventory.get_item_count(v.value.name)
|
||||||
local request_amount = math.min(assert(v.min) - current_amount, vlayer_data.storage.items[v.value.name])
|
local request_amount = math.min(v.min - current_amount, vlayer_data.storage.items[v.value.name])
|
||||||
|
|
||||||
if request_amount > 0 and inventory.can_insert{ name = v.value.name, count = request_amount } then
|
if request_amount > 0 and inventory.can_insert{ name = v.value.name, count = request_amount } then
|
||||||
local removed_item_count = vlayer.remove_item(v.value.name, request_amount)
|
local removed_item_count = vlayer.remove_item(v.value.name, request_amount)
|
||||||
@@ -515,6 +514,9 @@ function vlayer.get_statistics()
|
|||||||
energy_sustained = vdp * gsm,
|
energy_sustained = vdp * gsm,
|
||||||
energy_capacity = vlayer_data.properties.capacity * mega,
|
energy_capacity = vlayer_data.properties.capacity * mega,
|
||||||
energy_storage = vlayer_data.storage.energy,
|
energy_storage = vlayer_data.storage.energy,
|
||||||
|
day_time = math.floor(vlayer_data.surface.daytime * vlayer_data.surface.ticks_per_day),
|
||||||
|
day_length = vlayer_data.surface.ticks_per_day,
|
||||||
|
tick = game.tick,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -538,6 +540,9 @@ function vlayer.get_circuits()
|
|||||||
energy_sustained = "signal-S",
|
energy_sustained = "signal-S",
|
||||||
energy_capacity = "signal-C",
|
energy_capacity = "signal-C",
|
||||||
energy_storage = "signal-E",
|
energy_storage = "signal-E",
|
||||||
|
day_time = "signal-D",
|
||||||
|
day_length = "signal-L",
|
||||||
|
tick = "signal-T",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -561,15 +566,15 @@ function vlayer.create_circuit_interface(surface, position, circuit, last_user)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if circuit then
|
if circuit then
|
||||||
for k, _ in pairs(circuit) do
|
for k, _ in pairs({ defines.wire_connector_id.circuit_red, defines.wire_connector_id.circuit_green }) do
|
||||||
for _, v in pairs(circuit[k]) do
|
for _, v in pairs(circuit.get_wire_connector{ wire_connector_id = k, or_create = false }.real_connections) do
|
||||||
interface.connect_neighbour{ wire = defines.wire_type[k], target_entity = v }
|
interface.connect_to{ target = v.target }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
interface.destructible = false
|
interface.destructible = false
|
||||||
interface.minable_flag = false
|
interface.minable = false
|
||||||
interface.operable = true
|
interface.operable = true
|
||||||
|
|
||||||
return interface
|
return interface
|
||||||
@@ -583,11 +588,11 @@ local function handle_circuit_interfaces()
|
|||||||
if not interface.valid then
|
if not interface.valid then
|
||||||
vlayer_data.entity_interfaces.circuit[index] = nil
|
vlayer_data.entity_interfaces.circuit[index] = nil
|
||||||
else
|
else
|
||||||
local control = interface.get_or_create_control_behavior() --[[@as LuaConstantCombinatorControlBehavior]]
|
local circuit_oc = interface.get_or_create_control_behavior()
|
||||||
if control.sections_count == 0 then
|
if circuit_oc.sections_count == 0 then
|
||||||
control.add_section()
|
circuit_oc.add_section()
|
||||||
end
|
end
|
||||||
local circuit_oc = assert(control.sections[1])
|
circuit_oc = circuit_oc.sections[1]
|
||||||
local signal_index = 1
|
local signal_index = 1
|
||||||
local circuit = vlayer.get_circuits()
|
local circuit = vlayer.get_circuits()
|
||||||
|
|
||||||
@@ -618,7 +623,7 @@ local function handle_circuit_interfaces()
|
|||||||
|
|
||||||
-- Clear remaining signals to prevent outdated values being present (caused by count > 0 check)
|
-- Clear remaining signals to prevent outdated values being present (caused by count > 0 check)
|
||||||
for clear_index = signal_index, #circuit do
|
for clear_index = signal_index, #circuit do
|
||||||
if not circuit_oc.get_slot(clear_index).value then
|
if not circuit_oc.get_slot(clear_index).signal then
|
||||||
break -- There are no more signals to clear
|
break -- There are no more signals to clear
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -648,7 +653,7 @@ function vlayer.create_energy_interface(surface, position, last_user)
|
|||||||
end
|
end
|
||||||
|
|
||||||
interface.destructible = false
|
interface.destructible = false
|
||||||
interface.minable_flag = false
|
interface.minable = false
|
||||||
interface.operable = false
|
interface.operable = false
|
||||||
interface.electric_buffer_size = 0
|
interface.electric_buffer_size = 0
|
||||||
interface.power_production = 0
|
interface.power_production = 0
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ function Warnings.add_warning(player, by_player_name, reason)
|
|||||||
|
|
||||||
reason = reason or "None given."
|
reason = reason or "None given."
|
||||||
|
|
||||||
local warning_count --- @type number
|
local warning_count
|
||||||
PlayerWarnings:update(player.name, function(_, warnings)
|
PlayerWarnings:update(player.name, function(_, warnings)
|
||||||
local warning = {
|
local warning = {
|
||||||
by_player_name = by_player_name,
|
by_player_name = by_player_name,
|
||||||
|
|||||||
@@ -182,13 +182,17 @@ function Warps.make_warp_area(warp_id)
|
|||||||
}
|
}
|
||||||
entity.destructible = false
|
entity.destructible = false
|
||||||
entity.health = 0
|
entity.health = 0
|
||||||
entity.minable_flag = false
|
entity.minable = false
|
||||||
entity.rotatable = false
|
entity.rotatable = false
|
||||||
|
|
||||||
-- Save reference of the last power pole
|
-- Save reference of the last power pole
|
||||||
if entity.type == "electric-pole" then
|
if entity.type == "electric-pole" then
|
||||||
warp.electric_pole = entity
|
warp.electric_pole = entity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if entity.name == "small-lamp" then
|
||||||
|
entity.always_on = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
--[[-- Commands Module - Bonus
|
||||||
|
- Adds a command that allows players to have increased stats
|
||||||
|
@data Bonus
|
||||||
|
]]
|
||||||
|
|
||||||
|
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||||
|
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||||
|
local config = require("modules.exp_legacy.config.bonus") --- @dep config.bonuses
|
||||||
|
local Commands = require("modules/exp_commands")
|
||||||
|
|
||||||
|
-- Stores the bonus for the player
|
||||||
|
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||||
|
local PlayerBonus = PlayerData.Settings:combine("Bonus")
|
||||||
|
PlayerBonus:set_default(0)
|
||||||
|
PlayerBonus:set_metadata{
|
||||||
|
permission = "command/bonus",
|
||||||
|
stringify = function(value)
|
||||||
|
if not value or value == 0 then
|
||||||
|
return "None set"
|
||||||
|
end
|
||||||
|
|
||||||
|
return value
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Apply a bonus to a player
|
||||||
|
local function apply_bonus(player, stage)
|
||||||
|
if not player.character then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in pairs(config.player_bonus) do
|
||||||
|
player[k] = v.value * stage / 10
|
||||||
|
|
||||||
|
if v.combined_bonus then
|
||||||
|
for i = 1, #v.combined_bonus, 1 do
|
||||||
|
player[v.combined_bonus[i]] = v.value * stage / 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- When store is updated apply new bonus to the player
|
||||||
|
PlayerBonus:on_update(function(player_name, player_bonus)
|
||||||
|
apply_bonus(game.players[player_name], player_bonus or 0)
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- Changes the amount of bonus you receive
|
||||||
|
Commands.new("bonus", { "bonus.description" })
|
||||||
|
:optional("amount", { "bonus.arg-amount" }, Commands.types.integer_range(0, 10))
|
||||||
|
:register(function(player, amount)
|
||||||
|
--- @cast amount number?
|
||||||
|
if amount then
|
||||||
|
PlayerBonus:set(player, amount)
|
||||||
|
return Commands.status.success{ "bonus.set", amount }
|
||||||
|
else
|
||||||
|
return Commands.status.success{ "bonus.get", PlayerBonus:get(player) }
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- When a player respawns re-apply bonus
|
||||||
|
Event.add(defines.events.on_player_respawned, function(event)
|
||||||
|
local player = game.players[event.player_index]
|
||||||
|
apply_bonus(player, PlayerBonus:get(player))
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- Remove bonus if a player no longer has access to the command
|
||||||
|
local function role_update(event)
|
||||||
|
local player = game.players[event.player_index]
|
||||||
|
if not Roles.player_allowed(player, "command/bonus") then
|
||||||
|
apply_bonus(player, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- When a player dies allow them to have instant respawn
|
||||||
|
Event.add(defines.events.on_player_died, function(event)
|
||||||
|
local player = game.players[event.player_index]
|
||||||
|
|
||||||
|
if Roles.player_has_flag(player, "instant-respawn") then
|
||||||
|
player.ticks_to_respawn = 120
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
Event.add(defines.events.on_player_created, function(event)
|
||||||
|
if event.player_index ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in pairs(config.force_bonus) do
|
||||||
|
game.players[event.player_index].force[k] = v.value
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in pairs(config.surface_bonus) do
|
||||||
|
game.players[event.player_index].surface[k] = v.value
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
Event.add(Roles.events.on_role_assigned, role_update)
|
||||||
|
Event.add(Roles.events.on_role_unassigned, role_update)
|
||||||
@@ -5,10 +5,6 @@ local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
|||||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||||
local LocalLanguage = PlayerData.Statistics:combine("LocalLanguage")
|
local LocalLanguage = PlayerData.Statistics:combine("LocalLanguage")
|
||||||
LocalLanguage:set_default("Unknown")
|
LocalLanguage:set_default("Unknown")
|
||||||
LocalLanguage:set_metadata{
|
|
||||||
name = { "exp-statistics.Locale" },
|
|
||||||
tooltip = { "exp-statistics.Locale-tooltip" },
|
|
||||||
}
|
|
||||||
|
|
||||||
local function set_locale(event)
|
local function set_locale(event)
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
local Commands = require("modules/exp_commands")
|
||||||
|
local config = require("modules.exp_legacy.config.personal_logistic") --- @dep config.personal-logistic
|
||||||
|
|
||||||
|
---@param target LuaEntity | LuaPlayer
|
||||||
|
---@param amount number
|
||||||
|
local function pl(target, amount)
|
||||||
|
local c
|
||||||
|
local s
|
||||||
|
|
||||||
|
--- @cast target any Remove cast once implemented
|
||||||
|
error("Needs updating to use 2.0 logistics")
|
||||||
|
|
||||||
|
if target.object_name == "LuaPlayer" then
|
||||||
|
c = target.clear_personal_logistic_slot
|
||||||
|
s = target.set_personal_logistic_slot
|
||||||
|
else
|
||||||
|
c = target.clear_vehicle_logistic_slot
|
||||||
|
s = target.set_vehicle_logistic_slot
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, v in pairs(config.request) do
|
||||||
|
c(config.start + v.key)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (amount < 0) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local stats = target.force.get_item_production_statistics(target.surface)
|
||||||
|
|
||||||
|
for k, v in pairs(config.request) do
|
||||||
|
local v_min = math.ceil(v.min * amount)
|
||||||
|
local v_max = math.ceil(v.max * amount)
|
||||||
|
|
||||||
|
if v.stack ~= nil and v.stack ~= 1 and v.type ~= "weapon" then
|
||||||
|
v_min = math.floor(v_min / v.stack) * v.stack
|
||||||
|
v_max = math.ceil(v_max / v.stack) * v.stack
|
||||||
|
end
|
||||||
|
|
||||||
|
if v.upgrade_of == nil then
|
||||||
|
if v.type ~= nil then
|
||||||
|
if stats.get_input_count(k) < config.production_required[v.type] then
|
||||||
|
if v_min > 0 then
|
||||||
|
if v_min == v_max then
|
||||||
|
v_min = math.floor((v_max * 0.5) / v.stack) * v.stack
|
||||||
|
end
|
||||||
|
else
|
||||||
|
v_min = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
s(config.start + v.key, { name = k, min = v_min, max = v_max })
|
||||||
|
else
|
||||||
|
if v.type ~= nil then
|
||||||
|
if stats.get_input_count(k) >= config.production_required[v.type] then
|
||||||
|
s(config.start + v.key, { name = k, min = v_min, max = v_max })
|
||||||
|
local vuo = v.upgrade_of
|
||||||
|
|
||||||
|
while (vuo ~= nil) do
|
||||||
|
s(config.start + config.request[vuo].key, { name = vuo, min = 0, max = 0 })
|
||||||
|
vuo = config.request[vuo].upgrade_of
|
||||||
|
end
|
||||||
|
else
|
||||||
|
s(config.start + v.key, { name = k, min = 0, max = v_max })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Commands.new("personal-logistic", "Set Personal Logistic (-1 to cancel all) (Select spidertron to edit spidertron)")
|
||||||
|
:argument("amount", "", Commands.types.integer_range(-1, 10))
|
||||||
|
:add_aliases{ "pl" }
|
||||||
|
:add_flags{ "disabled" } -- Remove once implemented above
|
||||||
|
:register(function(player, amount)
|
||||||
|
--- @cast amount number
|
||||||
|
if player.force.technologies["logistic-robotics"].researched then
|
||||||
|
if player.selected ~= nil then
|
||||||
|
if player.selected.name == "spidertron" then
|
||||||
|
pl(player.selected, amount / 10)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
pl(player, amount / 10)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return Commands.status.error("Personal Logistic not researched")
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -43,14 +43,10 @@ local ignored_items = {
|
|||||||
--- Saves your quickbar preset to the script-output folder
|
--- Saves your quickbar preset to the script-output folder
|
||||||
Commands.new("save-quickbar", "Saves your Quickbar preset items to file")
|
Commands.new("save-quickbar", "Saves your Quickbar preset items to file")
|
||||||
:add_aliases{ "save-toolbar" }
|
:add_aliases{ "save-toolbar" }
|
||||||
:add_flags{ "disabled" }
|
|
||||||
:register(function(player)
|
:register(function(player)
|
||||||
local filters = {}
|
local filters = {}
|
||||||
|
|
||||||
error("2.1 changes to get_quick_bar_slot beak compatibility with 2.0; waiting for upstream")
|
|
||||||
-- Upstream may add method to compat, or change inventory sync to have a quickbar only mode
|
|
||||||
for i = 1, 100 do
|
for i = 1, 100 do
|
||||||
--[[
|
|
||||||
local slot = player.get_quick_bar_slot(i)
|
local slot = player.get_quick_bar_slot(i)
|
||||||
-- Need to filter out blueprint and blueprint books because the slot is a LuaItemPrototype and does not contain a way to export blueprint data
|
-- Need to filter out blueprint and blueprint books because the slot is a LuaItemPrototype and does not contain a way to export blueprint data
|
||||||
if slot ~= nil then
|
if slot ~= nil then
|
||||||
@@ -59,7 +55,6 @@ Commands.new("save-quickbar", "Saves your Quickbar preset items to file")
|
|||||||
filters[i] = slot.name
|
filters[i] = slot.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if next(filters) then
|
if next(filters) then
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ ToolbarState:on_load(function(player_name, value)
|
|||||||
|
|
||||||
local decompressed = helpers.json_to_table(assert(helpers.decode_string(value), "Failed String Decode"))
|
local decompressed = helpers.json_to_table(assert(helpers.decode_string(value), "Failed String Decode"))
|
||||||
local player = assert(game.get_player(player_name))
|
local player = assert(game.get_player(player_name))
|
||||||
Gui.toolbar.set_state(player, decompressed --[[@as Gui.ToolbarState]])
|
Gui.toolbar.set_state(player, decompressed --[[ @as Gui.ToolbarState ]])
|
||||||
|
|
||||||
return nil -- We don't save the state, use Gui.toolbar.get_state
|
return nil -- We don't save the state, use Gui.toolbar.get_state
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -126,19 +126,19 @@ lib.collect_loginet = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if config.modules.logistorage then
|
if config.modules.logistorage then
|
||||||
for _, item in pairs(network.get_contents()) do
|
for name, v in pairs(network.get_contents()) do
|
||||||
stats.items[item.name] = (stats.items[item.name] or 0) + item.count
|
stats.items[name] = (stats.items[name] or 0) + v
|
||||||
end
|
end
|
||||||
|
|
||||||
-- pickups and deliveries of items
|
-- pickups and deliveries of items
|
||||||
for _, point_list in pairs{ network.provider_points, network.requester_points, network.storage_points } do
|
for _, point_list in pairs{ network.provider_points, network.requester_points, network.storage_points } do
|
||||||
for _, point in pairs(point_list) do
|
for _, point in pairs(point_list) do
|
||||||
for _, item in pairs(point.targeted_items_pickup) do
|
for name, qty in pairs(point.targeted_items_pickup) do
|
||||||
stats.pickups[item.name] = (stats.pickups[item.name] or 0) + item.count
|
stats.pickups[name] = (stats.pickups[name] or 0) + qty
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, item in pairs(point.targeted_items_deliver) do
|
for name, qty in pairs(point.targeted_items_deliver) do
|
||||||
stats.deliveries[item.name] = (stats.deliveries[item.name] or 0) + item.count
|
stats.deliveries[name] = (stats.deliveries[name] or 0) + qty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ local Gui = require("modules/exp_gui")
|
|||||||
local Roles = require("modules.exp_legacy.expcore.roles")
|
local Roles = require("modules.exp_legacy.expcore.roles")
|
||||||
local Event = require("modules/exp_legacy/utils/event")
|
local Event = require("modules/exp_legacy/utils/event")
|
||||||
|
|
||||||
--- @diagnostic disable: access-invisible
|
--- @diagnostic disable invisible
|
||||||
Event.add(Roles.events.on_role_assigned, Gui._ensure_consistency)
|
Event.add(Roles.events.on_role_assigned, Gui._ensure_consistency)
|
||||||
Event.add(Roles.events.on_role_unassigned, Gui._ensure_consistency)
|
Event.add(Roles.events.on_role_unassigned, Gui._ensure_consistency)
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
local Gui = require("modules/exp_scenario/gui/debug/shim")
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local Model = require("modules/exp_scenario/gui/debug/model")
|
local Model = require("modules.exp_legacy.modules.gui.debug.model") --- @dep modules.gui.debug.model
|
||||||
local Color = require("modules/exp_util/include/color")
|
local Color = require("modules/exp_util/include/color")
|
||||||
|
|
||||||
local dump = Model.dump
|
local dump = Model.dump
|
||||||
+4
-4
@@ -1,6 +1,7 @@
|
|||||||
|
local Event = require("modules/exp_legacy/utils/event")
|
||||||
local Storage = require("modules/exp_util/storage")
|
local Storage = require("modules/exp_util/storage")
|
||||||
local Gui = require("modules/exp_scenario/gui/debug/shim")
|
local Gui = require("modules.exp_legacy.utils.gui")
|
||||||
local Model = require("modules/exp_scenario/gui/debug/model")
|
local Model = require("modules.exp_legacy.modules.gui.debug.model")
|
||||||
|
|
||||||
local format = string.format
|
local format = string.format
|
||||||
local insert = table.insert
|
local insert = table.insert
|
||||||
@@ -13,7 +14,6 @@ local events_to_keep = 10
|
|||||||
-- Local vars
|
-- Local vars
|
||||||
local Public = {
|
local Public = {
|
||||||
name = "Events",
|
name = "Events",
|
||||||
events = {}
|
|
||||||
}
|
}
|
||||||
local name_lookup = {}
|
local name_lookup = {}
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ Gui.on_click(
|
|||||||
-- Event registers (TODO: turn to removable hooks.. maybe)
|
-- Event registers (TODO: turn to removable hooks.. maybe)
|
||||||
for name, id in pairs(events) do
|
for name, id in pairs(events) do
|
||||||
name_lookup[id] = name
|
name_lookup[id] = name
|
||||||
Public.events[id] = event_callback
|
Event.add(id, event_callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Public
|
return Public
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
local Gui = require("modules/exp_scenario/gui/debug/shim")
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local Datastore = require("modules.exp_legacy.expcore.datastore")
|
local Datastore = require("modules.exp_legacy.expcore.datastore") --- @dep expcore.datastore
|
||||||
local Color = require("modules/exp_util/include/color")
|
local Color = require("modules/exp_util/include/color")
|
||||||
local Model = require("modules/exp_scenario/gui/debug/model")
|
local Model = require("modules.exp_legacy.modules.gui.debug.model") --- @dep modules.gui.debug.model
|
||||||
|
|
||||||
local dump = Model.dump
|
local dump = Model.dump
|
||||||
local concat = table.concat
|
local concat = table.concat
|
||||||
+9
-9
@@ -3,8 +3,8 @@ local ExpData = require("modules/exp_gui/data")
|
|||||||
local ExpIter = require("modules/exp_gui/iter")
|
local ExpIter = require("modules/exp_gui/iter")
|
||||||
local Color = require("modules/exp_util/include/color")
|
local Color = require("modules/exp_util/include/color")
|
||||||
|
|
||||||
local Gui = require("modules/exp_scenario/gui/debug/shim")
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local Model = require("modules/exp_scenario/gui/debug/model")
|
local Model = require("modules.exp_legacy.modules.gui.debug.model") --- @dep modules.gui.debug.model
|
||||||
|
|
||||||
local dump = Model.dump
|
local dump = Model.dump
|
||||||
local dump_text = Model.dump_text
|
local dump_text = Model.dump_text
|
||||||
@@ -27,7 +27,7 @@ function Public.show(container)
|
|||||||
local left_panel_style = left_panel.style
|
local left_panel_style = left_panel.style
|
||||||
left_panel_style.width = 300
|
left_panel_style.width = 300
|
||||||
|
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
for element_name in pairs(ExpElement._elements) do
|
for element_name in pairs(ExpElement._elements) do
|
||||||
local header = left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = element_name }
|
local header = left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = element_name }
|
||||||
Gui.set_data(header, element_name)
|
Gui.set_data(header, element_name)
|
||||||
@@ -92,18 +92,18 @@ Gui.on_click(
|
|||||||
input_text_box.text = concat{ "ExpElement._elements[\"", element_name, "\"]" }
|
input_text_box.text = concat{ "ExpElement._elements[\"", element_name, "\"]" }
|
||||||
input_text_box.style.font_color = Color.black
|
input_text_box.style.font_color = Color.black
|
||||||
|
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
local define = ExpElement._elements[element_name]
|
local define = ExpElement._elements[element_name]
|
||||||
local content = dump({
|
local content = dump({
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
debug = define._debug,
|
debug = define._debug,
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
has_handlers = define._has_handlers,
|
has_handlers = define._has_handlers,
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
track_elements = define._track_elements,
|
track_elements = define._track_elements,
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
elements = ExpIter._scopes[element_name],
|
elements = ExpIter._scopes[element_name],
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
data = ExpData._scopes[element_name]._raw,
|
data = ExpData._scopes[element_name]._raw,
|
||||||
}) or "nil"
|
}) or "nil"
|
||||||
right_panel.text = content
|
right_panel.text = content
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
local Gui = require("modules/exp_scenario/gui/debug/shim")
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local Model = require("modules/exp_scenario/gui/debug/model")
|
local Model = require("modules.exp_legacy.modules.gui.debug.model") --- @dep modules.gui.debug.model
|
||||||
local Color = require("modules/exp_util/include/color")
|
local Color = require("modules/exp_util/include/color")
|
||||||
|
|
||||||
local dump = Model.dump
|
local dump = Model.dump
|
||||||
+8
-8
@@ -1,16 +1,16 @@
|
|||||||
local Gui = require("modules/exp_scenario/gui/debug/shim")
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local Color = require("modules/exp_util/include/color")
|
local Color = require("modules/exp_util/include/color")
|
||||||
|
|
||||||
local Public = {}
|
local Public = {}
|
||||||
|
|
||||||
local pages = {
|
local pages = {
|
||||||
require("modules/exp_scenario/gui/debug/redmew_global_view"),
|
require("modules.exp_legacy.modules.gui.debug.redmew_global_view"),
|
||||||
require("modules/exp_scenario/gui/debug/expcore_datastore_view"),
|
require("modules.exp_legacy.modules.gui.debug.expcore_datastore_view"),
|
||||||
require("modules/exp_scenario/gui/debug/expcore_gui_view"),
|
require("modules.exp_legacy.modules.gui.debug.expcore_gui_view"),
|
||||||
require("modules/exp_scenario/gui/debug/global_view"),
|
require("modules.exp_legacy.modules.gui.debug.global_view"),
|
||||||
require("modules/exp_scenario/gui/debug/package_view"),
|
require("modules.exp_legacy.modules.gui.debug.package_view"),
|
||||||
require("modules/exp_scenario/gui/debug/_g_view"),
|
require("modules.exp_legacy.modules.gui.debug._g_view"),
|
||||||
require("modules/exp_scenario/gui/debug/event_view"),
|
require("modules.exp_legacy.modules.gui.debug.event_view"),
|
||||||
}
|
}
|
||||||
|
|
||||||
local main_frame_name = Gui.uid_name()
|
local main_frame_name = Gui.uid_name()
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
local Gui = require("modules/exp_scenario/gui/debug/shim") --- @dep utils.gui
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local ExpUtil = require("modules/exp_util")
|
local ExpUtil = require("modules/exp_util")
|
||||||
|
|
||||||
local concat = table.concat
|
local concat = table.concat
|
||||||
local inspect = table.inspect
|
local inspect = table.inspect
|
||||||
local pcall = pcall
|
local pcall = pcall
|
||||||
local loadstring = load
|
local loadstring = loadstring --- @diagnostic disable-line
|
||||||
local rawset = rawset
|
local rawset = rawset
|
||||||
|
|
||||||
local Public = {}
|
local Public = {}
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
local Gui = require("modules/exp_scenario/gui/debug/shim") --- @dep utils.gui
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local Color = require("modules/exp_util/include/color")
|
local Color = require("modules/exp_util/include/color")
|
||||||
local Model = require("modules/exp_scenario/gui/debug/model") --- @dep modules.gui.debug.model
|
local Model = require("modules.exp_legacy.modules.gui.debug.model") --- @dep modules.gui.debug.model
|
||||||
|
|
||||||
local dump_function = Model.dump_function
|
local dump_function = Model.dump_function
|
||||||
local loaded = _G.package.loaded
|
local loaded = _G.package.loaded
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
local Gui = require("modules/exp_scenario/gui/debug/shim") --- @dep utils.gui
|
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||||
local Storage = require("modules/exp_util/storage")
|
local Storage = require("modules/exp_util/storage")
|
||||||
local Color = require("modules/exp_util/include/color")
|
local Color = require("modules/exp_util/include/color")
|
||||||
local Model = require("modules/exp_scenario/gui/debug/model") --- @dep modules.gui.debug.model
|
local Model = require("modules.exp_legacy.modules.gui.debug.model") --- @dep modules.gui.debug.model
|
||||||
|
|
||||||
local dump = Model.dump
|
local dump = Model.dump
|
||||||
local dump_text = Model.dump_text
|
local dump_text = Model.dump_text
|
||||||
@@ -24,7 +24,7 @@ function Public.show(container)
|
|||||||
local left_panel_style = left_panel.style
|
local left_panel_style = left_panel.style
|
||||||
left_panel_style.width = 300
|
left_panel_style.width = 300
|
||||||
|
|
||||||
--- @diagnostic disable-next-line: access-invisible
|
--- @diagnostic disable-next-line invisible
|
||||||
for token_id in pairs(Storage._registered) do
|
for token_id in pairs(Storage._registered) do
|
||||||
local header = left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = token_id }
|
local header = left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = token_id }
|
||||||
Gui.set_data(header, token_id)
|
Gui.set_data(header, token_id)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user