Compare commits
978 Commits
5.4.2-andr
...
5.6.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53dd648c96 | ||
|
|
c4277877b6 | ||
|
|
eb49b6d85c | ||
|
|
b91063daef | ||
|
|
7c14b434e0 | ||
|
|
644f145ff2 | ||
|
|
a81259d19a | ||
|
|
f22d40975e | ||
|
|
4c1ef1b72b | ||
|
|
6ec6acc539 | ||
|
|
839600ed70 | ||
|
|
a2bf3a2aa8 | ||
|
|
9542ab5efb | ||
|
|
68a273102f | ||
|
|
13bb815b32 | ||
|
|
ccb982513a | ||
|
|
ef6ca6319b | ||
|
|
5192ce4330 | ||
|
|
62624722d8 | ||
|
|
b2d82125ec | ||
|
|
e80f695bb9 | ||
|
|
d9d38d2172 | ||
|
|
84e939193e | ||
|
|
56811c63d1 | ||
|
|
a4b1e0d124 | ||
|
|
70b71c5013 | ||
|
|
95d7fcb949 | ||
|
|
de509d05e6 | ||
|
|
c14b7536a4 | ||
|
|
a871115889 | ||
|
|
6a269d58ef | ||
|
|
3b37bcd994 | ||
|
|
99c8295e71 | ||
|
|
6611d7e1ee | ||
|
|
f0703f3c5b | ||
|
|
7e78c0171e | ||
|
|
175e132576 | ||
|
|
71f6a5f44e | ||
|
|
d631f21024 | ||
|
|
2351c95612 | ||
|
|
8dcbca1068 | ||
|
|
2183b35ba4 | ||
|
|
2cf52642fa | ||
|
|
eea2a97475 | ||
|
|
71f083d4ad | ||
|
|
32ef0678e5 | ||
|
|
e719690100 | ||
|
|
53fb958f45 | ||
|
|
ea51073e87 | ||
|
|
116de34438 | ||
|
|
816206321e | ||
|
|
eaa9ab754f | ||
|
|
5bd09907a9 | ||
|
|
7a76a00b62 | ||
|
|
cd96c6934d | ||
|
|
356fdc3cf5 | ||
|
|
7001d3de60 | ||
|
|
b64e030e92 | ||
|
|
9bb2cca842 | ||
|
|
639bcd3cae | ||
|
|
cdb9e3dea6 | ||
|
|
4c15dcbe89 | ||
|
|
cd2d25def7 | ||
|
|
2e816c0c1a | ||
|
|
3888376be3 | ||
|
|
71b8204652 | ||
|
|
62d74507d4 | ||
|
|
5d0235e757 | ||
|
|
29fa11ef4d | ||
|
|
919e5fbc5a | ||
|
|
259ceee478 | ||
|
|
ef9cca2f6e | ||
|
|
ae58485b67 | ||
|
|
731ac55a1b | ||
|
|
804fb825bb | ||
|
|
a0b966c5b4 | ||
|
|
001ad8e51b | ||
|
|
e0259b310b | ||
|
|
010694f64c | ||
|
|
398c7bded1 | ||
|
|
1327039824 | ||
|
|
1870c28397 | ||
|
|
a36d6b3688 | ||
|
|
d066cd1ff6 | ||
|
|
7c4db9f425 | ||
|
|
72a6724a46 | ||
|
|
df9b7f6b70 | ||
|
|
3e122f3eff | ||
|
|
6dac32e165 | ||
|
|
24fd5c39f5 | ||
|
|
9f66974cd4 | ||
|
|
c0e03f7ce7 | ||
|
|
93247a8a35 | ||
|
|
efcd1ff707 | ||
|
|
7b242d787e | ||
|
|
68ca317ec2 | ||
|
|
de76686bdc | ||
|
|
c792f3bf57 | ||
|
|
3903a1b4af | ||
|
|
106f0e3af6 | ||
|
|
f275a66f91 | ||
|
|
37f559b4b1 | ||
|
|
1aec8ed330 | ||
|
|
b6f0ebf968 | ||
|
|
3a60050ddd | ||
|
|
bfdbcf1955 | ||
|
|
e5e94070d6 | ||
|
|
70c54abc2a | ||
|
|
b270a46e53 | ||
|
|
d400a98ef0 | ||
|
|
7b6c4bf2e0 | ||
|
|
f090471022 | ||
|
|
4648d8f499 | ||
|
|
5cc7329717 | ||
|
|
9f41b4f72d | ||
|
|
06de82fd86 | ||
|
|
1d512ef7f4 | ||
|
|
8ff3fadba0 | ||
|
|
137eef6590 | ||
|
|
b204655081 | ||
|
|
f4c6ed863d | ||
|
|
ac4eb746fe | ||
|
|
6df69f9b5b | ||
|
|
20bd6bdb68 | ||
|
|
8724fe6e3f | ||
|
|
fae8726a76 | ||
|
|
e51f474613 | ||
|
|
051181fa6e | ||
|
|
7c261118e0 | ||
|
|
b15393c2a5 | ||
|
|
0e63f18a73 | ||
|
|
fc3460470a | ||
|
|
34f15259fa | ||
|
|
f7bcf7fa46 | ||
|
|
5a562a597c | ||
|
|
3e308584a3 | ||
|
|
9ac3b52fdc | ||
|
|
142928e944 | ||
|
|
b095dc4f2b | ||
|
|
45da0d43fd | ||
|
|
7494ff2917 | ||
|
|
de8ce9a8ff | ||
|
|
17709d7d0f | ||
|
|
a5f385917d | ||
|
|
18fbc0394b | ||
|
|
35ad006234 | ||
|
|
4163c872af | ||
|
|
4b087a0de2 | ||
|
|
a463620edb | ||
|
|
0b41533763 | ||
|
|
e92a217bd1 | ||
|
|
a83d81ff45 | ||
|
|
ae555465ba | ||
|
|
622d857bed | ||
|
|
0530ec11c0 | ||
|
|
46e7b51352 | ||
|
|
e9e721b937 | ||
|
|
992f501159 | ||
|
|
0f3f1a001c | ||
|
|
804c255941 | ||
|
|
c10fe7ec18 | ||
|
|
7ffc0268df | ||
|
|
e7d4ec6834 | ||
|
|
f4a53f7ee6 | ||
|
|
3eafcab64e | ||
|
|
ba65e0ace7 | ||
|
|
213d3562bd | ||
|
|
3ac5a24b12 | ||
|
|
3107c98591 | ||
|
|
edc7df5480 | ||
|
|
951604e29f | ||
|
|
381f84ee27 | ||
|
|
14c283a623 | ||
|
|
4baf56520d | ||
|
|
a69b7abe00 | ||
|
|
03d86ea0b4 | ||
|
|
21323ef1ff | ||
|
|
1f39948bc3 | ||
|
|
e82985c0a1 | ||
|
|
8e5bd82c4d | ||
|
|
575caa8015 | ||
|
|
5f3af7d18b | ||
|
|
6a6b579c54 | ||
|
|
6d163b72dc | ||
|
|
b72932b445 | ||
|
|
9fc018ded1 | ||
|
|
a9a207685a | ||
|
|
c1d03695d4 | ||
|
|
ea74680df4 | ||
|
|
bb671c3089 | ||
|
|
1b68fb7683 | ||
|
|
303329f2d6 | ||
|
|
85c824ed13 | ||
|
|
998e4820c9 | ||
|
|
5cd7b0c6e4 | ||
|
|
8908a91016 | ||
|
|
261a8db9dd | ||
|
|
f195db2d14 | ||
|
|
da71e86633 | ||
|
|
bccaf5fc2d | ||
|
|
0c6a029413 | ||
|
|
25ba9d848d | ||
|
|
76000e676b | ||
|
|
e8b2954586 | ||
|
|
fe299e24d6 | ||
|
|
ef22c0206f | ||
|
|
8b74257bf3 | ||
|
|
9a01581cdd | ||
|
|
5d26ac0088 | ||
|
|
ed26ed5a1f | ||
|
|
16a30556df | ||
|
|
5daafc9d33 | ||
|
|
e16a470d59 | ||
|
|
367a2d4b29 | ||
|
|
0f9c78c3eb | ||
|
|
c660218e43 | ||
|
|
fa682270a9 | ||
|
|
ac5e8176b9 | ||
|
|
9f338f5a56 | ||
|
|
2742fef458 | ||
|
|
bc59fcf5c5 | ||
|
|
2f32044273 | ||
|
|
371f21fb35 | ||
|
|
8edc0fae5f | ||
|
|
e1f707d7e1 | ||
|
|
9ee3dc71f1 | ||
|
|
70dc23f996 | ||
|
|
4e9e230e34 | ||
|
|
dc45b85a54 | ||
|
|
a4ef62f5b2 | ||
|
|
604fb2b738 | ||
|
|
273bfee9a1 | ||
|
|
af37f9dc54 | ||
|
|
db9b3aff75 | ||
|
|
eabf05758e | ||
|
|
8756b7a735 | ||
|
|
ec9f157512 | ||
|
|
7f58887ae3 | ||
|
|
d17d7eba14 | ||
|
|
4fb4991f5e | ||
|
|
0f8c46771e | ||
|
|
f5a8593b11 | ||
|
|
c2898f53bc | ||
|
|
089797dbe6 | ||
|
|
53c70b5f27 | ||
|
|
a66e6d4dff | ||
|
|
1fa4f58080 | ||
|
|
7fff9da71d | ||
|
|
f128f4cba1 | ||
|
|
6f0c966877 | ||
|
|
f10a260301 | ||
|
|
54bc8a7627 | ||
|
|
9824a451bb | ||
|
|
e0e897832c | ||
|
|
87472150bc | ||
|
|
45d318a773 | ||
|
|
4e1de06782 | ||
|
|
8735a85a30 | ||
|
|
e108954633 | ||
|
|
47cf257c40 | ||
|
|
cc56ebd90d | ||
|
|
89c82035d8 | ||
|
|
3ce5a68cd1 | ||
|
|
0704ca0550 | ||
|
|
ae7664597e | ||
|
|
e9e671078c | ||
|
|
71a56c3552 | ||
|
|
e7659883cc | ||
|
|
663c936428 | ||
|
|
56a558baf8 | ||
|
|
e6385e2ab7 | ||
|
|
5362f472ff | ||
|
|
41e79d902d | ||
|
|
c7bcebb628 | ||
|
|
a89afe1229 | ||
|
|
faecff570c | ||
|
|
828461c193 | ||
|
|
ec4a789b4f | ||
|
|
a65f6f07f3 | ||
|
|
00f71c3b9d | ||
|
|
3d2bf8fb02 | ||
|
|
391eec9ee7 | ||
|
|
0d91ef78dd | ||
|
|
7e18a1f1be | ||
|
|
7f4fc6f8a7 | ||
|
|
a2f13e479b | ||
|
|
fccf1e2eac | ||
|
|
480d5f2d51 | ||
|
|
a6170963b8 | ||
|
|
77325b92fb | ||
|
|
b55d7cd45a | ||
|
|
23f981c458 | ||
|
|
48d1bca9b8 | ||
|
|
a13cf0e3ce | ||
|
|
1c8614ac9a | ||
|
|
4558793caf | ||
|
|
583257f093 | ||
|
|
7cea688a1c | ||
|
|
062dd8dabc | ||
|
|
1d07a36552 | ||
|
|
a5d29fa1d4 | ||
|
|
9aabd911eb | ||
|
|
1f27bf6380 | ||
|
|
2d8eac4e0a | ||
|
|
833538cc90 | ||
|
|
80db8804c7 | ||
|
|
d9effbb179 | ||
|
|
24a0f55c9c | ||
|
|
f5e54cd398 | ||
|
|
c9317a16c5 | ||
|
|
dae6fe91a1 | ||
|
|
65fdc7ae50 | ||
|
|
00ebedad93 | ||
|
|
35bfffb556 | ||
|
|
8af332c9a7 | ||
|
|
7993909fab | ||
|
|
88b21a72f1 | ||
|
|
ea2fba877a | ||
|
|
5683bb76cc | ||
|
|
3a87fab6c8 | ||
|
|
23516acd0b | ||
|
|
48f7c5603e | ||
|
|
0b5b2b2633 | ||
|
|
1348d9aaf8 | ||
|
|
21f17e871e | ||
|
|
837cea6b4a | ||
|
|
b0b9732359 | ||
|
|
26c046a563 | ||
|
|
cf650fcaac | ||
|
|
3dd7d7867b | ||
|
|
31578303a4 | ||
|
|
06d197cdd0 | ||
|
|
11aab4198b | ||
|
|
8d387433b1 | ||
|
|
0f25fa7af6 | ||
|
|
8d55702d13 | ||
|
|
e54f5e544f | ||
|
|
289c3ff377 | ||
|
|
11f3f72f1c | ||
|
|
ad7c72c164 | ||
|
|
51294163bb | ||
|
|
598efbf7f9 | ||
|
|
b651bbf446 | ||
|
|
4801bdf45a | ||
|
|
25c1974e0d | ||
|
|
12896b22d8 | ||
|
|
e531c59606 | ||
|
|
8f652f4e31 | ||
|
|
97cb404822 | ||
|
|
d2a3bed240 | ||
|
|
e4583cb9b7 | ||
|
|
a684a91bf5 | ||
|
|
1175f48d05 | ||
|
|
54dccc480e | ||
|
|
f2cccf8da7 | ||
|
|
10be033791 | ||
|
|
4e39cdef94 | ||
|
|
2bba53b2c3 | ||
|
|
b9e886726c | ||
|
|
44fc888bd6 | ||
|
|
f2d1295fe6 | ||
|
|
04bd253390 | ||
|
|
7db751df3b | ||
|
|
f7311e0d97 | ||
|
|
633e23bd65 | ||
|
|
7c227d2a00 | ||
|
|
0a0fb11c21 | ||
|
|
c31b301722 | ||
|
|
5d0b18a0d0 | ||
|
|
258ae99491 | ||
|
|
10cf2f3edd | ||
|
|
0cd9c5b5be | ||
|
|
a8707158a5 | ||
|
|
ad1da994b2 | ||
|
|
ba6fbc417e | ||
|
|
ce199d6f9e | ||
|
|
0dd8e8c242 | ||
|
|
b9ee29a945 | ||
|
|
be05c9022d | ||
|
|
afb061c374 | ||
|
|
1ee37148a8 | ||
|
|
1c73902005 | ||
|
|
d387e9b6d3 | ||
|
|
163d3547e6 | ||
|
|
c61998bd20 | ||
|
|
1e4d6672be | ||
|
|
80812b86d6 | ||
|
|
128f6359e9 | ||
|
|
8c0331d244 | ||
|
|
54b805ffd0 | ||
|
|
484a4b518f | ||
|
|
5e4a01f2de | ||
|
|
5da204f5bc | ||
|
|
b66477c29f | ||
|
|
a0e4b2bf54 | ||
|
|
98982065ed | ||
|
|
49adce1a63 | ||
|
|
7c393f8658 | ||
|
|
fcd06d99c6 | ||
|
|
f3e23ae972 | ||
|
|
39f5b05ae9 | ||
|
|
9205f10208 | ||
|
|
8b9e5b47df | ||
|
|
17bb2712cb | ||
|
|
9d3135a21b | ||
|
|
777fb616b6 | ||
|
|
172acce352 | ||
|
|
f69eead62e | ||
|
|
a9bccb964f | ||
|
|
74a384de0a | ||
|
|
a27362de6a | ||
|
|
66e8aae9f2 | ||
|
|
91c6728eb8 | ||
|
|
22f0c66abb | ||
|
|
7aea5cb88f | ||
|
|
058846d687 | ||
|
|
fc161e757c | ||
|
|
47735c273c | ||
|
|
fe0b2d02bf | ||
|
|
48e508052a | ||
|
|
0d0786e414 | ||
|
|
4f0d7738b3 | ||
|
|
76d7816749 | ||
|
|
8c486aaeae | ||
|
|
2c338032ed | ||
|
|
94128924b2 | ||
|
|
319c4d1274 | ||
|
|
7a8efa7f4f | ||
|
|
6c3c2b3f92 | ||
|
|
f1ac573e9a | ||
|
|
0be76c0bf5 | ||
|
|
c07aeb0075 | ||
|
|
4e5de9607b | ||
|
|
c6f3dcc009 | ||
|
|
620ba51375 | ||
|
|
1a98351212 | ||
|
|
d4746b349d | ||
|
|
d9caa1bd48 | ||
|
|
c3a82b9a49 | ||
|
|
c4b47269a4 | ||
|
|
b4cc25f25b | ||
|
|
7645c95110 | ||
|
|
4decded6ab | ||
|
|
471031e516 | ||
|
|
c8d621e0b4 | ||
|
|
b1ea3a6199 | ||
|
|
bb2d79f930 | ||
|
|
c416394ab2 | ||
|
|
02478d2db6 | ||
|
|
9740a35685 | ||
|
|
7f1db70919 | ||
|
|
02c288fa13 | ||
|
|
f6ae8b6350 | ||
|
|
e59e16161f | ||
|
|
7b46bcbbb8 | ||
|
|
9b2dd0c7b3 | ||
|
|
8eeab37473 | ||
|
|
c745e711ec | ||
|
|
f022f030d0 | ||
|
|
8ab369475f | ||
|
|
9d1aed01fc | ||
|
|
a2cdc6de33 | ||
|
|
828ecac826 | ||
|
|
a0edf2849a | ||
|
|
e7fe20ada6 | ||
|
|
37aa8468a0 | ||
|
|
1b2176a426 | ||
|
|
95a775cd3a | ||
|
|
71317b8579 | ||
|
|
f8cef52ea0 | ||
|
|
37d80784dd | ||
|
|
f66ed2c27f | ||
|
|
4f6f09590c | ||
|
|
7c321ad7f5 | ||
|
|
42839fa1db | ||
|
|
b02b381af2 | ||
|
|
b6555ee6af | ||
|
|
7c93b2d7a3 | ||
|
|
9a12e4499e | ||
|
|
379473b670 | ||
|
|
72b14bd994 | ||
|
|
76e97e85a0 | ||
|
|
a90b2a4d4f | ||
|
|
97248c6957 | ||
|
|
b2eb44afc5 | ||
|
|
4c8c649779 | ||
|
|
b164e16d1b | ||
|
|
8fab406c28 | ||
|
|
5eb45e1ea0 | ||
|
|
76dbd0d2d0 | ||
|
|
bf22569019 | ||
|
|
b81948a14c | ||
|
|
85da2e284b | ||
|
|
e39b159845 | ||
|
|
d33ab97434 | ||
|
|
1965628705 | ||
|
|
84fdd369d4 | ||
|
|
835524654e | ||
|
|
e030d9cff0 | ||
|
|
8910c7f8ae | ||
|
|
29d2b2ccd0 | ||
|
|
544b9d5c72 | ||
|
|
4a16ab3585 | ||
|
|
14c7fae378 | ||
|
|
0ea8df4d64 | ||
|
|
05573d6d8d | ||
|
|
9b650b9efb | ||
|
|
481bb90eac | ||
|
|
0fa54531d4 | ||
|
|
cc64a0405a | ||
|
|
7f6306ca96 | ||
|
|
0c4929f025 | ||
|
|
1b664dd870 | ||
|
|
49f7d2494c | ||
|
|
b2409b14d0 | ||
|
|
f405459548 | ||
|
|
8c99f2232b | ||
|
|
8472141b79 | ||
|
|
1c5ece8334 | ||
|
|
378175497a | ||
|
|
fcf86ded8f | ||
|
|
84efe279bb | ||
|
|
f71091bf52 | ||
|
|
76aa6103e3 | ||
|
|
1ab3eadd87 | ||
|
|
a8c58d5cbb | ||
|
|
d9d219356a | ||
|
|
ff934d538c | ||
|
|
7a043b3ebb | ||
|
|
80c3c7e642 | ||
|
|
57a59ae92d | ||
|
|
1dc1305ada | ||
|
|
a157256706 | ||
|
|
3ac102c93b | ||
|
|
3332592905 | ||
|
|
42b8167f3d | ||
|
|
fc0897682d | ||
|
|
8d99cddecc | ||
|
|
6f9d803d67 | ||
|
|
c24b02852b | ||
|
|
88731631ab | ||
|
|
714d4e4a81 | ||
|
|
1935783cc6 | ||
|
|
9f5d35e2aa | ||
|
|
6569056bfc | ||
|
|
62c3c90120 | ||
|
|
7d2c99e2c2 | ||
|
|
dc73d441b5 | ||
|
|
4866e06e62 | ||
|
|
cd3a8f96c6 | ||
|
|
0eb829f5de | ||
|
|
c062daccc9 | ||
|
|
f57b8f3e8a | ||
|
|
efc99a8d42 | ||
|
|
ecd4fbc0de | ||
|
|
3590261c78 | ||
|
|
f8dba7e5cf | ||
|
|
dd23991a19 | ||
|
|
6328b2274a | ||
|
|
2e0780b437 | ||
|
|
dfb1e62bc3 | ||
|
|
c264e47ee7 | ||
|
|
19d5a5066c | ||
|
|
82f8e24d83 | ||
|
|
756261bafe | ||
|
|
a8745948c4 | ||
|
|
0ce549f49e | ||
|
|
7445a72f76 | ||
|
|
5cb9a36916 | ||
|
|
3dbf52a871 | ||
|
|
9ca08800e1 | ||
|
|
1556e7eb09 | ||
|
|
f5ab059c0f | ||
|
|
8ac17b877a | ||
|
|
9da60be08e | ||
|
|
0fc3684613 | ||
|
|
c0b977bf32 | ||
|
|
d3fab295ad | ||
|
|
58170e36ef | ||
|
|
60d6be1329 | ||
|
|
5929c8f5ca | ||
|
|
28851ca9b2 | ||
|
|
5f79e9552d | ||
|
|
891290a79f | ||
|
|
e1fbf4795b | ||
|
|
48bb0bb5bb | ||
|
|
b9c1a999ff | ||
|
|
70ece73da9 | ||
|
|
51cfb57b4d | ||
|
|
413be76c63 | ||
|
|
c85aa0030f | ||
|
|
87ab97da2a | ||
|
|
b9051386ae | ||
|
|
7a1464d783 | ||
|
|
206e131854 | ||
|
|
52bfbf6ed0 | ||
|
|
e35cfa589a | ||
|
|
c9070e54bc | ||
|
|
c510037e9a | ||
|
|
cbf658f83d | ||
|
|
6db914780e | ||
|
|
693f98373b | ||
|
|
6910c8d920 | ||
|
|
38ba813c55 | ||
|
|
0b95da7ad3 | ||
|
|
ea1396f856 | ||
|
|
4114e3047b | ||
|
|
cef016d393 | ||
|
|
532d5b21fd | ||
|
|
8dfeba02b9 | ||
|
|
4ee643f472 | ||
|
|
1e26e45530 | ||
|
|
660e63dbae | ||
|
|
d4b89eb106 | ||
|
|
a78124831f | ||
|
|
0d345dc1bd | ||
|
|
86b44ecd82 | ||
|
|
c82ec8b210 | ||
|
|
6901c5fae5 | ||
|
|
fe7195badb | ||
|
|
02292e03e4 | ||
|
|
fe5cb2cdfb | ||
|
|
6ea558f8ac | ||
|
|
ecc6f4ba25 | ||
|
|
6de8d77e17 | ||
|
|
2b5075f0e2 | ||
|
|
2d5b7b5fb4 | ||
|
|
9fab5d594c | ||
|
|
53e126ac49 | ||
|
|
b4b9bee5f2 | ||
|
|
bc71622d21 | ||
|
|
5aa95fef10 | ||
|
|
4fca601e0c | ||
|
|
d7e7ade0f6 | ||
|
|
982e03f60d | ||
|
|
21113ad410 | ||
|
|
f5040707fe | ||
|
|
d51d0f3a5a | ||
|
|
918fbe3ec1 | ||
|
|
2dc73d239a | ||
|
|
bc7d05581b | ||
|
|
3dcf9e963e | ||
|
|
9f85862b7c | ||
|
|
2628316842 | ||
|
|
e79d6154fc | ||
|
|
40ea4ddef1 | ||
|
|
e0529da5c8 | ||
|
|
16a62426d6 | ||
|
|
ad076ede85 | ||
|
|
fd8a8501bc | ||
|
|
ea250ff5c5 | ||
|
|
d1e0f73b77 | ||
|
|
6fedee16f0 | ||
|
|
719a12ecac | ||
|
|
4feb799b7e | ||
|
|
b480a3e9fd | ||
|
|
75bf9b75ca | ||
|
|
766e885a1b | ||
|
|
7423c4c11e | ||
|
|
2cefe51d3b | ||
|
|
bbfae0cc67 | ||
|
|
bcb6565483 | ||
|
|
7f3401412e | ||
|
|
a3e32d81c5 | ||
|
|
ff9945dc6e | ||
|
|
e912008cb3 | ||
|
|
31d2b9edcd | ||
|
|
e5edda28ce | ||
|
|
70dafcf5da | ||
|
|
d1624a5521 | ||
|
|
beac4a2c98 | ||
|
|
040aed37ab | ||
|
|
6a1424f2b1 | ||
|
|
0f8a6d78a7 | ||
|
|
3f1adb49ae | ||
|
|
1d69a23ba4 | ||
|
|
149d8fc8d6 | ||
|
|
d36dca3aba | ||
|
|
a7188bd6f5 | ||
|
|
ff3aa18436 | ||
|
|
ef84c3b8b9 | ||
|
|
63e8224636 | ||
|
|
eea488ed75 | ||
|
|
dad87a360b | ||
|
|
fad835cf64 | ||
|
|
0c1e9603db | ||
|
|
a72d13064f | ||
|
|
6fd8aede48 | ||
|
|
e7b05beb7d | ||
|
|
1320c51d8e | ||
|
|
24b66dede0 | ||
|
|
3b842a7e02 | ||
|
|
2eec997e97 | ||
|
|
328d949225 | ||
|
|
4419e311a9 | ||
|
|
963fbd1572 | ||
|
|
b3b075ea02 | ||
|
|
47c146120a | ||
|
|
442e48b84f | ||
|
|
0709946c75 | ||
|
|
eefa39e47b | ||
|
|
1ab29f1716 | ||
|
|
c6eddb0bae | ||
|
|
4a3728d828 | ||
|
|
bee50ca7fa | ||
|
|
32cb9d0828 | ||
|
|
e7cd4cfa25 | ||
|
|
0257e7150f | ||
|
|
1e2b638881 | ||
|
|
28c98f9fa5 | ||
|
|
80d12dbedb | ||
|
|
2866918f32 | ||
|
|
6e8aebf432 | ||
|
|
cf136914cf | ||
|
|
216728cc5e | ||
|
|
9c145ba0d8 | ||
|
|
bf3acbf388 | ||
|
|
ff2d2a6e93 | ||
|
|
5d27cc5096 | ||
|
|
a049e8267f | ||
|
|
850293bae6 | ||
|
|
6caed7073c | ||
|
|
40bee27e56 | ||
|
|
f4d8cc0f0b | ||
|
|
68143ed8ec | ||
|
|
6cdb150c8b | ||
|
|
b7b5aad027 | ||
|
|
5c89a0e12a | ||
|
|
effb5356ca | ||
|
|
f5706d444b | ||
|
|
1d25d1f7ad | ||
|
|
29522017a3 | ||
|
|
b93bbfde2c | ||
|
|
42fbc757b1 | ||
|
|
52128ae11e | ||
|
|
e9bc59e376 | ||
|
|
062fd2190e | ||
|
|
827a7852e2 | ||
|
|
8cc04e0cb4 | ||
|
|
f2fd443262 | ||
|
|
72927b73ca | ||
|
|
fa4dee0e62 | ||
|
|
63fc728a84 | ||
|
|
51bf4a6e26 | ||
|
|
c60a146e22 | ||
|
|
cec0dfcbbd | ||
|
|
a8b7c8ff38 | ||
|
|
b5c09ada79 | ||
|
|
a7143c2a8c | ||
|
|
7fdbf3f231 | ||
|
|
9d2e7fc983 | ||
|
|
4b9a51ff0d | ||
|
|
b28523bf38 | ||
|
|
2db6b07de1 | ||
|
|
b10091be9b | ||
|
|
1805775f3d | ||
|
|
e1b297a14b | ||
|
|
88bda3d914 | ||
|
|
cb5dd0dae4 | ||
|
|
ce0541fc0e | ||
|
|
165986beb0 | ||
|
|
3474b97921 | ||
|
|
5915941eba | ||
|
|
8575d68d49 | ||
|
|
42aa81befd | ||
|
|
392408401c | ||
|
|
dd3409c961 | ||
|
|
1a5279e911 | ||
|
|
a3b480e300 | ||
|
|
79a2c6f49d | ||
|
|
07e7d71bac | ||
|
|
873feb2619 | ||
|
|
a189ce20b1 | ||
|
|
53e82d0b25 | ||
|
|
dfe9f2c925 | ||
|
|
fd63faa3f3 | ||
|
|
72ae97d8ef | ||
|
|
3c761f86c2 | ||
|
|
a09db258ee | ||
|
|
875e9d4c6f | ||
|
|
d3fb83db6b | ||
|
|
3cc14d58d4 | ||
|
|
33509b13b7 | ||
|
|
686dcc7c59 | ||
|
|
3a2f9859fe | ||
|
|
ca254e4e4c | ||
|
|
a66b4f69e9 | ||
|
|
398815c0c5 | ||
|
|
bc49e3a8d1 | ||
|
|
45ee5c9f03 | ||
|
|
36af92443c | ||
|
|
20dd05b343 | ||
|
|
34da979ef6 | ||
|
|
5b11a6a800 | ||
|
|
f8e9ea38da | ||
|
|
6405188f68 | ||
|
|
4b6402a005 | ||
|
|
f922a78d13 | ||
|
|
ac46a4e7b3 | ||
|
|
6393d32332 | ||
|
|
aac0d36a1d | ||
|
|
9c8c7cfa13 | ||
|
|
a016189bb0 | ||
|
|
116957e131 | ||
|
|
e64c299983 | ||
|
|
dc6c43db7d | ||
|
|
900996c9f1 | ||
|
|
2e21b4a1b4 | ||
|
|
9352c26404 | ||
|
|
5b2b3464c0 | ||
|
|
2bc00862d3 | ||
|
|
819fbefc12 | ||
|
|
1784d5f741 | ||
|
|
b9456c1a0c | ||
|
|
6e8e0d10c8 | ||
|
|
0403de57ed | ||
|
|
a70dfcaed9 | ||
|
|
67b6f9771c | ||
|
|
afecda0a7d | ||
|
|
fa303ae12e | ||
|
|
4bc56034cf | ||
|
|
a065e22f97 | ||
|
|
8231516bca | ||
|
|
af7160b859 | ||
|
|
ec5e149c7a | ||
|
|
d6debece16 | ||
|
|
edf098db63 | ||
|
|
dc165fe942 | ||
|
|
fbcf0fab8e | ||
|
|
c47313db65 | ||
|
|
46f42e15c4 | ||
|
|
40acfc938c | ||
|
|
8f085e02a1 | ||
|
|
e15cae9fa0 | ||
|
|
c9144ae5e2 | ||
|
|
89f3991351 | ||
|
|
1bc753f655 | ||
|
|
f30dcdb504 | ||
|
|
2c53f03c18 | ||
|
|
758e3aa1ca | ||
|
|
a0047d6edc | ||
|
|
a12017c564 | ||
|
|
d7a4479eb3 | ||
|
|
5bf72468f3 | ||
|
|
ff48619a85 | ||
|
|
673c29f7ea | ||
|
|
93f43c890b | ||
|
|
4152227f17 | ||
|
|
b56a028d6b | ||
|
|
d44f1aabbb | ||
|
|
53dca4f95f | ||
|
|
69c70dd319 | ||
|
|
2443f1e235 | ||
|
|
7c2826cbc0 | ||
|
|
1bb8449734 | ||
|
|
225d4541ff | ||
|
|
ba40b39500 | ||
|
|
08f1a7fbed | ||
|
|
de85bc9227 | ||
|
|
48d5abd5be | ||
|
|
a93712458b | ||
|
|
5a02c376ea | ||
|
|
ccdd886e27 | ||
|
|
a47a00228b | ||
|
|
809e68fdc0 | ||
|
|
1bc855646e | ||
|
|
258101a910 | ||
|
|
74125a74d3 | ||
|
|
e0716384d6 | ||
|
|
e34d28af9f | ||
|
|
bc1888ff21 | ||
|
|
83a7b48bb1 | ||
|
|
228f1c6770 | ||
|
|
734fb2c811 | ||
|
|
9660ae288a | ||
|
|
776015c350 | ||
|
|
074e6a67de | ||
|
|
3e2145d662 | ||
|
|
daf862a38a | ||
|
|
a24899bf2d | ||
|
|
1da73418cd | ||
|
|
90a7bd6a0a | ||
|
|
16e5b39e1d | ||
|
|
0077982fb7 | ||
|
|
623f0a8613 | ||
|
|
52c0384bd1 | ||
|
|
a106bfd456 | ||
|
|
bbe120308f | ||
|
|
4d0fef8ae8 | ||
|
|
4b8209d9a4 | ||
|
|
0abc1e98ed | ||
|
|
a0e7a4a0df | ||
|
|
8c7e214875 | ||
|
|
e89e6c8380 | ||
|
|
57218aa9d1 | ||
|
|
85163b531f | ||
|
|
2332527765 | ||
|
|
19c283546c | ||
|
|
c11208c4b5 | ||
|
|
f0bad0e2ba | ||
|
|
3e1904fa8c | ||
|
|
88783679cf | ||
|
|
5de849713e | ||
|
|
78da79b60f | ||
|
|
c4b048fbb3 | ||
|
|
024d47e0d3 | ||
|
|
34888a914e | ||
|
|
3560691c0a | ||
|
|
1e4913cd76 | ||
|
|
0d90ed6d92 | ||
|
|
88d1fcfe23 | ||
|
|
f4118a4fde | ||
|
|
f345d00a43 | ||
|
|
6c9be39db0 | ||
|
|
3b78a22371 | ||
|
|
fde2785fe3 | ||
|
|
7ad8ca62dc | ||
|
|
7c24a9ebef | ||
|
|
8d89f5f0cc | ||
|
|
5f4c78a77d | ||
|
|
fc1512cca6 | ||
|
|
6a26d6d15a | ||
|
|
298bb3d8f7 | ||
|
|
437d011968 | ||
|
|
2da1eee394 | ||
|
|
c9eba8440d | ||
|
|
afe988d83d | ||
|
|
44ed05ddf0 | ||
|
|
531e7ef8eb | ||
|
|
042131d91d | ||
|
|
05719913ac | ||
|
|
a8cc3bdb08 | ||
|
|
ee2d46dcbe | ||
|
|
492110a640 | ||
|
|
59a1b53d67 | ||
|
|
96d4df995c | ||
|
|
285ba74723 | ||
|
|
66b5c08664 | ||
|
|
62e3593944 | ||
|
|
9113538142 | ||
|
|
88f514ad7a | ||
|
|
88b052cbea | ||
|
|
051bc9e662 | ||
|
|
1bc85a47cb | ||
|
|
cff35cf0b3 | ||
|
|
f213376b35 | ||
|
|
bb1c4badfb | ||
|
|
75eb28b959 | ||
|
|
91c9313c87 | ||
|
|
3579dd2186 | ||
|
|
13b50f55a4 | ||
|
|
bf8fb2672e | ||
|
|
a21402b38f | ||
|
|
c48bbfd067 | ||
|
|
176f5866cb | ||
|
|
fc864029b9 | ||
|
|
d9b78d6492 | ||
|
|
dcb30a593d | ||
|
|
593d5f4465 | ||
|
|
dd228fd92e | ||
|
|
1c7b69f9cf | ||
|
|
abb0c99a6c | ||
|
|
cafad6ac03 | ||
|
|
ac8ac19169 | ||
|
|
5b42b5a8c2 | ||
|
|
1abb83b1ab | ||
|
|
3a2f55bc19 | ||
|
|
c401a06f8a | ||
|
|
ccdaf5de54 | ||
|
|
b390bd2ea5 | ||
|
|
225e69063f | ||
|
|
3edb1ddb81 | ||
|
|
b5eda416ce | ||
|
|
d51d0d77c4 | ||
|
|
9f6167fc3b | ||
|
|
92f4c68c0c | ||
|
|
827224635b | ||
|
|
02d64a51ee |
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
./cmake-build-*
|
||||
./build/*
|
||||
./cache/*
|
||||
Dockerfile
|
||||
9
.editorconfig
Executable file
9
.editorconfig
Executable file
@@ -0,0 +1,9 @@
|
||||
[*]
|
||||
end_of_line = lf
|
||||
|
||||
[*.{cpp,h,lua,txt,glsl,md,c,cmake,java,gradle}]
|
||||
charset = utf8
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
110
.github/CONTRIBUTING.md
vendored
110
.github/CONTRIBUTING.md
vendored
@@ -10,13 +10,31 @@ Contributions are welcome! Here's how you can help:
|
||||
|
||||
## Code
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) the repository and [clone](https://help.github.com/articles/cloning-a-repository/) your fork.
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) the repository and
|
||||
[clone](https://help.github.com/articles/cloning-a-repository/) your fork.
|
||||
|
||||
2. Before you start coding, consider opening an [issue at Github](https://github.com/minetest/minetest/issues) to discuss the suitability and implementation of your intended contribution with the core developers. If you are planning to start some very significant coding, you would benefit from first discussing on our IRC development channel [#minetest-dev](http://www.minetest.net/irc/). Note that a proper IRC client is required to speak on this channel.
|
||||
2. Before you start coding, consider opening an
|
||||
[issue at Github](https://github.com/minetest/minetest/issues) to discuss the
|
||||
suitability and implementation of your intended contribution with the core
|
||||
developers.
|
||||
|
||||
Any Pull Request that isn't a bug fix and isn't covered by
|
||||
[the roadmap](../doc/direction.md) will be closed within a week unless it
|
||||
receives a concept approval from a Core Developer. For this reason, it is
|
||||
recommended that you open an issue for any such pull requests before doing
|
||||
the work, to avoid disappointment.
|
||||
|
||||
You may also benefit from discussing on our IRC development channel
|
||||
[#minetest-dev](http://www.minetest.net/irc/). Note that a proper IRC client
|
||||
is required to speak on this channel.
|
||||
|
||||
3. Start coding!
|
||||
- Refer to the [Lua API](https://github.com/minetest/minetest/blob/master/doc/lua_api.txt), [Developer Wiki](http://dev.minetest.net/Main_Page) and other [documentation](https://github.com/minetest/minetest/tree/master/doc).
|
||||
- Follow the [C/C++](http://dev.minetest.net/Code_style_guidelines) and [Lua](http://dev.minetest.net/Lua_code_style_guidelines) code style guidelines.
|
||||
- Refer to the
|
||||
[Lua API](https://github.com/minetest/minetest/blob/master/doc/lua_api.txt),
|
||||
[Developer Wiki](http://dev.minetest.net/Main_Page) and other
|
||||
[documentation](https://github.com/minetest/minetest/tree/master/doc).
|
||||
- Follow the [C/C++](http://dev.minetest.net/Code_style_guidelines) and
|
||||
[Lua](http://dev.minetest.net/Lua_code_style_guidelines) code style guidelines.
|
||||
- Check your code works as expected and document any changes to the Lua API.
|
||||
|
||||
4. Commit & [push](https://help.github.com/articles/pushing-to-a-remote/) your changes to a new branch (not `master`, one change per branch)
|
||||
@@ -33,67 +51,115 @@ Contributions are welcome! Here's how you can help:
|
||||
|
||||
5. Once you are happy with your changes, submit a pull request.
|
||||
- Open the [pull-request form](https://github.com/minetest/minetest/pull/new/master).
|
||||
- Add a description explaining what you've done (or if it's a work-in-progress - what you need to do).
|
||||
- Add a description explaining what you've done (or if it's a
|
||||
work-in-progress - what you need to do).
|
||||
- Make sure to fill out the pull request template.
|
||||
|
||||
### A pull-request is considered merge-able when:
|
||||
|
||||
1. It follows the roadmap in some way and fits the whole picture of the project: [roadmap introduction](http://c55.me/blog/?p=1491), [roadmap continued](https://forum.minetest.net/viewtopic.php?t=9177)
|
||||
1. It follows [the roadmap](../doc/direction.md) in some way and fits the whole
|
||||
picture of the project.
|
||||
2. It works.
|
||||
3. It follows the code style for [C/C++](http://dev.minetest.net/Code_style_guidelines) or [Lua](http://dev.minetest.net/Lua_code_style_guidelines).
|
||||
4. The code's interfaces are well designed, regardless of other aspects that might need more work in the future.
|
||||
3. It follows the code style for
|
||||
[C/C++](http://dev.minetest.net/Code_style_guidelines) or
|
||||
[Lua](http://dev.minetest.net/Lua_code_style_guidelines).
|
||||
4. The code's interfaces are well designed, regardless of other aspects that
|
||||
might need more work in the future.
|
||||
5. It uses protocols and formats which include the required compatibility.
|
||||
|
||||
### Important note about automated GitHub checks
|
||||
|
||||
When you submit a pull request, GitHub automatically runs checks on the Minetest Engine combined with your changes. One of these checks is called 'cpp lint / clang format', which checks code formatting. Because formatting for readability requires human judgement this check often fails and often makes unsuitable formatting requests which make code readability worse.
|
||||
When you submit a pull request, GitHub automatically runs checks on the Minetest
|
||||
Engine combined with your changes. One of these checks is called 'cpp lint /
|
||||
clang format', which checks code formatting. Because formatting for readability
|
||||
requires human judgement this check often fails and often makes unsuitable
|
||||
formatting requests which make code readability worse.
|
||||
|
||||
If this check fails, look at the details to check for any clear mistakes and correct those. However, you should not apply everything ClangFormat requests. Ignore requests that make code readability worse and any other clearly unsuitable requests. Discuss in the pull request with a core developer about how to progress.
|
||||
If this check fails, look at the details to check for any clear mistakes and
|
||||
correct those. However, you should not apply everything ClangFormat requests.
|
||||
Ignore requests that make code readability worse and any other clearly
|
||||
unsuitable requests. Discuss in the pull request with a core developer about how
|
||||
to progress.
|
||||
|
||||
## Issues
|
||||
|
||||
If you experience an issue, we would like to know the details - especially when a stable release is on the way.
|
||||
If you experience an issue, we would like to know the details - especially when
|
||||
a stable release is on the way.
|
||||
|
||||
1. Do a quick search on GitHub to check if the issue has already been reported.
|
||||
2. Is it an issue with the Minetest *engine*? If not, report it [elsewhere](http://www.minetest.net/development/#reporting-issues).
|
||||
3. [Open an issue](https://github.com/minetest/minetest/issues/new) and describe the issue you are having - you could include:
|
||||
2. Is it an issue with the Minetest *engine*? If not, report it
|
||||
[elsewhere](http://www.minetest.net/development/#reporting-issues).
|
||||
3. [Open an issue](https://github.com/minetest/minetest/issues/new) and describe
|
||||
the issue you are having - you could include:
|
||||
- Error logs (check the bottom of the `debug.txt` file).
|
||||
- Screenshots.
|
||||
- Ways you have tried to solve the issue, and whether they worked or not.
|
||||
- Your Minetest version and the content (games, mods or texture packs) you have installed.
|
||||
- Your platform (e.g. Windows 10 or Ubuntu 15.04 x64).
|
||||
|
||||
After reporting you should aim to answer questions or clarifications as this helps pinpoint the cause of the issue (if you don't do this your issue may be closed after 1 month).
|
||||
After reporting you should aim to answer questions or clarifications as this
|
||||
helps pinpoint the cause of the issue (if you don't do this your issue may be
|
||||
closed after 1 month).
|
||||
|
||||
## Feature requests
|
||||
|
||||
Feature requests are welcome but take a moment to see if your idea follows the roadmap in some way and fits the whole picture of the project: [roadmap introduction](http://c55.me/blog/?p=1491), [roadmap continued](https://forum.minetest.net/viewtopic.php?t=9177). You should provide a clear explanation with as much detail as possible.
|
||||
Feature requests are welcome but take a moment to see if your idea follows
|
||||
[the roadmap](../doc/direction.md) in some way and fits the whole picture of
|
||||
the project. You should provide a clear explanation with as much detail as
|
||||
possible.
|
||||
|
||||
## Translations
|
||||
|
||||
Translations of Minetest are performed using Weblate. You can access the project page with a list of current languages [here](https://hosted.weblate.org/projects/minetest/minetest/).
|
||||
The core translations of Minetest are performed using Weblate. You can access
|
||||
the project page with a list of current languages
|
||||
[here](https://hosted.weblate.org/projects/minetest/minetest/).
|
||||
|
||||
Builtin (the component which contains things like server messages, chat command
|
||||
descriptions, privilege descriptions) is translated separately; it needs to be
|
||||
translated by editing a `.tr` text file. See
|
||||
[Translation](https://dev.minetest.net/Translation) for more information.
|
||||
|
||||
## Donations
|
||||
|
||||
If you'd like to monetarily support Minetest development, you can find donation methods on [our website](http://www.minetest.net/development/#donate).
|
||||
If you'd like to monetarily support Minetest development, you can find donation
|
||||
methods on [our website](http://www.minetest.net/development/#donate).
|
||||
|
||||
# Maintaining
|
||||
|
||||
*This is a concise version of the [Rules & Guidelines](http://dev.minetest.net/Category:Rules_and_Guidelines) on the developer wiki.*
|
||||
* This is a concise version of the
|
||||
[Rules & Guidelines](http://dev.minetest.net/Category:Rules_and_Guidelines) on the developer wiki.*
|
||||
|
||||
These notes are for those who have push access Minetest (core developers / maintainers).
|
||||
|
||||
- See the [project organisation](http://dev.minetest.net/Organisation) for the people involved.
|
||||
|
||||
## Concept approvals and roadmaps
|
||||
|
||||
If a Pull Request is not a bug fix:
|
||||
|
||||
* If it matches a goal in [the roadmap](../doc/direction.md), then the PR should
|
||||
be labelled as "Roadmap" and the goal stated by number in the description.
|
||||
* If it doesn't match a goal, then it needs to receive a concept approval within
|
||||
a week of being opened to remain open. This 1 week deadline does not apply to
|
||||
PRs opened before the roadmap was adopted; instead, they may remain open or be
|
||||
closed as needed. Use the "Concept Approved" label. Issues can be marked as
|
||||
"Concept Approved" to give preapproval to future PRs.
|
||||
|
||||
## Reviewing pull requests
|
||||
|
||||
Pull requests should be reviewed and, if appropriate, checked if they achieve their intended purpose. You can show that you are in the process of, or will review the pull request by commenting *"Looks good"* or something similar.
|
||||
Pull requests should be reviewed and, if appropriate, checked if they achieve
|
||||
their intended purpose. You can show that you are in the process of, or will
|
||||
review the pull request by commenting *"Looks good"* or something similar.
|
||||
|
||||
**If the pull-request is not [merge-able](#a-pull-request-is-considered-merge-able-when):**
|
||||
|
||||
Submit a comment explaining to the author what they need to change to make the pull-request merge-able.
|
||||
Submit a comment explaining to the author what they need to change to make the
|
||||
pull-request merge-able.
|
||||
|
||||
- If the author comments or makes changes to the pull-request, it can be reviewed again.
|
||||
- If no response is made from the author within 1 month (when improvements are suggested or a question is asked), it can be closed.
|
||||
- If the author comments or makes changes to the pull-request, it can be
|
||||
reviewed again.
|
||||
- If no response is made from the author within 1 month (when improvements are
|
||||
suggested or a question is asked), it can be closed.
|
||||
|
||||
**If the pull-request is [merge-able](#a-pull-request-is-considered-merge-able-when):**
|
||||
|
||||
|
||||
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -8,8 +8,8 @@ assignees: ''
|
||||
|
||||
##### Minetest version
|
||||
<!--
|
||||
Paste Minetest version between quotes below
|
||||
If you are on a devel version, please add git commit hash
|
||||
Paste Minetest version between quotes below.
|
||||
If you are on a devel version, please add git commit hash.
|
||||
You can use `minetest --version` to find it.
|
||||
-->
|
||||
```
|
||||
@@ -29,4 +29,4 @@ OpenGL version:
|
||||
<!-- Describe your problem here -->
|
||||
|
||||
##### Steps to reproduce
|
||||
<!-- For bug reports or build issues, explain how the problem happened -->
|
||||
<!-- Explain how the problem has happened, providing a minimal test (i.e. a code snippet reduced to the bone) where possible -->
|
||||
|
||||
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -3,6 +3,7 @@ Add compact, short information about your PR for easier understanding:
|
||||
- Goal of the PR
|
||||
- How does the PR work?
|
||||
- Does it resolve any reported issue?
|
||||
- Does this relate to a goal in [the roadmap](../doc/direction.md)?
|
||||
- If not a bug fix, why is this PR needed? What usecases does it solve?
|
||||
|
||||
## To do
|
||||
|
||||
16
.github/workflows/android.yml
vendored
16
.github/workflows/android.yml
vendored
@@ -21,22 +21,22 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends gettext openjdk-11-jdk-headless
|
||||
- name: Build with Gradle
|
||||
run: cd android; ./gradlew assemblerelease
|
||||
- name: Save armeabi artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Minetest-armeabi-v7a.apk
|
||||
path: android/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned.apk
|
||||
- name: Save arm64 artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Minetest-arm64-v8a.apk
|
||||
path: android/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk
|
||||
|
||||
130
.github/workflows/build.yml
vendored
130
.github/workflows/build.yml
vendored
@@ -13,6 +13,8 @@ on:
|
||||
- 'util/buildbot/**'
|
||||
- 'util/ci/**'
|
||||
- '.github/workflows/**.yml'
|
||||
- 'Dockerfile'
|
||||
- '.dockerignore'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
@@ -24,59 +26,61 @@ on:
|
||||
- 'util/buildbot/**'
|
||||
- 'util/ci/**'
|
||||
- '.github/workflows/**.yml'
|
||||
- 'Dockerfile'
|
||||
- '.dockerignore'
|
||||
|
||||
jobs:
|
||||
# This is our minor gcc compiler
|
||||
gcc_6:
|
||||
# Older gcc version (should be close to our minimum supported version)
|
||||
gcc_5:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps g++-6
|
||||
install_linux_deps g++-5
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: gcc-6
|
||||
CXX: g++-6
|
||||
CC: gcc-5
|
||||
CXX: g++-5
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
# This is the current gcc compiler (available in bionic)
|
||||
gcc_8:
|
||||
runs-on: ubuntu-18.04
|
||||
# Current gcc version
|
||||
gcc_10:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps g++-8
|
||||
install_linux_deps g++-10
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: gcc-8
|
||||
CXX: g++-8
|
||||
CC: gcc-10
|
||||
CXX: g++-10
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
# This is our minor clang compiler
|
||||
# Older clang version (should be close to our minimum supported version)
|
||||
clang_3_9:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps clang-3.9
|
||||
install_linux_deps clang-3.9 gdb
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
@@ -85,26 +89,30 @@ jobs:
|
||||
CC: clang-3.9
|
||||
CXX: clang++-3.9
|
||||
|
||||
- name: Test
|
||||
- name: Unittest
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
# This is the current clang version
|
||||
clang_9:
|
||||
runs-on: ubuntu-18.04
|
||||
- name: Integration test + devtest
|
||||
run: |
|
||||
./util/test_multiplayer.sh
|
||||
|
||||
# Current clang version
|
||||
clang_10:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps clang-9 valgrind libluajit-5.1-dev
|
||||
install_linux_deps clang-10 valgrind libluajit-5.1-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: clang-9
|
||||
CXX: clang++-9
|
||||
CC: clang-10
|
||||
CXX: clang++-10
|
||||
CMAKE_FLAGS: "-DREQUIRE_LUAJIT=1"
|
||||
|
||||
- name: Test
|
||||
@@ -118,9 +126,9 @@ jobs:
|
||||
# Build with prometheus-cpp (server-only)
|
||||
clang_9_prometheus:
|
||||
name: "clang_9 (PROMETHEUS=1)"
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
@@ -142,47 +150,25 @@ jobs:
|
||||
run: |
|
||||
./bin/minetestserver --run-unittests
|
||||
|
||||
# Build without freetype (client-only)
|
||||
clang_9_no_freetype:
|
||||
name: "clang_9 (FREETYPE=0)"
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps clang-9
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: clang-9
|
||||
CXX: clang++-9
|
||||
CMAKE_FLAGS: "-DENABLE_FREETYPE=0 -DBUILD_SERVER=0"
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
docker:
|
||||
name: "Docker image"
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build docker image
|
||||
run: |
|
||||
docker build .
|
||||
docker build . -t minetest:latest
|
||||
docker run --rm minetest:latest /usr/local/bin/minetestserver --version
|
||||
|
||||
win32:
|
||||
name: "MinGW cross-compiler (32-bit)"
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install compiler
|
||||
run: |
|
||||
sudo apt-get update -q && sudo apt-get install gettext -qyy
|
||||
wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
|
||||
sudo apt-get update && sudo apt-get install -y gettext
|
||||
wget http://minetest.kitsunemimi.pw/mingw-w64-i686_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
|
||||
sudo tar -xaf mingw.tar.xz -C /usr
|
||||
|
||||
- name: Build
|
||||
@@ -194,13 +180,13 @@ jobs:
|
||||
|
||||
win64:
|
||||
name: "MinGW cross-compiler (64-bit)"
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install compiler
|
||||
run: |
|
||||
sudo apt-get update -q && sudo apt-get install gettext -qyy
|
||||
wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
|
||||
sudo apt-get update && sudo apt-get install -y gettext
|
||||
wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
|
||||
sudo tar -xaf mingw.tar.xz -C /usr
|
||||
|
||||
- name: Build
|
||||
@@ -212,11 +198,11 @@ jobs:
|
||||
|
||||
msvc:
|
||||
name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
VCPKG_VERSION: 0bf3923f9fab4001c00f0f429682a0853b5749e0
|
||||
# 2020.11
|
||||
vcpkg_packages: irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit
|
||||
VCPKG_VERSION: 5cf60186a241e84e8232641ee973395d4fde90e1
|
||||
# 2022.02
|
||||
vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp opengl-registry
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -237,11 +223,15 @@ jobs:
|
||||
# Enable it, when working on the installer.
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Checkout IrrlichtMt
|
||||
run: |
|
||||
$ref = @(Get-Content misc\irrlichtmt_tag.txt)
|
||||
git clone https://github.com/minetest/irrlicht lib\irrlichtmt --depth 1 -b $ref[0]
|
||||
|
||||
- name: Restore from cache and run vcpkg
|
||||
uses: lukka/run-vcpkg@v5
|
||||
uses: lukka/run-vcpkg@v7
|
||||
with:
|
||||
vcpkgArguments: ${{env.vcpkg_packages}}
|
||||
vcpkgDirectory: '${{ github.workspace }}\vcpkg'
|
||||
@@ -249,7 +239,7 @@ jobs:
|
||||
vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
|
||||
vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
|
||||
|
||||
- name: CMake
|
||||
- name: Minetest CMake
|
||||
run: |
|
||||
cmake ${{matrix.config.generator}} `
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
|
||||
@@ -257,7 +247,7 @@ jobs:
|
||||
-DENABLE_POSTGRESQL=OFF `
|
||||
-DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
|
||||
|
||||
- name: Build
|
||||
- name: Build Minetest
|
||||
run: cmake --build . --config Release
|
||||
|
||||
- name: CPack
|
||||
@@ -276,7 +266,7 @@ jobs:
|
||||
- name: Package Clean
|
||||
run: rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
|
||||
|
||||
- uses: actions/upload-artifact@v1
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
|
||||
path: .\Package\
|
||||
|
||||
35
.github/workflows/cpp_lint.yml
vendored
35
.github/workflows/cpp_lint.yml
vendored
@@ -24,30 +24,31 @@ on:
|
||||
- '.github/workflows/**.yml'
|
||||
|
||||
jobs:
|
||||
clang_format:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
sudo apt-get install clang-format-9 -qyy
|
||||
|
||||
- name: Run clang-format
|
||||
run: |
|
||||
source ./util/ci/lint.sh
|
||||
perform_lint
|
||||
env:
|
||||
CLANG_FORMAT: clang-format-9
|
||||
# clang_format:
|
||||
# runs-on: ubuntu-20.04
|
||||
# steps:
|
||||
# - uses: actions/checkout@v3
|
||||
# - name: Install clang-format
|
||||
# run: |
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y clang-format-9
|
||||
#
|
||||
# - name: Run clang-format
|
||||
# run: |
|
||||
# source ./util/ci/clang-format.sh
|
||||
# check_format
|
||||
# env:
|
||||
# CLANG_FORMAT: clang-format-9
|
||||
|
||||
clang_tidy:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get install clang-tidy-9 -qyy
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps
|
||||
install_linux_deps clang-tidy-9
|
||||
|
||||
- name: Run clang-tidy
|
||||
run: |
|
||||
|
||||
72
.github/workflows/lua.yml
vendored
Normal file
72
.github/workflows/lua.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
name: lua_lint
|
||||
|
||||
# Lint on lua changes on builtin or if workflow changed
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'builtin/**.lua'
|
||||
- 'games/devtest/**.lua'
|
||||
- '.github/workflows/**.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'builtin/**.lua'
|
||||
- 'games/devtest/**.lua'
|
||||
- '.github/workflows/**.yml'
|
||||
|
||||
jobs:
|
||||
# Note that the integration tests are also run build.yml, but only when C++ code is changed.
|
||||
integration_tests:
|
||||
name: "Compile and run multiplayer tests"
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps clang-10 gdb libluajit-5.1-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: clang-10
|
||||
CXX: clang++-10
|
||||
CMAKE_FLAGS: "-DENABLE_GETTEXT=0 -DBUILD_SERVER=0"
|
||||
|
||||
- name: Integration test + devtest
|
||||
run: |
|
||||
./util/test_multiplayer.sh
|
||||
|
||||
luacheck:
|
||||
name: "Builtin Luacheck and Unit Tests"
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: leafo/gh-actions-lua@v9
|
||||
with:
|
||||
luaVersion: "5.1.5"
|
||||
- uses: leafo/gh-actions-luarocks@v4
|
||||
|
||||
- name: Install LuaJIT
|
||||
run: |
|
||||
cd $HOME
|
||||
git clone https://github.com/LuaJIT/LuaJIT/
|
||||
cd LuaJIT
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Install luarocks tools
|
||||
run: |
|
||||
luarocks install --local luacheck
|
||||
luarocks install --local busted
|
||||
|
||||
- name: Run checks (builtin)
|
||||
run: |
|
||||
$HOME/.luarocks/bin/luacheck builtin
|
||||
$HOME/.luarocks/bin/busted builtin
|
||||
$HOME/.luarocks/bin/busted builtin --lua=$HOME/LuaJIT/src/luajit
|
||||
|
||||
- name: Run checks (devtest)
|
||||
run: |
|
||||
$HOME/.luarocks/bin/luacheck --config=games/devtest/.luacheckrc games/devtest
|
||||
32
.github/workflows/lua_lint.yml
vendored
32
.github/workflows/lua_lint.yml
vendored
@@ -1,32 +0,0 @@
|
||||
name: lua_lint
|
||||
|
||||
# Lint on lua changes on builtin or if workflow changed
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'builtin/**.lua'
|
||||
- '.github/workflows/**.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'builtin/**.lua'
|
||||
- '.github/workflows/**.yml'
|
||||
|
||||
jobs:
|
||||
luacheck:
|
||||
name: "Builtin Luacheck and Unit Tests"
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install luarocks
|
||||
run: |
|
||||
sudo apt-get install luarocks -qyy
|
||||
|
||||
- name: Install luarocks tools
|
||||
run: |
|
||||
luarocks install --local luacheck
|
||||
luarocks install --local busted
|
||||
|
||||
- name: Run checks
|
||||
run: |
|
||||
$HOME/.luarocks/bin/luacheck builtin
|
||||
$HOME/.luarocks/bin/busted builtin
|
||||
71
.github/workflows/macos.yml
vendored
Normal file
71
.github/workflows/macos.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: macos
|
||||
|
||||
# build on c/cpp changes or workflow changes
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'cmake/Modules/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'cmake/Modules/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
|
||||
env:
|
||||
MINETEST_GAME_REPO: https://github.com/minetest/minetest_game.git
|
||||
MINETEST_GAME_BRANCH: master
|
||||
MINETEST_GAME_NAME: minetest_game
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
pkgs=(cmake freetype gettext gmp hiredis jpeg jsoncpp leveldb libogg libpng libvorbis luajit zstd)
|
||||
brew update
|
||||
brew install ${pkgs[@]}
|
||||
brew unlink $(brew ls --formula)
|
||||
brew link ${pkgs[@]}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
git clone -b $MINETEST_GAME_BRANCH $MINETEST_GAME_REPO games/$MINETEST_GAME_NAME
|
||||
git clone https://github.com/minetest/irrlicht lib/irrlichtmt --depth 1 -b $(cat misc/irrlichtmt_tag.txt)
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
|
||||
-DCMAKE_FIND_FRAMEWORK=LAST \
|
||||
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
|
||||
-DRUN_IN_PLACE=FALSE \
|
||||
-DENABLE_FREETYPE=TRUE -DENABLE_GETTEXT=TRUE
|
||||
make -j2
|
||||
make install
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./build/macos/minetest.app/Contents/MacOS/minetest --run-unittests
|
||||
|
||||
# Zipping the built .app preserves permissions on the contained files,
|
||||
# which the GitHub artifact pipeline would otherwise strip away.
|
||||
- name: CPack
|
||||
run: |
|
||||
cd build
|
||||
cpack -G ZIP -B macos
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: minetest-macos
|
||||
path: ./build/macos/*.zip
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -87,8 +87,8 @@ src/test_config.h
|
||||
src/cmake_config.h
|
||||
src/cmake_config_githash.h
|
||||
src/unittest/test_world/world.mt
|
||||
src/lua/build/
|
||||
locale/
|
||||
games/devtest/mods/testnodes/textures/testnodes_generated_*.png
|
||||
/locale/
|
||||
.directory
|
||||
*.cbp
|
||||
*.layout
|
||||
@@ -107,3 +107,13 @@ CMakeDoxy*
|
||||
compile_commands.json
|
||||
*.apk
|
||||
*.zip
|
||||
# Visual Studio
|
||||
*.vcxproj*
|
||||
*.sln
|
||||
.vs/
|
||||
|
||||
# Optional user provided library folder
|
||||
lib/irrlichtmt
|
||||
|
||||
# Generated mod storage database
|
||||
client/mod_storage.sqlite
|
||||
|
||||
146
.gitlab-ci.yml
146
.gitlab-ci.yml
@@ -14,12 +14,14 @@ variables:
|
||||
|
||||
.build_template:
|
||||
stage: build
|
||||
before_script:
|
||||
- apt-get update
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential git cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libleveldb-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev
|
||||
script:
|
||||
- mkdir cmakebuild
|
||||
- mkdir -p artifact/minetest/usr/
|
||||
- cd cmakebuild
|
||||
- cmake -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DENABLE_SYSTEM_JSONCPP=TRUE -DBUILD_SERVER=TRUE ..
|
||||
- make -j2
|
||||
- git clone https://github.com/minetest/irrlicht lib/irrlichtmt --depth 1 -b $(cat misc/irrlichtmt_tag.txt)
|
||||
- mkdir build && cd build
|
||||
- cmake -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE ..
|
||||
- make -j $(($(nproc) + 1))
|
||||
- make install
|
||||
artifacts:
|
||||
when: on_success
|
||||
@@ -30,7 +32,7 @@ variables:
|
||||
.debpkg_template:
|
||||
stage: package
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get update
|
||||
- apt-get install -y git
|
||||
- mkdir -p build/deb/minetest/DEBIAN/
|
||||
- cp misc/debpkg-control build/deb/minetest/DEBIAN/control
|
||||
@@ -39,7 +41,9 @@ variables:
|
||||
- git clone $MINETEST_GAME_REPO build/deb/minetest/usr/share/minetest/games/minetest_game
|
||||
- rm -rf build/deb/minetest/usr/share/minetest/games/minetest/.git
|
||||
- sed -i 's/DATEPLACEHOLDER/'$(date +%y.%m.%d)'/g' build/deb/minetest/DEBIAN/control
|
||||
- sed -i 's/JPEG_PLACEHOLDER/'$JPEG_PKG'/g' build/deb/minetest/DEBIAN/control
|
||||
- sed -i 's/LEVELDB_PLACEHOLDER/'$LEVELDB_PKG'/g' build/deb/minetest/DEBIAN/control
|
||||
- sed -i 's/JSONCPP_PLACEHOLDER/'$JSONCPP_PKG'/g' build/deb/minetest/DEBIAN/control
|
||||
- cd build/deb/ && dpkg-deb -b minetest/ && mv minetest.deb ../../
|
||||
artifacts:
|
||||
expire_in: 90 day
|
||||
@@ -49,7 +53,7 @@ variables:
|
||||
.debpkg_install:
|
||||
stage: deploy
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get update -qy
|
||||
script:
|
||||
- apt-get install -y ./*.deb
|
||||
- minetest --version
|
||||
@@ -63,9 +67,6 @@ variables:
|
||||
build:debian-9:
|
||||
extends: .build_template
|
||||
image: debian:9
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
package:debian-9:
|
||||
extends: .debpkg_template
|
||||
@@ -73,7 +74,9 @@ package:debian-9:
|
||||
needs:
|
||||
- build:debian-9
|
||||
variables:
|
||||
JSONCPP_PKG: libjsoncpp1
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
JPEG_PKG: libjpeg62-turbo
|
||||
|
||||
deploy:debian-9:
|
||||
extends: .debpkg_install
|
||||
@@ -86,9 +89,6 @@ deploy:debian-9:
|
||||
build:debian-10:
|
||||
extends: .build_template
|
||||
image: debian:10
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
package:debian-10:
|
||||
extends: .debpkg_template
|
||||
@@ -96,7 +96,9 @@ package:debian-10:
|
||||
needs:
|
||||
- build:debian-10
|
||||
variables:
|
||||
JSONCPP_PKG: libjsoncpp1
|
||||
LEVELDB_PKG: libleveldb1d
|
||||
JPEG_PKG: libjpeg62-turbo
|
||||
|
||||
deploy:debian-10:
|
||||
extends: .debpkg_install
|
||||
@@ -104,41 +106,37 @@ deploy:debian-10:
|
||||
needs:
|
||||
- package:debian-10
|
||||
|
||||
# Bullseye
|
||||
|
||||
build:debian-11:
|
||||
extends: .build_template
|
||||
image: debian:11
|
||||
|
||||
package:debian-11:
|
||||
extends: .debpkg_template
|
||||
image: debian:11
|
||||
needs:
|
||||
- build:debian-11
|
||||
variables:
|
||||
JSONCPP_PKG: libjsoncpp24
|
||||
LEVELDB_PKG: libleveldb1d
|
||||
JPEG_PKG: libjpeg62-turbo
|
||||
|
||||
deploy:debian-11:
|
||||
extends: .debpkg_install
|
||||
image: debian:11
|
||||
needs:
|
||||
- package:debian-11
|
||||
|
||||
##
|
||||
## Ubuntu
|
||||
##
|
||||
|
||||
# Xenial
|
||||
|
||||
build:ubuntu-16.04:
|
||||
extends: .build_template
|
||||
image: ubuntu:xenial
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
package:ubuntu-16.04:
|
||||
extends: .debpkg_template
|
||||
image: ubuntu:xenial
|
||||
needs:
|
||||
- build:ubuntu-16.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
|
||||
deploy:ubuntu-16.04:
|
||||
extends: .debpkg_install
|
||||
image: ubuntu:xenial
|
||||
needs:
|
||||
- package:ubuntu-16.04
|
||||
|
||||
# Bionic
|
||||
|
||||
build:ubuntu-18.04:
|
||||
extends: .build_template
|
||||
image: ubuntu:bionic
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
package:ubuntu-18.04:
|
||||
extends: .debpkg_template
|
||||
@@ -146,7 +144,9 @@ package:ubuntu-18.04:
|
||||
needs:
|
||||
- build:ubuntu-18.04
|
||||
variables:
|
||||
JSONCPP_PKG: libjsoncpp1
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
JPEG_PKG: libjpeg-turbo8
|
||||
|
||||
deploy:ubuntu-18.04:
|
||||
extends: .debpkg_install
|
||||
@@ -154,6 +154,28 @@ deploy:ubuntu-18.04:
|
||||
needs:
|
||||
- package:ubuntu-18.04
|
||||
|
||||
# Focal
|
||||
|
||||
build:ubuntu-20.04:
|
||||
extends: .build_template
|
||||
image: ubuntu:focal
|
||||
|
||||
package:ubuntu-20.04:
|
||||
extends: .debpkg_template
|
||||
image: ubuntu:focal
|
||||
needs:
|
||||
- build:ubuntu-20.04
|
||||
variables:
|
||||
JSONCPP_PKG: libjsoncpp1
|
||||
LEVELDB_PKG: libleveldb1d
|
||||
JPEG_PKG: libjpeg-turbo8
|
||||
|
||||
deploy:ubuntu-20.04:
|
||||
extends: .debpkg_install
|
||||
image: ubuntu:focal
|
||||
needs:
|
||||
- package:ubuntu-20.04
|
||||
|
||||
##
|
||||
## Fedora
|
||||
##
|
||||
@@ -163,36 +185,23 @@ build:fedora-28:
|
||||
extends: .build_template
|
||||
image: fedora:28
|
||||
before_script:
|
||||
- dnf -y install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel spatialindex-devel
|
||||
- dnf -y install make git gcc gcc-c++ kernel-devel cmake libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel spatialindex-devel libzstd-devel
|
||||
|
||||
##
|
||||
## MinGW for Windows
|
||||
##
|
||||
|
||||
.generic_win_template:
|
||||
image: ubuntu:bionic
|
||||
image: ubuntu:focal
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y wget xz-utils unzip git cmake gettext
|
||||
- wget -nv http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
|
||||
- apt-get update
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get install -y wget xz-utils unzip git cmake gettext
|
||||
- wget -nv http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
|
||||
- tar -xaf mingw.tar.xz -C /usr
|
||||
|
||||
.build_win_template:
|
||||
extends: .generic_win_template
|
||||
stage: build
|
||||
artifacts:
|
||||
expire_in: 1h
|
||||
paths:
|
||||
- build/minetest/_build/*
|
||||
|
||||
.package_win_template:
|
||||
extends: .generic_win_template
|
||||
stage: package
|
||||
script:
|
||||
- unzip build/minetest/_build/minetest-*.zip
|
||||
- cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libgcc*.dll minetest-*-win*/bin/
|
||||
- cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libstdc++*.dll minetest-*-win*/bin/
|
||||
- cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libwinpthread*.dll minetest-*-win*/bin/
|
||||
artifacts:
|
||||
expire_in: 90 day
|
||||
paths:
|
||||
@@ -201,29 +210,16 @@ build:fedora-28:
|
||||
build:win32:
|
||||
extends: .build_win_template
|
||||
script:
|
||||
- ./util/buildbot/buildwin32.sh build
|
||||
- EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh build
|
||||
- unzip -q build/build/*.zip
|
||||
variables:
|
||||
WIN_ARCH: "i686"
|
||||
|
||||
package:win32:
|
||||
extends: .package_win_template
|
||||
needs:
|
||||
- build:win32
|
||||
variables:
|
||||
WIN_ARCH: "i686"
|
||||
|
||||
|
||||
build:win64:
|
||||
extends: .build_win_template
|
||||
script:
|
||||
- ./util/buildbot/buildwin64.sh build
|
||||
variables:
|
||||
WIN_ARCH: "x86_64"
|
||||
|
||||
package:win64:
|
||||
extends: .package_win_template
|
||||
needs:
|
||||
- build:win64
|
||||
- EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh build
|
||||
- unzip -q build/build/*.zip
|
||||
variables:
|
||||
WIN_ARCH: "x86_64"
|
||||
|
||||
@@ -274,7 +270,7 @@ package:appimage-client:
|
||||
- build:ubuntu-18.04
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y git wget
|
||||
- apt-get install -y git
|
||||
# Collect files
|
||||
- mkdir AppDir
|
||||
- cp -a artifact/minetest/usr/ AppDir/usr/
|
||||
|
||||
@@ -20,7 +20,7 @@ read_globals = {
|
||||
|
||||
string = {fields = {"split", "trim"}},
|
||||
table = {fields = {"copy", "getn", "indexof", "insert_all"}},
|
||||
math = {fields = {"hypot"}},
|
||||
math = {fields = {"hypot", "round"}},
|
||||
}
|
||||
|
||||
globals = {
|
||||
|
||||
8
.mailmap
8
.mailmap
@@ -49,14 +49,15 @@ ClobberXD <ClobberXD@gmail.com> <36130650+ClobberXD@users.noreply.github.com>
|
||||
Auke Kok <sofar+github@foo-projects.org>
|
||||
Auke Kok <sofar+github@foo-projects.org> <sofar@foo-projects.org>
|
||||
Desour <vorunbekannt75@web.de>
|
||||
Nathanaël Courant <Ekdohibs@users.noreply.github.com> <nathanael.courant@laposte.net>
|
||||
Nathanaëlle Courant <Ekdohibs@users.noreply.github.com> <nathanael.courant@laposte.net>
|
||||
Ezhh <owlecho@live.com>
|
||||
paramat <paramat@users.noreply.github.com>
|
||||
paramat <paramat@users.noreply.github.com> <mat.gregory@virginmedia.com>
|
||||
lhofhansl <lhofhansl@yahoo.com> <larsh@apache.org>
|
||||
red-001 <red-001@outlook.ie> <red-001@openmailbox.org>
|
||||
Wuzzy <wuzzy2@mail.ru> <Wuzzy2@mail.ru>
|
||||
Wuzzy <wuzzy2@mail.ru> <almikes@aol.com>
|
||||
Wuzzy <Wuzzy@disroot.org> <wuzzy2@mail.ru>
|
||||
Wuzzy <Wuzzy@disroot.org> <Wuzzy2@mail.ru>
|
||||
Wuzzy <Wuzzy@disroot.org> <almikes@aol.com>
|
||||
Jordach <jordach.snelling@gmail.com>
|
||||
MoNTE48 <MoNTE48@mail.ua>
|
||||
v-rob <robinsonvincent89@gmail.com>
|
||||
@@ -65,3 +66,4 @@ EvidenceB <49488517+EvidenceBKidscode@users.noreply.github.com>
|
||||
gregorycu <gregory.currie@gmail.com>
|
||||
Rogier <rogier777@gmail.com>
|
||||
Rogier <rogier777@gmail.com> <Rogier-5@users.noreply.github.com>
|
||||
x2048 <codeforsmile@gmail.com>
|
||||
|
||||
@@ -24,18 +24,21 @@ AppDir:
|
||||
- sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-security main universe
|
||||
|
||||
include:
|
||||
- libirrlicht1.8
|
||||
- libxxf86vm1
|
||||
- libgl1-mesa-glx
|
||||
- libsqlite3-0
|
||||
- libogg0
|
||||
- libvorbis0a
|
||||
- libopenal1
|
||||
- libc6
|
||||
- libcurl3-gnutls
|
||||
- libfreetype6
|
||||
- zlib1g
|
||||
- libgmp10
|
||||
- libgl1
|
||||
- libjpeg-turbo8
|
||||
- libjsoncpp1
|
||||
- libleveldb1v5
|
||||
- libopenal1
|
||||
- libpng16-16
|
||||
- libsqlite3-0
|
||||
- libstdc++6
|
||||
- libvorbisfile3
|
||||
- libx11-6
|
||||
- libxxf86vm1
|
||||
- zlib1g
|
||||
|
||||
files:
|
||||
exclude:
|
||||
|
||||
127
CMakeLists.txt
127
CMakeLists.txt
@@ -1,19 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
cmake_policy(SET CMP0025 OLD)
|
||||
# Set policies up to 3.9 since we want to enable the IPO option
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.9)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
else()
|
||||
cmake_policy(VERSION 3.9)
|
||||
endif()
|
||||
|
||||
# This can be read from ${PROJECT_NAME} after project() is called
|
||||
project(minetest)
|
||||
set(PROJECT_NAME_CAPITALIZED "Minetest")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(GCC_MINIMUM_VERSION "4.8")
|
||||
set(CLANG_MINIMUM_VERSION "3.4")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(GCC_MINIMUM_VERSION "5.1")
|
||||
set(CLANG_MINIMUM_VERSION "3.5")
|
||||
|
||||
# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH 2)
|
||||
set(VERSION_MINOR 6)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||
|
||||
# Change to false for releases
|
||||
@@ -21,7 +27,7 @@ set(DEVELOPMENT_BUILD FALSE)
|
||||
|
||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
if(VERSION_EXTRA)
|
||||
set(VERSION_STRING ${VERSION_STRING}-${VERSION_EXTRA})
|
||||
set(VERSION_STRING "${VERSION_STRING}-${VERSION_EXTRA}")
|
||||
elseif(DEVELOPMENT_BUILD)
|
||||
set(VERSION_STRING "${VERSION_STRING}-dev")
|
||||
endif()
|
||||
@@ -46,7 +52,7 @@ set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL
|
||||
set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
|
||||
set(BUILD_SERVER FALSE CACHE BOOL "Build server")
|
||||
set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
|
||||
|
||||
set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")
|
||||
|
||||
set(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build")
|
||||
|
||||
@@ -55,12 +61,80 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
||||
endif()
|
||||
|
||||
set(ENABLE_UPDATE_CHECKER (NOT ${DEVELOPMENT_BUILD}) CACHE BOOL
|
||||
"Whether to enable update checks by default")
|
||||
|
||||
# Included stuff
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
|
||||
# This is done here so that relative search paths are more reasonable
|
||||
find_package(Irrlicht)
|
||||
set(IRRLICHTMT_BUILD_DIR "" CACHE PATH "Path to IrrlichtMt build directory.")
|
||||
if(NOT "${IRRLICHTMT_BUILD_DIR}" STREQUAL "")
|
||||
find_package(IrrlichtMt QUIET
|
||||
PATHS "${IRRLICHTMT_BUILD_DIR}"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(NOT TARGET IrrlichtMt::IrrlichtMt)
|
||||
# find_package() searches certain subdirectories. ${PATH}/cmake is not
|
||||
# the only one, but it is the one where IrrlichtMt is supposed to export
|
||||
# IrrlichtMtConfig.cmake
|
||||
message(FATAL_ERROR "Could not find IrrlichtMtConfig.cmake in ${IRRLICHTMT_BUILD_DIR}/cmake.")
|
||||
endif()
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt")
|
||||
message(STATUS "Using user-provided IrrlichtMt at subdirectory 'lib/irrlichtmt'")
|
||||
if(BUILD_CLIENT)
|
||||
# tell IrrlichtMt to create a static library
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library" FORCE)
|
||||
add_subdirectory(lib/irrlichtmt EXCLUDE_FROM_ALL)
|
||||
unset(BUILD_SHARED_LIBS CACHE)
|
||||
|
||||
if(NOT TARGET IrrlichtMt)
|
||||
message(FATAL_ERROR "IrrlichtMt project is missing a CMake target?!")
|
||||
endif()
|
||||
else()
|
||||
add_library(IrrlichtMt::IrrlichtMt INTERFACE IMPORTED)
|
||||
set_target_properties(IrrlichtMt::IrrlichtMt PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt/include")
|
||||
endif()
|
||||
else()
|
||||
find_package(IrrlichtMt QUIET)
|
||||
if(NOT TARGET IrrlichtMt::IrrlichtMt)
|
||||
string(CONCAT explanation_msg
|
||||
"The Minetest team has forked Irrlicht to make their own customizations. "
|
||||
"It can be found here: https://github.com/minetest/irrlicht\n"
|
||||
"For example use: git clone --depth=1 https://github.com/minetest/irrlicht lib/irrlichtmt\n")
|
||||
if(BUILD_CLIENT)
|
||||
message(FATAL_ERROR "IrrlichtMt is required to build the client, but it was not found.\n${explanation_msg}")
|
||||
endif()
|
||||
|
||||
include(MinetestFindIrrlichtHeaders)
|
||||
if(NOT IRRLICHT_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "IrrlichtMt headers are required to build the server, but none found.\n${explanation_msg}")
|
||||
endif()
|
||||
message(STATUS "Found IrrlichtMt headers: ${IRRLICHT_INCLUDE_DIR}")
|
||||
add_library(IrrlichtMt::IrrlichtMt INTERFACE IMPORTED)
|
||||
# Note that we can't use target_include_directories() since that doesn't work for IMPORTED targets before CMake 3.11
|
||||
set_target_properties(IrrlichtMt::IrrlichtMt PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${IRRLICHT_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_CLIENT AND TARGET IrrlichtMt::IrrlichtMt)
|
||||
# retrieve version somehow
|
||||
if(NOT IrrlichtMt_VERSION)
|
||||
get_target_property(IrrlichtMt_VERSION IrrlichtMt VERSION)
|
||||
endif()
|
||||
message(STATUS "Found IrrlichtMt ${IrrlichtMt_VERSION}")
|
||||
|
||||
set(TARGET_VER_S 1.9.0mt7)
|
||||
string(REPLACE "mt" "." TARGET_VER ${TARGET_VER_S})
|
||||
if(IrrlichtMt_VERSION VERSION_LESS ${TARGET_VER})
|
||||
message(FATAL_ERROR "At least IrrlichtMt ${TARGET_VER_S} is required to build")
|
||||
elseif(NOT DEVELOPMENT_BUILD AND IrrlichtMt_VERSION VERSION_GREATER ${TARGET_VER})
|
||||
message(FATAL_ERROR "IrrlichtMt ${TARGET_VER_S} is required to build")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Installation
|
||||
@@ -91,15 +165,16 @@ elseif(UNIX) # Linux, BSD etc
|
||||
set(ICONDIR "unix/icons")
|
||||
set(LOCALEDIR "locale")
|
||||
else()
|
||||
set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
|
||||
set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}")
|
||||
set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
|
||||
include(GNUInstallDirs)
|
||||
set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
|
||||
set(BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
|
||||
set(DOCDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}")
|
||||
set(MANDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_MANDIR}")
|
||||
set(EXAMPLE_CONF_DIR ${DOCDIR})
|
||||
set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
|
||||
set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo")
|
||||
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
|
||||
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
|
||||
set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/applications")
|
||||
set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/metainfo")
|
||||
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/icons")
|
||||
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -169,7 +244,6 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/devtest" DESTINATION "${SHA
|
||||
if(BUILD_CLIENT)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/shaders" DESTINATION "${SHAREDIR}/client")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")
|
||||
if(RUN_IN_PLACE)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/serverlist" DESTINATION "${SHAREDIR}/client")
|
||||
@@ -203,10 +277,10 @@ endif()
|
||||
find_package(GMP REQUIRED)
|
||||
find_package(Json REQUIRED)
|
||||
find_package(Lua REQUIRED)
|
||||
|
||||
# JsonCPP doesn't compile well on GCC 4.8
|
||||
if(NOT ENABLE_SYSTEM_JSONCPP)
|
||||
set(GCC_MINIMUM_VERSION "4.9")
|
||||
if(NOT USE_LUAJIT)
|
||||
set(LUA_BIT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/bitop)
|
||||
set(LUA_BIT_LIBRARY bitop)
|
||||
add_subdirectory(lib/bitop)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
@@ -214,16 +288,19 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
message(FATAL_ERROR "Insufficient gcc version, found ${CMAKE_CXX_COMPILER_VERSION}. "
|
||||
"Version ${GCC_MINIMUM_VERSION} or higher is required.")
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${CLANG_MINIMUM_VERSION}")
|
||||
message(FATAL_ERROR "Insufficient clang version, found ${CMAKE_CXX_COMPILER_VERSION}. "
|
||||
"Version ${CLANG_MINIMUM_VERSION} or higher is required.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_BENCHMARKS)
|
||||
add_subdirectory(lib/catch2)
|
||||
endif()
|
||||
|
||||
# Subdirectories
|
||||
# Be sure to add all relevant definitions above this
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
|
||||
|
||||
47
Dockerfile
47
Dockerfile
@@ -1,6 +1,8 @@
|
||||
FROM alpine:3.11
|
||||
ARG DOCKER_IMAGE=alpine:3.14
|
||||
FROM $DOCKER_IMAGE AS builder
|
||||
|
||||
ENV MINETEST_GAME_VERSION master
|
||||
ENV IRRLICHT_VERSION master
|
||||
|
||||
COPY .git /usr/src/minetest/.git
|
||||
COPY CMakeLists.txt /usr/src/minetest/CMakeLists.txt
|
||||
@@ -18,48 +20,49 @@ COPY textures /usr/src/minetest/textures
|
||||
|
||||
WORKDIR /usr/src/minetest
|
||||
|
||||
RUN apk add --no-cache git build-base irrlicht-dev cmake bzip2-dev libpng-dev \
|
||||
jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev \
|
||||
libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev \
|
||||
gmp-dev jsoncpp-dev postgresql-dev luajit-dev ca-certificates && \
|
||||
RUN apk add --no-cache git build-base cmake sqlite-dev curl-dev zlib-dev zstd-dev \
|
||||
gmp-dev jsoncpp-dev postgresql-dev ninja luajit-dev ca-certificates && \
|
||||
git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \
|
||||
rm -fr ./games/minetest_game/.git
|
||||
|
||||
WORKDIR /usr/src/
|
||||
RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \
|
||||
mkdir prometheus-cpp/build && \
|
||||
cd prometheus-cpp/build && \
|
||||
cmake .. \
|
||||
cd prometheus-cpp && \
|
||||
cmake -B build \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_TESTING=0 && \
|
||||
make -j2 && \
|
||||
make install
|
||||
-DENABLE_TESTING=0 \
|
||||
-GNinja && \
|
||||
cmake --build build && \
|
||||
cmake --install build
|
||||
|
||||
RUN git clone --depth=1 https://github.com/minetest/irrlicht/ -b ${IRRLICHT_VERSION} && \
|
||||
cp -r irrlicht/include /usr/include/irrlichtmt
|
||||
|
||||
WORKDIR /usr/src/minetest
|
||||
RUN mkdir build && \
|
||||
cd build && \
|
||||
cmake .. \
|
||||
RUN cmake -B build \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SERVER=TRUE \
|
||||
-DENABLE_PROMETHEUS=TRUE \
|
||||
-DBUILD_UNITTESTS=FALSE \
|
||||
-DBUILD_CLIENT=FALSE && \
|
||||
make -j2 && \
|
||||
make install
|
||||
-DBUILD_CLIENT=FALSE \
|
||||
-GNinja && \
|
||||
cmake --build build && \
|
||||
cmake --install build
|
||||
|
||||
FROM alpine:3.11
|
||||
ARG DOCKER_IMAGE=alpine:3.14
|
||||
FROM $DOCKER_IMAGE AS runtime
|
||||
|
||||
RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc libpq luajit && \
|
||||
RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc libpq luajit jsoncpp zstd-libs && \
|
||||
adduser -D minetest --uid 30000 -h /var/lib/minetest && \
|
||||
chown -R minetest:minetest /var/lib/minetest
|
||||
|
||||
WORKDIR /var/lib/minetest
|
||||
|
||||
COPY --from=0 /usr/local/share/minetest /usr/local/share/minetest
|
||||
COPY --from=0 /usr/local/bin/minetestserver /usr/local/bin/minetestserver
|
||||
COPY --from=0 /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
|
||||
COPY --from=builder /usr/local/share/minetest /usr/local/share/minetest
|
||||
COPY --from=builder /usr/local/bin/minetestserver /usr/local/bin/minetestserver
|
||||
COPY --from=builder /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
|
||||
|
||||
USER minetest:minetest
|
||||
|
||||
|
||||
22
LICENSE.txt
22
LICENSE.txt
@@ -14,6 +14,9 @@ https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
Textures by Zughy are under CC BY-SA 4.0
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
textures/base/pack/server_public.png is under CC-BY 4.0, taken from Twitter's Twemoji set
|
||||
https://creativecommons.org/licenses/by/4.0/
|
||||
|
||||
Authors of media files
|
||||
-----------------------
|
||||
Everything not listed in here:
|
||||
@@ -39,10 +42,10 @@ erlehmann:
|
||||
misc/minetest.svg
|
||||
textures/base/pack/logo.png
|
||||
|
||||
JRottm
|
||||
JRottm:
|
||||
textures/base/pack/player_marker.png
|
||||
|
||||
srifqi
|
||||
srifqi:
|
||||
textures/base/pack/chat_hide_btn.png
|
||||
textures/base/pack/chat_show_btn.png
|
||||
textures/base/pack/joystick_bg.png
|
||||
@@ -58,6 +61,18 @@ Zughy:
|
||||
textures/base/pack/cdb_update.png
|
||||
textures/base/pack/cdb_viewonline.png
|
||||
|
||||
appgurueu:
|
||||
textures/base/pack/server_incompatible.png
|
||||
|
||||
erlehmann, Warr1024, rollerozxa:
|
||||
textures/base/pack/no_screenshot.png
|
||||
|
||||
kilbith:
|
||||
textures/base/pack/server_favorite.png
|
||||
|
||||
SmallJoker
|
||||
textures/base/pack/server_favorite_delete.png (based on server_favorite.png)
|
||||
|
||||
License of Minetest source code
|
||||
-------------------------------
|
||||
|
||||
@@ -81,7 +96,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
Irrlicht
|
||||
---------------
|
||||
|
||||
This program uses the Irrlicht Engine. http://irrlicht.sourceforge.net/
|
||||
This program uses IrrlichtMt, Minetest's fork of
|
||||
the Irrlicht Engine. http://irrlicht.sourceforge.net/
|
||||
|
||||
The Irrlicht Engine License
|
||||
|
||||
|
||||
159
README.md
159
README.md
@@ -7,7 +7,7 @@ Minetest
|
||||
|
||||
Minetest is a free open-source voxel game engine with easy modding and game creation.
|
||||
|
||||
Copyright (C) 2010-2020 Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2010-2022 Perttu Ahola <celeron55@gmail.com>
|
||||
and contributors (see source file comments and the version control log)
|
||||
|
||||
In case you downloaded the source code
|
||||
@@ -68,7 +68,7 @@ Some can be changed in the key config dialog in the settings tab.
|
||||
| P | Enable/disable pitch move mode |
|
||||
| J | Enable/disable fast mode (needs fast privilege) |
|
||||
| H | Enable/disable noclip mode (needs noclip privilege) |
|
||||
| E | Move fast in fast mode |
|
||||
| E | Aux1 (Move fast in fast mode. Games may add special features) |
|
||||
| C | Cycle through camera modes |
|
||||
| V | Cycle through minimap modes |
|
||||
| Shift + V | Change minimap orientation |
|
||||
@@ -132,29 +132,31 @@ Compiling
|
||||
|
||||
| Dependency | Version | Commentary |
|
||||
|------------|---------|------------|
|
||||
| GCC | 4.9+ | Can be replaced with Clang 3.4+ |
|
||||
| CMake | 2.6+ | |
|
||||
| Irrlicht | 1.7.3+ | |
|
||||
| SQLite3 | 3.0+ | |
|
||||
| GCC | 5.1+ | or Clang 3.5+ |
|
||||
| CMake | 3.5+ | |
|
||||
| IrrlichtMt | - | Custom version of Irrlicht, see https://github.com/minetest/irrlicht |
|
||||
| Freetype | 2.0+ | |
|
||||
| SQLite3 | 3+ | |
|
||||
| Zstd | 1.0+ | |
|
||||
| LuaJIT | 2.0+ | Bundled Lua 5.1 is used if not present |
|
||||
| GMP | 5.0.0+ | Bundled mini-GMP is used if not present |
|
||||
| JsonCPP | 1.0.0+ | Bundled JsonCPP is used if not present |
|
||||
|
||||
For Debian/Ubuntu users:
|
||||
|
||||
sudo apt install g++ make libc6-dev libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev libluajit-5.1-dev
|
||||
|
||||
For Fedora users:
|
||||
|
||||
sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel
|
||||
|
||||
sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXi-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel spatialindex-devel libzstd-devel
|
||||
|
||||
For Arch users:
|
||||
|
||||
sudo pacman -S base-devel libcurl-gnutls cmake libxxf86vm irrlicht libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses
|
||||
sudo pacman -S base-devel libcurl-gnutls cmake libxi libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses zstd
|
||||
|
||||
For Alpine users:
|
||||
|
||||
sudo apk add build-base irrlicht-dev cmake bzip2-dev libpng-dev jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev
|
||||
sudo apk add build-base cmake libpng-dev jpeg-dev libxi-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev zstd-dev
|
||||
|
||||
#### Download
|
||||
|
||||
@@ -177,6 +179,10 @@ Download minetest_game (otherwise only the "Development Test" game is available)
|
||||
|
||||
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
|
||||
|
||||
Download IrrlichtMt to `lib/irrlichtmt`, it will be used to satisfy the IrrlichtMt dependency that way:
|
||||
|
||||
git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt
|
||||
|
||||
Download source, without using Git:
|
||||
|
||||
wget https://github.com/minetest/minetest/archive/master.tar.gz
|
||||
@@ -191,6 +197,14 @@ Download minetest_game, without using Git:
|
||||
mv minetest_game-master minetest_game
|
||||
cd ..
|
||||
|
||||
Download IrrlichtMt, without using Git:
|
||||
|
||||
cd lib/
|
||||
wget https://github.com/minetest/irrlicht/archive/master.tar.gz
|
||||
tar xf master.tar.gz
|
||||
mv irrlicht-master irrlichtmt
|
||||
cd ..
|
||||
|
||||
#### Build
|
||||
|
||||
Build a version that runs directly from the source directory:
|
||||
@@ -209,8 +223,15 @@ Run it:
|
||||
- You can disable the client build by specifying `-DBUILD_CLIENT=FALSE`.
|
||||
- You can select between Release and Debug build by `-DCMAKE_BUILD_TYPE=<Debug or Release>`.
|
||||
- Debug build is slower, but gives much more useful output in a debugger.
|
||||
- If you build a bare server you don't need to have Irrlicht installed.
|
||||
- In that case use `-DIRRLICHT_SOURCE_DIR=/the/irrlicht/source`.
|
||||
- If you build a bare server you don't need to compile IrrlichtMt, just the headers suffice.
|
||||
- In that case use `-DIRRLICHT_INCLUDE_DIR=/some/where/irrlichtmt/include`.
|
||||
|
||||
- Minetest will use the IrrlichtMt package that is found first, given by the following order:
|
||||
1. Specified `IRRLICHTMT_BUILD_DIR` CMake variable
|
||||
2. `${PROJECT_SOURCE_DIR}/lib/irrlichtmt` (if existent)
|
||||
3. Installation of IrrlichtMt in the system-specific library paths
|
||||
4. For server builds with disabled `BUILD_CLIENT` variable, the headers from `IRRLICHT_INCLUDE_DIR` will be used.
|
||||
- NOTE: Changing the IrrlichtMt build directory (includes system installs) requires regenerating the CMake cache (`rm CMakeCache.txt`)
|
||||
|
||||
### CMake options
|
||||
|
||||
@@ -219,6 +240,7 @@ General options and their default values:
|
||||
BUILD_CLIENT=TRUE - Build Minetest client
|
||||
BUILD_SERVER=FALSE - Build Minetest server
|
||||
BUILD_UNITTESTS=TRUE - Build unittest sources
|
||||
BUILD_BENCHMARKS=FALSE - Build benchmark sources
|
||||
CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug)
|
||||
Release - Release build
|
||||
Debug - Debug build
|
||||
@@ -227,9 +249,8 @@ General options and their default values:
|
||||
MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible
|
||||
ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
|
||||
ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
|
||||
ENABLE_FREETYPE=ON - Build with FreeType2; Allows using TTF fonts
|
||||
ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations
|
||||
ENABLE_GLES=OFF - Build for OpenGL ES instead of OpenGL (requires support by Irrlicht)
|
||||
ENABLE_GLES=OFF - Enable extra support code for OpenGL ES (requires support by IrrlichtMt)
|
||||
ENABLE_LEVELDB=ON - Build with LevelDB; Enables use of LevelDB map backend
|
||||
ENABLE_POSTGRESQL=ON - Build with libpq; Enables use of PostgreSQL map backend (PostgreSQL 9.5 or greater recommended)
|
||||
ENABLE_REDIS=ON - Build with libhiredis; Enables use of Redis map backend
|
||||
@@ -238,33 +259,31 @@ General options and their default values:
|
||||
ENABLE_LUAJIT=ON - Build with LuaJIT (much faster than non-JIT Lua)
|
||||
ENABLE_PROMETHEUS=OFF - Build with Prometheus metrics exporter (listens on tcp/30000 by default)
|
||||
ENABLE_SYSTEM_GMP=ON - Use GMP from system (much faster than bundled mini-gmp)
|
||||
ENABLE_SYSTEM_JSONCPP=OFF - Use JsonCPP from system
|
||||
OPENGL_GL_PREFERENCE=LEGACY - Linux client build only; See CMake Policy CMP0072 for reference
|
||||
ENABLE_SYSTEM_JSONCPP=ON - Use JsonCPP from system
|
||||
RUN_IN_PLACE=FALSE - Create a portable install (worlds, settings etc. in current directory)
|
||||
ENABLE_UPDATE_CHECKER=TRUE - Whether to enable update checks by default
|
||||
USE_GPROF=FALSE - Enable profiling using GProf
|
||||
VERSION_EXTRA= - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar)
|
||||
ENABLE_TOUCH=FALSE - Enable Touchscreen support (requires support by IrrlichtMt)
|
||||
|
||||
Library specific options:
|
||||
|
||||
BZIP2_INCLUDE_DIR - Linux only; directory where bzlib.h is located
|
||||
BZIP2_LIBRARY - Linux only; path to libbz2.a/libbz2.so
|
||||
CURL_DLL - Only if building with cURL on Windows; path to libcurl.dll
|
||||
CURL_INCLUDE_DIR - Only if building with cURL; directory where curl.h is located
|
||||
CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib
|
||||
EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h
|
||||
EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so
|
||||
FREETYPE_INCLUDE_DIR_freetype2 - Only if building with FreeType 2; directory that contains an freetype directory with files such as ftimage.h in it
|
||||
FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h
|
||||
FREETYPE_LIBRARY - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib
|
||||
FREETYPE_DLL - Only if building with FreeType 2 on Windows; path to libfreetype.dll
|
||||
GETTEXT_DLL - Only when building with gettext on Windows; path to libintl3.dll
|
||||
GETTEXT_ICONV_DLL - Only when building with gettext on Windows; path to libiconv2.dll
|
||||
EXTRA_DLL - Only on Windows; optional paths to additional DLLs that should be packaged
|
||||
FREETYPE_INCLUDE_DIR_freetype2 - Directory that contains files such as ftimage.h
|
||||
FREETYPE_INCLUDE_DIR_ft2build - Directory that contains ft2build.h
|
||||
FREETYPE_LIBRARY - Path to libfreetype.a/libfreetype.so/freetype.lib
|
||||
FREETYPE_DLL - Only on Windows; path to libfreetype-6.dll
|
||||
GETTEXT_DLL - Only when building with gettext on Windows; paths to libintl + libiconv DLLs
|
||||
GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h
|
||||
GETTEXT_LIBRARY - Only when building with gettext on Windows; path to libintl.dll.a
|
||||
GETTEXT_MSGFMT - Only when building with gettext; path to msgfmt/msgfmt.exe
|
||||
IRRLICHT_DLL - Only on Windows; path to Irrlicht.dll
|
||||
IRRLICHT_INCLUDE_DIR - Directory that contains IrrCompileConfig.h
|
||||
IRRLICHT_LIBRARY - Path to libIrrlicht.a/libIrrlicht.so/libIrrlicht.dll.a/Irrlicht.lib
|
||||
IRRLICHT_DLL - Only on Windows; path to IrrlichtMt.dll
|
||||
IRRLICHT_INCLUDE_DIR - Directory that contains IrrCompileConfig.h (usable for server build only)
|
||||
LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h
|
||||
LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a
|
||||
LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll
|
||||
@@ -276,28 +295,26 @@ Library specific options:
|
||||
SPATIAL_LIBRARY - Only when building with LibSpatial; path to libspatialindex_c.so/spatialindex-32.lib
|
||||
LUA_INCLUDE_DIR - Only if you want to use LuaJIT; directory where luajit.h is located
|
||||
LUA_LIBRARY - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so
|
||||
MINGWM10_DLL - Only if compiling with MinGW; path to mingwm10.dll
|
||||
OGG_DLL - Only if building with sound on Windows; path to libogg.dll
|
||||
OGG_INCLUDE_DIR - Only if building with sound; directory that contains an ogg directory which contains ogg.h
|
||||
OGG_LIBRARY - Only if building with sound; path to libogg.a/libogg.so/libogg.dll.a
|
||||
OPENAL_DLL - Only if building with sound on Windows; path to OpenAL32.dll
|
||||
OPENAL_INCLUDE_DIR - Only if building with sound; directory where al.h is located
|
||||
OPENAL_LIBRARY - Only if building with sound; path to libopenal.a/libopenal.so/OpenAL32.lib
|
||||
OPENGLES2_INCLUDE_DIR - Only if building with GLES; directory that contains gl2.h
|
||||
OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so
|
||||
SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h
|
||||
SQLITE3_LIBRARY - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib
|
||||
VORBISFILE_DLL - Only if building with sound on Windows; path to libvorbisfile-3.dll
|
||||
VORBISFILE_LIBRARY - Only if building with sound; path to libvorbisfile.a/libvorbisfile.so/libvorbisfile.dll.a
|
||||
VORBIS_DLL - Only if building with sound on Windows; path to libvorbis-0.dll
|
||||
VORBIS_DLL - Only if building with sound on Windows; paths to vorbis DLLs
|
||||
VORBIS_INCLUDE_DIR - Only if building with sound; directory that contains a directory vorbis with vorbisenc.h inside
|
||||
VORBIS_LIBRARY - Only if building with sound; path to libvorbis.a/libvorbis.so/libvorbis.dll.a
|
||||
XXF86VM_LIBRARY - Only on Linux; path to libXXf86vm.a/libXXf86vm.so
|
||||
ZLIB_DLL - Only on Windows; path to zlib1.dll
|
||||
ZLIB_INCLUDE_DIR - Directory that contains zlib.h
|
||||
ZLIB_LIBRARY - Path to libz.a/libz.so/zlib.lib
|
||||
ZSTD_DLL - Only on Windows; path to libzstd.dll
|
||||
ZSTD_INCLUDE_DIR - Directory that contains zstd.h
|
||||
ZSTD_LIBRARY - Path to libzstd.a/libzstd.so/ztd.lib
|
||||
|
||||
### Compiling on Windows
|
||||
### Compiling on Windows using MSVC
|
||||
|
||||
### Requirements
|
||||
|
||||
@@ -310,16 +327,14 @@ Library specific options:
|
||||
|
||||
It is highly recommended to use vcpkg as package manager.
|
||||
|
||||
#### a) Using vcpkg to install dependencies
|
||||
|
||||
After you successfully built vcpkg you can easily install the required libraries:
|
||||
```powershell
|
||||
vcpkg install irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit gmp jsoncpp --triplet x64-windows
|
||||
vcpkg install zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp opengl-registry --triplet x64-windows
|
||||
```
|
||||
|
||||
- **Don't forget about IrrlichtMt.** The easiest way is to clone it to `lib/irrlichtmt` as described in the Linux section.
|
||||
- `curl` is optional, but required to read the serverlist, `curl[winssl]` is required to use the content store.
|
||||
- `openal-soft`, `libvorbis` and `libogg` are optional, but required to use sound.
|
||||
- `freetype` is optional, it allows true-type font rendering.
|
||||
- `luajit` is optional, it replaces the integrated Lua interpreter with a faster just-in-time interpreter.
|
||||
- `gmp` and `jsoncpp` are optional, otherwise the bundled versions will be compiled
|
||||
|
||||
@@ -327,10 +342,6 @@ There are other optional libraries, but they are not tested if they can build an
|
||||
|
||||
Use `--triplet` to specify the target triplet, e.g. `x64-windows` or `x86-windows`.
|
||||
|
||||
#### b) Compile the dependencies on your own
|
||||
|
||||
This is outdated and not recommended. Follow the instructions on https://dev.minetest.net/Build_Win32_Minetest_including_all_required_libraries#VS2012_Build
|
||||
|
||||
### Compile Minetest
|
||||
|
||||
#### a) Using the vcpkg toolchain and CMake GUI
|
||||
@@ -354,17 +365,11 @@ This is outdated and not recommended. Follow the instructions on https://dev.min
|
||||
Run the following script in PowerShell:
|
||||
|
||||
```powershell
|
||||
cmake . -G"Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GETTEXT=OFF -DENABLE_CURSES=OFF -DENABLE_SYSTEM_JSONCPP=ON
|
||||
cmake . -G"Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GETTEXT=OFF -DENABLE_CURSES=OFF
|
||||
cmake --build . --config Release
|
||||
```
|
||||
Make sure that the right compiler is selected and the path to the vcpkg toolchain is correct.
|
||||
|
||||
#### c) Using your own compiled libraries
|
||||
|
||||
**This is outdated and not recommended**
|
||||
|
||||
Follow the instructions on https://dev.minetest.net/Build_Win32_Minetest_including_all_required_libraries#VS2012_Build
|
||||
|
||||
### Windows Installer using WiX Toolset
|
||||
|
||||
Requirements:
|
||||
@@ -378,6 +383,60 @@ Build the binaries as described above, but make sure you unselect `RUN_IN_PLACE`
|
||||
Open the generated project file with Visual Studio. Right-click **Package** and choose **Generate**.
|
||||
It may take some minutes to generate the installer.
|
||||
|
||||
### Compiling on MacOS
|
||||
|
||||
#### Requirements
|
||||
- [Homebrew](https://brew.sh/)
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
|
||||
Install dependencies with homebrew:
|
||||
|
||||
```
|
||||
brew install cmake freetype gettext gmp hiredis jpeg jsoncpp leveldb libogg libpng libvorbis luajit zstd
|
||||
```
|
||||
|
||||
#### Download
|
||||
|
||||
Download source (this is the URL to the latest of source repository, which might not work at all times) using Git:
|
||||
|
||||
```bash
|
||||
git clone --depth 1 https://github.com/minetest/minetest.git
|
||||
cd minetest
|
||||
```
|
||||
|
||||
Download minetest_game (otherwise only the "Development Test" game is available) using Git:
|
||||
|
||||
```
|
||||
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
|
||||
```
|
||||
|
||||
Download Minetest's fork of Irrlicht:
|
||||
|
||||
```
|
||||
git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt
|
||||
```
|
||||
|
||||
#### Build
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
|
||||
-DCMAKE_FIND_FRAMEWORK=LAST \
|
||||
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
|
||||
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE
|
||||
|
||||
make -j$(sysctl -n hw.logicalcpu)
|
||||
make install
|
||||
```
|
||||
|
||||
#### Run
|
||||
|
||||
```
|
||||
open ./build/macos/minetest.app
|
||||
```
|
||||
|
||||
Docker
|
||||
------
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion '30.0.3'
|
||||
ndkVersion '22.0.7026061'
|
||||
ndkVersion "$ndk_version"
|
||||
defaultConfig {
|
||||
applicationId 'net.minetest.minetest'
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
targetSdkVersion 30
|
||||
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
versionCode project.versionCode
|
||||
}
|
||||
@@ -68,7 +68,7 @@ task prepareAssets() {
|
||||
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
|
||||
}
|
||||
copy {
|
||||
from "../native/deps/Android/Irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht"
|
||||
from "../native/deps/armeabi-v7a/Irrlicht/Shaders" into "${assetsFolder}/client/shaders/Irrlicht"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
|
||||
@@ -76,10 +76,13 @@ task prepareAssets() {
|
||||
copy {
|
||||
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
|
||||
}
|
||||
/*copy {
|
||||
// ToDo: fix broken locales
|
||||
from "${projRoot}/po" into "${assetsFolder}/po"
|
||||
}*/
|
||||
fileTree("${projRoot}/po").include("**/*.po").forEach { poFile ->
|
||||
def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
|
||||
file(moPath).mkdirs()
|
||||
exec {
|
||||
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
|
||||
}
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/textures" into "${assetsFolder}/textures"
|
||||
}
|
||||
@@ -109,5 +112,5 @@ android.applicationVariants.all { variant ->
|
||||
|
||||
dependencies {
|
||||
implementation project(':native')
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
android:label="@string/label"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:resizeableActivity="false"
|
||||
android:hasFragileUserData="true"
|
||||
android:isGame="true"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<meta-data
|
||||
@@ -32,7 +30,8 @@
|
||||
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
|
||||
android:maxAspectRatio="3.0"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@@ -46,7 +45,8 @@
|
||||
android:launchMode="singleTask"
|
||||
android:maxAspectRatio="3.0"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
@@ -59,6 +59,17 @@
|
||||
android:name=".UnzipService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
</application>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="net.minetest.minetest.fileprovider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/filepaths" />
|
||||
</provider>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -26,16 +26,25 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
// Native code finds these methods by name (see porting_android.cpp).
|
||||
// This annotation prevents the minifier/Proguard from mangling them.
|
||||
@Keep
|
||||
public class GameActivity extends NativeActivity {
|
||||
static {
|
||||
System.loadLibrary("c++_shared");
|
||||
@@ -85,9 +94,19 @@ public class GameActivity extends NativeActivity {
|
||||
|
||||
private void showDialogUI(String hint, String current, int editType) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
EditText editText = new CustomEditText(this);
|
||||
builder.setView(editText);
|
||||
LinearLayout container = new LinearLayout(this);
|
||||
container.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(container);
|
||||
AlertDialog alertDialog = builder.create();
|
||||
EditText editText;
|
||||
// For multi-line, do not close the dialog after pressing back button
|
||||
if (editType == 1) {
|
||||
editText = new EditText(this);
|
||||
} else {
|
||||
editText = new CustomEditText(this);
|
||||
}
|
||||
container.addView(editText);
|
||||
editText.setMaxLines(8);
|
||||
editText.requestFocus();
|
||||
editText.setHint(hint);
|
||||
editText.setText(current);
|
||||
@@ -103,8 +122,9 @@ public class GameActivity extends NativeActivity {
|
||||
else
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
editText.setSelection(editText.getText().length());
|
||||
editText.setOnKeyListener((view, KeyCode, event) -> {
|
||||
if (KeyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
editText.setOnKeyListener((view, keyCode, event) -> {
|
||||
// For multi-line, do not submit the text after pressing Enter key
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER && editType != 1) {
|
||||
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
messageReturnCode = 0;
|
||||
messageReturnValue = editText.getText().toString();
|
||||
@@ -113,6 +133,18 @@ public class GameActivity extends NativeActivity {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// For multi-line, add Done button since Enter key does not submit text
|
||||
if (editType == 1) {
|
||||
Button doneButton = new Button(this);
|
||||
container.addView(doneButton);
|
||||
doneButton.setText(R.string.ime_dialog_done);
|
||||
doneButton.setOnClickListener((view -> {
|
||||
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
messageReturnCode = 0;
|
||||
messageReturnValue = editText.getText().toString();
|
||||
alertDialog.dismiss();
|
||||
}));
|
||||
}
|
||||
alertDialog.show();
|
||||
alertDialog.setOnCancelListener(dialog -> {
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
@@ -154,4 +186,22 @@ public class GameActivity extends NativeActivity {
|
||||
public String getCachePath() {
|
||||
return Utils.getCacheDirectory(this).getAbsolutePath();
|
||||
}
|
||||
|
||||
public void shareFile(String path) {
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
Log.e("GameActivity", "File " + file.getAbsolutePath() + " doesn't exist");
|
||||
return;
|
||||
}
|
||||
|
||||
Uri fileUri = FileProvider.getUriForFile(this, "net.minetest.minetest.fileprovider", file);
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SEND, fileUri);
|
||||
intent.setDataAndType(fileUri, getContentResolver().getType(fileUri));
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.putExtra(Intent.EXTRA_STREAM, fileUri);
|
||||
|
||||
Intent shareIntent = Intent.createChooser(intent, null);
|
||||
startActivity(shareIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
mTextView = findViewById(R.id.textView);
|
||||
sharedPreferences = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.R)
|
||||
checkPermission();
|
||||
else
|
||||
checkAppVersion();
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.os.Environment;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import java.io.File;
|
||||
@@ -200,6 +201,10 @@ public class UnzipService extends IntentService {
|
||||
* Migrates user data from deprecated external storage to app scoped storage
|
||||
*/
|
||||
private void migrate(Notification.Builder notificationBuilder, File newLocation) throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
return;
|
||||
}
|
||||
|
||||
File oldLocation = new File(Environment.getExternalStorageDirectory(), "Minetest");
|
||||
if (!oldLocation.isDirectory())
|
||||
return;
|
||||
|
||||
3
android/app/src/main/res/xml/filepaths.xml
Normal file
3
android/app/src/main/res/xml/filepaths.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<paths>
|
||||
<external-files-path path="Minetest/" name="minetest" />
|
||||
</paths>
|
||||
@@ -1,21 +1,23 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
project.ext.set("versionMajor", 5) // Version Major
|
||||
project.ext.set("versionMinor", 4) // Version Minor
|
||||
project.ext.set("versionPatch", 2) // Version Patch
|
||||
project.ext.set("versionMinor", 6) // Version Minor
|
||||
project.ext.set("versionPatch", 0) // Version Patch
|
||||
project.ext.set("versionExtra", "") // Version Extra
|
||||
project.ext.set("versionCode", 36) // Android Version Code
|
||||
project.ext.set("versionCode", 40) // Android Version Code
|
||||
project.ext.set("developmentBuild", 0) // Whether it is a development build, or a release
|
||||
// NOTE: +2 after each release!
|
||||
// +1 for ARM and +1 for ARM64 APK's, because
|
||||
// each APK must have a larger `versionCode` than the previous
|
||||
|
||||
buildscript {
|
||||
ext.ndk_version = '23.2.8568313'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||
classpath 'de.undercouch:gradle-download-task:4.1.1'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#Fri Jan 08 17:52:00 UTC 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
|
||||
2
android/gradlew
vendored
2
android/gradlew
vendored
@@ -98,7 +98,7 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
command -v java >/dev/null || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
|
||||
@@ -1,411 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="512"
|
||||
height="512"
|
||||
viewBox="0 0 135.46666 135.46667"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.1 r15371"
|
||||
sodipodi:docname="aux_btn.svg"
|
||||
inkscape:export-filename="/home/stu/Desktop/icons/png/aux_btn.png"
|
||||
inkscape:export-xdpi="24.000002"
|
||||
inkscape:export-ydpi="24.000002">
|
||||
<defs
|
||||
id="defs2">
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Colorize"
|
||||
id="filter4628">
|
||||
<feComposite
|
||||
in2="SourceGraphic"
|
||||
operator="arithmetic"
|
||||
k1="0"
|
||||
k2="1"
|
||||
result="composite1"
|
||||
id="feComposite4614" />
|
||||
<feColorMatrix
|
||||
in="composite1"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix1"
|
||||
id="feColorMatrix4616" />
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(158,0,0)"
|
||||
result="flood1"
|
||||
id="feFlood4618" />
|
||||
<feBlend
|
||||
in="flood1"
|
||||
in2="colormatrix1"
|
||||
mode="multiply"
|
||||
result="blend1"
|
||||
id="feBlend4620" />
|
||||
<feBlend
|
||||
in2="blend1"
|
||||
mode="screen"
|
||||
result="blend2"
|
||||
id="feBlend4622" />
|
||||
<feColorMatrix
|
||||
in="blend2"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix2"
|
||||
id="feColorMatrix4624" />
|
||||
<feComposite
|
||||
in="colormatrix2"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
k2="1"
|
||||
result="composite2"
|
||||
id="feComposite4626" />
|
||||
</filter>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Sharpen More"
|
||||
id="filter5109"
|
||||
inkscape:menu="Image Effects"
|
||||
inkscape:menu-tooltip="Sharpen edges and boundaries within the object, force=0.3">
|
||||
<feComposite
|
||||
in2="SourceGraphic"
|
||||
operator="arithmetic"
|
||||
k1="0"
|
||||
k2="1"
|
||||
result="composite1"
|
||||
id="feComposite5095" />
|
||||
<feColorMatrix
|
||||
in="composite1"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix1"
|
||||
id="feColorMatrix5097" />
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(158,67,0)"
|
||||
result="flood1"
|
||||
id="feFlood5099" />
|
||||
<feBlend
|
||||
in="flood1"
|
||||
in2="colormatrix1"
|
||||
mode="multiply"
|
||||
result="blend1"
|
||||
id="feBlend5101" />
|
||||
<feBlend
|
||||
in2="blend1"
|
||||
mode="screen"
|
||||
result="blend2"
|
||||
id="feBlend5103" />
|
||||
<feColorMatrix
|
||||
in="blend2"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix2"
|
||||
id="feColorMatrix5105" />
|
||||
<feComposite
|
||||
in="colormatrix2"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
k2="1"
|
||||
result="fbSourceGraphic"
|
||||
id="feComposite5107" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix5111" />
|
||||
<feComposite
|
||||
in2="fbSourceGraphic"
|
||||
id="feComposite5113"
|
||||
operator="arithmetic"
|
||||
k1="0"
|
||||
k2="1"
|
||||
result="composite1"
|
||||
in="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
id="feColorMatrix5115"
|
||||
in="composite1"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix1" />
|
||||
<feFlood
|
||||
id="feFlood5117"
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(158,0,0)"
|
||||
result="flood1" />
|
||||
<feBlend
|
||||
in2="colormatrix1"
|
||||
id="feBlend5119"
|
||||
in="flood1"
|
||||
mode="multiply"
|
||||
result="blend1" />
|
||||
<feBlend
|
||||
in2="blend1"
|
||||
id="feBlend5121"
|
||||
mode="screen"
|
||||
result="blend2" />
|
||||
<feColorMatrix
|
||||
id="feColorMatrix5123"
|
||||
in="blend2"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix2" />
|
||||
<feComposite
|
||||
in2="fbSourceGraphic"
|
||||
id="feComposite5125"
|
||||
in="colormatrix2"
|
||||
operator="in"
|
||||
k2="1"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix7007" />
|
||||
<feConvolveMatrix
|
||||
id="feConvolveMatrix7009"
|
||||
order="3 3"
|
||||
kernelMatrix="0 -0.15 0 -0.15 1.6 -0.15 0 -0.15 0"
|
||||
divisor="1"
|
||||
in="fbSourceGraphic"
|
||||
targetX="1"
|
||||
targetY="1"
|
||||
result="fbSourceGraphic" />
|
||||
<feColorMatrix
|
||||
result="fbSourceGraphicAlpha"
|
||||
in="fbSourceGraphic"
|
||||
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||
id="feColorMatrix7011" />
|
||||
<feConvolveMatrix
|
||||
id="feConvolveMatrix7013"
|
||||
targetY="1"
|
||||
targetX="1"
|
||||
in="fbSourceGraphic"
|
||||
divisor="1"
|
||||
kernelMatrix="0 -0.3 0 -0.3 2.2 -0.3 0 -0.3 0"
|
||||
order="3 3"
|
||||
result="result1" />
|
||||
<feBlend
|
||||
in2="fbSourceGraphic"
|
||||
id="feBlend7015"
|
||||
mode="normal"
|
||||
result="result2" />
|
||||
</filter>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
refY="0.0"
|
||||
refX="0.0"
|
||||
orient="auto"
|
||||
id="DistanceX">
|
||||
<path
|
||||
id="path7410"
|
||||
style="stroke:#000000; stroke-width:0.5"
|
||||
d="M 3,-3 L -3,3 M 0,-5 L 0,5" />
|
||||
</marker>
|
||||
<pattern
|
||||
y="0"
|
||||
x="0"
|
||||
width="8"
|
||||
patternUnits="userSpaceOnUse"
|
||||
id="Hatch"
|
||||
height="8">
|
||||
<path
|
||||
id="path7413"
|
||||
stroke-width="0.25"
|
||||
stroke="#000000"
|
||||
linecap="square"
|
||||
d="M8 4 l-4,4" />
|
||||
<path
|
||||
id="path7415"
|
||||
stroke-width="0.25"
|
||||
stroke="#000000"
|
||||
linecap="square"
|
||||
d="M6 2 l-4,4" />
|
||||
<path
|
||||
id="path7417"
|
||||
stroke-width="0.25"
|
||||
stroke="#000000"
|
||||
linecap="square"
|
||||
d="M4 0 l-4,4" />
|
||||
</pattern>
|
||||
<symbol
|
||||
id="*Model_Space" />
|
||||
<symbol
|
||||
id="*Paper_Space" />
|
||||
<symbol
|
||||
id="*Paper_Space0" />
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Colorize"
|
||||
id="filter4883">
|
||||
<feComposite
|
||||
in2="SourceGraphic"
|
||||
operator="arithmetic"
|
||||
k1="0"
|
||||
k2="1"
|
||||
result="composite1"
|
||||
id="feComposite4869" />
|
||||
<feColorMatrix
|
||||
in="composite1"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix1"
|
||||
id="feColorMatrix4871" />
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(158,21,0)"
|
||||
result="flood1"
|
||||
id="feFlood4873" />
|
||||
<feBlend
|
||||
in="flood1"
|
||||
in2="colormatrix1"
|
||||
mode="multiply"
|
||||
result="blend1"
|
||||
id="feBlend4875" />
|
||||
<feBlend
|
||||
in2="blend1"
|
||||
mode="screen"
|
||||
result="blend2"
|
||||
id="feBlend4877" />
|
||||
<feColorMatrix
|
||||
in="blend2"
|
||||
values="1"
|
||||
type="saturate"
|
||||
result="colormatrix2"
|
||||
id="feColorMatrix4879" />
|
||||
<feComposite
|
||||
in="colormatrix2"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
k2="1"
|
||||
result="composite2"
|
||||
id="feComposite4881" />
|
||||
</filter>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#404040"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.98994949"
|
||||
inkscape:cx="-341.34157"
|
||||
inkscape:cy="210.02973"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer2"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1023"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="34"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:pagecheckerboard="false"
|
||||
inkscape:snap-grids="false"
|
||||
inkscape:snap-page="true"
|
||||
showguides="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:snap-object-midpoints="false"
|
||||
inkscape:snap-others="true"
|
||||
inkscape:snap-bbox-midpoints="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid16"
|
||||
spacingx="0.26458333"
|
||||
spacingy="0.26458333"
|
||||
empspacing="4"
|
||||
color="#40ff40"
|
||||
opacity="0.1254902"
|
||||
empcolor="#40ff40"
|
||||
empopacity="0.25098039" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Layer 2"
|
||||
style="display:inline">
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d=""
|
||||
id="path7055"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d=""
|
||||
id="path7035"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d=""
|
||||
id="path7005"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d=""
|
||||
id="path5127"
|
||||
inkscape:connector-curvature="0" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:48.47851181px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#d9d9d9;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
x="67.78315"
|
||||
y="85.59491"
|
||||
id="text4716"
|
||||
transform="scale(1.0078883,0.99217343)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4714"
|
||||
x="67.78315"
|
||||
y="85.59491"
|
||||
style="fill:#d9d9d9;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">AUX</tspan></text>
|
||||
<flowRoot
|
||||
xml:space="preserve"
|
||||
id="flowRoot4718"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
|
||||
transform="scale(0.26458333)"><flowRegion
|
||||
id="flowRegion4720"
|
||||
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><rect
|
||||
id="rect4722"
|
||||
width="157.5838"
|
||||
height="136.37059"
|
||||
x="264.65997"
|
||||
y="124.10143"
|
||||
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-opacity:1" /></flowRegion><flowPara
|
||||
id="flowPara4724" /></flowRoot> </g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 12 KiB |
@@ -2,19 +2,20 @@ apply plugin: 'com.android.library'
|
||||
apply plugin: 'de.undercouch.download'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion '30.0.3'
|
||||
ndkVersion '22.0.7026061'
|
||||
ndkVersion "$ndk_version"
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
targetSdkVersion 30
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments '-j' + Runtime.getRuntime().availableProcessors(),
|
||||
"versionMajor=${versionMajor}",
|
||||
"versionMinor=${versionMinor}",
|
||||
"versionPatch=${versionPatch}",
|
||||
"versionExtra=${versionExtra}"
|
||||
"versionExtra=${versionExtra}",
|
||||
"developmentBuild=${developmentBuild}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,54 +51,19 @@ android {
|
||||
}
|
||||
|
||||
// get precompiled deps
|
||||
def folder = 'minetest_android_deps_binaries'
|
||||
def deps_ref = "342eb18b7512462585a33bc9eef0b68298087151"
|
||||
|
||||
task downloadDeps(type: Download) {
|
||||
src 'https://github.com/minetest/' + folder + '/archive/' + deps_ref + '.zip'
|
||||
src 'https://github.com/minetest/minetest_android_deps/releases/download/latest/deps.zip'
|
||||
dest new File(buildDir, 'deps.zip')
|
||||
overwrite false
|
||||
}
|
||||
|
||||
task getDeps(dependsOn: downloadDeps, type: Copy) {
|
||||
def deps = file('deps')
|
||||
def f = file("$buildDir/" + folder + "-" + deps_ref)
|
||||
|
||||
if (!deps.exists() && !f.exists()) {
|
||||
def deps = new File(buildDir.parent, 'deps')
|
||||
if (!deps.exists()) {
|
||||
deps.mkdir()
|
||||
from zipTree(downloadDeps.dest)
|
||||
into buildDir
|
||||
}
|
||||
|
||||
doLast {
|
||||
if (!deps.exists()) {
|
||||
file(f).renameTo(file(deps))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get sqlite
|
||||
def sqlite_ver = '3340000'
|
||||
task downloadSqlite(dependsOn: getDeps, type: Download) {
|
||||
src 'https://www.sqlite.org/2020/sqlite-amalgamation-' + sqlite_ver + '.zip'
|
||||
dest new File(buildDir, 'sqlite.zip')
|
||||
overwrite false
|
||||
}
|
||||
|
||||
task getSqlite(dependsOn: downloadSqlite, type: Copy) {
|
||||
def sqlite = file('deps/Android/sqlite')
|
||||
def f = file("$buildDir/sqlite-amalgamation-" + sqlite_ver)
|
||||
|
||||
if (!sqlite.exists() && !f.exists()) {
|
||||
from zipTree(downloadSqlite.dest)
|
||||
into buildDir
|
||||
}
|
||||
|
||||
doLast {
|
||||
if (!sqlite.exists()) {
|
||||
file(f).renameTo(file(sqlite))
|
||||
}
|
||||
into deps
|
||||
}
|
||||
}
|
||||
|
||||
preBuild.dependsOn getDeps
|
||||
preBuild.dependsOn getSqlite
|
||||
|
||||
@@ -1,67 +1,90 @@
|
||||
LOCAL_PATH := $(call my-dir)/..
|
||||
|
||||
#LOCAL_ADDRESS_SANITIZER:=true
|
||||
#USE_BUILTIN_LUA:=true
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Curl
|
||||
LOCAL_SRC_FILES := deps/Android/Curl/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libcurl.a
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libcurl.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libmbedcrypto
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libmbedcrypto.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libmbedtls
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libmbedtls.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libmbedx509
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libmbedx509.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Freetype
|
||||
LOCAL_SRC_FILES := deps/Android/Freetype/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libfreetype.a
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Freetype/libfreetype.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Iconv
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Iconv/libiconv.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libcharset
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Iconv/libcharset.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Irrlicht
|
||||
LOCAL_SRC_FILES := deps/Android/Irrlicht/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libIrrlicht.a
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Irrlicht/libIrrlichtMt.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#include $(CLEAR_VARS)
|
||||
#LOCAL_MODULE := LevelDB
|
||||
#LOCAL_SRC_FILES := deps/Android/LevelDB/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libleveldb.a
|
||||
#include $(PREBUILT_STATIC_LIBRARY)
|
||||
ifndef USE_BUILTIN_LUA
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := LuaJIT
|
||||
LOCAL_SRC_FILES := deps/Android/LuaJIT/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libluajit.a
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/LuaJIT/libluajit.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := mbedTLS
|
||||
LOCAL_SRC_FILES := deps/Android/mbedTLS/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libmbedtls.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := mbedx509
|
||||
LOCAL_SRC_FILES := deps/Android/mbedTLS/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libmbedx509.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := mbedcrypto
|
||||
LOCAL_SRC_FILES := deps/Android/mbedTLS/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libmbedcrypto.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := OpenAL
|
||||
LOCAL_SRC_FILES := deps/Android/OpenAL-Soft/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libopenal.a
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/OpenAL-Soft/libopenal.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
# You can use `OpenSSL and Crypto` instead `mbedTLS mbedx509 mbedcrypto`,
|
||||
#but it increase APK size on ~0.7MB
|
||||
#include $(CLEAR_VARS)
|
||||
#LOCAL_MODULE := OpenSSL
|
||||
#LOCAL_SRC_FILES := deps/Android/OpenSSL/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libssl.a
|
||||
#include $(PREBUILT_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Gettext
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Gettext/libintl.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#include $(CLEAR_VARS)
|
||||
#LOCAL_MODULE := Crypto
|
||||
#LOCAL_SRC_FILES := deps/Android/OpenSSL/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libcrypto.a
|
||||
#include $(PREBUILT_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := SQLite3
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/SQLite/libsqlite3.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Vorbis
|
||||
LOCAL_SRC_FILES := deps/Android/Vorbis/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libvorbis.a
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Vorbis/libvorbis.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libvorbisfile
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Vorbis/libvorbisfile.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libogg
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Vorbis/libogg.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Zstd
|
||||
LOCAL_SRC_FILES := deps/$(APP_ABI)/Zstd/libzstd.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
@@ -73,15 +96,21 @@ LOCAL_CFLAGS += \
|
||||
-DENABLE_GLES=1 \
|
||||
-DUSE_CURL=1 \
|
||||
-DUSE_SOUND=1 \
|
||||
-DUSE_FREETYPE=1 \
|
||||
-DUSE_LEVELDB=0 \
|
||||
-DUSE_LUAJIT=1 \
|
||||
-DUSE_GETTEXT=1 \
|
||||
-DVERSION_MAJOR=${versionMajor} \
|
||||
-DVERSION_MINOR=${versionMinor} \
|
||||
-DVERSION_PATCH=${versionPatch} \
|
||||
-DVERSION_EXTRA=${versionExtra} \
|
||||
-DDEVELOPMENT_BUILD=${developmentBuild} \
|
||||
$(GPROF_DEF)
|
||||
|
||||
ifdef USE_BUILTIN_LUA
|
||||
LOCAL_CFLAGS += -DUSE_LUAJIT=0
|
||||
else
|
||||
LOCAL_CFLAGS += -DUSE_LUAJIT=1
|
||||
endif
|
||||
|
||||
ifdef NDEBUG
|
||||
LOCAL_CFLAGS += -DNDEBUG=1
|
||||
endif
|
||||
@@ -97,16 +126,23 @@ LOCAL_C_INCLUDES := \
|
||||
../../src/script \
|
||||
../../lib/gmp \
|
||||
../../lib/jsoncpp \
|
||||
deps/Android/Curl/include \
|
||||
deps/Android/Freetype/include \
|
||||
deps/Android/Irrlicht/include \
|
||||
deps/Android/LevelDB/include \
|
||||
deps/Android/libiconv/include \
|
||||
deps/Android/libiconv/libcharset/include \
|
||||
deps/Android/LuaJIT/src \
|
||||
deps/Android/OpenAL-Soft/include \
|
||||
deps/Android/sqlite \
|
||||
deps/Android/Vorbis/include
|
||||
deps/$(APP_ABI)/Curl/include \
|
||||
deps/$(APP_ABI)/Freetype/include/freetype2 \
|
||||
deps/$(APP_ABI)/Irrlicht/include \
|
||||
deps/$(APP_ABI)/Gettext/include \
|
||||
deps/$(APP_ABI)/Iconv/include \
|
||||
deps/$(APP_ABI)/OpenAL-Soft/include \
|
||||
deps/$(APP_ABI)/SQLite/include \
|
||||
deps/$(APP_ABI)/Vorbis/include \
|
||||
deps/$(APP_ABI)/Zstd/include
|
||||
|
||||
ifdef USE_BUILTIN_LUA
|
||||
LOCAL_C_INCLUDES += \
|
||||
../../lib/lua/src \
|
||||
../../lib/bitop
|
||||
else
|
||||
LOCAL_C_INCLUDES += deps/$(APP_ABI)/LuaJIT/include
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(wildcard ../../src/client/*.cpp) \
|
||||
@@ -189,8 +225,40 @@ LOCAL_SRC_FILES := \
|
||||
../../src/voxel.cpp \
|
||||
../../src/voxelalgorithms.cpp
|
||||
|
||||
# LevelDB backend is disabled
|
||||
# ../../src/database/database-leveldb.cpp
|
||||
# Built-in Lua
|
||||
ifdef USE_BUILTIN_LUA
|
||||
LOCAL_SRC_FILES += \
|
||||
../../lib/lua/src/lapi.c \
|
||||
../../lib/lua/src/lauxlib.c \
|
||||
../../lib/lua/src/lbaselib.c \
|
||||
../../lib/lua/src/lcode.c \
|
||||
../../lib/lua/src/ldblib.c \
|
||||
../../lib/lua/src/ldebug.c \
|
||||
../../lib/lua/src/ldo.c \
|
||||
../../lib/lua/src/ldump.c \
|
||||
../../lib/lua/src/lfunc.c \
|
||||
../../lib/lua/src/lgc.c \
|
||||
../../lib/lua/src/linit.c \
|
||||
../../lib/lua/src/liolib.c \
|
||||
../../lib/lua/src/llex.c \
|
||||
../../lib/lua/src/lmathlib.c \
|
||||
../../lib/lua/src/lmem.c \
|
||||
../../lib/lua/src/loadlib.c \
|
||||
../../lib/lua/src/lobject.c \
|
||||
../../lib/lua/src/lopcodes.c \
|
||||
../../lib/lua/src/loslib.c \
|
||||
../../lib/lua/src/lparser.c \
|
||||
../../lib/lua/src/lstate.c \
|
||||
../../lib/lua/src/lstring.c \
|
||||
../../lib/lua/src/lstrlib.c \
|
||||
../../lib/lua/src/ltable.c \
|
||||
../../lib/lua/src/ltablib.c \
|
||||
../../lib/lua/src/ltm.c \
|
||||
../../lib/lua/src/lundump.c \
|
||||
../../lib/lua/src/lvm.c \
|
||||
../../lib/lua/src/lzio.c \
|
||||
../../lib/bitop/bit.c
|
||||
endif
|
||||
|
||||
# GMP
|
||||
LOCAL_SRC_FILES += ../../lib/gmp/mini-gmp.c
|
||||
@@ -198,16 +266,20 @@ LOCAL_SRC_FILES += ../../lib/gmp/mini-gmp.c
|
||||
# JSONCPP
|
||||
LOCAL_SRC_FILES += ../../lib/jsoncpp/jsoncpp.cpp
|
||||
|
||||
# iconv
|
||||
LOCAL_SRC_FILES += \
|
||||
deps/Android/libiconv/lib/iconv.c \
|
||||
deps/Android/libiconv/libcharset/lib/localcharset.c
|
||||
|
||||
# SQLite3
|
||||
LOCAL_SRC_FILES += deps/Android/sqlite/sqlite3.c
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += Curl Freetype Irrlicht OpenAL mbedTLS mbedx509 mbedcrypto Vorbis LuaJIT android_native_app_glue $(PROFILER_LIBS) #LevelDB
|
||||
#OpenSSL Crypto
|
||||
LOCAL_STATIC_LIBRARIES += \
|
||||
Curl libmbedcrypto libmbedtls libmbedx509 \
|
||||
Freetype \
|
||||
Iconv libcharset \
|
||||
Irrlicht \
|
||||
OpenAL \
|
||||
Gettext \
|
||||
SQLite3 \
|
||||
Vorbis libvorbisfile libogg \
|
||||
Zstd
|
||||
ifndef USE_BUILTIN_LUA
|
||||
LOCAL_STATIC_LIBRARIES += LuaJIT
|
||||
endif
|
||||
LOCAL_STATIC_LIBRARIES += android_native_app_glue $(PROFILER_LIBS)
|
||||
|
||||
LOCAL_LDLIBS := -lEGL -lGLESv1_CM -lGLESv2 -landroid -lOpenSLES
|
||||
|
||||
|
||||
@@ -5,22 +5,22 @@ NDK_TOOLCHAIN_VERSION := clang
|
||||
APP_SHORT_COMMANDS := true
|
||||
APP_MODULES := Minetest
|
||||
|
||||
APP_CPPFLAGS := -Ofast -fvisibility=hidden -fexceptions -Wno-deprecated-declarations -Wno-extra-tokens
|
||||
APP_CPPFLAGS := -O2 -fvisibility=hidden
|
||||
|
||||
ifeq ($(APP_ABI),armeabi-v7a)
|
||||
APP_CPPFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb
|
||||
APP_CPPFLAGS += -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb
|
||||
endif
|
||||
|
||||
#ifeq ($(APP_ABI),x86)
|
||||
#APP_CPPFLAGS += -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -funroll-loops
|
||||
#endif
|
||||
ifeq ($(APP_ABI),x86)
|
||||
APP_CPPFLAGS += -mssse3 -mfpmath=sse -funroll-loops
|
||||
endif
|
||||
|
||||
ifndef NDEBUG
|
||||
APP_CPPFLAGS := -g -D_DEBUG -O0 -fno-omit-frame-pointer -fexceptions
|
||||
APP_CPPFLAGS := -g -Og -fno-omit-frame-pointer
|
||||
endif
|
||||
|
||||
APP_CFLAGS := $(APP_CPPFLAGS) -Wno-parentheses-equality #-Werror=shorten-64-to-32
|
||||
APP_CXXFLAGS := $(APP_CPPFLAGS) -frtti -std=gnu++17
|
||||
APP_CFLAGS := $(APP_CPPFLAGS) -Wno-inconsistent-missing-override -Wno-parentheses-equality
|
||||
APP_CXXFLAGS := $(APP_CPPFLAGS) -fexceptions -frtti -std=gnu++14
|
||||
APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
|
||||
ifeq ($(APP_ABI),arm64-v8a)
|
||||
|
||||
59
builtin/async/game.lua
Normal file
59
builtin/async/game.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
core.log("info", "Initializing asynchronous environment (game)")
|
||||
|
||||
local function pack2(...)
|
||||
return {n=select('#', ...), ...}
|
||||
end
|
||||
|
||||
-- Entrypoint to run async jobs, called by C++
|
||||
function core.job_processor(func, params)
|
||||
local retval = pack2(func(unpack(params, 1, params.n)))
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
-- Import a bunch of individual files from builtin/game/
|
||||
local gamepath = core.get_builtin_path() .. "game" .. DIR_DELIM
|
||||
|
||||
dofile(gamepath .. "constants.lua")
|
||||
dofile(gamepath .. "item_s.lua")
|
||||
dofile(gamepath .. "misc_s.lua")
|
||||
dofile(gamepath .. "features.lua")
|
||||
dofile(gamepath .. "voxelarea.lua")
|
||||
|
||||
-- Transfer of globals
|
||||
do
|
||||
local all = assert(core.transferred_globals)
|
||||
core.transferred_globals = nil
|
||||
|
||||
all.registered_nodes = {}
|
||||
all.registered_craftitems = {}
|
||||
all.registered_tools = {}
|
||||
for k, v in pairs(all.registered_items) do
|
||||
-- Disable further modification
|
||||
setmetatable(v, {__newindex = {}})
|
||||
-- Reassemble the other tables
|
||||
if v.type == "node" then
|
||||
all.registered_nodes[k] = v
|
||||
elseif v.type == "craftitem" then
|
||||
all.registered_craftitems[k] = v
|
||||
elseif v.type == "tool" then
|
||||
all.registered_tools[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(all) do
|
||||
core[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- For tables that are indexed by item name:
|
||||
-- If table[X] does not exist, default to table[core.registered_aliases[X]]
|
||||
local alias_metatable = {
|
||||
__index = function(t, name)
|
||||
return rawget(t, core.registered_aliases[name])
|
||||
end
|
||||
}
|
||||
setmetatable(core.registered_items, alias_metatable)
|
||||
setmetatable(core.registered_nodes, alias_metatable)
|
||||
setmetatable(core.registered_craftitems, alias_metatable)
|
||||
setmetatable(core.registered_tools, alias_metatable)
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
core.log("info", "Initializing Asynchronous environment")
|
||||
|
||||
function core.job_processor(serialized_func, serialized_param)
|
||||
local func = loadstring(serialized_func)
|
||||
local param = core.deserialize(serialized_param)
|
||||
local retval = nil
|
||||
|
||||
if type(func) == "function" then
|
||||
retval = core.serialize(func(param))
|
||||
else
|
||||
core.log("error", "ASYNC WORKER: Unable to deserialize function")
|
||||
end
|
||||
|
||||
return retval or core.serialize(nil)
|
||||
end
|
||||
|
||||
9
builtin/async/mainmenu.lua
Normal file
9
builtin/async/mainmenu.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
core.log("info", "Initializing asynchronous environment")
|
||||
|
||||
function core.job_processor(func, serialized_param)
|
||||
local param = core.deserialize(serialized_param)
|
||||
|
||||
local retval = core.serialize(func(param))
|
||||
|
||||
return retval or core.serialize(nil)
|
||||
end
|
||||
@@ -1,6 +1,5 @@
|
||||
-- Minetest: builtin/client/chatcommands.lua
|
||||
|
||||
|
||||
core.register_on_sending_chat_message(function(message)
|
||||
if message:sub(1,2) == ".." then
|
||||
return false
|
||||
@@ -8,7 +7,7 @@ core.register_on_sending_chat_message(function(message)
|
||||
|
||||
local first_char = message:sub(1,1)
|
||||
if first_char == "/" or first_char == "." then
|
||||
core.display_chat_message(core.gettext("issued command: ") .. message)
|
||||
core.display_chat_message(core.gettext("Issued command: ") .. message)
|
||||
end
|
||||
|
||||
if first_char ~= "." then
|
||||
@@ -19,7 +18,7 @@ core.register_on_sending_chat_message(function(message)
|
||||
param = param or ""
|
||||
|
||||
if not cmd then
|
||||
core.display_chat_message(core.gettext("-!- Empty command"))
|
||||
core.display_chat_message("-!- " .. core.gettext("Empty command."))
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -36,7 +35,7 @@ core.register_on_sending_chat_message(function(message)
|
||||
core.display_chat_message(result)
|
||||
end
|
||||
else
|
||||
core.display_chat_message(core.gettext("-!- Invalid command: ") .. cmd)
|
||||
core.display_chat_message("-!- " .. core.gettext("Invalid command: ") .. cmd)
|
||||
end
|
||||
|
||||
return true
|
||||
@@ -66,7 +65,7 @@ core.register_chatcommand("clear_chat_queue", {
|
||||
description = core.gettext("Clear the out chat queue"),
|
||||
func = function(param)
|
||||
core.clear_out_chat_queue()
|
||||
return true, core.gettext("The out chat queue is now empty")
|
||||
return true, core.gettext("The out chat queue is now empty.")
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
-- handled by the engine.
|
||||
|
||||
core.register_on_death(function()
|
||||
core.display_chat_message("You died.")
|
||||
local formspec = "size[11,5.5]bgcolor[#320000b4;true]" ..
|
||||
"label[4.85,1.35;" .. fgettext("You died") ..
|
||||
"]button_exit[4,3;3,0.5;btn_respawn;".. fgettext("Respawn") .."]"
|
||||
|
||||
@@ -5,7 +5,8 @@ local commonpath = scriptpath.."common"..DIR_DELIM
|
||||
|
||||
dofile(clientpath .. "register.lua")
|
||||
dofile(commonpath .. "after.lua")
|
||||
dofile(commonpath .. "mod_storage.lua")
|
||||
dofile(commonpath .. "chatcommands.lua")
|
||||
dofile(clientpath .. "chatcommands.lua")
|
||||
dofile(commonpath .. "vector.lua")
|
||||
dofile(clientpath .. "death_formspec.lua")
|
||||
dofile(clientpath .. "misc.lua")
|
||||
|
||||
7
builtin/client/misc.lua
Normal file
7
builtin/client/misc.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
function core.setting_get_pos(name)
|
||||
local value = core.settings:get(name)
|
||||
if not value then
|
||||
return nil
|
||||
end
|
||||
return core.string_to_pos(value)
|
||||
end
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
core.callback_origins = {}
|
||||
|
||||
local getinfo = debug.getinfo
|
||||
|
||||
@@ -37,7 +37,14 @@ function core.after(after, func, ...)
|
||||
arg = {...},
|
||||
mod_origin = core.get_last_run_mod(),
|
||||
}
|
||||
|
||||
jobs[#jobs + 1] = new_job
|
||||
time_next = math.min(time_next, expire)
|
||||
return { cancel = function() new_job.func = function() end end }
|
||||
|
||||
return {
|
||||
cancel = function()
|
||||
new_job.func = function() end
|
||||
new_job.args = {}
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1,7 +1,47 @@
|
||||
-- Minetest: builtin/common/chatcommands.lua
|
||||
|
||||
-- For server-side translations (if INIT == "game")
|
||||
-- Otherwise, use core.gettext
|
||||
local S = core.get_translator("__builtin")
|
||||
|
||||
core.registered_chatcommands = {}
|
||||
|
||||
-- Interpret the parameters of a command, separating options and arguments.
|
||||
-- Input: command, param
|
||||
-- command: name of command
|
||||
-- param: parameters of command
|
||||
-- Returns: opts, args
|
||||
-- opts is a string of option letters, or false on error
|
||||
-- args is an array with the non-option arguments in order, or an error message
|
||||
-- Example: for this command line:
|
||||
-- /command a b -cd e f -g
|
||||
-- the function would receive:
|
||||
-- a b -cd e f -g
|
||||
-- and it would return:
|
||||
-- "cdg", {"a", "b", "e", "f"}
|
||||
-- Negative numbers are taken as arguments. Long options (--option) are
|
||||
-- currently rejected as reserved.
|
||||
local function getopts(command, param)
|
||||
local opts = ""
|
||||
local args = {}
|
||||
for match in param:gmatch("%S+") do
|
||||
if match:byte(1) == 45 then -- 45 = '-'
|
||||
local second = match:byte(2)
|
||||
if second == 45 then
|
||||
return false, S("Invalid parameters (see /help @1).", command)
|
||||
elseif second and (second < 48 or second > 57) then -- 48 = '0', 57 = '9'
|
||||
opts = opts .. match:sub(2)
|
||||
else
|
||||
-- numeric, add it to args
|
||||
args[#args + 1] = match
|
||||
end
|
||||
else
|
||||
args[#args + 1] = match
|
||||
end
|
||||
end
|
||||
return opts, args
|
||||
end
|
||||
|
||||
function core.register_chatcommand(cmd, def)
|
||||
def = def or {}
|
||||
def.params = def.params or ""
|
||||
@@ -29,35 +69,30 @@ function core.override_chatcommand(name, redefinition)
|
||||
core.registered_chatcommands[name] = chatcommand
|
||||
end
|
||||
|
||||
local cmd_marker = "/"
|
||||
|
||||
local function gettext(...)
|
||||
return ...
|
||||
end
|
||||
|
||||
local function gettext_replace(text, replace)
|
||||
return text:gsub("$1", replace)
|
||||
end
|
||||
|
||||
|
||||
if INIT == "client" then
|
||||
cmd_marker = "."
|
||||
gettext = core.gettext
|
||||
gettext_replace = fgettext_ne
|
||||
local function format_help_line(cmd, def)
|
||||
local cmd_marker = INIT == "client" and "." or "/"
|
||||
local msg = core.colorize("#00ffff", cmd_marker .. cmd)
|
||||
if def.params and def.params ~= "" then
|
||||
msg = msg .. " " .. def.params
|
||||
end
|
||||
if def.description and def.description ~= "" then
|
||||
msg = msg .. ": " .. def.description
|
||||
end
|
||||
return msg
|
||||
end
|
||||
|
||||
local function do_help_cmd(name, param)
|
||||
local function format_help_line(cmd, def)
|
||||
local msg = core.colorize("#00ffff", cmd_marker .. cmd)
|
||||
if def.params and def.params ~= "" then
|
||||
msg = msg .. " " .. def.params
|
||||
end
|
||||
if def.description and def.description ~= "" then
|
||||
msg = msg .. ": " .. def.description
|
||||
end
|
||||
return msg
|
||||
local opts, args = getopts("help", param)
|
||||
if not opts then
|
||||
return false, args
|
||||
end
|
||||
if param == "" then
|
||||
if #args > 1 then
|
||||
return false, S("Too many arguments, try using just /help <command>")
|
||||
end
|
||||
local use_gui = INIT ~= "client" and core.get_player_by_name(name)
|
||||
use_gui = use_gui and not opts:find("t")
|
||||
|
||||
if #args == 0 and not use_gui then
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(core.registered_chatcommands) do
|
||||
if INIT == "client" or core.check_player_privs(name, def.privs) then
|
||||
@@ -65,10 +100,25 @@ local function do_help_cmd(name, param)
|
||||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, gettext("Available commands: ") .. table.concat(cmds, " ") .. "\n"
|
||||
.. gettext_replace("Use '$1help <cmd>' to get more information,"
|
||||
.. " or '$1help all' to list everything.", cmd_marker)
|
||||
elseif param == "all" then
|
||||
local msg
|
||||
if INIT == "game" then
|
||||
msg = S("Available commands: @1",
|
||||
table.concat(cmds, " ")) .. "\n"
|
||||
.. S("Use '/help <cmd>' to get more "
|
||||
.. "information, or '/help all' to list "
|
||||
.. "everything.")
|
||||
else
|
||||
msg = core.gettext("Available commands: ")
|
||||
.. table.concat(cmds, " ") .. "\n"
|
||||
.. core.gettext("Use '.help <cmd>' to get more "
|
||||
.. "information, or '.help all' to list "
|
||||
.. "everything.")
|
||||
end
|
||||
return true, msg
|
||||
elseif #args == 0 or (args[1] == "all" and use_gui) then
|
||||
core.show_general_help_formspec(name)
|
||||
return true
|
||||
elseif args[1] == "all" then
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(core.registered_chatcommands) do
|
||||
if INIT == "client" or core.check_player_privs(name, def.privs) then
|
||||
@@ -76,19 +126,35 @@ local function do_help_cmd(name, param)
|
||||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, gettext("Available commands:").."\n"..table.concat(cmds, "\n")
|
||||
elseif INIT == "game" and param == "privs" then
|
||||
local msg
|
||||
if INIT == "game" then
|
||||
msg = S("Available commands:")
|
||||
else
|
||||
msg = core.gettext("Available commands:")
|
||||
end
|
||||
return true, msg.."\n"..table.concat(cmds, "\n")
|
||||
elseif INIT == "game" and args[1] == "privs" then
|
||||
if use_gui then
|
||||
core.show_privs_help_formspec(name)
|
||||
return true
|
||||
end
|
||||
local privs = {}
|
||||
for priv, def in pairs(core.registered_privileges) do
|
||||
privs[#privs + 1] = priv .. ": " .. def.description
|
||||
end
|
||||
table.sort(privs)
|
||||
return true, "Available privileges:\n"..table.concat(privs, "\n")
|
||||
return true, S("Available privileges:").."\n"..table.concat(privs, "\n")
|
||||
else
|
||||
local cmd = param
|
||||
local cmd = args[1]
|
||||
local def = core.registered_chatcommands[cmd]
|
||||
if not def then
|
||||
return false, gettext("Command not available: ")..cmd
|
||||
local msg
|
||||
if INIT == "game" then
|
||||
msg = S("Command not available: @1", cmd)
|
||||
else
|
||||
msg = core.gettext("Command not available: ") .. cmd
|
||||
end
|
||||
return false, msg
|
||||
else
|
||||
return true, format_help_line(cmd, def)
|
||||
end
|
||||
@@ -97,16 +163,16 @@ end
|
||||
|
||||
if INIT == "client" then
|
||||
core.register_chatcommand("help", {
|
||||
params = gettext("[all | <cmd>]"),
|
||||
description = gettext("Get help for commands"),
|
||||
params = core.gettext("[all | <cmd>]"),
|
||||
description = core.gettext("Get help for commands"),
|
||||
func = function(param)
|
||||
return do_help_cmd(nil, param)
|
||||
end,
|
||||
})
|
||||
else
|
||||
core.register_chatcommand("help", {
|
||||
params = "[all | privs | <cmd>]",
|
||||
description = "Get help for commands or list privileges",
|
||||
params = S("[all | privs | <cmd>] [-t]"),
|
||||
description = S("Get help for commands or list privileges (-t: output in chat)"),
|
||||
func = do_help_cmd,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -20,8 +20,8 @@ local LIST_FORMSPEC_DESCRIPTION = [[
|
||||
button_exit[5,7;3,1;quit;%s]
|
||||
]]
|
||||
|
||||
local formspec_escape = core.formspec_escape
|
||||
local check_player_privs = core.check_player_privs
|
||||
local F = core.formspec_escape
|
||||
local S = core.get_translator("__builtin")
|
||||
|
||||
|
||||
-- CHAT COMMANDS FORMSPEC
|
||||
@@ -51,22 +51,24 @@ core.after(0, load_mod_command_tree)
|
||||
|
||||
local function build_chatcommands_formspec(name, sel, copy)
|
||||
local rows = {}
|
||||
rows[1] = "#FFF,0,Command,Parameters"
|
||||
rows[1] = "#FFF,0,"..F(S("Command"))..","..F(S("Parameters"))
|
||||
|
||||
local description = "For more information, click on any entry in the list.\n" ..
|
||||
"Double-click to copy the entry to the chat history."
|
||||
local description = S("For more information, click on "
|
||||
.. "any entry in the list.").. "\n" ..
|
||||
S("Double-click to copy the entry to the chat history.")
|
||||
|
||||
local privs = core.get_player_privs(name)
|
||||
for i, data in ipairs(mod_cmds) do
|
||||
rows[#rows + 1] = COLOR_BLUE .. ",0," .. formspec_escape(data[1]) .. ","
|
||||
rows[#rows + 1] = COLOR_BLUE .. ",0," .. F(data[1]) .. ","
|
||||
for j, cmds in ipairs(data[2]) do
|
||||
local has_priv = check_player_privs(name, cmds[2].privs)
|
||||
local has_priv = privs[cmds[2].privs]
|
||||
rows[#rows + 1] = ("%s,1,%s,%s"):format(
|
||||
has_priv and COLOR_GREEN or COLOR_GRAY,
|
||||
cmds[1], formspec_escape(cmds[2].params))
|
||||
cmds[1], F(cmds[2].params))
|
||||
if sel == #rows then
|
||||
description = cmds[2].description
|
||||
if copy then
|
||||
core.chat_send_player(name, ("Command: %s %s"):format(
|
||||
core.chat_send_player(name, S("Command: @1 @2",
|
||||
core.colorize("#0FF", "/" .. cmds[1]), cmds[2].params))
|
||||
end
|
||||
end
|
||||
@@ -74,9 +76,9 @@ local function build_chatcommands_formspec(name, sel, copy)
|
||||
end
|
||||
|
||||
return LIST_FORMSPEC_DESCRIPTION:format(
|
||||
"Available commands: (see also: /help <cmd>)",
|
||||
F(S("Available commands: (see also: /help <cmd>)")),
|
||||
table.concat(rows, ","), sel or 0,
|
||||
description, "Close"
|
||||
F(description), F(S("Close"))
|
||||
)
|
||||
end
|
||||
|
||||
@@ -91,19 +93,19 @@ local function build_privs_formspec(name)
|
||||
table.sort(privs, function(a, b) return a[1] < b[1] end)
|
||||
|
||||
local rows = {}
|
||||
rows[1] = "#FFF,0,Privilege,Description"
|
||||
rows[1] = "#FFF,0,"..F(S("Privilege"))..","..F(S("Description"))
|
||||
|
||||
local player_privs = core.get_player_privs(name)
|
||||
for i, data in ipairs(privs) do
|
||||
rows[#rows + 1] = ("%s,0,%s,%s"):format(
|
||||
player_privs[data[1]] and COLOR_GREEN or COLOR_GRAY,
|
||||
data[1], formspec_escape(data[2].description))
|
||||
data[1], F(data[2].description))
|
||||
end
|
||||
|
||||
return LIST_FORMSPEC:format(
|
||||
"Available privileges:",
|
||||
F(S("Available privileges:")),
|
||||
table.concat(rows, ","),
|
||||
"Close"
|
||||
F(S("Close"))
|
||||
)
|
||||
end
|
||||
|
||||
@@ -123,30 +125,12 @@ core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
local help_command = core.registered_chatcommands["help"]
|
||||
local old_help_func = help_command.func
|
||||
|
||||
help_command.func = function(name, param)
|
||||
local admin = core.settings:get("name")
|
||||
|
||||
-- If the admin ran help, put the output in the chat buffer as well to
|
||||
-- work with the server terminal
|
||||
if param == "privs" then
|
||||
core.show_formspec(name, "__builtin:help_privs",
|
||||
build_privs_formspec(name))
|
||||
if name ~= admin then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if param == "" or param == "all" then
|
||||
core.show_formspec(name, "__builtin:help_cmds",
|
||||
build_chatcommands_formspec(name))
|
||||
if name ~= admin then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return old_help_func(name, param)
|
||||
function core.show_general_help_formspec(name)
|
||||
core.show_formspec(name, "__builtin:help_cmds",
|
||||
build_chatcommands_formspec(name))
|
||||
end
|
||||
|
||||
function core.show_privs_help_formspec(name)
|
||||
core.show_formspec(name, "__builtin:help_privs",
|
||||
build_privs_formspec(name))
|
||||
end
|
||||
|
||||
@@ -204,19 +204,12 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function string:trim()
|
||||
return (self:gsub("^%s*(.-)%s*$", "%1"))
|
||||
return self:match("^%s*(.-)%s*$")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function math.hypot(x, y)
|
||||
local t
|
||||
x = math.abs(x)
|
||||
y = math.abs(y)
|
||||
t = math.min(x, y)
|
||||
x = math.max(x, y)
|
||||
if x == 0 then return 0 end
|
||||
t = t / x
|
||||
return x * math.sqrt(1 + t * t)
|
||||
return math.sqrt(x * x + y * y)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -244,15 +237,24 @@ function math.factorial(x)
|
||||
return v
|
||||
end
|
||||
|
||||
function core.formspec_escape(text)
|
||||
if text ~= nil then
|
||||
text = string.gsub(text,"\\","\\\\")
|
||||
text = string.gsub(text,"%]","\\]")
|
||||
text = string.gsub(text,"%[","\\[")
|
||||
text = string.gsub(text,";","\\;")
|
||||
text = string.gsub(text,",","\\,")
|
||||
|
||||
function math.round(x)
|
||||
if x >= 0 then
|
||||
return math.floor(x + 0.5)
|
||||
end
|
||||
return text
|
||||
return math.ceil(x - 0.5)
|
||||
end
|
||||
|
||||
local formspec_escapes = {
|
||||
["\\"] = "\\\\",
|
||||
["["] = "\\[",
|
||||
["]"] = "\\]",
|
||||
[";"] = "\\;",
|
||||
[","] = "\\,"
|
||||
}
|
||||
function core.formspec_escape(text)
|
||||
-- Use explicit character set instead of dot here because it doubles the performance
|
||||
return text and string.gsub(text, "[\\%[%];,]", formspec_escapes)
|
||||
end
|
||||
|
||||
|
||||
@@ -263,18 +265,21 @@ function core.wrap_text(text, max_length, as_table)
|
||||
return as_table and {text} or text
|
||||
end
|
||||
|
||||
for word in text:gmatch('%S+') do
|
||||
local cur_length = #table.concat(line, ' ')
|
||||
if cur_length > 0 and cur_length + #word + 1 >= max_length then
|
||||
local line_length = 0
|
||||
for word in text:gmatch("%S+") do
|
||||
if line_length > 0 and line_length + #word + 1 >= max_length then
|
||||
-- word wouldn't fit on current line, move to next line
|
||||
table.insert(result, table.concat(line, ' '))
|
||||
line = {}
|
||||
table.insert(result, table.concat(line, " "))
|
||||
line = {word}
|
||||
line_length = #word
|
||||
else
|
||||
table.insert(line, word)
|
||||
line_length = line_length + 1 + #word
|
||||
end
|
||||
table.insert(line, word)
|
||||
end
|
||||
|
||||
table.insert(result, table.concat(line, ' '))
|
||||
return as_table and result or table.concat(result, '\n')
|
||||
table.insert(result, table.concat(line, " "))
|
||||
return as_table and result or table.concat(result, "\n")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -423,56 +428,50 @@ function core.string_to_pos(value)
|
||||
return nil
|
||||
end
|
||||
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(value, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
if p.x and p.y and p.z then
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
return p
|
||||
end
|
||||
p = {}
|
||||
p.x, p.y, p.z = string.match(value, "^%( *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) *%)$")
|
||||
if p.x and p.y and p.z then
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
return p
|
||||
value = value:match("^%((.-)%)$") or value -- strip parentheses
|
||||
|
||||
local x, y, z = value:trim():match("^([%d.-]+)[,%s]%s*([%d.-]+)[,%s]%s*([%d.-]+)$")
|
||||
if x and y and z then
|
||||
x = tonumber(x)
|
||||
y = tonumber(y)
|
||||
z = tonumber(z)
|
||||
return vector.new(x, y, z)
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function core.string_to_area(value)
|
||||
local p1, p2 = unpack(value:split(") ("))
|
||||
if p1 == nil or p2 == nil then
|
||||
return nil
|
||||
|
||||
do
|
||||
local rel_num_cap = "(~?-?%d*%.?%d*)" -- may be overly permissive as this will be tonumber'ed anyways
|
||||
local num_delim = "[,%s]%s*"
|
||||
local pattern = "^" .. table.concat({rel_num_cap, rel_num_cap, rel_num_cap}, num_delim) .. "$"
|
||||
|
||||
local function parse_area_string(pos, relative_to)
|
||||
local pp = {}
|
||||
pp.x, pp.y, pp.z = pos:trim():match(pattern)
|
||||
return core.parse_coordinates(pp.x, pp.y, pp.z, relative_to)
|
||||
end
|
||||
|
||||
p1 = core.string_to_pos(p1 .. ")")
|
||||
p2 = core.string_to_pos("(" .. p2)
|
||||
if p1 == nil or p2 == nil then
|
||||
return nil
|
||||
function core.string_to_area(value, relative_to)
|
||||
local p1, p2 = value:match("^%((.-)%)%s*%((.-)%)$")
|
||||
if not p1 then
|
||||
return
|
||||
end
|
||||
|
||||
p1 = parse_area_string(p1, relative_to)
|
||||
p2 = parse_area_string(p2, relative_to)
|
||||
|
||||
if p1 == nil or p2 == nil then
|
||||
return
|
||||
end
|
||||
|
||||
return p1, p2
|
||||
end
|
||||
|
||||
return p1, p2
|
||||
end
|
||||
|
||||
local function test_string_to_area()
|
||||
local p1, p2 = core.string_to_area("(10.0, 5, -2) ( 30.2, 4, -12.53)")
|
||||
assert(p1.x == 10.0 and p1.y == 5 and p1.z == -2)
|
||||
assert(p2.x == 30.2 and p2.y == 4 and p2.z == -12.53)
|
||||
|
||||
p1, p2 = core.string_to_area("(10.0, 5, -2 30.2, 4, -12.53")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(10.0, 5,) -2 fgdf2, 4, -12.53")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
end
|
||||
|
||||
test_string_to_area()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function table.copy(t, seen)
|
||||
local n = {}
|
||||
@@ -532,7 +531,7 @@ if INIT == "mainmenu" then
|
||||
end
|
||||
end
|
||||
|
||||
if INIT == "client" or INIT == "mainmenu" then
|
||||
if core.gettext then -- for client and mainmenu
|
||||
function fgettext_ne(text, ...)
|
||||
text = core.gettext(text)
|
||||
local arg = {n=select('#', ...), ...}
|
||||
@@ -701,3 +700,71 @@ end
|
||||
function core.is_nan(number)
|
||||
return number ~= number
|
||||
end
|
||||
|
||||
--[[ Helper function for parsing an optionally relative number
|
||||
of a chat command parameter, using the chat command tilde notation.
|
||||
|
||||
Parameters:
|
||||
* arg: String snippet containing the number; possible values:
|
||||
* "<number>": return as number
|
||||
* "~<number>": return relative_to + <number>
|
||||
* "~": return relative_to
|
||||
* Anything else will return `nil`
|
||||
* relative_to: Number to which the `arg` number might be relative to
|
||||
|
||||
Returns:
|
||||
A number or `nil`, depending on `arg.
|
||||
|
||||
Examples:
|
||||
* `core.parse_relative_number("5", 10)` returns 5
|
||||
* `core.parse_relative_number("~5", 10)` returns 15
|
||||
* `core.parse_relative_number("~", 10)` returns 10
|
||||
]]
|
||||
function core.parse_relative_number(arg, relative_to)
|
||||
if not arg then
|
||||
return nil
|
||||
elseif arg == "~" then
|
||||
return relative_to
|
||||
elseif string.sub(arg, 1, 1) == "~" then
|
||||
local number = tonumber(string.sub(arg, 2))
|
||||
if not number then
|
||||
return nil
|
||||
end
|
||||
if core.is_nan(number) or number == math.huge or number == -math.huge then
|
||||
return nil
|
||||
end
|
||||
return relative_to + number
|
||||
else
|
||||
local number = tonumber(arg)
|
||||
if core.is_nan(number) or number == math.huge or number == -math.huge then
|
||||
return nil
|
||||
end
|
||||
return number
|
||||
end
|
||||
end
|
||||
|
||||
--[[ Helper function to parse coordinates that might be relative
|
||||
to another position; supports chat command tilde notation.
|
||||
Intended to be used in chat command parameter parsing.
|
||||
|
||||
Parameters:
|
||||
* x, y, z: Parsed x, y, and z coordinates as strings
|
||||
* relative_to: Position to which to compare the position
|
||||
|
||||
Syntax of x, y and z:
|
||||
* "<number>": return as number
|
||||
* "~<number>": return <number> + player position on this axis
|
||||
* "~": return player position on this axis
|
||||
|
||||
Returns: a vector or nil for invalid input or if player does not exist
|
||||
]]
|
||||
function core.parse_coordinates(x, y, z, relative_to)
|
||||
if not relative_to then
|
||||
x, y, z = tonumber(x), tonumber(y), tonumber(z)
|
||||
return x and y and z and { x = x, y = y, z = z }
|
||||
end
|
||||
local rx = core.parse_relative_number(x, relative_to.x)
|
||||
local ry = core.parse_relative_number(y, relative_to.y)
|
||||
local rz = core.parse_relative_number(z, relative_to.z)
|
||||
return rx and ry and rz and { x = rx, y = ry, z = rz }
|
||||
end
|
||||
|
||||
19
builtin/common/mod_storage.lua
Normal file
19
builtin/common/mod_storage.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Modify core.get_mod_storage to return the storage for the current mod.
|
||||
|
||||
local get_current_modname = core.get_current_modname
|
||||
|
||||
local old_get_mod_storage = core.get_mod_storage
|
||||
|
||||
local storages = setmetatable({}, {
|
||||
__mode = "v", -- values are weak references (can be garbage-collected)
|
||||
__index = function(self, modname)
|
||||
local storage = old_get_mod_storage(modname)
|
||||
self[modname] = storage
|
||||
return storage
|
||||
end,
|
||||
})
|
||||
|
||||
function core.get_mod_storage()
|
||||
local modname = get_current_modname()
|
||||
return modname and storages[modname]
|
||||
end
|
||||
@@ -1,205 +1,224 @@
|
||||
--- Lua module to serialize values as Lua code.
|
||||
-- From: https://github.com/fab13n/metalua/blob/no-dll/src/lib/serialize.lua
|
||||
-- From: https://github.com/appgurueu/modlib/blob/master/luon.lua
|
||||
-- License: MIT
|
||||
-- @copyright 2006-2997 Fabien Fleutot <metalua@gmail.com>
|
||||
-- @author Fabien Fleutot <metalua@gmail.com>
|
||||
-- @author ShadowNinja <shadowninja@minetest.net>
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--- Serialize an object into a source code string. This string, when passed as
|
||||
-- an argument to deserialize(), returns an object structurally identical to
|
||||
-- the original one. The following are currently supported:
|
||||
-- * Booleans, numbers, strings, and nil.
|
||||
-- * Functions; uses interpreter-dependent (and sometimes platform-dependent) bytecode!
|
||||
-- * Tables; they can cantain multiple references and can be recursive, but metatables aren't saved.
|
||||
-- This works in two phases:
|
||||
-- 1. Recursively find and record multiple references and recursion.
|
||||
-- 2. Recursively dump the value into a string.
|
||||
-- @param x Value to serialize (nil is allowed).
|
||||
-- @return load()able string containing the value.
|
||||
function core.serialize(x)
|
||||
local local_index = 1 -- Top index of the "_" local table in the dump
|
||||
-- table->nil/1/2 set of tables seen.
|
||||
-- nil = not seen, 1 = seen once, 2 = seen multiple times.
|
||||
local seen = {}
|
||||
local next, rawget, pairs, pcall, error, type, setfenv, loadstring
|
||||
= next, rawget, pairs, pcall, error, type, setfenv, loadstring
|
||||
|
||||
-- nest_points are places where a table appears within itself, directly
|
||||
-- or not. For instance, all of these chunks create nest points in
|
||||
-- table x: "x = {}; x[x] = 1", "x = {}; x[1] = x",
|
||||
-- "x = {}; x[1] = {y = {x}}".
|
||||
-- To handle those, two tables are used by mark_nest_point:
|
||||
-- * nested - Transient set of tables being currently traversed.
|
||||
-- Used for detecting nested tables.
|
||||
-- * nest_points - parent->{key=value, ...} table cantaining the nested
|
||||
-- keys and values in the parent. They're all dumped after all the
|
||||
-- other table operations have been performed.
|
||||
--
|
||||
-- mark_nest_point(p, k, v) fills nest_points with information required
|
||||
-- to remember that key/value (k, v) creates a nest point in table
|
||||
-- parent. It also marks "parent" and the nested item(s) as occuring
|
||||
-- multiple times, since several references to it will be required in
|
||||
-- order to patch the nest points.
|
||||
local nest_points = {}
|
||||
local nested = {}
|
||||
local function mark_nest_point(parent, k, v)
|
||||
local nk, nv = nested[k], nested[v]
|
||||
local np = nest_points[parent]
|
||||
if not np then
|
||||
np = {}
|
||||
nest_points[parent] = np
|
||||
end
|
||||
np[k] = v
|
||||
seen[parent] = 2
|
||||
if nk then seen[k] = 2 end
|
||||
if nv then seen[v] = 2 end
|
||||
local table_concat, string_dump, string_format, string_match, math_huge
|
||||
= table.concat, string.dump, string.format, string.match, math.huge
|
||||
|
||||
-- Recursively counts occurences of objects (non-primitives including strings) in a table.
|
||||
local function count_objects(value)
|
||||
local counts = {}
|
||||
if value == nil then
|
||||
-- Early return for nil; tables can't contain nil
|
||||
return counts
|
||||
end
|
||||
|
||||
-- First phase, list the tables and functions which appear more than
|
||||
-- once in x.
|
||||
local function mark_multiple_occurences(x)
|
||||
local tp = type(x)
|
||||
if tp ~= "table" and tp ~= "function" then
|
||||
-- No identity (comparison is done by value, not by instance)
|
||||
local function count_values(val)
|
||||
local type_ = type(val)
|
||||
if type_ == "boolean" or type_ == "number" then
|
||||
return
|
||||
end
|
||||
if seen[x] == 1 then
|
||||
seen[x] = 2
|
||||
elseif seen[x] ~= 2 then
|
||||
seen[x] = 1
|
||||
end
|
||||
|
||||
if tp == "table" then
|
||||
nested[x] = true
|
||||
for k, v in pairs(x) do
|
||||
if nested[k] or nested[v] then
|
||||
mark_nest_point(x, k, v)
|
||||
else
|
||||
mark_multiple_occurences(k)
|
||||
mark_multiple_occurences(v)
|
||||
local count = counts[val]
|
||||
counts[val] = (count or 0) + 1
|
||||
if type_ == "table" then
|
||||
if not count then
|
||||
for k, v in pairs(val) do
|
||||
count_values(k)
|
||||
count_values(v)
|
||||
end
|
||||
end
|
||||
nested[x] = nil
|
||||
elseif type_ ~= "string" and type_ ~= "function" then
|
||||
error("unsupported type: " .. type_)
|
||||
end
|
||||
end
|
||||
|
||||
local dumped = {} -- object->varname set
|
||||
local local_defs = {} -- Dumped local definitions as source code lines
|
||||
|
||||
-- Mutually recursive local functions:
|
||||
local dump_val, dump_or_ref_val
|
||||
|
||||
-- If x occurs multiple times, dump the local variable rather than
|
||||
-- the value. If it's the first time it's dumped, also dump the
|
||||
-- content in local_defs.
|
||||
function dump_or_ref_val(x)
|
||||
if seen[x] ~= 2 then
|
||||
return dump_val(x)
|
||||
end
|
||||
local var = dumped[x]
|
||||
if var then -- Already referenced
|
||||
return var
|
||||
end
|
||||
-- First occurence, create and register reference
|
||||
local val = dump_val(x)
|
||||
local i = local_index
|
||||
local_index = local_index + 1
|
||||
var = "_["..i.."]"
|
||||
local_defs[#local_defs + 1] = var.." = "..val
|
||||
dumped[x] = var
|
||||
return var
|
||||
end
|
||||
|
||||
-- Second phase. Dump the object; subparts occuring multiple times
|
||||
-- are dumped in local variables which can be referenced multiple
|
||||
-- times. Care is taken to dump local vars in a sensible order.
|
||||
function dump_val(x)
|
||||
local tp = type(x)
|
||||
if x == nil then return "nil"
|
||||
elseif tp == "string" then return string.format("%q", x)
|
||||
elseif tp == "boolean" then return x and "true" or "false"
|
||||
elseif tp == "function" then
|
||||
return string.format("loadstring(%q)", string.dump(x))
|
||||
elseif tp == "number" then
|
||||
-- Serialize numbers reversibly with string.format
|
||||
return string.format("%.17g", x)
|
||||
elseif tp == "table" then
|
||||
local vals = {}
|
||||
local idx_dumped = {}
|
||||
local np = nest_points[x]
|
||||
for i, v in ipairs(x) do
|
||||
if not np or not np[i] then
|
||||
vals[#vals + 1] = dump_or_ref_val(v)
|
||||
end
|
||||
idx_dumped[i] = true
|
||||
end
|
||||
for k, v in pairs(x) do
|
||||
if (not np or not np[k]) and
|
||||
not idx_dumped[k] then
|
||||
vals[#vals + 1] = "["..dump_or_ref_val(k).."] = "
|
||||
..dump_or_ref_val(v)
|
||||
end
|
||||
end
|
||||
return "{"..table.concat(vals, ", ").."}"
|
||||
else
|
||||
error("Can't serialize data of type "..tp)
|
||||
end
|
||||
end
|
||||
|
||||
local function dump_nest_points()
|
||||
for parent, vals in pairs(nest_points) do
|
||||
for k, v in pairs(vals) do
|
||||
local_defs[#local_defs + 1] = dump_or_ref_val(parent)
|
||||
.."["..dump_or_ref_val(k).."] = "
|
||||
..dump_or_ref_val(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mark_multiple_occurences(x)
|
||||
local top_level = dump_or_ref_val(x)
|
||||
dump_nest_points()
|
||||
|
||||
if next(local_defs) then
|
||||
return "local _ = {}\n"
|
||||
..table.concat(local_defs, "\n")
|
||||
.."\nreturn "..top_level
|
||||
else
|
||||
return "return "..top_level
|
||||
end
|
||||
count_values(value)
|
||||
return counts
|
||||
end
|
||||
|
||||
-- Deserialization
|
||||
-- Build a "set" of Lua keywords. These can't be used as short key names.
|
||||
-- See https://www.lua.org/manual/5.1/manual.html#2.1
|
||||
local keywords = {}
|
||||
for _, keyword in pairs({
|
||||
"and", "break", "do", "else", "elseif",
|
||||
"end", "false", "for", "function", "if",
|
||||
"in", "local", "nil", "not", "or",
|
||||
"repeat", "return", "then", "true", "until", "while",
|
||||
"goto" -- LuaJIT, Lua 5.2+
|
||||
}) do
|
||||
keywords[keyword] = true
|
||||
end
|
||||
|
||||
local function safe_loadstring(...)
|
||||
local func, err = loadstring(...)
|
||||
if func then
|
||||
setfenv(func, {})
|
||||
return func
|
||||
local function quote(string)
|
||||
return string_format("%q", string)
|
||||
end
|
||||
|
||||
local function dump_func(func)
|
||||
return string_format("loadstring(%q)", string_dump(func))
|
||||
end
|
||||
|
||||
-- Serializes Lua nil, booleans, numbers, strings, tables and even functions
|
||||
-- Tables are referenced by reference, strings are referenced by value. Supports circular tables.
|
||||
local function serialize(value, write)
|
||||
local reference, refnum = "r1", 1
|
||||
-- [object] = reference string
|
||||
local references = {}
|
||||
-- Circular tables that must be filled using `table[key] = value` statements
|
||||
local to_fill = {}
|
||||
for object, count in pairs(count_objects(value)) do
|
||||
local type_ = type(object)
|
||||
-- Object must appear more than once. If it is a string, the reference has to be shorter than the string.
|
||||
if count >= 2 and (type_ ~= "string" or #reference + 2 < #object) then
|
||||
write(reference)
|
||||
write("=")
|
||||
if type_ == "table" then
|
||||
write("{}")
|
||||
elseif type_ == "function" then
|
||||
write(dump_func(object))
|
||||
elseif type_ == "string" then
|
||||
write(quote(object))
|
||||
end
|
||||
write(";")
|
||||
references[object] = reference
|
||||
if type_ == "table" then
|
||||
to_fill[object] = reference
|
||||
end
|
||||
refnum = refnum + 1
|
||||
reference = ("r%X"):format(refnum)
|
||||
end
|
||||
end
|
||||
return nil, err
|
||||
-- Used to decide whether we should do "key=..."
|
||||
local function use_short_key(key)
|
||||
return not references[key] and type(key) == "string" and (not keywords[key]) and string_match(key, "^[%a_][%a%d_]*$")
|
||||
end
|
||||
local function dump(value)
|
||||
-- Primitive types
|
||||
if value == nil then
|
||||
return write("nil")
|
||||
end
|
||||
if value == true then
|
||||
return write("true")
|
||||
end
|
||||
if value == false then
|
||||
return write("false")
|
||||
end
|
||||
local type_ = type(value)
|
||||
if type_ == "number" then
|
||||
return write(string_format("%.17g", value))
|
||||
end
|
||||
-- Reference types: table, function and string
|
||||
local ref = references[value]
|
||||
if ref then
|
||||
return write(ref)
|
||||
end
|
||||
if type_ == "string" then
|
||||
return write(quote(value))
|
||||
end
|
||||
if type_ == "function" then
|
||||
return write(dump_func(value))
|
||||
end
|
||||
if type_ == "table" then
|
||||
write("{")
|
||||
-- First write list keys:
|
||||
-- Don't use the table length #value here as it may horribly fail
|
||||
-- for tables which use large integers as keys in the hash part;
|
||||
-- stop at the first "hole" (nil value) instead
|
||||
local len = 0
|
||||
local first = true -- whether this is the first entry, which may not have a leading comma
|
||||
while true do
|
||||
local v = rawget(value, len + 1) -- use rawget to avoid metatables like the vector metatable
|
||||
if v == nil then break end
|
||||
if first then first = false else write(",") end
|
||||
dump(v)
|
||||
len = len + 1
|
||||
end
|
||||
-- Now write map keys ([key] = value)
|
||||
for k, v in next, value do
|
||||
-- We have written all non-float keys in [1, len] already
|
||||
if type(k) ~= "number" or k % 1 ~= 0 or k < 1 or k > len then
|
||||
if first then first = false else write(",") end
|
||||
if use_short_key(k) then
|
||||
write(k)
|
||||
else
|
||||
write("[")
|
||||
dump(k)
|
||||
write("]")
|
||||
end
|
||||
write("=")
|
||||
dump(v)
|
||||
end
|
||||
end
|
||||
write("}")
|
||||
return
|
||||
end
|
||||
end
|
||||
-- Write the statements to fill circular tables
|
||||
for table, ref in pairs(to_fill) do
|
||||
for k, v in pairs(table) do
|
||||
write(ref)
|
||||
if use_short_key(k) then
|
||||
write(".")
|
||||
write(k)
|
||||
else
|
||||
write("[")
|
||||
dump(k)
|
||||
write("]")
|
||||
end
|
||||
write("=")
|
||||
dump(v)
|
||||
write(";")
|
||||
end
|
||||
end
|
||||
write("return ")
|
||||
dump(value)
|
||||
end
|
||||
|
||||
function core.serialize(value)
|
||||
local rope = {}
|
||||
serialize(value, function(text)
|
||||
-- Faster than table.insert(rope, text) on PUC Lua 5.1
|
||||
rope[#rope + 1] = text
|
||||
end)
|
||||
return table_concat(rope)
|
||||
end
|
||||
|
||||
local function dummy_func() end
|
||||
|
||||
local nan = (0/0)^1 -- +nan
|
||||
|
||||
function core.deserialize(str, safe)
|
||||
if type(str) ~= "string" then
|
||||
return nil, "Cannot deserialize type '"..type(str)
|
||||
.."'. Argument must be a string."
|
||||
-- Backwards compatibility
|
||||
if str == nil then
|
||||
core.log("deprecated", "minetest.deserialize called with nil (expected string).")
|
||||
return nil, "Invalid type: Expected a string, got nil"
|
||||
end
|
||||
if str:byte(1) == 0x1B then
|
||||
return nil, "Bytecode prohibited"
|
||||
local t = type(str)
|
||||
if t ~= "string" then
|
||||
error(("minetest.deserialize called with %s (expected string)."):format(t))
|
||||
end
|
||||
local f, err = loadstring(str)
|
||||
if not f then return nil, err end
|
||||
|
||||
-- The environment is recreated every time so deseralized code cannot
|
||||
-- pollute it with permanent references.
|
||||
setfenv(f, {loadstring = safe and dummy_func or safe_loadstring})
|
||||
local func, err = loadstring(str)
|
||||
if not func then return nil, err end
|
||||
|
||||
local good, data = pcall(f)
|
||||
if good then
|
||||
return data
|
||||
-- math.huge is serialized to inf, NaNs are serialized to nan by Lua
|
||||
local env = {inf = math_huge, nan = nan}
|
||||
if safe then
|
||||
env.loadstring = dummy_func
|
||||
else
|
||||
return nil, data
|
||||
env.loadstring = function(str, ...)
|
||||
local func, err = loadstring(str, ...)
|
||||
if func then
|
||||
setfenv(func, env)
|
||||
return func
|
||||
end
|
||||
return nil, err
|
||||
end
|
||||
end
|
||||
setfenv(func, env)
|
||||
local success, value_or_err = pcall(func)
|
||||
if success then
|
||||
return value_or_err
|
||||
end
|
||||
return nil, value_or_err
|
||||
end
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
|
||||
-- Always warn when creating a global variable, even outside of a function.
|
||||
-- This ignores mod namespaces (variables with the same name as the current mod).
|
||||
local WARN_INIT = false
|
||||
|
||||
local getinfo = debug.getinfo
|
||||
local getinfo, rawget, rawset = debug.getinfo, rawget, rawset
|
||||
|
||||
function core.global_exists(name)
|
||||
if type(name) ~= "string" then
|
||||
@@ -19,39 +14,33 @@ local declared = {}
|
||||
local warned = {}
|
||||
|
||||
function meta:__newindex(name, value)
|
||||
if declared[name] then
|
||||
return
|
||||
end
|
||||
local info = getinfo(2, "Sl")
|
||||
local desc = ("%s:%d"):format(info.short_src, info.currentline)
|
||||
if not declared[name] then
|
||||
local warn_key = ("%s\0%d\0%s"):format(info.source,
|
||||
info.currentline, name)
|
||||
if not warned[warn_key] and info.what ~= "main" and
|
||||
info.what ~= "C" then
|
||||
core.log("warning", ("Assignment to undeclared "..
|
||||
"global %q inside a function at %s.")
|
||||
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
|
||||
if not warned[warn_key] and info.what ~= "main" and info.what ~= "C" then
|
||||
core.log("warning", ("Assignment to undeclared global %q inside a function at %s.")
|
||||
:format(name, desc))
|
||||
warned[warn_key] = true
|
||||
end
|
||||
declared[name] = true
|
||||
end
|
||||
-- Ignore mod namespaces
|
||||
if WARN_INIT and name ~= core.get_current_modname() then
|
||||
core.log("warning", ("Global variable %q created at %s.")
|
||||
:format(name, desc))
|
||||
warned[warn_key] = true
|
||||
end
|
||||
rawset(self, name, value)
|
||||
declared[name] = true
|
||||
end
|
||||
|
||||
|
||||
function meta:__index(name)
|
||||
if declared[name] then
|
||||
return
|
||||
end
|
||||
local info = getinfo(2, "Sl")
|
||||
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
|
||||
if not declared[name] and not warned[warn_key] and info.what ~= "C" then
|
||||
if not warned[warn_key] and info.what ~= "C" then
|
||||
core.log("warning", ("Undeclared global variable %q accessed at %s:%s")
|
||||
:format(name, info.short_src, info.currentline))
|
||||
warned[warn_key] = true
|
||||
end
|
||||
return rawget(self, name)
|
||||
end
|
||||
|
||||
setmetatable(_G, meta)
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
_G.core = {}
|
||||
_G.vector = {metatable = {}}
|
||||
dofile("builtin/common/vector.lua")
|
||||
dofile("builtin/common/misc_helpers.lua")
|
||||
|
||||
describe("string", function()
|
||||
@@ -55,8 +57,8 @@ end)
|
||||
|
||||
describe("pos", function()
|
||||
it("from string", function()
|
||||
assert.same({ x = 10, y = 5.1, z = -2}, core.string_to_pos("10.0, 5.1, -2"))
|
||||
assert.same({ x = 10, y = 5.1, z = -2}, core.string_to_pos("( 10.0, 5.1, -2)"))
|
||||
assert.equal(vector.new(10, 5.1, -2), core.string_to_pos("10.0, 5.1, -2"))
|
||||
assert.equal(vector.new(10, 5.1, -2), core.string_to_pos("( 10.0, 5.1, -2)"))
|
||||
assert.is_nil(core.string_to_pos("asd, 5, -2)"))
|
||||
end)
|
||||
|
||||
@@ -65,9 +67,107 @@ describe("pos", function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("area parsing", function()
|
||||
describe("valid inputs", function()
|
||||
it("accepts absolute numbers", function()
|
||||
local p1, p2 = core.string_to_area("(10.0, 5, -2) ( 30.2 4 -12.53)")
|
||||
assert(p1.x == 10 and p1.y == 5 and p1.z == -2)
|
||||
assert(p2.x == 30.2 and p2.y == 4 and p2.z == -12.53)
|
||||
end)
|
||||
|
||||
it("accepts relative numbers", function()
|
||||
local p1, p2 = core.string_to_area("(1,2,3) (~5,~-5,~)", {x=10,y=10,z=10})
|
||||
assert(type(p1) == "table" and type(p2) == "table")
|
||||
assert(p1.x == 1 and p1.y == 2 and p1.z == 3)
|
||||
assert(p2.x == 15 and p2.y == 5 and p2.z == 10)
|
||||
|
||||
p1, p2 = core.string_to_area("(1 2 3) (~5 ~-5 ~)", {x=10,y=10,z=10})
|
||||
assert(type(p1) == "table" and type(p2) == "table")
|
||||
assert(p1.x == 1 and p1.y == 2 and p1.z == 3)
|
||||
assert(p2.x == 15 and p2.y == 5 and p2.z == 10)
|
||||
end)
|
||||
end)
|
||||
describe("invalid inputs", function()
|
||||
it("rejects too few numbers", function()
|
||||
local p1, p2 = core.string_to_area("(1,1) (1,1,1,1)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
end)
|
||||
|
||||
it("rejects too many numbers", function()
|
||||
local p1, p2 = core.string_to_area("(1,1,1,1) (1,1,1,1)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
end)
|
||||
|
||||
it("rejects nan & inf", function()
|
||||
local p1, p2 = core.string_to_area("(1,1,1) (1,1,nan)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(1,1,1) (1,1,~nan)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(1,1,1) (1,~nan,1)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(1,1,1) (1,1,inf)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(1,1,1) (1,1,~inf)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(1,1,1) (1,~inf,1)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(nan,nan,nan) (nan,nan,nan)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(nan,nan,nan) (nan,nan,nan)")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(inf,inf,inf) (-inf,-inf,-inf)", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(inf,inf,inf) (-inf,-inf,-inf)")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
end)
|
||||
|
||||
it("rejects words", function()
|
||||
local p1, p2 = core.string_to_area("bananas", {x=1,y=1,z=1})
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("bananas", "foobar")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("bananas")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(bananas,bananas,bananas)")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(bananas,bananas,bananas) (bananas,bananas,bananas)")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
end)
|
||||
|
||||
it("requires parenthesis & valid numbers", function()
|
||||
local p1, p2 = core.string_to_area("(10.0, 5, -2 30.2, 4, -12.53")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
|
||||
p1, p2 = core.string_to_area("(10.0, 5,) -2 fgdf2, 4, -12.53")
|
||||
assert(p1 == nil and p2 == nil)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("table", function()
|
||||
it("indexof()", function()
|
||||
assert.equal(1, table.indexof({"foo", "bar"}, "foo"))
|
||||
assert.equal(-1, table.indexof({"foo", "bar"}, "baz"))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("formspec_escape", function()
|
||||
it("escapes", function()
|
||||
assert.equal(nil, core.formspec_escape(nil))
|
||||
assert.equal("", core.formspec_escape(""))
|
||||
assert.equal("\\[Hello\\\\\\[", core.formspec_escape("[Hello\\["))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -1,41 +1,97 @@
|
||||
_G.core = {}
|
||||
_G.vector = {metatable = {}}
|
||||
|
||||
_G.setfenv = require 'busted.compatibility'.setfenv
|
||||
|
||||
dofile("builtin/common/serialize.lua")
|
||||
dofile("builtin/common/vector.lua")
|
||||
|
||||
-- Supports circular tables; does not support table keys
|
||||
-- Correctly checks whether a mapping of references ("same") exists
|
||||
-- Is significantly more efficient than assert.same
|
||||
local function assert_same(a, b, same)
|
||||
same = same or {}
|
||||
if same[a] or same[b] then
|
||||
assert(same[a] == b and same[b] == a)
|
||||
return
|
||||
end
|
||||
if a == b then
|
||||
return
|
||||
end
|
||||
if type(a) ~= "table" or type(b) ~= "table" then
|
||||
assert(a == b)
|
||||
return
|
||||
end
|
||||
same[a] = b
|
||||
same[b] = a
|
||||
local count = 0
|
||||
for k, v in pairs(a) do
|
||||
count = count + 1
|
||||
assert(type(k) ~= "table")
|
||||
assert_same(v, b[k], same)
|
||||
end
|
||||
for _ in pairs(b) do
|
||||
count = count - 1
|
||||
end
|
||||
assert(count == 0)
|
||||
end
|
||||
|
||||
local x, y = {}, {}
|
||||
local t1, t2 = {x, x, y, y}, {x, y, x, y}
|
||||
assert.same(t1, t2) -- will succeed because it only checks whether the depths match
|
||||
assert(not pcall(assert_same, t1, t2)) -- will correctly fail because it checks whether the refs match
|
||||
|
||||
describe("serialize", function()
|
||||
local function assert_preserves(value)
|
||||
local preserved_value = core.deserialize(core.serialize(value))
|
||||
assert_same(value, preserved_value)
|
||||
end
|
||||
it("works", function()
|
||||
local test_in = {cat={sound="nyan", speed=400}, dog={sound="woof"}}
|
||||
local test_out = core.deserialize(core.serialize(test_in))
|
||||
|
||||
assert.same(test_in, test_out)
|
||||
assert_preserves({cat={sound="nyan", speed=400}, dog={sound="woof"}})
|
||||
end)
|
||||
|
||||
it("handles characters", function()
|
||||
local test_in = {escape_chars="\n\r\t\v\\\"\'", non_european="θשׁ٩∂"}
|
||||
local test_out = core.deserialize(core.serialize(test_in))
|
||||
assert.same(test_in, test_out)
|
||||
assert_preserves({escape_chars="\n\r\t\v\\\"\'", non_european="θשׁ٩∂"})
|
||||
end)
|
||||
|
||||
it("handles NaN & infinities", function()
|
||||
local nan = core.deserialize(core.serialize(0/0))
|
||||
assert(nan ~= nan)
|
||||
assert_preserves(math.huge)
|
||||
assert_preserves(-math.huge)
|
||||
end)
|
||||
|
||||
it("handles precise numbers", function()
|
||||
local test_in = 0.2695949158945771
|
||||
local test_out = core.deserialize(core.serialize(test_in))
|
||||
assert.same(test_in, test_out)
|
||||
assert_preserves(0.2695949158945771)
|
||||
end)
|
||||
|
||||
it("handles big integers", function()
|
||||
local test_in = 269594915894577
|
||||
local test_out = core.deserialize(core.serialize(test_in))
|
||||
assert.same(test_in, test_out)
|
||||
assert_preserves(269594915894577)
|
||||
end)
|
||||
|
||||
it("handles recursive structures", function()
|
||||
local test_in = { hello = "world" }
|
||||
test_in.foo = test_in
|
||||
assert_preserves(test_in)
|
||||
end)
|
||||
|
||||
local test_out = core.deserialize(core.serialize(test_in))
|
||||
assert.same(test_in, test_out)
|
||||
it("handles cross-referencing structures", function()
|
||||
local test_in = {
|
||||
foo = {
|
||||
baz = {
|
||||
{}
|
||||
},
|
||||
},
|
||||
bar = {
|
||||
baz = {},
|
||||
},
|
||||
}
|
||||
|
||||
test_in.foo.baz[1].foo = test_in.foo
|
||||
test_in.foo.baz[1].bar = test_in.bar
|
||||
test_in.bar.baz[1] = test_in.foo.baz[1]
|
||||
|
||||
assert_preserves(test_in)
|
||||
end)
|
||||
|
||||
it("strips functions in safe mode", function()
|
||||
@@ -45,6 +101,7 @@ describe("serialize", function()
|
||||
end,
|
||||
foo = "bar"
|
||||
}
|
||||
setfenv(test_in.func, _G)
|
||||
|
||||
local str = core.serialize(test_in)
|
||||
assert.not_nil(str:find("loadstring"))
|
||||
@@ -53,4 +110,80 @@ describe("serialize", function()
|
||||
assert.is_nil(test_out.func)
|
||||
assert.equals(test_out.foo, "bar")
|
||||
end)
|
||||
|
||||
it("vectors work", function()
|
||||
local v = vector.new(1, 2, 3)
|
||||
assert_preserves({v})
|
||||
assert_preserves(v)
|
||||
|
||||
-- abuse
|
||||
v = vector.new(1, 2, 3)
|
||||
v.a = "bla"
|
||||
assert_preserves(v)
|
||||
end)
|
||||
|
||||
it("handles keywords as keys", function()
|
||||
assert_preserves({["and"] = "keyword", ["for"] = "keyword"})
|
||||
end)
|
||||
|
||||
describe("fuzzing", function()
|
||||
local atomics = {true, false, math.huge, -math.huge} -- no NaN or nil
|
||||
local function atomic()
|
||||
return atomics[math.random(1, #atomics)]
|
||||
end
|
||||
local function num()
|
||||
local sign = math.random() < 0.5 and -1 or 1
|
||||
-- HACK math.random(a, b) requires a, b & b - a to fit within a 32-bit int
|
||||
-- Use two random calls to generate a random number from 0 - 2^50 as lower & upper 25 bits
|
||||
local val = math.random(0, 2^25) * 2^25 + math.random(0, 2^25 - 1)
|
||||
local exp = math.random() < 0.5 and 1 or 2^(math.random(-120, 120))
|
||||
return sign * val * exp
|
||||
end
|
||||
local function charcodes(count)
|
||||
if count == 0 then return end
|
||||
return math.random(0, 0xFF), charcodes(count - 1)
|
||||
end
|
||||
local function str()
|
||||
return string.char(charcodes(math.random(0, 100)))
|
||||
end
|
||||
local primitives = {atomic, num, str}
|
||||
local function primitive()
|
||||
return primitives[math.random(1, #primitives)]()
|
||||
end
|
||||
local function tab(max_actions)
|
||||
local root = {}
|
||||
local tables = {root}
|
||||
local function random_table()
|
||||
return tables[math.random(1, #tables)]
|
||||
end
|
||||
for _ = 1, math.random(1, max_actions) do
|
||||
local tab = random_table()
|
||||
local value
|
||||
if math.random() < 0.5 then
|
||||
if math.random() < 0.5 then
|
||||
value = random_table()
|
||||
else
|
||||
value = {}
|
||||
table.insert(tables, value)
|
||||
end
|
||||
else
|
||||
value = primitive()
|
||||
end
|
||||
tab[math.random() < 0.5 and (#tab + 1) or primitive()] = value
|
||||
end
|
||||
return root
|
||||
end
|
||||
it("primitives work", function()
|
||||
for _ = 1, 1e3 do
|
||||
assert_preserves(primitive())
|
||||
end
|
||||
end)
|
||||
it("tables work", function()
|
||||
for _ = 1, 100 do
|
||||
local fuzzed_table = tab(1e3)
|
||||
assert_same(fuzzed_table, table.copy(fuzzed_table))
|
||||
assert_preserves(fuzzed_table)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
_G.vector = {}
|
||||
_G.vector = {metatable = {}}
|
||||
dofile("builtin/common/vector.lua")
|
||||
|
||||
describe("vector", function()
|
||||
describe("new()", function()
|
||||
it("constructs", function()
|
||||
assert.same({ x = 0, y = 0, z = 0 }, vector.new())
|
||||
assert.same({ x = 1, y = 2, z = 3 }, vector.new(1, 2, 3))
|
||||
assert.same({ x = 3, y = 2, z = 1 }, vector.new({ x = 3, y = 2, z = 1 }))
|
||||
assert.same({x = 0, y = 0, z = 0}, vector.new())
|
||||
assert.same({x = 1, y = 2, z = 3}, vector.new(1, 2, 3))
|
||||
assert.same({x = 3, y = 2, z = 1}, vector.new({x = 3, y = 2, z = 1}))
|
||||
|
||||
assert.is_true(vector.check(vector.new()))
|
||||
assert.is_true(vector.check(vector.new(1, 2, 3)))
|
||||
assert.is_true(vector.check(vector.new({x = 3, y = 2, z = 1})))
|
||||
|
||||
local input = vector.new({ x = 3, y = 2, z = 1 })
|
||||
local output = vector.new(input)
|
||||
assert.same(input, output)
|
||||
assert.are_not.equal(input, output)
|
||||
assert.equal(input, output)
|
||||
assert.is_false(rawequal(input, output))
|
||||
assert.equal(input, input:new())
|
||||
end)
|
||||
|
||||
it("throws on invalid input", function()
|
||||
@@ -25,27 +31,294 @@ describe("vector", function()
|
||||
end)
|
||||
end)
|
||||
|
||||
it("equal()", function()
|
||||
local function assertE(a, b)
|
||||
assert.is_true(vector.equals(a, b))
|
||||
end
|
||||
local function assertNE(a, b)
|
||||
assert.is_false(vector.equals(a, b))
|
||||
end
|
||||
|
||||
assertE({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
assertE({x = -1, y = 0, z = 1}, {x = -1, y = 0, z = 1})
|
||||
local a = { x = 2, y = 4, z = -10 }
|
||||
assertE(a, a)
|
||||
assertNE({x = -1, y = 0, z = 1}, a)
|
||||
it("zero()", function()
|
||||
assert.same({x = 0, y = 0, z = 0}, vector.zero())
|
||||
assert.same(vector.new(), vector.zero())
|
||||
assert.equal(vector.new(), vector.zero())
|
||||
assert.is_true(vector.check(vector.zero()))
|
||||
end)
|
||||
|
||||
it("add()", function()
|
||||
assert.same({ x = 2, y = 4, z = 6 }, vector.add(vector.new(1, 2, 3), { x = 1, y = 2, z = 3 }))
|
||||
it("copy()", function()
|
||||
local v = vector.new(1, 2, 3)
|
||||
assert.same(v, vector.copy(v))
|
||||
assert.same(vector.new(v), vector.copy(v))
|
||||
assert.equal(vector.new(v), vector.copy(v))
|
||||
assert.is_true(vector.check(vector.copy(v)))
|
||||
end)
|
||||
|
||||
it("indexes", function()
|
||||
local some_vector = vector.new(24, 42, 13)
|
||||
assert.equal(24, some_vector[1])
|
||||
assert.equal(24, some_vector.x)
|
||||
assert.equal(42, some_vector[2])
|
||||
assert.equal(42, some_vector.y)
|
||||
assert.equal(13, some_vector[3])
|
||||
assert.equal(13, some_vector.z)
|
||||
|
||||
some_vector[1] = 100
|
||||
assert.equal(100, some_vector.x)
|
||||
some_vector.x = 101
|
||||
assert.equal(101, some_vector[1])
|
||||
|
||||
some_vector[2] = 100
|
||||
assert.equal(100, some_vector.y)
|
||||
some_vector.y = 102
|
||||
assert.equal(102, some_vector[2])
|
||||
|
||||
some_vector[3] = 100
|
||||
assert.equal(100, some_vector.z)
|
||||
some_vector.z = 103
|
||||
assert.equal(103, some_vector[3])
|
||||
end)
|
||||
|
||||
it("direction()", function()
|
||||
local a = vector.new(1, 0, 0)
|
||||
local b = vector.new(1, 42, 0)
|
||||
assert.equal(vector.new(0, 1, 0), vector.direction(a, b))
|
||||
assert.equal(vector.new(0, 1, 0), a:direction(b))
|
||||
end)
|
||||
|
||||
it("distance()", function()
|
||||
local a = vector.new(1, 0, 0)
|
||||
local b = vector.new(3, 42, 9)
|
||||
assert.is_true(math.abs(43 - vector.distance(a, b)) < 1.0e-12)
|
||||
assert.is_true(math.abs(43 - a:distance(b)) < 1.0e-12)
|
||||
assert.equal(0, vector.distance(a, a))
|
||||
assert.equal(0, b:distance(b))
|
||||
end)
|
||||
|
||||
it("length()", function()
|
||||
local a = vector.new(0, 0, -23)
|
||||
assert.equal(0, vector.length(vector.new()))
|
||||
assert.equal(23, vector.length(a))
|
||||
assert.equal(23, a:length())
|
||||
end)
|
||||
|
||||
it("normalize()", function()
|
||||
local a = vector.new(0, 0, -23)
|
||||
assert.equal(vector.new(0, 0, -1), vector.normalize(a))
|
||||
assert.equal(vector.new(0, 0, -1), a:normalize())
|
||||
assert.equal(vector.new(), vector.normalize(vector.new()))
|
||||
end)
|
||||
|
||||
it("floor()", function()
|
||||
local a = vector.new(0.1, 0.9, -0.5)
|
||||
assert.equal(vector.new(0, 0, -1), vector.floor(a))
|
||||
assert.equal(vector.new(0, 0, -1), a:floor())
|
||||
end)
|
||||
|
||||
it("round()", function()
|
||||
local a = vector.new(0.1, 0.9, -0.5)
|
||||
assert.equal(vector.new(0, 1, -1), vector.round(a))
|
||||
assert.equal(vector.new(0, 1, -1), a:round())
|
||||
end)
|
||||
|
||||
it("apply()", function()
|
||||
local i = 0
|
||||
local f = function(x)
|
||||
i = i + 1
|
||||
return x + i
|
||||
end
|
||||
local a = vector.new(0.1, 0.9, -0.5)
|
||||
assert.equal(vector.new(1, 1, 0), vector.apply(a, math.ceil))
|
||||
assert.equal(vector.new(1, 1, 0), a:apply(math.ceil))
|
||||
assert.equal(vector.new(0.1, 0.9, 0.5), vector.apply(a, math.abs))
|
||||
assert.equal(vector.new(0.1, 0.9, 0.5), a:apply(math.abs))
|
||||
assert.equal(vector.new(1.1, 2.9, 2.5), vector.apply(a, f))
|
||||
assert.equal(vector.new(4.1, 5.9, 5.5), a:apply(f))
|
||||
end)
|
||||
|
||||
it("combine()", function()
|
||||
local a = vector.new(1, 2, 3)
|
||||
local b = vector.new(3, 2, 1)
|
||||
assert.equal(vector.add(a, b), vector.combine(a, b, function(x, y) return x + y end))
|
||||
assert.equal(vector.new(3, 2, 3), vector.combine(a, b, math.max))
|
||||
assert.equal(vector.new(1, 2, 1), vector.combine(a, b, math.min))
|
||||
end)
|
||||
|
||||
it("equals()", function()
|
||||
local function assertE(a, b)
|
||||
assert.is_true(vector.equals(a, b))
|
||||
end
|
||||
local function assertNE(a, b)
|
||||
assert.is_false(vector.equals(a, b))
|
||||
end
|
||||
|
||||
assertE({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
assertE({x = -1, y = 0, z = 1}, {x = -1, y = 0, z = 1})
|
||||
assertE({x = -1, y = 0, z = 1}, vector.new(-1, 0, 1))
|
||||
local a = {x = 2, y = 4, z = -10}
|
||||
assertE(a, a)
|
||||
assertNE({x = -1, y = 0, z = 1}, a)
|
||||
|
||||
assert.equal(vector.new(1, 2, 3), vector.new(1, 2, 3))
|
||||
assert.is_true(vector.new(1, 2, 3):equals(vector.new(1, 2, 3)))
|
||||
assert.not_equal(vector.new(1, 2, 3), vector.new(1, 2, 4))
|
||||
assert.is_true(vector.new(1, 2, 3) == vector.new(1, 2, 3))
|
||||
assert.is_false(vector.new(1, 2, 3) == vector.new(1, 3, 3))
|
||||
end)
|
||||
|
||||
it("metatable is same", function()
|
||||
local a = vector.new()
|
||||
local b = vector.new(1, 2, 3)
|
||||
|
||||
assert.equal(true, vector.check(a))
|
||||
assert.equal(true, vector.check(b))
|
||||
|
||||
assert.equal(vector.metatable, getmetatable(a))
|
||||
assert.equal(vector.metatable, getmetatable(b))
|
||||
assert.equal(vector.metatable, a.metatable)
|
||||
end)
|
||||
|
||||
it("sort()", function()
|
||||
local a = vector.new(1, 2, 3)
|
||||
local b = vector.new(0.5, 232, -2)
|
||||
local sorted = {vector.new(0.5, 2, -2), vector.new(1, 232, 3)}
|
||||
assert.same(sorted, {vector.sort(a, b)})
|
||||
assert.same(sorted, {a:sort(b)})
|
||||
end)
|
||||
|
||||
it("angle()", function()
|
||||
assert.equal(math.pi, vector.angle(vector.new(-1, -2, -3), vector.new(1, 2, 3)))
|
||||
assert.equal(math.pi/2, vector.new(0, 1, 0):angle(vector.new(1, 0, 0)))
|
||||
end)
|
||||
|
||||
it("dot()", function()
|
||||
assert.equal(-14, vector.dot(vector.new(-1, -2, -3), vector.new(1, 2, 3)))
|
||||
assert.equal(0, vector.new():dot(vector.new(1, 2, 3)))
|
||||
end)
|
||||
|
||||
it("cross()", function()
|
||||
local a = vector.new(-1, -2, 0)
|
||||
local b = vector.new(1, 2, 3)
|
||||
assert.equal(vector.new(-6, 3, 0), vector.cross(a, b))
|
||||
assert.equal(vector.new(-6, 3, 0), a:cross(b))
|
||||
end)
|
||||
|
||||
it("offset()", function()
|
||||
assert.same({ x = 41, y = 52, z = 63 }, vector.offset(vector.new(1, 2, 3), 40, 50, 60))
|
||||
assert.same({x = 41, y = 52, z = 63}, vector.offset(vector.new(1, 2, 3), 40, 50, 60))
|
||||
assert.equal(vector.new(41, 52, 63), vector.offset(vector.new(1, 2, 3), 40, 50, 60))
|
||||
assert.equal(vector.new(41, 52, 63), vector.new(1, 2, 3):offset(40, 50, 60))
|
||||
end)
|
||||
|
||||
it("is()", function()
|
||||
local some_table1 = {foo = 13, [42] = 1, "bar", 2}
|
||||
local some_table2 = {1, 2, 3}
|
||||
local some_table3 = {x = 1, 2, 3}
|
||||
local some_table4 = {1, 2, z = 3}
|
||||
local old = {x = 1, y = 2, z = 3}
|
||||
local real = vector.new(1, 2, 3)
|
||||
|
||||
assert.is_false(vector.check(nil))
|
||||
assert.is_false(vector.check(1))
|
||||
assert.is_false(vector.check(true))
|
||||
assert.is_false(vector.check("foo"))
|
||||
assert.is_false(vector.check(some_table1))
|
||||
assert.is_false(vector.check(some_table2))
|
||||
assert.is_false(vector.check(some_table3))
|
||||
assert.is_false(vector.check(some_table4))
|
||||
assert.is_false(vector.check(old))
|
||||
assert.is_true(vector.check(real))
|
||||
assert.is_true(real:check())
|
||||
end)
|
||||
|
||||
it("global pairs", function()
|
||||
local out = {}
|
||||
local vec = vector.new(10, 20, 30)
|
||||
for k, v in pairs(vec) do
|
||||
out[k] = v
|
||||
end
|
||||
assert.same({x = 10, y = 20, z = 30}, out)
|
||||
end)
|
||||
|
||||
it("abusing works", function()
|
||||
local v = vector.new(1, 2, 3)
|
||||
v.a = 1
|
||||
assert.equal(1, v.a)
|
||||
|
||||
local a_is_there = false
|
||||
for key, value in pairs(v) do
|
||||
if key == "a" then
|
||||
a_is_there = true
|
||||
assert.equal(value, 1)
|
||||
break
|
||||
end
|
||||
end
|
||||
assert.is_true(a_is_there)
|
||||
end)
|
||||
|
||||
it("add()", function()
|
||||
local a = vector.new(1, 2, 3)
|
||||
local b = vector.new(1, 4, 3)
|
||||
local c = vector.new(2, 6, 6)
|
||||
assert.equal(c, vector.add(a, {x = 1, y = 4, z = 3}))
|
||||
assert.equal(c, vector.add(a, b))
|
||||
assert.equal(c, a:add(b))
|
||||
assert.equal(c, a + b)
|
||||
assert.equal(c, b + a)
|
||||
end)
|
||||
|
||||
it("subtract()", function()
|
||||
local a = vector.new(1, 2, 3)
|
||||
local b = vector.new(2, 4, 3)
|
||||
local c = vector.new(-1, -2, 0)
|
||||
assert.equal(c, vector.subtract(a, {x = 2, y = 4, z = 3}))
|
||||
assert.equal(c, vector.subtract(a, b))
|
||||
assert.equal(c, a:subtract(b))
|
||||
assert.equal(c, a - b)
|
||||
assert.equal(c, -b + a)
|
||||
end)
|
||||
|
||||
it("multiply()", function()
|
||||
local a = vector.new(1, 2, 3)
|
||||
local b = vector.new(2, 4, 3)
|
||||
local c = vector.new(2, 8, 9)
|
||||
local s = 2
|
||||
local d = vector.new(2, 4, 6)
|
||||
assert.equal(c, vector.multiply(a, {x = 2, y = 4, z = 3}))
|
||||
assert.equal(c, vector.multiply(a, b))
|
||||
assert.equal(d, vector.multiply(a, s))
|
||||
assert.equal(d, a:multiply(s))
|
||||
assert.equal(d, a * s)
|
||||
assert.equal(d, s * a)
|
||||
assert.equal(-a, -1 * a)
|
||||
end)
|
||||
|
||||
it("divide()", function()
|
||||
local a = vector.new(1, 2, 3)
|
||||
local b = vector.new(2, 4, 3)
|
||||
local c = vector.new(0.5, 0.5, 1)
|
||||
local s = 2
|
||||
local d = vector.new(0.5, 1, 1.5)
|
||||
assert.equal(c, vector.divide(a, {x = 2, y = 4, z = 3}))
|
||||
assert.equal(c, vector.divide(a, b))
|
||||
assert.equal(d, vector.divide(a, s))
|
||||
assert.equal(d, a:divide(s))
|
||||
assert.equal(d, a / s)
|
||||
assert.equal(d, 1/s * a)
|
||||
assert.equal(-a, a / -1)
|
||||
end)
|
||||
|
||||
it("to_string()", function()
|
||||
local v = vector.new(1, 2, 3.14)
|
||||
assert.same("(1, 2, 3.14)", vector.to_string(v))
|
||||
assert.same("(1, 2, 3.14)", v:to_string())
|
||||
assert.same("(1, 2, 3.14)", tostring(v))
|
||||
end)
|
||||
|
||||
it("from_string()", function()
|
||||
local v = vector.new(1, 2, 3.14)
|
||||
assert.is_true(vector.check(vector.from_string("(1, 2, 3.14)")))
|
||||
assert.same({v, 13}, {vector.from_string("(1, 2, 3.14)")})
|
||||
assert.same({v, 12}, {vector.from_string("(1,2 ,3.14)")})
|
||||
assert.same({v, 12}, {vector.from_string("(1,2,3.14,)")})
|
||||
assert.same({v, 11}, {vector.from_string("(1 2 3.14)")})
|
||||
assert.same({v, 15}, {vector.from_string("( 1, 2, 3.14 )")})
|
||||
assert.same({v, 15}, {vector.from_string(" ( 1, 2, 3.14) ")})
|
||||
assert.same({vector.new(), 8}, {vector.from_string("(0,0,0) ( 1, 2, 3.14) ")})
|
||||
assert.same({v, 22}, {vector.from_string("(0,0,0) ( 1, 2, 3.14) ", 8)})
|
||||
assert.same({v, 22}, {vector.from_string("(0,0,0) ( 1, 2, 3.14) ", 9)})
|
||||
assert.same(nil, vector.from_string("nothing"))
|
||||
end)
|
||||
|
||||
-- This function is needed because of floating point imprecision.
|
||||
|
||||
@@ -1,73 +1,132 @@
|
||||
--[[
|
||||
Vector helpers
|
||||
Note: The vector.*-functions must be able to accept old vectors that had no metatables
|
||||
]]
|
||||
|
||||
vector = {}
|
||||
-- localize functions
|
||||
local setmetatable = setmetatable
|
||||
|
||||
-- vector.metatable is set by C++.
|
||||
local metatable = vector.metatable
|
||||
|
||||
local xyz = {"x", "y", "z"}
|
||||
|
||||
-- only called when rawget(v, key) returns nil
|
||||
function metatable.__index(v, key)
|
||||
return rawget(v, xyz[key]) or vector[key]
|
||||
end
|
||||
|
||||
-- only called when rawget(v, key) returns nil
|
||||
function metatable.__newindex(v, key, value)
|
||||
rawset(v, xyz[key] or key, value)
|
||||
end
|
||||
|
||||
-- constructors
|
||||
|
||||
local function fast_new(x, y, z)
|
||||
return setmetatable({x = x, y = y, z = z}, metatable)
|
||||
end
|
||||
|
||||
function vector.new(a, b, c)
|
||||
if type(a) == "table" then
|
||||
assert(a.x and a.y and a.z, "Invalid vector passed to vector.new()")
|
||||
return {x=a.x, y=a.y, z=a.z}
|
||||
elseif a then
|
||||
assert(b and c, "Invalid arguments for vector.new()")
|
||||
return {x=a, y=b, z=c}
|
||||
if a and b and c then
|
||||
return fast_new(a, b, c)
|
||||
end
|
||||
|
||||
-- deprecated, use vector.copy and vector.zero directly
|
||||
if type(a) == "table" then
|
||||
return vector.copy(a)
|
||||
else
|
||||
assert(not a, "Invalid arguments for vector.new()")
|
||||
return vector.zero()
|
||||
end
|
||||
return {x=0, y=0, z=0}
|
||||
end
|
||||
|
||||
function vector.zero()
|
||||
return fast_new(0, 0, 0)
|
||||
end
|
||||
|
||||
function vector.copy(v)
|
||||
assert(v.x and v.y and v.z, "Invalid vector passed to vector.copy()")
|
||||
return fast_new(v.x, v.y, v.z)
|
||||
end
|
||||
|
||||
function vector.from_string(s, init)
|
||||
local x, y, z, np = string.match(s, "^%s*%(%s*([^%s,]+)%s*[,%s]%s*([^%s,]+)%s*[,%s]" ..
|
||||
"%s*([^%s,]+)%s*[,%s]?%s*%)()", init)
|
||||
x = tonumber(x)
|
||||
y = tonumber(y)
|
||||
z = tonumber(z)
|
||||
if not (x and y and z) then
|
||||
return nil
|
||||
end
|
||||
return fast_new(x, y, z), np
|
||||
end
|
||||
|
||||
function vector.to_string(v)
|
||||
return string.format("(%g, %g, %g)", v.x, v.y, v.z)
|
||||
end
|
||||
metatable.__tostring = vector.to_string
|
||||
|
||||
function vector.equals(a, b)
|
||||
return a.x == b.x and
|
||||
a.y == b.y and
|
||||
a.z == b.z
|
||||
end
|
||||
metatable.__eq = vector.equals
|
||||
|
||||
-- unary operations
|
||||
|
||||
function vector.length(v)
|
||||
return math.hypot(v.x, math.hypot(v.y, v.z))
|
||||
return math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z)
|
||||
end
|
||||
-- Note: we can not use __len because it is already used for primitive table length
|
||||
|
||||
function vector.normalize(v)
|
||||
local len = vector.length(v)
|
||||
if len == 0 then
|
||||
return {x=0, y=0, z=0}
|
||||
return fast_new(0, 0, 0)
|
||||
else
|
||||
return vector.divide(v, len)
|
||||
end
|
||||
end
|
||||
|
||||
function vector.floor(v)
|
||||
return {
|
||||
x = math.floor(v.x),
|
||||
y = math.floor(v.y),
|
||||
z = math.floor(v.z)
|
||||
}
|
||||
return vector.apply(v, math.floor)
|
||||
end
|
||||
|
||||
function vector.round(v)
|
||||
return {
|
||||
x = math.floor(v.x + 0.5),
|
||||
y = math.floor(v.y + 0.5),
|
||||
z = math.floor(v.z + 0.5)
|
||||
}
|
||||
return fast_new(
|
||||
math.round(v.x),
|
||||
math.round(v.y),
|
||||
math.round(v.z)
|
||||
)
|
||||
end
|
||||
|
||||
function vector.apply(v, func)
|
||||
return {
|
||||
x = func(v.x),
|
||||
y = func(v.y),
|
||||
z = func(v.z)
|
||||
}
|
||||
return fast_new(
|
||||
func(v.x),
|
||||
func(v.y),
|
||||
func(v.z)
|
||||
)
|
||||
end
|
||||
|
||||
function vector.combine(a, b, func)
|
||||
return fast_new(
|
||||
func(a.x, b.x),
|
||||
func(a.y, b.y),
|
||||
func(a.z, b.z)
|
||||
)
|
||||
end
|
||||
|
||||
function vector.distance(a, b)
|
||||
local x = a.x - b.x
|
||||
local y = a.y - b.y
|
||||
local z = a.z - b.z
|
||||
return math.hypot(x, math.hypot(y, z))
|
||||
return math.sqrt(x * x + y * y + z * z)
|
||||
end
|
||||
|
||||
function vector.direction(pos1, pos2)
|
||||
return vector.normalize({
|
||||
x = pos2.x - pos1.x,
|
||||
y = pos2.y - pos1.y,
|
||||
z = pos2.z - pos1.z
|
||||
})
|
||||
return vector.subtract(pos2, pos1):normalize()
|
||||
end
|
||||
|
||||
function vector.angle(a, b)
|
||||
@@ -82,70 +141,137 @@ function vector.dot(a, b)
|
||||
end
|
||||
|
||||
function vector.cross(a, b)
|
||||
return {
|
||||
x = a.y * b.z - a.z * b.y,
|
||||
y = a.z * b.x - a.x * b.z,
|
||||
z = a.x * b.y - a.y * b.x
|
||||
}
|
||||
return fast_new(
|
||||
a.y * b.z - a.z * b.y,
|
||||
a.z * b.x - a.x * b.z,
|
||||
a.x * b.y - a.y * b.x
|
||||
)
|
||||
end
|
||||
|
||||
function metatable.__unm(v)
|
||||
return fast_new(-v.x, -v.y, -v.z)
|
||||
end
|
||||
|
||||
-- add, sub, mul, div operations
|
||||
|
||||
function vector.add(a, b)
|
||||
if type(b) == "table" then
|
||||
return {x = a.x + b.x,
|
||||
y = a.y + b.y,
|
||||
z = a.z + b.z}
|
||||
return fast_new(
|
||||
a.x + b.x,
|
||||
a.y + b.y,
|
||||
a.z + b.z
|
||||
)
|
||||
else
|
||||
return {x = a.x + b,
|
||||
y = a.y + b,
|
||||
z = a.z + b}
|
||||
return fast_new(
|
||||
a.x + b,
|
||||
a.y + b,
|
||||
a.z + b
|
||||
)
|
||||
end
|
||||
end
|
||||
function metatable.__add(a, b)
|
||||
return fast_new(
|
||||
a.x + b.x,
|
||||
a.y + b.y,
|
||||
a.z + b.z
|
||||
)
|
||||
end
|
||||
|
||||
function vector.subtract(a, b)
|
||||
if type(b) == "table" then
|
||||
return {x = a.x - b.x,
|
||||
y = a.y - b.y,
|
||||
z = a.z - b.z}
|
||||
return fast_new(
|
||||
a.x - b.x,
|
||||
a.y - b.y,
|
||||
a.z - b.z
|
||||
)
|
||||
else
|
||||
return {x = a.x - b,
|
||||
y = a.y - b,
|
||||
z = a.z - b}
|
||||
return fast_new(
|
||||
a.x - b,
|
||||
a.y - b,
|
||||
a.z - b
|
||||
)
|
||||
end
|
||||
end
|
||||
function metatable.__sub(a, b)
|
||||
return fast_new(
|
||||
a.x - b.x,
|
||||
a.y - b.y,
|
||||
a.z - b.z
|
||||
)
|
||||
end
|
||||
|
||||
function vector.multiply(a, b)
|
||||
if type(b) == "table" then
|
||||
return {x = a.x * b.x,
|
||||
y = a.y * b.y,
|
||||
z = a.z * b.z}
|
||||
return fast_new(
|
||||
a.x * b.x,
|
||||
a.y * b.y,
|
||||
a.z * b.z
|
||||
)
|
||||
else
|
||||
return {x = a.x * b,
|
||||
y = a.y * b,
|
||||
z = a.z * b}
|
||||
return fast_new(
|
||||
a.x * b,
|
||||
a.y * b,
|
||||
a.z * b
|
||||
)
|
||||
end
|
||||
end
|
||||
function metatable.__mul(a, b)
|
||||
if type(a) == "table" then
|
||||
return fast_new(
|
||||
a.x * b,
|
||||
a.y * b,
|
||||
a.z * b
|
||||
)
|
||||
else
|
||||
return fast_new(
|
||||
a * b.x,
|
||||
a * b.y,
|
||||
a * b.z
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function vector.divide(a, b)
|
||||
if type(b) == "table" then
|
||||
return {x = a.x / b.x,
|
||||
y = a.y / b.y,
|
||||
z = a.z / b.z}
|
||||
return fast_new(
|
||||
a.x / b.x,
|
||||
a.y / b.y,
|
||||
a.z / b.z
|
||||
)
|
||||
else
|
||||
return {x = a.x / b,
|
||||
y = a.y / b,
|
||||
z = a.z / b}
|
||||
return fast_new(
|
||||
a.x / b,
|
||||
a.y / b,
|
||||
a.z / b
|
||||
)
|
||||
end
|
||||
end
|
||||
function metatable.__div(a, b)
|
||||
-- scalar/vector makes no sense
|
||||
return fast_new(
|
||||
a.x / b,
|
||||
a.y / b,
|
||||
a.z / b
|
||||
)
|
||||
end
|
||||
|
||||
-- misc stuff
|
||||
|
||||
function vector.offset(v, x, y, z)
|
||||
return {x = v.x + x,
|
||||
y = v.y + y,
|
||||
z = v.z + z}
|
||||
return fast_new(
|
||||
v.x + x,
|
||||
v.y + y,
|
||||
v.z + z
|
||||
)
|
||||
end
|
||||
|
||||
function vector.sort(a, b)
|
||||
return {x = math.min(a.x, b.x), y = math.min(a.y, b.y), z = math.min(a.z, b.z)},
|
||||
{x = math.max(a.x, b.x), y = math.max(a.y, b.y), z = math.max(a.z, b.z)}
|
||||
return fast_new(math.min(a.x, b.x), math.min(a.y, b.y), math.min(a.z, b.z)),
|
||||
fast_new(math.max(a.x, b.x), math.max(a.y, b.y), math.max(a.z, b.z))
|
||||
end
|
||||
|
||||
function vector.check(v)
|
||||
return getmetatable(v) == metatable
|
||||
end
|
||||
|
||||
local function sin(x)
|
||||
@@ -213,7 +339,7 @@ end
|
||||
|
||||
function vector.dir_to_rotation(forward, up)
|
||||
forward = vector.normalize(forward)
|
||||
local rot = {x = math.asin(forward.y), y = -math.atan2(forward.x, forward.z), z = 0}
|
||||
local rot = vector.new(math.asin(forward.y), -math.atan2(forward.x, forward.z), 0)
|
||||
if not up then
|
||||
return rot
|
||||
end
|
||||
@@ -221,7 +347,7 @@ function vector.dir_to_rotation(forward, up)
|
||||
"Invalid vectors passed to vector.dir_to_rotation().")
|
||||
up = vector.normalize(up)
|
||||
-- Calculate vector pointing up with roll = 0, just based on forward vector.
|
||||
local forwup = vector.rotate({x = 0, y = 1, z = 0}, rot)
|
||||
local forwup = vector.rotate(vector.new(0, 1, 0), rot)
|
||||
-- 'forwup' and 'up' are now in a plane with 'forward' as normal.
|
||||
-- The angle between them is the absolute of the roll value we're looking for.
|
||||
rot.z = vector.angle(forwup, up)
|
||||
|
||||
@@ -58,26 +58,20 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function get_formspec(self)
|
||||
local formspec = ""
|
||||
|
||||
if not self.hidden and (self.parent == nil or not self.parent.hidden) then
|
||||
|
||||
if self.parent == nil then
|
||||
local tsize = self.tablist[self.last_tab_index].tabsize or
|
||||
{width=self.width, height=self.height}
|
||||
formspec = formspec ..
|
||||
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
|
||||
dump(self.fixed_size))
|
||||
end
|
||||
formspec = formspec .. self:tab_header()
|
||||
formspec = formspec ..
|
||||
self.tablist[self.last_tab_index].get_formspec(
|
||||
self,
|
||||
self.tablist[self.last_tab_index].name,
|
||||
self.tablist[self.last_tab_index].tabdata,
|
||||
self.tablist[self.last_tab_index].tabsize
|
||||
)
|
||||
if self.hidden or (self.parent ~= nil and self.parent.hidden) then
|
||||
return ""
|
||||
end
|
||||
local tab = self.tablist[self.last_tab_index]
|
||||
|
||||
local content, prepend = tab.get_formspec(self, tab.name, tab.tabdata, tab.tabsize)
|
||||
|
||||
if self.parent == nil and not prepend then
|
||||
local tsize = tab.tabsize or {width=self.width, height=self.height}
|
||||
prepend = string.format("size[%f,%f,%s]", tsize.width, tsize.height,
|
||||
dump(self.fixed_size))
|
||||
end
|
||||
|
||||
local formspec = (prepend or "") .. self:tab_header() .. content
|
||||
return formspec
|
||||
end
|
||||
|
||||
@@ -97,14 +91,9 @@ local function handle_buttons(self,fields)
|
||||
return true
|
||||
end
|
||||
|
||||
if self.tablist[self.last_tab_index].button_handler ~= nil then
|
||||
return
|
||||
self.tablist[self.last_tab_index].button_handler(
|
||||
self,
|
||||
fields,
|
||||
self.tablist[self.last_tab_index].name,
|
||||
self.tablist[self.last_tab_index].tabdata
|
||||
)
|
||||
local tab = self.tablist[self.last_tab_index]
|
||||
if tab.button_handler ~= nil then
|
||||
return tab.button_handler(self, fields, tab.name, tab.tabdata)
|
||||
end
|
||||
|
||||
return false
|
||||
@@ -122,14 +111,9 @@ local function handle_events(self,event)
|
||||
return true
|
||||
end
|
||||
|
||||
if self.tablist[self.last_tab_index].evt_handler ~= nil then
|
||||
return
|
||||
self.tablist[self.last_tab_index].evt_handler(
|
||||
self,
|
||||
event,
|
||||
self.tablist[self.last_tab_index].name,
|
||||
self.tablist[self.last_tab_index].tabdata
|
||||
)
|
||||
local tab = self.tablist[self.last_tab_index]
|
||||
if tab.evt_handler ~= nil then
|
||||
return tab.evt_handler(self, event, tab.name, tab.tabdata)
|
||||
end
|
||||
|
||||
return false
|
||||
|
||||
@@ -63,7 +63,7 @@ function ui.update()
|
||||
-- handle errors
|
||||
if gamedata ~= nil and gamedata.reconnect_requested then
|
||||
local error_message = core.formspec_escape(
|
||||
gamedata.errormessage or "<none available>")
|
||||
gamedata.errormessage or fgettext("<none available>"))
|
||||
formspec = {
|
||||
"size[14,8]",
|
||||
"real_coordinates[true]",
|
||||
|
||||
22
builtin/game/async.lua
Normal file
22
builtin/game/async.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
core.async_jobs = {}
|
||||
|
||||
function core.async_event_handler(jobid, retval)
|
||||
local callback = core.async_jobs[jobid]
|
||||
assert(type(callback) == "function")
|
||||
callback(unpack(retval, 1, retval.n))
|
||||
core.async_jobs[jobid] = nil
|
||||
end
|
||||
|
||||
function core.handle_async(func, callback, ...)
|
||||
assert(type(func) == "function" and type(callback) == "function",
|
||||
"Invalid minetest.handle_async invocation")
|
||||
local args = {n = select("#", ...), ...}
|
||||
local mod_origin = core.get_last_run_mod()
|
||||
|
||||
local jobid = core.do_async_callback(func, args, mod_origin)
|
||||
core.async_jobs[jobid] = callback
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -87,6 +87,10 @@ core.builtin_auth_handler = {
|
||||
core.settings:get("default_password")))
|
||||
end
|
||||
|
||||
auth_entry.privileges = privileges
|
||||
|
||||
core_auth.save(auth_entry)
|
||||
|
||||
-- Run grant callbacks
|
||||
for priv, _ in pairs(privileges) do
|
||||
if not auth_entry.privileges[priv] then
|
||||
@@ -100,9 +104,6 @@ core.builtin_auth_handler = {
|
||||
core.run_priv_callbacks(name, priv, nil, "revoke")
|
||||
end
|
||||
end
|
||||
|
||||
auth_entry.privileges = privileges
|
||||
core_auth.save(auth_entry)
|
||||
core.notify_authentication_modified(name)
|
||||
end,
|
||||
reload = function()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,7 +39,7 @@ local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81
|
||||
core.register_entity(":__builtin:falling_node", {
|
||||
initial_properties = {
|
||||
visual = "item",
|
||||
visual_size = {x = SCALE, y = SCALE, z = SCALE},
|
||||
visual_size = vector.new(SCALE, SCALE, SCALE),
|
||||
textures = {},
|
||||
physical = true,
|
||||
is_visible = false,
|
||||
@@ -84,9 +84,6 @@ core.register_entity(":__builtin:falling_node", {
|
||||
local textures
|
||||
if def.tiles and def.tiles[1] then
|
||||
local tile = def.tiles[1]
|
||||
if def.drawtype == "torchlike" and def.paramtype2 ~= "wallmounted" then
|
||||
tile = def.tiles[2] or def.tiles[1]
|
||||
end
|
||||
if type(tile) == "table" then
|
||||
tile = tile.name
|
||||
end
|
||||
@@ -99,7 +96,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
local vsize
|
||||
if def.visual_scale then
|
||||
local s = def.visual_scale
|
||||
vsize = {x = s, y = s, z = s}
|
||||
vsize = vector.new(s, s, s)
|
||||
end
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
@@ -114,15 +111,21 @@ core.register_entity(":__builtin:falling_node", {
|
||||
itemstring = core.itemstring_with_palette(itemstring, node.param2)
|
||||
end
|
||||
-- FIXME: solution needed for paramtype2 == "leveled"
|
||||
local vsize
|
||||
if def.visual_scale then
|
||||
local s = def.visual_scale * SCALE
|
||||
vsize = {x = s, y = s, z = s}
|
||||
-- Calculate size of falling node
|
||||
local s = {}
|
||||
s.x = (def.visual_scale or 1) * SCALE
|
||||
s.y = s.x
|
||||
s.z = s.x
|
||||
-- Compensate for wield_scale
|
||||
if def.wield_scale then
|
||||
s.x = s.x / def.wield_scale.x
|
||||
s.y = s.y / def.wield_scale.y
|
||||
s.z = s.z / def.wield_scale.z
|
||||
end
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
wield_item = itemstring,
|
||||
visual_size = vsize,
|
||||
visual_size = s,
|
||||
glow = def.light_source,
|
||||
})
|
||||
end
|
||||
@@ -147,11 +150,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
|
||||
-- Rotate entity
|
||||
if def.drawtype == "torchlike" then
|
||||
if def.paramtype2 == "wallmounted" then
|
||||
self.object:set_yaw(math.pi*0.25)
|
||||
else
|
||||
self.object:set_yaw(-math.pi*0.25)
|
||||
end
|
||||
self.object:set_yaw(math.pi*0.25)
|
||||
elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh")
|
||||
and (def.wield_image == "" or def.wield_image == nil))
|
||||
or def.drawtype == "signlike"
|
||||
@@ -159,14 +158,17 @@ core.register_entity(":__builtin:falling_node", {
|
||||
or def.drawtype == "normal"
|
||||
or def.drawtype == "nodebox" then
|
||||
if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") then
|
||||
local fdir = node.param2 % 32
|
||||
local fdir = node.param2 % 32 % 24
|
||||
-- Get rotation from a precalculated lookup table
|
||||
local euler = facedir_to_euler[fdir + 1]
|
||||
if euler then
|
||||
self.object:set_rotation(euler)
|
||||
end
|
||||
elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then
|
||||
self.object:set_rotation(euler)
|
||||
elseif (def.drawtype ~= "plantlike" and def.drawtype ~= "plantlike_rooted" and
|
||||
(def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted" or def.drawtype == "signlike")) then
|
||||
local rot = node.param2 % 8
|
||||
if (def.drawtype == "signlike" and def.paramtype2 ~= "wallmounted" and def.paramtype2 ~= "colorwallmounted") then
|
||||
-- Change rotation to "floor" by default for non-wallmounted paramtype2
|
||||
rot = 1
|
||||
end
|
||||
local pitch, yaw, roll = 0, 0, 0
|
||||
if def.drawtype == "nodebox" or def.drawtype == "mesh" then
|
||||
if rot == 0 then
|
||||
@@ -208,6 +210,14 @@ core.register_entity(":__builtin:falling_node", {
|
||||
end
|
||||
end
|
||||
self.object:set_rotation({x=pitch, y=yaw, z=roll})
|
||||
elseif (def.drawtype == "mesh" and def.paramtype2 == "degrotate") then
|
||||
local p2 = (node.param2 - (def.place_param2 or 0)) % 240
|
||||
local yaw = (p2 / 240) * (math.pi * 2)
|
||||
self.object:set_yaw(yaw)
|
||||
elseif (def.drawtype == "mesh" and def.paramtype2 == "colordegrotate") then
|
||||
local p2 = (node.param2 % 32 - (def.place_param2 or 0) % 32) % 24
|
||||
local yaw = (p2 / 24) * (math.pi * 2)
|
||||
self.object:set_yaw(yaw)
|
||||
end
|
||||
end
|
||||
end,
|
||||
@@ -222,7 +232,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
self.object:set_acceleration({x = 0, y = -gravity, z = 0})
|
||||
self.object:set_acceleration(vector.new(0, -gravity, 0))
|
||||
|
||||
local ds = core.deserialize(staticdata)
|
||||
if ds and ds.node then
|
||||
@@ -252,7 +262,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
end
|
||||
|
||||
-- Decide if we're replacing the node or placing on top
|
||||
local np = vector.new(bcp)
|
||||
local np = vector.copy(bcp)
|
||||
if bcd and bcd.buildable_to and
|
||||
(not self.floats or bcd.liquidtype == "none") then
|
||||
core.remove_node(bcp)
|
||||
@@ -298,7 +308,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
if self.floats then
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
local bcp = vector.round({x = pos.x, y = pos.y - 0.7, z = pos.z})
|
||||
local bcp = pos:offset(0, -0.7, 0):round()
|
||||
local bcn = core.get_node(bcp)
|
||||
|
||||
local bcd = core.registered_nodes[bcn.name]
|
||||
@@ -339,13 +349,12 @@ core.register_entity(":__builtin:falling_node", {
|
||||
-- TODO: this hack could be avoided in the future if objects
|
||||
-- could choose who to collide with
|
||||
local vel = self.object:get_velocity()
|
||||
self.object:set_velocity({
|
||||
x = vel.x,
|
||||
y = player_collision.old_velocity.y,
|
||||
z = vel.z
|
||||
})
|
||||
self.object:set_pos(vector.add(self.object:get_pos(),
|
||||
{x = 0, y = -0.5, z = 0}))
|
||||
self.object:set_velocity(vector.new(
|
||||
vel.x,
|
||||
player_collision.old_velocity.y,
|
||||
vel.z
|
||||
))
|
||||
self.object:set_pos(self.object:get_pos():offset(0, -0.5, 0))
|
||||
end
|
||||
return
|
||||
elseif bcn.name == "ignore" then
|
||||
@@ -407,7 +416,7 @@ local function convert_to_falling_node(pos, node)
|
||||
|
||||
obj:get_luaentity():set_node(node, metatable)
|
||||
core.remove_node(pos)
|
||||
return true
|
||||
return true, obj
|
||||
end
|
||||
|
||||
function core.spawn_falling_node(pos)
|
||||
@@ -425,7 +434,7 @@ local function drop_attached_node(p)
|
||||
if def and def.preserve_metadata then
|
||||
local oldmeta = core.get_meta(p):to_table().fields
|
||||
-- Copy pos and node because the callback can modify them.
|
||||
local pos_copy = {x=p.x, y=p.y, z=p.z}
|
||||
local pos_copy = vector.copy(p)
|
||||
local node_copy = {name=n.name, param1=n.param1, param2=n.param2}
|
||||
local drop_stacks = {}
|
||||
for k, v in pairs(drops) do
|
||||
@@ -450,14 +459,14 @@ end
|
||||
|
||||
function builtin_shared.check_attached_node(p, n)
|
||||
local def = core.registered_nodes[n.name]
|
||||
local d = {x = 0, y = 0, z = 0}
|
||||
local d = vector.zero()
|
||||
if def.paramtype2 == "wallmounted" or
|
||||
def.paramtype2 == "colorwallmounted" then
|
||||
-- The fallback vector here is in case 'wallmounted to dir' is nil due
|
||||
-- to voxelmanip placing a wallmounted node without resetting a
|
||||
-- pre-existing param2 value that is out-of-range for wallmounted.
|
||||
-- The fallback vector corresponds to param2 = 0.
|
||||
d = core.wallmounted_to_dir(n.param2) or {x = 0, y = 1, z = 0}
|
||||
d = core.wallmounted_to_dir(n.param2) or vector.new(0, 1, 0)
|
||||
else
|
||||
d.y = -1
|
||||
end
|
||||
@@ -477,7 +486,7 @@ end
|
||||
function core.check_single_for_falling(p)
|
||||
local n = core.get_node(p)
|
||||
if core.get_item_group(n.name, "falling_node") ~= 0 then
|
||||
local p_bottom = {x = p.x, y = p.y - 1, z = p.z}
|
||||
local p_bottom = vector.offset(p, 0, -1, 0)
|
||||
-- Only spawn falling node if node below is loaded
|
||||
local n_bottom = core.get_node_or_nil(p_bottom)
|
||||
local d_bottom = n_bottom and core.registered_nodes[n_bottom.name]
|
||||
@@ -516,17 +525,17 @@ end
|
||||
-- Down first as likely case, but always before self. The same with sides.
|
||||
-- Up must come last, so that things above self will also fall all at once.
|
||||
local check_for_falling_neighbors = {
|
||||
{x = -1, y = -1, z = 0},
|
||||
{x = 1, y = -1, z = 0},
|
||||
{x = 0, y = -1, z = -1},
|
||||
{x = 0, y = -1, z = 1},
|
||||
{x = 0, y = -1, z = 0},
|
||||
{x = -1, y = 0, z = 0},
|
||||
{x = 1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 0, y = 0, z = -1},
|
||||
{x = 0, y = 0, z = 0},
|
||||
{x = 0, y = 1, z = 0},
|
||||
vector.new(-1, -1, 0),
|
||||
vector.new( 1, -1, 0),
|
||||
vector.new( 0, -1, -1),
|
||||
vector.new( 0, -1, 1),
|
||||
vector.new( 0, -1, 0),
|
||||
vector.new(-1, 0, 0),
|
||||
vector.new( 1, 0, 0),
|
||||
vector.new( 0, 0, 1),
|
||||
vector.new( 0, 0, -1),
|
||||
vector.new( 0, 0, 0),
|
||||
vector.new( 0, 1, 0),
|
||||
}
|
||||
|
||||
function core.check_for_falling(p)
|
||||
|
||||
@@ -19,6 +19,11 @@ core.features = {
|
||||
object_step_has_moveresult = true,
|
||||
direct_velocity_on_players = true,
|
||||
use_texture_alpha_string_modes = true,
|
||||
degrotate_240_steps = true,
|
||||
abm_min_max_y = true,
|
||||
particlespawner_tweenable = true,
|
||||
dynamic_add_media_table = true,
|
||||
get_sky_as_table = true,
|
||||
}
|
||||
|
||||
function core.has_feature(arg)
|
||||
|
||||
@@ -86,12 +86,6 @@ local function read_file(filename)
|
||||
return core.deserialize(t) or {}
|
||||
end
|
||||
|
||||
local function write_file(filename, table)
|
||||
local f = io.open(filename, "w")
|
||||
f:write(core.serialize(table))
|
||||
f:close()
|
||||
end
|
||||
|
||||
blocks_forceloaded = read_file(wpath.."/force_loaded.txt")
|
||||
for _, __ in pairs(blocks_forceloaded) do
|
||||
total_forceloaded = total_forceloaded + 1
|
||||
@@ -106,7 +100,8 @@ end)
|
||||
|
||||
-- persists the currently forceloaded blocks to disk
|
||||
local function persist_forceloaded_blocks()
|
||||
write_file(wpath.."/force_loaded.txt", blocks_forceloaded)
|
||||
local data = core.serialize(blocks_forceloaded)
|
||||
core.safe_file_write(wpath.."/force_loaded.txt", data)
|
||||
end
|
||||
|
||||
-- periodical forceload persistence
|
||||
|
||||
@@ -7,9 +7,8 @@ local gamepath = scriptpath .. "game".. DIR_DELIM
|
||||
-- not exposed to outer context
|
||||
local builtin_shared = {}
|
||||
|
||||
dofile(commonpath .. "vector.lua")
|
||||
|
||||
dofile(gamepath .. "constants.lua")
|
||||
dofile(gamepath .. "item_s.lua")
|
||||
assert(loadfile(gamepath .. "item.lua"))(builtin_shared)
|
||||
dofile(gamepath .. "register.lua")
|
||||
|
||||
@@ -18,8 +17,10 @@ if core.settings:get_bool("profiler.load") then
|
||||
end
|
||||
|
||||
dofile(commonpath .. "after.lua")
|
||||
dofile(commonpath .. "mod_storage.lua")
|
||||
dofile(gamepath .. "item_entity.lua")
|
||||
dofile(gamepath .. "deprecated.lua")
|
||||
dofile(gamepath .. "misc_s.lua")
|
||||
dofile(gamepath .. "misc.lua")
|
||||
dofile(gamepath .. "privileges.lua")
|
||||
dofile(gamepath .. "auth.lua")
|
||||
@@ -34,5 +35,6 @@ dofile(gamepath .. "voxelarea.lua")
|
||||
dofile(gamepath .. "forceloading.lua")
|
||||
dofile(gamepath .. "statbars.lua")
|
||||
dofile(gamepath .. "knockback.lua")
|
||||
dofile(gamepath .. "async.lua")
|
||||
|
||||
profiler = nil
|
||||
|
||||
@@ -5,8 +5,8 @@ local builtin_shared = ...
|
||||
local function copy_pointed_thing(pointed_thing)
|
||||
return {
|
||||
type = pointed_thing.type,
|
||||
above = vector.new(pointed_thing.above),
|
||||
under = vector.new(pointed_thing.under),
|
||||
above = pointed_thing.above and vector.copy(pointed_thing.above),
|
||||
under = pointed_thing.under and vector.copy(pointed_thing.under),
|
||||
ref = pointed_thing.ref,
|
||||
}
|
||||
end
|
||||
@@ -15,15 +15,6 @@ end
|
||||
-- Item definition helpers
|
||||
--
|
||||
|
||||
function core.inventorycube(img1, img2, img3)
|
||||
img2 = img2 or img1
|
||||
img3 = img3 or img1
|
||||
return "[inventorycube"
|
||||
.. "{" .. img1:gsub("%^", "&")
|
||||
.. "{" .. img2:gsub("%^", "&")
|
||||
.. "{" .. img3:gsub("%^", "&")
|
||||
end
|
||||
|
||||
function core.get_pointed_thing_position(pointed_thing, above)
|
||||
if pointed_thing.type == "node" then
|
||||
if above then
|
||||
@@ -37,140 +28,16 @@ function core.get_pointed_thing_position(pointed_thing, above)
|
||||
end
|
||||
end
|
||||
|
||||
function core.dir_to_facedir(dir, is6d)
|
||||
--account for y if requested
|
||||
if is6d and math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then
|
||||
|
||||
--from above
|
||||
if dir.y < 0 then
|
||||
if math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 19
|
||||
else
|
||||
return 13
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 10
|
||||
else
|
||||
return 4
|
||||
end
|
||||
end
|
||||
|
||||
--from below
|
||||
else
|
||||
if math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 15
|
||||
else
|
||||
return 17
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 6
|
||||
else
|
||||
return 8
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--otherwise, place horizontally
|
||||
elseif math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 3
|
||||
else
|
||||
return 1
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 2
|
||||
else
|
||||
return 0
|
||||
local function has_all_groups(tbl, required_groups)
|
||||
if type(required_groups) == "string" then
|
||||
return (tbl[required_groups] or 0) ~= 0
|
||||
end
|
||||
for _, group in ipairs(required_groups) do
|
||||
if (tbl[group] or 0) == 0 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Table of possible dirs
|
||||
local facedir_to_dir = {
|
||||
{x= 0, y=0, z= 1},
|
||||
{x= 1, y=0, z= 0},
|
||||
{x= 0, y=0, z=-1},
|
||||
{x=-1, y=0, z= 0},
|
||||
{x= 0, y=-1, z= 0},
|
||||
{x= 0, y=1, z= 0},
|
||||
}
|
||||
-- Mapping from facedir value to index in facedir_to_dir.
|
||||
local facedir_to_dir_map = {
|
||||
[0]=1, 2, 3, 4,
|
||||
5, 2, 6, 4,
|
||||
6, 2, 5, 4,
|
||||
1, 5, 3, 6,
|
||||
1, 6, 3, 5,
|
||||
1, 4, 3, 2,
|
||||
}
|
||||
function core.facedir_to_dir(facedir)
|
||||
return facedir_to_dir[facedir_to_dir_map[facedir % 32]]
|
||||
end
|
||||
|
||||
function core.dir_to_wallmounted(dir)
|
||||
if math.abs(dir.y) > math.max(math.abs(dir.x), math.abs(dir.z)) then
|
||||
if dir.y < 0 then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 3
|
||||
else
|
||||
return 2
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 5
|
||||
else
|
||||
return 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- table of dirs in wallmounted order
|
||||
local wallmounted_to_dir = {
|
||||
[0] = {x = 0, y = 1, z = 0},
|
||||
{x = 0, y = -1, z = 0},
|
||||
{x = 1, y = 0, z = 0},
|
||||
{x = -1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 0, y = 0, z = -1},
|
||||
}
|
||||
function core.wallmounted_to_dir(wallmounted)
|
||||
return wallmounted_to_dir[wallmounted % 8]
|
||||
end
|
||||
|
||||
function core.dir_to_yaw(dir)
|
||||
return -math.atan2(dir.x, dir.z)
|
||||
end
|
||||
|
||||
function core.yaw_to_dir(yaw)
|
||||
return {x = -math.sin(yaw), y = 0, z = math.cos(yaw)}
|
||||
end
|
||||
|
||||
function core.is_colored_paramtype(ptype)
|
||||
return (ptype == "color") or (ptype == "colorfacedir") or
|
||||
(ptype == "colorwallmounted")
|
||||
end
|
||||
|
||||
function core.strip_param2_color(param2, paramtype2)
|
||||
if not core.is_colored_paramtype(paramtype2) then
|
||||
return nil
|
||||
end
|
||||
if paramtype2 == "colorfacedir" then
|
||||
param2 = math.floor(param2 / 32) * 32
|
||||
elseif paramtype2 == "colorwallmounted" then
|
||||
param2 = math.floor(param2 / 8) * 8
|
||||
end
|
||||
-- paramtype2 == "color" requires no modification.
|
||||
return param2
|
||||
return true
|
||||
end
|
||||
|
||||
function core.get_node_drops(node, toolname)
|
||||
@@ -212,7 +79,7 @@ function core.get_node_drops(node, toolname)
|
||||
if item.rarity ~= nil then
|
||||
good_rarity = item.rarity < 1 or math.random(item.rarity) == 1
|
||||
end
|
||||
if item.tools ~= nil then
|
||||
if item.tools ~= nil or item.tool_groups ~= nil then
|
||||
good_tool = false
|
||||
end
|
||||
if item.tools ~= nil and toolname then
|
||||
@@ -227,6 +94,27 @@ function core.get_node_drops(node, toolname)
|
||||
end
|
||||
end
|
||||
end
|
||||
if item.tool_groups ~= nil and toolname then
|
||||
local tooldef = core.registered_items[toolname]
|
||||
if tooldef ~= nil and type(tooldef.groups) == "table" then
|
||||
if type(item.tool_groups) == "string" then
|
||||
-- tool_groups can be a string which specifies the required group
|
||||
good_tool = core.get_item_group(toolname, item.tool_groups) ~= 0
|
||||
else
|
||||
-- tool_groups can be a list of sufficient requirements.
|
||||
-- i.e. if any item in the list can be satisfied then the tool is good
|
||||
assert(type(item.tool_groups) == "table")
|
||||
for _, required_groups in ipairs(item.tool_groups) do
|
||||
-- required_groups can be either a string (a single group),
|
||||
-- or an array of strings where all must be in tooldef.groups
|
||||
good_tool = has_all_groups(tooldef.groups, required_groups)
|
||||
if good_tool then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if good_rarity and good_tool then
|
||||
got_count = got_count + 1
|
||||
for _, add_item in ipairs(item.items) do
|
||||
@@ -288,12 +176,12 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
end
|
||||
|
||||
-- Place above pointed node
|
||||
local place_to = {x = above.x, y = above.y, z = above.z}
|
||||
local place_to = vector.copy(above)
|
||||
|
||||
-- If node under is buildable_to, place into it instead (eg. snow)
|
||||
if olddef_under.buildable_to then
|
||||
log("info", "node under is buildable to")
|
||||
place_to = {x = under.x, y = under.y, z = under.z}
|
||||
place_to = vector.copy(under)
|
||||
end
|
||||
|
||||
if core.is_protected(place_to, playername) then
|
||||
@@ -313,22 +201,14 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
newnode.param2 = def.place_param2
|
||||
elseif (def.paramtype2 == "wallmounted" or
|
||||
def.paramtype2 == "colorwallmounted") and not param2 then
|
||||
local dir = {
|
||||
x = under.x - above.x,
|
||||
y = under.y - above.y,
|
||||
z = under.z - above.z
|
||||
}
|
||||
local dir = vector.subtract(under, above)
|
||||
newnode.param2 = core.dir_to_wallmounted(dir)
|
||||
-- Calculate the direction for furnaces and chests and stuff
|
||||
elseif (def.paramtype2 == "facedir" or
|
||||
def.paramtype2 == "colorfacedir") and not param2 then
|
||||
local placer_pos = placer and placer:get_pos()
|
||||
if placer_pos then
|
||||
local dir = {
|
||||
x = above.x - placer_pos.x,
|
||||
y = above.y - placer_pos.y,
|
||||
z = above.z - placer_pos.z
|
||||
}
|
||||
local dir = vector.subtract(above, placer_pos)
|
||||
newnode.param2 = core.dir_to_facedir(dir)
|
||||
log("info", "facedir: " .. newnode.param2)
|
||||
end
|
||||
@@ -345,6 +225,8 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
color_divisor = 8
|
||||
elseif def.paramtype2 == "colorfacedir" then
|
||||
color_divisor = 32
|
||||
elseif def.paramtype2 == "colordegrotate" then
|
||||
color_divisor = 32
|
||||
end
|
||||
if color_divisor then
|
||||
local color = math.floor(metatable.palette_index / color_divisor)
|
||||
@@ -380,7 +262,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
-- Run callback
|
||||
if def.after_place_node and not prevent_after_place then
|
||||
-- Deepcopy place_to and pointed_thing because callback can modify it
|
||||
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
|
||||
local place_to_copy = vector.copy(place_to)
|
||||
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
|
||||
if def.after_place_node(place_to_copy, placer, itemstack,
|
||||
pointed_thing_copy) then
|
||||
@@ -391,7 +273,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
-- Run script hook
|
||||
for _, callback in ipairs(core.registered_on_placenodes) do
|
||||
-- Deepcopy pos, node and pointed_thing because callback can modify them
|
||||
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
|
||||
local place_to_copy = vector.copy(place_to)
|
||||
local newnode_copy = {name=newnode.name, param1=newnode.param1, param2=newnode.param2}
|
||||
local oldnode_copy = {name=oldnode.name, param1=oldnode.param1, param2=oldnode.param2}
|
||||
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
|
||||
@@ -470,34 +352,41 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
|
||||
return result
|
||||
end
|
||||
end
|
||||
-- read definition before potentially emptying the stack
|
||||
local def = itemstack:get_definition()
|
||||
if itemstack:take_item() ~= nil then
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
if itemstack:take_item():is_empty() then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if def and def.sound and def.sound.eat then
|
||||
core.sound_play(def.sound.eat, {
|
||||
pos = user:get_pos(),
|
||||
max_hear_distance = 16
|
||||
}, true)
|
||||
end
|
||||
if def and def.sound and def.sound.eat then
|
||||
core.sound_play(def.sound.eat, {
|
||||
pos = user:get_pos(),
|
||||
max_hear_distance = 16
|
||||
}, true)
|
||||
end
|
||||
|
||||
if replace_with_item then
|
||||
if itemstack:is_empty() then
|
||||
itemstack:add_item(replace_with_item)
|
||||
-- Changing hp might kill the player causing mods to do who-knows-what to the
|
||||
-- inventory, so do this before set_hp().
|
||||
if replace_with_item then
|
||||
if itemstack:is_empty() then
|
||||
itemstack:add_item(replace_with_item)
|
||||
else
|
||||
local inv = user:get_inventory()
|
||||
-- Check if inv is null, since non-players don't have one
|
||||
if inv and inv:room_for_item("main", {name=replace_with_item}) then
|
||||
inv:add_item("main", replace_with_item)
|
||||
else
|
||||
local inv = user:get_inventory()
|
||||
-- Check if inv is null, since non-players don't have one
|
||||
if inv and inv:room_for_item("main", {name=replace_with_item}) then
|
||||
inv:add_item("main", replace_with_item)
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
core.add_item(pos, replace_with_item)
|
||||
end
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
core.add_item(pos, replace_with_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
user:set_wielded_item(itemstack)
|
||||
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
|
||||
return nil -- don't overwrite wield item a second time
|
||||
end
|
||||
|
||||
function core.item_eat(hp_change, replace_with_item)
|
||||
@@ -512,7 +401,7 @@ function core.node_punch(pos, node, puncher, pointed_thing)
|
||||
-- Run script hook
|
||||
for _, callback in ipairs(core.registered_on_punchnodes) do
|
||||
-- Copy pos and node because callback can modify them
|
||||
local pos_copy = vector.new(pos)
|
||||
local pos_copy = vector.copy(pos)
|
||||
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||
local pointed_thing_copy = pointed_thing and copy_pointed_thing(pointed_thing) or nil
|
||||
callback(pos_copy, node_copy, puncher, pointed_thing_copy)
|
||||
@@ -537,11 +426,11 @@ function core.handle_node_drops(pos, drops, digger)
|
||||
for _, dropped_item in pairs(drops) do
|
||||
local left = give_item(dropped_item)
|
||||
if not left:is_empty() then
|
||||
local p = {
|
||||
x = pos.x + math.random()/2-0.25,
|
||||
y = pos.y + math.random()/2-0.25,
|
||||
z = pos.z + math.random()/2-0.25,
|
||||
}
|
||||
local p = vector.offset(pos,
|
||||
math.random()/2-0.25,
|
||||
math.random()/2-0.25,
|
||||
math.random()/2-0.25
|
||||
)
|
||||
core.add_item(p, left)
|
||||
end
|
||||
end
|
||||
@@ -553,7 +442,7 @@ function core.node_dig(pos, node, digger)
|
||||
local def = core.registered_nodes[node.name]
|
||||
-- Copy pos because the callback could modify it
|
||||
if def and (not def.diggable or
|
||||
(def.can_dig and not def.can_dig(vector.new(pos), digger))) then
|
||||
(def.can_dig and not def.can_dig(vector.copy(pos), digger))) then
|
||||
log("info", diggername .. " tried to dig "
|
||||
.. node.name .. " which is not diggable "
|
||||
.. core.pos_to_string(pos))
|
||||
@@ -578,7 +467,7 @@ function core.node_dig(pos, node, digger)
|
||||
if wielded then
|
||||
local wdef = wielded:get_definition()
|
||||
local tp = wielded:get_tool_capabilities()
|
||||
local dp = core.get_dig_params(def and def.groups, tp)
|
||||
local dp = core.get_dig_params(def and def.groups, tp, wielded:get_wear())
|
||||
if wdef and wdef.after_use then
|
||||
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||
else
|
||||
@@ -600,7 +489,7 @@ function core.node_dig(pos, node, digger)
|
||||
if def and def.preserve_metadata then
|
||||
local oldmeta = core.get_meta(pos):to_table().fields
|
||||
-- Copy pos and node because the callback can modify them.
|
||||
local pos_copy = {x=pos.x, y=pos.y, z=pos.z}
|
||||
local pos_copy = vector.copy(pos)
|
||||
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||
local drop_stacks = {}
|
||||
for k, v in pairs(drops) do
|
||||
@@ -632,7 +521,7 @@ function core.node_dig(pos, node, digger)
|
||||
-- Run callback
|
||||
if def and def.after_dig_node then
|
||||
-- Copy pos and node because callback can modify them
|
||||
local pos_copy = {x=pos.x, y=pos.y, z=pos.z}
|
||||
local pos_copy = vector.copy(pos)
|
||||
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||
def.after_dig_node(pos_copy, node_copy, oldmetadata, digger)
|
||||
end
|
||||
@@ -640,12 +529,10 @@ function core.node_dig(pos, node, digger)
|
||||
-- Run script hook
|
||||
for _, callback in ipairs(core.registered_on_dignodes) do
|
||||
local origin = core.callback_origins[callback]
|
||||
if origin then
|
||||
core.set_last_run_mod(origin.mod)
|
||||
end
|
||||
core.set_last_run_mod(origin.mod)
|
||||
|
||||
-- Copy pos and node because callback can modify them
|
||||
local pos_copy = {x=pos.x, y=pos.y, z=pos.z}
|
||||
local pos_copy = vector.copy(pos)
|
||||
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||
callback(pos_copy, node_copy, digger)
|
||||
end
|
||||
@@ -688,7 +575,7 @@ core.nodedef_default = {
|
||||
groups = {},
|
||||
inventory_image = "",
|
||||
wield_image = "",
|
||||
wield_scale = {x=1,y=1,z=1},
|
||||
wield_scale = vector.new(1, 1, 1),
|
||||
stack_max = default_stack_max,
|
||||
usable = false,
|
||||
liquids_pointable = false,
|
||||
@@ -710,13 +597,8 @@ core.nodedef_default = {
|
||||
-- Node properties
|
||||
drawtype = "normal",
|
||||
visual_scale = 1.0,
|
||||
-- Don't define these because otherwise the old tile_images and
|
||||
-- special_materials wouldn't be read
|
||||
--tiles ={""},
|
||||
--special_tiles = {
|
||||
-- {name="", backface_culling=true},
|
||||
-- {name="", backface_culling=true},
|
||||
--},
|
||||
tiles = {},
|
||||
special_tiles = {},
|
||||
post_effect_color = {a=0, r=0, g=0, b=0},
|
||||
paramtype = "none",
|
||||
paramtype2 = "none",
|
||||
@@ -747,7 +629,7 @@ core.craftitemdef_default = {
|
||||
groups = {},
|
||||
inventory_image = "",
|
||||
wield_image = "",
|
||||
wield_scale = {x=1,y=1,z=1},
|
||||
wield_scale = vector.new(1, 1, 1),
|
||||
stack_max = default_stack_max,
|
||||
liquids_pointable = false,
|
||||
tool_capabilities = nil,
|
||||
@@ -766,7 +648,7 @@ core.tooldef_default = {
|
||||
groups = {},
|
||||
inventory_image = "",
|
||||
wield_image = "",
|
||||
wield_scale = {x=1,y=1,z=1},
|
||||
wield_scale = vector.new(1, 1, 1),
|
||||
stack_max = 1,
|
||||
liquids_pointable = false,
|
||||
tool_capabilities = nil,
|
||||
@@ -785,7 +667,7 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items
|
||||
groups = {},
|
||||
inventory_image = "",
|
||||
wield_image = "",
|
||||
wield_scale = {x=1,y=1,z=1},
|
||||
wield_scale = vector.new(1, 1, 1),
|
||||
stack_max = default_stack_max,
|
||||
liquids_pointable = false,
|
||||
tool_capabilities = nil,
|
||||
|
||||
@@ -58,17 +58,21 @@ core.register_entity(":__builtin:item", {
|
||||
local glow = def and def.light_source and
|
||||
math.floor(def.light_source / 2 + 0.5)
|
||||
|
||||
local size_bias = 1e-3 * math.random() -- small random bias to counter Z-fighting
|
||||
local c = {-size, -size, -size, size, size, size}
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
visual = "wielditem",
|
||||
textures = {itemname},
|
||||
visual_size = {x = size, y = size},
|
||||
collisionbox = {-size, -size, -size, size, size, size},
|
||||
visual_size = {x = size + size_bias, y = size + size_bias},
|
||||
collisionbox = c,
|
||||
automatic_rotate = math.pi * 0.5 * 0.2 / size,
|
||||
wield_item = self.itemstring,
|
||||
glow = glow,
|
||||
})
|
||||
|
||||
-- cache for usage in on_step
|
||||
self._collisionbox = c
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
@@ -93,6 +97,7 @@ core.register_entity(":__builtin:item", {
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
self.object:set_velocity({x = 0, y = 2, z = 0})
|
||||
self.object:set_acceleration({x = 0, y = -gravity, z = 0})
|
||||
self._collisionbox = self.initial_properties.collisionbox
|
||||
self:set_item()
|
||||
end,
|
||||
|
||||
@@ -163,7 +168,7 @@ core.register_entity(":__builtin:item", {
|
||||
local pos = self.object:get_pos()
|
||||
local node = core.get_node_or_nil({
|
||||
x = pos.x,
|
||||
y = pos.y + self.object:get_properties().collisionbox[2] - 0.05,
|
||||
y = pos.y + self._collisionbox[2] - 0.05,
|
||||
z = pos.z
|
||||
})
|
||||
-- Delete in 'ignore' nodes
|
||||
@@ -176,7 +181,7 @@ core.register_entity(":__builtin:item", {
|
||||
if self.force_out then
|
||||
-- This code runs after the entity got a push from the is_stuck code.
|
||||
-- It makes sure the entity is entirely outside the solid node
|
||||
local c = self.object:get_properties().collisionbox
|
||||
local c = self._collisionbox
|
||||
local s = self.force_out_start
|
||||
local f = self.force_out
|
||||
local ok = (f.x > 0 and pos.x + c[1] > s.x + 0.5) or
|
||||
|
||||
156
builtin/game/item_s.lua
Normal file
156
builtin/game/item_s.lua
Normal file
@@ -0,0 +1,156 @@
|
||||
-- Minetest: builtin/item_s.lua
|
||||
-- The distinction of what goes here is a bit tricky, basically it's everything
|
||||
-- that does not (directly or indirectly) need access to ServerEnvironment,
|
||||
-- Server or writable access to IGameDef on the engine side.
|
||||
-- (The '_s' stands for standalone.)
|
||||
|
||||
--
|
||||
-- Item definition helpers
|
||||
--
|
||||
|
||||
function core.inventorycube(img1, img2, img3)
|
||||
img2 = img2 or img1
|
||||
img3 = img3 or img1
|
||||
return "[inventorycube"
|
||||
.. "{" .. img1:gsub("%^", "&")
|
||||
.. "{" .. img2:gsub("%^", "&")
|
||||
.. "{" .. img3:gsub("%^", "&")
|
||||
end
|
||||
|
||||
function core.dir_to_facedir(dir, is6d)
|
||||
--account for y if requested
|
||||
if is6d and math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then
|
||||
|
||||
--from above
|
||||
if dir.y < 0 then
|
||||
if math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 19
|
||||
else
|
||||
return 13
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 10
|
||||
else
|
||||
return 4
|
||||
end
|
||||
end
|
||||
|
||||
--from below
|
||||
else
|
||||
if math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 15
|
||||
else
|
||||
return 17
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 6
|
||||
else
|
||||
return 8
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--otherwise, place horizontally
|
||||
elseif math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 3
|
||||
else
|
||||
return 1
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 2
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Table of possible dirs
|
||||
local facedir_to_dir = {
|
||||
vector.new( 0, 0, 1),
|
||||
vector.new( 1, 0, 0),
|
||||
vector.new( 0, 0, -1),
|
||||
vector.new(-1, 0, 0),
|
||||
vector.new( 0, -1, 0),
|
||||
vector.new( 0, 1, 0),
|
||||
}
|
||||
-- Mapping from facedir value to index in facedir_to_dir.
|
||||
local facedir_to_dir_map = {
|
||||
[0]=1, 2, 3, 4,
|
||||
5, 2, 6, 4,
|
||||
6, 2, 5, 4,
|
||||
1, 5, 3, 6,
|
||||
1, 6, 3, 5,
|
||||
1, 4, 3, 2,
|
||||
}
|
||||
function core.facedir_to_dir(facedir)
|
||||
return facedir_to_dir[facedir_to_dir_map[facedir % 32]]
|
||||
end
|
||||
|
||||
function core.dir_to_wallmounted(dir)
|
||||
if math.abs(dir.y) > math.max(math.abs(dir.x), math.abs(dir.z)) then
|
||||
if dir.y < 0 then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x < 0 then
|
||||
return 3
|
||||
else
|
||||
return 2
|
||||
end
|
||||
else
|
||||
if dir.z < 0 then
|
||||
return 5
|
||||
else
|
||||
return 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- table of dirs in wallmounted order
|
||||
local wallmounted_to_dir = {
|
||||
[0] = vector.new( 0, 1, 0),
|
||||
vector.new( 0, -1, 0),
|
||||
vector.new( 1, 0, 0),
|
||||
vector.new(-1, 0, 0),
|
||||
vector.new( 0, 0, 1),
|
||||
vector.new( 0, 0, -1),
|
||||
}
|
||||
function core.wallmounted_to_dir(wallmounted)
|
||||
return wallmounted_to_dir[wallmounted % 8]
|
||||
end
|
||||
|
||||
function core.dir_to_yaw(dir)
|
||||
return -math.atan2(dir.x, dir.z)
|
||||
end
|
||||
|
||||
function core.yaw_to_dir(yaw)
|
||||
return vector.new(-math.sin(yaw), 0, math.cos(yaw))
|
||||
end
|
||||
|
||||
function core.is_colored_paramtype(ptype)
|
||||
return (ptype == "color") or (ptype == "colorfacedir") or
|
||||
(ptype == "colorwallmounted") or (ptype == "colordegrotate")
|
||||
end
|
||||
|
||||
function core.strip_param2_color(param2, paramtype2)
|
||||
if not core.is_colored_paramtype(paramtype2) then
|
||||
return nil
|
||||
end
|
||||
if paramtype2 == "colorfacedir" then
|
||||
param2 = math.floor(param2 / 32) * 32
|
||||
elseif paramtype2 == "colorwallmounted" then
|
||||
param2 = math.floor(param2 / 8) * 8
|
||||
elseif paramtype2 == "colordegrotate" then
|
||||
param2 = math.floor(param2 / 32) * 32
|
||||
end
|
||||
-- paramtype2 == "color" requires no modification.
|
||||
return param2
|
||||
end
|
||||
@@ -1,9 +1,21 @@
|
||||
-- Minetest: builtin/misc.lua
|
||||
|
||||
local S = core.get_translator("__builtin")
|
||||
|
||||
--
|
||||
-- Misc. API functions
|
||||
--
|
||||
|
||||
-- @spec core.kick_player(String, String) :: Boolean
|
||||
function core.kick_player(player_name, reason)
|
||||
if type(reason) == "string" then
|
||||
reason = "Kicked: " .. reason
|
||||
else
|
||||
reason = "Kicked."
|
||||
end
|
||||
return core.disconnect_player(player_name, reason)
|
||||
end
|
||||
|
||||
function core.check_player_privs(name, ...)
|
||||
if core.is_player(name) then
|
||||
name = name:get_player_name()
|
||||
@@ -42,15 +54,15 @@ end
|
||||
|
||||
function core.send_join_message(player_name)
|
||||
if not core.is_singleplayer() then
|
||||
core.chat_send_all("*** " .. player_name .. " joined the game.")
|
||||
core.chat_send_all("*** " .. S("@1 joined the game.", player_name))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function core.send_leave_message(player_name, timed_out)
|
||||
local announcement = "*** " .. player_name .. " left the game."
|
||||
local announcement = "*** " .. S("@1 left the game.", player_name)
|
||||
if timed_out then
|
||||
announcement = announcement .. " (timed out)"
|
||||
announcement = "*** " .. S("@1 left the game (timed out).", player_name)
|
||||
end
|
||||
core.chat_send_all(announcement)
|
||||
end
|
||||
@@ -109,54 +121,6 @@ function core.get_player_radius_area(player_name, radius)
|
||||
end
|
||||
|
||||
|
||||
function core.hash_node_position(pos)
|
||||
return (pos.z + 32768) * 65536 * 65536
|
||||
+ (pos.y + 32768) * 65536
|
||||
+ pos.x + 32768
|
||||
end
|
||||
|
||||
|
||||
function core.get_position_from_hash(hash)
|
||||
local pos = {}
|
||||
pos.x = (hash % 65536) - 32768
|
||||
hash = math.floor(hash / 65536)
|
||||
pos.y = (hash % 65536) - 32768
|
||||
hash = math.floor(hash / 65536)
|
||||
pos.z = (hash % 65536) - 32768
|
||||
return pos
|
||||
end
|
||||
|
||||
|
||||
function core.get_item_group(name, group)
|
||||
if not core.registered_items[name] or not
|
||||
core.registered_items[name].groups[group] then
|
||||
return 0
|
||||
end
|
||||
return core.registered_items[name].groups[group]
|
||||
end
|
||||
|
||||
|
||||
function core.get_node_group(name, group)
|
||||
core.log("deprecated", "Deprecated usage of get_node_group, use get_item_group instead")
|
||||
return core.get_item_group(name, group)
|
||||
end
|
||||
|
||||
|
||||
function core.setting_get_pos(name)
|
||||
local value = core.settings:get(name)
|
||||
if not value then
|
||||
return nil
|
||||
end
|
||||
return core.string_to_pos(value)
|
||||
end
|
||||
|
||||
|
||||
-- See l_env.cpp for the other functions
|
||||
function core.get_artificial_light(param1)
|
||||
return math.floor(param1 / 16)
|
||||
end
|
||||
|
||||
|
||||
-- To be overriden by protection mods
|
||||
|
||||
function core.is_protected(pos, name)
|
||||
@@ -213,7 +177,7 @@ function core.is_area_protected(minp, maxp, player_name, interval)
|
||||
local y = math.floor(yf + 0.5)
|
||||
for xf = minp.x, maxp.x, d.x do
|
||||
local x = math.floor(xf + 0.5)
|
||||
local pos = {x = x, y = y, z = z}
|
||||
local pos = vector.new(x, y, z)
|
||||
if core.is_protected(pos, player_name) then
|
||||
return pos
|
||||
end
|
||||
@@ -239,7 +203,7 @@ end
|
||||
|
||||
-- HTTP callback interface
|
||||
|
||||
function core.http_add_fetch(httpenv)
|
||||
core.set_http_api_lua(function(httpenv)
|
||||
httpenv.fetch = function(req, callback)
|
||||
local handle = httpenv.fetch_async(req)
|
||||
|
||||
@@ -255,7 +219,8 @@ function core.http_add_fetch(httpenv)
|
||||
end
|
||||
|
||||
return httpenv
|
||||
end
|
||||
end)
|
||||
core.set_http_api_lua = nil
|
||||
|
||||
|
||||
function core.close_formspec(player_name, formname)
|
||||
@@ -268,24 +233,34 @@ function core.cancel_shutdown_requests()
|
||||
end
|
||||
|
||||
|
||||
-- Callback handling for dynamic_add_media
|
||||
-- Used for callback handling with dynamic_add_media
|
||||
core.dynamic_media_callbacks = {}
|
||||
|
||||
local dynamic_add_media_raw = core.dynamic_add_media_raw
|
||||
core.dynamic_add_media_raw = nil
|
||||
function core.dynamic_add_media(filepath, callback)
|
||||
local ret = dynamic_add_media_raw(filepath)
|
||||
if ret == false then
|
||||
return ret
|
||||
|
||||
-- Transfer of certain globals into async environment
|
||||
-- see builtin/async/game.lua for the other side
|
||||
|
||||
local function copy_filtering(t, seen)
|
||||
if type(t) == "userdata" or type(t) == "function" then
|
||||
return true -- don't use nil so presence can still be detected
|
||||
elseif type(t) ~= "table" then
|
||||
return t
|
||||
end
|
||||
if callback == nil then
|
||||
core.log("deprecated", "Calling minetest.dynamic_add_media without "..
|
||||
"a callback is deprecated and will stop working in future versions.")
|
||||
else
|
||||
-- At the moment async loading is not actually implemented, so we
|
||||
-- immediately call the callback ourselves
|
||||
for _, name in ipairs(ret) do
|
||||
callback(name)
|
||||
end
|
||||
local n = {}
|
||||
seen = seen or {}
|
||||
seen[t] = n
|
||||
for k, v in pairs(t) do
|
||||
local k_ = seen[k] or copy_filtering(k, seen)
|
||||
local v_ = seen[v] or copy_filtering(v, seen)
|
||||
n[k_] = v_
|
||||
end
|
||||
return true
|
||||
return n
|
||||
end
|
||||
|
||||
function core.get_globals_to_transfer()
|
||||
local all = {
|
||||
registered_items = copy_filtering(core.registered_items),
|
||||
registered_aliases = core.registered_aliases,
|
||||
}
|
||||
return all
|
||||
end
|
||||
|
||||
93
builtin/game/misc_s.lua
Normal file
93
builtin/game/misc_s.lua
Normal file
@@ -0,0 +1,93 @@
|
||||
-- Minetest: builtin/misc_s.lua
|
||||
-- The distinction of what goes here is a bit tricky, basically it's everything
|
||||
-- that does not (directly or indirectly) need access to ServerEnvironment,
|
||||
-- Server or writable access to IGameDef on the engine side.
|
||||
-- (The '_s' stands for standalone.)
|
||||
|
||||
--
|
||||
-- Misc. API functions
|
||||
--
|
||||
|
||||
function core.hash_node_position(pos)
|
||||
return (pos.z + 32768) * 65536 * 65536
|
||||
+ (pos.y + 32768) * 65536
|
||||
+ pos.x + 32768
|
||||
end
|
||||
|
||||
|
||||
function core.get_position_from_hash(hash)
|
||||
local x = (hash % 65536) - 32768
|
||||
hash = math.floor(hash / 65536)
|
||||
local y = (hash % 65536) - 32768
|
||||
hash = math.floor(hash / 65536)
|
||||
local z = (hash % 65536) - 32768
|
||||
return vector.new(x, y, z)
|
||||
end
|
||||
|
||||
|
||||
function core.get_item_group(name, group)
|
||||
if not core.registered_items[name] or not
|
||||
core.registered_items[name].groups[group] then
|
||||
return 0
|
||||
end
|
||||
return core.registered_items[name].groups[group]
|
||||
end
|
||||
|
||||
|
||||
function core.get_node_group(name, group)
|
||||
core.log("deprecated", "Deprecated usage of get_node_group, use get_item_group instead")
|
||||
return core.get_item_group(name, group)
|
||||
end
|
||||
|
||||
|
||||
function core.setting_get_pos(name)
|
||||
local value = core.settings:get(name)
|
||||
if not value then
|
||||
return nil
|
||||
end
|
||||
return core.string_to_pos(value)
|
||||
end
|
||||
|
||||
|
||||
-- See l_env.cpp for the other functions
|
||||
function core.get_artificial_light(param1)
|
||||
return math.floor(param1 / 16)
|
||||
end
|
||||
|
||||
-- PNG encoder safety wrapper
|
||||
|
||||
local o_encode_png = core.encode_png
|
||||
function core.encode_png(width, height, data, compression)
|
||||
if type(width) ~= "number" then
|
||||
error("Incorrect type for 'width', expected number, got " .. type(width))
|
||||
end
|
||||
if type(height) ~= "number" then
|
||||
error("Incorrect type for 'height', expected number, got " .. type(height))
|
||||
end
|
||||
|
||||
local expected_byte_count = width * height * 4
|
||||
|
||||
if type(data) ~= "table" and type(data) ~= "string" then
|
||||
error("Incorrect type for 'data', expected table or string, got " .. type(data))
|
||||
end
|
||||
|
||||
local data_length = type(data) == "table" and #data * 4 or string.len(data)
|
||||
|
||||
if data_length ~= expected_byte_count then
|
||||
error(string.format(
|
||||
"Incorrect length of 'data', width and height imply %d bytes but %d were provided",
|
||||
expected_byte_count,
|
||||
data_length
|
||||
))
|
||||
end
|
||||
|
||||
if type(data) == "table" then
|
||||
local dataBuf = {}
|
||||
for i = 1, #data do
|
||||
dataBuf[i] = core.colorspec_to_bytes(data[i])
|
||||
end
|
||||
data = table.concat(dataBuf)
|
||||
end
|
||||
|
||||
return o_encode_png(width, height, data, compression or 6)
|
||||
end
|
||||
@@ -1,5 +1,7 @@
|
||||
-- Minetest: builtin/privileges.lua
|
||||
|
||||
local S = core.get_translator("__builtin")
|
||||
|
||||
--
|
||||
-- Privileges
|
||||
--
|
||||
@@ -15,7 +17,7 @@ function core.register_privilege(name, param)
|
||||
def.give_to_admin = def.give_to_singleplayer
|
||||
end
|
||||
if def.description == nil then
|
||||
def.description = "(no description)"
|
||||
def.description = S("(no description)")
|
||||
end
|
||||
end
|
||||
local def
|
||||
@@ -28,71 +30,76 @@ function core.register_privilege(name, param)
|
||||
core.registered_privileges[name] = def
|
||||
end
|
||||
|
||||
core.register_privilege("interact", "Can interact with things and modify the world")
|
||||
core.register_privilege("shout", "Can speak in chat")
|
||||
core.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privileges")
|
||||
core.register_privilege("privs", "Can modify privileges")
|
||||
core.register_privilege("interact", S("Can interact with things and modify the world"))
|
||||
core.register_privilege("shout", S("Can speak in chat"))
|
||||
|
||||
local basic_privs =
|
||||
core.string_to_privs((core.settings:get("basic_privs") or "shout,interact"))
|
||||
local basic_privs_desc = S("Can modify basic privileges (@1)",
|
||||
core.privs_to_string(basic_privs, ', '))
|
||||
core.register_privilege("basic_privs", basic_privs_desc)
|
||||
|
||||
core.register_privilege("privs", S("Can modify privileges"))
|
||||
|
||||
core.register_privilege("teleport", {
|
||||
description = "Can teleport self",
|
||||
description = S("Can teleport self"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("bring", {
|
||||
description = "Can teleport other players",
|
||||
description = S("Can teleport other players"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("settime", {
|
||||
description = "Can set the time of day using /time",
|
||||
description = S("Can set the time of day using /time"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("server", {
|
||||
description = "Can do server maintenance stuff",
|
||||
description = S("Can do server maintenance stuff"),
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = true,
|
||||
})
|
||||
core.register_privilege("protection_bypass", {
|
||||
description = "Can bypass node protection in the world",
|
||||
description = S("Can bypass node protection in the world"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("ban", {
|
||||
description = "Can ban and unban players",
|
||||
description = S("Can ban and unban players"),
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = true,
|
||||
})
|
||||
core.register_privilege("kick", {
|
||||
description = "Can kick players",
|
||||
description = S("Can kick players"),
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = true,
|
||||
})
|
||||
core.register_privilege("give", {
|
||||
description = "Can use /give and /giveme",
|
||||
description = S("Can use /give and /giveme"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("password", {
|
||||
description = "Can use /setpassword and /clearpassword",
|
||||
description = S("Can use /setpassword and /clearpassword"),
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = true,
|
||||
})
|
||||
core.register_privilege("fly", {
|
||||
description = "Can use fly mode",
|
||||
description = S("Can use fly mode"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("fast", {
|
||||
description = "Can use fast mode",
|
||||
description = S("Can use fast mode"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("noclip", {
|
||||
description = "Can fly through solid nodes using noclip mode",
|
||||
description = S("Can fly through solid nodes using noclip mode"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("rollback", {
|
||||
description = "Can use the rollback functionality",
|
||||
description = S("Can use the rollback functionality"),
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
core.register_privilege("debug", {
|
||||
description = "Allows enabling various debug options that may affect gameplay",
|
||||
description = S("Can enable wireframe"),
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = true,
|
||||
})
|
||||
|
||||
core.register_can_bypass_userlimit(function(name, ip)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
-- Minetest: builtin/misc_register.lua
|
||||
-- Minetest: builtin/register.lua
|
||||
|
||||
local S = core.get_translator("__builtin")
|
||||
|
||||
--
|
||||
-- Make raw registration functions inaccessible to anyone except this file
|
||||
@@ -326,7 +328,7 @@ end
|
||||
|
||||
core.register_item(":unknown", {
|
||||
type = "none",
|
||||
description = "Unknown Item",
|
||||
description = S("Unknown Item"),
|
||||
inventory_image = "unknown_item.png",
|
||||
on_place = core.item_place,
|
||||
on_secondary_use = core.item_secondary_use,
|
||||
@@ -336,7 +338,7 @@ core.register_item(":unknown", {
|
||||
})
|
||||
|
||||
core.register_node(":air", {
|
||||
description = "Air",
|
||||
description = S("Air"),
|
||||
inventory_image = "air.png",
|
||||
wield_image = "air.png",
|
||||
drawtype = "airlike",
|
||||
@@ -353,7 +355,7 @@ core.register_node(":air", {
|
||||
})
|
||||
|
||||
core.register_node(":ignore", {
|
||||
description = "Ignore",
|
||||
description = S("Ignore"),
|
||||
inventory_image = "ignore.png",
|
||||
wield_image = "ignore.png",
|
||||
drawtype = "airlike",
|
||||
@@ -366,11 +368,12 @@ core.register_node(":ignore", {
|
||||
air_equivalent = true,
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
node_placement_prediction = "",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
core.chat_send_player(
|
||||
placer:get_player_name(),
|
||||
core.colorize("#FF0000",
|
||||
"You can't place 'ignore' nodes!"))
|
||||
S("You can't place 'ignore' nodes!")))
|
||||
return ""
|
||||
end,
|
||||
})
|
||||
@@ -400,8 +403,14 @@ function core.override_item(name, redefinition)
|
||||
register_item_raw(item)
|
||||
end
|
||||
|
||||
|
||||
core.callback_origins = {}
|
||||
do
|
||||
local default = {mod = "??", name = "??"}
|
||||
core.callback_origins = setmetatable({}, {
|
||||
__index = function()
|
||||
return default
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function core.run_callbacks(callbacks, mode, ...)
|
||||
assert(type(callbacks) == "table")
|
||||
@@ -416,9 +425,7 @@ function core.run_callbacks(callbacks, mode, ...)
|
||||
local ret = nil
|
||||
for i = 1, cb_len do
|
||||
local origin = core.callback_origins[callbacks[i]]
|
||||
if origin then
|
||||
core.set_last_run_mod(origin.mod)
|
||||
end
|
||||
core.set_last_run_mod(origin.mod)
|
||||
local cb_ret = callbacks[i](...)
|
||||
|
||||
if mode == 0 and i == 1 then
|
||||
@@ -607,6 +614,7 @@ core.registered_on_modchannel_message, core.register_on_modchannel_message = mak
|
||||
core.registered_on_player_inventory_actions, core.register_on_player_inventory_action = make_registration()
|
||||
core.registered_allow_player_inventory_actions, core.register_allow_player_inventory_action = make_registration()
|
||||
core.registered_on_rightclickplayers, core.register_on_rightclickplayer = make_registration()
|
||||
core.registered_on_liquid_transformed, core.register_on_liquid_transformed = make_registration()
|
||||
|
||||
--
|
||||
-- Compatibility for on_mapgen_init()
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
-- cache setting
|
||||
local enable_damage = core.settings:get_bool("enable_damage")
|
||||
|
||||
local health_bar_definition = {
|
||||
hud_elem_type = "statbar",
|
||||
position = {x = 0.5, y = 1},
|
||||
text = "heart.png",
|
||||
text2 = "heart_gone.png",
|
||||
number = core.PLAYER_MAX_HP_DEFAULT,
|
||||
item = core.PLAYER_MAX_HP_DEFAULT,
|
||||
direction = 0,
|
||||
size = {x = 24, y = 24},
|
||||
offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)},
|
||||
}
|
||||
|
||||
local breath_bar_definition = {
|
||||
hud_elem_type = "statbar",
|
||||
position = {x = 0.5, y = 1},
|
||||
text = "bubble.png",
|
||||
text2 = "bubble_gone.png",
|
||||
number = core.PLAYER_MAX_BREATH_DEFAULT,
|
||||
item = core.PLAYER_MAX_BREATH_DEFAULT * 2,
|
||||
direction = 0,
|
||||
size = {x = 24, y = 24},
|
||||
offset = {x = 25, y= -(48 + 24 + 16)},
|
||||
local bar_definitions = {
|
||||
hp = {
|
||||
hud_elem_type = "statbar",
|
||||
position = {x = 0.5, y = 1},
|
||||
text = "heart.png",
|
||||
text2 = "heart_gone.png",
|
||||
number = core.PLAYER_MAX_HP_DEFAULT,
|
||||
item = core.PLAYER_MAX_HP_DEFAULT,
|
||||
direction = 0,
|
||||
size = {x = 24, y = 24},
|
||||
offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)},
|
||||
},
|
||||
breath = {
|
||||
hud_elem_type = "statbar",
|
||||
position = {x = 0.5, y = 1},
|
||||
text = "bubble.png",
|
||||
text2 = "bubble_gone.png",
|
||||
number = core.PLAYER_MAX_BREATH_DEFAULT * 2,
|
||||
item = core.PLAYER_MAX_BREATH_DEFAULT * 2,
|
||||
direction = 0,
|
||||
size = {x = 24, y = 24},
|
||||
offset = {x = 25, y= -(48 + 24 + 16)},
|
||||
},
|
||||
}
|
||||
|
||||
local hud_ids = {}
|
||||
|
||||
local function scaleToDefault(player, field)
|
||||
-- Scale "hp" or "breath" to the default dimensions
|
||||
local function scaleToHudMax(player, field)
|
||||
-- Scale "hp" or "breath" to the hud maximum dimensions
|
||||
local current = player["get_" .. field](player)
|
||||
local nominal = core["PLAYER_MAX_" .. field:upper() .. "_DEFAULT"]
|
||||
local max_display = math.max(nominal,
|
||||
math.max(player:get_properties()[field .. "_max"], current))
|
||||
return current / max_display * nominal
|
||||
local nominal = bar_definitions[field].item
|
||||
local max_display = math.max(player:get_properties()[field .. "_max"], current)
|
||||
return math.ceil(current / max_display * nominal)
|
||||
end
|
||||
|
||||
local function update_builtin_statbars(player)
|
||||
@@ -55,9 +55,9 @@ local function update_builtin_statbars(player)
|
||||
local immortal = player:get_armor_groups().immortal == 1
|
||||
|
||||
if flags.healthbar and enable_damage and not immortal then
|
||||
local number = scaleToDefault(player, "hp")
|
||||
local number = scaleToHudMax(player, "hp")
|
||||
if hud.id_healthbar == nil then
|
||||
local hud_def = table.copy(health_bar_definition)
|
||||
local hud_def = table.copy(bar_definitions.hp)
|
||||
hud_def.number = number
|
||||
hud.id_healthbar = player:hud_add(hud_def)
|
||||
else
|
||||
@@ -73,9 +73,9 @@ local function update_builtin_statbars(player)
|
||||
local breath = player:get_breath()
|
||||
local breath_max = player:get_properties().breath_max
|
||||
if show_breathbar and breath <= breath_max then
|
||||
local number = 2 * scaleToDefault(player, "breath")
|
||||
local number = scaleToHudMax(player, "breath")
|
||||
if not hud.id_breathbar and breath < breath_max then
|
||||
local hud_def = table.copy(breath_bar_definition)
|
||||
local hud_def = table.copy(bar_definitions.breath)
|
||||
hud_def.number = number
|
||||
hud.id_breathbar = player:hud_add(hud_def)
|
||||
elseif hud.id_breathbar then
|
||||
@@ -138,14 +138,16 @@ local function player_event_handler(player,eventname)
|
||||
end
|
||||
|
||||
function core.hud_replace_builtin(hud_name, definition)
|
||||
|
||||
if type(definition) ~= "table" or
|
||||
definition.hud_elem_type ~= "statbar" then
|
||||
return false
|
||||
end
|
||||
|
||||
definition = table.copy(definition)
|
||||
|
||||
if hud_name == "health" then
|
||||
health_bar_definition = definition
|
||||
definition.item = definition.item or definition.number or core.PLAYER_MAX_HP_DEFAULT
|
||||
bar_definitions.hp = definition
|
||||
|
||||
for name, ids in pairs(hud_ids) do
|
||||
local player = core.get_player_by_name(name)
|
||||
@@ -159,7 +161,8 @@ function core.hud_replace_builtin(hud_name, definition)
|
||||
end
|
||||
|
||||
if hud_name == "breath" then
|
||||
breath_bar_definition = definition
|
||||
definition.item = definition.item or definition.number or core.PLAYER_MAX_BREATH_DEFAULT
|
||||
bar_definitions.breath = definition
|
||||
|
||||
for name, ids in pairs(hud_ids) do
|
||||
local player = core.get_player_by_name(name)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
local math_floor = math.floor
|
||||
local vector_new = vector.new
|
||||
|
||||
VoxelArea = {
|
||||
MinEdge = {x=1, y=1, z=1},
|
||||
MaxEdge = {x=0, y=0, z=0},
|
||||
MinEdge = vector_new(1, 1, 1),
|
||||
MaxEdge = vector_new(0, 0, 0),
|
||||
ystride = 0,
|
||||
zstride = 0,
|
||||
}
|
||||
@@ -19,11 +22,11 @@ end
|
||||
|
||||
function VoxelArea:getExtent()
|
||||
local MaxEdge, MinEdge = self.MaxEdge, self.MinEdge
|
||||
return {
|
||||
x = MaxEdge.x - MinEdge.x + 1,
|
||||
y = MaxEdge.y - MinEdge.y + 1,
|
||||
z = MaxEdge.z - MinEdge.z + 1,
|
||||
}
|
||||
return vector_new(
|
||||
MaxEdge.x - MinEdge.x + 1,
|
||||
MaxEdge.y - MinEdge.y + 1,
|
||||
MaxEdge.z - MinEdge.z + 1
|
||||
)
|
||||
end
|
||||
|
||||
function VoxelArea:getVolume()
|
||||
@@ -36,7 +39,7 @@ function VoxelArea:index(x, y, z)
|
||||
local i = (z - MinEdge.z) * self.zstride +
|
||||
(y - MinEdge.y) * self.ystride +
|
||||
(x - MinEdge.x) + 1
|
||||
return math.floor(i)
|
||||
return math_floor(i)
|
||||
end
|
||||
|
||||
function VoxelArea:indexp(p)
|
||||
@@ -44,24 +47,23 @@ function VoxelArea:indexp(p)
|
||||
local i = (p.z - MinEdge.z) * self.zstride +
|
||||
(p.y - MinEdge.y) * self.ystride +
|
||||
(p.x - MinEdge.x) + 1
|
||||
return math.floor(i)
|
||||
return math_floor(i)
|
||||
end
|
||||
|
||||
function VoxelArea:position(i)
|
||||
local p = {}
|
||||
local MinEdge = self.MinEdge
|
||||
|
||||
i = i - 1
|
||||
|
||||
p.z = math.floor(i / self.zstride) + MinEdge.z
|
||||
local z = math_floor(i / self.zstride) + MinEdge.z
|
||||
i = i % self.zstride
|
||||
|
||||
p.y = math.floor(i / self.ystride) + MinEdge.y
|
||||
local y = math_floor(i / self.ystride) + MinEdge.y
|
||||
i = i % self.ystride
|
||||
|
||||
p.x = math.floor(i) + MinEdge.x
|
||||
local x = math_floor(i) + MinEdge.x
|
||||
|
||||
return p
|
||||
return vector_new(x, y, z)
|
||||
end
|
||||
|
||||
function VoxelArea:contains(x, y, z)
|
||||
|
||||
@@ -30,6 +30,7 @@ local clientpath = scriptdir .. "client" .. DIR_DELIM
|
||||
local commonpath = scriptdir .. "common" .. DIR_DELIM
|
||||
local asyncpath = scriptdir .. "async" .. DIR_DELIM
|
||||
|
||||
dofile(commonpath .. "vector.lua")
|
||||
dofile(commonpath .. "strict.lua")
|
||||
dofile(commonpath .. "serialize.lua")
|
||||
dofile(commonpath .. "misc_helpers.lua")
|
||||
@@ -55,8 +56,10 @@ elseif INIT == "mainmenu" then
|
||||
if not custom_loaded then
|
||||
dofile(core.get_mainmenu_path() .. DIR_DELIM .. "init.lua")
|
||||
end
|
||||
elseif INIT == "async" then
|
||||
dofile(asyncpath .. "init.lua")
|
||||
elseif INIT == "async" then
|
||||
dofile(asyncpath .. "mainmenu.lua")
|
||||
elseif INIT == "async_game" then
|
||||
dofile(asyncpath .. "game.lua")
|
||||
elseif INIT == "client" then
|
||||
dofile(clientpath .. "init.lua")
|
||||
else
|
||||
|
||||
246
builtin/locale/__builtin.de.tr
Normal file
246
builtin/locale/__builtin.de.tr
Normal file
@@ -0,0 +1,246 @@
|
||||
# textdomain: __builtin
|
||||
Empty command.=Leerer Befehl.
|
||||
Invalid command: @1=Ungültiger Befehl: @1
|
||||
Invalid command usage.=Ungültige Befehlsverwendung.
|
||||
(@1 s)= (@1 s)
|
||||
Command execution took @1 s=Befehlsausführung brauchte @1 s
|
||||
You don't have permission to run this command (missing privileges: @1).=Sie haben keine Erlaubnis, diesen Befehl auszuführen (fehlende Privilegien: @1).
|
||||
Unable to get position of player @1.=Konnte Position vom Spieler @1 nicht ermitteln.
|
||||
Incorrect area format. Expected: (x1,y1,z1) (x2,y2,z2)=Ungültiges Gebietsformat. Erwartet: (x1,y1,z1) (x2,y2,z2)
|
||||
<action>=<Aktion>
|
||||
Show chat action (e.g., '/me orders a pizza' displays '<player name> orders a pizza')=Chataktion zeigen (z.B. wird „/me isst Pizza“ zu „<Spielername> isst Pizza“)
|
||||
Show the name of the server owner=Den Namen des Servereigentümers zeigen
|
||||
The administrator of this server is @1.=Der Administrator dieses Servers ist @1.
|
||||
There's no administrator named in the config file.=In der Konfigurationsdatei wurde kein Administrator angegeben.
|
||||
@1 does not have any privileges.=@1 hat keine Privilegien.
|
||||
Privileges of @1: @2=Privilegien von @1: @2
|
||||
[<name>]=[<Name>]
|
||||
Show privileges of yourself or another player=Ihre eigenen Privilegien oder die eines anderen Spielers anzeigen
|
||||
Player @1 does not exist.=Spieler @1 existiert nicht.
|
||||
<privilege>=<Privileg>
|
||||
Return list of all online players with privilege=Liste aller Spieler mit einem Privileg ausgeben
|
||||
Invalid parameters (see /help haspriv).=Ungültige Parameter (siehe „/help haspriv“).
|
||||
Unknown privilege!=Unbekanntes Privileg!
|
||||
No online player has the "@1" privilege.=Kein online spielender Spieler hat das „@1“-Privileg.
|
||||
Players online with the "@1" privilege: @2=Derzeit online spielende Spieler mit dem „@1“-Privileg: @2
|
||||
Your privileges are insufficient.=Ihre Privilegien sind unzureichend.
|
||||
Your privileges are insufficient. '@1' only allows you to grant: @2=Ihre Privilegien sind unzureichend. Mit „@1“ können Sie nur folgendes gewähren: @2
|
||||
Unknown privilege: @1=Unbekanntes Privileg: @1
|
||||
@1 granted you privileges: @2=@1 gewährte Ihnen Privilegien: @2
|
||||
<name> (<privilege> [, <privilege2> [<...>]] | all)=<Name> (<Privileg> [, <Privileg2> [<...>]] | all)
|
||||
Give privileges to player=Privileg an Spieler vergeben
|
||||
Invalid parameters (see /help grant).=Ungültige Parameter (siehe „/help grant“).
|
||||
<privilege> [, <privilege2> [<...>]] | all=<Privileg> [, <Privileg2> [<...>]] | all
|
||||
Grant privileges to yourself=Privilegien an Ihnen selbst vergeben
|
||||
Invalid parameters (see /help grantme).=Ungültige Parameter (siehe „/help grantme“).
|
||||
Your privileges are insufficient. '@1' only allows you to revoke: @2=Ihre Privilegien sind unzureichend. Mit „@1“ können Sie nur folgendes entziehen: @2
|
||||
Note: Cannot revoke in singleplayer: @1=Anmerkung: Im Einzelspielermodus kann man folgendes nicht entziehen: @1
|
||||
Note: Cannot revoke from admin: @1=Anmerkung: Vom Admin kann man folgendes nicht entziehen: @1
|
||||
No privileges were revoked.=Es wurden keine Privilegien entzogen.
|
||||
@1 revoked privileges from you: @2=@1 entfernte Privilegien von Ihnen: @2
|
||||
Remove privileges from player=Privilegien von Spieler entfernen
|
||||
Invalid parameters (see /help revoke).=Ungültige Parameter (siehe „/help revoke“).
|
||||
Revoke privileges from yourself=Privilegien von Ihnen selbst entfernen
|
||||
Invalid parameters (see /help revokeme).=Ungültige Parameter (siehe „/help revokeme“).
|
||||
<name> <password>=<Name> <Passwort>
|
||||
Set player's password=Passwort von Spieler setzen
|
||||
Name field required.=Namensfeld benötigt.
|
||||
Your password was cleared by @1.=Ihr Passwort wurde von @1 geleert.
|
||||
Password of player "@1" cleared.=Passwort von Spieler „@1“ geleert.
|
||||
Your password was set by @1.=Ihr Passwort wurde von @1 gesetzt.
|
||||
Password of player "@1" set.=Passwort von Spieler „@1“ gesetzt.
|
||||
<name>=<Name>
|
||||
Set empty password for a player=Leeres Passwort für einen Spieler setzen
|
||||
Reload authentication data=Authentifizierungsdaten erneut laden
|
||||
Done.=Fertig.
|
||||
Failed.=Fehlgeschlagen.
|
||||
Remove a player's data=Daten eines Spielers löschen
|
||||
Player "@1" removed.=Spieler „@1“ gelöscht.
|
||||
No such player "@1" to remove.=Es gibt keinen Spieler „@1“, der gelöscht werden könnte.
|
||||
Player "@1" is connected, cannot remove.=Spieler „@1“ ist verbunden, er kann nicht gelöscht werden.
|
||||
Unhandled remove_player return code @1.=Nicht berücksichtigter remove_player-Rückgabewert @1.
|
||||
Cannot teleport out of map bounds!=Eine Teleportation außerhalb der Kartengrenzen ist nicht möglich!
|
||||
Cannot get player with name @1.=Spieler mit Namen @1 kann nicht gefunden werden.
|
||||
Cannot teleport, @1 is attached to an object!=Teleportation nicht möglich, @1 ist an einem Objekt befestigt!
|
||||
Teleporting @1 to @2.=Teleportation von @1 nach @2
|
||||
One does not teleport to oneself.=Man teleportiert sich doch nicht zu sich selbst.
|
||||
Cannot get teleportee with name @1.=Der zu teleportierende Spieler mit Namen @1 kann nicht gefunden werden.
|
||||
Cannot get target player with name @1.=Zielspieler mit Namen @1 kann nicht gefunden werden.
|
||||
Teleporting @1 to @2 at @3.=Teleportation von @1 zu @2 bei @3
|
||||
<X>,<Y>,<Z> | <to_name> | <name> <X>,<Y>,<Z> | <name> <to_name>=<X>,<Y>,<Z> | <zu_Name> | <Name> <X>,<Y>,<Z> | <Name> <zu_Name>
|
||||
Teleport to position or player=Zu Position oder Spieler teleportieren
|
||||
You don't have permission to teleport other players (missing privilege: @1).=Sie haben nicht die Erlaubnis, andere Spieler zu teleportieren (fehlendes Privileg: @1).
|
||||
([-n] <name> <value>) | <name>=([-n] <Name> <Wert>) | <Name>
|
||||
Set or read server configuration setting=Serverkonfigurationseinstellung setzen oder lesen
|
||||
Failed. Cannot modify secure settings. Edit the settings file manually.=Fehlgeschlagen. Sicherheitseinstellungen können nicht modifiziert werden. Bearbeiten Sie die Einstellungsdatei manuell.
|
||||
Failed. Use '/set -n <name> <value>' to create a new setting.=Fehlgeschlagen. Benutzen Sie „/set -n <Name> <Wert>“, um eine neue Einstellung zu erstellen.
|
||||
@1 @= @2=@1 @= @2
|
||||
<not set>=<nicht gesetzt>
|
||||
Invalid parameters (see /help set).=Ungültige Parameter (siehe „/help set“).
|
||||
Finished emerging @1 blocks in @2ms.=Fertig mit Erzeugung von @1 Blöcken in @2 ms.
|
||||
emergeblocks update: @1/@2 blocks emerged (@3%)=emergeblocks-Update: @1/@2 Kartenblöcke geladen (@3%)
|
||||
(here [<radius>]) | (<pos1> <pos2>)=(here [<Radius>]) | (<Pos1> <Pos2>)
|
||||
Load (or, if nonexistent, generate) map blocks contained in area pos1 to pos2 (<pos1> and <pos2> must be in parentheses)=Lade (oder, wenn nicht existent, generiere) Kartenblöcke im Gebiet zwischen Pos1 und Pos2 (<Pos1> und <Pos2> müssen in Klammern stehen)
|
||||
Started emerge of area ranging from @1 to @2.=Start des Ladevorgangs des Gebiets zwischen @1 und @2.
|
||||
Delete map blocks contained in area pos1 to pos2 (<pos1> and <pos2> must be in parentheses)=Kartenblöcke innerhalb des Gebiets zwischen Pos1 und Pos2 löschen (<Pos1> und <Pos2> müssen in Klammern stehen)
|
||||
Successfully cleared area ranging from @1 to @2.=Gebiet zwischen @1 und @2 erfolgreich geleert.
|
||||
Failed to clear one or more blocks in area.=Fehlgeschlagen: Ein oder mehrere Kartenblöcke im Gebiet konnten nicht geleert werden.
|
||||
Resets lighting in the area between pos1 and pos2 (<pos1> and <pos2> must be in parentheses)=Setzt das Licht im Gebiet zwischen Pos1 und Pos2 zurück (<Pos1> und <Pos2> müssen in Klammern stehen)
|
||||
Successfully reset light in the area ranging from @1 to @2.=Das Licht im Gebiet zwischen @1 und @2 wurde erfolgreich zurückgesetzt.
|
||||
Failed to load one or more blocks in area.=Fehlgeschlagen: Ein oder mehrere Kartenblöcke im Gebiet konnten nicht geladen werden.
|
||||
List mods installed on the server=Installierte Mods auf dem Server auflisten
|
||||
No mods installed.=Es sind keine Mods installiert.
|
||||
Cannot give an empty item.=Ein leerer Gegenstand kann nicht gegeben werden.
|
||||
Cannot give an unknown item.=Ein unbekannter Gegenstand kann nicht gegeben werden.
|
||||
Giving 'ignore' is not allowed.=„ignore“ darf nicht gegeben werden.
|
||||
@1 is not a known player.=@1 ist kein bekannter Spieler.
|
||||
@1 partially added to inventory.=@1 teilweise ins Inventar eingefügt.
|
||||
@1 could not be added to inventory.=@1 konnte nicht ins Inventar eingefügt werden.
|
||||
@1 added to inventory.=@1 zum Inventar hinzugefügt.
|
||||
@1 partially added to inventory of @2.=@1 teilweise ins Inventar von @2 eingefügt.
|
||||
@1 could not be added to inventory of @2.=@1 konnte nicht ins Inventar von @2 eingefügt werden.
|
||||
@1 added to inventory of @2.=@1 ins Inventar von @2 eingefügt.
|
||||
<name> <ItemString> [<count> [<wear>]]=<Name> <ItemString> [<Anzahl> [<Abnutzung>]]
|
||||
Give item to player=Gegenstand an Spieler geben
|
||||
Name and ItemString required.=Name und ItemString benötigt.
|
||||
<ItemString> [<count> [<wear>]]=<ItemString> [<Anzahl> [<Abnutzung>]]
|
||||
Give item to yourself=Gegenstand Ihnen selbst geben
|
||||
ItemString required.=ItemString benötigt.
|
||||
<EntityName> [<X>,<Y>,<Z>]=<EntityName> [<X>,<Y>,<Z>]
|
||||
Spawn entity at given (or your) position=Entity an angegebener (oder Ihrer eigenen) Position spawnen
|
||||
EntityName required.=EntityName benötigt.
|
||||
Unable to spawn entity, player is nil.=Entity konnte nicht gespawnt werden, Spieler ist nil.
|
||||
Cannot spawn an unknown entity.=Ein unbekanntes Entity kann nicht gespawnt werden.
|
||||
Invalid parameters (@1).=Ungültige Parameter (@1).
|
||||
@1 spawned.=@1 gespawnt.
|
||||
@1 failed to spawn.=@1 konnte nicht gespawnt werden.
|
||||
Destroy item in hand=Gegenstand in der Hand zerstören
|
||||
Unable to pulverize, no player.=Konnte nicht pulverisieren, kein Spieler.
|
||||
Unable to pulverize, no item in hand.=Konnte nicht pulverisieren, kein Gegenstand in der Hand.
|
||||
An item was pulverized.=Ein Gegenstand wurde pulverisiert.
|
||||
[<range>] [<seconds>] [<limit>]=[<Reichweite>] [<Sekunden>] [<Limit>]
|
||||
Check who last touched a node or a node near it within the time specified by <seconds>. Default: range @= 0, seconds @= 86400 @= 24h, limit @= 5. Set <seconds> to inf for no time limit=Überprüfen, wer als letztes einen Node oder einen Node in der Nähe innerhalb der in <Sekunden> angegebenen Zeitspanne angefasst hat. Standard: Reichweite @= 0, Sekunden @= 86400 @= 24h, Limit @= 5. <Sekunden> auf „inf“ setzen, um Zeitlimit zu deaktivieren.
|
||||
Rollback functions are disabled.=Rollback-Funktionen sind deaktiviert.
|
||||
That limit is too high!=Dieses Limit ist zu hoch!
|
||||
Checking @1 ...=Überprüfe @1 ...
|
||||
Nobody has touched the specified location in @1 seconds.=Niemand hat die angegebene Position seit @1 Sekunden angefasst.
|
||||
@1 @2 @3 -> @4 @5 seconds ago.=@1 @2 @3 -> @4 vor @5 Sekunden.
|
||||
Punch a node (range@=@1, seconds@=@2, limit@=@3).=Hauen Sie einen Node (Reichweite@=@1, Sekunden@=@2, Limit@=@3).
|
||||
(<name> [<seconds>]) | (:<actor> [<seconds>])=(<Name> [<Sekunden>]) | (:<Akteur> [<Sekunden>])
|
||||
Revert actions of a player. Default for <seconds> is 60. Set <seconds> to inf for no time limit=Aktionen eines Spielers zurückrollen. Standard für <Sekunden> ist 60. <Sekunden> auf „inf“ setzen, um Zeitlimit zu deaktivieren
|
||||
Invalid parameters. See /help rollback and /help rollback_check.=Ungültige Parameter. Siehe /help rollback und /help rollback_check.
|
||||
Reverting actions of player '@1' since @2 seconds.=Die Aktionen des Spielers „@1“ seit @2 Sekunden werden rückgängig gemacht.
|
||||
Reverting actions of @1 since @2 seconds.=Die Aktionen von @1 seit @2 Sekunden werden rückgängig gemacht.
|
||||
(log is too long to show)=(Protokoll ist zu lang für die Anzeige)
|
||||
Reverting actions succeeded.=Die Aktionen wurden erfolgreich rückgängig gemacht.
|
||||
Reverting actions FAILED.=FEHLGESCHLAGEN: Die Aktionen konnten nicht rückgängig gemacht werden.
|
||||
Show server status=Serverstatus anzeigen
|
||||
This command was disabled by a mod or game.=Dieser Befehl wurde von einer Mod oder einem Spiel deaktiviert.
|
||||
[<0..23>:<0..59> | <0..24000>]=[<0..23>:<0..59> | <0..24000>]
|
||||
Show or set time of day=Tageszeit anzeigen oder setzen
|
||||
Current time is @1:@2.=Es ist jetzt @1:@2 Uhr.
|
||||
You don't have permission to run this command (missing privilege: @1).=Sie haben nicht die Erlaubnis, diesen Befehl auszuführen (fehlendes Privileg: @1).
|
||||
Invalid time (must be between 0 and 24000).=Ungültige Zeit (muss zwischen 0 und 24000 liegen).
|
||||
Time of day changed.=Tageszeit geändert.
|
||||
Invalid hour (must be between 0 and 23 inclusive).=Ungültige Stunde (muss zwischen 0 und 23 inklusive liegen).
|
||||
Invalid minute (must be between 0 and 59 inclusive).=Ungültige Minute (muss zwischen 0 und 59 inklusive liegen).
|
||||
Show day count since world creation=Anzahl Tage seit der Erschaffung der Welt anzeigen
|
||||
Current day is @1.=Aktueller Tag ist @1.
|
||||
[<delay_in_seconds> | -1] [-r] [<message>]=[<Verzögerung_in_Sekunden> | -1] [-r] [<Nachricht>]
|
||||
Shutdown server (-1 cancels a delayed shutdown, -r allows players to reconnect)=Server herunterfahren (-1 bricht einen verzögerten Abschaltvorgang ab, -r erlaubt Spielern, sich wiederzuverbinden)
|
||||
Server shutting down (operator request).=Server wird heruntergefahren (Betreiberanfrage).
|
||||
Ban the IP of a player or show the ban list=Die IP eines Spielers verbannen oder die Bannliste anzeigen
|
||||
The ban list is empty.=Die Bannliste ist leer.
|
||||
Ban list: @1=Bannliste: @1
|
||||
You cannot ban players in singleplayer!=Im Einzelspielermodus können Sie keine Spieler verbannen!
|
||||
Player is not online.=Spieler ist nicht online.
|
||||
Failed to ban player.=Konnte Spieler nicht verbannen.
|
||||
Banned @1.=@1 verbannt.
|
||||
<name> | <IP_address>=<Name> | <IP_Adresse>
|
||||
Remove IP ban belonging to a player/IP=Einen IP-Bann auf einen Spieler zurücknehmen
|
||||
Failed to unban player/IP.=Konnte Bann auf Spieler/IP nicht zurücknehmen.
|
||||
Unbanned @1.=Bann auf @1 zurückgenommen.
|
||||
<name> [<reason>]=<Name> [<Grund>]
|
||||
Kick a player=Spieler hinauswerfen
|
||||
Failed to kick player @1.=Spieler @1 konnte nicht hinausgeworfen werden.
|
||||
Kicked @1.=@1 hinausgeworfen.
|
||||
[full | quick]=[full | quick]
|
||||
Clear all objects in world=Alle Objekte in der Welt löschen
|
||||
Invalid usage, see /help clearobjects.=Ungültige Verwendung, siehe /help clearobjects.
|
||||
Clearing all objects. This may take a long time. You may experience a timeout. (by @1)=Lösche alle Objekte. Dies kann eine lange Zeit dauern. Eine Netzwerkzeitüberschreitung könnte für Sie auftreten. (von @1)
|
||||
Cleared all objects.=Alle Objekte gelöscht.
|
||||
<name> <message>=<Name> <Nachricht>
|
||||
Send a direct message to a player=Eine Direktnachricht an einen Spieler senden
|
||||
Invalid usage, see /help msg.=Ungültige Verwendung, siehe /help msg.
|
||||
The player @1 is not online.=Der Spieler @1 ist nicht online.
|
||||
DM from @1: @2=DN von @1: @2
|
||||
Message sent.=Nachricht gesendet.
|
||||
Get the last login time of a player or yourself=Den letzten Loginzeitpunkt eines Spielers oder Ihren eigenen anfragen
|
||||
@1's last login time was @2.=Letzter Loginzeitpunkt von @1 war @2.
|
||||
@1's last login time is unknown.=Letzter Loginzeitpunkt von @1 ist unbekannt.
|
||||
Clear the inventory of yourself or another player=Das Inventar von Ihnen oder einem anderen Spieler leeren
|
||||
You don't have permission to clear another player's inventory (missing privilege: @1).=Sie haben nicht die Erlaubnis, das Inventar eines anderen Spielers zu leeren (fehlendes Privileg: @1).
|
||||
@1 cleared your inventory.=@1 hat Ihr Inventar geleert.
|
||||
Cleared @1's inventory.=Inventar von @1 geleert.
|
||||
Player must be online to clear inventory!=Spieler muss online sein, um das Inventar leeren zu können!
|
||||
Players can't be killed, damage has been disabled.=Spieler können nicht getötet werden, Schaden ist deaktiviert.
|
||||
Player @1 is not online.=Spieler @1 ist nicht online.
|
||||
You are already dead.=Sie sind schon tot.
|
||||
@1 is already dead.=@1 ist bereits tot.
|
||||
@1 has been killed.=@1 wurde getötet.
|
||||
Kill player or yourself=Einen Spieler oder Sie selbst töten
|
||||
Invalid parameters (see /help @1).=Ungültige Parameter (siehe „/help @1“).
|
||||
Too many arguments, try using just /help <command>=Zu viele Argumente. Probieren Sie es mit „/help <Befehl>“
|
||||
Available commands: @1=Verfügbare Befehle: @1
|
||||
Use '/help <cmd>' to get more information, or '/help all' to list everything.=„/help <Befehl>“ benutzen, um mehr Informationen zu erhalten, oder „/help all“, um alles aufzulisten.
|
||||
Available commands:=Verfügbare Befehle:
|
||||
Command not available: @1=Befehl nicht verfügbar: @1
|
||||
[all | privs | <cmd>] [-t]=[all | privs | <Befehl>] [-t]
|
||||
Get help for commands or list privileges (-t: output in chat)=Hilfe für Befehle erhalten oder Privilegien auflisten (-t: Ausgabe im Chat)
|
||||
Command=Befehl
|
||||
Parameters=Parameter
|
||||
For more information, click on any entry in the list.=Für mehr Informationen klicken Sie auf einen beliebigen Eintrag in der Liste.
|
||||
Double-click to copy the entry to the chat history.=Doppelklicken, um den Eintrag in die Chathistorie einzufügen.
|
||||
Command: @1 @2=Befehl: @1 @2
|
||||
Available commands: (see also: /help <cmd>)=Verfügbare Befehle: (siehe auch: /help <Befehl>)
|
||||
Close=Schließen
|
||||
Privilege=Privileg
|
||||
Description=Beschreibung
|
||||
Available privileges:=Verfügbare Privilegien:
|
||||
print [<filter>] | dump [<filter>] | save [<format> [<filter>]] | reset=print [<Filter>] | dump [<Filter>] | save [<Format> [<Filter>]]
|
||||
Handle the profiler and profiling data=Den Profiler und Profilingdaten verwalten
|
||||
Statistics written to action log.=Statistiken zum Aktionsprotokoll geschrieben.
|
||||
Statistics were reset.=Statistiken wurden zurückgesetzt.
|
||||
Usage: @1=Verwendung: @1
|
||||
Format can be one of txt, csv, lua, json, json_pretty (structures may be subject to change).=Format kann entweder „txt“, „csv“, „lua“, „json“ oder „json_pretty“ sein (die Struktur kann sich in Zukunft ändern).
|
||||
@1 joined the game.=@1 ist dem Spiel beigetreten.
|
||||
@1 left the game.=@1 hat das Spiel verlassen.
|
||||
@1 left the game (timed out).=@1 hat das Spiel verlassen (Netzwerkzeitüberschreitung).
|
||||
(no description)=(keine Beschreibung)
|
||||
Can interact with things and modify the world=Kann mit Dingen interagieren und die Welt verändern
|
||||
Can speak in chat=Kann im Chat sprechen
|
||||
Can modify basic privileges (@1)=Kann grundlegende Privilegien anpassen (@1)
|
||||
Can modify privileges=Kann Privilegien anpassen
|
||||
Can teleport self=Kann sich selbst teleportieren
|
||||
Can teleport other players=Kann andere Spieler teleportieren
|
||||
Can set the time of day using /time=Kann die Tageszeit mit /time setzen
|
||||
Can do server maintenance stuff=Kann Serverwartungsdinge machen
|
||||
Can bypass node protection in the world=Kann den Schutz auf Blöcken in der Welt umgehen
|
||||
Can ban and unban players=Kann Spieler verbannen und entbannen
|
||||
Can kick players=Kann Spieler hinauswerfen
|
||||
Can use /give and /giveme=Kann /give und /giveme benutzen
|
||||
Can use /setpassword and /clearpassword=Kann /setpassword und /clearpassword benutzen
|
||||
Can use fly mode=Kann den Flugmodus benutzen
|
||||
Can use fast mode=Kann den Schnellmodus benutzen
|
||||
Can fly through solid nodes using noclip mode=Kann durch feste Blöcke mit dem Geistmodus fliegen
|
||||
Can use the rollback functionality=Kann die Rollback-Funktionalität benutzen
|
||||
Can enable wireframe=Kann Drahtmodell aktivieren
|
||||
Unknown Item=Unbekannter Gegenstand
|
||||
Air=Luft
|
||||
Ignore=Ignorieren
|
||||
You can't place 'ignore' nodes!=Sie können keine „ignore“-Blöcke platzieren!
|
||||
Values below show absolute/relative times spend per server step by the instrumented function.=Die unten angegebenen Werte zeigen absolute/relative Zeitspannen, die je Server-Step von der instrumentierten Funktion in Anspruch genommen wurden.
|
||||
A total of @1 sample(s) were taken.=Es wurden insgesamt @1 Datenpunkt(e) aufgezeichnet.
|
||||
The output is limited to '@1'.=Die Ausgabe ist beschränkt auf „@1“.
|
||||
Saving of profile failed: @1=Speichern des Profils fehlgeschlagen: @1
|
||||
Profile saved to @1=Profil abgespeichert nach @1
|
||||
259
builtin/locale/__builtin.it.tr
Normal file
259
builtin/locale/__builtin.it.tr
Normal file
@@ -0,0 +1,259 @@
|
||||
# textdomain: __builtin
|
||||
Empty command.=Comando vuoto.
|
||||
Invalid command: @1=Comando non valido: @1
|
||||
Invalid command usage.=Utilizzo del comando non valido.
|
||||
(@1 s)=
|
||||
Command execution took @1 s=
|
||||
You don't have permission to run this command (missing privileges: @1).=Non hai il permesso di eseguire questo comando (privilegi mancanti: @1).
|
||||
Unable to get position of player @1.=Impossibile ottenere la posizione del giocatore @1.
|
||||
Incorrect area format. Expected: (x1,y1,z1) (x2,y2,z2)=Formato dell'area non corretto. Richiesto: (x1,y1,z1) (x2,y2,z2)
|
||||
<action>=<azione>
|
||||
Show chat action (e.g., '/me orders a pizza' displays '<player name> orders a pizza')=Mostra un'azione in chat (es. `/me ordina una pizza` mostra `<nome giocatore> ordina una pizza`)
|
||||
Show the name of the server owner=Mostra il nome del proprietario del server
|
||||
The administrator of this server is @1.=L'amministratore di questo server è @1.
|
||||
There's no administrator named in the config file.=Non c'è nessun amministratore nel file di configurazione.
|
||||
@1 does not have any privileges.=
|
||||
Privileges of @1: @2=Privilegi di @1: @2
|
||||
[<name>]=[<nome>]
|
||||
Show privileges of yourself or another player=Mostra i privilegi propri o di un altro giocatore
|
||||
Player @1 does not exist.=Il giocatore @1 non esiste.
|
||||
<privilege>=<privilegio>
|
||||
Return list of all online players with privilege=Ritorna una lista di tutti i giocatori connessi col tale privilegio
|
||||
Invalid parameters (see /help haspriv).=Parametri non validi (vedi /help haspriv).
|
||||
Unknown privilege!=Privilegio sconosciuto!
|
||||
No online player has the "@1" privilege.=
|
||||
Players online with the "@1" privilege: @2=Giocatori connessi con il privilegio "@1": @2
|
||||
Your privileges are insufficient.=I tuoi privilegi sono insufficienti.
|
||||
Your privileges are insufficient. '@1' only allows you to grant: @2=
|
||||
Unknown privilege: @1=Privilegio sconosciuto: @1
|
||||
@1 granted you privileges: @2=@1 ti ha assegnato i seguenti privilegi: @2
|
||||
<name> (<privilege> [, <privilege2> [<...>]] | all)=
|
||||
Give privileges to player=Dà privilegi al giocatore
|
||||
Invalid parameters (see /help grant).=Parametri non validi (vedi /help grant).
|
||||
<privilege> [, <privilege2> [<...>]] | all=
|
||||
Grant privileges to yourself=Assegna dei privilegi a te stessǝ
|
||||
Invalid parameters (see /help grantme).=Parametri non validi (vedi /help grantme).
|
||||
Your privileges are insufficient. '@1' only allows you to revoke: @2=
|
||||
Note: Cannot revoke in singleplayer: @1=
|
||||
Note: Cannot revoke from admin: @1=
|
||||
No privileges were revoked.=
|
||||
@1 revoked privileges from you: @2=@1 ti ha revocato i seguenti privilegi: @2
|
||||
Remove privileges from player=Rimuove privilegi dal giocatore
|
||||
Invalid parameters (see /help revoke).=Parametri non validi (vedi /help revoke).
|
||||
Revoke privileges from yourself=Revoca privilegi a te stessǝ
|
||||
Invalid parameters (see /help revokeme).=Parametri non validi (vedi /help revokeme).
|
||||
<name> <password>=<nome> <password>
|
||||
Set player's password=Imposta la password del giocatore
|
||||
Name field required.=Campo "nome" richiesto.
|
||||
Your password was cleared by @1.=La tua password è stata resettata da @1.
|
||||
Password of player "@1" cleared.=Password del giocatore "@1" resettata.
|
||||
Your password was set by @1.=La tua password è stata impostata da @1.
|
||||
Password of player "@1" set.=Password del giocatore "@1" impostata.
|
||||
<name>=<nome>
|
||||
Set empty password for a player=Imposta una password vuota a un giocatore
|
||||
Reload authentication data=Ricarica i dati d'autenticazione
|
||||
Done.=Fatto.
|
||||
Failed.=Errore.
|
||||
Remove a player's data=Rimuove i dati di un giocatore
|
||||
Player "@1" removed.=Giocatore "@1" rimosso.
|
||||
No such player "@1" to remove.=Non è presente nessun giocatore "@1" da rimuovere.
|
||||
Player "@1" is connected, cannot remove.=Il giocatore "@1" è connesso, non può essere rimosso.
|
||||
Unhandled remove_player return code @1.=Codice ritornato da remove_player non gestito (@1).
|
||||
Cannot teleport out of map bounds!=Non ci si può teletrasportare fuori dai limiti della mappa!
|
||||
Cannot get player with name @1.=Impossibile trovare il giocatore chiamato @1.
|
||||
Cannot teleport, @1 is attached to an object!=Impossibile teletrasportare, @1 è attaccato a un oggetto!
|
||||
Teleporting @1 to @2.=Teletrasportando @1 da @2.
|
||||
One does not teleport to oneself.=Non ci si può teletrasportare su se stessi.
|
||||
Cannot get teleportee with name @1.=Impossibile trovare il giocatore chiamato @1 per il teletrasporto
|
||||
Cannot get target player with name @1.=Impossibile trovare il giocatore chiamato @1 per il teletrasporto
|
||||
Teleporting @1 to @2 at @3.=Teletrasportando @1 da @2 a @3
|
||||
<X>,<Y>,<Z> | <to_name> | <name> <X>,<Y>,<Z> | <name> <to_name>=<X>,<Y>,<Z> | <da_nome> | <nome> <X>,<Y>,<Z> | <nome> <da_nome>
|
||||
Teleport to position or player=Teletrasporta a una posizione o da un giocatore
|
||||
You don't have permission to teleport other players (missing privilege: @1).=Non hai il permesso di teletrasportare altri giocatori (privilegio mancante: @1).
|
||||
([-n] <name> <value>) | <name>=([-n] <nome> <valore>) | <nome>
|
||||
Set or read server configuration setting=Imposta o ottieni le configurazioni del server
|
||||
Failed. Cannot modify secure settings. Edit the settings file manually.=
|
||||
Failed. Use '/set -n <name> <value>' to create a new setting.=Errore. Usa 'set -n <nome> <valore>' per creare una nuova impostazione
|
||||
@1 @= @2=@1 @= @2
|
||||
<not set>=<non impostato>
|
||||
Invalid parameters (see /help set).=Parametri non validi (vedi /help set).
|
||||
Finished emerging @1 blocks in @2ms.=Finito di emergere @1 blocchi in @2ms
|
||||
emergeblocks update: @1/@2 blocks emerged (@3%)=aggiornamento emergeblocks: @1/@2 blocchi emersi (@3%)
|
||||
(here [<radius>]) | (<pos1> <pos2>)=(here [<raggio>]) | (<pos1> <pos2>)
|
||||
Load (or, if nonexistent, generate) map blocks contained in area pos1 to pos2 (<pos1> and <pos2> must be in parentheses)=Carica (o, se non esiste, genera) blocchi mappa contenuti nell'area tra pos1 e pos2 (<pos1> e <pos2> vanno tra parentesi)
|
||||
Started emerge of area ranging from @1 to @2.=Iniziata emersione dell'area tra @1 e @2.
|
||||
Delete map blocks contained in area pos1 to pos2 (<pos1> and <pos2> must be in parentheses)=Cancella i blocchi mappa contenuti nell'area tra pos1 e pos2 (<pos1> e <pos2> vanno tra parentesi)
|
||||
Successfully cleared area ranging from @1 to @2.=Area tra @1 e @2 ripulita con successo.
|
||||
Failed to clear one or more blocks in area.=Errore nel ripulire uno o più blocchi mappa nell'area
|
||||
Resets lighting in the area between pos1 and pos2 (<pos1> and <pos2> must be in parentheses)=Reimposta l'illuminazione nell'area tra pos1 e po2 (<pos1> e <pos2> vanno tra parentesi)
|
||||
Successfully reset light in the area ranging from @1 to @2.=Luce nell'area tra @1 e @2 reimpostata con successo.
|
||||
Failed to load one or more blocks in area.=Errore nel caricare uno o più blocchi mappa nell'area.
|
||||
List mods installed on the server=Elenca le mod installate nel server
|
||||
No mods installed.=
|
||||
Cannot give an empty item.=Impossibile dare un oggetto vuoto.
|
||||
Cannot give an unknown item.=Impossibile dare un oggetto sconosciuto.
|
||||
Giving 'ignore' is not allowed.=Non è permesso dare 'ignore'.
|
||||
@1 is not a known player.=@1 non è un giocatore conosciuto.
|
||||
@1 partially added to inventory.=@1 parzialmente aggiunto all'inventario.
|
||||
@1 could not be added to inventory.=@1 non può essere aggiunto all'inventario.
|
||||
@1 added to inventory.=@1 aggiunto all'inventario.
|
||||
@1 partially added to inventory of @2.=@1 parzialmente aggiunto all'inventario di @2.
|
||||
@1 could not be added to inventory of @2.=Non è stato possibile aggiungere @1 all'inventario di @2.
|
||||
@1 added to inventory of @2.=@1 aggiunto all'inventario di @2.
|
||||
<name> <ItemString> [<count> [<wear>]]=<nome> <NomeOggetto> [<quantità> [<usura>]]
|
||||
Give item to player=Dà oggetti ai giocatori
|
||||
Name and ItemString required.=Richiesti nome e NomeOggetto.
|
||||
<ItemString> [<count> [<wear>]]=<NomeOggetto> [<quantità> [<usura>]]
|
||||
Give item to yourself=Dà oggetti a te stessǝ
|
||||
ItemString required.=Richiesto NomeOggetto.
|
||||
<EntityName> [<X>,<Y>,<Z>]=<NomeEntità> [<X>,<Y>,<Z>]
|
||||
Spawn entity at given (or your) position=Genera un'entità alla data coordinata (o la tua)
|
||||
EntityName required.=Richiesto NomeEntità
|
||||
Unable to spawn entity, player is nil.=Impossibile generare l'entità, il giocatore è nil.
|
||||
Cannot spawn an unknown entity.=Impossibile generare un'entità sconosciuta.
|
||||
Invalid parameters (@1).=Parametri non validi (@1).
|
||||
@1 spawned.=Generata entità @1.
|
||||
@1 failed to spawn.=Errore nel generare @1
|
||||
Destroy item in hand=Distrugge l'oggetto in mano
|
||||
Unable to pulverize, no player.=Impossibile polverizzare, nessun giocatore.
|
||||
Unable to pulverize, no item in hand.=Impossibile polverizzare, nessun oggetto in mano.
|
||||
An item was pulverized.=Un oggetto è stato polverizzato.
|
||||
[<range>] [<seconds>] [<limit>]=[<raggio>] [<secondi>] [<limite>]
|
||||
Check who last touched a node or a node near it within the time specified by <seconds>. Default: range @= 0, seconds @= 86400 @= 24h, limit @= 5. Set <seconds> to inf for no time limit=Controlla chi è l'ultimo giocatore che ha toccato un nodo o un nodo nelle sue vicinanze, negli ultimi secondi indicati. Di base: raggio @= 0, secondi @= 86400 @= 24h, limite @= 5.
|
||||
Rollback functions are disabled.=Le funzioni di rollback sono disabilitate.
|
||||
That limit is too high!=Il limite è troppo alto!
|
||||
Checking @1 ...=Controllando @1 ...
|
||||
Nobody has touched the specified location in @1 seconds.=Nessuno ha toccato il punto specificato negli ultimi @1 secondi.
|
||||
@1 @2 @3 -> @4 @5 seconds ago.=@1 @2 @3 -> @4 @5 secondi fa.
|
||||
Punch a node (range@=@1, seconds@=@2, limit@=@3).=Colpisce un nodo (raggio@=@1, secondi@=@2, limite@=@3)
|
||||
(<name> [<seconds>]) | (:<actor> [<seconds>])=(<nome> [<secondi>]) | (:<attore> [<secondi>])
|
||||
Revert actions of a player. Default for <seconds> is 60. Set <seconds> to inf for no time limit=Riavvolge le azioni di un giocatore. Di base, <secondi> è 60. Imposta <secondi> a inf per nessun limite di tempo
|
||||
Invalid parameters. See /help rollback and /help rollback_check.=Parametri non validi. Vedi /help rollback e /help rollback_check.
|
||||
Reverting actions of player '@1' since @2 seconds.=Riavvolge le azioni del giocatore '@1' avvenute negli ultimi @2 secondi.
|
||||
Reverting actions of @1 since @2 seconds.=Riavvolge le azioni di @1 avvenute negli ultimi @2 secondi.
|
||||
(log is too long to show)=(il log è troppo lungo per essere mostrato)
|
||||
Reverting actions succeeded.=Riavvolgimento azioni avvenuto con successo.
|
||||
Reverting actions FAILED.=Errore nel riavvolgere le azioni.
|
||||
Show server status=Mostra lo stato del server
|
||||
This command was disabled by a mod or game.=Questo comando è stato disabilitato da una mod o dal gioco.
|
||||
[<0..23>:<0..59> | <0..24000>]=[<0..23>:<0..59> | <0..24000>]
|
||||
Show or set time of day=Mostra o imposta l'orario della giornata
|
||||
Current time is @1:@2.=Orario corrente: @1:@2.
|
||||
You don't have permission to run this command (missing privilege: @1).=Non hai il permesso di eseguire questo comando (privilegio mancante: @1)
|
||||
Invalid time (must be between 0 and 24000).=
|
||||
Time of day changed.=Orario della giornata cambiato.
|
||||
Invalid hour (must be between 0 and 23 inclusive).=Ora non valida (deve essere tra 0 e 23 inclusi)
|
||||
Invalid minute (must be between 0 and 59 inclusive).=Minuto non valido (deve essere tra 0 e 59 inclusi)
|
||||
Show day count since world creation=Mostra il conteggio dei giorni da quando il mondo è stato creato
|
||||
Current day is @1.=Giorno attuale: @1.
|
||||
[<delay_in_seconds> | -1] [-r] [<message>]=
|
||||
Shutdown server (-1 cancels a delayed shutdown, -r allows players to reconnect)=
|
||||
Server shutting down (operator request).=Arresto del server in corso (per richiesta dell'operatore)
|
||||
Ban the IP of a player or show the ban list=Bandisce l'IP del giocatore o mostra la lista di quelli banditi
|
||||
The ban list is empty.=La lista banditi è vuota.
|
||||
Ban list: @1=Lista banditi: @1
|
||||
You cannot ban players in singleplayer!=
|
||||
Player is not online.=Il giocatore non è connesso.
|
||||
Failed to ban player.=Errore nel bandire il giocatore.
|
||||
Banned @1.=@1 banditǝ.
|
||||
<name> | <IP_address>=<nome> | <indirizzo_IP>
|
||||
Remove IP ban belonging to a player/IP=Perdona l'IP appartenente a un giocatore/IP
|
||||
Failed to unban player/IP.=Errore nel perdonare il giocatore/IP
|
||||
Unbanned @1.=@1 perdonatǝ
|
||||
<name> [<reason>]=<nome> [<ragione>]
|
||||
Kick a player=Caccia un giocatore
|
||||
Failed to kick player @1.=Errore nel cacciare il giocatore @1.
|
||||
Kicked @1.=@1 cacciatǝ.
|
||||
[full | quick]=[full | quick]
|
||||
Clear all objects in world=Elimina tutti gli oggetti/entità nel mondo
|
||||
Invalid usage, see /help clearobjects.=Uso incorretto, vedi /help clearobjects.
|
||||
Clearing all objects. This may take a long time. You may experience a timeout. (by @1)=Eliminando tutti gli oggetti/entità. Questo potrebbe richiedere molto tempo e farti eventualmente crashare. (di @1)
|
||||
Cleared all objects.=Tutti gli oggetti sono stati eliminati.
|
||||
<name> <message>=<nome> <messaggio>
|
||||
Send a direct message to a player=Invia un messaggio privato al giocatore
|
||||
Invalid usage, see /help msg.=Uso incorretto, vedi /help msg
|
||||
The player @1 is not online.=Il giocatore @1 non è connesso.
|
||||
DM from @1: @2=Messaggio privato da @1: @2
|
||||
Message sent.=Messaggio inviato.
|
||||
Get the last login time of a player or yourself=Ritorna l'ultimo accesso di un giocatore o di te stessǝ
|
||||
@1's last login time was @2.=L'ultimo accesso di @1 è avvenuto il @2
|
||||
@1's last login time is unknown.=L'ultimo accesso di @1 non è conosciuto
|
||||
Clear the inventory of yourself or another player=Svuota l'inventario tuo o di un altro giocatore
|
||||
You don't have permission to clear another player's inventory (missing privilege: @1).=Non hai il permesso di svuotare l'inventario di un altro giocatore (privilegio mancante: @1).
|
||||
@1 cleared your inventory.=@1 ha svuotato il tuo inventario.
|
||||
Cleared @1's inventory.=L'inventario di @1 è stato svuotato.
|
||||
Player must be online to clear inventory!=Il giocatore deve essere connesso per svuotarne l'inventario!
|
||||
Players can't be killed, damage has been disabled.=I giocatori non possono essere uccisi, il danno è disabilitato.
|
||||
Player @1 is not online.=Il giocatore @1 non è connesso.
|
||||
You are already dead.=Sei già mortǝ.
|
||||
@1 is already dead.=@1 è già mortǝ.
|
||||
@1 has been killed.=@1 è stato uccisǝ.
|
||||
Kill player or yourself=Uccide un giocatore o te stessǝ
|
||||
Invalid parameters (see /help @1).=
|
||||
Too many arguments, try using just /help <command>=
|
||||
Available commands: @1=Comandi disponibili: @1
|
||||
Use '/help <cmd>' to get more information, or '/help all' to list everything.=Usa '/help <comando>' per ottenere più informazioni, o '/help all' per elencare tutti i comandi.
|
||||
Available commands:=Comandi disponibili:
|
||||
Command not available: @1=Comando non disponibile: @1
|
||||
[all | privs | <cmd>] [-t]=
|
||||
Get help for commands or list privileges (-t: output in chat)=
|
||||
Command=Comando
|
||||
Parameters=Parametri
|
||||
For more information, click on any entry in the list.=Per più informazioni, clicca su una qualsiasi voce dell'elenco.
|
||||
Double-click to copy the entry to the chat history.=Doppio click per copiare la voce nella cronologia della chat.
|
||||
Command: @1 @2=Comando: @1 @2
|
||||
Available commands: (see also: /help <cmd>)=Comandi disponibili: (vedi anche /help <comando>)
|
||||
Close=Chiudi
|
||||
Privilege=Privilegio
|
||||
Description=Descrizione
|
||||
Available privileges:=Privilegi disponibili:
|
||||
print [<filter>] | dump [<filter>] | save [<format> [<filter>]] | reset=print [<filtro>] | dump [<filtro>] | save [<formato> [<filtro>]] | reset
|
||||
Handle the profiler and profiling data=Gestisce il profiler e i dati da esso elaborati
|
||||
Statistics written to action log.=Statistiche scritte nel log delle azioni.
|
||||
Statistics were reset.=Le statistiche sono state resettate.
|
||||
Usage: @1=Utilizzo: @1
|
||||
Format can be one of txt, csv, lua, json, json_pretty (structures may be subject to change).=I formati supportati sono txt, csv, lua, json e json_pretty (le strutture potrebbero essere soggetti a cambiamenti).
|
||||
@1 joined the game.=
|
||||
@1 left the game.=
|
||||
@1 left the game (timed out).=
|
||||
(no description)=(nessuna descrizione)
|
||||
Can interact with things and modify the world=Si può interagire con le cose e modificare il mondo
|
||||
Can speak in chat=Si può parlare in chat
|
||||
Can modify basic privileges (@1)=
|
||||
Can modify privileges=Si possono modificare i privilegi
|
||||
Can teleport self=Si può teletrasportare se stessз
|
||||
Can teleport other players=Si possono teletrasportare gli altri giocatori
|
||||
Can set the time of day using /time=Si può impostate l'orario della giornata tramite /time
|
||||
Can do server maintenance stuff=Si possono eseguire operazioni di manutenzione del server
|
||||
Can bypass node protection in the world=Si può aggirare la protezione dei nodi nel mondo
|
||||
Can ban and unban players=Si possono bandire e perdonare i giocatori
|
||||
Can kick players=Si possono cacciare i giocatori
|
||||
Can use /give and /giveme=Si possono usare /give e /give me
|
||||
Can use /setpassword and /clearpassword=Si possono usare /setpassword e /clearpassword
|
||||
Can use fly mode=Si può usare la modalità volo
|
||||
Can use fast mode=Si può usare la modalità rapida
|
||||
Can fly through solid nodes using noclip mode=Si può volare attraverso i nodi solidi con la modalità incorporea
|
||||
Can use the rollback functionality=Si può usare la funzione di rollback
|
||||
Can enable wireframe=
|
||||
Unknown Item=Oggetto sconosciuto
|
||||
Air=Aria
|
||||
Ignore=Ignora
|
||||
You can't place 'ignore' nodes!=Non puoi piazzare nodi 'ignore'!
|
||||
Values below show absolute/relative times spend per server step by the instrumented function.=
|
||||
A total of @1 sample(s) were taken.=
|
||||
The output is limited to '@1'.=
|
||||
Saving of profile failed: @1=
|
||||
Profile saved to @1=
|
||||
|
||||
|
||||
##### not used anymore #####
|
||||
|
||||
Invalid time.=Orario non valido.
|
||||
[all | privs | <cmd>]=[all | privs | <comando>]
|
||||
Get help for commands or list privileges=Richiama la finestra d'aiuto dei comandi o dei privilegi
|
||||
Allows enabling various debug options that may affect gameplay=Permette di abilitare varie opzioni di debug che potrebbero influenzare l'esperienza di gioco
|
||||
[<delay_in_seconds> | -1] [reconnect] [<message>]=[<ritardo_in_secondi> | -1] [reconnect] [<messaggio>]
|
||||
Shutdown server (-1 cancels a delayed shutdown)=Arresta il server (-1 annulla un arresto programmato)
|
||||
<name> (<privilege> | all)=<nome> (<privilegio> | all)
|
||||
<privilege> | all=<privilegio> | all
|
||||
Can modify 'shout' and 'interact' privileges=Si possono modificare i privilegi 'shout' e 'interact'
|
||||
246
builtin/locale/template.txt
Normal file
246
builtin/locale/template.txt
Normal file
@@ -0,0 +1,246 @@
|
||||
# textdomain: __builtin
|
||||
Empty command.=
|
||||
Invalid command: @1=
|
||||
Invalid command usage.=
|
||||
(@1 s)=
|
||||
Command execution took @1 s=
|
||||
You don't have permission to run this command (missing privileges: @1).=
|
||||
Unable to get position of player @1.=
|
||||
Incorrect area format. Expected: (x1,y1,z1) (x2,y2,z2)=
|
||||
<action>=
|
||||
Show chat action (e.g., '/me orders a pizza' displays '<player name> orders a pizza')=
|
||||
Show the name of the server owner=
|
||||
The administrator of this server is @1.=
|
||||
There's no administrator named in the config file.=
|
||||
@1 does not have any privileges.=
|
||||
Privileges of @1: @2=
|
||||
[<name>]=
|
||||
Show privileges of yourself or another player=
|
||||
Player @1 does not exist.=
|
||||
<privilege>=
|
||||
Return list of all online players with privilege=
|
||||
Invalid parameters (see /help haspriv).=
|
||||
Unknown privilege!=
|
||||
No online player has the "@1" privilege.=
|
||||
Players online with the "@1" privilege: @2=
|
||||
Your privileges are insufficient.=
|
||||
Your privileges are insufficient. '@1' only allows you to grant: @2=
|
||||
Unknown privilege: @1=
|
||||
@1 granted you privileges: @2=
|
||||
<name> (<privilege> [, <privilege2> [<...>]] | all)=
|
||||
Give privileges to player=
|
||||
Invalid parameters (see /help grant).=
|
||||
<privilege> [, <privilege2> [<...>]] | all=
|
||||
Grant privileges to yourself=
|
||||
Invalid parameters (see /help grantme).=
|
||||
Your privileges are insufficient. '@1' only allows you to revoke: @2=
|
||||
Note: Cannot revoke in singleplayer: @1=
|
||||
Note: Cannot revoke from admin: @1=
|
||||
No privileges were revoked.=
|
||||
@1 revoked privileges from you: @2=
|
||||
Remove privileges from player=
|
||||
Invalid parameters (see /help revoke).=
|
||||
Revoke privileges from yourself=
|
||||
Invalid parameters (see /help revokeme).=
|
||||
<name> <password>=
|
||||
Set player's password=
|
||||
Name field required.=
|
||||
Your password was cleared by @1.=
|
||||
Password of player "@1" cleared.=
|
||||
Your password was set by @1.=
|
||||
Password of player "@1" set.=
|
||||
<name>=
|
||||
Set empty password for a player=
|
||||
Reload authentication data=
|
||||
Done.=
|
||||
Failed.=
|
||||
Remove a player's data=
|
||||
Player "@1" removed.=
|
||||
No such player "@1" to remove.=
|
||||
Player "@1" is connected, cannot remove.=
|
||||
Unhandled remove_player return code @1.=
|
||||
Cannot teleport out of map bounds!=
|
||||
Cannot get player with name @1.=
|
||||
Cannot teleport, @1 is attached to an object!=
|
||||
Teleporting @1 to @2.=
|
||||
One does not teleport to oneself.=
|
||||
Cannot get teleportee with name @1.=
|
||||
Cannot get target player with name @1.=
|
||||
Teleporting @1 to @2 at @3.=
|
||||
<X>,<Y>,<Z> | <to_name> | <name> <X>,<Y>,<Z> | <name> <to_name>=
|
||||
Teleport to position or player=
|
||||
You don't have permission to teleport other players (missing privilege: @1).=
|
||||
([-n] <name> <value>) | <name>=
|
||||
Set or read server configuration setting=
|
||||
Failed. Cannot modify secure settings. Edit the settings file manually.=
|
||||
Failed. Use '/set -n <name> <value>' to create a new setting.=
|
||||
@1 @= @2=
|
||||
<not set>=
|
||||
Invalid parameters (see /help set).=
|
||||
Finished emerging @1 blocks in @2ms.=
|
||||
emergeblocks update: @1/@2 blocks emerged (@3%)=
|
||||
(here [<radius>]) | (<pos1> <pos2>)=
|
||||
Load (or, if nonexistent, generate) map blocks contained in area pos1 to pos2 (<pos1> and <pos2> must be in parentheses)=
|
||||
Started emerge of area ranging from @1 to @2.=
|
||||
Delete map blocks contained in area pos1 to pos2 (<pos1> and <pos2> must be in parentheses)=
|
||||
Successfully cleared area ranging from @1 to @2.=
|
||||
Failed to clear one or more blocks in area.=
|
||||
Resets lighting in the area between pos1 and pos2 (<pos1> and <pos2> must be in parentheses)=
|
||||
Successfully reset light in the area ranging from @1 to @2.=
|
||||
Failed to load one or more blocks in area.=
|
||||
List mods installed on the server=
|
||||
No mods installed.=
|
||||
Cannot give an empty item.=
|
||||
Cannot give an unknown item.=
|
||||
Giving 'ignore' is not allowed.=
|
||||
@1 is not a known player.=
|
||||
@1 partially added to inventory.=
|
||||
@1 could not be added to inventory.=
|
||||
@1 added to inventory.=
|
||||
@1 partially added to inventory of @2.=
|
||||
@1 could not be added to inventory of @2.=
|
||||
@1 added to inventory of @2.=
|
||||
<name> <ItemString> [<count> [<wear>]]=
|
||||
Give item to player=
|
||||
Name and ItemString required.=
|
||||
<ItemString> [<count> [<wear>]]=
|
||||
Give item to yourself=
|
||||
ItemString required.=
|
||||
<EntityName> [<X>,<Y>,<Z>]=
|
||||
Spawn entity at given (or your) position=
|
||||
EntityName required.=
|
||||
Unable to spawn entity, player is nil.=
|
||||
Cannot spawn an unknown entity.=
|
||||
Invalid parameters (@1).=
|
||||
@1 spawned.=
|
||||
@1 failed to spawn.=
|
||||
Destroy item in hand=
|
||||
Unable to pulverize, no player.=
|
||||
Unable to pulverize, no item in hand.=
|
||||
An item was pulverized.=
|
||||
[<range>] [<seconds>] [<limit>]=
|
||||
Check who last touched a node or a node near it within the time specified by <seconds>. Default: range @= 0, seconds @= 86400 @= 24h, limit @= 5. Set <seconds> to inf for no time limit=
|
||||
Rollback functions are disabled.=
|
||||
That limit is too high!=
|
||||
Checking @1 ...=
|
||||
Nobody has touched the specified location in @1 seconds.=
|
||||
@1 @2 @3 -> @4 @5 seconds ago.=
|
||||
Punch a node (range@=@1, seconds@=@2, limit@=@3).=
|
||||
(<name> [<seconds>]) | (:<actor> [<seconds>])=
|
||||
Revert actions of a player. Default for <seconds> is 60. Set <seconds> to inf for no time limit=
|
||||
Invalid parameters. See /help rollback and /help rollback_check.=
|
||||
Reverting actions of player '@1' since @2 seconds.=
|
||||
Reverting actions of @1 since @2 seconds.=
|
||||
(log is too long to show)=
|
||||
Reverting actions succeeded.=
|
||||
Reverting actions FAILED.=
|
||||
Show server status=
|
||||
This command was disabled by a mod or game.=
|
||||
[<0..23>:<0..59> | <0..24000>]=
|
||||
Show or set time of day=
|
||||
Current time is @1:@2.=
|
||||
You don't have permission to run this command (missing privilege: @1).=
|
||||
Invalid time (must be between 0 and 24000).=
|
||||
Time of day changed.=
|
||||
Invalid hour (must be between 0 and 23 inclusive).=
|
||||
Invalid minute (must be between 0 and 59 inclusive).=
|
||||
Show day count since world creation=
|
||||
Current day is @1.=
|
||||
[<delay_in_seconds> | -1] [-r] [<message>]=
|
||||
Shutdown server (-1 cancels a delayed shutdown, -r allows players to reconnect)=
|
||||
Server shutting down (operator request).=
|
||||
Ban the IP of a player or show the ban list=
|
||||
The ban list is empty.=
|
||||
Ban list: @1=
|
||||
You cannot ban players in singleplayer!=
|
||||
Player is not online.=
|
||||
Failed to ban player.=
|
||||
Banned @1.=
|
||||
<name> | <IP_address>=
|
||||
Remove IP ban belonging to a player/IP=
|
||||
Failed to unban player/IP.=
|
||||
Unbanned @1.=
|
||||
<name> [<reason>]=
|
||||
Kick a player=
|
||||
Failed to kick player @1.=
|
||||
Kicked @1.=
|
||||
[full | quick]=
|
||||
Clear all objects in world=
|
||||
Invalid usage, see /help clearobjects.=
|
||||
Clearing all objects. This may take a long time. You may experience a timeout. (by @1)=
|
||||
Cleared all objects.=
|
||||
<name> <message>=
|
||||
Send a direct message to a player=
|
||||
Invalid usage, see /help msg.=
|
||||
The player @1 is not online.=
|
||||
DM from @1: @2=
|
||||
Message sent.=
|
||||
Get the last login time of a player or yourself=
|
||||
@1's last login time was @2.=
|
||||
@1's last login time is unknown.=
|
||||
Clear the inventory of yourself or another player=
|
||||
You don't have permission to clear another player's inventory (missing privilege: @1).=
|
||||
@1 cleared your inventory.=
|
||||
Cleared @1's inventory.=
|
||||
Player must be online to clear inventory!=
|
||||
Players can't be killed, damage has been disabled.=
|
||||
Player @1 is not online.=
|
||||
You are already dead.=
|
||||
@1 is already dead.=
|
||||
@1 has been killed.=
|
||||
Kill player or yourself=
|
||||
Invalid parameters (see /help @1).=
|
||||
Too many arguments, try using just /help <command>=
|
||||
Available commands: @1=
|
||||
Use '/help <cmd>' to get more information, or '/help all' to list everything.=
|
||||
Available commands:=
|
||||
Command not available: @1=
|
||||
[all | privs | <cmd>] [-t]=
|
||||
Get help for commands or list privileges (-t: output in chat)=
|
||||
Command=
|
||||
Parameters=
|
||||
For more information, click on any entry in the list.=
|
||||
Double-click to copy the entry to the chat history.=
|
||||
Command: @1 @2=
|
||||
Available commands: (see also: /help <cmd>)=
|
||||
Close=
|
||||
Privilege=
|
||||
Description=
|
||||
Available privileges:=
|
||||
print [<filter>] | dump [<filter>] | save [<format> [<filter>]] | reset=
|
||||
Handle the profiler and profiling data=
|
||||
Statistics written to action log.=
|
||||
Statistics were reset.=
|
||||
Usage: @1=
|
||||
Format can be one of txt, csv, lua, json, json_pretty (structures may be subject to change).=
|
||||
@1 joined the game.=
|
||||
@1 left the game.=
|
||||
@1 left the game (timed out).=
|
||||
(no description)=
|
||||
Can interact with things and modify the world=
|
||||
Can speak in chat=
|
||||
Can modify basic privileges (@1)=
|
||||
Can modify privileges=
|
||||
Can teleport self=
|
||||
Can teleport other players=
|
||||
Can set the time of day using /time=
|
||||
Can do server maintenance stuff=
|
||||
Can bypass node protection in the world=
|
||||
Can ban and unban players=
|
||||
Can kick players=
|
||||
Can use /give and /giveme=
|
||||
Can use /setpassword and /clearpassword=
|
||||
Can use fly mode=
|
||||
Can use fast mode=
|
||||
Can fly through solid nodes using noclip mode=
|
||||
Can use the rollback functionality=
|
||||
Can enable wireframe=
|
||||
Unknown Item=
|
||||
Air=
|
||||
Ignore=
|
||||
You can't place 'ignore' nodes!=
|
||||
Values below show absolute/relative times spend per server step by the instrumented function.=
|
||||
A total of @1 sample(s) were taken.=
|
||||
The output is limited to '@1'.=
|
||||
Saving of profile failed: @1=
|
||||
Profile saved to @1=
|
||||
@@ -14,14 +14,11 @@
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Global menu data
|
||||
--------------------------------------------------------------------------------
|
||||
menudata = {}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Local cached values
|
||||
--------------------------------------------------------------------------------
|
||||
local min_supp_proto, max_supp_proto
|
||||
|
||||
function common_update_cached_supp_proto()
|
||||
@@ -29,14 +26,12 @@ function common_update_cached_supp_proto()
|
||||
max_supp_proto = core.get_max_supp_proto()
|
||||
end
|
||||
common_update_cached_supp_proto()
|
||||
--------------------------------------------------------------------------------
|
||||
-- Menu helper functions
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Menu helper functions
|
||||
|
||||
local function render_client_count(n)
|
||||
if n > 99 then return '99+'
|
||||
elseif n >= 0 then return tostring(n)
|
||||
if n > 999 then return '99+'
|
||||
elseif n >= 0 then return tostring(n)
|
||||
else return '?' end
|
||||
end
|
||||
|
||||
@@ -50,21 +45,7 @@ local function configure_selected_world_params(idx)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function image_column(tooltip, flagname)
|
||||
return "image,tooltip=" .. core.formspec_escape(tooltip) .. "," ..
|
||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
||||
"1=" .. core.formspec_escape(defaulttexturedir ..
|
||||
(flagname and "server_flags_" .. flagname .. ".png" or "blank.png")) .. "," ..
|
||||
"2=" .. core.formspec_escape(defaulttexturedir .. "server_ping_4.png") .. "," ..
|
||||
"3=" .. core.formspec_escape(defaulttexturedir .. "server_ping_3.png") .. "," ..
|
||||
"4=" .. core.formspec_escape(defaulttexturedir .. "server_ping_2.png") .. "," ..
|
||||
"5=" .. core.formspec_escape(defaulttexturedir .. "server_ping_1.png")
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function render_serverlist_row(spec, is_favorite)
|
||||
function render_serverlist_row(spec)
|
||||
local text = ""
|
||||
if spec.name then
|
||||
text = text .. core.formspec_escape(spec.name:trim())
|
||||
@@ -75,31 +56,29 @@ function render_serverlist_row(spec, is_favorite)
|
||||
end
|
||||
end
|
||||
|
||||
local grey_out = not is_server_protocol_compat(spec.proto_min, spec.proto_max)
|
||||
local grey_out = not spec.is_compatible
|
||||
|
||||
local details
|
||||
if is_favorite then
|
||||
details = "1,"
|
||||
else
|
||||
details = "0,"
|
||||
end
|
||||
local details = {}
|
||||
|
||||
if spec.ping then
|
||||
local ping = spec.ping * 1000
|
||||
if ping <= 50 then
|
||||
details = details .. "2,"
|
||||
elseif ping <= 100 then
|
||||
details = details .. "3,"
|
||||
elseif ping <= 250 then
|
||||
details = details .. "4,"
|
||||
if spec.lag or spec.ping then
|
||||
local lag = (spec.lag or 0) * 1000 + (spec.ping or 0) * 250
|
||||
if lag <= 125 then
|
||||
table.insert(details, "1")
|
||||
elseif lag <= 175 then
|
||||
table.insert(details, "2")
|
||||
elseif lag <= 250 then
|
||||
table.insert(details, "3")
|
||||
else
|
||||
details = details .. "5,"
|
||||
table.insert(details, "4")
|
||||
end
|
||||
else
|
||||
details = details .. "0,"
|
||||
table.insert(details, "0")
|
||||
end
|
||||
|
||||
if spec.clients and spec.clients_max then
|
||||
table.insert(details, ",")
|
||||
|
||||
local color = (grey_out and "#aaaaaa") or ((spec.is_favorite and "#ddddaa") or "#ffffff")
|
||||
if spec.clients and (spec.clients_max or 0) > 0 then
|
||||
local clients_percent = 100 * spec.clients / spec.clients_max
|
||||
|
||||
-- Choose a color depending on how many clients are connected
|
||||
@@ -110,68 +89,53 @@ function render_serverlist_row(spec, is_favorite)
|
||||
elseif clients_percent <= 60 then clients_color = '#a1e587' -- 0-60%: green
|
||||
elseif clients_percent <= 90 then clients_color = '#ffdc97' -- 60-90%: yellow
|
||||
elseif clients_percent == 100 then clients_color = '#dd5b5b' -- full server: red (darker)
|
||||
else clients_color = '#ffba97' -- 90-100%: orange
|
||||
else clients_color = '#ffba97' -- 90-100%: orange
|
||||
end
|
||||
|
||||
details = details .. clients_color .. ',' ..
|
||||
render_client_count(spec.clients) .. ',/,' ..
|
||||
render_client_count(spec.clients_max) .. ','
|
||||
|
||||
elseif grey_out then
|
||||
details = details .. '#aaaaaa,?,/,?,'
|
||||
table.insert(details, clients_color)
|
||||
table.insert(details, render_client_count(spec.clients) .. " / " ..
|
||||
render_client_count(spec.clients_max))
|
||||
else
|
||||
details = details .. ',?,/,?,'
|
||||
table.insert(details, color)
|
||||
table.insert(details, "?")
|
||||
end
|
||||
|
||||
if spec.creative then
|
||||
details = details .. "1,"
|
||||
table.insert(details, "1") -- creative icon
|
||||
else
|
||||
details = details .. "0,"
|
||||
end
|
||||
|
||||
if spec.damage then
|
||||
details = details .. "1,"
|
||||
else
|
||||
details = details .. "0,"
|
||||
table.insert(details, "0")
|
||||
end
|
||||
|
||||
if spec.pvp then
|
||||
details = details .. "1,"
|
||||
table.insert(details, "2") -- pvp icon
|
||||
elseif spec.damage then
|
||||
table.insert(details, "1") -- heart icon
|
||||
else
|
||||
details = details .. "0,"
|
||||
table.insert(details, "0")
|
||||
end
|
||||
|
||||
return details .. (grey_out and '#aaaaaa,' or ',') .. text
|
||||
end
|
||||
table.insert(details, color)
|
||||
table.insert(details, text)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
os.tempfolder = function()
|
||||
local temp = core.get_temp_path()
|
||||
return temp .. DIR_DELIM .. "MT_" .. math.random(0, 10000)
|
||||
return table.concat(details, ",")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------
|
||||
os.tmpname = function()
|
||||
local path = os.tempfolder()
|
||||
io.open(path, "w"):close()
|
||||
return path
|
||||
error('do not use') -- instead use core.get_temp_path()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function menu_render_worldlist()
|
||||
local retval = ""
|
||||
local retval = {}
|
||||
local current_worldlist = menudata.worldlist:get_list()
|
||||
|
||||
for i, v in ipairs(current_worldlist) do
|
||||
if retval ~= "" then retval = retval .. "," end
|
||||
retval = retval .. core.formspec_escape(v.name) ..
|
||||
" \\[" .. core.formspec_escape(v.gameid) .. "\\]"
|
||||
retval[#retval+1] = core.formspec_escape(v.name)
|
||||
end
|
||||
|
||||
return retval
|
||||
return table.concat(retval, ",")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function menu_handle_key_up_down(fields, textlist, settingname)
|
||||
local oldidx, newidx = core.get_textlist_index(textlist), 1
|
||||
if fields.key_up or fields.key_down then
|
||||
@@ -188,7 +152,6 @@ function menu_handle_key_up_down(fields, textlist, settingname)
|
||||
return false
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function text2textlist(xpos, ypos, width, height, tl_name, textlen, text, transparency)
|
||||
local textlines = core.wrap_text(text, textlen, true)
|
||||
local retval = "textlist[" .. xpos .. "," .. ypos .. ";" .. width ..
|
||||
@@ -206,7 +169,6 @@ function text2textlist(xpos, ypos, width, height, tl_name, textlen, text, transp
|
||||
return retval
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function is_server_protocol_compat(server_proto_min, server_proto_max)
|
||||
if (not server_proto_min) or (not server_proto_max) then
|
||||
-- There is no info. Assume the best and act as if we would be compatible.
|
||||
@@ -214,7 +176,7 @@ function is_server_protocol_compat(server_proto_min, server_proto_max)
|
||||
end
|
||||
return min_supp_proto <= server_proto_max and max_supp_proto >= server_proto_min
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function is_server_protocol_compat_or_error(server_proto_min, server_proto_max)
|
||||
if not is_server_protocol_compat(server_proto_min, server_proto_max) then
|
||||
local server_prot_ver_info, client_prot_ver_info
|
||||
@@ -242,7 +204,7 @@ function is_server_protocol_compat_or_error(server_proto_min, server_proto_max)
|
||||
|
||||
return true
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function menu_worldmt(selected, setting, value)
|
||||
local world = menudata.worldlist:get_list()[selected]
|
||||
if world then
|
||||
@@ -274,3 +236,11 @@ function menu_worldmt_legacy(selected)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function confirmation_formspec(message, confirm_id, confirm_label, cancel_id, cancel_label)
|
||||
return "size[10,2.5,true]" ..
|
||||
"label[0.5,0.5;" .. message .. "]" ..
|
||||
"style[" .. confirm_id .. ";bgcolor=red]" ..
|
||||
"button[0.5,1.5;2.5,0.5;" .. confirm_id .. ";" .. confirm_label .. "]" ..
|
||||
"button[7.0,1.5;2.5,0.5;" .. cancel_id .. ";" .. cancel_label .. "]"
|
||||
end
|
||||
|
||||
@@ -61,12 +61,68 @@ local function init_data(data)
|
||||
data.list:set_sortmode("alphabetic")
|
||||
end
|
||||
|
||||
|
||||
-- Returns errors errors and a list of all enabled mods (inc. game and world mods)
|
||||
--
|
||||
-- `with_errors` is a table from mod virtual path to `{ type = "error" | "warning" }`.
|
||||
-- `enabled_mods_by_name` is a table from mod virtual path to `true`.
|
||||
--
|
||||
-- @param world_path Path to the world
|
||||
-- @param all_mods List of mods, with `enabled` property.
|
||||
-- @returns with_errors, enabled_mods_by_name
|
||||
local function check_mod_configuration(world_path, all_mods)
|
||||
-- Build up lookup tables for enabled mods and all mods by vpath
|
||||
local enabled_mod_paths = {}
|
||||
local all_mods_by_vpath = {}
|
||||
for _, mod in ipairs(all_mods) do
|
||||
if mod.type == "mod" then
|
||||
all_mods_by_vpath[mod.virtual_path] = mod
|
||||
end
|
||||
if mod.enabled then
|
||||
enabled_mod_paths[mod.virtual_path] = mod.path
|
||||
end
|
||||
end
|
||||
|
||||
-- Use the engine's mod configuration code to resolve dependencies and return any errors
|
||||
local config_status = core.check_mod_configuration(world_path, enabled_mod_paths)
|
||||
|
||||
-- Build the list of enabled mod virtual paths
|
||||
local enabled_mods_by_name = {}
|
||||
for _, mod in ipairs(config_status.satisfied_mods) do
|
||||
assert(mod.virtual_path ~= "")
|
||||
enabled_mods_by_name[mod.name] = all_mods_by_vpath[mod.virtual_path] or mod
|
||||
end
|
||||
for _, mod in ipairs(config_status.unsatisfied_mods) do
|
||||
assert(mod.virtual_path ~= "")
|
||||
enabled_mods_by_name[mod.name] = all_mods_by_vpath[mod.virtual_path] or mod
|
||||
end
|
||||
|
||||
-- Build the table of errors
|
||||
local with_error = {}
|
||||
for _, mod in ipairs(config_status.unsatisfied_mods) do
|
||||
local error = { type = "warning" }
|
||||
with_error[mod.virtual_path] = error
|
||||
|
||||
for _, depname in ipairs(mod.unsatisfied_depends) do
|
||||
if not enabled_mods_by_name[depname] then
|
||||
error.type = "error"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return with_error, enabled_mods_by_name
|
||||
end
|
||||
|
||||
local function get_formspec(data)
|
||||
if not data.list then
|
||||
init_data(data)
|
||||
end
|
||||
|
||||
local mod = data.list:get_list()[data.selected_mod] or {name = ""}
|
||||
local all_mods = data.list:get_list()
|
||||
local with_error, enabled_mods_by_name = check_mod_configuration(data.worldspec.path, all_mods)
|
||||
|
||||
local mod = all_mods[data.selected_mod] or {name = ""}
|
||||
|
||||
local retval =
|
||||
"size[11.5,7.5,true]" ..
|
||||
@@ -87,6 +143,29 @@ local function get_formspec(data)
|
||||
"textarea[0.25,0.7;5.75,7.2;;" .. info .. ";]"
|
||||
else
|
||||
local hard_deps, soft_deps = pkgmgr.get_dependencies(mod.path)
|
||||
|
||||
-- Add error messages to dep lists
|
||||
if mod.enabled or mod.is_game_content then
|
||||
for i, dep_name in ipairs(hard_deps) do
|
||||
local dep = enabled_mods_by_name[dep_name]
|
||||
if not dep then
|
||||
hard_deps[i] = mt_color_red .. dep_name .. " " .. fgettext("(Unsatisfied)")
|
||||
elseif with_error[dep.virtual_path] then
|
||||
hard_deps[i] = mt_color_orange .. dep_name .. " " .. fgettext("(Enabled, has error)")
|
||||
else
|
||||
hard_deps[i] = mt_color_green .. dep_name
|
||||
end
|
||||
end
|
||||
for i, dep_name in ipairs(soft_deps) do
|
||||
local dep = enabled_mods_by_name[dep_name]
|
||||
if dep and with_error[dep.virtual_path] then
|
||||
soft_deps[i] = mt_color_orange .. dep_name .. " " .. fgettext("(Enabled, has error)")
|
||||
elseif dep then
|
||||
soft_deps[i] = mt_color_green .. dep_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local hard_deps_str = table.concat(hard_deps, ",")
|
||||
local soft_deps_str = table.concat(soft_deps, ",")
|
||||
|
||||
@@ -138,7 +217,6 @@ local function get_formspec(data)
|
||||
|
||||
if mod.name ~= "" and not mod.is_game_content then
|
||||
if mod.is_modpack then
|
||||
|
||||
if pkgmgr.is_modpack_entirely_enabled(data, mod.name) then
|
||||
retval = retval ..
|
||||
"button[5.5,0.125;3,0.5;btn_mp_disable;" ..
|
||||
@@ -163,10 +241,16 @@ local function get_formspec(data)
|
||||
"button[8.95,0.125;2.5,0.5;btn_enable_all_mods;" ..
|
||||
fgettext("Enable all") .. "]"
|
||||
end
|
||||
|
||||
local use_technical_names = core.settings:get_bool("show_technical_names")
|
||||
|
||||
return retval ..
|
||||
"tablecolumns[color;tree;text]" ..
|
||||
"tablecolumns[color;tree;image,align=inline,width=1.5,0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") ..
|
||||
",1=" .. core.formspec_escape(defaulttexturedir .. "checkbox_16_white.png") ..
|
||||
",2=" .. core.formspec_escape(defaulttexturedir .. "error_icon_orange.png") ..
|
||||
",3=" .. core.formspec_escape(defaulttexturedir .. "error_icon_red.png") .. ";text]" ..
|
||||
"table[5.5,0.75;5.75,6;world_config_modlist;" ..
|
||||
pkgmgr.render_packagelist(data.list) .. ";" .. data.selected_mod .."]"
|
||||
pkgmgr.render_packagelist(data.list, use_technical_names, with_error) .. ";" .. data.selected_mod .."]"
|
||||
end
|
||||
|
||||
local function handle_buttons(this, fields)
|
||||
@@ -205,14 +289,19 @@ local function handle_buttons(this, fields)
|
||||
local mods = worldfile:to_table()
|
||||
|
||||
local rawlist = this.data.list:get_raw_list()
|
||||
local was_set = {}
|
||||
|
||||
for i = 1, #rawlist do
|
||||
local mod = rawlist[i]
|
||||
if not mod.is_modpack and
|
||||
not mod.is_game_content then
|
||||
if modname_valid(mod.name) then
|
||||
worldfile:set("load_mod_" .. mod.name,
|
||||
mod.enabled and "true" or "false")
|
||||
if mod.enabled then
|
||||
worldfile:set("load_mod_" .. mod.name, mod.virtual_path)
|
||||
was_set[mod.name] = true
|
||||
elseif not was_set[mod.name] then
|
||||
worldfile:set("load_mod_" .. mod.name, "false")
|
||||
end
|
||||
elseif mod.enabled then
|
||||
gamedata.errormessage = fgettext_ne("Failed to enable mo" ..
|
||||
"d \"$1\" as it contains disallowed characters. " ..
|
||||
@@ -256,12 +345,26 @@ local function handle_buttons(this, fields)
|
||||
if fields.btn_enable_all_mods then
|
||||
local list = this.data.list:get_raw_list()
|
||||
|
||||
-- When multiple copies of a mod are installed, we need to avoid enabling multiple of them
|
||||
-- at a time. So lets first collect all the enabled mods, and then use this to exclude
|
||||
-- multiple enables.
|
||||
|
||||
local was_enabled = {}
|
||||
for i = 1, #list do
|
||||
if not list[i].is_game_content
|
||||
and not list[i].is_modpack then
|
||||
list[i].enabled = true
|
||||
and not list[i].is_modpack and list[i].enabled then
|
||||
was_enabled[list[i].name] = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #list do
|
||||
if not list[i].is_game_content and not list[i].is_modpack and
|
||||
not was_enabled[list[i].name] then
|
||||
list[i].enabled = true
|
||||
was_enabled[list[i].name] = true
|
||||
end
|
||||
end
|
||||
|
||||
enabled_all = true
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ end
|
||||
|
||||
-- Unordered preserves the original order of the ContentDB API,
|
||||
-- before the package list is ordered based on installed state.
|
||||
local store = { packages = {}, packages_full = {}, packages_full_unordered = {} }
|
||||
local store = { packages = {}, packages_full = {}, packages_full_unordered = {}, aliases = {} }
|
||||
|
||||
local http = core.get_http_api()
|
||||
|
||||
@@ -57,34 +57,77 @@ local filter_types_type = {
|
||||
"txp",
|
||||
}
|
||||
|
||||
local REASON_NEW = "new"
|
||||
local REASON_UPDATE = "update"
|
||||
local REASON_DEPENDENCY = "dependency"
|
||||
|
||||
local function download_package(param)
|
||||
if core.download_file(param.package.url, param.filename) then
|
||||
return {
|
||||
filename = param.filename,
|
||||
successful = true,
|
||||
}
|
||||
else
|
||||
core.log("error", "downloading " .. dump(param.package.url) .. " failed")
|
||||
return {
|
||||
successful = false,
|
||||
}
|
||||
|
||||
-- encodes for use as URL parameter or path component
|
||||
local function urlencode(str)
|
||||
return str:gsub("[^%a%d()._~-]", function(char)
|
||||
return string.format("%%%02X", string.byte(char))
|
||||
end)
|
||||
end
|
||||
assert(urlencode("sample text?") == "sample%20text%3F")
|
||||
|
||||
|
||||
local function get_download_url(package, reason)
|
||||
local base_url = core.settings:get("contentdb_url")
|
||||
local ret = base_url .. ("/packages/%s/releases/%d/download/"):format(
|
||||
package.url_part, package.release)
|
||||
if reason then
|
||||
ret = ret .. "?reason=" .. reason
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
local function start_install(package)
|
||||
|
||||
local function download_and_extract(param)
|
||||
local package = param.package
|
||||
|
||||
local filename = core.get_temp_path(true)
|
||||
if filename == "" or not core.download_file(param.url, filename) then
|
||||
core.log("error", "Downloading " .. dump(param.url) .. " failed")
|
||||
return {
|
||||
msg = fgettext("Failed to download $1", package.name)
|
||||
}
|
||||
end
|
||||
|
||||
local tempfolder = core.get_temp_path()
|
||||
if tempfolder ~= "" then
|
||||
tempfolder = tempfolder .. DIR_DELIM .. "MT_" .. math.random(1, 1024000)
|
||||
if not core.extract_zip(filename, tempfolder) then
|
||||
tempfolder = nil
|
||||
end
|
||||
else
|
||||
tempfolder = nil
|
||||
end
|
||||
os.remove(filename)
|
||||
if not tempfolder then
|
||||
return {
|
||||
msg = fgettext("Install: Unsupported file type or broken archive"),
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
path = tempfolder
|
||||
}
|
||||
end
|
||||
|
||||
local function start_install(package, reason)
|
||||
local params = {
|
||||
package = package,
|
||||
filename = os.tempfolder() .. "_MODNAME_" .. package.name .. ".zip",
|
||||
url = get_download_url(package, reason),
|
||||
}
|
||||
|
||||
number_downloading = number_downloading + 1
|
||||
|
||||
local function callback(result)
|
||||
if result.successful then
|
||||
local path, msg = pkgmgr.install(package.type,
|
||||
result.filename, package.name,
|
||||
package.path)
|
||||
if result.msg then
|
||||
gamedata.errormessage = result.msg
|
||||
else
|
||||
local path, msg = pkgmgr.install_dir(package.type, result.path, package.name, package.path)
|
||||
core.delete_dir(result.path)
|
||||
if not path then
|
||||
gamedata.errormessage = msg
|
||||
else
|
||||
@@ -108,11 +151,9 @@ local function start_install(package)
|
||||
|
||||
if conf_path then
|
||||
local conf = Settings(conf_path)
|
||||
if name_is_title then
|
||||
conf:set("name", package.title)
|
||||
else
|
||||
conf:set("title", package.title)
|
||||
conf:set("name", package.name)
|
||||
conf:set("title", package.title)
|
||||
if not name_is_title then
|
||||
conf:set("name", package.name)
|
||||
end
|
||||
if not conf:get("description") then
|
||||
conf:set("description", package.short_description)
|
||||
@@ -122,9 +163,6 @@ local function start_install(package)
|
||||
conf:write()
|
||||
end
|
||||
end
|
||||
os.remove(result.filename)
|
||||
else
|
||||
gamedata.errormessage = fgettext("Failed to download $1", package.name)
|
||||
end
|
||||
|
||||
package.downloading = false
|
||||
@@ -135,7 +173,7 @@ local function start_install(package)
|
||||
if next then
|
||||
table.remove(download_queue, 1)
|
||||
|
||||
start_install(next)
|
||||
start_install(next.package, next.reason)
|
||||
end
|
||||
|
||||
ui.update()
|
||||
@@ -144,19 +182,19 @@ local function start_install(package)
|
||||
package.queued = false
|
||||
package.downloading = true
|
||||
|
||||
if not core.handle_async(download_package, params, callback) then
|
||||
if not core.handle_async(download_and_extract, params, callback) then
|
||||
core.log("error", "ERROR: async event failed")
|
||||
gamedata.errormessage = fgettext("Failed to download $1", package.name)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local function queue_download(package)
|
||||
local function queue_download(package, reason)
|
||||
local max_concurrent_downloads = tonumber(core.settings:get("contentdb_max_concurrent_downloads"))
|
||||
if number_downloading < max_concurrent_downloads then
|
||||
start_install(package)
|
||||
if number_downloading < math.max(max_concurrent_downloads, 1) then
|
||||
start_install(package, reason)
|
||||
else
|
||||
table.insert(download_queue, package)
|
||||
table.insert(download_queue, { package = package, reason = reason })
|
||||
package.queued = true
|
||||
end
|
||||
end
|
||||
@@ -169,7 +207,7 @@ local function get_raw_dependencies(package)
|
||||
local url_fmt = "/api/packages/%s/dependencies/?only_hard=1&protocol_version=%s&engine_version=%s"
|
||||
local version = core.get_version()
|
||||
local base_url = core.settings:get("contentdb_url")
|
||||
local url = base_url .. url_fmt:format(package.id, core.get_max_supp_proto(), version.string)
|
||||
local url = base_url .. url_fmt:format(package.url_part, core.get_max_supp_proto(), urlencode(version.string))
|
||||
|
||||
local response = http.fetch_sync({ url = url })
|
||||
if not response.succeeded then
|
||||
@@ -320,7 +358,7 @@ function install_dialog.get_formspec()
|
||||
selected_game_idx = i
|
||||
end
|
||||
|
||||
games[i] = core.formspec_escape(games[i].name)
|
||||
games[i] = core.formspec_escape(games[i].title)
|
||||
end
|
||||
|
||||
local selected_game = pkgmgr.games[selected_game_idx]
|
||||
@@ -370,7 +408,7 @@ function install_dialog.get_formspec()
|
||||
"container[0.375,0.70]",
|
||||
|
||||
"label[0,0.25;", fgettext("Base Game:"), "]",
|
||||
"dropdown[2,0;4.25,0.5;gameid;", table.concat(games, ","), ";", selected_game_idx, "]",
|
||||
"dropdown[2,0;4.25,0.5;selected_game;", table.concat(games, ","), ";", selected_game_idx, "]",
|
||||
|
||||
"label[0,0.8;", fgettext("Dependencies:"), "]",
|
||||
|
||||
@@ -407,12 +445,12 @@ function install_dialog.handle_submit(this, fields)
|
||||
end
|
||||
|
||||
if fields.install_all then
|
||||
queue_download(install_dialog.package)
|
||||
queue_download(install_dialog.package, REASON_NEW)
|
||||
|
||||
if install_dialog.will_install_deps then
|
||||
for _, dep in pairs(install_dialog.dependencies) do
|
||||
if not dep.is_optional and not dep.installed and dep.package then
|
||||
queue_download(dep.package)
|
||||
queue_download(dep.package, REASON_DEPENDENCY)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -421,9 +459,9 @@ function install_dialog.handle_submit(this, fields)
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.gameid then
|
||||
if fields.selected_game then
|
||||
for _, game in pairs(pkgmgr.games) do
|
||||
if game.name == fields.gameid then
|
||||
if game.title == fields.selected_game then
|
||||
core.settings:set("menu_last_game", game.id)
|
||||
break
|
||||
end
|
||||
@@ -450,12 +488,10 @@ local confirm_overwrite = {}
|
||||
function confirm_overwrite.get_formspec()
|
||||
local package = confirm_overwrite.package
|
||||
|
||||
return "size[11.5,4.5,true]" ..
|
||||
"label[2,2;" ..
|
||||
fgettext("\"$1\" already exists. Would you like to overwrite it?", package.name) .. "]"..
|
||||
"style[install;bgcolor=red]" ..
|
||||
"button[3.25,3.5;2.5,0.5;install;" .. fgettext("Overwrite") .. "]" ..
|
||||
"button[5.75,3.5;2.5,0.5;cancel;" .. fgettext("Cancel") .. "]"
|
||||
return confirmation_formspec(
|
||||
fgettext("\"$1\" already exists. Would you like to overwrite it?", package.name),
|
||||
'install', fgettext("Overwrite"),
|
||||
'cancel', fgettext("Cancel"))
|
||||
end
|
||||
|
||||
function confirm_overwrite.handle_submit(this, fields)
|
||||
@@ -544,33 +580,43 @@ function store.load()
|
||||
local base_url = core.settings:get("contentdb_url")
|
||||
local url = base_url ..
|
||||
"/api/packages/?type=mod&type=game&type=txp&protocol_version=" ..
|
||||
core.get_max_supp_proto() .. "&engine_version=" .. version.string
|
||||
core.get_max_supp_proto() .. "&engine_version=" .. urlencode(version.string)
|
||||
|
||||
for _, item in pairs(core.settings:get("contentdb_flag_blacklist"):split(",")) do
|
||||
item = item:trim()
|
||||
if item ~= "" then
|
||||
url = url .. "&hide=" .. item
|
||||
url = url .. "&hide=" .. urlencode(item)
|
||||
end
|
||||
end
|
||||
|
||||
local timeout = tonumber(core.settings:get("curl_file_download_timeout"))
|
||||
local response = http.fetch_sync({ url = url, timeout = timeout })
|
||||
local response = http.fetch_sync({ url = url })
|
||||
if not response.succeeded then
|
||||
return
|
||||
end
|
||||
|
||||
store.packages_full = core.parse_json(response.data) or {}
|
||||
store.aliases = {}
|
||||
|
||||
for _, package in pairs(store.packages_full) do
|
||||
package.url = base_url .. "/packages/" ..
|
||||
package.author .. "/" .. package.name ..
|
||||
"/releases/" .. package.release .. "/download/"
|
||||
|
||||
local name_len = #package.name
|
||||
-- This must match what store.update_paths() does!
|
||||
package.id = package.author:lower() .. "/"
|
||||
if package.type == "game" and name_len > 5 and package.name:sub(name_len - 4) == "_game" then
|
||||
package.id = package.author:lower() .. "/" .. package.name:sub(1, name_len - 5)
|
||||
package.id = package.id .. package.name:sub(1, name_len - 5)
|
||||
else
|
||||
package.id = package.author:lower() .. "/" .. package.name
|
||||
package.id = package.id .. package.name
|
||||
end
|
||||
|
||||
package.url_part = urlencode(package.author) .. "/" .. urlencode(package.name)
|
||||
|
||||
if package.aliases then
|
||||
for _, alias in ipairs(package.aliases) do
|
||||
-- We currently don't support name changing
|
||||
local suffix = "/" .. package.name
|
||||
if alias:sub(-#suffix) == suffix then
|
||||
store.aliases[alias:lower()] = package.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -584,7 +630,8 @@ function store.update_paths()
|
||||
pkgmgr.refresh_globals()
|
||||
for _, mod in pairs(pkgmgr.global_mods:get_list()) do
|
||||
if mod.author and mod.release > 0 then
|
||||
mod_hash[mod.author:lower() .. "/" .. mod.name] = mod
|
||||
local id = mod.author:lower() .. "/" .. mod.name
|
||||
mod_hash[store.aliases[id] or id] = mod
|
||||
end
|
||||
end
|
||||
|
||||
@@ -592,14 +639,16 @@ function store.update_paths()
|
||||
pkgmgr.update_gamelist()
|
||||
for _, game in pairs(pkgmgr.games) do
|
||||
if game.author ~= "" and game.release > 0 then
|
||||
game_hash[game.author:lower() .. "/" .. game.id] = game
|
||||
local id = game.author:lower() .. "/" .. game.id
|
||||
game_hash[store.aliases[id] or id] = game
|
||||
end
|
||||
end
|
||||
|
||||
local txp_hash = {}
|
||||
for _, txp in pairs(pkgmgr.get_texture_packs()) do
|
||||
if txp.author and txp.release > 0 then
|
||||
txp_hash[txp.author:lower() .. "/" .. txp.name] = txp
|
||||
local id = txp.author:lower() .. "/" .. txp.name
|
||||
txp_hash[store.aliases[id] or id] = txp
|
||||
end
|
||||
end
|
||||
|
||||
@@ -809,8 +858,7 @@ function store.get_formspec(dlgdata)
|
||||
formspec[#formspec + 1] = "cdb_downloading.png;3;400;]"
|
||||
elseif package.queued then
|
||||
formspec[#formspec + 1] = left_base
|
||||
formspec[#formspec + 1] = core.formspec_escape(defaulttexturedir)
|
||||
formspec[#formspec + 1] = "cdb_queued.png;queued]"
|
||||
formspec[#formspec + 1] = "cdb_queued.png;queued;]"
|
||||
elseif not package.path then
|
||||
local elem_name = "install_" .. i .. ";"
|
||||
formspec[#formspec + 1] = "style[" .. elem_name .. "bgcolor=#71aa34]"
|
||||
@@ -915,7 +963,7 @@ function store.handle_submit(this, fields)
|
||||
local package = store.packages_full[i]
|
||||
if package.path and package.installed_release < package.release and
|
||||
not (package.downloading or package.queued) then
|
||||
queue_download(package)
|
||||
queue_download(package, REASON_UPDATE)
|
||||
end
|
||||
end
|
||||
return true
|
||||
@@ -948,7 +996,7 @@ function store.handle_submit(this, fields)
|
||||
this:hide()
|
||||
dlg:show()
|
||||
else
|
||||
queue_download(package)
|
||||
queue_download(package, package.path and REASON_UPDATE or REASON_NEW)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -973,9 +1021,9 @@ function store.handle_submit(this, fields)
|
||||
end
|
||||
|
||||
if fields["view_" .. i] then
|
||||
local url = ("%s/packages/%s/%s?protocol_version=%d"):format(
|
||||
core.settings:get("contentdb_url"),
|
||||
package.author, package.name, core.get_max_supp_proto())
|
||||
local url = ("%s/packages/%s?protocol_version=%d"):format(
|
||||
core.settings:get("contentdb_url"), package.url_part,
|
||||
core.get_max_supp_proto())
|
||||
core.open_url(url)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
local worldname = ""
|
||||
|
||||
local function table_to_flags(ftable)
|
||||
-- Convert e.g. { jungles = true, caves = false } to "jungles,nocaves"
|
||||
local str = {}
|
||||
@@ -31,9 +29,8 @@ local function strflag(flags, flag)
|
||||
return (flags[flag] == true) and "true" or "false"
|
||||
end
|
||||
|
||||
local cb_caverns = { "caverns", fgettext("Caverns"), "caverns",
|
||||
local cb_caverns = { "caverns", fgettext("Caverns"),
|
||||
fgettext("Very large caverns deep in the underground") }
|
||||
local tt_sea_rivers = fgettext("Sea level rivers")
|
||||
|
||||
local flag_checkboxes = {
|
||||
v5 = {
|
||||
@@ -41,39 +38,38 @@ local flag_checkboxes = {
|
||||
},
|
||||
v7 = {
|
||||
cb_caverns,
|
||||
{ "ridges", fgettext("Rivers"), "ridges", tt_sea_rivers },
|
||||
{ "mountains", fgettext("Mountains"), "mountains" },
|
||||
{ "floatlands", fgettext("Floatlands (experimental)"), "floatlands",
|
||||
{ "ridges", fgettext("Rivers"), fgettext("Sea level rivers") },
|
||||
{ "mountains", fgettext("Mountains") },
|
||||
{ "floatlands", fgettext("Floatlands (experimental)"),
|
||||
fgettext("Floating landmasses in the sky") },
|
||||
},
|
||||
carpathian = {
|
||||
cb_caverns,
|
||||
{ "rivers", fgettext("Rivers"), "rivers", tt_sea_rivers },
|
||||
{ "rivers", fgettext("Rivers"), fgettext("Sea level rivers") },
|
||||
},
|
||||
valleys = {
|
||||
{ "altitude-chill", fgettext("Altitude chill"), "altitude_chill",
|
||||
{ "altitude_chill", fgettext("Altitude chill"),
|
||||
fgettext("Reduces heat with altitude") },
|
||||
{ "altitude-dry", fgettext("Altitude dry"), "altitude_dry",
|
||||
{ "altitude_dry", fgettext("Altitude dry"),
|
||||
fgettext("Reduces humidity with altitude") },
|
||||
{ "humid-rivers", fgettext("Humid rivers"), "humid_rivers",
|
||||
{ "humid_rivers", fgettext("Humid rivers"),
|
||||
fgettext("Increases humidity around rivers") },
|
||||
{ "vary-river-depth", fgettext("Vary river depth"), "vary_river_depth",
|
||||
{ "vary_river_depth", fgettext("Vary river depth"),
|
||||
fgettext("Low humidity and high heat causes shallow or dry rivers") },
|
||||
},
|
||||
flat = {
|
||||
cb_caverns,
|
||||
{ "hills", fgettext("Hills"), "hills" },
|
||||
{ "lakes", fgettext("Lakes"), "lakes" },
|
||||
{ "hills", fgettext("Hills") },
|
||||
{ "lakes", fgettext("Lakes") },
|
||||
},
|
||||
fractal = {
|
||||
{ "terrain", fgettext("Additional terrain"), "terrain",
|
||||
{ "terrain", fgettext("Additional terrain"),
|
||||
fgettext("Generate non-fractal terrain: Oceans and underground") },
|
||||
},
|
||||
v6 = {
|
||||
{ "trees", fgettext("Trees and jungle grass"), "trees" },
|
||||
{ "flat", fgettext("Flat terrain"), "flat" },
|
||||
{ "mudflow", fgettext("Mud flow"), "mudflow",
|
||||
fgettext("Terrain surface erosion") },
|
||||
{ "trees", fgettext("Trees and jungle grass") },
|
||||
{ "flat", fgettext("Flat terrain") },
|
||||
{ "mudflow", fgettext("Mud flow"), fgettext("Terrain surface erosion") },
|
||||
-- Biome settings are in mgv6_biomes below
|
||||
},
|
||||
}
|
||||
@@ -95,48 +91,33 @@ local mgv6_biomes = {
|
||||
|
||||
local function create_world_formspec(dialogdata)
|
||||
|
||||
-- Error out when no games found
|
||||
-- Point the player to ContentDB when no games are found
|
||||
if #pkgmgr.games == 0 then
|
||||
return "size[12.25,3,true]" ..
|
||||
"box[0,0;12,2;" .. mt_color_orange .. "]" ..
|
||||
"textarea[0.3,0;11.7,2;;;"..
|
||||
fgettext("You have no games installed.") .. "\n" ..
|
||||
fgettext("Download one from minetest.net") .. "]" ..
|
||||
"button[4.75,2.5;3,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
|
||||
return "size[8,2.5,true]" ..
|
||||
"style[label_button;border=false]" ..
|
||||
"button[0.5,0.5;7,0.5;label_button;" ..
|
||||
fgettext("You have no games installed.") .. "]" ..
|
||||
"button[0.5,1.5;2.5,0.5;world_create_open_cdb;" .. fgettext("Install a game") .. "]" ..
|
||||
"button[5.0,1.5;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
|
||||
end
|
||||
|
||||
local current_mg = dialogdata.mg
|
||||
local mapgens = core.get_mapgen_names()
|
||||
|
||||
local current_seed = core.settings:get("fixed_map_seed") or ""
|
||||
local current_mg = core.settings:get("mg_name")
|
||||
local gameid = core.settings:get("menu_last_game")
|
||||
|
||||
local flags = {
|
||||
main = core.settings:get_flags("mg_flags"),
|
||||
v5 = core.settings:get_flags("mgv5_spflags"),
|
||||
v6 = core.settings:get_flags("mgv6_spflags"),
|
||||
v7 = core.settings:get_flags("mgv7_spflags"),
|
||||
fractal = core.settings:get_flags("mgfractal_spflags"),
|
||||
carpathian = core.settings:get_flags("mgcarpathian_spflags"),
|
||||
valleys = core.settings:get_flags("mgvalleys_spflags"),
|
||||
flat = core.settings:get_flags("mgflat_spflags"),
|
||||
}
|
||||
local flags = dialogdata.flags
|
||||
|
||||
local gameidx = 0
|
||||
if gameid ~= nil then
|
||||
local _
|
||||
_, gameidx = pkgmgr.find_by_gameid(gameid)
|
||||
|
||||
if gameidx == nil then
|
||||
gameidx = 0
|
||||
end
|
||||
local game = pkgmgr.find_by_gameid(gameid)
|
||||
if game == nil then
|
||||
-- should never happen but just pick the first game
|
||||
game = pkgmgr.get_game(1)
|
||||
core.settings:set("menu_last_game", game.id)
|
||||
end
|
||||
|
||||
local game_by_gameidx = core.get_game(gameidx)
|
||||
local disallowed_mapgen_settings = {}
|
||||
if game_by_gameidx ~= nil then
|
||||
local gamepath = game_by_gameidx.path
|
||||
local gameconfig = Settings(gamepath.."/game.conf")
|
||||
if game ~= nil then
|
||||
local gameconfig = Settings(game.path.."/game.conf")
|
||||
|
||||
local allowed_mapgens = (gameconfig:get("allowed_mapgens") or ""):split()
|
||||
for key, value in pairs(allowed_mapgens) do
|
||||
@@ -156,7 +137,7 @@ local function create_world_formspec(dialogdata)
|
||||
end
|
||||
end
|
||||
|
||||
if disallowed_mapgens then
|
||||
if #disallowed_mapgens > 0 then
|
||||
for i = #mapgens, 1, -1 do
|
||||
if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then
|
||||
table.remove(mapgens, i)
|
||||
@@ -172,23 +153,29 @@ local function create_world_formspec(dialogdata)
|
||||
|
||||
local mglist = ""
|
||||
local selindex
|
||||
local i = 1
|
||||
local first_mg
|
||||
for k,v in pairs(mapgens) do
|
||||
if not first_mg then
|
||||
first_mg = v
|
||||
do -- build the list of mapgens
|
||||
local i = 1
|
||||
local first_mg
|
||||
for k, v in pairs(mapgens) do
|
||||
if not first_mg then
|
||||
first_mg = v
|
||||
end
|
||||
if current_mg == v then
|
||||
selindex = i
|
||||
end
|
||||
i = i + 1
|
||||
mglist = mglist .. core.formspec_escape(v) .. ","
|
||||
end
|
||||
if current_mg == v then
|
||||
selindex = i
|
||||
if not selindex then
|
||||
selindex = 1
|
||||
current_mg = first_mg
|
||||
end
|
||||
i = i + 1
|
||||
mglist = mglist .. v .. ","
|
||||
mglist = mglist:sub(1, -2)
|
||||
end
|
||||
if not selindex then
|
||||
selindex = 1
|
||||
current_mg = first_mg
|
||||
end
|
||||
mglist = mglist:sub(1, -2)
|
||||
|
||||
-- The logic of the flag element IDs is as follows:
|
||||
-- "flag_main_foo-bar-baz" controls dialogdata.flags["main"]["foo_bar_baz"]
|
||||
-- see the buttonhandler for the implementation of this
|
||||
|
||||
local mg_main_flags = function(mapgen, y)
|
||||
if mapgen == "singlenode" then
|
||||
@@ -198,11 +185,11 @@ local function create_world_formspec(dialogdata)
|
||||
return "", y
|
||||
end
|
||||
|
||||
local form = "checkbox[0," .. y .. ";flag_mg_caves;" ..
|
||||
local form = "checkbox[0," .. y .. ";flag_main_caves;" ..
|
||||
fgettext("Caves") .. ";"..strflag(flags.main, "caves").."]"
|
||||
y = y + 0.5
|
||||
|
||||
form = form .. "checkbox[0,"..y..";flag_mg_dungeons;" ..
|
||||
form = form .. "checkbox[0,"..y..";flag_main_dungeons;" ..
|
||||
fgettext("Dungeons") .. ";"..strflag(flags.main, "dungeons").."]"
|
||||
y = y + 0.5
|
||||
|
||||
@@ -213,7 +200,7 @@ local function create_world_formspec(dialogdata)
|
||||
else
|
||||
d_tt = fgettext("Structures appearing on the terrain, typically trees and plants")
|
||||
end
|
||||
form = form .. "checkbox[0,"..y..";flag_mg_decorations;" ..
|
||||
form = form .. "checkbox[0,"..y..";flag_main_decorations;" ..
|
||||
d_name .. ";" ..
|
||||
strflag(flags.main, "decorations").."]" ..
|
||||
"tooltip[flag_mg_decorations;" ..
|
||||
@@ -221,7 +208,7 @@ local function create_world_formspec(dialogdata)
|
||||
"]"
|
||||
y = y + 0.5
|
||||
|
||||
form = form .. "tooltip[flag_mg_caves;" ..
|
||||
form = form .. "tooltip[flag_main_caves;" ..
|
||||
fgettext("Network of tunnels and caves")
|
||||
.. "]"
|
||||
return form, y
|
||||
@@ -235,13 +222,13 @@ local function create_world_formspec(dialogdata)
|
||||
return "", y
|
||||
end
|
||||
local form = ""
|
||||
for _,tab in pairs(flag_checkboxes[mapgen]) do
|
||||
local id = "flag_mg"..mapgen.."_"..tab[1]
|
||||
for _, tab in pairs(flag_checkboxes[mapgen]) do
|
||||
local id = "flag_"..mapgen.."_"..tab[1]:gsub("_", "-")
|
||||
form = form .. ("checkbox[0,%f;%s;%s;%s]"):
|
||||
format(y, id, tab[2], strflag(flags[mapgen], tab[3]))
|
||||
format(y, id, tab[2], strflag(flags[mapgen], tab[1]))
|
||||
|
||||
if tab[4] then
|
||||
form = form .. "tooltip["..id..";"..tab[4].."]"
|
||||
if tab[3] then
|
||||
form = form .. "tooltip["..id..";"..tab[3].."]"
|
||||
end
|
||||
y = y + 0.5
|
||||
end
|
||||
@@ -277,16 +264,14 @@ local function create_world_formspec(dialogdata)
|
||||
|
||||
-- biomeblend
|
||||
y = y + 0.55
|
||||
form = form .. "checkbox[0,"..y..";flag_mgv6_biomeblend;" ..
|
||||
form = form .. "checkbox[0,"..y..";flag_v6_biomeblend;" ..
|
||||
fgettext("Biome blending") .. ";"..strflag(flags.v6, "biomeblend").."]" ..
|
||||
"tooltip[flag_mgv6_biomeblend;" ..
|
||||
"tooltip[flag_v6_biomeblend;" ..
|
||||
fgettext("Smooth transition between biomes") .. "]"
|
||||
|
||||
return form, y
|
||||
end
|
||||
|
||||
current_seed = core.formspec_escape(current_seed)
|
||||
|
||||
local y_start = 0.0
|
||||
local y = y_start
|
||||
local str_flags, str_spflags
|
||||
@@ -305,17 +290,6 @@ local function create_world_formspec(dialogdata)
|
||||
label_spflags = "label[0,"..y_start..";" .. fgettext("Mapgen-specific flags") .. "]"
|
||||
end
|
||||
|
||||
-- Warning if only devtest is installed
|
||||
local devtest_only = ""
|
||||
local gamelist_height = 2.3
|
||||
if #pkgmgr.games == 1 and pkgmgr.games[1].id == "devtest" then
|
||||
devtest_only = "box[0,0;5.8,1.7;#ff8800]" ..
|
||||
"textarea[0.3,0;6,1.8;;;"..
|
||||
fgettext("Warning: The Development Test is meant for developers.") .. "\n" ..
|
||||
fgettext("Download a game, such as Minetest Game, from minetest.net") .. "]"
|
||||
gamelist_height = 0.5
|
||||
end
|
||||
|
||||
local retval =
|
||||
"size[12.25,7,true]" ..
|
||||
|
||||
@@ -323,21 +297,33 @@ local function create_world_formspec(dialogdata)
|
||||
"container[0,0]"..
|
||||
"field[0.3,0.6;6,0.5;te_world_name;" ..
|
||||
fgettext("World name") ..
|
||||
";" .. core.formspec_escape(worldname) .. "]" ..
|
||||
";" .. core.formspec_escape(dialogdata.worldname) .. "]" ..
|
||||
"set_focus[te_world_name;false]"
|
||||
|
||||
"field[0.3,1.7;6,0.5;te_seed;" ..
|
||||
fgettext("Seed") ..
|
||||
";".. current_seed .. "]" ..
|
||||
if not disallowed_mapgen_settings["seed"] then
|
||||
|
||||
retval = retval .. "field[0.3,1.7;6,0.5;te_seed;" ..
|
||||
fgettext("Seed") ..
|
||||
";".. core.formspec_escape(dialogdata.seed) .. "]"
|
||||
|
||||
end
|
||||
|
||||
retval = retval ..
|
||||
"label[0,2;" .. fgettext("Mapgen") .. "]"..
|
||||
"dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" ..
|
||||
"dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]"
|
||||
|
||||
"label[0,3.35;" .. fgettext("Game") .. "]"..
|
||||
"textlist[0,3.85;5.8,"..gamelist_height..";games;" ..
|
||||
pkgmgr.gamelist() .. ";" .. gameidx .. ";false]" ..
|
||||
"container[0,4.5]" ..
|
||||
devtest_only ..
|
||||
"container_end[]" ..
|
||||
-- Warning if only devtest is installed
|
||||
if #pkgmgr.games == 1 and pkgmgr.games[1].id == "devtest" then
|
||||
retval = retval ..
|
||||
"container[0,3.5]" ..
|
||||
"box[0,0;5.8,1.7;#ff8800]" ..
|
||||
"textarea[0.4,0.1;6,1.8;;;"..
|
||||
fgettext("Development Test is meant for developers.") .. "]" ..
|
||||
"button[1,1;4,0.5;world_create_open_cdb;" .. fgettext("Install another game") .. "]" ..
|
||||
"container_end[]"
|
||||
end
|
||||
|
||||
retval = retval ..
|
||||
"container_end[]" ..
|
||||
|
||||
-- Right side
|
||||
@@ -356,13 +342,27 @@ end
|
||||
|
||||
local function create_world_buttonhandler(this, fields)
|
||||
|
||||
if fields["world_create_open_cdb"] then
|
||||
local dlg = create_store_dlg("game")
|
||||
dlg:set_parent(this.parent)
|
||||
this:delete()
|
||||
this.parent:hide()
|
||||
dlg:show()
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["world_create_confirm"] or
|
||||
fields["key_enter"] then
|
||||
|
||||
local worldname = fields["te_world_name"]
|
||||
local gameindex = core.get_textlist_index("games")
|
||||
local game, gameindex = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))
|
||||
|
||||
if gameindex ~= nil then
|
||||
local message
|
||||
if game == nil then
|
||||
message = fgettext("No game selected")
|
||||
end
|
||||
|
||||
if message == nil then
|
||||
-- For unnamed worlds use the generated name 'world<number>',
|
||||
-- where the number increments: it is set to 1 larger than the largest
|
||||
-- generated name number found.
|
||||
@@ -377,36 +377,46 @@ local function create_world_buttonhandler(this, fields)
|
||||
worldname = "world" .. worldnum_max + 1
|
||||
end
|
||||
|
||||
core.settings:set("fixed_map_seed", fields["te_seed"])
|
||||
|
||||
local message
|
||||
if not menudata.worldlist:uid_exists_raw(worldname) then
|
||||
core.settings:set("mg_name",fields["dd_mapgen"])
|
||||
message = core.create_world(worldname,gameindex)
|
||||
else
|
||||
if menudata.worldlist:uid_exists_raw(worldname) then
|
||||
message = fgettext("A world named \"$1\" already exists", worldname)
|
||||
end
|
||||
|
||||
if message ~= nil then
|
||||
gamedata.errormessage = message
|
||||
else
|
||||
core.settings:set("menu_last_game",pkgmgr.games[gameindex].id)
|
||||
if this.data.update_worldlist_filter then
|
||||
menudata.worldlist:set_filtercriteria(pkgmgr.games[gameindex].id)
|
||||
mm_texture.update("singleplayer", pkgmgr.games[gameindex].id)
|
||||
end
|
||||
menudata.worldlist:refresh()
|
||||
core.settings:set("mainmenu_last_selected_world",
|
||||
menudata.worldlist:raw_index_by_uid(worldname))
|
||||
end
|
||||
else
|
||||
gamedata.errormessage = fgettext("No game selected")
|
||||
end
|
||||
|
||||
if message == nil then
|
||||
this.data.seed = fields["te_seed"] or ""
|
||||
this.data.mg = fields["dd_mapgen"]
|
||||
|
||||
-- actual names as used by engine
|
||||
local settings = {
|
||||
fixed_map_seed = this.data.seed,
|
||||
mg_name = this.data.mg,
|
||||
mg_flags = table_to_flags(this.data.flags.main),
|
||||
mgv5_spflags = table_to_flags(this.data.flags.v5),
|
||||
mgv6_spflags = table_to_flags(this.data.flags.v6),
|
||||
mgv7_spflags = table_to_flags(this.data.flags.v7),
|
||||
mgfractal_spflags = table_to_flags(this.data.flags.fractal),
|
||||
mgcarpathian_spflags = table_to_flags(this.data.flags.carpathian),
|
||||
mgvalleys_spflags = table_to_flags(this.data.flags.valleys),
|
||||
mgflat_spflags = table_to_flags(this.data.flags.flat),
|
||||
}
|
||||
message = core.create_world(worldname, gameindex, settings)
|
||||
end
|
||||
|
||||
if message == nil then
|
||||
core.settings:set("menu_last_game", game.id)
|
||||
menudata.worldlist:set_filtercriteria(game.id)
|
||||
menudata.worldlist:refresh()
|
||||
core.settings:set("mainmenu_last_selected_world",
|
||||
menudata.worldlist:raw_index_by_uid(worldname))
|
||||
end
|
||||
|
||||
gamedata.errormessage = message
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
|
||||
worldname = fields.te_world_name
|
||||
this.data.worldname = fields["te_world_name"]
|
||||
this.data.seed = fields["te_seed"] or ""
|
||||
|
||||
if fields["games"] then
|
||||
local gameindex = core.get_textlist_index("games")
|
||||
@@ -417,22 +427,11 @@ local function create_world_buttonhandler(this, fields)
|
||||
for k,v in pairs(fields) do
|
||||
local split = string.split(k, "_", nil, 3)
|
||||
if split and split[1] == "flag" then
|
||||
local setting
|
||||
if split[2] == "mg" then
|
||||
setting = "mg_flags"
|
||||
else
|
||||
setting = split[2].."_spflags"
|
||||
end
|
||||
-- We replaced the underscore of flag names with a dash.
|
||||
local flag = string.gsub(split[3], "-", "_")
|
||||
local ftable = core.settings:get_flags(setting)
|
||||
if v == "true" then
|
||||
ftable[flag] = true
|
||||
else
|
||||
ftable[flag] = false
|
||||
end
|
||||
local flags = table_to_flags(ftable)
|
||||
core.settings:set(setting, flags)
|
||||
local ftable = this.data.flags[split[2]]
|
||||
assert(ftable)
|
||||
ftable[flag] = v == "true"
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -446,18 +445,16 @@ local function create_world_buttonhandler(this, fields)
|
||||
local entry = core.formspec_escape(fields["mgv6_biomes"])
|
||||
for b=1, #mgv6_biomes do
|
||||
if entry == mgv6_biomes[b][1] then
|
||||
local ftable = core.settings:get_flags("mgv6_spflags")
|
||||
local ftable = this.data.flags.v6
|
||||
ftable.jungles = mgv6_biomes[b][2].jungles
|
||||
ftable.snowbiomes = mgv6_biomes[b][2].snowbiomes
|
||||
local flags = table_to_flags(ftable)
|
||||
core.settings:set("mgv6_spflags", flags)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if fields["dd_mapgen"] then
|
||||
core.settings:set("mg_name", fields["dd_mapgen"])
|
||||
this.data.mg = fields["dd_mapgen"]
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -465,13 +462,27 @@ local function create_world_buttonhandler(this, fields)
|
||||
end
|
||||
|
||||
|
||||
function create_create_world_dlg(update_worldlistfilter)
|
||||
worldname = ""
|
||||
function create_create_world_dlg()
|
||||
local retval = dialog_create("sp_create_world",
|
||||
create_world_formspec,
|
||||
create_world_buttonhandler,
|
||||
nil)
|
||||
retval.update_worldlist_filter = update_worldlistfilter
|
||||
retval.data = {
|
||||
worldname = "",
|
||||
-- settings the world is created with:
|
||||
seed = core.settings:get("fixed_map_seed") or "",
|
||||
mg = core.settings:get("mg_name"),
|
||||
flags = {
|
||||
main = core.settings:get_flags("mg_flags"),
|
||||
v5 = core.settings:get_flags("mgv5_spflags"),
|
||||
v6 = core.settings:get_flags("mgv6_spflags"),
|
||||
v7 = core.settings:get_flags("mgv7_spflags"),
|
||||
fractal = core.settings:get_flags("mgfractal_spflags"),
|
||||
carpathian = core.settings:get_flags("mgcarpathian_spflags"),
|
||||
valleys = core.settings:get_flags("mgvalleys_spflags"),
|
||||
flat = core.settings:get_flags("mgflat_spflags"),
|
||||
}
|
||||
}
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
@@ -18,15 +18,10 @@
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local function delete_content_formspec(dialogdata)
|
||||
local retval =
|
||||
"size[11.5,4.5,true]" ..
|
||||
"label[2,2;" ..
|
||||
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.content.name) .. "]"..
|
||||
"style[dlg_delete_content_confirm;bgcolor=red]" ..
|
||||
"button[3.25,3.5;2.5,0.5;dlg_delete_content_confirm;" .. fgettext("Delete") .. "]" ..
|
||||
"button[5.75,3.5;2.5,0.5;dlg_delete_content_cancel;" .. fgettext("Cancel") .. "]"
|
||||
|
||||
return retval
|
||||
return confirmation_formspec(
|
||||
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.content.name),
|
||||
'dlg_delete_content_confirm', fgettext("Delete"),
|
||||
'dlg_delete_content_cancel', fgettext("Cancel"))
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -17,14 +17,10 @@
|
||||
|
||||
|
||||
local function delete_world_formspec(dialogdata)
|
||||
local retval =
|
||||
"size[10,2.5,true]" ..
|
||||
"label[0.5,0.5;" ..
|
||||
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" ..
|
||||
"style[world_delete_confirm;bgcolor=red]" ..
|
||||
"button[0.5,1.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
|
||||
"button[7.0,1.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
|
||||
return retval
|
||||
return confirmation_formspec(
|
||||
fgettext("Delete World \"$1\"?", dialogdata.delete_name),
|
||||
'world_delete_confirm', fgettext("Delete"),
|
||||
'world_delete_cancel', fgettext("Cancel"))
|
||||
end
|
||||
|
||||
local function delete_world_buttonhandler(this, fields)
|
||||
|
||||
123
builtin/mainmenu/dlg_register.lua
Normal file
123
builtin/mainmenu/dlg_register.lua
Normal file
@@ -0,0 +1,123 @@
|
||||
--Minetest
|
||||
--Copyright (C) 2022 rubenwardy
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local function register_formspec(dialogdata)
|
||||
local title = fgettext("Joining $1", dialogdata.server and dialogdata.server.name or dialogdata.address)
|
||||
local buttons_y = 4 + 1.3
|
||||
if dialogdata.error then
|
||||
buttons_y = buttons_y + 0.8
|
||||
end
|
||||
|
||||
local retval = {
|
||||
"formspec_version[4]",
|
||||
"size[8,", tostring(buttons_y + 1.175), "]",
|
||||
"set_focus[", (dialogdata.name ~= "" and "password" or "name"), "]",
|
||||
"label[0.375,0.8;", title, "]",
|
||||
"field[0.375,1.575;7.25,0.8;name;", core.formspec_escape(fgettext("Name")), ";",
|
||||
core.formspec_escape(dialogdata.name), "]",
|
||||
"pwdfield[0.375,2.875;7.25,0.8;password;", core.formspec_escape(fgettext("Password")), "]",
|
||||
"pwdfield[0.375,4.175;7.25,0.8;password_2;", core.formspec_escape(fgettext("Confirm Password")), "]"
|
||||
}
|
||||
|
||||
if dialogdata.error then
|
||||
table.insert_all(retval, {
|
||||
"box[0.375,", tostring(buttons_y - 0.9), ";7.25,0.6;darkred]",
|
||||
"label[0.625,", tostring(buttons_y - 0.6), ";", core.formspec_escape(dialogdata.error), "]",
|
||||
})
|
||||
end
|
||||
|
||||
table.insert_all(retval, {
|
||||
"container[0.375,", tostring(buttons_y), "]",
|
||||
"button[0,0;2.5,0.8;dlg_register_confirm;", fgettext("Register"), "]",
|
||||
"button[4.75,0;2.5,0.8;dlg_register_cancel;", fgettext("Cancel"), "]",
|
||||
"container_end[]",
|
||||
})
|
||||
|
||||
return table.concat(retval, "")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function register_buttonhandler(this, fields)
|
||||
this.data.name = fields.name
|
||||
this.data.error = nil
|
||||
|
||||
if fields.dlg_register_confirm or fields.key_enter then
|
||||
if fields.name == "" then
|
||||
this.data.error = fgettext("Missing name")
|
||||
return true
|
||||
end
|
||||
if fields.password ~= fields.password_2 then
|
||||
this.data.error = fgettext("Passwords do not match")
|
||||
return true
|
||||
end
|
||||
|
||||
gamedata.playername = fields.name
|
||||
gamedata.password = fields.password
|
||||
gamedata.address = this.data.address
|
||||
gamedata.port = this.data.port
|
||||
gamedata.allow_login_or_register = "register"
|
||||
gamedata.selected_world = 0
|
||||
|
||||
assert(gamedata.address and gamedata.port)
|
||||
|
||||
local server = this.data.server
|
||||
if server then
|
||||
serverlistmgr.add_favorite(server)
|
||||
gamedata.servername = server.name
|
||||
gamedata.serverdescription = server.description
|
||||
else
|
||||
gamedata.servername = ""
|
||||
gamedata.serverdescription = ""
|
||||
|
||||
serverlistmgr.add_favorite({
|
||||
address = gamedata.address,
|
||||
port = gamedata.port,
|
||||
})
|
||||
end
|
||||
|
||||
core.settings:set("name", fields.name)
|
||||
core.settings:set("address", gamedata.address)
|
||||
core.settings:set("remote_port", gamedata.port)
|
||||
|
||||
core.start()
|
||||
end
|
||||
|
||||
if fields["dlg_register_cancel"] then
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function create_register_dialog(address, port, server)
|
||||
assert(address)
|
||||
assert(type(port) == "number")
|
||||
|
||||
local retval = dialog_create("dlg_register",
|
||||
register_formspec,
|
||||
register_buttonhandler,
|
||||
nil)
|
||||
retval.data.address = address
|
||||
retval.data.port = port
|
||||
retval.data.server = server
|
||||
retval.data.name = core.settings:get("name") or ""
|
||||
return retval
|
||||
end
|
||||
@@ -31,6 +31,10 @@ end
|
||||
|
||||
-- returns error message, or nil
|
||||
local function parse_setting_line(settings, line, read_all, base_level, allow_secure)
|
||||
|
||||
-- strip carriage returns (CR, /r)
|
||||
line = line:gsub("\r", "")
|
||||
|
||||
-- comment
|
||||
local comment = line:match("^#" .. CHAR_CLASSES.SPACE .. "*(.*)$")
|
||||
if comment then
|
||||
@@ -347,9 +351,9 @@ local function parse_config_file(read_all, parse_mods)
|
||||
local file = io.open(path, "r")
|
||||
if file then
|
||||
if not games_category_initialized then
|
||||
fgettext_ne("Games") -- not used, but needed for xgettext
|
||||
fgettext_ne("Content: Games") -- not used, but needed for xgettext
|
||||
table.insert(settings, {
|
||||
name = "Games",
|
||||
name = "Content: Games",
|
||||
level = 0,
|
||||
type = "category",
|
||||
})
|
||||
@@ -374,21 +378,52 @@ local function parse_config_file(read_all, parse_mods)
|
||||
-- Parse mods
|
||||
local mods_category_initialized = false
|
||||
local mods = {}
|
||||
get_mods(core.get_modpath(), mods)
|
||||
get_mods(core.get_modpath(), "mods", mods)
|
||||
for _, mod in ipairs(mods) do
|
||||
local path = mod.path .. DIR_DELIM .. FILENAME
|
||||
local file = io.open(path, "r")
|
||||
if file then
|
||||
if not mods_category_initialized then
|
||||
fgettext_ne("Mods") -- not used, but needed for xgettext
|
||||
fgettext_ne("Content: Mods") -- not used, but needed for xgettext
|
||||
table.insert(settings, {
|
||||
name = "Mods",
|
||||
name = "Content: Mods",
|
||||
level = 0,
|
||||
type = "category",
|
||||
})
|
||||
mods_category_initialized = true
|
||||
end
|
||||
|
||||
table.insert(settings, {
|
||||
name = mod.name,
|
||||
readable_name = mod.title,
|
||||
level = 1,
|
||||
type = "category",
|
||||
})
|
||||
|
||||
parse_single_file(file, path, read_all, settings, 2, false)
|
||||
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
-- Parse client mods
|
||||
local clientmods_category_initialized = false
|
||||
local clientmods = {}
|
||||
get_mods(core.get_clientmodpath(), "clientmods", clientmods)
|
||||
for _, mod in ipairs(clientmods) do
|
||||
local path = mod.path .. DIR_DELIM .. FILENAME
|
||||
local file = io.open(path, "r")
|
||||
if file then
|
||||
if not clientmods_category_initialized then
|
||||
fgettext_ne("Client Mods") -- not used, but needed for xgettext
|
||||
table.insert(settings, {
|
||||
name = "Client Mods",
|
||||
level = 0,
|
||||
type = "category",
|
||||
})
|
||||
clientmods_category_initialized = true
|
||||
end
|
||||
|
||||
table.insert(settings, {
|
||||
name = mod.name,
|
||||
level = 1,
|
||||
@@ -493,44 +528,40 @@ end
|
||||
|
||||
local function get_current_np_group(setting)
|
||||
local value = core.settings:get_np_group(setting.name)
|
||||
local t = {}
|
||||
if value == nil then
|
||||
t = setting.values
|
||||
else
|
||||
table.insert(t, value.offset)
|
||||
table.insert(t, value.scale)
|
||||
table.insert(t, value.spread.x)
|
||||
table.insert(t, value.spread.y)
|
||||
table.insert(t, value.spread.z)
|
||||
table.insert(t, value.seed)
|
||||
table.insert(t, value.octaves)
|
||||
table.insert(t, value.persistence)
|
||||
table.insert(t, value.lacunarity)
|
||||
table.insert(t, value.flags)
|
||||
return setting.values
|
||||
end
|
||||
return t
|
||||
local p = "%g"
|
||||
return {
|
||||
p:format(value.offset),
|
||||
p:format(value.scale),
|
||||
p:format(value.spread.x),
|
||||
p:format(value.spread.y),
|
||||
p:format(value.spread.z),
|
||||
p:format(value.seed),
|
||||
p:format(value.octaves),
|
||||
p:format(value.persistence),
|
||||
p:format(value.lacunarity),
|
||||
value.flags
|
||||
}
|
||||
end
|
||||
|
||||
local function get_current_np_group_as_string(setting)
|
||||
local value = core.settings:get_np_group(setting.name)
|
||||
local t
|
||||
if value == nil then
|
||||
t = setting.default
|
||||
else
|
||||
t = value.offset .. ", " ..
|
||||
value.scale .. ", (" ..
|
||||
value.spread.x .. ", " ..
|
||||
value.spread.y .. ", " ..
|
||||
value.spread.z .. "), " ..
|
||||
value.seed .. ", " ..
|
||||
value.octaves .. ", " ..
|
||||
value.persistence .. ", " ..
|
||||
value.lacunarity
|
||||
if value.flags ~= "" then
|
||||
t = t .. ", " .. value.flags
|
||||
end
|
||||
return setting.default
|
||||
end
|
||||
return t
|
||||
return ("%g, %g, (%g, %g, %g), %g, %g, %g, %g"):format(
|
||||
value.offset,
|
||||
value.scale,
|
||||
value.spread.x,
|
||||
value.spread.y,
|
||||
value.spread.z,
|
||||
value.seed,
|
||||
value.octaves,
|
||||
value.persistence,
|
||||
value.lacunarity
|
||||
) .. (value.flags ~= "" and (", " .. value.flags) or "")
|
||||
end
|
||||
|
||||
local checkboxes = {} -- handle checkboxes events
|
||||
@@ -620,7 +651,7 @@ local function create_change_setting_formspec(dialogdata)
|
||||
|
||||
-- Third row
|
||||
add_field(0.3, "te_octaves", fgettext("Octaves"), t[7])
|
||||
add_field(3.6, "te_persist", fgettext("Persistance"), t[8])
|
||||
add_field(3.6, "te_persist", fgettext("Persistence"), t[8])
|
||||
add_field(6.9, "te_lacun", fgettext("Lacunarity"), t[9])
|
||||
height = height + 1.1
|
||||
|
||||
@@ -663,7 +694,7 @@ local function create_change_setting_formspec(dialogdata)
|
||||
elseif setting.type == "v3f" then
|
||||
local val = get_current_value(setting)
|
||||
local v3f = {}
|
||||
for line in val:gmatch("[+-]?[%d.-e]+") do -- All numeric characters
|
||||
for line in val:gmatch("[+-]?[%d.+-eE]+") do -- All numeric characters
|
||||
table.insert(v3f, line)
|
||||
end
|
||||
|
||||
@@ -956,7 +987,7 @@ local function create_settings_formspec(tabview, _, tabdata)
|
||||
local current_level = 0
|
||||
for _, entry in ipairs(settings) do
|
||||
local name
|
||||
if not core.settings:get_bool("main_menu_technical_settings") and entry.readable_name then
|
||||
if not core.settings:get_bool("show_technical_names") and entry.readable_name then
|
||||
name = fgettext_ne(entry.readable_name)
|
||||
else
|
||||
name = entry.name
|
||||
@@ -997,7 +1028,7 @@ local function create_settings_formspec(tabview, _, tabdata)
|
||||
"button[10,4.9;2,1;btn_edit;" .. fgettext("Edit") .. "]" ..
|
||||
"button[7,4.9;3,1;btn_restore;" .. fgettext("Restore Default") .. "]" ..
|
||||
"checkbox[0,4.3;cb_tech_settings;" .. fgettext("Show technical names") .. ";"
|
||||
.. dump(core.settings:get_bool("main_menu_technical_settings")) .. "]"
|
||||
.. dump(core.settings:get_bool("show_technical_names")) .. "]"
|
||||
|
||||
return formspec
|
||||
end
|
||||
@@ -1080,7 +1111,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
end
|
||||
|
||||
if fields["cb_tech_settings"] then
|
||||
core.settings:set("main_menu_technical_settings", fields["cb_tech_settings"])
|
||||
core.settings:set("show_technical_names", fields["cb_tech_settings"])
|
||||
core.settings:write()
|
||||
core.update_formspec(this:get_formspec())
|
||||
return true
|
||||
|
||||
172
builtin/mainmenu/dlg_version_info.lua
Normal file
172
builtin/mainmenu/dlg_version_info.lua
Normal file
@@ -0,0 +1,172 @@
|
||||
--[[
|
||||
Minetest
|
||||
Copyright (C) 2018-2020 SmallJoker, 2022 rubenwardy
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
]]
|
||||
|
||||
if not core.get_http_api then
|
||||
function check_new_version()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local function version_info_formspec(data)
|
||||
local cur_ver = core.get_version()
|
||||
local title = fgettext("A new $1 version is available", cur_ver.project)
|
||||
local message =
|
||||
fgettext("Installed version: $1\nNew version: $2\n" ..
|
||||
"Visit $3 to find out how to get the newest version and stay up to date" ..
|
||||
" with features and bugfixes.",
|
||||
cur_ver.string, data.new_version or "", data.url or "")
|
||||
|
||||
local fs = {
|
||||
"formspec_version[3]",
|
||||
"size[12.8,7]",
|
||||
"style_type[label;textcolor=#0E0]",
|
||||
"label[0.5,0.8;", core.formspec_escape(title), "]",
|
||||
"textarea[0.4,1.6;12,3.4;;;",
|
||||
core.formspec_escape(message), "]",
|
||||
"container[0.4,5.8]",
|
||||
"button[0.0,0;4.0,0.8;version_check_visit;", fgettext("Visit website"), "]",
|
||||
"button[4.5,0;3.5,0.8;version_check_remind;", fgettext("Later"), "]",
|
||||
"button[8.5.5,0;3.5,0.8;version_check_never;", fgettext("Never"), "]",
|
||||
"container_end[]",
|
||||
}
|
||||
|
||||
return table.concat(fs, "")
|
||||
end
|
||||
|
||||
local function version_info_buttonhandler(this, fields)
|
||||
if fields.version_check_remind then
|
||||
-- Erase last known, user will be reminded again at next check
|
||||
core.settings:set("update_last_known", "")
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
if fields.version_check_never then
|
||||
core.settings:set("update_last_checked", "disabled")
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
if fields.version_check_visit then
|
||||
if type(this.data.url) == "string" then
|
||||
core.open_url(this.data.url)
|
||||
end
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local function create_version_info_dlg(new_version, url)
|
||||
assert(type(new_version) == "string")
|
||||
assert(type(url) == "string")
|
||||
|
||||
local retval = dialog_create("version_info",
|
||||
version_info_formspec,
|
||||
version_info_buttonhandler,
|
||||
nil)
|
||||
|
||||
retval.data.new_version = new_version
|
||||
retval.data.url = url
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
local function get_current_version_code()
|
||||
-- Format: Major.Minor.Patch
|
||||
-- Convert to MMMNNNPPP
|
||||
local cur_string = core.get_version().string
|
||||
local cur_major, cur_minor, cur_patch = cur_string:match("^(%d+).(%d+).(%d+)")
|
||||
|
||||
if not cur_patch then
|
||||
core.log("error", "Failed to parse version numbers (invalid tag format?)")
|
||||
return
|
||||
end
|
||||
|
||||
return (cur_major * 1000 + cur_minor) * 1000 + cur_patch
|
||||
end
|
||||
|
||||
local function on_version_info_received(json)
|
||||
local maintab = ui.find_by_name("maintab")
|
||||
if maintab.hidden then
|
||||
-- Another dialog is open, abort.
|
||||
return
|
||||
end
|
||||
|
||||
local known_update = tonumber(core.settings:get("update_last_known")) or 0
|
||||
|
||||
-- Format: MMNNPPP (Major, Minor, Patch)
|
||||
local new_number = type(json.latest) == "table" and json.latest.version_code
|
||||
if type(new_number) ~= "number" then
|
||||
core.log("error", "Failed to read version number (invalid response?)")
|
||||
return
|
||||
end
|
||||
|
||||
local cur_number = get_current_version_code()
|
||||
if new_number <= known_update or new_number < cur_number then
|
||||
return
|
||||
end
|
||||
|
||||
-- Also consider updating from 1.2.3-dev to 1.2.3
|
||||
if new_number == cur_number and not core.get_version().is_dev then
|
||||
return
|
||||
end
|
||||
|
||||
core.settings:set("update_last_known", tostring(new_number))
|
||||
|
||||
-- Show version info dialog (once)
|
||||
maintab:hide()
|
||||
|
||||
local version_info_dlg = create_version_info_dlg(json.latest.version, json.latest.url)
|
||||
version_info_dlg:set_parent(maintab)
|
||||
version_info_dlg:show()
|
||||
|
||||
ui.update()
|
||||
end
|
||||
|
||||
function check_new_version()
|
||||
local url = core.settings:get("update_information_url")
|
||||
if core.settings:get("update_last_checked") == "disabled" or
|
||||
url == "" then
|
||||
-- Never show any updates
|
||||
return
|
||||
end
|
||||
|
||||
local time_now = os.time()
|
||||
local time_checked = tonumber(core.settings:get("update_last_checked")) or 0
|
||||
if time_now - time_checked < 2 * 24 * 3600 then
|
||||
-- Check interval of 2 entire days
|
||||
return
|
||||
end
|
||||
|
||||
core.settings:set("update_last_checked", tostring(time_now))
|
||||
|
||||
core.handle_async(function(params)
|
||||
local http = core.get_http_api()
|
||||
return http.fetch_sync(params)
|
||||
end, { url = url }, function(result)
|
||||
local json = result.succeeded and core.parse_json(result.data)
|
||||
if type(json) ~= "table" or not json.latest then
|
||||
core.log("error", "Failed to read JSON output from " .. url ..
|
||||
", status code = " .. result.code)
|
||||
return
|
||||
end
|
||||
|
||||
on_version_info_received(json)
|
||||
end)
|
||||
end
|
||||
@@ -16,23 +16,25 @@
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
mm_texture = {}
|
||||
mm_game_theme = {}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_texture.init()
|
||||
mm_texture.defaulttexturedir = core.get_texturepath() .. DIR_DELIM .. "base" ..
|
||||
function mm_game_theme.init()
|
||||
mm_game_theme.defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
|
||||
DIR_DELIM .. "pack" .. DIR_DELIM
|
||||
mm_texture.basetexturedir = mm_texture.defaulttexturedir
|
||||
mm_game_theme.basetexturedir = mm_game_theme.defaulttexturedir
|
||||
|
||||
mm_texture.texturepack = core.settings:get("texture_path")
|
||||
mm_game_theme.texturepack = core.settings:get("texture_path")
|
||||
|
||||
mm_texture.gameid = nil
|
||||
mm_game_theme.gameid = nil
|
||||
|
||||
mm_game_theme.music_handle = nil
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_texture.update(tab,gamedetails)
|
||||
function mm_game_theme.update(tab,gamedetails)
|
||||
if tab ~= "singleplayer" then
|
||||
mm_texture.reset()
|
||||
mm_game_theme.reset()
|
||||
return
|
||||
end
|
||||
|
||||
@@ -40,50 +42,54 @@ function mm_texture.update(tab,gamedetails)
|
||||
return
|
||||
end
|
||||
|
||||
mm_texture.update_game(gamedetails)
|
||||
mm_game_theme.update_game(gamedetails)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_texture.reset()
|
||||
mm_texture.gameid = nil
|
||||
function mm_game_theme.reset()
|
||||
mm_game_theme.gameid = nil
|
||||
local have_bg = false
|
||||
local have_overlay = mm_texture.set_generic("overlay")
|
||||
local have_overlay = mm_game_theme.set_generic("overlay")
|
||||
|
||||
if not have_overlay then
|
||||
have_bg = mm_texture.set_generic("background")
|
||||
have_bg = mm_game_theme.set_generic("background")
|
||||
end
|
||||
|
||||
mm_texture.clear("header")
|
||||
mm_texture.clear("footer")
|
||||
mm_game_theme.clear("header")
|
||||
mm_game_theme.clear("footer")
|
||||
core.set_clouds(false)
|
||||
|
||||
mm_texture.set_generic("footer")
|
||||
mm_texture.set_generic("header")
|
||||
mm_game_theme.set_generic("footer")
|
||||
mm_game_theme.set_generic("header")
|
||||
|
||||
if not have_bg then
|
||||
if core.settings:get_bool("menu_clouds") then
|
||||
core.set_clouds(true)
|
||||
else
|
||||
mm_texture.set_dirt_bg()
|
||||
mm_game_theme.set_dirt_bg()
|
||||
end
|
||||
end
|
||||
|
||||
if mm_game_theme.music_handle ~= nil then
|
||||
core.sound_stop(mm_game_theme.music_handle)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_texture.update_game(gamedetails)
|
||||
if mm_texture.gameid == gamedetails.id then
|
||||
function mm_game_theme.update_game(gamedetails)
|
||||
if mm_game_theme.gameid == gamedetails.id then
|
||||
return
|
||||
end
|
||||
|
||||
local have_bg = false
|
||||
local have_overlay = mm_texture.set_game("overlay",gamedetails)
|
||||
local have_overlay = mm_game_theme.set_game("overlay",gamedetails)
|
||||
|
||||
if not have_overlay then
|
||||
have_bg = mm_texture.set_game("background",gamedetails)
|
||||
have_bg = mm_game_theme.set_game("background",gamedetails)
|
||||
end
|
||||
|
||||
mm_texture.clear("header")
|
||||
mm_texture.clear("footer")
|
||||
mm_game_theme.clear("header")
|
||||
mm_game_theme.clear("footer")
|
||||
core.set_clouds(false)
|
||||
|
||||
if not have_bg then
|
||||
@@ -91,34 +97,34 @@ function mm_texture.update_game(gamedetails)
|
||||
if core.settings:get_bool("menu_clouds") then
|
||||
core.set_clouds(true)
|
||||
else
|
||||
mm_texture.set_dirt_bg()
|
||||
mm_game_theme.set_dirt_bg()
|
||||
end
|
||||
end
|
||||
|
||||
mm_texture.set_game("footer",gamedetails)
|
||||
mm_texture.set_game("header",gamedetails)
|
||||
mm_game_theme.set_game("footer",gamedetails)
|
||||
mm_game_theme.set_game("header",gamedetails)
|
||||
|
||||
mm_texture.gameid = gamedetails.id
|
||||
mm_game_theme.gameid = gamedetails.id
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_texture.clear(identifier)
|
||||
function mm_game_theme.clear(identifier)
|
||||
core.set_background(identifier,"")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_texture.set_generic(identifier)
|
||||
function mm_game_theme.set_generic(identifier)
|
||||
--try texture pack first
|
||||
if mm_texture.texturepack ~= nil then
|
||||
local path = mm_texture.texturepack .. DIR_DELIM .."menu_" ..
|
||||
if mm_game_theme.texturepack ~= nil then
|
||||
local path = mm_game_theme.texturepack .. DIR_DELIM .."menu_" ..
|
||||
identifier .. ".png"
|
||||
if core.set_background(identifier,path) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if mm_texture.defaulttexturedir ~= nil then
|
||||
local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
|
||||
if mm_game_theme.defaulttexturedir ~= nil then
|
||||
local path = mm_game_theme.defaulttexturedir .. DIR_DELIM .."menu_" ..
|
||||
identifier .. ".png"
|
||||
if core.set_background(identifier,path) then
|
||||
return true
|
||||
@@ -129,14 +135,16 @@ function mm_texture.set_generic(identifier)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_texture.set_game(identifier, gamedetails)
|
||||
function mm_game_theme.set_game(identifier, gamedetails)
|
||||
|
||||
if gamedetails == nil then
|
||||
return false
|
||||
end
|
||||
|
||||
if mm_texture.texturepack ~= nil then
|
||||
local path = mm_texture.texturepack .. DIR_DELIM ..
|
||||
mm_game_theme.set_music(gamedetails)
|
||||
|
||||
if mm_game_theme.texturepack ~= nil then
|
||||
local path = mm_game_theme.texturepack .. DIR_DELIM ..
|
||||
gamedetails.id .. "_menu_" .. identifier .. ".png"
|
||||
if core.set_background(identifier, path) then
|
||||
return true
|
||||
@@ -171,9 +179,10 @@ function mm_texture.set_game(identifier, gamedetails)
|
||||
return false
|
||||
end
|
||||
|
||||
function mm_texture.set_dirt_bg()
|
||||
if mm_texture.texturepack ~= nil then
|
||||
local path = mm_texture.texturepack .. DIR_DELIM .."default_dirt.png"
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_game_theme.set_dirt_bg()
|
||||
if mm_game_theme.texturepack ~= nil then
|
||||
local path = mm_game_theme.texturepack .. DIR_DELIM .."default_dirt.png"
|
||||
if core.set_background("background", path, true, 128) then
|
||||
return true
|
||||
end
|
||||
@@ -183,3 +192,12 @@ function mm_texture.set_dirt_bg()
|
||||
local minimalpath = defaulttexturedir .. "menu_bg.png"
|
||||
core.set_background("background", minimalpath, true, 128)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_game_theme.set_music(gamedetails)
|
||||
if mm_game_theme.music_handle ~= nil then
|
||||
core.sound_stop(mm_game_theme.music_handle)
|
||||
end
|
||||
local music_path = gamedetails.path .. DIR_DELIM .. "menu" .. DIR_DELIM .. "theme"
|
||||
mm_game_theme.music_handle = core.sound_play(music_path, true)
|
||||
end
|
||||
@@ -31,7 +31,7 @@ local group_format_template = [[
|
||||
# octaves = %s,
|
||||
# persistence = %s,
|
||||
# lacunarity = %s,
|
||||
# flags = %s
|
||||
# flags =%s
|
||||
# }
|
||||
|
||||
]]
|
||||
@@ -55,7 +55,11 @@ local function create_minetest_conf_example()
|
||||
end
|
||||
if entry.comment ~= "" then
|
||||
for _, comment_line in ipairs(entry.comment:split("\n", true)) do
|
||||
insert(result, "# " .. comment_line .. "\n")
|
||||
if comment_line == "" then
|
||||
insert(result, "#\n")
|
||||
else
|
||||
insert(result, "# " .. comment_line .. "\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
insert(result, "# type: " .. entry.type)
|
||||
@@ -73,10 +77,14 @@ local function create_minetest_conf_example()
|
||||
end
|
||||
insert(result, "\n")
|
||||
if group_format == true then
|
||||
local flags = entry.values[10]
|
||||
if flags ~= "" then
|
||||
flags = " "..flags
|
||||
end
|
||||
insert(result, sprintf(group_format_template, entry.name, entry.values[1],
|
||||
entry.values[2], entry.values[3], entry.values[4], entry.values[5],
|
||||
entry.values[6], entry.values[7], entry.values[8], entry.values[9],
|
||||
entry.values[10]))
|
||||
flags))
|
||||
else
|
||||
local append
|
||||
if entry.default ~= "" then
|
||||
@@ -91,7 +99,7 @@ end
|
||||
|
||||
local translation_file_header = [[
|
||||
// This file is automatically generated
|
||||
// It conatins a bunch of fake gettext calls, to tell xgettext about the strings in config files
|
||||
// It contains a bunch of fake gettext calls, to tell xgettext about the strings in config files
|
||||
// To update it, refer to the bottom of builtin/mainmenu/dlg_settings_advanced.lua
|
||||
|
||||
fake_function() {]]
|
||||
@@ -126,4 +134,3 @@ file = assert(io.open("src/settings_translation_file.cpp", "w"))
|
||||
--file = assert(io.open("settings_translation_file.cpp", "w"))
|
||||
file:write(create_translation_file())
|
||||
file:close()
|
||||
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
|
||||
mt_color_grey = "#AAAAAA"
|
||||
mt_color_blue = "#6389FF"
|
||||
mt_color_lightblue = "#99CCFF"
|
||||
mt_color_green = "#72FF63"
|
||||
mt_color_dark_green = "#25C191"
|
||||
mt_color_orange = "#FF8800"
|
||||
mt_color_red = "#FF3300"
|
||||
|
||||
local menupath = core.get_mainmenu_path()
|
||||
local basepath = core.get_builtin_path()
|
||||
@@ -35,7 +37,7 @@ dofile(menupath .. DIR_DELIM .. "async_event.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "common.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "pkgmgr.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "serverlistmgr.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "textures.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "game_theme.lua")
|
||||
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
|
||||
@@ -43,13 +45,15 @@ dofile(menupath .. DIR_DELIM .. "dlg_contentstore.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_delete_content.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_register.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua")
|
||||
dofile(menupath .. DIR_DELIM .. "dlg_version_info.lua")
|
||||
|
||||
local tabs = {}
|
||||
|
||||
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
|
||||
tabs.content = dofile(menupath .. DIR_DELIM .. "tab_content.lua")
|
||||
tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
|
||||
tabs.about = dofile(menupath .. DIR_DELIM .. "tab_about.lua")
|
||||
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
|
||||
tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
|
||||
|
||||
@@ -87,10 +91,11 @@ local function init_globals()
|
||||
core.settings:set("menu_last_game", default_game)
|
||||
end
|
||||
|
||||
mm_texture.init()
|
||||
mm_game_theme.init()
|
||||
|
||||
-- Create main tabview
|
||||
local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0})
|
||||
-- note: size would be 15.5,7.1 in real coordinates mode
|
||||
|
||||
tv_main:set_autosave_tab(true)
|
||||
tv_main:add(tabs.local_game)
|
||||
@@ -98,7 +103,7 @@ local function init_globals()
|
||||
|
||||
tv_main:add(tabs.content)
|
||||
tv_main:add(tabs.settings)
|
||||
tv_main:add(tabs.credits)
|
||||
tv_main:add(tabs.about)
|
||||
|
||||
tv_main:set_global_event_handler(main_event_handler)
|
||||
tv_main:set_fixed_size(false)
|
||||
@@ -113,16 +118,14 @@ local function init_globals()
|
||||
if tv_main.current_tab == "local" then
|
||||
local game = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))
|
||||
if game == nil then
|
||||
mm_texture.reset()
|
||||
mm_game_theme.reset()
|
||||
end
|
||||
end
|
||||
|
||||
ui.set_default("maintab")
|
||||
check_new_version()
|
||||
tv_main:show()
|
||||
|
||||
ui.update()
|
||||
|
||||
core.sound_play("main_menu", true)
|
||||
end
|
||||
|
||||
init_globals()
|
||||
|
||||
@@ -78,34 +78,35 @@ local function load_texture_packs(txtpath, retval)
|
||||
|
||||
for _, item in ipairs(list) do
|
||||
if item ~= "base" then
|
||||
local name = item
|
||||
|
||||
local path = txtpath .. DIR_DELIM .. item .. DIR_DELIM
|
||||
if path == current_texture_path then
|
||||
name = fgettext("$1 (Enabled)", name)
|
||||
end
|
||||
|
||||
local conf = Settings(path .. "texture_pack.conf")
|
||||
local enabled = path == current_texture_path
|
||||
|
||||
local title = conf:get("title") or item
|
||||
|
||||
-- list_* is only used if non-nil, else the regular versions are used.
|
||||
retval[#retval + 1] = {
|
||||
name = item,
|
||||
title = title,
|
||||
list_name = enabled and fgettext("$1 (Enabled)", item) or nil,
|
||||
list_title = enabled and fgettext("$1 (Enabled)", title) or nil,
|
||||
author = conf:get("author"),
|
||||
release = tonumber(conf:get("release")) or 0,
|
||||
list_name = name,
|
||||
type = "txp",
|
||||
path = path,
|
||||
enabled = path == current_texture_path,
|
||||
enabled = enabled,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function get_mods(path,retval,modpack)
|
||||
function get_mods(path, virtual_path, retval, modpack)
|
||||
local mods = core.get_dir_list(path, true)
|
||||
|
||||
for _, name in ipairs(mods) do
|
||||
if name:sub(1, 1) ~= "." then
|
||||
local prefix = path .. DIR_DELIM .. name
|
||||
local mod_path = path .. DIR_DELIM .. name
|
||||
local mod_virtual_path = virtual_path .. "/" .. name
|
||||
local toadd = {
|
||||
dir_name = name,
|
||||
parent_dir = path,
|
||||
@@ -114,18 +115,18 @@ function get_mods(path,retval,modpack)
|
||||
|
||||
-- Get config file
|
||||
local mod_conf
|
||||
local modpack_conf = io.open(prefix .. DIR_DELIM .. "modpack.conf")
|
||||
local modpack_conf = io.open(mod_path .. DIR_DELIM .. "modpack.conf")
|
||||
if modpack_conf then
|
||||
toadd.is_modpack = true
|
||||
modpack_conf:close()
|
||||
|
||||
mod_conf = Settings(prefix .. DIR_DELIM .. "modpack.conf"):to_table()
|
||||
mod_conf = Settings(mod_path .. DIR_DELIM .. "modpack.conf"):to_table()
|
||||
if mod_conf.name then
|
||||
name = mod_conf.name
|
||||
toadd.is_name_explicit = true
|
||||
end
|
||||
else
|
||||
mod_conf = Settings(prefix .. DIR_DELIM .. "mod.conf"):to_table()
|
||||
mod_conf = Settings(mod_path .. DIR_DELIM .. "mod.conf"):to_table()
|
||||
if mod_conf.name then
|
||||
name = mod_conf.name
|
||||
toadd.is_name_explicit = true
|
||||
@@ -134,14 +135,16 @@ function get_mods(path,retval,modpack)
|
||||
|
||||
-- Read from config
|
||||
toadd.name = name
|
||||
toadd.title = mod_conf.title
|
||||
toadd.author = mod_conf.author
|
||||
toadd.release = tonumber(mod_conf.release) or 0
|
||||
toadd.path = prefix
|
||||
toadd.path = mod_path
|
||||
toadd.virtual_path = mod_virtual_path
|
||||
toadd.type = "mod"
|
||||
|
||||
-- Check modpack.txt
|
||||
-- Note: modpack.conf is already checked above
|
||||
local modpackfile = io.open(prefix .. DIR_DELIM .. "modpack.txt")
|
||||
local modpackfile = io.open(mod_path .. DIR_DELIM .. "modpack.txt")
|
||||
if modpackfile then
|
||||
modpackfile:close()
|
||||
toadd.is_modpack = true
|
||||
@@ -153,7 +156,7 @@ function get_mods(path,retval,modpack)
|
||||
elseif toadd.is_modpack then
|
||||
toadd.type = "modpack"
|
||||
toadd.is_modpack = true
|
||||
get_mods(prefix, retval, name)
|
||||
get_mods(mod_path, mod_virtual_path, retval, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -181,21 +184,6 @@ function pkgmgr.get_texture_packs()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function pkgmgr.extract(modfile)
|
||||
if modfile.type == "zip" then
|
||||
local tempfolder = os.tempfolder()
|
||||
|
||||
if tempfolder ~= nil and
|
||||
tempfolder ~= "" then
|
||||
core.create_dir(tempfolder)
|
||||
if core.extract_zip(modfile.name,tempfolder) then
|
||||
return tempfolder
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function pkgmgr.get_folder_type(path)
|
||||
local testfile = io.open(path .. DIR_DELIM .. "init.lua","r")
|
||||
if testfile ~= nil then
|
||||
@@ -349,7 +337,7 @@ function pkgmgr.identify_modname(modpath,filename)
|
||||
return nil
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
function pkgmgr.render_packagelist(render_list)
|
||||
function pkgmgr.render_packagelist(render_list, use_technical_names, with_error)
|
||||
if not render_list then
|
||||
if not pkgmgr.global_mods then
|
||||
pkgmgr.refresh_globals()
|
||||
@@ -361,31 +349,75 @@ function pkgmgr.render_packagelist(render_list)
|
||||
local retval = {}
|
||||
for i, v in ipairs(list) do
|
||||
local color = ""
|
||||
local icon = 0
|
||||
local error = with_error and with_error[v.virtual_path]
|
||||
local function update_error(val)
|
||||
if val and (not error or (error.type == "warning" and val.type == "error")) then
|
||||
error = val
|
||||
end
|
||||
end
|
||||
|
||||
if v.is_modpack then
|
||||
local rawlist = render_list:get_raw_list()
|
||||
color = mt_color_dark_green
|
||||
|
||||
for j = 1, #rawlist, 1 do
|
||||
if rawlist[j].modpack == list[i].name and
|
||||
not rawlist[j].enabled then
|
||||
-- Modpack not entirely enabled so showing as grey
|
||||
color = mt_color_grey
|
||||
break
|
||||
for j = 1, #rawlist do
|
||||
if rawlist[j].modpack == list[i].name then
|
||||
if with_error then
|
||||
update_error(with_error[rawlist[j].virtual_path])
|
||||
end
|
||||
|
||||
if rawlist[j].enabled then
|
||||
icon = 1
|
||||
else
|
||||
-- Modpack not entirely enabled so showing as grey
|
||||
color = mt_color_grey
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif v.is_game_content or v.type == "game" then
|
||||
icon = 1
|
||||
color = mt_color_blue
|
||||
|
||||
local rawlist = render_list:get_raw_list()
|
||||
if v.type == "game" and with_error then
|
||||
for j = 1, #rawlist do
|
||||
if rawlist[j].is_game_content then
|
||||
update_error(with_error[rawlist[j].virtual_path])
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif v.enabled or v.type == "txp" then
|
||||
icon = 1
|
||||
color = mt_color_green
|
||||
end
|
||||
|
||||
if error then
|
||||
if error.type == "warning" then
|
||||
color = mt_color_orange
|
||||
icon = 2
|
||||
else
|
||||
color = mt_color_red
|
||||
icon = 3
|
||||
end
|
||||
end
|
||||
|
||||
retval[#retval + 1] = color
|
||||
if v.modpack ~= nil or v.loc == "game" then
|
||||
retval[#retval + 1] = "1"
|
||||
else
|
||||
retval[#retval + 1] = "0"
|
||||
end
|
||||
retval[#retval + 1] = core.formspec_escape(v.list_name or v.name)
|
||||
|
||||
if with_error then
|
||||
retval[#retval + 1] = icon
|
||||
end
|
||||
|
||||
if use_technical_names then
|
||||
retval[#retval + 1] = core.formspec_escape(v.list_name or v.name)
|
||||
else
|
||||
retval[#retval + 1] = core.formspec_escape(v.list_title or v.list_name or v.title or v.name)
|
||||
end
|
||||
end
|
||||
|
||||
return table.concat(retval, ",")
|
||||
@@ -412,6 +444,14 @@ function pkgmgr.is_modpack_entirely_enabled(data, name)
|
||||
return true
|
||||
end
|
||||
|
||||
local function disable_all_by_name(list, name, except)
|
||||
for i=1, #list do
|
||||
if list[i].name == name and list[i] ~= except then
|
||||
list[i].enabled = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------- toggles or en/disables a mod or modpack and its dependencies --------
|
||||
local function toggle_mod_or_modpack(list, toggled_mods, enabled_mods, toset, mod)
|
||||
if not mod.is_modpack then
|
||||
@@ -420,13 +460,16 @@ local function toggle_mod_or_modpack(list, toggled_mods, enabled_mods, toset, mo
|
||||
toset = not mod.enabled
|
||||
end
|
||||
if mod.enabled ~= toset then
|
||||
mod.enabled = toset
|
||||
toggled_mods[#toggled_mods+1] = mod.name
|
||||
end
|
||||
if toset then
|
||||
-- Mark this mod for recursive dependency traversal
|
||||
enabled_mods[mod.name] = true
|
||||
|
||||
-- Disable other mods with the same name
|
||||
disable_all_by_name(list, mod.name, mod)
|
||||
end
|
||||
mod.enabled = toset
|
||||
else
|
||||
-- Toggle or en/disable every mod in the modpack,
|
||||
-- interleaved unsupported
|
||||
@@ -451,7 +494,7 @@ function pkgmgr.enable_mod(this, toset)
|
||||
local enabled_mods = {}
|
||||
toggle_mod_or_modpack(list, toggled_mods, enabled_mods, toset, mod)
|
||||
|
||||
if not toset then
|
||||
if next(enabled_mods) == nil then
|
||||
-- Mod(s) were disabled, so no dependencies need to be enabled
|
||||
table.sort(toggled_mods)
|
||||
core.log("info", "Following mods were disabled: " ..
|
||||
@@ -461,11 +504,16 @@ function pkgmgr.enable_mod(this, toset)
|
||||
|
||||
-- Enable mods' depends after activation
|
||||
|
||||
-- Make a list of mod ids indexed by their names
|
||||
-- Make a list of mod ids indexed by their names. Among mods with the
|
||||
-- same name, enabled mods take precedence, after which game mods take
|
||||
-- precedence, being last in the mod list.
|
||||
local mod_ids = {}
|
||||
for id, mod2 in pairs(list) do
|
||||
if mod2.type == "mod" and not mod2.is_modpack then
|
||||
mod_ids[mod2.name] = id
|
||||
local prev_id = mod_ids[mod2.name]
|
||||
if not prev_id or not list[prev_id].enabled then
|
||||
mod_ids[mod2.name] = id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -482,6 +530,7 @@ function pkgmgr.enable_mod(this, toset)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If sp is 0, every dependency is already activated
|
||||
while sp > 0 do
|
||||
local name = to_enable[sp]
|
||||
@@ -493,15 +542,15 @@ function pkgmgr.enable_mod(this, toset)
|
||||
if not mod_to_enable then
|
||||
core.log("warning", "Mod dependency \"" .. name ..
|
||||
"\" not found!")
|
||||
else
|
||||
if mod_to_enable.enabled == false then
|
||||
elseif not mod_to_enable.is_game_content then
|
||||
if not mod_to_enable.enabled then
|
||||
mod_to_enable.enabled = true
|
||||
toggled_mods[#toggled_mods+1] = mod_to_enable.name
|
||||
end
|
||||
-- Push the dependencies of the dependency onto the stack
|
||||
local depends = pkgmgr.get_dependencies(mod_to_enable.path)
|
||||
for i = 1, #depends do
|
||||
if not enabled_mods[name] then
|
||||
if not enabled_mods[depends[i]] then
|
||||
sp = sp+1
|
||||
to_enable[sp] = depends[i]
|
||||
end
|
||||
@@ -561,11 +610,10 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
|
||||
local from = basefolder and basefolder.path or path
|
||||
if targetpath then
|
||||
core.delete_dir(targetpath)
|
||||
core.create_dir(targetpath)
|
||||
else
|
||||
targetpath = core.get_texturepath() .. DIR_DELIM .. basename
|
||||
end
|
||||
if not core.copy_dir(from, targetpath) then
|
||||
if not core.copy_dir(from, targetpath, false) then
|
||||
return nil,
|
||||
fgettext("Failed to install $1 to $2", basename, targetpath)
|
||||
end
|
||||
@@ -586,7 +634,6 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
|
||||
-- Get destination name for modpack
|
||||
if targetpath then
|
||||
core.delete_dir(targetpath)
|
||||
core.create_dir(targetpath)
|
||||
else
|
||||
local clean_path = nil
|
||||
if basename ~= nil then
|
||||
@@ -610,7 +657,6 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
|
||||
|
||||
if targetpath then
|
||||
core.delete_dir(targetpath)
|
||||
core.create_dir(targetpath)
|
||||
else
|
||||
local targetfolder = basename
|
||||
if targetfolder == nil then
|
||||
@@ -636,14 +682,15 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
|
||||
|
||||
if targetpath then
|
||||
core.delete_dir(targetpath)
|
||||
core.create_dir(targetpath)
|
||||
else
|
||||
targetpath = core.get_gamepath() .. DIR_DELIM .. basename
|
||||
end
|
||||
else
|
||||
error("basefolder didn't return a recognised type, this shouldn't happen")
|
||||
end
|
||||
|
||||
-- Copy it
|
||||
if not core.copy_dir(basefolder.path, targetpath) then
|
||||
if not core.copy_dir(basefolder.path, targetpath, false) then
|
||||
return nil,
|
||||
fgettext("Failed to install $1 to $2", basename, targetpath)
|
||||
end
|
||||
@@ -657,23 +704,6 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
|
||||
return targetpath, nil
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function pkgmgr.install(type, modfilename, basename, dest)
|
||||
local archive_info = pkgmgr.identify_filetype(modfilename)
|
||||
local path = pkgmgr.extract(archive_info)
|
||||
|
||||
if path == nil then
|
||||
return nil,
|
||||
fgettext("Install: file: \"$1\"", archive_info.name) .. "\n" ..
|
||||
fgettext("Install: Unsupported file type \"$1\" or broken archive",
|
||||
archive_info.type)
|
||||
end
|
||||
|
||||
local targetpath, msg = pkgmgr.install_dir(type, path, basename, dest)
|
||||
core.delete_dir(path)
|
||||
return targetpath, msg
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function pkgmgr.preparemodlist(data)
|
||||
local retval = {}
|
||||
@@ -682,16 +712,15 @@ function pkgmgr.preparemodlist(data)
|
||||
local game_mods = {}
|
||||
|
||||
--read global mods
|
||||
local modpath = core.get_modpath()
|
||||
|
||||
if modpath ~= nil and
|
||||
modpath ~= "" then
|
||||
get_mods(modpath,global_mods)
|
||||
local modpaths = core.get_modpaths()
|
||||
for key, modpath in pairs(modpaths) do
|
||||
get_mods(modpath, key, global_mods)
|
||||
end
|
||||
|
||||
for i=1,#global_mods,1 do
|
||||
global_mods[i].type = "mod"
|
||||
global_mods[i].loc = "global"
|
||||
global_mods[i].enabled = false
|
||||
retval[#retval + 1] = global_mods[i]
|
||||
end
|
||||
|
||||
@@ -704,7 +733,7 @@ function pkgmgr.preparemodlist(data)
|
||||
retval[#retval + 1] = {
|
||||
type = "game",
|
||||
is_game_content = true,
|
||||
name = fgettext("$1 mods", gamespec.name),
|
||||
name = fgettext("$1 mods", gamespec.title),
|
||||
path = gamespec.path
|
||||
}
|
||||
end
|
||||
@@ -725,22 +754,37 @@ function pkgmgr.preparemodlist(data)
|
||||
DIR_DELIM .. "world.mt"
|
||||
|
||||
local worldfile = Settings(filename)
|
||||
|
||||
for key,value in pairs(worldfile:to_table()) do
|
||||
for key, value in pairs(worldfile:to_table()) do
|
||||
if key:sub(1, 9) == "load_mod_" then
|
||||
key = key:sub(10)
|
||||
local element = nil
|
||||
for i=1,#retval,1 do
|
||||
local mod_found = false
|
||||
|
||||
local fallback_found = false
|
||||
local fallback_mod = nil
|
||||
|
||||
for i=1, #retval do
|
||||
if retval[i].name == key and
|
||||
not retval[i].is_modpack then
|
||||
element = retval[i]
|
||||
break
|
||||
not retval[i].is_modpack then
|
||||
if core.is_yes(value) or retval[i].virtual_path == value then
|
||||
retval[i].enabled = true
|
||||
mod_found = true
|
||||
break
|
||||
elseif fallback_found then
|
||||
-- Only allow fallback if only one mod matches
|
||||
fallback_mod = nil
|
||||
else
|
||||
fallback_found = true
|
||||
fallback_mod = retval[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
if element ~= nil then
|
||||
element.enabled = value ~= "false" and value ~= "nil" and value
|
||||
else
|
||||
core.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
|
||||
|
||||
if not mod_found then
|
||||
if fallback_mod and value:find("/") then
|
||||
fallback_mod.enabled = true
|
||||
else
|
||||
core.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -819,45 +863,6 @@ function pkgmgr.refresh_globals()
|
||||
pkgmgr.global_mods:set_sortmode("alphabetic")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function pkgmgr.identify_filetype(name)
|
||||
|
||||
if name:sub(-3):lower() == "zip" then
|
||||
return {
|
||||
name = name,
|
||||
type = "zip"
|
||||
}
|
||||
end
|
||||
|
||||
if name:sub(-6):lower() == "tar.gz" or
|
||||
name:sub(-3):lower() == "tgz"then
|
||||
return {
|
||||
name = name,
|
||||
type = "tgz"
|
||||
}
|
||||
end
|
||||
|
||||
if name:sub(-6):lower() == "tar.bz2" then
|
||||
return {
|
||||
name = name,
|
||||
type = "tbz"
|
||||
}
|
||||
end
|
||||
|
||||
if name:sub(-2):lower() == "7z" then
|
||||
return {
|
||||
name = name,
|
||||
type = "7z"
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
name = name,
|
||||
type = "ukn"
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function pkgmgr.find_by_gameid(gameid)
|
||||
for i=1,#pkgmgr.games,1 do
|
||||
@@ -873,7 +878,7 @@ function pkgmgr.get_game_mods(gamespec, retval)
|
||||
if gamespec ~= nil and
|
||||
gamespec.gamemods_path ~= nil and
|
||||
gamespec.gamemods_path ~= "" then
|
||||
get_mods(gamespec.gamemods_path, retval)
|
||||
get_mods(gamespec.gamemods_path, ("games/%s/mods"):format(gamespec.id), retval)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -909,10 +914,10 @@ end
|
||||
function pkgmgr.gamelist()
|
||||
local retval = ""
|
||||
if #pkgmgr.games > 0 then
|
||||
retval = retval .. core.formspec_escape(pkgmgr.games[1].name)
|
||||
retval = retval .. core.formspec_escape(pkgmgr.games[1].title)
|
||||
|
||||
for i=2,#pkgmgr.games,1 do
|
||||
retval = retval .. "," .. core.formspec_escape(pkgmgr.games[i].name)
|
||||
retval = retval .. "," .. core.formspec_escape(pkgmgr.games[i].title)
|
||||
end
|
||||
end
|
||||
return retval
|
||||
|
||||
195
builtin/mainmenu/tab_about.lua
Normal file
195
builtin/mainmenu/tab_about.lua
Normal file
@@ -0,0 +1,195 @@
|
||||
--Minetest
|
||||
--Copyright (C) 2013 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
-- https://github.com/orgs/minetest/teams/engine/members
|
||||
|
||||
local core_developers = {
|
||||
"Perttu Ahola (celeron55) <celeron55@gmail.com> [Project founder]",
|
||||
"sfan5 <sfan5@live.de>",
|
||||
"ShadowNinja <shadowninja@minetest.net>",
|
||||
"Nathanaëlle Courant (Nore/Ekdohibs) <nore@mesecons.net>",
|
||||
"Loic Blot (nerzhul/nrz) <loic.blot@unix-experience.fr>",
|
||||
"Andrew Ward (rubenwardy) <rw@rubenwardy.com>",
|
||||
"Krock/SmallJoker <mk939@ymail.com>",
|
||||
"Lars Hofhansl <larsh@apache.org>",
|
||||
"v-rob <robinsonvincent89@gmail.com>",
|
||||
"hecks",
|
||||
"Hugues Ross <hugues.ross@gmail.com>",
|
||||
"Dmitry Kostenko (x2048) <codeforsmile@gmail.com>",
|
||||
}
|
||||
|
||||
local core_team = {
|
||||
"Zughy [Issue triager]",
|
||||
}
|
||||
|
||||
-- For updating active/previous contributors, see the script in ./util/gather_git_credits.py
|
||||
|
||||
local active_contributors = {
|
||||
"Wuzzy [Features, translations, devtest]",
|
||||
"Lars Müller [Lua optimizations and fixes]",
|
||||
"Jude Melton-Houghton [Optimizations, bugfixes]",
|
||||
"paradust7 [Performance, fixes, Irrlicht refactoring]",
|
||||
"Desour [Fixes]",
|
||||
"ROllerozxa [Main menu]",
|
||||
"savilli [Bugfixes]",
|
||||
"Lexi Hale [Particlespawner animation]",
|
||||
"Liso [Shadow Mapping]",
|
||||
"JosiahWI [Fixes, build system]",
|
||||
"numzero [Graphics and rendering]",
|
||||
"HybridDog [Fixes]",
|
||||
"NeroBurner [Joystick]",
|
||||
"pecksin [Clickable web links]",
|
||||
"Daroc Alden [Fixes]",
|
||||
"Jean-Patrick Guerrero (kilbith) [Fixes]",
|
||||
}
|
||||
|
||||
local previous_core_developers = {
|
||||
"BlockMen",
|
||||
"Maciej Kasatkin (RealBadAngel) [RIP]",
|
||||
"Lisa Milne (darkrose) <lisa@ltmnet.com>",
|
||||
"proller",
|
||||
"Ilya Zhuravlev (xyz) <xyz@minetest.net>",
|
||||
"PilzAdam <pilzadam@minetest.net>",
|
||||
"est31 <MTest31@outlook.com>",
|
||||
"kahrl <kahrl@gmx.net>",
|
||||
"Ryan Kwolek (kwolekr) <kwolekr@minetest.net>",
|
||||
"sapier",
|
||||
"Zeno",
|
||||
"Auke Kok (sofar) <sofar@foo-projects.org>",
|
||||
"Aaron Suen <warr1024@gmail.com>",
|
||||
"paramat",
|
||||
"Pierre-Yves Rollo <dev@pyrollo.com>",
|
||||
}
|
||||
|
||||
local previous_contributors = {
|
||||
"Nils Dagsson Moskopp (erlehmann) <nils@dieweltistgarnichtso.net> [Minetest logo]",
|
||||
"red-001 <red-001@outlook.ie>",
|
||||
"Giuseppe Bilotta",
|
||||
"ClobberXD",
|
||||
"Dániel Juhász (juhdanad) <juhdanad@gmail.com>",
|
||||
"MirceaKitsune <mirceakitsune@gmail.com>",
|
||||
"MoNTE48",
|
||||
"Constantin Wenger (SpeedProg)",
|
||||
"Ciaran Gultnieks (CiaranG)",
|
||||
"Paul Ouellette (pauloue)",
|
||||
"stujones11",
|
||||
"srifqi",
|
||||
"Rogier <rogier777@gmail.com>",
|
||||
"Gregory Currie (gregorycu)",
|
||||
"JacobF",
|
||||
"Jeija <jeija@mesecons.net>",
|
||||
}
|
||||
|
||||
local function prepare_credits(dest, source)
|
||||
for _, s in ipairs(source) do
|
||||
-- if there's text inside brackets make it gray-ish
|
||||
s = s:gsub("%[.-%]", core.colorize("#aaa", "%1"))
|
||||
dest[#dest+1] = s
|
||||
end
|
||||
end
|
||||
|
||||
local function build_hacky_list(items, spacing)
|
||||
spacing = spacing or 0.5
|
||||
local y = spacing / 2
|
||||
local ret = {}
|
||||
for _, item in ipairs(items) do
|
||||
if item ~= "" then
|
||||
ret[#ret+1] = ("label[0,%f;%s]"):format(y, core.formspec_escape(item))
|
||||
end
|
||||
y = y + spacing
|
||||
end
|
||||
return table.concat(ret, ""), y
|
||||
end
|
||||
|
||||
return {
|
||||
name = "about",
|
||||
caption = fgettext("About"),
|
||||
cbf_formspec = function(tabview, name, tabdata)
|
||||
local logofile = defaulttexturedir .. "logo.png"
|
||||
local version = core.get_version()
|
||||
|
||||
local credit_list = {}
|
||||
table.insert_all(credit_list, {
|
||||
core.colorize("#ff0", fgettext("Core Developers"))
|
||||
})
|
||||
prepare_credits(credit_list, core_developers)
|
||||
table.insert_all(credit_list, {
|
||||
"",
|
||||
core.colorize("#ff0", fgettext("Core Team"))
|
||||
})
|
||||
prepare_credits(credit_list, core_team)
|
||||
table.insert_all(credit_list, {
|
||||
"",
|
||||
core.colorize("#ff0", fgettext("Active Contributors"))
|
||||
})
|
||||
prepare_credits(credit_list, active_contributors)
|
||||
table.insert_all(credit_list, {
|
||||
"",
|
||||
core.colorize("#ff0", fgettext("Previous Core Developers"))
|
||||
})
|
||||
prepare_credits(credit_list, previous_core_developers)
|
||||
table.insert_all(credit_list, {
|
||||
"",
|
||||
core.colorize("#ff0", fgettext("Previous Contributors"))
|
||||
})
|
||||
prepare_credits(credit_list, previous_contributors)
|
||||
local credit_fs, scroll_height = build_hacky_list(credit_list)
|
||||
-- account for the visible portion
|
||||
scroll_height = math.max(0, scroll_height - 6.9)
|
||||
|
||||
local fs = "image[1.5,0.6;2.5,2.5;" .. core.formspec_escape(logofile) .. "]" ..
|
||||
"style[label_button;border=false]" ..
|
||||
"button[0.1,3.4;5.3,0.5;label_button;" ..
|
||||
core.formspec_escape(version.project .. " " .. version.string) .. "]" ..
|
||||
"button[1.5,4.1;2.5,0.8;homepage;minetest.net]" ..
|
||||
"scroll_container[5.5,0.1;9.5,6.9;scroll_credits;vertical;" ..
|
||||
tostring(scroll_height / 1000) .. "]" .. credit_fs ..
|
||||
"scroll_container_end[]"..
|
||||
"scrollbar[15,0.1;0.4,6.9;vertical;scroll_credits;0]"
|
||||
|
||||
-- Render information
|
||||
fs = fs .. "style[label_button2;border=false]" ..
|
||||
"button[0.1,6;5.3,1;label_button2;" ..
|
||||
fgettext("Active renderer:") .. "\n" ..
|
||||
core.formspec_escape(core.get_screen_info().render_info) .. "]"
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
fs = fs .. "button[0.5,5.1;4.5,0.8;share_debug;" .. fgettext("Share debug log") .. "]"
|
||||
else
|
||||
fs = fs .. "tooltip[userdata;" ..
|
||||
fgettext("Opens the directory that contains user-provided worlds, games, mods,\n" ..
|
||||
"and texture packs in a file manager / explorer.") .. "]"
|
||||
fs = fs .. "button[0.5,5.1;4.5,0.8;userdata;" .. fgettext("Open User Data Directory") .. "]"
|
||||
end
|
||||
|
||||
return fs, "size[15.5,7.1,false]real_coordinates[true]"
|
||||
end,
|
||||
cbf_button_handler = function(this, fields, name, tabdata)
|
||||
if fields.homepage then
|
||||
core.open_url("https://www.minetest.net")
|
||||
end
|
||||
|
||||
if fields.share_debug then
|
||||
local path = core.get_user_path() .. DIR_DELIM .. "debug.txt"
|
||||
core.share_file(path)
|
||||
end
|
||||
|
||||
if fields.userdata then
|
||||
core.open_dir(core.get_user_path())
|
||||
end
|
||||
end,
|
||||
}
|
||||
@@ -51,12 +51,14 @@ local function get_formspec(tabview, name, tabdata)
|
||||
tabdata.selected_pkg = 1
|
||||
end
|
||||
|
||||
local use_technical_names = core.settings:get_bool("show_technical_names")
|
||||
|
||||
|
||||
local retval =
|
||||
"label[0.05,-0.25;".. fgettext("Installed Packages:") .. "]" ..
|
||||
"tablecolumns[color;tree;text]" ..
|
||||
"table[0,0.25;5.1,4.3;pkglist;" ..
|
||||
pkgmgr.render_packagelist(packages) ..
|
||||
pkgmgr.render_packagelist(packages, use_technical_names) ..
|
||||
";" .. tabdata.selected_pkg .. "]" ..
|
||||
"button[0,4.85;5.25,0.5;btn_contentdb;".. fgettext("Browse online content") .. "]"
|
||||
|
||||
@@ -87,9 +89,17 @@ local function get_formspec(tabview, name, tabdata)
|
||||
desc = info.description
|
||||
end
|
||||
|
||||
local title_and_name
|
||||
if selected_pkg.type == "game" then
|
||||
title_and_name = selected_pkg.name
|
||||
else
|
||||
title_and_name = (selected_pkg.title or selected_pkg.name) .. "\n" ..
|
||||
core.colorize("#BFBFBF", selected_pkg.name)
|
||||
end
|
||||
|
||||
retval = retval ..
|
||||
"image[5.5,0;3,2;" .. core.formspec_escape(modscreenshot) .. "]" ..
|
||||
"label[8.25,0.6;" .. core.formspec_escape(selected_pkg.name) .. "]" ..
|
||||
"label[8.25,0.6;" .. core.formspec_escape(title_and_name) .. "]" ..
|
||||
"box[5.5,2.2;6.15,2.35;#000]"
|
||||
|
||||
if selected_pkg.type == "mod" then
|
||||
@@ -145,11 +155,29 @@ local function get_formspec(tabview, name, tabdata)
|
||||
return retval
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function handle_doubleclick(pkg)
|
||||
if pkg.type == "txp" then
|
||||
if core.settings:get("texture_path") == pkg.path then
|
||||
core.settings:set("texture_path", "")
|
||||
else
|
||||
core.settings:set("texture_path", pkg.path)
|
||||
end
|
||||
packages = nil
|
||||
|
||||
mm_game_theme.init()
|
||||
mm_game_theme.reset()
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function handle_buttons(tabview, fields, tabname, tabdata)
|
||||
if fields["pkglist"] ~= nil then
|
||||
local event = core.explode_table_event(fields["pkglist"])
|
||||
tabdata.selected_pkg = event.row
|
||||
if event.type == "DCL" then
|
||||
handle_doubleclick(packages:get_list()[tabdata.selected_pkg])
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -182,17 +210,17 @@ local function handle_buttons(tabview, fields, tabname, tabdata)
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.btn_mod_mgr_use_txp then
|
||||
local txp = packages:get_list()[tabdata.selected_pkg]
|
||||
core.settings:set("texture_path", txp.path)
|
||||
packages = nil
|
||||
return true
|
||||
end
|
||||
if fields.btn_mod_mgr_use_txp or fields.btn_mod_mgr_disable_txp then
|
||||
local txp_path = ""
|
||||
if fields.btn_mod_mgr_use_txp then
|
||||
txp_path = packages:get_list()[tabdata.selected_pkg].path
|
||||
end
|
||||
|
||||
|
||||
if fields.btn_mod_mgr_disable_txp then
|
||||
core.settings:set("texture_path", "")
|
||||
core.settings:set("texture_path", txp_path)
|
||||
packages = nil
|
||||
|
||||
mm_game_theme.init()
|
||||
mm_game_theme.reset()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
--Minetest
|
||||
--Copyright (C) 2013 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local core_developers = {
|
||||
"Perttu Ahola (celeron55) <celeron55@gmail.com>",
|
||||
"sfan5 <sfan5@live.de>",
|
||||
"Nathanaël Courant (Nore/Ekdohibs) <nore@mesecons.net>",
|
||||
"Loic Blot (nerzhul/nrz) <loic.blot@unix-experience.fr>",
|
||||
"paramat",
|
||||
"Andrew Ward (rubenwardy) <rw@rubenwardy.com>",
|
||||
"Krock/SmallJoker <mk939@ymail.com>",
|
||||
"Lars Hofhansl <larsh@apache.org>",
|
||||
"Pierre-Yves Rollo <dev@pyrollo.com>",
|
||||
"v-rob <robinsonvincent89@gmail.com>",
|
||||
}
|
||||
|
||||
-- For updating active/previous contributors, see the script in ./util/gather_git_credits.py
|
||||
|
||||
local active_contributors = {
|
||||
"Wuzzy [devtest game, visual corrections]",
|
||||
"Zughy [Visual improvements, various fixes]",
|
||||
"Maksim (MoNTE48) [Android]",
|
||||
"numzero [Graphics and rendering]",
|
||||
"appgurueu [Various internal fixes]",
|
||||
"Desour [Formspec and vector API changes]",
|
||||
"HybridDog [Rendering fixes and documentation]",
|
||||
"Hugues Ross [Graphics-related improvements]",
|
||||
"ANAND (ClobberXD) [Mouse buttons rebinding]",
|
||||
"luk3yx [Fixes]",
|
||||
"hecks [Audiovisuals, Lua API]",
|
||||
"LoneWolfHT [Object crosshair, documentation fixes]",
|
||||
"Lejo [Server-related improvements]",
|
||||
"EvidenceB [Compass HUD element]",
|
||||
"Paul Ouellette (pauloue) [Lua API, documentation]",
|
||||
"TheTermos [Collision detection, physics]",
|
||||
"David CARLIER [Unix & Haiku build fixes]",
|
||||
"dcbrwn [Object shading]",
|
||||
"Elias Fleckenstein [API features/fixes]",
|
||||
"Jean-Patrick Guerrero (kilbith) [model element, visual fixes]",
|
||||
"k.h.lai [Memory leak fixes, documentation]",
|
||||
}
|
||||
|
||||
local previous_core_developers = {
|
||||
"BlockMen",
|
||||
"Maciej Kasatkin (RealBadAngel) [RIP]",
|
||||
"Lisa Milne (darkrose) <lisa@ltmnet.com>",
|
||||
"proller",
|
||||
"Ilya Zhuravlev (xyz) <xyz@minetest.net>",
|
||||
"PilzAdam <pilzadam@minetest.net>",
|
||||
"est31 <MTest31@outlook.com>",
|
||||
"kahrl <kahrl@gmx.net>",
|
||||
"Ryan Kwolek (kwolekr) <kwolekr@minetest.net>",
|
||||
"sapier",
|
||||
"Zeno",
|
||||
"ShadowNinja <shadowninja@minetest.net>",
|
||||
"Auke Kok (sofar) <sofar@foo-projects.org>",
|
||||
}
|
||||
|
||||
local previous_contributors = {
|
||||
"Nils Dagsson Moskopp (erlehmann) <nils@dieweltistgarnichtso.net> [Minetest Logo]",
|
||||
"red-001 <red-001@outlook.ie>",
|
||||
"Giuseppe Bilotta",
|
||||
"Dániel Juhász (juhdanad) <juhdanad@gmail.com>",
|
||||
"MirceaKitsune <mirceakitsune@gmail.com>",
|
||||
"Constantin Wenger (SpeedProg)",
|
||||
"Ciaran Gultnieks (CiaranG)",
|
||||
"stujones11 [Android UX improvements]",
|
||||
"Rogier <rogier777@gmail.com> [Fixes]",
|
||||
"Gregory Currie (gregorycu) [optimisation]",
|
||||
"srifqi [Fixes]",
|
||||
"JacobF",
|
||||
"Jeija <jeija@mesecons.net> [HTTP, particles]",
|
||||
}
|
||||
|
||||
local function buildCreditList(source)
|
||||
local ret = {}
|
||||
for i = 1, #source do
|
||||
ret[i] = core.formspec_escape(source[i])
|
||||
end
|
||||
return table.concat(ret, ",,")
|
||||
end
|
||||
|
||||
return {
|
||||
name = "credits",
|
||||
caption = fgettext("Credits"),
|
||||
cbf_formspec = function(tabview, name, tabdata)
|
||||
local logofile = defaulttexturedir .. "logo.png"
|
||||
local version = core.get_version()
|
||||
local fs = "image[0.75,0.5;2.2,2.2;" .. core.formspec_escape(logofile) .. "]" ..
|
||||
"style[label_button;border=false]" ..
|
||||
"button[0.5,2;2.5,2;label_button;" .. version.project .. " " .. version.string .. "]" ..
|
||||
"button[0.75,2.75;2,2;homepage;minetest.net]" ..
|
||||
"tablecolumns[color;text]" ..
|
||||
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
|
||||
"table[3.5,-0.25;8.5,6.05;list_credits;" ..
|
||||
"#FFFF00," .. fgettext("Core Developers") .. ",," ..
|
||||
buildCreditList(core_developers) .. ",,," ..
|
||||
"#FFFF00," .. fgettext("Active Contributors") .. ",," ..
|
||||
buildCreditList(active_contributors) .. ",,," ..
|
||||
"#FFFF00," .. fgettext("Previous Core Developers") ..",," ..
|
||||
buildCreditList(previous_core_developers) .. ",,," ..
|
||||
"#FFFF00," .. fgettext("Previous Contributors") .. ",," ..
|
||||
buildCreditList(previous_contributors) .. "," ..
|
||||
";1]"
|
||||
|
||||
if PLATFORM ~= "Android" then
|
||||
fs = fs .. "tooltip[userdata;" ..
|
||||
fgettext("Opens the directory that contains user-provided worlds, games, mods,\n" ..
|
||||
"and texture packs in a file manager / explorer.") .. "]"
|
||||
fs = fs .. "button[0,4.75;3.5,1;userdata;" .. fgettext("Open User Data Directory") .. "]"
|
||||
end
|
||||
|
||||
return fs
|
||||
end,
|
||||
cbf_button_handler = function(this, fields, name, tabdata)
|
||||
if fields.homepage then
|
||||
core.open_url("https://www.minetest.net")
|
||||
end
|
||||
|
||||
if fields.userdata then
|
||||
core.open_dir(core.get_user_path())
|
||||
end
|
||||
end,
|
||||
}
|
||||
@@ -16,123 +16,176 @@
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
local enable_gamebar = PLATFORM ~= "Android"
|
||||
local current_game, singleplayer_refresh_gamebar
|
||||
local valid_disabled_settings = {
|
||||
["enable_damage"]=true,
|
||||
["creative_mode"]=true,
|
||||
["enable_server"]=true,
|
||||
}
|
||||
|
||||
if enable_gamebar then
|
||||
function current_game()
|
||||
local last_game_id = core.settings:get("menu_last_game")
|
||||
local game = pkgmgr.find_by_gameid(last_game_id)
|
||||
-- Currently chosen game in gamebar for theming and filtering
|
||||
function current_game()
|
||||
local last_game_id = core.settings:get("menu_last_game")
|
||||
local game = pkgmgr.find_by_gameid(last_game_id)
|
||||
|
||||
return game
|
||||
return game
|
||||
end
|
||||
|
||||
-- Apply menu changes from given game
|
||||
function apply_game(game)
|
||||
core.set_topleft_text(game.name)
|
||||
core.settings:set("menu_last_game", game.id)
|
||||
menudata.worldlist:set_filtercriteria(game.id)
|
||||
|
||||
mm_game_theme.update("singleplayer", game) -- this refreshes the formspec
|
||||
|
||||
local index = filterlist.get_current_index(menudata.worldlist,
|
||||
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
||||
if not index or index < 1 then
|
||||
local selected = core.get_textlist_index("sp_worlds")
|
||||
if selected ~= nil and selected < #menudata.worldlist:get_list() then
|
||||
index = selected
|
||||
else
|
||||
index = #menudata.worldlist:get_list()
|
||||
end
|
||||
end
|
||||
menu_worldmt_legacy(index)
|
||||
end
|
||||
|
||||
function singleplayer_refresh_gamebar()
|
||||
|
||||
local old_bar = ui.find_by_name("game_button_bar")
|
||||
if old_bar ~= nil then
|
||||
old_bar:delete()
|
||||
end
|
||||
|
||||
function singleplayer_refresh_gamebar()
|
||||
|
||||
local old_bar = ui.find_by_name("game_button_bar")
|
||||
|
||||
if old_bar ~= nil then
|
||||
old_bar:delete()
|
||||
local function game_buttonbar_button_handler(fields)
|
||||
if fields.game_open_cdb then
|
||||
local maintab = ui.find_by_name("maintab")
|
||||
local dlg = create_store_dlg("game")
|
||||
dlg:set_parent(maintab)
|
||||
maintab:hide()
|
||||
dlg:show()
|
||||
return true
|
||||
end
|
||||
|
||||
local function game_buttonbar_button_handler(fields)
|
||||
if fields.game_open_cdb then
|
||||
local maintab = ui.find_by_name("maintab")
|
||||
local dlg = create_store_dlg("game")
|
||||
dlg:set_parent(maintab)
|
||||
maintab:hide()
|
||||
dlg:show()
|
||||
for _, game in ipairs(pkgmgr.games) do
|
||||
if fields["game_btnbar_" .. game.id] then
|
||||
apply_game(game)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for key,value in pairs(fields) do
|
||||
for j=1,#pkgmgr.games,1 do
|
||||
if ("game_btnbar_" .. pkgmgr.games[j].id == key) then
|
||||
mm_texture.update("singleplayer", pkgmgr.games[j])
|
||||
core.set_topleft_text(pkgmgr.games[j].name)
|
||||
core.settings:set("menu_last_game",pkgmgr.games[j].id)
|
||||
menudata.worldlist:set_filtercriteria(pkgmgr.games[j].id)
|
||||
local index = filterlist.get_current_index(menudata.worldlist,
|
||||
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
||||
if not index or index < 1 then
|
||||
local selected = core.get_textlist_index("sp_worlds")
|
||||
if selected ~= nil and selected < #menudata.worldlist:get_list() then
|
||||
index = selected
|
||||
else
|
||||
index = #menudata.worldlist:get_list()
|
||||
end
|
||||
end
|
||||
menu_worldmt_legacy(index)
|
||||
return true
|
||||
end
|
||||
end
|
||||
local btnbar = buttonbar_create("game_button_bar",
|
||||
game_buttonbar_button_handler,
|
||||
{x=-0.3,y=5.9}, "horizontal", {x=12.4,y=1.15})
|
||||
|
||||
for _, game in ipairs(pkgmgr.games) do
|
||||
local btn_name = "game_btnbar_" .. game.id
|
||||
|
||||
local image = nil
|
||||
local text = nil
|
||||
local tooltip = core.formspec_escape(game.title)
|
||||
|
||||
if (game.menuicon_path or "") ~= "" then
|
||||
image = core.formspec_escape(game.menuicon_path)
|
||||
else
|
||||
local part1 = game.id:sub(1,5)
|
||||
local part2 = game.id:sub(6,10)
|
||||
local part3 = game.id:sub(11)
|
||||
|
||||
text = part1 .. "\n" .. part2
|
||||
if part3 ~= "" then
|
||||
text = text .. "\n" .. part3
|
||||
end
|
||||
end
|
||||
btnbar:add_button(btn_name, text, image, tooltip)
|
||||
end
|
||||
|
||||
local btnbar = buttonbar_create("game_button_bar",
|
||||
game_buttonbar_button_handler,
|
||||
{x=-0.3,y=5.9}, "horizontal", {x=12.4,y=1.15})
|
||||
local plus_image = core.formspec_escape(defaulttexturedir .. "plus.png")
|
||||
btnbar:add_button("game_open_cdb", "", plus_image, fgettext("Install games from ContentDB"))
|
||||
end
|
||||
|
||||
for i=1,#pkgmgr.games,1 do
|
||||
local btn_name = "game_btnbar_" .. pkgmgr.games[i].id
|
||||
local function get_disabled_settings(game)
|
||||
if not game then
|
||||
return {}
|
||||
end
|
||||
|
||||
local image = nil
|
||||
local text = nil
|
||||
local tooltip = core.formspec_escape(pkgmgr.games[i].name)
|
||||
|
||||
if pkgmgr.games[i].menuicon_path ~= nil and
|
||||
pkgmgr.games[i].menuicon_path ~= "" then
|
||||
image = core.formspec_escape(pkgmgr.games[i].menuicon_path)
|
||||
local gameconfig = Settings(game.path .. "/game.conf")
|
||||
local disabled_settings = {}
|
||||
if gameconfig then
|
||||
local disabled_settings_str = (gameconfig:get("disabled_settings") or ""):split()
|
||||
for _, value in pairs(disabled_settings_str) do
|
||||
local state = false
|
||||
value = value:trim()
|
||||
if string.sub(value, 1, 1) == "!" then
|
||||
state = true
|
||||
value = string.sub(value, 2)
|
||||
end
|
||||
if valid_disabled_settings[value] then
|
||||
disabled_settings[value] = state
|
||||
else
|
||||
|
||||
local part1 = pkgmgr.games[i].id:sub(1,5)
|
||||
local part2 = pkgmgr.games[i].id:sub(6,10)
|
||||
local part3 = pkgmgr.games[i].id:sub(11)
|
||||
|
||||
text = part1 .. "\n" .. part2
|
||||
if part3 ~= nil and
|
||||
part3 ~= "" then
|
||||
text = text .. "\n" .. part3
|
||||
end
|
||||
core.log("error", "Invalid disabled setting in game.conf: "..tostring(value))
|
||||
end
|
||||
btnbar:add_button(btn_name, text, image, tooltip)
|
||||
end
|
||||
|
||||
local plus_image = core.formspec_escape(defaulttexturedir .. "plus.png")
|
||||
btnbar:add_button("game_open_cdb", "", plus_image, fgettext("Install games from ContentDB"))
|
||||
end
|
||||
else
|
||||
function current_game()
|
||||
return nil
|
||||
end
|
||||
return disabled_settings
|
||||
end
|
||||
|
||||
local function get_formspec(tabview, name, tabdata)
|
||||
local retval = ""
|
||||
|
||||
local index = filterlist.get_current_index(menudata.worldlist,
|
||||
tonumber(core.settings:get("mainmenu_last_selected_world"))
|
||||
)
|
||||
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
||||
local list = menudata.worldlist:get_list()
|
||||
local world = list and index and list[index]
|
||||
local game
|
||||
if world then
|
||||
game = pkgmgr.find_by_gameid(world.gameid)
|
||||
else
|
||||
game = current_game()
|
||||
end
|
||||
local disabled_settings = get_disabled_settings(game)
|
||||
|
||||
local creative, damage, host = "", "", ""
|
||||
|
||||
-- Y offsets for game settings checkboxes
|
||||
local y = -0.2
|
||||
local yo = 0.45
|
||||
|
||||
if disabled_settings["creative_mode"] == nil then
|
||||
creative = "checkbox[0,"..y..";cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
||||
dump(core.settings:get_bool("creative_mode")) .. "]"
|
||||
y = y + yo
|
||||
end
|
||||
if disabled_settings["enable_damage"] == nil then
|
||||
damage = "checkbox[0,"..y..";cb_enable_damage;".. fgettext("Enable Damage") .. ";" ..
|
||||
dump(core.settings:get_bool("enable_damage")) .. "]"
|
||||
y = y + yo
|
||||
end
|
||||
if disabled_settings["enable_server"] == nil then
|
||||
host = "checkbox[0,"..y..";cb_server;".. fgettext("Host Server") ..";" ..
|
||||
dump(core.settings:get_bool("enable_server")) .. "]"
|
||||
y = y + yo
|
||||
end
|
||||
|
||||
retval = retval ..
|
||||
"button[3.9,3.8;2.8,1;world_delete;".. fgettext("Delete") .. "]" ..
|
||||
"button[6.55,3.8;2.8,1;world_configure;".. fgettext("Select Mods") .. "]" ..
|
||||
"button[9.2,3.8;2.8,1;world_create;".. fgettext("New") .. "]" ..
|
||||
"label[3.9,-0.05;".. fgettext("Select World:") .. "]"..
|
||||
"checkbox[0,-0.20;cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
||||
dump(core.settings:get_bool("creative_mode")) .. "]"..
|
||||
"checkbox[0,0.25;cb_enable_damage;".. fgettext("Enable Damage") .. ";" ..
|
||||
dump(core.settings:get_bool("enable_damage")) .. "]"..
|
||||
"checkbox[0,0.7;cb_server;".. fgettext("Host Server") ..";" ..
|
||||
dump(core.settings:get_bool("enable_server")) .. "]" ..
|
||||
creative ..
|
||||
damage ..
|
||||
host ..
|
||||
"textlist[3.9,0.4;7.9,3.45;sp_worlds;" ..
|
||||
menu_render_worldlist() ..
|
||||
";" .. index .. "]"
|
||||
|
||||
if core.settings:get_bool("enable_server") then
|
||||
if core.settings:get_bool("enable_server") and disabled_settings["enable_server"] == nil then
|
||||
retval = retval ..
|
||||
"button[7.9,4.75;4.1,1;play;".. fgettext("Host Game") .. "]" ..
|
||||
"checkbox[0,1.15;cb_server_announce;" .. fgettext("Announce Server") .. ";" ..
|
||||
"checkbox[0,"..y..";cb_server_announce;" .. fgettext("Announce Server") .. ";" ..
|
||||
dump(core.settings:get_bool("server_announce")) .. "]" ..
|
||||
"field[0.3,2.85;3.8,0.5;te_playername;" .. fgettext("Name") .. ";" ..
|
||||
core.formspec_escape(core.settings:get("name")) .. "]" ..
|
||||
@@ -227,9 +280,21 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||
|
||||
-- Update last game
|
||||
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
|
||||
local game_obj
|
||||
if world then
|
||||
local game = pkgmgr.find_by_gameid(world.gameid)
|
||||
core.settings:set("menu_last_game", game.id)
|
||||
game_obj = pkgmgr.find_by_gameid(world.gameid)
|
||||
core.settings:set("menu_last_game", game_obj.id)
|
||||
end
|
||||
|
||||
local disabled_settings = get_disabled_settings(game_obj)
|
||||
for k, _ in pairs(valid_disabled_settings) do
|
||||
local v = disabled_settings[k]
|
||||
if v ~= nil then
|
||||
if k == "enable_server" and v == true then
|
||||
error("Setting 'enable_server' cannot be force-enabled! The game.conf needs to be fixed.")
|
||||
end
|
||||
core.settings:set_bool(k, disabled_settings[k])
|
||||
end
|
||||
end
|
||||
|
||||
if core.settings:get_bool("enable_server") then
|
||||
@@ -251,11 +316,11 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||
end
|
||||
|
||||
if fields["world_create"] ~= nil then
|
||||
local create_world_dlg = create_create_world_dlg(true)
|
||||
local create_world_dlg = create_create_world_dlg()
|
||||
create_world_dlg:set_parent(this)
|
||||
this:hide()
|
||||
create_world_dlg:show()
|
||||
mm_texture.update("singleplayer", current_game())
|
||||
mm_game_theme.update("singleplayer", current_game())
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -272,7 +337,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||
delete_world_dlg:set_parent(this)
|
||||
this:hide()
|
||||
delete_world_dlg:show()
|
||||
mm_texture.update("singleplayer",current_game())
|
||||
mm_game_theme.update("singleplayer",current_game())
|
||||
end
|
||||
end
|
||||
|
||||
@@ -290,7 +355,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||
configdialog:set_parent(this)
|
||||
this:hide()
|
||||
configdialog:show()
|
||||
mm_texture.update("singleplayer",current_game())
|
||||
mm_game_theme.update("singleplayer",current_game())
|
||||
end
|
||||
end
|
||||
|
||||
@@ -298,29 +363,23 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||
end
|
||||
end
|
||||
|
||||
local on_change
|
||||
if enable_gamebar then
|
||||
function on_change(type, old_tab, new_tab)
|
||||
if (type == "ENTER") then
|
||||
local game = current_game()
|
||||
|
||||
if game then
|
||||
menudata.worldlist:set_filtercriteria(game.id)
|
||||
core.set_topleft_text(game.name)
|
||||
mm_texture.update("singleplayer",game)
|
||||
end
|
||||
|
||||
singleplayer_refresh_gamebar()
|
||||
ui.find_by_name("game_button_bar"):show()
|
||||
else
|
||||
menudata.worldlist:set_filtercriteria(nil)
|
||||
local gamebar = ui.find_by_name("game_button_bar")
|
||||
if gamebar then
|
||||
gamebar:hide()
|
||||
end
|
||||
core.set_topleft_text("")
|
||||
mm_texture.update(new_tab,nil)
|
||||
local function on_change(type, old_tab, new_tab)
|
||||
if (type == "ENTER") then
|
||||
local game = current_game()
|
||||
if game then
|
||||
apply_game(game)
|
||||
end
|
||||
|
||||
singleplayer_refresh_gamebar()
|
||||
ui.find_by_name("game_button_bar"):show()
|
||||
else
|
||||
menudata.worldlist:set_filtercriteria(nil)
|
||||
local gamebar = ui.find_by_name("game_button_bar")
|
||||
if gamebar then
|
||||
gamebar:hide()
|
||||
end
|
||||
core.set_topleft_text("")
|
||||
mm_game_theme.update(new_tab,nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -15,17 +15,50 @@
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function get_sorted_servers()
|
||||
local servers = {
|
||||
fav = {},
|
||||
public = {},
|
||||
incompatible = {}
|
||||
}
|
||||
|
||||
local favs = serverlistmgr.get_favorites()
|
||||
local taken_favs = {}
|
||||
local result = menudata.search_result or serverlistmgr.servers
|
||||
for _, server in ipairs(result) do
|
||||
server.is_favorite = false
|
||||
for index, fav in ipairs(favs) do
|
||||
if server.address == fav.address and server.port == fav.port then
|
||||
taken_favs[index] = true
|
||||
server.is_favorite = true
|
||||
break
|
||||
end
|
||||
end
|
||||
server.is_compatible = is_server_protocol_compat(server.proto_min, server.proto_max)
|
||||
if server.is_favorite then
|
||||
table.insert(servers.fav, server)
|
||||
elseif server.is_compatible then
|
||||
table.insert(servers.public, server)
|
||||
else
|
||||
table.insert(servers.incompatible, server)
|
||||
end
|
||||
end
|
||||
|
||||
if not menudata.search_result then
|
||||
for index, fav in ipairs(favs) do
|
||||
if not taken_favs[index] then
|
||||
table.insert(servers.fav, fav)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return servers
|
||||
end
|
||||
|
||||
local function get_formspec(tabview, name, tabdata)
|
||||
-- Update the cached supported proto info,
|
||||
-- it may have changed after a change by the settings menu.
|
||||
common_update_cached_supp_proto()
|
||||
local selected
|
||||
if menudata.search_result then
|
||||
selected = menudata.search_result[tabdata.selected]
|
||||
else
|
||||
selected = serverlistmgr.servers[tabdata.selected]
|
||||
end
|
||||
|
||||
if not tabdata.search_for then
|
||||
tabdata.search_for = ""
|
||||
@@ -33,128 +66,228 @@ local function get_formspec(tabview, name, tabdata)
|
||||
|
||||
local retval =
|
||||
-- Search
|
||||
"field[0.15,0.075;5.91,1;te_search;;" .. core.formspec_escape(tabdata.search_for) .. "]" ..
|
||||
"image_button[5.63,-.165;.83,.83;" .. core.formspec_escape(defaulttexturedir .. "search.png") .. ";btn_mp_search;]" ..
|
||||
"image_button[6.3,-.165;.83,.83;" .. core.formspec_escape(defaulttexturedir .. "clear.png") .. ";btn_mp_clear;]" ..
|
||||
"image_button[6.97,-.165;.83,.83;" .. core.formspec_escape(defaulttexturedir .. "refresh.png")
|
||||
.. ";btn_mp_refresh;]" ..
|
||||
"field[0.25,0.25;7,0.75;te_search;;" .. core.formspec_escape(tabdata.search_for) .. "]" ..
|
||||
"container[7.25,0.25]" ..
|
||||
"image_button[0,0;0.75,0.75;" .. core.formspec_escape(defaulttexturedir .. "search.png") .. ";btn_mp_search;]" ..
|
||||
"image_button[0.75,0;0.75,0.75;" .. core.formspec_escape(defaulttexturedir .. "clear.png") .. ";btn_mp_clear;]" ..
|
||||
"image_button[1.5,0;0.75,0.75;" .. core.formspec_escape(defaulttexturedir .. "refresh.png") .. ";btn_mp_refresh;]" ..
|
||||
"tooltip[btn_mp_clear;" .. fgettext("Clear") .. "]" ..
|
||||
"tooltip[btn_mp_search;" .. fgettext("Search") .. "]" ..
|
||||
"tooltip[btn_mp_refresh;" .. fgettext("Refresh") .. "]" ..
|
||||
"container_end[]" ..
|
||||
|
||||
"container[9.75,0]" ..
|
||||
"box[0,0;5.75,7;#666666]" ..
|
||||
|
||||
-- Address / Port
|
||||
"label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" ..
|
||||
"field[8,0.65;3.25,0.5;te_address;;" ..
|
||||
"label[0.25,0.35;" .. fgettext("Address") .. "]" ..
|
||||
"label[4.25,0.35;" .. fgettext("Port") .. "]" ..
|
||||
"field[0.25,0.5;4,0.75;te_address;;" ..
|
||||
core.formspec_escape(core.settings:get("address")) .. "]" ..
|
||||
"field[11.1,0.65;1.4,0.5;te_port;;" ..
|
||||
"field[4.25,0.5;1.25,0.75;te_port;;" ..
|
||||
core.formspec_escape(core.settings:get("remote_port")) .. "]" ..
|
||||
|
||||
-- Name / Password
|
||||
"label[7.75,0.95;" .. fgettext("Name / Password") .. "]" ..
|
||||
"field[8,1.85;2.9,0.5;te_name;;" ..
|
||||
core.formspec_escape(core.settings:get("name")) .. "]" ..
|
||||
"pwdfield[10.73,1.85;1.77,0.5;te_pwd;]" ..
|
||||
|
||||
-- Description Background
|
||||
"box[7.73,2.25;4.25,2.6;#999999]"..
|
||||
"label[0.25,1.6;" .. fgettext("Server Description") .. "]" ..
|
||||
"box[0.25,1.85;5.25,2.7;#999999]"..
|
||||
|
||||
-- Name / Password
|
||||
"container[0,4.8]" ..
|
||||
"label[0.25,0;" .. fgettext("Name") .. "]" ..
|
||||
"label[3,0;" .. fgettext("Password") .. "]" ..
|
||||
"field[0.25,0.2;2.625,0.75;te_name;;" .. core.formspec_escape(core.settings:get("name")) .. "]" ..
|
||||
"pwdfield[2.875,0.2;2.625,0.75;te_pwd;]" ..
|
||||
"container_end[]" ..
|
||||
|
||||
-- Connect
|
||||
"button[9.88,4.9;2.3,1;btn_mp_connect;" .. fgettext("Connect") .. "]"
|
||||
"button[3,6;2.5,0.75;btn_mp_login;" .. fgettext("Login") .. "]"
|
||||
|
||||
if tabdata.selected and selected then
|
||||
if core.settings:get_bool("enable_split_login_register") then
|
||||
retval = retval .. "button[0.25,6;2.5,0.75;btn_mp_register;" .. fgettext("Register") .. "]"
|
||||
end
|
||||
|
||||
if tabdata.selected then
|
||||
if gamedata.fav then
|
||||
retval = retval .. "button[7.73,4.9;2.3,1;btn_delete_favorite;" ..
|
||||
fgettext("Del. Favorite") .. "]"
|
||||
retval = retval .. "tooltip[btn_delete_favorite;" .. fgettext("Remove favorite") .. "]"
|
||||
retval = retval .. "style[btn_delete_favorite;padding=6]"
|
||||
retval = retval .. "image_button[5,1.3;0.5,0.5;" .. core.formspec_escape(defaulttexturedir ..
|
||||
"server_favorite_delete.png") .. ";btn_delete_favorite;]"
|
||||
end
|
||||
if selected.description then
|
||||
retval = retval .. "textarea[8.1,2.3;4.23,2.9;;;" ..
|
||||
core.formspec_escape((gamedata.serverdescription or ""), true) .. "]"
|
||||
if gamedata.serverdescription then
|
||||
retval = retval .. "textarea[0.25,1.85;5.2,2.75;;;" ..
|
||||
core.formspec_escape(gamedata.serverdescription) .. "]"
|
||||
end
|
||||
end
|
||||
|
||||
--favorites
|
||||
retval = retval .. "container_end[]"
|
||||
|
||||
-- Table
|
||||
retval = retval .. "tablecolumns[" ..
|
||||
image_column(fgettext("Favorite"), "favorite") .. ";" ..
|
||||
image_column(fgettext("Ping")) .. ",padding=0.25;" ..
|
||||
"color,span=3;" ..
|
||||
"text,align=right;" .. -- clients
|
||||
"text,align=center,padding=0.25;" .. -- "/"
|
||||
"text,align=right,padding=0.25;" .. -- clients_max
|
||||
image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" ..
|
||||
image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" ..
|
||||
--~ PvP = Player versus Player
|
||||
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
|
||||
"image,tooltip=" .. fgettext("Ping") .. "," ..
|
||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
||||
"1=" .. core.formspec_escape(defaulttexturedir .. "server_ping_4.png") .. "," ..
|
||||
"2=" .. core.formspec_escape(defaulttexturedir .. "server_ping_3.png") .. "," ..
|
||||
"3=" .. core.formspec_escape(defaulttexturedir .. "server_ping_2.png") .. "," ..
|
||||
"4=" .. core.formspec_escape(defaulttexturedir .. "server_ping_1.png") .. "," ..
|
||||
"5=" .. core.formspec_escape(defaulttexturedir .. "server_favorite.png") .. "," ..
|
||||
"6=" .. core.formspec_escape(defaulttexturedir .. "server_public.png") .. "," ..
|
||||
"7=" .. core.formspec_escape(defaulttexturedir .. "server_incompatible.png") .. ";" ..
|
||||
"color,span=1;" ..
|
||||
"text,padding=1]" ..
|
||||
"table[-0.15,0.6;7.75,5.15;favorites;"
|
||||
"text,align=inline;"..
|
||||
"color,span=1;" ..
|
||||
"text,align=inline,width=4.25;" ..
|
||||
"image,tooltip=" .. fgettext("Creative mode") .. "," ..
|
||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
||||
"1=" .. core.formspec_escape(defaulttexturedir .. "server_flags_creative.png") .. "," ..
|
||||
"align=inline,padding=0.25,width=1.5;" ..
|
||||
--~ PvP = Player versus Player
|
||||
"image,tooltip=" .. fgettext("Damage / PvP") .. "," ..
|
||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
||||
"1=" .. core.formspec_escape(defaulttexturedir .. "server_flags_damage.png") .. "," ..
|
||||
"2=" .. core.formspec_escape(defaulttexturedir .. "server_flags_pvp.png") .. "," ..
|
||||
"align=inline,padding=0.25,width=1.5;" ..
|
||||
"color,align=inline,span=1;" ..
|
||||
"text,align=inline,padding=1]" ..
|
||||
"table[0.25,1;9.25,5.75;servers;"
|
||||
|
||||
if menudata.search_result then
|
||||
local favs = serverlistmgr.get_favorites()
|
||||
for i = 1, #menudata.search_result do
|
||||
local server = menudata.search_result[i]
|
||||
for fav_id = 1, #favs do
|
||||
if server.address == favs[fav_id].address and
|
||||
server.port == favs[fav_id].port then
|
||||
server.is_favorite = true
|
||||
end
|
||||
local servers = get_sorted_servers()
|
||||
|
||||
local dividers = {
|
||||
fav = "5,#ffff00," .. fgettext("Favorites") .. ",,,0,0,,",
|
||||
public = "6,#4bdd42," .. fgettext("Public Servers") .. ",,,0,0,,",
|
||||
incompatible = "7,"..mt_color_grey.."," .. fgettext("Incompatible Servers") .. ",,,0,0,,"
|
||||
}
|
||||
local order = {"fav", "public", "incompatible"}
|
||||
|
||||
tabdata.lookup = {} -- maps row number to server
|
||||
local rows = {}
|
||||
for _, section in ipairs(order) do
|
||||
local section_servers = servers[section]
|
||||
if next(section_servers) ~= nil then
|
||||
rows[#rows + 1] = dividers[section]
|
||||
for _, server in ipairs(section_servers) do
|
||||
tabdata.lookup[#rows + 1] = server
|
||||
rows[#rows + 1] = render_serverlist_row(server)
|
||||
end
|
||||
|
||||
if i ~= 1 then
|
||||
retval = retval .. ","
|
||||
end
|
||||
|
||||
retval = retval .. render_serverlist_row(server, server.is_favorite)
|
||||
end
|
||||
elseif #serverlistmgr.servers > 0 then
|
||||
local favs = serverlistmgr.get_favorites()
|
||||
if #favs > 0 then
|
||||
for i = 1, #favs do
|
||||
for j = 1, #serverlistmgr.servers do
|
||||
if serverlistmgr.servers[j].address == favs[i].address and
|
||||
serverlistmgr.servers[j].port == favs[i].port then
|
||||
table.insert(serverlistmgr.servers, i, table.remove(serverlistmgr.servers, j))
|
||||
end
|
||||
end
|
||||
if favs[i].address ~= serverlistmgr.servers[i].address then
|
||||
table.insert(serverlistmgr.servers, i, favs[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
retval = retval .. render_serverlist_row(serverlistmgr.servers[1], (#favs > 0))
|
||||
for i = 2, #serverlistmgr.servers do
|
||||
retval = retval .. "," .. render_serverlist_row(serverlistmgr.servers[i], (i <= #favs))
|
||||
end
|
||||
end
|
||||
|
||||
retval = retval .. table.concat(rows, ",")
|
||||
|
||||
if tabdata.selected then
|
||||
retval = retval .. ";" .. tabdata.selected .. "]"
|
||||
else
|
||||
retval = retval .. ";0]"
|
||||
end
|
||||
|
||||
return retval
|
||||
return retval, "size[15.5,7,false]real_coordinates[true]"
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function main_button_handler(tabview, fields, name, tabdata)
|
||||
local serverlist = menudata.search_result or serverlistmgr.servers
|
||||
|
||||
local function search_server_list(input)
|
||||
menudata.search_result = nil
|
||||
if #serverlistmgr.servers < 2 then
|
||||
return
|
||||
end
|
||||
|
||||
-- setup the keyword list
|
||||
local keywords = {}
|
||||
for word in input:gmatch("%S+") do
|
||||
word = word:gsub("(%W)", "%%%1")
|
||||
table.insert(keywords, word)
|
||||
end
|
||||
|
||||
if #keywords == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
menudata.search_result = {}
|
||||
|
||||
-- Search the serverlist
|
||||
local search_result = {}
|
||||
for i = 1, #serverlistmgr.servers do
|
||||
local server = serverlistmgr.servers[i]
|
||||
local found = 0
|
||||
for k = 1, #keywords do
|
||||
local keyword = keywords[k]
|
||||
if server.name then
|
||||
local sername = server.name:lower()
|
||||
local _, count = sername:gsub(keyword, keyword)
|
||||
found = found + count * 4
|
||||
end
|
||||
|
||||
if server.description then
|
||||
local desc = server.description:lower()
|
||||
local _, count = desc:gsub(keyword, keyword)
|
||||
found = found + count * 2
|
||||
end
|
||||
end
|
||||
if found > 0 then
|
||||
local points = (#serverlistmgr.servers - i) / 5 + found
|
||||
server.points = points
|
||||
table.insert(search_result, server)
|
||||
end
|
||||
end
|
||||
|
||||
if #search_result == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
table.sort(search_result, function(a, b)
|
||||
return a.points > b.points
|
||||
end)
|
||||
menudata.search_result = search_result
|
||||
end
|
||||
|
||||
local function set_selected_server(tabdata, idx, server)
|
||||
-- reset selection
|
||||
if idx == nil or server == nil then
|
||||
tabdata.selected = nil
|
||||
|
||||
core.settings:set("address", "")
|
||||
core.settings:set("remote_port", "30000")
|
||||
return
|
||||
end
|
||||
|
||||
local address = server.address
|
||||
local port = server.port
|
||||
gamedata.serverdescription = server.description
|
||||
|
||||
gamedata.fav = false
|
||||
for _, fav in ipairs(serverlistmgr.get_favorites()) do
|
||||
if address == fav.address and port == fav.port then
|
||||
gamedata.fav = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if address and port then
|
||||
core.settings:set("address", address)
|
||||
core.settings:set("remote_port", port)
|
||||
end
|
||||
tabdata.selected = idx
|
||||
end
|
||||
|
||||
local function main_button_handler(tabview, fields, name, tabdata)
|
||||
if fields.te_name then
|
||||
gamedata.playername = fields.te_name
|
||||
core.settings:set("name", fields.te_name)
|
||||
end
|
||||
|
||||
if fields.favorites then
|
||||
local event = core.explode_table_event(fields.favorites)
|
||||
local fav = serverlist[event.row]
|
||||
if fields.servers then
|
||||
local event = core.explode_table_event(fields.servers)
|
||||
local server = tabdata.lookup[event.row]
|
||||
|
||||
if event.type == "DCL" then
|
||||
if event.row <= #serverlist then
|
||||
if server then
|
||||
if event.type == "DCL" then
|
||||
if not is_server_protocol_compat_or_error(
|
||||
fav.proto_min, fav.proto_max) then
|
||||
server.proto_min, server.proto_max) then
|
||||
return true
|
||||
end
|
||||
|
||||
gamedata.address = fav.address
|
||||
gamedata.port = fav.port
|
||||
gamedata.address = server.address
|
||||
gamedata.port = server.port
|
||||
gamedata.playername = fields.te_name
|
||||
gamedata.selected_world = 0
|
||||
|
||||
@@ -162,84 +295,32 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
gamedata.password = fields.te_pwd
|
||||
end
|
||||
|
||||
gamedata.servername = fav.name
|
||||
gamedata.serverdescription = fav.description
|
||||
gamedata.servername = server.name
|
||||
gamedata.serverdescription = server.description
|
||||
|
||||
if gamedata.address and gamedata.port then
|
||||
core.settings:set("address", gamedata.address)
|
||||
core.settings:set("remote_port", gamedata.port)
|
||||
core.start()
|
||||
end
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if event.type == "CHG" then
|
||||
if event.row <= #serverlist then
|
||||
gamedata.fav = false
|
||||
local favs = serverlistmgr.get_favorites()
|
||||
local address = fav.address
|
||||
local port = fav.port
|
||||
gamedata.serverdescription = fav.description
|
||||
|
||||
for i = 1, #favs do
|
||||
if fav.address == favs[i].address and
|
||||
fav.port == favs[i].port then
|
||||
gamedata.fav = true
|
||||
end
|
||||
end
|
||||
|
||||
if address and port then
|
||||
core.settings:set("address", address)
|
||||
core.settings:set("remote_port", port)
|
||||
end
|
||||
tabdata.selected = event.row
|
||||
if event.type == "CHG" then
|
||||
set_selected_server(tabdata, event.row, server)
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if fields.key_up or fields.key_down then
|
||||
local fav_idx = core.get_table_index("favorites")
|
||||
local fav = serverlist[fav_idx]
|
||||
|
||||
if fav_idx then
|
||||
if fields.key_up and fav_idx > 1 then
|
||||
fav_idx = fav_idx - 1
|
||||
elseif fields.key_down and fav_idx < #serverlistmgr.servers then
|
||||
fav_idx = fav_idx + 1
|
||||
end
|
||||
else
|
||||
fav_idx = 1
|
||||
end
|
||||
|
||||
if not serverlistmgr.servers or not fav then
|
||||
tabdata.selected = 0
|
||||
return true
|
||||
end
|
||||
|
||||
local address = fav.address
|
||||
local port = fav.port
|
||||
gamedata.serverdescription = fav.description
|
||||
if address and port then
|
||||
core.settings:set("address", address)
|
||||
core.settings:set("remote_port", port)
|
||||
end
|
||||
|
||||
tabdata.selected = fav_idx
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.btn_delete_favorite then
|
||||
local current_favorite = core.get_table_index("favorites")
|
||||
if not current_favorite then return end
|
||||
local idx = core.get_table_index("servers")
|
||||
if not idx then return end
|
||||
local server = tabdata.lookup[idx]
|
||||
if not server then return end
|
||||
|
||||
serverlistmgr.delete_favorite(serverlistmgr.servers[current_favorite])
|
||||
serverlistmgr.sync()
|
||||
tabdata.selected = nil
|
||||
|
||||
core.settings:set("address", "")
|
||||
core.settings:set("remote_port", "30000")
|
||||
serverlistmgr.delete_favorite(server)
|
||||
-- the server at [idx+1] will be at idx once list is refreshed
|
||||
set_selected_server(tabdata, idx, tabdata.lookup[idx+1])
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -250,63 +331,13 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
end
|
||||
|
||||
if fields.btn_mp_search or fields.key_enter_field == "te_search" then
|
||||
tabdata.selected = 1
|
||||
local input = fields.te_search:lower()
|
||||
tabdata.search_for = fields.te_search
|
||||
|
||||
if #serverlistmgr.servers < 2 then
|
||||
return true
|
||||
search_server_list(fields.te_search:lower())
|
||||
if menudata.search_result then
|
||||
-- first server in row 2 due to header
|
||||
set_selected_server(tabdata, 2, menudata.search_result[1])
|
||||
end
|
||||
|
||||
menudata.search_result = {}
|
||||
|
||||
-- setup the keyword list
|
||||
local keywords = {}
|
||||
for word in input:gmatch("%S+") do
|
||||
word = word:gsub("(%W)", "%%%1")
|
||||
table.insert(keywords, word)
|
||||
end
|
||||
|
||||
if #keywords == 0 then
|
||||
menudata.search_result = nil
|
||||
return true
|
||||
end
|
||||
|
||||
-- Search the serverlist
|
||||
local search_result = {}
|
||||
for i = 1, #serverlistmgr.servers do
|
||||
local server = serverlistmgr.servers[i]
|
||||
local found = 0
|
||||
for k = 1, #keywords do
|
||||
local keyword = keywords[k]
|
||||
if server.name then
|
||||
local sername = server.name:lower()
|
||||
local _, count = sername:gsub(keyword, keyword)
|
||||
found = found + count * 4
|
||||
end
|
||||
|
||||
if server.description then
|
||||
local desc = server.description:lower()
|
||||
local _, count = desc:gsub(keyword, keyword)
|
||||
found = found + count * 2
|
||||
end
|
||||
end
|
||||
if found > 0 then
|
||||
local points = (#serverlistmgr.servers - i) / 5 + found
|
||||
server.points = points
|
||||
table.insert(search_result, server)
|
||||
end
|
||||
end
|
||||
if #search_result > 0 then
|
||||
table.sort(search_result, function(a, b)
|
||||
return a.points > b.points
|
||||
end)
|
||||
menudata.search_result = search_result
|
||||
local first_server = search_result[1]
|
||||
core.settings:set("address", first_server.address)
|
||||
core.settings:set("remote_port", first_server.port)
|
||||
gamedata.serverdescription = first_server.description
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -315,27 +346,32 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
return true
|
||||
end
|
||||
|
||||
if (fields.btn_mp_connect or fields.key_enter)
|
||||
if (fields.btn_mp_login or fields.key_enter)
|
||||
and fields.te_address ~= "" and fields.te_port then
|
||||
gamedata.playername = fields.te_name
|
||||
gamedata.password = fields.te_pwd
|
||||
gamedata.address = fields.te_address
|
||||
gamedata.port = tonumber(fields.te_port)
|
||||
|
||||
local enable_split_login_register = core.settings:get_bool("enable_split_login_register")
|
||||
gamedata.allow_login_or_register = enable_split_login_register and "login" or "any"
|
||||
gamedata.selected_world = 0
|
||||
local fav_idx = core.get_table_index("favorites")
|
||||
local fav = serverlist[fav_idx]
|
||||
|
||||
if fav_idx and fav_idx <= #serverlist and
|
||||
fav.address == gamedata.address and
|
||||
fav.port == gamedata.port then
|
||||
local idx = core.get_table_index("servers")
|
||||
local server = idx and tabdata.lookup[idx]
|
||||
|
||||
serverlistmgr.add_favorite(fav)
|
||||
set_selected_server(tabdata)
|
||||
|
||||
gamedata.servername = fav.name
|
||||
gamedata.serverdescription = fav.description
|
||||
if server and server.address == gamedata.address and
|
||||
server.port == gamedata.port then
|
||||
|
||||
serverlistmgr.add_favorite(server)
|
||||
|
||||
gamedata.servername = server.name
|
||||
gamedata.serverdescription = server.description
|
||||
|
||||
if not is_server_protocol_compat_or_error(
|
||||
fav.proto_min, fav.proto_max) then
|
||||
server.proto_min, server.proto_max) then
|
||||
return true
|
||||
end
|
||||
else
|
||||
@@ -354,6 +390,26 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
core.start()
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.btn_mp_register and fields.te_address ~= "" and fields.te_port then
|
||||
local idx = core.get_table_index("servers")
|
||||
local server = idx and tabdata.lookup[idx]
|
||||
if server and (server.address ~= fields.te_address or server.port ~= tonumber(fields.te_port)) then
|
||||
server = nil
|
||||
end
|
||||
|
||||
if server and not is_server_protocol_compat_or_error(
|
||||
server.proto_min, server.proto_max) then
|
||||
return true
|
||||
end
|
||||
|
||||
local dlg = create_register_dialog(fields.te_address, tonumber(fields.te_port), server)
|
||||
dlg:set_parent(tabview)
|
||||
tabview:hide()
|
||||
dlg:show()
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -362,7 +418,6 @@ local function on_change(type, old_tab, new_tab)
|
||||
serverlistmgr.sync()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
return {
|
||||
name = "online",
|
||||
caption = fgettext("Join Game"),
|
||||
|
||||
@@ -43,6 +43,14 @@ local labels = {
|
||||
fgettext("2x"),
|
||||
fgettext("4x"),
|
||||
fgettext("8x")
|
||||
},
|
||||
shadow_levels = {
|
||||
fgettext("Disabled"),
|
||||
fgettext("Very Low"),
|
||||
fgettext("Low"),
|
||||
fgettext("Medium"),
|
||||
fgettext("High"),
|
||||
fgettext("Very High")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +74,10 @@ local dd_options = {
|
||||
antialiasing = {
|
||||
table.concat(labels.antialiasing, ","),
|
||||
{"0", "2", "4", "8"}
|
||||
},
|
||||
shadow_levels = {
|
||||
table.concat(labels.shadow_levels, ","),
|
||||
{ "0", "1", "2", "3", "4", "5" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +122,15 @@ local getSettingIndex = {
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
ShadowMapping = function()
|
||||
local shadow_setting = core.settings:get("shadow_levels")
|
||||
for i = 1, #dd_options.shadow_levels[2] do
|
||||
if shadow_setting == dd_options.shadow_levels[2][i] then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
}
|
||||
|
||||
@@ -139,7 +160,7 @@ local function formspec(tabview, name, tabdata)
|
||||
.. getSettingIndex.NodeHighlighting() .. "]" ..
|
||||
"dropdown[0.25,3.6;3.5;dd_leaves_style;" .. dd_options.leaves[1] .. ";"
|
||||
.. getSettingIndex.Leaves() .. "]" ..
|
||||
"box[4,0;3.75,4.5;#999999]" ..
|
||||
"box[4,0;3.75,4.9;#999999]" ..
|
||||
"label[4.25,0.1;" .. fgettext("Texturing:") .. "]" ..
|
||||
"dropdown[4.25,0.55;3.5;dd_filters;" .. dd_options.filters[1] .. ";"
|
||||
.. getSettingIndex.Filter() .. "]" ..
|
||||
@@ -148,9 +169,6 @@ local function formspec(tabview, name, tabdata)
|
||||
"label[4.25,2.15;" .. fgettext("Antialiasing:") .. "]" ..
|
||||
"dropdown[4.25,2.6;3.5;dd_antialiasing;" .. dd_options.antialiasing[1] .. ";"
|
||||
.. getSettingIndex.Antialiasing() .. "]" ..
|
||||
"label[4.25,3.45;" .. fgettext("Screen:") .. "]" ..
|
||||
"checkbox[4.25,3.6;cb_autosave_screensize;" .. fgettext("Autosave Screen Size") .. ";"
|
||||
.. dump(core.settings:get_bool("autosave_screensize")) .. "]" ..
|
||||
"box[8,0;3.75,4.5;#999999]"
|
||||
|
||||
local video_driver = core.settings:get("video_driver")
|
||||
@@ -182,10 +200,15 @@ local function formspec(tabview, name, tabdata)
|
||||
|
||||
if core.settings:get("touchscreen_threshold") ~= nil then
|
||||
tab_string = tab_string ..
|
||||
"label[4.3,4.2;" .. fgettext("Touchthreshold: (px)") .. "]" ..
|
||||
"dropdown[4.25,4.65;3.5;dd_touchthreshold;0,10,20,30,40,50;" ..
|
||||
"label[4.25,3.5;" .. fgettext("Touch threshold (px):") .. "]" ..
|
||||
"dropdown[4.25,3.95;3.5;dd_touchthreshold;0,10,20,30,40,50;" ..
|
||||
((tonumber(core.settings:get("touchscreen_threshold")) / 10) + 1) ..
|
||||
"]box[4.0,4.5;3.75,1.0;#999999]"
|
||||
"]"
|
||||
else
|
||||
tab_string = tab_string ..
|
||||
"label[4.25,3.65;" .. fgettext("Screen:") .. "]" ..
|
||||
"checkbox[4.25,3.9;cb_autosave_screensize;" .. fgettext("Autosave Screen Size") .. ";"
|
||||
.. dump(core.settings:get_bool("autosave_screensize")) .. "]"
|
||||
end
|
||||
|
||||
if shaders_enabled then
|
||||
@@ -198,6 +221,18 @@ local function formspec(tabview, name, tabdata)
|
||||
.. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
|
||||
"checkbox[8.25,2;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
|
||||
.. dump(core.settings:get_bool("enable_waving_plants")) .. "]"
|
||||
|
||||
if video_driver == "opengl" then
|
||||
tab_string = tab_string ..
|
||||
"label[8.25,2.8;" .. fgettext("Dynamic shadows:") .. "]" ..
|
||||
"label[8.25,3.2;" .. fgettext("(game support required)") .. "]" ..
|
||||
"dropdown[8.25,3.7;3.5;dd_shadows;" .. dd_options.shadow_levels[1] .. ";"
|
||||
.. getSettingIndex.ShadowMapping() .. "]"
|
||||
else
|
||||
tab_string = tab_string ..
|
||||
"label[8.38,2.7;" .. core.colorize("#888888",
|
||||
fgettext("Dynamic shadows")) .. "]"
|
||||
end
|
||||
else
|
||||
tab_string = tab_string ..
|
||||
"label[8.38,0.7;" .. core.colorize("#888888",
|
||||
@@ -207,7 +242,9 @@ local function formspec(tabview, name, tabdata)
|
||||
"label[8.38,1.7;" .. core.colorize("#888888",
|
||||
fgettext("Waving Leaves")) .. "]" ..
|
||||
"label[8.38,2.2;" .. core.colorize("#888888",
|
||||
fgettext("Waving Plants")) .. "]"
|
||||
fgettext("Waving Plants")) .. "]"..
|
||||
"label[8.38,2.7;" .. core.colorize("#888888",
|
||||
fgettext("Dynamic shadows")) .. "]"
|
||||
end
|
||||
|
||||
return tab_string
|
||||
@@ -221,7 +258,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
adv_settings_dlg:set_parent(this)
|
||||
this:hide()
|
||||
adv_settings_dlg:show()
|
||||
--mm_texture.update("singleplayer", current_game())
|
||||
--mm_game_theme.update("singleplayer", current_game())
|
||||
return true
|
||||
end
|
||||
if fields["cb_smooth_lighting"] then
|
||||
@@ -249,13 +286,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
return true
|
||||
end
|
||||
if fields["cb_shaders"] then
|
||||
if (core.settings:get("video_driver") == "direct3d8" or
|
||||
core.settings:get("video_driver") == "direct3d9") then
|
||||
core.settings:set("enable_shaders", "false")
|
||||
gamedata.errormessage = fgettext("To enable shaders the OpenGL driver needs to be used.")
|
||||
else
|
||||
core.settings:set("enable_shaders", fields["cb_shaders"])
|
||||
end
|
||||
core.settings:set("enable_shaders", fields["cb_shaders"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_tonemapping"] then
|
||||
@@ -333,6 +364,34 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
ddhandled = true
|
||||
end
|
||||
|
||||
for i = 1, #labels.shadow_levels do
|
||||
if fields["dd_shadows"] == labels.shadow_levels[i] then
|
||||
core.settings:set("shadow_levels", dd_options.shadow_levels[2][i])
|
||||
ddhandled = true
|
||||
end
|
||||
end
|
||||
|
||||
if fields["dd_shadows"] == labels.shadow_levels[1] then
|
||||
core.settings:set("enable_dynamic_shadows", "false")
|
||||
else
|
||||
local shadow_presets = {
|
||||
[2] = { 62, 512, "true", 0, "false" },
|
||||
[3] = { 93, 1024, "true", 0, "false" },
|
||||
[4] = { 140, 2048, "true", 1, "false" },
|
||||
[5] = { 210, 4096, "true", 2, "true" },
|
||||
[6] = { 300, 8192, "true", 2, "true" },
|
||||
}
|
||||
local s = shadow_presets[table.indexof(labels.shadow_levels, fields["dd_shadows"])]
|
||||
if s then
|
||||
core.settings:set("enable_dynamic_shadows", "true")
|
||||
core.settings:set("shadow_map_max_distance", s[1])
|
||||
core.settings:set("shadow_map_texture_size", s[2])
|
||||
core.settings:set("shadow_map_texture_32bit", s[3])
|
||||
core.settings:set("shadow_filters", s[4])
|
||||
core.settings:set("shadow_map_color", s[5])
|
||||
end
|
||||
end
|
||||
|
||||
return ddhandled
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
_G.core = {}
|
||||
_G.vector = {metatable = {}}
|
||||
_G.unpack = table.unpack
|
||||
_G.serverlistmgr = {}
|
||||
|
||||
dofile("builtin/common/vector.lua")
|
||||
dofile("builtin/common/misc_helpers.lua")
|
||||
dofile("builtin/mainmenu/serverlistmgr.lua")
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
local S = core.get_translator("__builtin")
|
||||
|
||||
local function get_bool_default(name, default)
|
||||
local val = core.settings:get_bool(name)
|
||||
if val == nil then
|
||||
@@ -40,9 +42,9 @@ function profiler.init_chatcommand()
|
||||
instrumentation.init_chatcommand()
|
||||
end
|
||||
|
||||
local param_usage = "print [filter] | dump [filter] | save [format [filter]] | reset"
|
||||
local param_usage = S("print [<filter>] | dump [<filter>] | save [<format> [<filter>]] | reset")
|
||||
core.register_chatcommand("profiler", {
|
||||
description = "handle the profiler and profiling data",
|
||||
description = S("Handle the profiler and profiling data"),
|
||||
params = param_usage,
|
||||
privs = { server=true },
|
||||
func = function(name, param)
|
||||
@@ -51,21 +53,19 @@ function profiler.init_chatcommand()
|
||||
|
||||
if command == "dump" then
|
||||
core.log("action", reporter.print(sampler.profile, arg0))
|
||||
return true, "Statistics written to action log"
|
||||
return true, S("Statistics written to action log.")
|
||||
elseif command == "print" then
|
||||
return true, reporter.print(sampler.profile, arg0)
|
||||
elseif command == "save" then
|
||||
return reporter.save(sampler.profile, args[1] or "txt", args[2])
|
||||
elseif command == "reset" then
|
||||
sampler.reset()
|
||||
return true, "Statistics were reset"
|
||||
return true, S("Statistics were reset.")
|
||||
end
|
||||
|
||||
return false, string.format(
|
||||
"Usage: %s\n" ..
|
||||
"Format can be one of txt, csv, lua, json, json_pretty (structures may be subject to change).",
|
||||
param_usage
|
||||
)
|
||||
return false,
|
||||
S("Usage: @1", param_usage) .. "\n" ..
|
||||
S("Format can be one of txt, csv, lua, json, json_pretty (structures may be subject to change).")
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
@@ -102,8 +102,9 @@ local function instrument(def)
|
||||
-- also called https://en.wikipedia.org/wiki/Continuation_passing_style
|
||||
-- Compared to table creation and unpacking it won't lose `nil` returns
|
||||
-- and is expected to be faster
|
||||
-- `measure` will be executed after time() and func(...)
|
||||
return measure(modname, instrument_name, time(), func(...))
|
||||
-- `measure` will be executed after func(...)
|
||||
local start = time()
|
||||
return measure(modname, instrument_name, start, func(...))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
local S = core.get_translator("__builtin")
|
||||
-- Note: In this file, only messages are translated
|
||||
-- but not the table itself, to keep it simple.
|
||||
|
||||
local DIR_DELIM, LINE_DELIM = DIR_DELIM, "\n"
|
||||
local table, unpack, string, pairs, io, os = table, unpack, string, pairs, io, os
|
||||
local rep, sprintf, tonumber = string.rep, string.format, tonumber
|
||||
@@ -104,11 +108,11 @@ local TxtFormatter = Formatter:new {
|
||||
end,
|
||||
format = function(self, filter)
|
||||
local profile = self.profile
|
||||
self:print("Values below show absolute/relative times spend per server step by the instrumented function.")
|
||||
self:print("A total of %d samples were taken", profile.stats_total.samples)
|
||||
self:print(S("Values below show absolute/relative times spend per server step by the instrumented function."))
|
||||
self:print(S("A total of @1 sample(s) were taken.", profile.stats_total.samples))
|
||||
|
||||
if filter then
|
||||
self:print("The output is limited to '%s'", filter)
|
||||
self:print(S("The output is limited to '@1'.", filter))
|
||||
end
|
||||
|
||||
self:print()
|
||||
@@ -259,19 +263,18 @@ function reporter.save(profile, format, filter)
|
||||
|
||||
local output, io_err = io.open(path, "w")
|
||||
if not output then
|
||||
return false, "Saving of profile failed with: " .. io_err
|
||||
return false, S("Saving of profile failed: @1", io_err)
|
||||
end
|
||||
local content, err = serialize_profile(profile, format, filter)
|
||||
if not content then
|
||||
output:close()
|
||||
return false, "Saving of profile failed with: " .. err
|
||||
return false, S("Saving of profile failed: @1", err)
|
||||
end
|
||||
output:write(content)
|
||||
output:close()
|
||||
|
||||
local logmessage = "Profile saved to " .. path
|
||||
core.log("action", logmessage)
|
||||
return true, logmessage
|
||||
core.log("action", "Profile saved to " .. path)
|
||||
return true, S("Profile saved to @1", path)
|
||||
end
|
||||
|
||||
return reporter
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ uniform sampler2D textureFlags;
|
||||
#define rightImage normalTexture
|
||||
#define maskImage textureFlags
|
||||
|
||||
varying mediump vec2 varTexCoord;
|
||||
varying mediump vec4 varTexCoord;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
varying mediump vec2 varTexCoord;
|
||||
varying mediump vec4 varTexCoord;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user