Compare commits
1448 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3e51dca15 | ||
|
|
9b59b2f75d | ||
|
|
35b476c65d | ||
|
|
74a93546ea | ||
|
|
4abe4b87b5 | ||
|
|
29681085b9 | ||
|
|
bbf4f7ae54 | ||
|
|
e86fbf9c06 | ||
|
|
f35b9be03d | ||
|
|
f0084d8494 | ||
|
|
b88015d8e4 | ||
|
|
914b011742 | ||
|
|
0e75f85c41 | ||
|
|
d77a8a980f | ||
|
|
308a3fc8f4 | ||
|
|
c1ae72de84 | ||
|
|
9de982dcae | ||
|
|
d8e7b6ec68 | ||
|
|
65047e4192 | ||
|
|
3b7663e79f | ||
|
|
7dc68ebf53 | ||
|
|
8bfe4e3cef | ||
|
|
1b7acd2a6c | ||
|
|
e97dc5ece5 | ||
|
|
9895eba92e | ||
|
|
454fe5be3c | ||
|
|
48f885e310 | ||
|
|
19d3ce7609 | ||
|
|
609eca5b81 | ||
|
|
de29007c82 | ||
|
|
033cba996f | ||
|
|
f879c0b212 | ||
|
|
fbdb517274 | ||
|
|
2291b7ebb8 | ||
|
|
0c80c5635d | ||
|
|
48518b88ad | ||
|
|
cd95832634 | ||
|
|
6cd5bbeb43 | ||
|
|
ff8c2dfd6b | ||
|
|
7f5b4edb66 | ||
|
|
a4d57b4a16 | ||
|
|
ac3d5d0873 | ||
|
|
25e8e2dcdf | ||
|
|
1539c377de | ||
|
|
bce875fada | ||
|
|
051e4c2b00 | ||
|
|
c12e9cdcba | ||
|
|
e441ab9675 | ||
|
|
b2ab5fd161 | ||
|
|
f85e9ab925 | ||
|
|
a8f6befd39 | ||
|
|
7832b6843e | ||
|
|
f018737b06 | ||
|
|
375bcd65c1 | ||
|
|
4db7fb4a3b | ||
|
|
9736b9cea5 | ||
|
|
b28749057a | ||
|
|
1d64e6537c | ||
|
|
6591597430 | ||
|
|
857dbcd572 | ||
|
|
3a8c37181a | ||
|
|
4caf156be5 | ||
|
|
3ac07ad34d | ||
|
|
fbb9ef3818 | ||
|
|
0f74c7a977 | ||
|
|
d287da184c | ||
|
|
9b64834c6a | ||
|
|
8c19823aa7 | ||
|
|
2072afb72b | ||
|
|
f227e40180 | ||
|
|
9388c23e86 | ||
|
|
674d67f312 | ||
|
|
c834d2ab25 | ||
|
|
5e392cf34f | ||
|
|
7ebd5da9cd | ||
|
|
40ad976753 | ||
|
|
a01a02f7a1 | ||
|
|
fd1c1a755e | ||
|
|
112a6adb10 | ||
|
|
6e0e0324a4 | ||
|
|
d1ec5117d9 | ||
|
|
cb807b26e2 | ||
|
|
d39c0310da | ||
|
|
d4e5b0f2b7 | ||
|
|
00e735ee9b | ||
|
|
237d4a948a | ||
|
|
30c28654e8 | ||
|
|
d1a15634c9 | ||
|
|
48691b0b2b | ||
|
|
9eac2edd1a | ||
|
|
588af14733 | ||
|
|
5a7c728a9f | ||
|
|
df40105009 | ||
|
|
722d895e66 | ||
|
|
7f2daf95b5 | ||
|
|
8610adae6c | ||
|
|
a76e224dee | ||
|
|
5fdd3db5e8 | ||
|
|
4160502baa | ||
|
|
071bf32057 | ||
|
|
0b203b35cd | ||
|
|
bf2e079f6d | ||
|
|
d6980c22d3 | ||
|
|
c6abdfef48 | ||
|
|
bb0f2b28ee | ||
|
|
583babc1cf | ||
|
|
9e646364d9 | ||
|
|
5505a6af00 | ||
|
|
3cf6cea911 | ||
|
|
26fd464fb3 | ||
|
|
09b87c6e1a | ||
|
|
9cf4cba7e5 | ||
|
|
9e209a4a90 | ||
|
|
33d9f83c44 | ||
|
|
14f9794ba8 | ||
|
|
54a3b37ea4 | ||
|
|
339faea2e7 | ||
|
|
a66401b32d | ||
|
|
49728d0b01 | ||
|
|
bc69b4d52c | ||
|
|
64599a493c | ||
|
|
dd08fe0a29 | ||
|
|
60a7c02511 | ||
|
|
3b46e94318 | ||
|
|
fa5092dabc | ||
|
|
6657f877a8 | ||
|
|
27441874e4 | ||
|
|
8dea5fd3b3 | ||
|
|
92c12a1fc8 | ||
|
|
0b6614839c | ||
|
|
12eb5fcc48 | ||
|
|
6553777982 | ||
|
|
f79b240764 | ||
|
|
a66d6bcad4 | ||
|
|
44b15b1dc8 | ||
|
|
146b48e2fe | ||
|
|
2bc2d8480a | ||
|
|
3a245e95be | ||
|
|
c600038705 | ||
|
|
f43df20559 | ||
|
|
1c46ab6d69 | ||
|
|
696db40ec3 | ||
|
|
f4503542eb | ||
|
|
54bbea30ef | ||
|
|
f07faf8919 | ||
|
|
55646ed54f | ||
|
|
9851491a3c | ||
|
|
7dea11ba33 | ||
|
|
7a5d8aea38 | ||
|
|
97fd5f012f | ||
|
|
8d36bc2624 | ||
|
|
d8b62dc217 | ||
|
|
632e2bfe65 | ||
|
|
0283ae54da | ||
|
|
0306dab84f | ||
|
|
5871e32a84 | ||
|
|
485e4d82a2 | ||
|
|
aa6bd97503 | ||
|
|
9cb7570cfb | ||
|
|
10c237a274 | ||
|
|
4015f4eada | ||
|
|
366ff51e0e | ||
|
|
e2f97b5ec0 | ||
|
|
ffe56c572f | ||
|
|
bd8dfdd263 | ||
|
|
ab5065d54a | ||
|
|
264ab502e1 | ||
|
|
ccadc23864 | ||
|
|
6cca7c1996 | ||
|
|
70a066571e | ||
|
|
683cc45a5c | ||
|
|
265df122f6 | ||
|
|
5e01970c40 | ||
|
|
b43f8cb2de | ||
|
|
fb129f17ec | ||
|
|
c1957df543 | ||
|
|
ace25f516b | ||
|
|
426bae8a98 | ||
|
|
4232a1335f | ||
|
|
775d22aacb | ||
|
|
855545d306 | ||
|
|
e0ff898bfd | ||
|
|
fbd62e4097 | ||
|
|
08c0b8783d | ||
|
|
495f371166 | ||
|
|
e27febae0f | ||
|
|
5bb87f62e7 | ||
|
|
7abfd06aa3 | ||
|
|
0936fa2eeb | ||
|
|
67f319ba94 | ||
|
|
7a64f31abe | ||
|
|
495621bc60 | ||
|
|
ad70c1d422 | ||
|
|
c641a81693 | ||
|
|
990380d81e | ||
|
|
27dfe653fe | ||
|
|
3fa8232607 | ||
|
|
9a177f009b | ||
|
|
9c91cbf50c | ||
|
|
5c005ad081 | ||
|
|
83229921e5 | ||
|
|
edd8c3c664 | ||
|
|
e6e5910cb4 | ||
|
|
2760371d8e | ||
|
|
37a05ec8d6 | ||
|
|
5e9dd1667b | ||
|
|
b5956bde25 | ||
|
|
ed0882fd58 | ||
|
|
82deed2d7d | ||
|
|
44a9510c81 | ||
|
|
8dae7b47fc | ||
|
|
ad9adcb884 | ||
|
|
6a55c03dab | ||
|
|
6417f4d314 | ||
|
|
009e39e73b | ||
|
|
4c76239818 | ||
|
|
67aa75d444 | ||
|
|
4fcd000e20 | ||
|
|
8ff209c412 | ||
|
|
45ccfe26fb | ||
|
|
ea5d6312c1 | ||
|
|
d92da47697 | ||
|
|
7f25823bd4 | ||
|
|
eb8af614a5 | ||
|
|
cc44943528 | ||
|
|
6693a4b30e | ||
|
|
e86c93f0bf | ||
|
|
5e6df0e7be | ||
|
|
4b01282821 | ||
|
|
1946835ee8 | ||
|
|
08ee9794fb | ||
|
|
fcb3ed840a | ||
|
|
5fcc78a1fe | ||
|
|
58a709096e | ||
|
|
e663aecbae | ||
|
|
edd0836011 | ||
|
|
dd5a732fa9 | ||
|
|
ad58fb2206 | ||
|
|
92aac69b36 | ||
|
|
ff921f6989 | ||
|
|
9250b5205a | ||
|
|
09d7fbd645 | ||
|
|
55dba1bc6d | ||
|
|
8f72d4b294 | ||
|
|
74762470b2 | ||
|
|
289425f6bd | ||
|
|
2c3593b51e | ||
|
|
2bdf4955c8 | ||
|
|
d2bbf13dfe | ||
|
|
535557cc2e | ||
|
|
03540e7140 | ||
|
|
af22dd86e3 | ||
|
|
5066fe7583 | ||
|
|
ccbf8029ea | ||
|
|
664f5ce960 | ||
|
|
025035db5c | ||
|
|
d5a481b4e6 | ||
|
|
6f8a1c99d5 | ||
|
|
e638056523 | ||
|
|
d0a38f694d | ||
|
|
3ed940ff13 | ||
|
|
4d41ed0975 | ||
|
|
f2c8c6bf51 | ||
|
|
e18b6c5a21 | ||
|
|
af073438fd | ||
|
|
6d7067fd37 | ||
|
|
07e0b527cf | ||
|
|
08c9d1a669 | ||
|
|
e73c5d4585 | ||
|
|
ecd4f45318 | ||
|
|
3176daee79 | ||
|
|
f1d72d212a | ||
|
|
9bb381ebd3 | ||
|
|
868749b4f8 | ||
|
|
8689e00fca | ||
|
|
c158e20e5b | ||
|
|
cdcf7dca7c | ||
|
|
be59668f47 | ||
|
|
d7cf40a0ce | ||
|
|
560627eef8 | ||
|
|
3077afc0a2 | ||
|
|
89cc5bf537 | ||
|
|
095f82692d | ||
|
|
f1349be542 | ||
|
|
8dc70ebb93 | ||
|
|
78273027bf | ||
|
|
43bc3a1245 | ||
|
|
872dce5020 | ||
|
|
2f6393f49d | ||
|
|
a16e412c9d | ||
|
|
ee1853e9bc | ||
|
|
ad58ece180 | ||
|
|
61bbdd6807 | ||
|
|
b504a1aa4b | ||
|
|
c441baa91b | ||
|
|
8eb2cbac61 | ||
|
|
68139a28eb | ||
|
|
adffef2b94 | ||
|
|
be8d1d2d99 | ||
|
|
be3fe161fc | ||
|
|
fca4db4184 | ||
|
|
97aefe9b81 | ||
|
|
b6e47a30bb | ||
|
|
e1142ee57f | ||
|
|
7589cbe086 | ||
|
|
c940a57a38 | ||
|
|
8c1871fa2c | ||
|
|
627c22c36e | ||
|
|
3356da0151 | ||
|
|
e3bd6704a0 | ||
|
|
72b93ec0d7 | ||
|
|
39213bd00a | ||
|
|
aa4d3cb148 | ||
|
|
0abb3e89fa | ||
|
|
9c9344ceb3 | ||
|
|
89dd05fdf3 | ||
|
|
2dff3dd03f | ||
|
|
a701d24a00 | ||
|
|
68cd93b865 | ||
|
|
61a196378f | ||
|
|
707c8c1e95 | ||
|
|
33b2c5f5b1 | ||
|
|
9d370b78da | ||
|
|
5c0a57f606 | ||
|
|
f53396b152 | ||
|
|
4d9c9186ce | ||
|
|
c7aa92aaed | ||
|
|
4f2303849e | ||
|
|
660115c1ab | ||
|
|
b826e39730 | ||
|
|
db9eee2d80 | ||
|
|
738f624218 | ||
|
|
ed22260822 | ||
|
|
f43d1cfa81 | ||
|
|
2f871e3b49 | ||
|
|
fc2e120b03 | ||
|
|
7499ebe46a | ||
|
|
2ca81d679f | ||
|
|
e831ebd63b | ||
|
|
05436fb551 | ||
|
|
2341a4aff1 | ||
|
|
521a04222a | ||
|
|
11f3deb9c4 | ||
|
|
d671102546 | ||
|
|
272b72361a | ||
|
|
c61c175e9c | ||
|
|
f3ae45b2b2 | ||
|
|
b2f3f66385 | ||
|
|
f0b6f7909a | ||
|
|
a37e96eefc | ||
|
|
aae7d4ff8e | ||
|
|
2f4037752b | ||
|
|
e80fc22dd9 | ||
|
|
f46509d5e2 | ||
|
|
81c66d6efb | ||
|
|
3068853e8a | ||
|
|
0f98b54aa4 | ||
|
|
3250b37e32 | ||
|
|
41a6136f77 | ||
|
|
9624387179 | ||
|
|
7d3641021b | ||
|
|
0750047919 | ||
|
|
9dc29a75b4 | ||
|
|
4b423ee9b1 | ||
|
|
947466ab28 | ||
|
|
ca5c2dbefa | ||
|
|
79414aa3e5 | ||
|
|
a69bc67ce2 | ||
|
|
995d405261 | ||
|
|
d3e327a853 | ||
|
|
4298d95b16 | ||
|
|
65c15e137f | ||
|
|
917e357bca | ||
|
|
9eb4516cbc | ||
|
|
09af0c5946 | ||
|
|
c6e3050357 | ||
|
|
9bff154cba | ||
|
|
787561b29a | ||
|
|
34e3ede8ee | ||
|
|
add68369a5 | ||
|
|
55e2dd911b | ||
|
|
e7f33ee2f1 | ||
|
|
49117de476 | ||
|
|
9ec75d7765 | ||
|
|
c8303f790c | ||
|
|
fcff9f2911 | ||
|
|
3fb1f45301 | ||
|
|
0683bea283 | ||
|
|
62913b872e | ||
|
|
0d128ab344 | ||
|
|
6dcc9e6331 | ||
|
|
9faeca3290 | ||
|
|
b3ace8f197 | ||
|
|
050964bed6 | ||
|
|
4ba5046308 | ||
|
|
74e22b72e1 | ||
|
|
9ed84cfa85 | ||
|
|
f5df70764d | ||
|
|
d3d218940b | ||
|
|
c18dbadcb8 | ||
|
|
5c4b560b68 | ||
|
|
386d5f778a | ||
|
|
28e87ce9d5 | ||
|
|
9976f36b18 | ||
|
|
3693b6871e | ||
|
|
d28f1b0170 | ||
|
|
454009a7f2 | ||
|
|
1eaff3dfa4 | ||
|
|
d052593c7a | ||
|
|
788f297595 | ||
|
|
b262184acf | ||
|
|
44c98089cf | ||
|
|
f27cf47779 | ||
|
|
3e5bce2251 | ||
|
|
287f3fb2e3 | ||
|
|
3c2890692b | ||
|
|
47948793c1 | ||
|
|
f5a203fbcd | ||
|
|
cf5547227d | ||
|
|
98faeac5a7 | ||
|
|
9c7340104a | ||
|
|
71287894ad | ||
|
|
83d0c360cc | ||
|
|
471497fa91 | ||
|
|
5bda36143f | ||
|
|
649211bf27 | ||
|
|
7242de1d4b | ||
|
|
291a6b70d6 | ||
|
|
fff0393187 | ||
|
|
1c38027c3a | ||
|
|
cd0e213a36 | ||
|
|
abfea69e5f | ||
|
|
f92a393f6f | ||
|
|
93ecc589bc | ||
|
|
d22fd6fc34 | ||
|
|
542df11bed | ||
|
|
aba8c37531 | ||
|
|
9bba52c400 | ||
|
|
e5725dfb8e | ||
|
|
470f328216 | ||
|
|
715a123a33 | ||
|
|
f34abaedd2 | ||
|
|
3ce03d1c2a | ||
|
|
f948e2c585 | ||
|
|
ae83edd165 | ||
|
|
808fa5ecb3 | ||
|
|
8ca602150d | ||
|
|
76afde861d | ||
|
|
82731d0d3d | ||
|
|
cfaef5b1cf | ||
|
|
4b4513a67d | ||
|
|
88ffd64124 | ||
|
|
4fa1e03f68 | ||
|
|
2bec83eec0 | ||
|
|
1dd6c8ed7f | ||
|
|
e0499731a8 | ||
|
|
d80def5bbf | ||
|
|
c6422e0872 | ||
|
|
b1ff04e06d | ||
|
|
2384c10e10 | ||
|
|
057f0b82c2 | ||
|
|
70df3d54f3 | ||
|
|
21de17e3b6 | ||
|
|
b4c25872f1 | ||
|
|
5f3f806d67 | ||
|
|
352529e749 | ||
|
|
3c175707eb | ||
|
|
b7129f63c4 | ||
|
|
3547c47ee7 | ||
|
|
ab175e259e | ||
|
|
9889f57cbc | ||
|
|
550549d56b | ||
|
|
6ca7d42969 | ||
|
|
4324b93615 | ||
|
|
55c30596e3 | ||
|
|
4f59bebd37 | ||
|
|
1e05ef1803 | ||
|
|
38d0253b7e | ||
|
|
63800fe843 | ||
|
|
e07090cd7e | ||
|
|
fd9e7abf0e | ||
|
|
b3867a4b4c | ||
|
|
f30331af39 | ||
|
|
e2878567ca | ||
|
|
6da65f1ba9 | ||
|
|
dcdc6b762f | ||
|
|
387a3493c5 | ||
|
|
5435442ce7 | ||
|
|
d9fe830810 | ||
|
|
b0019b876a | ||
|
|
822fdb60bc | ||
|
|
6a58fc0e3c | ||
|
|
184cbaade7 | ||
|
|
34a20b358c | ||
|
|
cbd964e572 | ||
|
|
b706049981 | ||
|
|
719b0e9850 | ||
|
|
ac0f168e10 | ||
|
|
4c05453cbe | ||
|
|
de35541465 | ||
|
|
5564babc94 | ||
|
|
3ebfe0ccfd | ||
|
|
6e51935aa9 | ||
|
|
2675fb93ac | ||
|
|
ecc66ccf40 | ||
|
|
6e12846ad8 | ||
|
|
99541ab294 | ||
|
|
6e5fc82f9a | ||
|
|
7c52a53aeb | ||
|
|
faf1985953 | ||
|
|
68cc9583da | ||
|
|
12dd01b731 | ||
|
|
b3f78c57a8 | ||
|
|
42b0d612ef | ||
|
|
ebb721a476 | ||
|
|
6e4d8de104 | ||
|
|
dc6318b84a | ||
|
|
da71313e1d | ||
|
|
3f702fa1a9 | ||
|
|
7be082f9a8 | ||
|
|
3014e8b33b | ||
|
|
ee6c499ff8 | ||
|
|
646af2ef5f | ||
|
|
f7c78993f6 | ||
|
|
d7a2113893 | ||
|
|
4cb18d4874 | ||
|
|
e99415e0c5 | ||
|
|
0f1f8e4a0f | ||
|
|
a2199bf622 | ||
|
|
57df895cf9 | ||
|
|
495f7198ef | ||
|
|
469e8d8b7e | ||
|
|
8ebeed53ad | ||
|
|
a1b444bb61 | ||
|
|
3a6dfda358 | ||
|
|
0a1181f763 | ||
|
|
0ba19a08b8 | ||
|
|
c013a24787 | ||
|
|
24e58b7546 | ||
|
|
8aa1a36beb | ||
|
|
e0c094f414 | ||
|
|
0785802269 | ||
|
|
b8b3cec9eb | ||
|
|
2b42319cb8 | ||
|
|
978d9a667e | ||
|
|
60f635e335 | ||
|
|
7a8ba99c75 | ||
|
|
d7106c4d5f | ||
|
|
d69d6fe003 | ||
|
|
849f7efac5 | ||
|
|
f86c7f5db6 | ||
|
|
a72a900c82 | ||
|
|
e9052d6060 | ||
|
|
b0500f9db9 | ||
|
|
f664ff1285 | ||
|
|
197ab7570f | ||
|
|
17ebb72ebe | ||
|
|
c4a7c8a420 | ||
|
|
4e3dba902e | ||
|
|
c5b22bf6da | ||
|
|
47081a5338 | ||
|
|
cdd1dc8b82 | ||
|
|
8e44cdcddb | ||
|
|
329b62a02c | ||
|
|
c13919d3b4 | ||
|
|
e882cbb9ac | ||
|
|
7f7706a538 | ||
|
|
6f3fc76db3 | ||
|
|
3d17394410 | ||
|
|
4fcc671742 | ||
|
|
5fb86768e8 | ||
|
|
f0513a9d46 | ||
|
|
51656cd96d | ||
|
|
1c6970ace0 | ||
|
|
372506bc94 | ||
|
|
f0e31ee1be | ||
|
|
082d48e644 | ||
|
|
2f8492949a | ||
|
|
c3306c469a | ||
|
|
eeb85c304b | ||
|
|
5de7d1c346 | ||
|
|
fee4ac710c | ||
|
|
9feae63557 | ||
|
|
604acbfd29 | ||
|
|
ff42264d07 | ||
|
|
caac1e131b | ||
|
|
ec26fab3b6 | ||
|
|
e2e27fa04b | ||
|
|
e27ff020ee | ||
|
|
d6a2e4136b | ||
|
|
0f44dbe60d | ||
|
|
586ad0d24b | ||
|
|
e7e065f553 | ||
|
|
2424dfe007 | ||
|
|
982a030f33 | ||
|
|
3f0cbbc372 | ||
|
|
f89794108c | ||
|
|
80d9e9c183 | ||
|
|
64380cf92e | ||
|
|
fe3e69eb40 | ||
|
|
7148834440 | ||
|
|
b16f841756 | ||
|
|
09e285f38c | ||
|
|
b9f618746c | ||
|
|
0d8e5bf587 | ||
|
|
756dc89ede | ||
|
|
3cee55f2b4 | ||
|
|
a21f9bb7e6 | ||
|
|
0ab580810c | ||
|
|
09f9e465e7 | ||
|
|
fe1f72ab0a | ||
|
|
8fc9e7eb11 | ||
|
|
e746607d0f | ||
|
|
36099ba947 | ||
|
|
60bab8b2d7 | ||
|
|
7ec0e3df35 | ||
|
|
08c0b7696a | ||
|
|
87b25e583d | ||
|
|
850af80089 | ||
|
|
c1e01bc638 | ||
|
|
0e698e63b3 | ||
|
|
42a9b45c21 | ||
|
|
a08d18acad | ||
|
|
f849917bbe | ||
|
|
51de4ae297 | ||
|
|
4c8e1c3200 | ||
|
|
db7c262ee8 | ||
|
|
34862a6442 | ||
|
|
65a6a316d0 | ||
|
|
9a64a9fd94 | ||
|
|
471e567657 | ||
|
|
2fd5f38c45 | ||
|
|
03dae5fba6 | ||
|
|
f90ca96c73 | ||
|
|
58f523e363 | ||
|
|
ba553e22e4 | ||
|
|
8713924811 | ||
|
|
1afd6d682a | ||
|
|
083b285f43 | ||
|
|
b546e8938d | ||
|
|
5311a27523 | ||
|
|
212a1123e0 | ||
|
|
b3c79906d4 | ||
|
|
6456aba73f | ||
|
|
a9b74f4c39 | ||
|
|
f51cf7c68a | ||
|
|
5430770b68 | ||
|
|
a9d6be8b6f | ||
|
|
8ee2ece3c9 | ||
|
|
10c3002aea | ||
|
|
9d6e7e48d6 | ||
|
|
15ba75e4cf | ||
|
|
037422fdba | ||
|
|
e79bc40c0a | ||
|
|
7ab0c0662a | ||
|
|
1357ea1da2 | ||
|
|
1bcdc2d7e9 | ||
|
|
82e4137893 | ||
|
|
42fcfb75e8 | ||
|
|
c47a680db7 | ||
|
|
732c8008f4 | ||
|
|
c94d37827d | ||
|
|
7d3972a504 | ||
|
|
0fc51db772 | ||
|
|
11723cffe0 | ||
|
|
52430d34d3 | ||
|
|
be38a44ffe | ||
|
|
a9c3a42323 | ||
|
|
c1ce4be756 | ||
|
|
ab745685c7 | ||
|
|
a08251a61e | ||
|
|
af0f7ac4a2 | ||
|
|
d76785b4c7 | ||
|
|
36d35f2fe3 | ||
|
|
6ef7ad09bb | ||
|
|
836dd4a1e4 | ||
|
|
2d7e000cfe | ||
|
|
6c607e2082 | ||
|
|
4e997e9d04 | ||
|
|
7ec76e530d | ||
|
|
9ba24f89f5 | ||
|
|
6e1372bd89 | ||
|
|
88bb8e57e6 | ||
|
|
7cb53791c3 | ||
|
|
b6242498aa | ||
|
|
454dbf83a9 | ||
|
|
650168cada | ||
|
|
4f9ccd89b3 | ||
|
|
664800b2ad | ||
|
|
4f9a5f67ee | ||
|
|
e8e5d282da | ||
|
|
723926a995 | ||
|
|
b6b80f55c8 | ||
|
|
cb159f8d8a | ||
|
|
f3e87c53a5 | ||
|
|
ab06880525 | ||
|
|
c28fbd06a8 | ||
|
|
3c65d1acec | ||
|
|
2062c80e21 | ||
|
|
d1c6cc72cc | ||
|
|
f34c62c47f | ||
|
|
f1a05d0f71 | ||
|
|
cad5b987ad | ||
|
|
1b6f40c356 | ||
|
|
3ed5619d9a | ||
|
|
373bad16c0 | ||
|
|
66c182531c | ||
|
|
cb9a44ef89 | ||
|
|
5c96f57782 | ||
|
|
808eb4c571 | ||
|
|
61d93988d8 | ||
|
|
e0ea87f1f3 | ||
|
|
ac368af4fe | ||
|
|
74d9b6010f | ||
|
|
3f275d799c | ||
|
|
00323e8fce | ||
|
|
56bababcdf | ||
|
|
a36c9c3e93 | ||
|
|
a368e7e793 | ||
|
|
b9377f26a1 | ||
|
|
3475759d1a | ||
|
|
aef59f2ad9 | ||
|
|
ca8957f500 | ||
|
|
13a8ea2dac | ||
|
|
91c4f7f0ea | ||
|
|
be71e70a91 | ||
|
|
515d38a702 | ||
|
|
8a03097450 | ||
|
|
d3f50f216f | ||
|
|
f6f6dd140f | ||
|
|
e564bf8ead | ||
|
|
2fe4641c1e | ||
|
|
68f45fc130 | ||
|
|
eca6ee911a | ||
|
|
e1fc72c6f3 | ||
|
|
bc60e44d80 | ||
|
|
8b45f6a5f3 | ||
|
|
73180a73da | ||
|
|
49ed0ca00a | ||
|
|
6cc5c7cbb4 | ||
|
|
cee3c5e73d | ||
|
|
914dbeaa0b | ||
|
|
ce5b0932f8 | ||
|
|
6ba44d7452 | ||
|
|
5355cb1d87 | ||
|
|
4361bfcb4d | ||
|
|
8ef239b448 | ||
|
|
c2ac7b1a83 | ||
|
|
27a485a472 | ||
|
|
338195ff25 | ||
|
|
cdbe3c5e57 | ||
|
|
c87d52a5fa | ||
|
|
87829cd744 | ||
|
|
4fb6b6afa7 | ||
|
|
241bf44260 | ||
|
|
7b57d3f613 | ||
|
|
23c6d0c31f | ||
|
|
4e2473ec49 | ||
|
|
e88719bcdd | ||
|
|
7539267d37 | ||
|
|
093e79ea78 | ||
|
|
57038b3cb4 | ||
|
|
45999b74e6 | ||
|
|
5cbe8437a8 | ||
|
|
e8ac5a31cf | ||
|
|
62ae7adab2 | ||
|
|
8ae8c1600a | ||
|
|
5c588f89e7 | ||
|
|
62c62f3829 | ||
|
|
032d90b9f6 | ||
|
|
2d5bd3bf79 | ||
|
|
7c43cf47c3 | ||
|
|
5cf6318117 | ||
|
|
7e21b3cd48 | ||
|
|
27d611fe55 | ||
|
|
0ac999ded7 | ||
|
|
6cf15cf872 | ||
|
|
d7e706ac9d | ||
|
|
b55dd5d82f | ||
|
|
a24d3b3600 | ||
|
|
3833396cfa | ||
|
|
af2e6a6a10 | ||
|
|
f780bae05c | ||
|
|
ba3587e776 | ||
|
|
840b17ce63 | ||
|
|
40df3931d8 | ||
|
|
5cc06e4748 | ||
|
|
5146086a64 | ||
|
|
894a34aef4 | ||
|
|
c99e8df07f | ||
|
|
2a7267febf | ||
|
|
6d43736172 | ||
|
|
01b3f26c7b | ||
|
|
fbf74dc524 | ||
|
|
1292bdbbce | ||
|
|
5f3a17eb65 | ||
|
|
054c5dfaa3 | ||
|
|
f105bc8dc2 | ||
|
|
aa3cf400e2 | ||
|
|
35e778ee9f | ||
|
|
f648fb76ae | ||
|
|
2349d31bae | ||
|
|
12275e235a | ||
|
|
3ad5388c6d | ||
|
|
c1742b0901 | ||
|
|
d6ad587ab8 | ||
|
|
659245acc7 | ||
|
|
de73f989eb | ||
|
|
3494475df1 | ||
|
|
143a37e947 | ||
|
|
f45ba78a72 | ||
|
|
661b4a1837 | ||
|
|
f91124a0c0 | ||
|
|
faedde08f9 | ||
|
|
528b162d9f | ||
|
|
24147d99c0 | ||
|
|
09b8f5d1be | ||
|
|
40dccc0f54 | ||
|
|
7aec5f43be | ||
|
|
e6e1c1281d | ||
|
|
0eb3072819 | ||
|
|
ea30b89d3f | ||
|
|
d5c4412536 | ||
|
|
86a0e991ef | ||
|
|
307d7376cf | ||
|
|
b8d29ab0af | ||
|
|
fe21aa1f4a | ||
|
|
b6d2c34a15 | ||
|
|
6940e5a191 | ||
|
|
65884816be | ||
|
|
e223d7cf57 | ||
|
|
11f4525865 | ||
|
|
965e2028de | ||
|
|
be0200b215 | ||
|
|
96696cd1c0 | ||
|
|
82a08213f0 | ||
|
|
19b8f12e79 | ||
|
|
665b90a3c4 | ||
|
|
c08ced0928 | ||
|
|
c71e54fa6d | ||
|
|
391432eb9e | ||
|
|
39c4df6b80 | ||
|
|
ad2e2d3f08 | ||
|
|
9003ddb8d6 | ||
|
|
7ea3dfd290 | ||
|
|
0a1725d345 | ||
|
|
9ae2b7c8a6 | ||
|
|
cee3a3fd63 | ||
|
|
50b30de407 | ||
|
|
bfe91e0b8f | ||
|
|
a5ec71f758 | ||
|
|
6831836d0d | ||
|
|
316f1e028d | ||
|
|
02fd884d04 | ||
|
|
facce8b966 | ||
|
|
ad2de3ad95 | ||
|
|
214d99a4d0 | ||
|
|
0ed27ffd37 | ||
|
|
fa9278963b | ||
|
|
548efbf16f | ||
|
|
668d834583 | ||
|
|
811acbc8fd | ||
|
|
4d3e2f8d69 | ||
|
|
2a1ad6a903 | ||
|
|
e94ba07a69 | ||
|
|
2de515f311 | ||
|
|
2048377c78 | ||
|
|
af076ba747 | ||
|
|
f055e9bdc3 | ||
|
|
45a2ca0af2 | ||
|
|
3d6b55d3e9 | ||
|
|
d7825bca1b | ||
|
|
9953145a4e | ||
|
|
13b228513e | ||
|
|
c6d6358b92 | ||
|
|
04961491c1 | ||
|
|
3c0d309643 | ||
|
|
49a558574f | ||
|
|
a0998754a7 | ||
|
|
f7c7353a9a | ||
|
|
f3032a637c | ||
|
|
625b100593 | ||
|
|
5c1b72544a | ||
|
|
ca646487f2 | ||
|
|
5a31d56c9f | ||
|
|
13ad8e2a09 | ||
|
|
1441281809 | ||
|
|
8546d6089a | ||
|
|
7908b20dd9 | ||
|
|
245876cddb | ||
|
|
766d160ffb | ||
|
|
fd4daefb29 | ||
|
|
b42493fb4c | ||
|
|
7a7bfdca7c | ||
|
|
7da4f9ef20 | ||
|
|
30d795b4b2 | ||
|
|
0cb34ce158 | ||
|
|
c49575ef97 | ||
|
|
b9a0626d88 | ||
|
|
23c907befe | ||
|
|
0e88176db8 | ||
|
|
ce8cdc0333 | ||
|
|
9ca0b3739c | ||
|
|
db95ff2286 | ||
|
|
e774d8ca2f | ||
|
|
8d6a0b917c | ||
|
|
ef09e8a4d6 | ||
|
|
946c03c69b | ||
|
|
580e7e8eb9 | ||
|
|
6d8e2d2483 | ||
|
|
1761d7d0f8 | ||
|
|
7dffd08c1a | ||
|
|
0c08f948d7 | ||
|
|
244121b964 | ||
|
|
8ddb6718e3 | ||
|
|
e2fc93022b | ||
|
|
6be7150cd5 | ||
|
|
217f3a42f4 | ||
|
|
2bb7d3aa99 | ||
|
|
0b8d3f99a5 | ||
|
|
c657fb343f | ||
|
|
4da057cc49 | ||
|
|
2df226bb41 | ||
|
|
d507047443 | ||
|
|
e8a8185d24 | ||
|
|
6958071f49 | ||
|
|
478e753298 | ||
|
|
3f675490df | ||
|
|
7ce21788f8 | ||
|
|
ee7d357602 | ||
|
|
71899e11d2 | ||
|
|
ff769e7df5 | ||
|
|
ac5f53e364 | ||
|
|
df74d369a3 | ||
|
|
c2f48eab4d | ||
|
|
2d5e0ce5ba | ||
|
|
91eef646a5 | ||
|
|
b14aa1c847 | ||
|
|
4eb3baa51e | ||
|
|
7d29611c1b | ||
|
|
c10e188594 | ||
|
|
ace3c76112 | ||
|
|
ea5e231959 | ||
|
|
2b3490db1f | ||
|
|
1116918dbb | ||
|
|
908e762479 | ||
|
|
60544ac56f | ||
|
|
cde2a7f6f2 | ||
|
|
9cb3219f34 | ||
|
|
987b2c5f37 | ||
|
|
e80c0bdea5 | ||
|
|
5e929c6b7f | ||
|
|
53123bbb6b | ||
|
|
73241423fb | ||
|
|
d4b8075c35 | ||
|
|
5e6e46f059 | ||
|
|
992705b4db | ||
|
|
384ad7dec4 | ||
|
|
8bf790b70e | ||
|
|
0e4ad952da | ||
|
|
231ea6cbce | ||
|
|
527fabdac1 | ||
|
|
ab3aef666b | ||
|
|
c2d0d9027c | ||
|
|
85b03f3fd3 | ||
|
|
73f89e59ed | ||
|
|
70601008da | ||
|
|
fb0d672373 | ||
|
|
4c020bb6fc | ||
|
|
117397a5fc | ||
|
|
82f577c740 | ||
|
|
7909701389 | ||
|
|
899bc0eb0d | ||
|
|
5233f81660 | ||
|
|
4d792186b8 | ||
|
|
5e5ed606b1 | ||
|
|
240f5d4f19 | ||
|
|
c69e3ed6e8 | ||
|
|
271ca52f0a | ||
|
|
03843cf5d3 | ||
|
|
4d4ea46b2e | ||
|
|
6cb9e26f38 | ||
|
|
6b754bfe3b | ||
|
|
d3bd7c5c0f | ||
|
|
30ea18a127 | ||
|
|
b1c4037eec | ||
|
|
5648e7ac46 | ||
|
|
ef8afb06d1 | ||
|
|
66ec4f3d01 | ||
|
|
af28afdac4 | ||
|
|
662dd157ed | ||
|
|
43db70f480 | ||
|
|
cc667ba7aa | ||
|
|
23484ff0cf | ||
|
|
068c70bb9e | ||
|
|
cde683a4c7 | ||
|
|
f35dd3b2a8 | ||
|
|
31002669c1 | ||
|
|
8751915bd2 | ||
|
|
4a58f2525a | ||
|
|
e045ed9ebf | ||
|
|
c0c76219fe | ||
|
|
a431f5e757 | ||
|
|
94af88bdba | ||
|
|
527d29de25 | ||
|
|
bc29596458 | ||
|
|
ac9f83197f | ||
|
|
7a3d8ec522 | ||
|
|
601906064a | ||
|
|
b83ca324f9 | ||
|
|
105fff174c | ||
|
|
a36eae7546 | ||
|
|
645b4ce58b | ||
|
|
199eee5be0 | ||
|
|
4a89b1d71f | ||
|
|
5e983a1d6e | ||
|
|
811326e2a7 | ||
|
|
29d5d9987b | ||
|
|
1c6a93f4be | ||
|
|
8fddab5118 | ||
|
|
6bb6521eee | ||
|
|
22f7dd3bd9 | ||
|
|
5ed9e6ac49 | ||
|
|
b6e7a064de | ||
|
|
7417d01ede | ||
|
|
8a9e9d76de | ||
|
|
497368c664 | ||
|
|
b82e0b3803 | ||
|
|
831d192bb2 | ||
|
|
b6c246b638 | ||
|
|
2054198c64 | ||
|
|
71360b2d3a | ||
|
|
17fd82cee1 | ||
|
|
273cdb38a9 | ||
|
|
c8583f9a5e | ||
|
|
a1da9caecf | ||
|
|
1892ff3c0d | ||
|
|
fab3f5f7c8 | ||
|
|
e05b7dbb3c | ||
|
|
3dfb6ecbb2 | ||
|
|
0877587cce | ||
|
|
468eb4bf57 | ||
|
|
e8fd1ce623 | ||
|
|
1173ff0c13 | ||
|
|
6d472b1840 | ||
|
|
680aaa1bd5 | ||
|
|
cea4fd2b27 | ||
|
|
c396800629 | ||
|
|
8d75c118d9 | ||
|
|
4c8af5492b | ||
|
|
3189e4466b | ||
|
|
f4f7c7a11b | ||
|
|
7c0e0c34ec | ||
|
|
f9c7e46a34 | ||
|
|
3ad92baa9c | ||
|
|
c162340973 | ||
|
|
44458896d9 | ||
|
|
876a15bd75 | ||
|
|
7199dc7559 | ||
|
|
9c28acd29b | ||
|
|
37f771a95b | ||
|
|
ec3224dce2 | ||
|
|
4b9fabf172 | ||
|
|
80af58c8c5 | ||
|
|
39a1e6660e | ||
|
|
db7e59f472 | ||
|
|
b50dc43f67 | ||
|
|
e42faae8d9 | ||
|
|
bd4b8d40b3 | ||
|
|
41ff0f6679 | ||
|
|
03e1f23a5e | ||
|
|
c3d0aab0bc | ||
|
|
8e63d22d64 | ||
|
|
9284313d17 | ||
|
|
a462181e5f | ||
|
|
8f73ec6c6c | ||
|
|
d3255f92d7 | ||
|
|
51b4ddc4c9 | ||
|
|
27ce6d0ecc | ||
|
|
103d9c5c53 | ||
|
|
aa8df112ff | ||
|
|
51f230895c | ||
|
|
4f45bfd08b | ||
|
|
9a5d43a4f5 | ||
|
|
cf7fda0083 | ||
|
|
f6de86ce4b | ||
|
|
ef8bf3cf35 | ||
|
|
4b6bff46e1 | ||
|
|
0b2f0914cc | ||
|
|
154080c883 | ||
|
|
ec5f591014 | ||
|
|
b50a166bb0 | ||
|
|
60bff1e6cb | ||
|
|
b3c245bb46 | ||
|
|
c10952b574 | ||
|
|
97764600e2 | ||
|
|
706b6aad06 | ||
|
|
49365b25d9 | ||
|
|
b5f5e00b29 | ||
|
|
02111e4961 | ||
|
|
c44318a253 | ||
|
|
2c4cf508a9 | ||
|
|
3f271564e0 | ||
|
|
682b9de824 | ||
|
|
b57dc70769 | ||
|
|
b0260b5ec8 | ||
|
|
4d668f32a6 | ||
|
|
3b0df9760b | ||
|
|
d961ece144 | ||
|
|
485b669840 | ||
|
|
7e649f985c | ||
|
|
b1f2a69382 | ||
|
|
82a2e02323 | ||
|
|
5ab546f99b | ||
|
|
17191a60fb | ||
|
|
f35533a953 | ||
|
|
7f023de5cb | ||
|
|
dfd5f7cb10 | ||
|
|
29a4a8e5af | ||
|
|
d11bfa3ef5 | ||
|
|
2a74727857 | ||
|
|
5506e97ed8 | ||
|
|
15a030ec9f | ||
|
|
2907c0f3a2 | ||
|
|
388ea737f5 | ||
|
|
72416a6a1f | ||
|
|
8697090b35 | ||
|
|
5f835a72b2 | ||
|
|
f2e62298a5 | ||
|
|
8ee16180c7 | ||
|
|
53ebd803c6 | ||
|
|
1f142ec06f | ||
|
|
cd35949cd0 | ||
|
|
2f3c96b38d | ||
|
|
2ecf57c640 | ||
|
|
904b05b0d3 | ||
|
|
524442fc5e | ||
|
|
a978278bfb | ||
|
|
79440605ec | ||
|
|
15b6922ae6 | ||
|
|
b7e358703f | ||
|
|
2dd4f8d3fe | ||
|
|
0df646e068 | ||
|
|
47d0779365 | ||
|
|
69a2099c04 | ||
|
|
894008ce6f | ||
|
|
4e4fb4db2a | ||
|
|
ffe7f96d24 | ||
|
|
22e04d9919 | ||
|
|
d7045d2b7e | ||
|
|
f483a1a9b2 | ||
|
|
cbcb9e0b1c | ||
|
|
b49dfa92ce | ||
|
|
825579b43d | ||
|
|
dee22104b7 | ||
|
|
dde0628976 | ||
|
|
ad96df191b | ||
|
|
76032159bd | ||
|
|
81c2370c8b | ||
|
|
251038e136 | ||
|
|
7fafe656a1 | ||
|
|
653d7b8112 | ||
|
|
61e9c1b0dd | ||
|
|
c2458d3d3a | ||
|
|
3799ffd9d5 | ||
|
|
07bdd6049b | ||
|
|
16865a5bf6 | ||
|
|
b79741c90f | ||
|
|
5fde69798c | ||
|
|
9e95bac75d | ||
|
|
26b39f1eae | ||
|
|
d77ea76476 | ||
|
|
d364b6d0a6 | ||
|
|
cf78e37da3 | ||
|
|
70f9e1aafa | ||
|
|
fec30e37ac | ||
|
|
5fa614d97e | ||
|
|
47da640d77 | ||
|
|
5c9983400f | ||
|
|
0b5c5499ec | ||
|
|
c413eeb026 | ||
|
|
6a7f5c0985 | ||
|
|
4271889ef8 | ||
|
|
94a5df795c | ||
|
|
05a7da6279 | ||
|
|
e0a85fae01 | ||
|
|
1db3d252cf | ||
|
|
1ea9bfc6f7 | ||
|
|
23bd5630d0 | ||
|
|
1de4ca1f9d | ||
|
|
8e42a25e57 | ||
|
|
16d6ca3937 | ||
|
|
eea082ee3f | ||
|
|
e2d6445f2a | ||
|
|
81c7f0ae04 | ||
|
|
9acd36bf99 | ||
|
|
b0baa698a4 | ||
|
|
23677be951 | ||
|
|
720aedb467 | ||
|
|
fae6242d4e | ||
|
|
a57f951e02 | ||
|
|
ae92bbe508 | ||
|
|
0f758a182b | ||
|
|
4682c7be5d | ||
|
|
e97cbcf34d | ||
|
|
52e3b4bc72 | ||
|
|
36bfc67574 | ||
|
|
2c9edefde3 | ||
|
|
ea9b241c13 | ||
|
|
5c97eeabac | ||
|
|
c9ec1a8580 | ||
|
|
4582691104 | ||
|
|
f3acdd3914 | ||
|
|
cd1d01b8b4 | ||
|
|
0013f064ad | ||
|
|
095f26a4f8 | ||
|
|
96762af3ce | ||
|
|
9543b84970 | ||
|
|
049256573b | ||
|
|
f3fd85aafb | ||
|
|
99ca72e9df | ||
|
|
4291961e09 | ||
|
|
1d3f5af7c0 | ||
|
|
b53a60c8d5 | ||
|
|
fbc8724d59 | ||
|
|
0b4f424f41 | ||
|
|
008b80fe1c | ||
|
|
efbac7e446 | ||
|
|
e8716ffede | ||
|
|
b14aa305ce | ||
|
|
9c725609c3 | ||
|
|
6ada090bb0 | ||
|
|
7d016b4efd | ||
|
|
ba8fb774c1 | ||
|
|
b52a79076d | ||
|
|
75d44ef1e8 | ||
|
|
b8131c3415 | ||
|
|
fb6f1fdcbe | ||
|
|
3c395d908f | ||
|
|
ded5da7800 | ||
|
|
dea5a152b2 | ||
|
|
d73e458db6 | ||
|
|
13b22e2afb | ||
|
|
428a4c86e3 | ||
|
|
fc2f55d931 | ||
|
|
d7c10b66d3 | ||
|
|
2db0e93f73 | ||
|
|
c4491165da | ||
|
|
082066e813 | ||
|
|
b2065756cf | ||
|
|
bf22184d6e | ||
|
|
72b7a957af | ||
|
|
539f016c1b | ||
|
|
e9ceead81d | ||
|
|
833e60d8d2 | ||
|
|
2f879e8bbd | ||
|
|
91114b562f | ||
|
|
a067d40454 | ||
|
|
33fdd48a76 | ||
|
|
49f1006183 | ||
|
|
120155f312 | ||
|
|
86d7f84b89 | ||
|
|
291e7730cf | ||
|
|
cf64054390 | ||
|
|
b19400aa74 | ||
|
|
d1c27c7e80 | ||
|
|
cc610c74a7 | ||
|
|
37923920a0 | ||
|
|
0c533dc436 | ||
|
|
8ffe95913b | ||
|
|
e788ee283f | ||
|
|
e462a9a5ef | ||
|
|
003af74213 | ||
|
|
fa6bc699bc | ||
|
|
1cef09ff10 | ||
|
|
19426387d4 | ||
|
|
4d7f296717 | ||
|
|
233cb86e86 | ||
|
|
8e757859d6 | ||
|
|
8da35c22d1 | ||
|
|
ac856b20bf | ||
|
|
800fa2d8e7 | ||
|
|
d0246cfdcc | ||
|
|
6c2ded4cac | ||
|
|
ca363d3ef8 | ||
|
|
526a9e4b66 | ||
|
|
4f7fa8d417 | ||
|
|
9541165752 | ||
|
|
ec3795a55c | ||
|
|
d1a1c5cbf0 | ||
|
|
41ad0f4f20 | ||
|
|
3ad9a8f3a9 | ||
|
|
1a97d06b5a | ||
|
|
3ceef8e6a0 | ||
|
|
ec3142af99 | ||
|
|
3296952ae5 | ||
|
|
245e628d40 | ||
|
|
cdc7eb2d4c | ||
|
|
b8aaef704d | ||
|
|
2dd645134e | ||
|
|
115ef6c09c | ||
|
|
4aa9a669cb | ||
|
|
50052fced5 | ||
|
|
705630e7d0 | ||
|
|
8efa1de835 | ||
|
|
fe6c666da2 | ||
|
|
395b1b3346 | ||
|
|
b994a35d97 | ||
|
|
c3daf2a8be | ||
|
|
a8446d29e8 | ||
|
|
af72876921 | ||
|
|
ce87ef397f | ||
|
|
0cde6fc552 | ||
|
|
245a31d6b7 | ||
|
|
ecd20de64d | ||
|
|
a1401696df | ||
|
|
69bf964241 | ||
|
|
9e00584730 | ||
|
|
76824bac9f | ||
|
|
a6f7848352 | ||
|
|
9fe3246154 | ||
|
|
41229696be | ||
|
|
71db715ba5 | ||
|
|
458f617575 | ||
|
|
47492386ec | ||
|
|
0c31946943 | ||
|
|
140aeabd87 | ||
|
|
0971a14a57 | ||
|
|
3a8ac9b031 | ||
|
|
9b067efb99 | ||
|
|
95371c16e9 | ||
|
|
bb14b7e956 | ||
|
|
93f7e10e0d | ||
|
|
5e7004e7af | ||
|
|
91d244c522 | ||
|
|
429a989648 | ||
|
|
4e3c1916f7 | ||
|
|
39c54e13c3 | ||
|
|
e3738c2f61 | ||
|
|
7eb110d503 | ||
|
|
cf9108433c | ||
|
|
5d4850a7ce | ||
|
|
95a37efc31 | ||
|
|
f2c73def4b | ||
|
|
4c11574e9d | ||
|
|
f1f9361bc8 | ||
|
|
e2f8f4da83 | ||
|
|
e40be619f2 | ||
|
|
bd6f1cca9d | ||
|
|
9a07792f4d | ||
|
|
a687efa6df | ||
|
|
2ba6785f09 | ||
|
|
cb00632e23 | ||
|
|
7379aa74cf | ||
|
|
a1459a9eac | ||
|
|
40dadecb6e | ||
|
|
627a96cd99 | ||
|
|
b917ea4723 | ||
|
|
a2848c9cde | ||
|
|
9d09c87f13 | ||
|
|
a90f2efb12 | ||
|
|
920bd3b16f | ||
|
|
cfef466d4e | ||
|
|
12e3d3d12f | ||
|
|
1604b949fd | ||
|
|
b1b40fef16 | ||
|
|
6cb6aea969 | ||
|
|
eb2bda7d0b | ||
|
|
568694122c | ||
|
|
06a749c386 | ||
|
|
8e3b63bd28 | ||
|
|
72feab081c | ||
|
|
96f250ed8f | ||
|
|
e32a630937 | ||
|
|
c4578aefe7 | ||
|
|
ad8d68c06a | ||
|
|
b839a6dd54 | ||
|
|
d71e1e0949 | ||
|
|
d0f0ceaf66 | ||
|
|
695d9edcd4 | ||
|
|
f409f44765 | ||
|
|
66ecfb5916 | ||
|
|
cff1e9ca27 | ||
|
|
38b94f248a | ||
|
|
12a63021d0 | ||
|
|
007ce24a11 | ||
|
|
4d2ad7c2b2 | ||
|
|
faa419fc8b | ||
|
|
bb7afd306a | ||
|
|
22ad820aa4 | ||
|
|
1e5f2e0f13 | ||
|
|
8306f7d2e2 | ||
|
|
0cc85a7dc6 | ||
|
|
a222ff4c02 | ||
|
|
0c90ab4f6c | ||
|
|
25f231a0e0 | ||
|
|
1db4ae96b1 | ||
|
|
3deaa7cf57 | ||
|
|
5b8363af00 | ||
|
|
d111865890 | ||
|
|
4f7674d448 | ||
|
|
a4677496f3 | ||
|
|
64bdd4b509 | ||
|
|
b55fc3d773 | ||
|
|
b3716a03a6 | ||
|
|
ab322fc5aa | ||
|
|
ad75dba87b | ||
|
|
42e1a12714 | ||
|
|
5e7662ca16 | ||
|
|
d0a1a29ab3 | ||
|
|
38ea0890ec | ||
|
|
5b99abb847 | ||
|
|
426bdba7fb | ||
|
|
c0fb5dd317 | ||
|
|
77cfc4fcd1 | ||
|
|
9f1b98b997 | ||
|
|
d50feb89de | ||
|
|
7f1c2b8a00 | ||
|
|
eadcbe474a | ||
|
|
ee57b63008 | ||
|
|
02a23892f9 | ||
|
|
a6a04c4b5b | ||
|
|
aafbdd442f | ||
|
|
e22a69d61a | ||
|
|
38f6e7a198 | ||
|
|
1e3e4fb649 | ||
|
|
3b25b807f3 | ||
|
|
77961aa73d | ||
|
|
c8914664a3 | ||
|
|
0b492f82f7 | ||
|
|
431d8a9b83 | ||
|
|
3066d76e33 | ||
|
|
bb35d06225 | ||
|
|
007c8440d7 | ||
|
|
557afdc429 | ||
|
|
ac86d04784 | ||
|
|
82c6363559 | ||
|
|
c735497a65 | ||
|
|
1c87d57e1d | ||
|
|
a7c5dc50e5 | ||
|
|
250420e566 | ||
|
|
60ab2d94f0 | ||
|
|
ee698770b9 | ||
|
|
e19565c170 | ||
|
|
5d2624ab82 | ||
|
|
b5defcffba | ||
|
|
61e5fbab72 | ||
|
|
51662dabb4 |
@@ -13,6 +13,7 @@ BraceWrapping:
|
||||
AfterUnion: true
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
FixNamespaceComments: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AccessModifierOffset: -8
|
||||
@@ -28,3 +29,4 @@ AlignAfterOpenBracket: DontAlign
|
||||
ContinuationIndentWidth: 16
|
||||
ConstructorInitializerIndentWidth: 16
|
||||
BreakConstructorInitializers: AfterColon
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Checks: '-*,modernize-use-emplace,modernize-use-default-member-init,modernize-use-equals-delete,modernize-use-equals-default,modernize-return-braced-init-list,modernize-loop-convert,modernize-avoid-bind,misc-throw-by-value-catch-by-reference,misc-string-compare,misc-inefficient-algorithm,misc-inaccurate-erase,misc-incorrect-roundings,misc-unconventional-assign-operator,bugprone-suspicious-memset-usage,performance-*'
|
||||
Checks: '-*,modernize-use-emplace,modernize-avoid-bind,misc-throw-by-value-catch-by-reference,misc-unconventional-assign-operator,performance-*'
|
||||
WarningsAsErrors: '-*,modernize-use-emplace,performance-type-promotion-in-math-fn,performance-faster-string-find,performance-implicit-cast-in-loop'
|
||||
CheckOptions:
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
value: True
|
||||
- key: performance-unnecessary-value-param.AllowedTypes
|
||||
value: v[23]f;v[23][su](16|32)
|
||||
|
||||
6
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
6
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
@@ -43,6 +43,12 @@ Contributions are welcome! Here's how you can help:
|
||||
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.
|
||||
|
||||
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.
|
||||
@@ -1,10 +1,11 @@
|
||||
##### Issue type
|
||||
<!-- Pick one below and delete others -->
|
||||
- Bug report
|
||||
- Feature request
|
||||
- Documentation issue
|
||||
- Build issue
|
||||
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: Unconfirmed bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
##### Minetest version
|
||||
<!--
|
||||
Paste Minetest version between quotes below
|
||||
25
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: Feature request
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Problem
|
||||
|
||||
A clear and concise description of what the problem is.
|
||||
ie: Why is this needed?
|
||||
Ex. I'm always frustrated when [...]
|
||||
|
||||
## Solutions
|
||||
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
## Alternatives
|
||||
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
## Additional context
|
||||
|
||||
Add any other context or screenshots about the feature request here.
|
||||
19
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
19
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
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?
|
||||
- If not a bug fix, why is this PR needed? What usecases does it solve?
|
||||
|
||||
## To do
|
||||
|
||||
This PR is a Work in Progress / Ready for Review.
|
||||
<!-- ^ delete one -->
|
||||
|
||||
- [ ] List
|
||||
- [ ] Things
|
||||
- [ ] To do
|
||||
|
||||
## How to test
|
||||
|
||||
<!-- Example code or instructions -->
|
||||
20
.github/SECURITY.md
vendored
Normal file
20
.github/SECURITY.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
We only support the latest stable version for security issues.
|
||||
See the [releases page](https://github.com/minetest/minetest/releases).
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
We ask that you report vulnerabilities privately, by contacting a core developer,
|
||||
to give us time to fix them. You can do that by emailing one of the following addresses:
|
||||
|
||||
* celeron55@gmail.com
|
||||
* rubenwardy@minetest.net
|
||||
|
||||
Depending on severity, we will either create a private issue for the vulnerability
|
||||
and release a patch version of Minetest, or give you permission to file the issue publicly.
|
||||
|
||||
For more information on the justification of this policy, see
|
||||
[Responsible Disclosure](https://en.wikipedia.org/wiki/Responsible_disclosure).
|
||||
42
.github/workflows/android.yml
vendored
Normal file
42
.github/workflows/android.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: android
|
||||
|
||||
# build on c/cpp changes or workflow changes
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- 'build/android/**'
|
||||
- '.github/workflows/android.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- 'build/android/**'
|
||||
- '.github/workflows/android.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Build with Gradle
|
||||
run: cd build/android; ./gradlew assemblerelease
|
||||
- name: Save armeabi artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Minetest-armeabi-v7a.apk
|
||||
path: build/android/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned.apk
|
||||
- name: Save arm64 artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Minetest-arm64-v8a.apk
|
||||
path: build/android/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk
|
||||
282
.github/workflows/build.yml
vendored
Normal file
282
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,282 @@
|
||||
name: build
|
||||
|
||||
# build on c/cpp changes or workflow changes
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'cmake/Modules/**'
|
||||
- 'util/buildbot/**'
|
||||
- 'util/ci/**'
|
||||
- '.github/workflows/**.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'cmake/Modules/**'
|
||||
- 'util/buildbot/**'
|
||||
- 'util/ci/**'
|
||||
- '.github/workflows/**.yml'
|
||||
|
||||
jobs:
|
||||
# This is our minor gcc compiler
|
||||
gcc_6:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps g++-6
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: gcc-6
|
||||
CXX: g++-6
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
# This is the current gcc compiler (available in bionic)
|
||||
gcc_8:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps g++-8
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: gcc-8
|
||||
CXX: g++-8
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
# This is our minor clang compiler
|
||||
clang_3_9:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps clang-3.9
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: clang-3.9
|
||||
CXX: clang++-3.9
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
# This is the current clang version
|
||||
clang_9:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install deps
|
||||
run: |
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps clang-9 valgrind libluajit-5.1-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: clang-9
|
||||
CXX: clang++-9
|
||||
CMAKE_FLAGS: "-DREQUIRE_LUAJIT=1"
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
./bin/minetest --run-unittests
|
||||
|
||||
- name: Valgrind
|
||||
run: |
|
||||
valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests
|
||||
|
||||
# Build with prometheus-cpp (server-only)
|
||||
clang_9_prometheus:
|
||||
name: "clang_9 (PROMETHEUS=1)"
|
||||
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 prometheus-cpp
|
||||
run: |
|
||||
./util/ci/build_prometheus_cpp.sh
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./util/ci/build.sh
|
||||
env:
|
||||
CC: clang-9
|
||||
CXX: clang++-9
|
||||
CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0"
|
||||
|
||||
- name: Test
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build docker image
|
||||
run: |
|
||||
docker build .
|
||||
|
||||
win32:
|
||||
name: "MinGW cross-compiler (32-bit)"
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- 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 tar -xaf mingw.tar.xz -C /usr
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh winbuild
|
||||
env:
|
||||
NO_MINETEST_GAME: 1
|
||||
NO_PACKAGE: 1
|
||||
|
||||
win64:
|
||||
name: "MinGW cross-compiler (64-bit)"
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- 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 tar -xaf mingw.tar.xz -C /usr
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild
|
||||
env:
|
||||
NO_MINETEST_GAME: 1
|
||||
NO_PACKAGE: 1
|
||||
|
||||
msvc:
|
||||
name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
VCPKG_VERSION: 0bf3923f9fab4001c00f0f429682a0853b5749e0
|
||||
# 2020.11
|
||||
vcpkg_packages: irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {
|
||||
arch: x86,
|
||||
generator: "-G'Visual Studio 16 2019' -A Win32",
|
||||
vcpkg_triplet: x86-windows
|
||||
}
|
||||
- {
|
||||
arch: x64,
|
||||
generator: "-G'Visual Studio 16 2019' -A x64",
|
||||
vcpkg_triplet: x64-windows
|
||||
}
|
||||
type: [portable]
|
||||
# type: [portable, installer]
|
||||
# The installer type is working, but disabled, to save runner jobs.
|
||||
# Enable it, when working on the installer.
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Restore from cache and run vcpkg
|
||||
uses: lukka/run-vcpkg@v5
|
||||
with:
|
||||
vcpkgArguments: ${{env.vcpkg_packages}}
|
||||
vcpkgDirectory: '${{ github.workspace }}\vcpkg'
|
||||
appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
|
||||
vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
|
||||
vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
cmake ${{matrix.config.generator}} `
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
|
||||
-DCMAKE_BUILD_TYPE=Release `
|
||||
-DENABLE_POSTGRESQL=OFF `
|
||||
-DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
|
||||
|
||||
- name: Build
|
||||
run: cmake --build . --config Release
|
||||
|
||||
- name: CPack
|
||||
run: |
|
||||
If ($env:TYPE -eq "installer")
|
||||
{
|
||||
cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
|
||||
}
|
||||
ElseIf($env:TYPE -eq "portable")
|
||||
{
|
||||
cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
|
||||
}
|
||||
env:
|
||||
TYPE: ${{matrix.type}}
|
||||
|
||||
- name: Package Clean
|
||||
run: rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
|
||||
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
|
||||
path: .\Package\
|
||||
54
.github/workflows/cpp_lint.yml
vendored
Normal file
54
.github/workflows/cpp_lint.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: cpp_lint
|
||||
|
||||
# lint on c/cpp changes or workflow changes
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'cmake/Modules/**'
|
||||
- 'util/ci/**'
|
||||
- '.github/workflows/**.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/**.[ch]'
|
||||
- 'lib/**.cpp'
|
||||
- 'src/**.[ch]'
|
||||
- 'src/**.cpp'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'cmake/Modules/**'
|
||||
- 'util/ci/**'
|
||||
- '.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_tidy:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get install clang-tidy-9 -qyy
|
||||
source ./util/ci/common.sh
|
||||
install_linux_deps
|
||||
|
||||
- name: Run clang-tidy
|
||||
run: |
|
||||
./util/ci/clang-tidy.sh
|
||||
32
.github/workflows/lua_lint.yml
vendored
Normal file
32
.github/workflows/lua_lint.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
43
.gitignore
vendored
43
.gitignore
vendored
@@ -1,8 +1,9 @@
|
||||
## Editors and Development environments
|
||||
## Editors and development environments
|
||||
*~
|
||||
*.swp
|
||||
*.bak*
|
||||
*.orig
|
||||
.DS_Store
|
||||
# Vim
|
||||
*.vim
|
||||
# Kate
|
||||
@@ -21,11 +22,16 @@
|
||||
tags
|
||||
!tags/
|
||||
gtags.files
|
||||
.idea/*
|
||||
.idea
|
||||
# Codelite
|
||||
*.project
|
||||
# Visual Studio Code & plugins
|
||||
.vscode/
|
||||
build/.cmake/
|
||||
# Gradle
|
||||
.gradle
|
||||
|
||||
## Files related to minetest development cycle
|
||||
## Files related to Minetest development cycle
|
||||
/*.patch
|
||||
*.diff
|
||||
# GNU Patch reject file
|
||||
@@ -34,7 +40,7 @@ gtags.files
|
||||
## Non-static Minetest directories or symlinks to these
|
||||
/bin/
|
||||
/games/*
|
||||
!/games/minimal/
|
||||
!/games/devtest/
|
||||
/cache
|
||||
/textures/*
|
||||
!/textures/base/
|
||||
@@ -53,8 +59,9 @@ gtags.files
|
||||
## Configuration/log files
|
||||
minetest.conf
|
||||
debug.txt
|
||||
debug.txt.1
|
||||
|
||||
## Other files generated by minetest
|
||||
## Other files generated by Minetest
|
||||
screenshot_*.png
|
||||
testbm.txt
|
||||
|
||||
@@ -63,20 +70,19 @@ doc/Doxyfile
|
||||
doc/html/
|
||||
doc/doxygen_*
|
||||
|
||||
## MkDocs files
|
||||
public/
|
||||
doc/mkdocs/docs/*.md
|
||||
doc/mkdocs/mkdocs.yml
|
||||
|
||||
## Build files
|
||||
CMakeFiles
|
||||
Makefile
|
||||
!build/android/Makefile
|
||||
build/android/path.cfg
|
||||
build/android/*.apk
|
||||
build/android/.externalNativeBuild
|
||||
cmake_install.cmake
|
||||
CMakeCache.txt
|
||||
CPackConfig.cmake
|
||||
CPackSourceConfig.cmake
|
||||
src/test_config.h
|
||||
src/android_version.h
|
||||
src/android_version_githash.h
|
||||
src/cmake_config.h
|
||||
src/cmake_config_githash.h
|
||||
src/unittest/test_world/world.mt
|
||||
@@ -98,16 +104,5 @@ cmake_config.h
|
||||
cmake_config_githash.h
|
||||
CMakeDoxy*
|
||||
compile_commands.json
|
||||
|
||||
## Android build files
|
||||
build/android/src/main/assets
|
||||
build/android/build
|
||||
build/android/deps
|
||||
build/android/libs
|
||||
build/android/jni/lib
|
||||
build/android/jni/src
|
||||
build/android/src/main/jniLibs
|
||||
build/android/obj
|
||||
build/android/local.properties
|
||||
build/android/.gradle
|
||||
timestamp
|
||||
*.apk
|
||||
*.zip
|
||||
|
||||
317
.gitlab-ci.yml
317
.gitlab-ci.yml
@@ -12,303 +12,224 @@ variables:
|
||||
MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git"
|
||||
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
|
||||
|
||||
.build_template: &build_definition
|
||||
.build_template:
|
||||
stage: build
|
||||
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 -DBUILD_SERVER=TRUE ..
|
||||
- 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
|
||||
- make install
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 2h
|
||||
expire_in: 1h
|
||||
paths:
|
||||
- artifact/*
|
||||
|
||||
.debpkg_template: &debpkg_template
|
||||
.debpkg_template:
|
||||
stage: package
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y git
|
||||
- mkdir -p build/deb/minetest/DEBIAN/
|
||||
- cp misc/debpkg-control build/deb/minetest/DEBIAN/control
|
||||
- cp -Rp artifact/minetest/usr build/deb/minetest/
|
||||
- cp -a artifact/minetest/usr build/deb/minetest/
|
||||
script:
|
||||
- git clone $MINETEST_GAME_REPO build/deb/minetest/usr/share/minetest/games/minetest
|
||||
- rm -Rf build/deb/minetest/usr/share/minetest/games/minetest/.git
|
||||
- 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/LEVELDB_PLACEHOLDER/'$LEVELDB_PKG'/g' build/deb/minetest/DEBIAN/control
|
||||
- cd build/deb/ && dpkg-deb -b minetest/ && mv minetest.deb ../../
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 90 day
|
||||
paths:
|
||||
- ./*.deb
|
||||
|
||||
.debpkg_install: &debpkg_install
|
||||
.debpkg_install:
|
||||
stage: deploy
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y libc6 libcurl3-gnutls libfreetype6 libirrlicht1.8 $LEVELDB_PKG liblua5.1-0 libluajit-5.1-2 libopenal1 libstdc++6 libvorbisfile3 libx11-6 zlib1g
|
||||
script:
|
||||
- dpkg -i ./*.deb
|
||||
- apt-get install -y ./*.deb
|
||||
- minetest --version
|
||||
|
||||
##
|
||||
## Debian
|
||||
##
|
||||
|
||||
# Jessie
|
||||
|
||||
build:debian-8:
|
||||
<<: *build_definition
|
||||
image: debian:8
|
||||
before_script:
|
||||
- echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" > /etc/apt/sources.list.d/uptodate-toolchain.list
|
||||
- apt-key adv --keyserver keyserver.ubuntu.com --recv BA9EF27F
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential gcc-6 g++-6 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
|
||||
variables:
|
||||
CC: gcc-6
|
||||
CXX: g++-6
|
||||
|
||||
package:debian-8:
|
||||
image: debian:8
|
||||
dependencies:
|
||||
- build:debian-8
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:debian-8:
|
||||
image: debian:8
|
||||
dependencies:
|
||||
- package:debian-8
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_install
|
||||
|
||||
# Stretch
|
||||
|
||||
build:debian-9:
|
||||
<<: *build_definition
|
||||
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
|
||||
image: debian:9
|
||||
dependencies:
|
||||
needs:
|
||||
- build:debian-9
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:debian-9:
|
||||
extends: .debpkg_install
|
||||
image: debian:9
|
||||
dependencies:
|
||||
needs:
|
||||
- package:debian-9
|
||||
|
||||
# Buster
|
||||
|
||||
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
|
||||
image: debian:10
|
||||
needs:
|
||||
- build:debian-10
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
LEVELDB_PKG: libleveldb1d
|
||||
|
||||
deploy:debian-10:
|
||||
extends: .debpkg_install
|
||||
image: debian:10
|
||||
needs:
|
||||
- package:debian-10
|
||||
|
||||
##
|
||||
## Ubuntu
|
||||
##
|
||||
|
||||
# Trusty
|
||||
|
||||
build:ubuntu-14.04:
|
||||
<<: *build_definition
|
||||
image: ubuntu:trusty
|
||||
before_script:
|
||||
- echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" > /etc/apt/sources.list.d/uptodate-toolchain.list
|
||||
- apt-key adv --keyserver keyserver.ubuntu.com --recv BA9EF27F
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential gcc-6 g++-6 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
|
||||
variables:
|
||||
CC: gcc-6
|
||||
CXX: g++-6
|
||||
|
||||
package:ubuntu-14.04:
|
||||
image: ubuntu:trusty
|
||||
dependencies:
|
||||
- build:ubuntu-14.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:ubuntu-14.04:
|
||||
image: ubuntu:trusty
|
||||
dependencies:
|
||||
- package:ubuntu-14.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_install
|
||||
|
||||
# Xenial
|
||||
|
||||
build:ubuntu-16.04:
|
||||
<<: *build_definition
|
||||
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
|
||||
dependencies:
|
||||
needs:
|
||||
- build:ubuntu-16.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:ubuntu-16.04:
|
||||
extends: .debpkg_install
|
||||
image: ubuntu:xenial
|
||||
dependencies:
|
||||
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
|
||||
image: ubuntu:bionic
|
||||
needs:
|
||||
- build:ubuntu-18.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
|
||||
# Yakkety
|
||||
|
||||
#build:ubuntu-16.10:
|
||||
# <<: *build_definition
|
||||
# image: ubuntu:yakkety
|
||||
# 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.10:
|
||||
# image: ubuntu:yakkety
|
||||
# dependencies:
|
||||
# - build:ubuntu-16.10
|
||||
# variables:
|
||||
# LEVELDB_PKG: libleveldb1v5
|
||||
# <<: *debpkg_template
|
||||
|
||||
#deploy:ubuntu-16.10:
|
||||
# image: ubuntu:yakkety
|
||||
# dependencies:
|
||||
# - package:ubuntu-16.10
|
||||
# variables:
|
||||
# LEVELDB_PKG: libleveldb1v5
|
||||
# <<: *debpkg_install
|
||||
|
||||
# Zesty
|
||||
|
||||
#build:ubuntu-17.04:
|
||||
# <<: *build_definition
|
||||
# image: ubuntu:zesty
|
||||
# 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-17.04:
|
||||
# image: ubuntu:zesty
|
||||
# dependencies:
|
||||
# - build:ubuntu-17.04
|
||||
# variables:
|
||||
# LEVELDB_PKG: libleveldb1v5
|
||||
# <<: *debpkg_template
|
||||
|
||||
#deploy:ubuntu-17.04:
|
||||
# image: ubuntu:zesty
|
||||
# dependencies:
|
||||
# - package:ubuntu-17.04
|
||||
# variables:
|
||||
# LEVELDB_PKG: libleveldb1v5
|
||||
# <<: *debpkg_install
|
||||
deploy:ubuntu-18.04:
|
||||
extends: .debpkg_install
|
||||
image: ubuntu:bionic
|
||||
needs:
|
||||
- package:ubuntu-18.04
|
||||
|
||||
##
|
||||
## Fedora
|
||||
##
|
||||
|
||||
build:fedora-24:
|
||||
<<: *build_definition
|
||||
image: fedora:24
|
||||
# Fedora 28 <-> RHEL 8
|
||||
build:fedora-28:
|
||||
extends: .build_template
|
||||
image: fedora:28
|
||||
before_script:
|
||||
- dnf -y install make automake gcc gcc-c++ kernel-devel cmake libcurl* openal* libvorbis* 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
|
||||
|
||||
- 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
|
||||
|
||||
##
|
||||
## Mingw for Windows
|
||||
## MinGW for Windows
|
||||
##
|
||||
|
||||
.generic_win_template: &generic_win_template
|
||||
image: ubuntu:xenial
|
||||
.generic_win_template:
|
||||
image: ubuntu:bionic
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y p7zip-full wget unzip git cmake gettext
|
||||
- wget http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_7.1.1_ubuntu14.04.7z -O mingw.7z > /dev/null
|
||||
- sed -e "s|%PREFIX%|${WIN_ARCH}-w64-mingw32|" -e "s|%ROOTPATH%|/usr/${WIN_ARCH}-w64-mingw32|" < util/travis/toolchain_mingw.cmake.in > ${TOOLCHAIN_OUTPUT}
|
||||
- 7z x -y -o/usr mingw.7z > /dev/null
|
||||
- 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
|
||||
- tar -xaf mingw.tar.xz -C /usr
|
||||
|
||||
.build_win_template: &build_win_template
|
||||
<<: *generic_win_template
|
||||
.build_win_template:
|
||||
extends: .generic_win_template
|
||||
stage: build
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 2h
|
||||
expire_in: 1h
|
||||
paths:
|
||||
- build/*
|
||||
- build/minetest/_build/*
|
||||
|
||||
.package_win_template: &package_win_template
|
||||
<<: *generic_win_template
|
||||
.package_win_template:
|
||||
extends: .generic_win_template
|
||||
stage: package
|
||||
script:
|
||||
- cd build/minetest/_build
|
||||
- make package
|
||||
- cd ../../../
|
||||
- mkdir minetest-win-${WIN_ARCH}
|
||||
- unzip build/minetest/_build/minetest-*-win*.zip -d minetest-win-${WIN_ARCH}
|
||||
- cp /usr/${WIN_ARCH}-w64-mingw32/bin/libgcc*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin
|
||||
- cp /usr/${WIN_ARCH}-w64-mingw32/bin/libstdc++*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin
|
||||
- cp /usr/${WIN_ARCH}-w64-mingw32/bin/libwinpthread*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin
|
||||
- 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:
|
||||
when: on_success
|
||||
expire_in: 90 day
|
||||
paths:
|
||||
- minetest-win-*/*
|
||||
- minetest-*-win*/*
|
||||
|
||||
build:win32:
|
||||
<<: *build_win_template
|
||||
extends: .build_win_template
|
||||
script:
|
||||
- ./util/buildbot/buildwin32.sh build
|
||||
variables:
|
||||
NO_PACKAGE: "1"
|
||||
WIN_ARCH: "i686"
|
||||
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake"
|
||||
|
||||
package:win32:
|
||||
<<: *package_win_template
|
||||
dependencies:
|
||||
extends: .package_win_template
|
||||
needs:
|
||||
- build:win32
|
||||
variables:
|
||||
NO_PACKAGE: "1"
|
||||
WIN_ARCH: "i686"
|
||||
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake"
|
||||
|
||||
|
||||
build:win64:
|
||||
<<: *build_win_template
|
||||
extends: .build_win_template
|
||||
script:
|
||||
- ./util/buildbot/buildwin64.sh build
|
||||
variables:
|
||||
NO_PACKAGE: "1"
|
||||
WIN_ARCH: "x86_64"
|
||||
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake"
|
||||
|
||||
package:win64:
|
||||
<<: *package_win_template
|
||||
dependencies:
|
||||
extends: .package_win_template
|
||||
needs:
|
||||
- build:win64
|
||||
variables:
|
||||
NO_PACKAGE: "1"
|
||||
WIN_ARCH: "x86_64"
|
||||
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake"
|
||||
|
||||
##
|
||||
## Docker
|
||||
##
|
||||
|
||||
package:docker:
|
||||
stage: package
|
||||
@@ -322,3 +243,51 @@ package:docker:
|
||||
- docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA
|
||||
- docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME
|
||||
- docker push ${CONTAINER_IMAGE}/server:latest
|
||||
|
||||
##
|
||||
## Gitlab Pages (Lua API documentation)
|
||||
##
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
image: python:3.8
|
||||
before_script:
|
||||
- pip install git+https://github.com/Python-Markdown/markdown.git
|
||||
- pip install git+https://github.com/mkdocs/mkdocs.git
|
||||
- pip install pygments
|
||||
script:
|
||||
- cd doc/mkdocs && ./build.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
|
||||
##
|
||||
## AppImage
|
||||
##
|
||||
|
||||
package:appimage-client:
|
||||
stage: package
|
||||
image: appimagecrafters/appimage-builder
|
||||
needs:
|
||||
- build:ubuntu-18.04
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y git wget
|
||||
# Collect files
|
||||
- mkdir AppDir
|
||||
- cp -a artifact/minetest/usr/ AppDir/usr/
|
||||
- rm AppDir/usr/bin/minetestserver
|
||||
- cp -a clientmods AppDir/usr/share/minetest
|
||||
script:
|
||||
- git clone $MINETEST_GAME_REPO AppDir/usr/share/minetest/games/minetest_game
|
||||
- rm -rf AppDir/usr/share/minetest/games/minetest/.git
|
||||
- export VERSION=$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA
|
||||
# Remove PrefersNonDefaultGPU property due to validation errors
|
||||
- sed -i '/PrefersNonDefaultGPU/d' AppDir/usr/share/applications/net.minetest.minetest.desktop
|
||||
- appimage-builder --skip-test
|
||||
artifacts:
|
||||
expire_in: 90 day
|
||||
paths:
|
||||
- ./*.AppImage
|
||||
|
||||
82
.luacheckrc
Normal file
82
.luacheckrc
Normal file
@@ -0,0 +1,82 @@
|
||||
unused_args = false
|
||||
allow_defined_top = true
|
||||
|
||||
ignore = {
|
||||
"131", -- Unused global variable
|
||||
"431", -- Shadowing an upvalue
|
||||
"432", -- Shadowing an upvalue argument
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
"ItemStack",
|
||||
"INIT",
|
||||
"DIR_DELIM",
|
||||
"dump", "dump2",
|
||||
"fgettext", "fgettext_ne",
|
||||
"vector",
|
||||
"VoxelArea",
|
||||
"profiler",
|
||||
"Settings",
|
||||
|
||||
string = {fields = {"split", "trim"}},
|
||||
table = {fields = {"copy", "getn", "indexof", "insert_all"}},
|
||||
math = {fields = {"hypot"}},
|
||||
}
|
||||
|
||||
globals = {
|
||||
"core",
|
||||
"gamedata",
|
||||
os = { fields = { "tempfolder" } },
|
||||
"_",
|
||||
}
|
||||
|
||||
files["builtin/client/register.lua"] = {
|
||||
globals = {
|
||||
debug = {fields={"getinfo"}},
|
||||
}
|
||||
}
|
||||
|
||||
files["builtin/common/misc_helpers.lua"] = {
|
||||
globals = {
|
||||
"dump", "dump2", "table", "math", "string",
|
||||
"fgettext", "fgettext_ne", "basic_dump", "game", -- ???
|
||||
"file_exists", "get_last_folder", "cleanup_path", -- ???
|
||||
},
|
||||
}
|
||||
|
||||
files["builtin/common/vector.lua"] = {
|
||||
globals = { "vector" },
|
||||
}
|
||||
|
||||
files["builtin/game/voxelarea.lua"] = {
|
||||
globals = { "VoxelArea" },
|
||||
}
|
||||
|
||||
files["builtin/game/init.lua"] = {
|
||||
globals = { "profiler" },
|
||||
}
|
||||
|
||||
files["builtin/common/filterlist.lua"] = {
|
||||
globals = {
|
||||
"filterlist",
|
||||
"compare_worlds", "sort_worlds_alphabetic", "sort_mod_list", -- ???
|
||||
},
|
||||
}
|
||||
|
||||
files["builtin/mainmenu"] = {
|
||||
globals = {
|
||||
"gamedata",
|
||||
},
|
||||
|
||||
read_globals = {
|
||||
"PLATFORM",
|
||||
},
|
||||
}
|
||||
|
||||
files["builtin/common/tests"] = {
|
||||
read_globals = {
|
||||
"describe",
|
||||
"it",
|
||||
"assert",
|
||||
},
|
||||
}
|
||||
74
.mailmap
74
.mailmap
@@ -1,33 +1,67 @@
|
||||
# Documentation: https://git-scm.com/docs/git-check-mailmap#_mapping_authors
|
||||
|
||||
0gb.us <0gb.us@0gb.us> <us_0gb@laptop-0gb-us.0gb.us>
|
||||
Calinou <calinou9999@gmail.com> <calinou9999spam@gmail.com>
|
||||
Perttu Ahola <celeron55@gmail.com> celeron55 <celeron55@gmail.com>
|
||||
Calinou <calinou@opmbx.org> <calinou9999@gmail.com>
|
||||
Calinou <calinou@opmbx.org> <calinou9999spam@gmail.com>
|
||||
Perttu Ahola <celeron55@gmail.com>
|
||||
Perttu Ahola <celeron55@gmail.com> celeron55 <celeron55@armada.(none)>
|
||||
Craig Robbins <kde.psych@gmail.com> <crobbins@localhost.localdomain>
|
||||
Zeno- <kde.psych@gmail.com>
|
||||
Zeno- <kde.psych@gmail.com> <crobbins@localhost.localdomain>
|
||||
Diego Martínez <kaeza@users.sf.net>
|
||||
Diego Martínez <kaeza@users.sf.net> <lkaezadl3@gmail.com>
|
||||
Ilya Zhuravlev <zhuravlevilya@ya.ru>
|
||||
Ilya Zhuravlev <zhuravlevilya@ya.ru> <whatever@xyz.is>
|
||||
kwolekr <kwolekr@minetest.net> <mirrorisim@gmail.com>
|
||||
PilzAdam <pilzadam@minetest.net> PilzAdam <adam-k@outlook.com>
|
||||
PilzAdam <pilzadam@minetest.net> Pilz Adam <PilzAdam@gmx.de>
|
||||
PilzAdam <pilzadam@minetest.net> PilzAdam <PilzAdam@gmx.de>
|
||||
PilzAdam <pilzadam@minetest.net> <adam-k@outlook.com>
|
||||
PilzAdam <pilzadam@minetest.net> <PilzAdam@gmx.de>
|
||||
proller <proller@github.com> <proler@github.com>
|
||||
proller <proller@github.com> <proler@gmail.com>
|
||||
RealBadAngel <maciej.kasatkin@o2.pl> <mk@realbadangel.pl>
|
||||
RealBadAngel <maciej.kasatkin@o2.pl> <maciej.kasatkin@yahoo.com>
|
||||
Selat <LongExampleTestName@gmail.com> <LongExampletestName@gmail.com>
|
||||
ShadowNinja <shadowninja@minetest.net> ShadowNinja <noreply@gmail.com>
|
||||
Shen Zheyu <arsdragonfly@gmail.com> arsdragonfly <arsdragonfly@gmail.com>
|
||||
Pavel Elagin <elagin.pasha@gmail.com> elagin <elagin.pasha@gmail.com>
|
||||
Esteban I. Ruiz Moreno <exio4.com@gmail.com> Esteban I. RM <exio4.com@gmail.com>
|
||||
manuel duarte <ffrogger0@yahoo.com> manuel joaquim <ffrogger0@yahoo.com>
|
||||
manuel duarte <ffrogger0@yahoo.com> sweetbomber <ffrogger _zero_ at yahoo dot com>
|
||||
Diego Martínez <kaeza@users.sf.net> kaeza <kaeza@users.sf.net>
|
||||
Diego Martínez <kaeza@users.sf.net> Diego Martinez <kaeza@users.sf.net>
|
||||
Lord James <neftali_dtctv@hotmail.com> Lord89James <neftali_dtctv@hotmail.com>
|
||||
BlockMen <nmuelll@web.de> Block Men <nmuelll@web.de>
|
||||
sfan5 <sfan5@live.de> Sfan5 <sfan5@live.de>
|
||||
DannyDark <the_skeleton_of_a_child@yahoo.co.uk> dannydark <the_skeleton_of_a_child@yahoo.co.uk>
|
||||
Ilya Pavlov <TTChangeTheWorld@gmail.com> Ilya <TTChangeTheWorld@gmail.com>
|
||||
Ilya Zhuravlev <zhuravlevilya@ya.ru> xyzz <zhuravlevilya@ya.ru>
|
||||
Esteban I. Ruiz Moreno <exio4.com@gmail.com>
|
||||
Esteban I. Ruiz Moreno <exio4.com@gmail.com> <me@exio4.xyz>
|
||||
Lord James <neftali_dtctv@hotmail.com>
|
||||
BlockMen <nmuelll@web.de>
|
||||
sfan5 <sfan5@live.de>
|
||||
DannyDark <the_skeleton_of_a_child@yahoo.co.uk>
|
||||
Ilya Pavlov <TTChangeTheWorld@gmail.com>
|
||||
sapier <Sapier at GMX dot net> sapier <sapier AT gmx DOT net>
|
||||
sapier <Sapier at GMX dot net> sapier <sapier at gmx dot net>
|
||||
|
||||
SmallJoker <SmallJoker@users.noreply.github.com> <mk939@ymail.com>
|
||||
Loïc Blot <nerzhul@users.noreply.github.com>
|
||||
Loïc Blot <nerzhul@users.noreply.github.com> <loic.blot@unix-experience.fr>
|
||||
numzero <numzer0@yandex.ru> Vitaliy <numzer0@yandex.ru>
|
||||
numzero <numzer0@yandex.ru> <silverunicorn2011@yandex.ru>
|
||||
Jean-Patrick Guerrero <kilbith@users.noreply.github.com>
|
||||
Jean-Patrick Guerrero <kilbith@users.noreply.github.com> <jeanpatrick.guerrero@gmail.com>
|
||||
HybridDog <3192173+HybridDog@users.noreply.github.com> <ovvv@web.de>
|
||||
srfqi <muhammadrifqipriyosusanto@gmail.com>
|
||||
Dániel Juhász <juhdanad@gmail.com>
|
||||
rubenwardy <rw@rubenwardy.com>
|
||||
rubenwardy <rw@rubenwardy.com> <rubenwardy@gmail.com>
|
||||
Paul Ouellette <oue.paul18@gmail.com>
|
||||
Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> <vanessaezekowitz@gmail.com>
|
||||
ClobberXD <ClobberXD@gmail.com>
|
||||
ClobberXD <ClobberXD@gmail.com> <ClobberXD@protonmail.com>
|
||||
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>
|
||||
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>
|
||||
Jordach <jordach.snelling@gmail.com>
|
||||
MoNTE48 <MoNTE48@mail.ua>
|
||||
v-rob <robinsonvincent89@gmail.com>
|
||||
v-rob <robinsonvincent89@gmail.com> <31123645+v-rob@users.noreply.github.com>
|
||||
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>
|
||||
|
||||
109
.travis.yml
109
.travis.yml
@@ -1,109 +0,0 @@
|
||||
language: cpp
|
||||
before_install: ./util/travis/before_install.sh
|
||||
script: ./util/travis/script.sh
|
||||
sudo: required
|
||||
dist: trusty
|
||||
group: edge
|
||||
notifications:
|
||||
email: false
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
|
||||
- env: LINT=1
|
||||
compiler: clang
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['clang-format-5.0']
|
||||
sources: &sources
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- env: CLANG_TIDY=1
|
||||
compiler: clang
|
||||
os: linux
|
||||
script: ./util/travis/clangtidy.sh
|
||||
addons:
|
||||
apt:
|
||||
packages: ['clang-tidy-5.0']
|
||||
sources: &sources
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- env: PLATFORM=Win32
|
||||
compiler: gcc
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['gcc-mingw-w64-i686', 'g++-mingw-w64-i686', 'binutils-mingw-w64-i686']
|
||||
sources: &sources
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'deb http://mirrors.kernel.org/ubuntu xenial main universe'
|
||||
|
||||
- env: PLATFORM=Win64
|
||||
compiler: gcc
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['gcc-mingw-w64-x86-64', 'g++-mingw-w64-x86-64', 'binutils-mingw-w64-x86-64']
|
||||
sources: &sources
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'deb http://mirrors.kernel.org/ubuntu xenial main universe'
|
||||
|
||||
- env: PLATFORM=Unix
|
||||
compiler: clang
|
||||
os: osx
|
||||
osx_image: xcode8
|
||||
|
||||
- env: PLATFORM=Unix COMPILER=gcc-6
|
||||
compiler: gcc
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['gcc-6', 'g++-6']
|
||||
sources: &sources
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- env: PLATFORM=Unix COMPILER=gcc-7
|
||||
compiler: gcc
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['gcc-7', 'g++-7']
|
||||
sources: &sources
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- env: PLATFORM=Unix COMPILER=clang-3.6
|
||||
compiler: clang
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['clang-3.6', 'clang++-3.6']
|
||||
sources: &sources
|
||||
- llvm-toolchain-trusty-3.6
|
||||
|
||||
- env: PLATFORM=Unix COMPILER=clang-5.0
|
||||
compiler: clang
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['clang-5.0', 'clang++-5.0']
|
||||
sources: &sources
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- env: PLATFORM=Unix COMPILER=clang-5.0 FREETYPE=0
|
||||
compiler: clang
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['clang-5.0', 'clang++-5.0']
|
||||
sources: &sources
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- env: PLATFORM=Unix COMPILER=clang-5.0 VALGRIND=1
|
||||
compiler: clang
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages: ['valgrind', 'clang-5.0', 'clang++-5.0']
|
||||
sources: &sources
|
||||
- llvm-toolchain-trusty-5.0
|
||||
51
AppImageBuilder.yml
Normal file
51
AppImageBuilder.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
version: 1
|
||||
|
||||
AppDir:
|
||||
path: ./AppDir
|
||||
|
||||
app_info:
|
||||
id: minetest
|
||||
name: Minetest
|
||||
icon: minetest
|
||||
version: !ENV ${VERSION}
|
||||
exec: usr/bin/minetest
|
||||
exec_args: $@
|
||||
runtime:
|
||||
env:
|
||||
APPDIR_LIBRARY_PATH: $APPDIR/usr/lib/x86_64-linux-gnu
|
||||
|
||||
apt:
|
||||
arch: amd64
|
||||
sources:
|
||||
- sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic main universe
|
||||
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32'
|
||||
- sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates main universe
|
||||
- sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-backports main universe
|
||||
- sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-security main universe
|
||||
|
||||
include:
|
||||
- libirrlicht1.8
|
||||
- libxxf86vm1
|
||||
- libgl1-mesa-glx
|
||||
- libsqlite3-0
|
||||
- libogg0
|
||||
- libvorbis0a
|
||||
- libopenal1
|
||||
- libcurl3-gnutls
|
||||
- libfreetype6
|
||||
- zlib1g
|
||||
- libgmp10
|
||||
- libjsoncpp1
|
||||
|
||||
files:
|
||||
exclude:
|
||||
- usr/share/man
|
||||
- usr/share/doc/*/README.*
|
||||
- usr/share/doc/*/changelog.*
|
||||
- usr/share/doc/*/NEWS.*
|
||||
- usr/share/doc/*/TODO.*
|
||||
|
||||
AppImage:
|
||||
update-information: None
|
||||
sign-key: None
|
||||
arch: x86_64
|
||||
@@ -1,23 +1,19 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
if(${CMAKE_VERSION} STREQUAL "2.8.2")
|
||||
# Bug http://vtk.org/Bug/view.php?id=11020
|
||||
message(WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
|
||||
endif()
|
||||
cmake_policy(SET CMP0025 OLD)
|
||||
|
||||
# This can be read from ${PROJECT_NAME} after project() is called
|
||||
project(minetest)
|
||||
set(PROJECT_NAME_CAPITALIZED "Minetest")
|
||||
|
||||
# Works only for cmake 3.1 and greater
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(GCC_MINIMUM_VERSION "4.8")
|
||||
set(CLANG_MINIMUM_VERSION "3.4")
|
||||
|
||||
# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 0)
|
||||
set(VERSION_PATCH 1)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||
|
||||
# Change to false for releases
|
||||
@@ -49,6 +45,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(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build")
|
||||
@@ -102,7 +99,7 @@ elseif(UNIX) # Linux, BSD etc
|
||||
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/${PROJECT_NAME}/locale")
|
||||
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -164,24 +161,24 @@ if(RUN_IN_PLACE)
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/texture_packs_here.txt" DESTINATION "${SHAREDIR}/textures")
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/"
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/"
|
||||
COMPONENT "SUBGAME_MINETEST_GAME" OPTIONAL PATTERN ".git*" EXCLUDE )
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minimal" DESTINATION "${SHAREDIR}/games/"
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/devtest" DESTINATION "${SHAREDIR}/games/"
|
||||
COMPONENT "SUBGAME_MINIMAL" OPTIONAL PATTERN ".git*" EXCLUDE )
|
||||
|
||||
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")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")
|
||||
|
||||
install(FILES "README.md" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||
install(FILES "doc/lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||
install(FILES "doc/client_lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||
install(FILES "doc/menu_lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||
install(FILES "doc/texture_packs.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||
install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||
@@ -232,7 +229,7 @@ add_subdirectory(src)
|
||||
|
||||
# CPack
|
||||
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A free open-source voxel game engine with easy modding and game creation.")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
||||
@@ -248,15 +245,15 @@ cpack_add_component(Docs
|
||||
|
||||
cpack_add_component(SUBGAME_MINETEST_GAME
|
||||
DISPLAY_NAME "Minetest Game"
|
||||
DESCRIPTION "The official subgame for the Minetest engine, that can easily extended by mods."
|
||||
GROUP "Subgames"
|
||||
DESCRIPTION "The default game bundled in the Minetest engine. Mainly used as a modding base."
|
||||
GROUP "Games"
|
||||
)
|
||||
|
||||
cpack_add_component(SUBGAME_MINIMAL
|
||||
DISPLAY_NAME "Minimal development test"
|
||||
DESCRIPTION "A minimal subgame helping to develop the engine."
|
||||
DISPLAY_NAME "Development Test"
|
||||
DESCRIPTION "A basic testing environment used for engine development and sometimes for testing mods."
|
||||
DISABLED #DISABLED does not mean it is disabled, and is just not selected by default.
|
||||
GROUP "Subgames"
|
||||
GROUP "Games"
|
||||
)
|
||||
|
||||
cpack_add_component_group(Subgames
|
||||
@@ -277,19 +274,20 @@ if(WIN32)
|
||||
set(CPACK_GENERATOR ZIP)
|
||||
|
||||
else()
|
||||
set(CPACK_GENERATOR WIX ZIP)
|
||||
set(CPACK_GENERATOR WIX)
|
||||
set(CPACK_PACKAGE_NAME "${PROJECT_NAME_CAPITALIZED}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME_CAPITALIZED}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY ".")
|
||||
set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} "${PROJECT_NAME_CAPITALIZED}")
|
||||
set(CPACK_CREATE_DESKTOP_LINKS ${PROJECT_NAME})
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/${PROJECT_NAME_CAPITALIZED}")
|
||||
|
||||
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/misc/minetest-icon.ico")
|
||||
# Supported languages can be found at
|
||||
# Supported languages can be found at
|
||||
# http://wixtoolset.org/documentation/manual/v3/wixui/wixui_localization.html
|
||||
#set(CPACK_WIX_CULTURES "ar-SA,bg-BG,ca-ES,hr-HR,cs-CZ,da-DK,nl-NL,en-US,et-EE,fi-FI,fr-FR,de-DE")
|
||||
set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_BANNER.BMP")
|
||||
set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_DIALOG.BMP")
|
||||
|
||||
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/lgpl-2.1.txt")
|
||||
|
||||
# The correct way would be to include both x32 and x64 into one installer
|
||||
@@ -325,4 +323,3 @@ if(DOXYGEN_FOUND)
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
76
Dockerfile
76
Dockerfile
@@ -1,31 +1,59 @@
|
||||
FROM debian:stretch
|
||||
FROM alpine:3.11
|
||||
|
||||
USER root
|
||||
RUN apt-get update -y && \
|
||||
apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev \
|
||||
libsqlite3-dev libcurl4-gnutls-dev zlib1g-dev libgmp-dev libjsoncpp-dev git && \
|
||||
apt-get clean && rm -rf /var/cache/apt/archives/* && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
ENV MINETEST_GAME_VERSION master
|
||||
|
||||
COPY . /usr/src/minetest
|
||||
COPY .git /usr/src/minetest/.git
|
||||
COPY CMakeLists.txt /usr/src/minetest/CMakeLists.txt
|
||||
COPY README.md /usr/src/minetest/README.md
|
||||
COPY minetest.conf.example /usr/src/minetest/minetest.conf.example
|
||||
COPY builtin /usr/src/minetest/builtin
|
||||
COPY cmake /usr/src/minetest/cmake
|
||||
COPY doc /usr/src/minetest/doc
|
||||
COPY fonts /usr/src/minetest/fonts
|
||||
COPY lib /usr/src/minetest/lib
|
||||
COPY misc /usr/src/minetest/misc
|
||||
COPY po /usr/src/minetest/po
|
||||
COPY src /usr/src/minetest/src
|
||||
COPY textures /usr/src/minetest/textures
|
||||
|
||||
RUN mkdir -p /usr/src/minetest/cmakebuild && cd /usr/src/minetest/cmakebuild && \
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE \
|
||||
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 && \
|
||||
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 .. \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_TESTING=0 && \
|
||||
make -j2 && \
|
||||
make install
|
||||
|
||||
WORKDIR /usr/src/minetest
|
||||
RUN mkdir build && \
|
||||
cd build && \
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SERVER=TRUE \
|
||||
-DBUILD_CLIENT=FALSE \
|
||||
-DENABLE_SYSTEM_JSONCPP=1 \
|
||||
.. && \
|
||||
make -j2 && \
|
||||
rm -Rf ../games/minetest_game && git clone https://github.com/minetest/minetest_game ../games/minetest_game && \
|
||||
make install
|
||||
-DENABLE_PROMETHEUS=TRUE \
|
||||
-DBUILD_UNITTESTS=FALSE \
|
||||
-DBUILD_CLIENT=FALSE && \
|
||||
make -j2 && \
|
||||
make install
|
||||
|
||||
FROM debian:stretch
|
||||
FROM alpine:3.11
|
||||
|
||||
USER root
|
||||
RUN groupadd minetest && useradd -m -g minetest -d /var/lib/minetest minetest && \
|
||||
apt-get update -y && \
|
||||
apt-get -y install libcurl3-gnutls libjsoncpp1 liblua5.1-0 libluajit-5.1-2 libpq5 libsqlite3-0 \
|
||||
libstdc++6 zlib1g libc6
|
||||
RUN apk add --no-cache sqlite-libs curl gmp libstdc++ libgcc libpq luajit && \
|
||||
adduser -D minetest --uid 30000 -h /var/lib/minetest && \
|
||||
chown -R minetest:minetest /var/lib/minetest
|
||||
|
||||
WORKDIR /var/lib/minetest
|
||||
|
||||
@@ -33,8 +61,8 @@ 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
|
||||
|
||||
USER minetest
|
||||
USER minetest:minetest
|
||||
|
||||
EXPOSE 30000/udp
|
||||
EXPOSE 30000/udp 30000/tcp
|
||||
|
||||
CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"]
|
||||
|
||||
19
LICENSE.txt
19
LICENSE.txt
@@ -11,6 +11,9 @@ http://creativecommons.org/licenses/by-sa/3.0/
|
||||
textures/base/pack/refresh.png is under the Apache 2 license
|
||||
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/
|
||||
|
||||
Authors of media files
|
||||
-----------------------
|
||||
Everything not listed in here:
|
||||
@@ -21,6 +24,14 @@ ShadowNinja:
|
||||
|
||||
paramat:
|
||||
textures/base/pack/menu_header.png
|
||||
textures/base/pack/next_icon.png
|
||||
textures/base/pack/prev_icon.png
|
||||
textures/base/pack/clear.png
|
||||
textures/base/pack/search.png
|
||||
|
||||
rubenwardy, paramat:
|
||||
textures/base/pack/start_icon.png
|
||||
textures/base/pack/end_icon.png
|
||||
|
||||
erlehmann:
|
||||
misc/minetest-icon-24x24.png
|
||||
@@ -39,6 +50,14 @@ srifqi
|
||||
textures/base/pack/joystick_off.png
|
||||
textures/base/pack/minimap_btn.png
|
||||
|
||||
Zughy:
|
||||
textures/base/pack/cdb_add.png
|
||||
textures/base/pack/cdb_clear.png
|
||||
textures/base/pack/cdb_downloading.png
|
||||
textures/base/pack/cdb_queued.png
|
||||
textures/base/pack/cdb_update.png
|
||||
textures/base/pack/cdb_viewonline.png
|
||||
|
||||
License of Minetest source code
|
||||
-------------------------------
|
||||
|
||||
|
||||
311
README.md
311
README.md
@@ -1,17 +1,17 @@
|
||||
Minetest
|
||||
========
|
||||
|
||||
[](https://travis-ci.org/minetest/minetest)
|
||||

|
||||
[](https://hosted.weblate.org/engage/minetest/?utm_source=widget)
|
||||
[](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||
|
||||
Minetest is a free open-source voxel game engine with easy modding and game creation.
|
||||
|
||||
Copyright (C) 2010-2018 Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2010-2020 Perttu Ahola <celeron55@gmail.com>
|
||||
and contributors (see source file comments and the version control log)
|
||||
|
||||
In case you downloaded the source code:
|
||||
---------------------------------------
|
||||
In case you downloaded the source code
|
||||
--------------------------------------
|
||||
If you downloaded the Minetest Engine source code in which this file is
|
||||
contained, you probably want to download the [Minetest Game](https://github.com/minetest/minetest_game/)
|
||||
project too. See its README.txt for more information.
|
||||
@@ -31,10 +31,10 @@ Table of Contents
|
||||
|
||||
Further documentation
|
||||
----------------------
|
||||
- Website: http://minetest.net/
|
||||
- Wiki: http://wiki.minetest.net/
|
||||
- Developer wiki: http://dev.minetest.net/
|
||||
- Forum: http://forum.minetest.net/
|
||||
- Website: https://minetest.net/
|
||||
- Wiki: https://wiki.minetest.net/
|
||||
- Developer wiki: https://dev.minetest.net/
|
||||
- Forum: https://forum.minetest.net/
|
||||
- GitHub: https://github.com/minetest/minetest/
|
||||
- [doc/](doc/) directory of source distribution
|
||||
|
||||
@@ -65,19 +65,19 @@ Some can be changed in the key config dialog in the settings tab.
|
||||
| + | Increase view range |
|
||||
| - | Decrease view range |
|
||||
| K | Enable/disable fly mode (needs fly privilege) |
|
||||
| L | Enable/disable pitch move mode |
|
||||
| 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 |
|
||||
| C | Cycle through camera modes |
|
||||
| V | Cycle through minimap modes |
|
||||
| Shift + V | Change minimap orientation |
|
||||
| F1 | Hide/show HUD |
|
||||
| F2 | Hide/show chat |
|
||||
| F3 | Disable/enable fog |
|
||||
| F4 | Disable/enable camera update (Mapblocks are not updated anymore when disabled, disabled in release builds) |
|
||||
| F5 | Cycle through debug information screens |
|
||||
| F6 | Cycle through profiler info screens |
|
||||
| F7 | Cycle through camera modes |
|
||||
| F9 | Cycle through minimap modes |
|
||||
| Shift + F9 | Change minimap orientation |
|
||||
| F10 | Show/hide console |
|
||||
| F12 | Take screenshot |
|
||||
|
||||
@@ -92,13 +92,13 @@ Locations:
|
||||
Where each location is on each platform:
|
||||
|
||||
* Windows .zip / RUN_IN_PLACE source:
|
||||
* bin = `bin`
|
||||
* share = `.`
|
||||
* user = `.`
|
||||
* `bin` = `bin`
|
||||
* `share` = `.`
|
||||
* `user` = `.`
|
||||
* Windows installed:
|
||||
* $bin = `C:\Program Files\Minetest\bin (Depends on the install location)`
|
||||
* $share = `C:\Program Files\Minetest (Depends on the install location)`
|
||||
* $user = `%Appdata%\Minetest`
|
||||
* `bin` = `C:\Program Files\Minetest\bin (Depends on the install location)`
|
||||
* `share` = `C:\Program Files\Minetest (Depends on the install location)`
|
||||
* `user` = `%APPDATA%\Minetest`
|
||||
* Linux installed:
|
||||
* `bin` = `/usr/bin`
|
||||
* `share` = `/usr/share/minetest`
|
||||
@@ -110,18 +110,18 @@ Where each location is on each platform:
|
||||
|
||||
Worlds can be found as separate folders in: `user/worlds/`
|
||||
|
||||
Configuration file:
|
||||
-------------------
|
||||
Configuration file
|
||||
------------------
|
||||
- Default location:
|
||||
`user/minetest.conf`
|
||||
- It is created by Minetest when it is ran the first time.
|
||||
- This file is created by closing Minetest for the first time.
|
||||
- A specific file can be specified on the command line:
|
||||
`--config <path-to-file>`
|
||||
- A run-in-place build will look for the configuration file in
|
||||
`location_of_exe/../minetest.conf` and also `location_of_exe/../../minetest.conf`
|
||||
|
||||
Command-line options:
|
||||
---------------------
|
||||
Command-line options
|
||||
--------------------
|
||||
- Use `--help`
|
||||
|
||||
Compiling
|
||||
@@ -140,13 +140,21 @@ Compiling
|
||||
| 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:
|
||||
For Debian/Ubuntu users:
|
||||
|
||||
sudo apt 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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
For Arch users:
|
||||
|
||||
sudo pacman -S base-devel libcurl-gnutls cmake libxxf86vm irrlicht libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses
|
||||
|
||||
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
|
||||
|
||||
#### Download
|
||||
|
||||
@@ -165,7 +173,7 @@ Download source (this is the URL to the latest of source repository, which might
|
||||
git clone --depth 1 https://github.com/minetest/minetest.git
|
||||
cd minetest
|
||||
|
||||
Download minetest_game (otherwise only the "Minimal development test" game is available) using Git:
|
||||
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
|
||||
|
||||
@@ -188,21 +196,21 @@ Download minetest_game, without using Git:
|
||||
Build a version that runs directly from the source directory:
|
||||
|
||||
cmake . -DRUN_IN_PLACE=TRUE
|
||||
make -j <number of processors>
|
||||
make -j$(nproc)
|
||||
|
||||
Run it:
|
||||
|
||||
./bin/minetest
|
||||
|
||||
- Use `cmake . -LH` to see all CMake options and their current state
|
||||
- Use `cmake . -LH` to see all CMake options and their current state.
|
||||
- If you want to install it system-wide (or are making a distribution package),
|
||||
you will want to use `-DRUN_IN_PLACE=FALSE`
|
||||
- You can build a bare server by specifying `-DBUILD_SERVER=TRUE`
|
||||
- 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`
|
||||
you will want to use `-DRUN_IN_PLACE=FALSE`.
|
||||
- You can build a bare server by specifying `-DBUILD_SERVER=TRUE`.
|
||||
- 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`.
|
||||
|
||||
### CMake options
|
||||
|
||||
@@ -210,6 +218,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
|
||||
CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug)
|
||||
Release - Release build
|
||||
Debug - Debug build
|
||||
@@ -220,13 +229,14 @@ General options and their default values:
|
||||
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 - Search for Open GLES headers & libraries and use them
|
||||
ENABLE_GLES=OFF - Build for OpenGL ES instead of OpenGL (requires support by Irrlicht)
|
||||
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
|
||||
ENABLE_SPATIAL=ON - Build with LibSpatial; Speeds up AreaStores
|
||||
ENABLE_SOUND=ON - Build with OpenAL, libogg & libvorbis; in-game sounds
|
||||
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
|
||||
@@ -259,7 +269,7 @@ Library specific options:
|
||||
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
|
||||
PostgreSQL_INCLUDE_DIR - Only when building with PostgreSQL; directory that contains libpq-fe.h
|
||||
POSTGRESQL_LIBRARY - Only when building with PostgreSQL; path to libpq.a/libpq.so
|
||||
PostgreSQL_LIBRARY - Only when building with PostgreSQL; path to libpq.a/libpq.so/libpq.lib
|
||||
REDIS_INCLUDE_DIR - Only when building with Redis; directory that contains hiredis.h
|
||||
REDIS_LIBRARY - Only when building with Redis; path to libhiredis.a/libhiredis.so
|
||||
SPATIAL_INCLUDE_DIR - Only when building with LibSpatial; directory that contains spatialindex/SpatialIndex.h
|
||||
@@ -284,183 +294,94 @@ Library specific options:
|
||||
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
|
||||
ZLIBWAPI_DLL - Only on Windows; path to zlibwapi.dll
|
||||
ZLIB_INCLUDE_DIR - Directory that contains zlib.h
|
||||
ZLIB_LIBRARY - Path to libz.a/libz.so/zlibwapi.lib
|
||||
ZLIB_LIBRARY - Path to libz.a/libz.so/zlib.lib
|
||||
|
||||
### Compiling on Windows
|
||||
|
||||
* This section is outdated. In addition to what is described here:
|
||||
* In addition to minetest, you need to download [minetest_game](https://github.com/minetest/minetest_game).
|
||||
* If you wish to have sound support, you need libogg, libvorbis and libopenal
|
||||
### Requirements
|
||||
|
||||
* You need:
|
||||
* CMake:
|
||||
http://www.cmake.org/cmake/resources/software.html
|
||||
* A compiler
|
||||
* MinGW: http://www.mingw.org/
|
||||
* or Visual Studio: http://msdn.microsoft.com/en-us/vstudio/default
|
||||
* Irrlicht SDK 1.7:
|
||||
http://irrlicht.sourceforge.net/downloads.html
|
||||
* Zlib headers (zlib125.zip)
|
||||
http://www.winimage.com/zLibDll/index.html
|
||||
* Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip):
|
||||
http://www.winimage.com/zLibDll/index.html
|
||||
* SQLite3 headers and library
|
||||
https://www.sqlite.org/download.html
|
||||
* Optional: gettext library and tools:
|
||||
http://gnuwin32.sourceforge.net/downlinks/gettext.php
|
||||
* This is used for other UI languages. Feel free to leave it out.
|
||||
* And, of course, Minetest:
|
||||
http://minetest.net/download
|
||||
* Steps:
|
||||
* Select a directory called DIR hereafter in which you will operate.
|
||||
* Make sure you have CMake and a compiler installed.
|
||||
* Download all the other stuff to DIR and extract them into there.
|
||||
("extract here", not "extract to packagename/")
|
||||
* NOTE: zlib125dll.zip needs to be extracted into zlib125dll
|
||||
* NOTE: You need to extract sqlite3.h & sqlite3ext.h from the SQLite 3
|
||||
source and sqlite3.dll & sqlite3.def from the SQLite 3 precompiled
|
||||
binaries into "sqlite3" directory, and generate sqlite3.lib using
|
||||
command "LIB /DEF:sqlite3.def /OUT:sqlite3.lib"
|
||||
* All those packages contain a nice base directory in them, which
|
||||
should end up being the direct subdirectories of DIR.
|
||||
* You will end up with a directory structure like this (+=dir, -=file):
|
||||
-----------------
|
||||
+ DIR
|
||||
* zlib-1.2.5.tar.gz
|
||||
* zlib125dll.zip
|
||||
* irrlicht-1.8.3.zip
|
||||
* sqlite-amalgamation-3130000.zip (SQLite3 headers)
|
||||
* sqlite-dll-win32-x86-3130000.zip (SQLite3 library for 32bit system)
|
||||
* 110214175330.zip (or whatever, this is the minetest source)
|
||||
+ zlib-1.2.5
|
||||
* zlib.h
|
||||
+ win32
|
||||
...
|
||||
+ zlib125dll
|
||||
* readme.txt
|
||||
+ dll32
|
||||
...
|
||||
+ irrlicht-1.8.3
|
||||
+ lib
|
||||
+ include
|
||||
...
|
||||
+ sqlite3
|
||||
sqlite3.h
|
||||
sqlite3ext.h
|
||||
sqlite3.lib
|
||||
sqlite3.dll
|
||||
+ gettext (optional)
|
||||
+bin
|
||||
+include
|
||||
+lib
|
||||
+ minetest
|
||||
+ src
|
||||
+ doc
|
||||
* CMakeLists.txt
|
||||
...
|
||||
-----------------
|
||||
* Start up the CMake GUI
|
||||
* Select "Browse Source..." and select DIR/minetest
|
||||
* Now, if using MSVC:
|
||||
* Select "Browse Build..." and select DIR/minetest-build
|
||||
* Else if using MinGW:
|
||||
* Select "Browse Build..." and select DIR/minetest
|
||||
* Select "Configure"
|
||||
* Select your compiler
|
||||
* It will warn about missing stuff, ignore that at this point. (later don't)
|
||||
* Make sure the configuration is as follows
|
||||
(note that the versions may differ for you):
|
||||
- [Visual Studio 2015 or newer](https://visualstudio.microsoft.com)
|
||||
- [CMake](https://cmake.org/download/)
|
||||
- [vcpkg](https://github.com/Microsoft/vcpkg)
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
|
||||
BUILD_CLIENT [X]
|
||||
BUILD_SERVER [ ]
|
||||
CMAKE_BUILD_TYPE Release
|
||||
CMAKE_INSTALL_PREFIX DIR/minetest-install
|
||||
IRRLICHT_SOURCE_DIR DIR/irrlicht-1.8.3
|
||||
RUN_IN_PLACE [X]
|
||||
WARN_ALL [ ]
|
||||
ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll
|
||||
ZLIB_INCLUDE_DIR DIR/zlib-1.2.5
|
||||
ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib
|
||||
GETTEXT_BIN_DIR DIR/gettext/bin
|
||||
GETTEXT_INCLUDE_DIR DIR/gettext/include
|
||||
GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib
|
||||
GETTEXT_MSGFMT DIR/gettext/bin/msgfmt
|
||||
### Compiling and installing the dependencies
|
||||
|
||||
* If CMake complains it couldn't find SQLITE3, choose "Advanced" box on the
|
||||
right top corner, then specify the location of SQLITE3_INCLUDE_DIR and
|
||||
SQLITE3_LIBRARY manually.
|
||||
* If you want to build 64-bit minetest, you will need to build 64-bit version
|
||||
of irrlicht engine manually, as only 32-bit pre-built library is provided.
|
||||
* Hit "Configure"
|
||||
* Hit "Configure" once again 8)
|
||||
* If something is still coloured red, you have a problem.
|
||||
* Hit "Generate"
|
||||
If using MSVC:
|
||||
* Open the generated minetest.sln
|
||||
* The project defaults to the "Debug" configuration. Make very sure to
|
||||
select "Release", unless you want to debug some stuff (it's slower
|
||||
and might not even work at all)
|
||||
* Build the ALL_BUILD project
|
||||
* Build the INSTALL project
|
||||
* You should now have a working game with the executable in
|
||||
DIR/minetest-install/bin/minetest.exe
|
||||
* Additionally you may create a zip package by building the PACKAGE
|
||||
project.
|
||||
If using MinGW:
|
||||
* Using the command line, browse to the build directory and run 'make'
|
||||
(or mingw32-make or whatever it happens to be)
|
||||
* You may need to copy some of the downloaded DLLs into bin/, see what
|
||||
running the produced executable tells you it doesn't have.
|
||||
* You should now have a working game with the executable in
|
||||
DIR/minetest/bin/minetest.exe
|
||||
It is highly recommended to use vcpkg as package manager.
|
||||
|
||||
### Bat script to build Windows releases of Minetest
|
||||
#### a) Using vcpkg to install dependencies
|
||||
|
||||
This is how we build Windows releases.
|
||||
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
|
||||
```
|
||||
|
||||
set sourcedir=%CD%
|
||||
set installpath="C:\tmp\minetest_install"
|
||||
set irrlichtpath="C:\tmp\irrlicht-1.7.2"
|
||||
- `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
|
||||
|
||||
set builddir=%sourcedir%\bvc10
|
||||
mkdir %builddir%
|
||||
pushd %builddir%
|
||||
cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=TRUE -DCMAKE_INSTALL_PREFIX=%installpath%
|
||||
if %errorlevel% neq 0 goto fail
|
||||
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release
|
||||
if %errorlevel% neq 0 goto fail
|
||||
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" INSTALL.vcxproj /p:Configuration=Release
|
||||
if %errorlevel% neq 0 goto fail
|
||||
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" PACKAGE.vcxproj /p:Configuration=Release
|
||||
if %errorlevel% neq 0 goto fail
|
||||
popd
|
||||
echo Finished.
|
||||
exit /b 0
|
||||
There are other optional libraries, but they are not tested if they can build and link correctly.
|
||||
|
||||
:fail
|
||||
popd
|
||||
echo Failed.
|
||||
exit /b 1
|
||||
Use `--triplet` to specify the target triplet, e.g. `x64-windows` or `x86-windows`.
|
||||
|
||||
### Windows Installer using WIX Toolset
|
||||
#### 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
|
||||
1. Start up the CMake GUI
|
||||
2. Select **Browse Source...** and select DIR/minetest
|
||||
3. Select **Browse Build...** and select DIR/minetest-build
|
||||
4. Select **Configure**
|
||||
5. Choose the right visual Studio version and target platform. It has to match the version of the installed dependencies
|
||||
6. Choose **Specify toolchain file for cross-compiling**
|
||||
7. Click **Next**
|
||||
8. Select the vcpkg toolchain file e.g. `D:/vcpkg/scripts/buildsystems/vcpkg.cmake`
|
||||
9. Click Finish
|
||||
10. Wait until cmake have generated the cash file
|
||||
11. If there are any errors, solve them and hit **Configure**
|
||||
12. Click **Generate**
|
||||
13. Click **Open Project**
|
||||
14. Compile Minetest inside Visual studio.
|
||||
|
||||
#### b) Using the vcpkg toolchain and the commandline
|
||||
|
||||
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 --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:
|
||||
* Visual Studio 2017
|
||||
* Wix Toolset
|
||||
* [Visual Studio 2017](https://visualstudio.microsoft.com/)
|
||||
* [WiX Toolset](https://wixtoolset.org/)
|
||||
|
||||
In Visual Studio 2017 Installer select "Optional Features" -> "Wix Toolset"
|
||||
In the Visual Studio 2017 Installer select **Optional Features -> WiX Toolset**.
|
||||
|
||||
Build the binaries like described above, but make sure you unselect "RUN_IN_PLACE".
|
||||
Build the binaries as described above, but make sure you unselect `RUN_IN_PLACE`.
|
||||
|
||||
Open the generated Project file with VS. Right click "PACKAGE" and choose "Generate".
|
||||
Open the generated project file with Visual Studio. Right-click **Package** and choose **Generate**.
|
||||
It may take some minutes to generate the installer.
|
||||
|
||||
|
||||
Docker
|
||||
------
|
||||
We provide Minetest server docker images using the Gitlab mirror registry.
|
||||
We provide Minetest server Docker images using the GitLab mirror registry.
|
||||
|
||||
Images are built on each commit and available using the following tag scheme:
|
||||
|
||||
@@ -468,20 +389,20 @@ Images are built on each commit and available using the following tag scheme:
|
||||
* `registry.gitlab.com/minetest/minetest/server:<branch/tag>` (current branch or current tag)
|
||||
* `registry.gitlab.com/minetest/minetest/server:<commit-id>` (current commit id)
|
||||
|
||||
If you want to test it on a docker server, you can easily run:
|
||||
If you want to test it on a Docker server you can easily run:
|
||||
|
||||
sudo docker run registry.gitlab.com/minetest/minetest/server:<docker tag>
|
||||
|
||||
If you want to use it in a production environment you should use volumes bound to the docker host
|
||||
If you want to use it in a production environment you should use volumes bound to the Docker host
|
||||
to persist data and modify the configuration:
|
||||
|
||||
sudo docker create -v /home/minetest/data/:/var/lib/minetest/ -v /home/minetest/conf/:/etc/minetest/ registry.gitlab.com/minetest/minetest/server:master
|
||||
|
||||
Data will be written to `/home/minetest/data` on the host, and configuration will be read from `/home/minetest/conf/minetest.conf`.
|
||||
|
||||
Note: If you don't understand the previous commands, please read the official Docker documentation before use.
|
||||
**Note:** If you don't understand the previous commands please read the official Docker documentation before use.
|
||||
|
||||
You can also host your minetest server inside a Kubernetes cluster. See our example implementation in `misc/kubernetes.yml`.
|
||||
You can also host your Minetest server inside a Kubernetes cluster. See our example implementation in [`misc/kubernetes.yml`](misc/kubernetes.yml).
|
||||
|
||||
|
||||
Version scheme
|
||||
|
||||
11
build/android/.gitignore
vendored
Normal file
11
build/android/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
*.iml
|
||||
.externalNativeBuild
|
||||
.gradle
|
||||
app/build
|
||||
app/release
|
||||
app/src/main/assets
|
||||
build
|
||||
local.properties
|
||||
native/.*
|
||||
native/build
|
||||
native/deps
|
||||
@@ -1,766 +0,0 @@
|
||||
# build options
|
||||
|
||||
OS := $(shell uname)
|
||||
|
||||
# compile with GPROF
|
||||
# GPROF = 1
|
||||
|
||||
# build for build platform
|
||||
API = 14
|
||||
APP_PLATFORM = android-$(API)
|
||||
|
||||
ANDR_ROOT = $(shell pwd)
|
||||
PROJ_ROOT = $(shell realpath $(ANDR_ROOT)/../..)
|
||||
APP_ROOT = $(ANDR_ROOT)/src/main
|
||||
|
||||
VERSION_MAJOR := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \
|
||||
grep ^set\(VERSION_MAJOR\ | sed 's/)/ /' | cut -f2 -d' ')
|
||||
VERSION_MINOR := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \
|
||||
grep ^set\(VERSION_MINOR\ | sed 's/)/ /' | cut -f2 -d' ')
|
||||
VERSION_PATCH := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \
|
||||
grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | cut -f2 -d' ')
|
||||
|
||||
################################################################################
|
||||
# toolchain config for arm new processors
|
||||
################################################################################
|
||||
TARGET_HOST = arm-linux
|
||||
TARGET_ABI = armeabi-v7a
|
||||
TARGET_LIBDIR = armeabi-v7a
|
||||
TARGET_TOOLCHAIN = arm-linux-androideabi-
|
||||
TARGET_CFLAGS_ADDON = -mfloat-abi=softfp -mfpu=vfpv3 -O3
|
||||
TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
|
||||
TARGET_ARCH = armv7
|
||||
CROSS_CC = clang
|
||||
CROSS_CXX = clang++
|
||||
COMPILER_VERSION = clang
|
||||
HAVE_LEVELDB = 0
|
||||
|
||||
################################################################################
|
||||
# toolchain config for little endian mips
|
||||
################################################################################
|
||||
#TARGET_HOST = mipsel-linux
|
||||
#TARGET_ABI = mips
|
||||
#TARGET_LIBDIR = mips
|
||||
#TARGET_TOOLCHAIN = mipsel-linux-android-
|
||||
#TARGET_ARCH = mips32
|
||||
#CROSS_CC = mipsel-linux-android-gcc
|
||||
#CROSS_CXX = mipsel-linux-android-g++
|
||||
#COMPILER_VERSION = 4.9
|
||||
#HAVE_LEVELDB = 0
|
||||
|
||||
################################################################################
|
||||
# toolchain config for x86
|
||||
################################################################################
|
||||
#TARGET_HOST = x86-linux
|
||||
#TARGET_ABI = x86
|
||||
#TARGET_LIBDIR = x86
|
||||
#TARGET_TOOLCHAIN = x86-
|
||||
#TARGET_ARCH = x86
|
||||
#CROSS_CC = clang
|
||||
#CROSS_CXX = clang++
|
||||
#COMPILER_VERSION = clang
|
||||
#HAVE_LEVELDB = 0
|
||||
|
||||
################################################################################
|
||||
ASSETS_TIMESTAMP = deps/assets_timestamp
|
||||
|
||||
LEVELDB_DIR = $(ANDR_ROOT)/deps/leveldb/
|
||||
LEVELDB_LIB = $(LEVELDB_DIR)libleveldb.a
|
||||
LEVELDB_TIMESTAMP = $(LEVELDB_DIR)/timestamp
|
||||
LEVELDB_TIMESTAMP_INT = $(ANDR_ROOT)/deps/leveldb_timestamp
|
||||
LEVELDB_URL_GIT = https://github.com/google/leveldb
|
||||
LEVELDB_COMMIT = 2d0320a458d0e6a20fff46d5f80b18bfdcce7018
|
||||
|
||||
OPENAL_DIR = $(ANDR_ROOT)/deps/openal-soft/
|
||||
OPENAL_LIB = $(OPENAL_DIR)libs/$(TARGET_ABI)/libopenal.so
|
||||
OPENAL_TIMESTAMP = $(OPENAL_DIR)/timestamp
|
||||
OPENAL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/openal_timestamp
|
||||
OPENAL_URL_GIT = https://github.com/apportable/openal-soft
|
||||
|
||||
OGG_DIR = $(ANDR_ROOT)/deps/libvorbis-libogg-android/
|
||||
OGG_LIB = $(OGG_DIR)libs/$(TARGET_ABI)/libogg.so
|
||||
VORBIS_LIB = $(OGG_DIR)libs/$(TARGET_ABI)/libogg.so
|
||||
OGG_TIMESTAMP = $(OGG_DIR)timestamp
|
||||
OGG_TIMESTAMP_INT = $(ANDR_ROOT)/deps/ogg_timestamp
|
||||
OGG_URL_GIT = https://gitlab.com/minetest/libvorbis-libogg-android
|
||||
|
||||
IRRLICHT_REVISION = 5150
|
||||
IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht/
|
||||
IRRLICHT_LIB = $(IRRLICHT_DIR)lib/Android/libIrrlicht.a
|
||||
IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp
|
||||
IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_timestamp
|
||||
IRRLICHT_URL_SVN = https://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@$(IRRLICHT_REVISION)
|
||||
|
||||
OPENSSL_VERSION = 1.0.2n
|
||||
OPENSSL_BASEDIR = openssl-$(OPENSSL_VERSION)
|
||||
OPENSSL_DIR = $(ANDR_ROOT)/deps/$(OPENSSL_BASEDIR)/
|
||||
OPENSSL_LIB = $(OPENSSL_DIR)/libssl.a
|
||||
OPENSSL_TIMESTAMP = $(OPENSSL_DIR)timestamp
|
||||
OPENSSL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/openssl_timestamp
|
||||
OPENSSL_URL = https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz
|
||||
|
||||
CURL_VERSION = 7.60.0
|
||||
CURL_DIR = $(ANDR_ROOT)/deps/curl-$(CURL_VERSION)
|
||||
CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a
|
||||
CURL_TIMESTAMP = $(CURL_DIR)/timestamp
|
||||
CURL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/curl_timestamp
|
||||
CURL_URL_HTTP = https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2
|
||||
|
||||
FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype2-android/
|
||||
FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGET_ABI)/libfreetype2-static.a
|
||||
FREETYPE_TIMESTAMP = $(FREETYPE_DIR)timestamp
|
||||
FREETYPE_TIMESTAMP_INT = $(ANDR_ROOT)/deps/freetype_timestamp
|
||||
FREETYPE_URL_GIT = https://github.com/cdave1/freetype2-android
|
||||
|
||||
ICONV_VERSION = 1.14
|
||||
ICONV_DIR = $(ANDR_ROOT)/deps/libiconv/
|
||||
ICONV_LIB = $(ICONV_DIR)/lib/.libs/libiconv.so
|
||||
ICONV_TIMESTAMP = $(ICONV_DIR)timestamp
|
||||
ICONV_TIMESTAMP_INT = $(ANDR_ROOT)/deps/iconv_timestamp
|
||||
ICONV_URL_HTTP = https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$(ICONV_VERSION).tar.gz
|
||||
|
||||
SQLITE3_FOLDER = sqlite-amalgamation-3240000
|
||||
SQLITE3_URL = https://www.sqlite.org/2018/$(SQLITE3_FOLDER).zip
|
||||
|
||||
ANDROID_SDK = $(shell grep '^sdk\.dir' local.properties | sed 's/^.*=[[:space:]]*//')
|
||||
ANDROID_NDK = $(shell grep '^ndk\.dir' local.properties | sed 's/^.*=[[:space:]]*//')
|
||||
|
||||
#use interim target variable to switch leveldb on or off
|
||||
ifeq ($(HAVE_LEVELDB),1)
|
||||
LEVELDB_TARGET = $(LEVELDB_LIB)
|
||||
endif
|
||||
|
||||
.PHONY : debug release reconfig delconfig \
|
||||
leveldb_download clean_leveldb leveldb\
|
||||
irrlicht_download clean_irrlicht irrlicht \
|
||||
clean_assets assets sqlite3_download \
|
||||
freetype_download clean_freetype freetype \
|
||||
apk clean_apk \
|
||||
clean_all clean prep_srcdir \
|
||||
install_debug install_release envpaths all \
|
||||
$(ASSETS_TIMESTAMP) $(LEVELDB_TIMESTAMP) \
|
||||
$(OPENAL_TIMESTAMP) $(OGG_TIMESTAMP) \
|
||||
$(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \
|
||||
$(OPENSSL_TIMESTAMP) \
|
||||
$(ANDR_ROOT)/jni/src/android_version.h \
|
||||
$(ANDR_ROOT)/jni/src/android_version_githash.h
|
||||
|
||||
debug : local.properties
|
||||
export NDEBUG=; \
|
||||
export BUILD_TYPE=debug; \
|
||||
$(MAKE) apk
|
||||
|
||||
all : debug release
|
||||
|
||||
release : local.properties
|
||||
@export NDEBUG=1; \
|
||||
export BUILD_TYPE=release; \
|
||||
$(MAKE) apk
|
||||
|
||||
reconfig: delconfig
|
||||
@$(MAKE) local.properties
|
||||
|
||||
delconfig:
|
||||
$(RM) local.properties
|
||||
|
||||
local.properties:
|
||||
@echo "Please specify path of ANDROID NDK"; \
|
||||
echo "e.g. $$HOME/Android/Sdk/ndk-bundle/"; \
|
||||
read ANDROID_NDK ; \
|
||||
if [ ! -d $$ANDROID_NDK ] ; then \
|
||||
echo "$$ANDROID_NDK is not a valid folder"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo "ndk.dir = $$ANDROID_NDK" > local.properties; \
|
||||
echo "Please specify path of ANDROID SDK"; \
|
||||
echo "e.g. $$HOME/Android/Sdk/"; \
|
||||
read SDKFLDR ; \
|
||||
if [ ! -d $$SDKFLDR ] ; then \
|
||||
echo "$$SDKFLDR is not a valid folder"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo "sdk.dir = $$SDKFLDR" >> local.properties;
|
||||
|
||||
|
||||
$(OPENAL_TIMESTAMP) : openal_download
|
||||
@LAST_MODIF=$$(find ${OPENAL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${OPENAL_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
openal_download :
|
||||
@if [ ! -d ${OPENAL_DIR} ] ; then \
|
||||
echo "openal sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd ${ANDR_ROOT}/deps ; \
|
||||
git clone ${OPENAL_URL_GIT} || exit 1; \
|
||||
fi
|
||||
|
||||
openal : $(OPENAL_LIB)
|
||||
|
||||
$(OPENAL_LIB): $(OPENAL_TIMESTAMP)
|
||||
+ @REFRESH=0; \
|
||||
if [ ! -e ${OPENAL_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${OPENAL_TIMESTAMP} -nt ${OPENAL_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
echo "changed timestamp for openal detected building..."; \
|
||||
cd ${OPENAL_DIR}; \
|
||||
export APP_PLATFORM=${APP_PLATFORM}; \
|
||||
export TARGET_ABI=${TARGET_ABI}; \
|
||||
export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \
|
||||
export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \
|
||||
export COMPILER_VERSION=${COMPILER_VERSION}; \
|
||||
${ANDROID_NDK}/ndk-build \
|
||||
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \
|
||||
touch ${OPENAL_TIMESTAMP}; \
|
||||
touch ${OPENAL_TIMESTAMP_INT}; \
|
||||
else \
|
||||
echo "nothing to be done for openal"; \
|
||||
fi
|
||||
|
||||
clean_openal :
|
||||
$(RM) -rf ${OPENAL_DIR}
|
||||
|
||||
$(OGG_TIMESTAMP) : ogg_download
|
||||
@LAST_MODIF=$$(find ${OGG_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${OGG_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
ogg_download :
|
||||
@if [ ! -d ${OGG_DIR} ] ; then \
|
||||
echo "ogg sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd ${ANDR_ROOT}/deps ; \
|
||||
git clone ${OGG_URL_GIT}|| exit 1; \
|
||||
cd libvorbis-libogg-android ; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/libvorbis-libogg-fpu.patch || exit 1; \
|
||||
fi
|
||||
|
||||
ogg : $(OGG_LIB)
|
||||
|
||||
$(OGG_LIB): $(OGG_TIMESTAMP)
|
||||
+ @REFRESH=0; \
|
||||
if [ ! -e ${OGG_TIMESTAMP_INT} ] ; then \
|
||||
echo "${OGG_TIMESTAMP_INT} doesn't exist"; \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${OGG_TIMESTAMP} -nt ${OGG_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
echo "changed timestamp for ogg detected building..."; \
|
||||
cd ${OGG_DIR}; \
|
||||
export APP_PLATFORM=${APP_PLATFORM}; \
|
||||
export TARGET_ABI=${TARGET_ABI}; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
touch ${OGG_TIMESTAMP}; \
|
||||
touch ${OGG_TIMESTAMP_INT}; \
|
||||
else \
|
||||
echo "nothing to be done for libogg/libvorbis"; \
|
||||
fi
|
||||
|
||||
clean_ogg :
|
||||
$(RM) -rf ${OGG_DIR}
|
||||
|
||||
$(OPENSSL_TIMESTAMP) : openssl_download
|
||||
@LAST_MODIF=$$(find ${OPENSSL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${OPENSSL_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
openssl_download :
|
||||
@if [ ! -d ${OPENSSL_DIR} ] ; then \
|
||||
echo "openssl sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd ${ANDR_ROOT}/deps ; \
|
||||
wget ${OPENSSL_URL} || exit 1; \
|
||||
tar -xzf ${OPENSSL_BASEDIR}.tar.gz; \
|
||||
cd ${OPENSSL_BASEDIR}; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/openssl_arch.patch; \
|
||||
sed -i 's/-mandroid //g' Configure; \
|
||||
fi
|
||||
|
||||
openssl : $(OPENSSL_LIB)
|
||||
|
||||
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${OPENSSL_TIMESTAMP_INT} ] ; then \
|
||||
echo "${OPENSSL_TIMESTAMP_INT} doesn't exist"; \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${OPENSSL_TIMESTAMP} -nt ${OPENSSL_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
echo "changed timestamp for openssl detected building..."; \
|
||||
cd ${OPENSSL_DIR}; \
|
||||
ln -s ${OPENSSL_DIR} ../openssl; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-openssl; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--stl=libc++ \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
|
||||
CC=${CROSS_CC} ./Configure -DL_ENDIAN no-asm android-${TARGET_ARCH} \
|
||||
-D__ANDROID_API__=$(API); \
|
||||
CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \
|
||||
CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \
|
||||
touch ${OPENSSL_TIMESTAMP}; \
|
||||
touch ${OPENSSL_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for openssl"; \
|
||||
fi
|
||||
|
||||
clean_openssl :
|
||||
$(RM) -rf ${OPENSSL_DIR}; \
|
||||
$(RM) -rf $(ANDR_ROOT)/deps/${OPENSSL_BASEDIR}.tar.gz; \
|
||||
$(RM) -rf $(ANDR_ROOT)/deps/openssl
|
||||
|
||||
$(LEVELDB_TIMESTAMP) : leveldb_download
|
||||
@LAST_MODIF=$$(find ${LEVELDB_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${LEVELDB_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
leveldb_download :
|
||||
@if [ ! -d ${LEVELDB_DIR} ] ; then \
|
||||
echo "leveldb sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd ${ANDR_ROOT}/deps ; \
|
||||
git clone ${LEVELDB_URL_GIT} || exit 1; \
|
||||
cd ${LEVELDB_DIR} || exit 1; \
|
||||
git checkout ${LEVELDB_COMMIT} || exit 1; \
|
||||
fi
|
||||
|
||||
leveldb : $(LEVELDB_LIB)
|
||||
ifeq ($(HAVE_LEVELDB),1)
|
||||
$(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${LEVELDB_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${LEVELDB_TIMESTAMP} -nt ${LEVELDB_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
echo "changed timestamp for leveldb detected building..."; \
|
||||
cd deps/leveldb; \
|
||||
export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-leveldb; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--stl=libc++ \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CC=${CROSS_CC}; \
|
||||
export CXX=${CROSS_CXX}; \
|
||||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \
|
||||
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
|
||||
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
|
||||
$(MAKE) || exit 1; \
|
||||
touch ${LEVELDB_TIMESTAMP}; \
|
||||
touch ${LEVELDB_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for leveldb"; \
|
||||
fi
|
||||
endif
|
||||
|
||||
clean_leveldb :
|
||||
./gradlew cleanLevelDB
|
||||
|
||||
$(FREETYPE_TIMESTAMP) : freetype_download
|
||||
@LAST_MODIF=$$(find ${FREETYPE_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${FREETYPE_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
freetype_download :
|
||||
@if [ ! -d ${FREETYPE_DIR} ] ; then \
|
||||
echo "freetype sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd deps; \
|
||||
git clone ${FREETYPE_URL_GIT} || exit 1; \
|
||||
fi
|
||||
|
||||
freetype : $(FREETYPE_LIB)
|
||||
|
||||
$(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
|
||||
+ @REFRESH=0; \
|
||||
if [ ! -e ${FREETYPE_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -e ${FREETYPE_LIB} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${FREETYPE_TIMESTAMP} -nt ${FREETYPE_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
mkdir -p ${FREETYPE_DIR}; \
|
||||
echo "changed timestamp for freetype detected building..."; \
|
||||
cd ${FREETYPE_DIR}/Android/jni; \
|
||||
export APP_PLATFORM=${APP_PLATFORM}; \
|
||||
export TARGET_ABI=${TARGET_ABI}; \
|
||||
export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \
|
||||
export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \
|
||||
export COMPILER_VERSION=${COMPILER_VERSION}; \
|
||||
${ANDROID_NDK}/ndk-build \
|
||||
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \
|
||||
touch ${FREETYPE_TIMESTAMP}; \
|
||||
touch ${FREETYPE_TIMESTAMP_INT}; \
|
||||
else \
|
||||
echo "nothing to be done for freetype"; \
|
||||
fi
|
||||
|
||||
clean_freetype :
|
||||
./gradlew cleanFreetype
|
||||
|
||||
$(ICONV_TIMESTAMP) : iconv_download
|
||||
@LAST_MODIF=$$(find ${ICONV_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${ICONV_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
iconv_download :
|
||||
@if [ ! -d ${ICONV_DIR} ] ; then \
|
||||
echo "iconv sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd ${ANDR_ROOT}/deps; \
|
||||
wget ${ICONV_URL_HTTP} || exit 1; \
|
||||
tar -xzf libiconv-${ICONV_VERSION}.tar.gz || exit 1; \
|
||||
rm libiconv-${ICONV_VERSION}.tar.gz; \
|
||||
ln -s libiconv-${ICONV_VERSION} libiconv; \
|
||||
cd ${ICONV_DIR}; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/libiconv_android.patch; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/libiconv_stdio.patch; \
|
||||
fi
|
||||
|
||||
iconv : $(ICONV_LIB)
|
||||
|
||||
$(ICONV_LIB) : $(ICONV_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${ICONV_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -e ${ICONV_LIB} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${ICONV_TIMESTAMP} -nt ${ICONV_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
mkdir -p ${ICONV_DIR}; \
|
||||
echo "changed timestamp for iconv detected building..."; \
|
||||
cd ${ICONV_DIR}; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-iconv; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--stl=libc++ \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON} -lstdc++"; \
|
||||
export CC=${CROSS_CC}; \
|
||||
export CXX=${CROSS_CXX}; \
|
||||
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
|
||||
./configure --host=${TARGET_HOST} || exit 1; \
|
||||
sed -i 's/LIBICONV_VERSION_INFO) /LIBICONV_VERSION_INFO) -avoid-version /g' lib/Makefile; \
|
||||
grep "iconv_LDFLAGS" src/Makefile; \
|
||||
$(MAKE) -s || exit 1; \
|
||||
touch ${ICONV_TIMESTAMP}; \
|
||||
touch ${ICONV_TIMESTAMP_INT}; \
|
||||
rm -rf ${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for iconv"; \
|
||||
fi
|
||||
|
||||
clean_iconv :
|
||||
./gradlew cleanIconv
|
||||
|
||||
#Note: Texturehack patch is required for gpu's not supporting color format
|
||||
# correctly. Known bad GPU:
|
||||
# -geforce on emulator
|
||||
# -Vivante Corporation GC1000 core (e.g. Galaxy Tab 3)
|
||||
|
||||
irrlicht_download :
|
||||
@if [ ! -d "deps/irrlicht" ] ; then \
|
||||
echo "irrlicht sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd deps; \
|
||||
svn co ${IRRLICHT_URL_SVN} irrlicht || exit 1; \
|
||||
cd irrlicht; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-touchcount.patch || exit 1; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-back_button.patch || exit 1; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-texturehack.patch || exit 1; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/irrlicht-native_activity.patch || exit 1; \
|
||||
fi
|
||||
|
||||
$(IRRLICHT_TIMESTAMP) : irrlicht_download
|
||||
@LAST_MODIF=$$(find ${IRRLICHT_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${IRRLICHT_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
irrlicht : $(IRRLICHT_LIB)
|
||||
|
||||
$(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB)
|
||||
+ @REFRESH=0; \
|
||||
if [ ! -e ${IRRLICHT_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -e ${IRRLICHT_LIB} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${IRRLICHT_TIMESTAMP} -nt ${IRRLICHT_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
mkdir -p ${IRRLICHT_DIR}; \
|
||||
echo "changed timestamp for irrlicht detected building..."; \
|
||||
cd deps/irrlicht/source/Irrlicht/Android; \
|
||||
export APP_PLATFORM=${APP_PLATFORM}; \
|
||||
export TARGET_ABI=${TARGET_ABI}; \
|
||||
export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \
|
||||
export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \
|
||||
export COMPILER_VERSION=${COMPILER_VERSION}; \
|
||||
${ANDROID_NDK}/ndk-build \
|
||||
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \
|
||||
touch ${IRRLICHT_TIMESTAMP}; \
|
||||
touch ${IRRLICHT_TIMESTAMP_INT}; \
|
||||
else \
|
||||
echo "nothing to be done for irrlicht"; \
|
||||
fi
|
||||
|
||||
clean_irrlicht :
|
||||
./gradlew cleanIrrlicht
|
||||
|
||||
$(CURL_TIMESTAMP) : curl_download
|
||||
@LAST_MODIF=$$(find ${CURL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${CURL_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
curl_download :
|
||||
@if [ ! -d "deps/curl-${CURL_VERSION}" ] ; then \
|
||||
echo "curl sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd deps; \
|
||||
wget ${CURL_URL_HTTP} || exit 1; \
|
||||
tar -xjf curl-${CURL_VERSION}.tar.bz2 || exit 1; \
|
||||
rm curl-${CURL_VERSION}.tar.bz2; \
|
||||
ln -s curl-${CURL_VERSION} curl; \
|
||||
fi
|
||||
|
||||
curl : $(CURL_LIB)
|
||||
|
||||
$(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${CURL_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -e ${CURL_LIB} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${CURL_TIMESTAMP} -nt ${CURL_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
mkdir -p ${CURL_DIR}; \
|
||||
echo "changed timestamp for curl detected building..."; \
|
||||
cd deps/curl-${CURL_VERSION}; \
|
||||
export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-curl; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--stl=libc++ \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CC=${CROSS_CC}; \
|
||||
export CXX=${CROSS_CXX}; \
|
||||
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
|
||||
export CPPFLAGS="$${CPPFLAGS} -I${OPENSSL_DIR}/include ${TARGET_CFLAGS_ADDON}"; \
|
||||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export LDFLAGS="$${LDFLAGS} -L${OPENSSL_DIR} ${TARGET_LDFLAGS_ADDON}"; \
|
||||
./configure --host=${TARGET_HOST} --disable-shared --enable-static --with-ssl; \
|
||||
$(MAKE) -s || exit 1; \
|
||||
touch ${CURL_TIMESTAMP}; \
|
||||
touch ${CURL_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for curl"; \
|
||||
fi
|
||||
|
||||
clean_curl :
|
||||
./gradlew cleanCURL
|
||||
|
||||
sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c
|
||||
|
||||
deps/${SQLITE3_FOLDER}/sqlite3.c :
|
||||
cd deps; \
|
||||
wget ${SQLITE3_URL}; \
|
||||
unzip ${SQLITE3_FOLDER}.zip; \
|
||||
ln -s ${SQLITE3_FOLDER} sqlite; \
|
||||
cd ${SQLITE3_FOLDER};
|
||||
|
||||
clean_sqlite3:
|
||||
./gradlew cleanSQLite3
|
||||
|
||||
$(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB)
|
||||
@mkdir -p ${ANDR_ROOT}/deps; \
|
||||
for DIRNAME in {builtin,client,doc,fonts,games,mods,po,textures}; do \
|
||||
LAST_MODIF=$$(find ${PROJ_ROOT}/${DIRNAME} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ]; then \
|
||||
touch ${PROJ_ROOT}/${DIRNAME}/timestamp; \
|
||||
touch ${ASSETS_TIMESTAMP}; \
|
||||
echo ${DIRNAME} changed $$LAST_MODIF; \
|
||||
fi; \
|
||||
done; \
|
||||
LAST_MODIF=$$(find ${IRRLICHT_DIR}/media -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${IRRLICHT_DIR}/media/timestamp; \
|
||||
touch ${ASSETS_TIMESTAMP}; \
|
||||
fi; \
|
||||
if [ ${PROJ_ROOT}/minetest.conf.example -nt ${ASSETS_TIMESTAMP} ] ; then \
|
||||
echo "conf changed"; \
|
||||
touch ${ASSETS_TIMESTAMP}; \
|
||||
fi; \
|
||||
if [ ${PROJ_ROOT}/README.txt -nt ${ASSETS_TIMESTAMP} ] ; then \
|
||||
touch ${ASSETS_TIMESTAMP}; \
|
||||
fi; \
|
||||
if [ ! -e $(ASSETS_TIMESTAMP) ] ; then \
|
||||
touch $(ASSETS_TIMESTAMP); \
|
||||
fi
|
||||
|
||||
assets : $(ASSETS_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${ASSETS_TIMESTAMP}.old ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${ASSETS_TIMESTAMP} -nt ${ASSETS_TIMESTAMP}.old ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -d ${APP_ROOT}/assets ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
echo "assets changed, refreshing..."; \
|
||||
$(MAKE) clean_assets; \
|
||||
./gradlew copyAssets; \
|
||||
cp -r ${IRRLICHT_DIR}/media/Shaders ${APP_ROOT}/assets/Minetest/media; \
|
||||
cd ${APP_ROOT}/assets || exit 1; \
|
||||
find . -name "timestamp" -exec rm {} \; ; \
|
||||
find . -name "*.blend" -exec rm {} \; ; \
|
||||
find . -name "*~" -exec rm {} \; ; \
|
||||
find . -type d -path "*.git" -exec rm -rf {} \; ; \
|
||||
find . -type d -path "*.svn" -exec rm -rf {} \; ; \
|
||||
find . -type f -path "*.gitignore" -exec rm -rf {} \; ; \
|
||||
ls -R | grep ":$$" | sed -e 's/:$$//' -e 's/\.//' -e 's/^\///' > "index.txt"; \
|
||||
find -L Minetest > filelist.txt; \
|
||||
cp ${ANDR_ROOT}/${ASSETS_TIMESTAMP} ${ANDR_ROOT}/${ASSETS_TIMESTAMP}.old; \
|
||||
else \
|
||||
echo "nothing to be done for assets"; \
|
||||
fi
|
||||
|
||||
clean_assets :
|
||||
./gradlew cleanAssets
|
||||
|
||||
apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \
|
||||
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \
|
||||
$(ANDR_ROOT)/jni/src/android_version_githash.h sqlite3_download
|
||||
+ @export TARGET_LIBDIR=${TARGET_LIBDIR}; \
|
||||
export HAVE_LEVELDB=${HAVE_LEVELDB}; \
|
||||
export APP_PLATFORM=${APP_PLATFORM}; \
|
||||
export TARGET_ABI=${TARGET_ABI}; \
|
||||
export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \
|
||||
export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \
|
||||
export COMPILER_VERSION=${COMPILER_VERSION}; \
|
||||
export GPROF=${GPROF}; \
|
||||
${ANDROID_NDK}/ndk-build || exit 1; \
|
||||
if [ ! -e ${APP_ROOT}/jniLibs ]; then \
|
||||
ln -s ${ANDR_ROOT}/libs ${APP_ROOT}/jniLibs || exit 1; \
|
||||
fi; \
|
||||
export VERSION_STR="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" && \
|
||||
export BUILD_TYPE_C=$$(echo "$${BUILD_TYPE}" | sed 's/./\U&/') && \
|
||||
./gradlew assemble$$BUILD_TYPE_C && \
|
||||
echo "APK stored at: build/outputs/apk/$$BUILD_TYPE/Minetest-$$BUILD_TYPE.apk" && \
|
||||
echo "You can install it with \`make install_$$BUILD_TYPE\`"
|
||||
|
||||
# These Intentionally doesn't depend on their respective build steps,
|
||||
# because it takes a while to verify that everything's up-to-date.
|
||||
install_debug:
|
||||
${ANDROID_SDK}/platform-tools/adb install -r build/outputs/apk/debug/Minetest-debug.apk
|
||||
|
||||
install_release:
|
||||
${ANDROID_SDK}/platform-tools/adb install -r build/outputs/apk/release/Minetest-release.apk
|
||||
|
||||
prep_srcdir :
|
||||
@if [ ! -e ${ANDR_ROOT}/jni/src ]; then \
|
||||
ln -s ${PROJ_ROOT}/src ${ANDR_ROOT}/jni/src; \
|
||||
fi; \
|
||||
if [ ! -e ${ANDR_ROOT}/jni/lib ]; then \
|
||||
ln -s ${PROJ_ROOT}/lib ${ANDR_ROOT}/jni/lib; \
|
||||
fi
|
||||
|
||||
clean_apk :
|
||||
./gradlew clean
|
||||
|
||||
clean_all :
|
||||
./gradlew cleanAll
|
||||
|
||||
$(ANDR_ROOT)/jni/src/android_version_githash.h : prep_srcdir
|
||||
@export VERSION_FILE=${ANDR_ROOT}/jni/src/android_version_githash.h; \
|
||||
export VERSION_FILE_NEW=$${VERSION_FILE}.new; \
|
||||
{ \
|
||||
echo "#ifndef ANDROID_MT_VERSION_GITHASH_H"; \
|
||||
echo "#define ANDROID_MT_VERSION_GITHASH_H"; \
|
||||
export GITHASH=$$(git rev-parse --short=8 HEAD); \
|
||||
export VERSION_STR="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"; \
|
||||
echo "#define VERSION_GITHASH \"$$VERSION_STR-$$GITHASH-Android\""; \
|
||||
echo "#endif"; \
|
||||
} > "$${VERSION_FILE_NEW}"; \
|
||||
if ! cmp -s $${VERSION_FILE} $${VERSION_FILE_NEW}; then \
|
||||
echo "android_version_githash.h changed, updating..."; \
|
||||
mv "$${VERSION_FILE_NEW}" "$${VERSION_FILE}"; \
|
||||
else \
|
||||
rm "$${VERSION_FILE_NEW}"; \
|
||||
fi
|
||||
|
||||
|
||||
$(ANDR_ROOT)/jni/src/android_version.h : prep_srcdir
|
||||
@export VERSION_FILE=${ANDR_ROOT}/jni/src/android_version.h; \
|
||||
export VERSION_FILE_NEW=$${VERSION_FILE}.new; \
|
||||
{ \
|
||||
echo "#ifndef ANDROID_MT_VERSION_H"; \
|
||||
echo "#define ANDROID_MT_VERSION_H"; \
|
||||
echo "#define VERSION_MAJOR ${VERSION_MAJOR}"; \
|
||||
echo "#define VERSION_MINOR ${VERSION_MINOR}"; \
|
||||
echo "#define VERSION_PATCH ${VERSION_PATCH}"; \
|
||||
echo "#define VERSION_STRING STR(VERSION_MAJOR) \".\" STR(VERSION_MINOR) \
|
||||
\".\" STR(VERSION_PATCH)"; \
|
||||
echo "#endif"; \
|
||||
} > $${VERSION_FILE_NEW}; \
|
||||
if ! cmp -s $${VERSION_FILE} $${VERSION_FILE_NEW}; then \
|
||||
echo "android_version.h changed, updating..."; \
|
||||
mv "$${VERSION_FILE_NEW}" "$${VERSION_FILE}"; \
|
||||
else \
|
||||
rm "$${VERSION_FILE_NEW}"; \
|
||||
fi
|
||||
|
||||
clean : clean_apk clean_assets
|
||||
113
build/android/app/build.gradle
Normal file
113
build/android/app/build.gradle
Normal file
@@ -0,0 +1,113 @@
|
||||
apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '30.0.3'
|
||||
ndkVersion '22.0.7026061'
|
||||
defaultConfig {
|
||||
applicationId 'net.minetest.minetest'
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
versionCode project.versionCode
|
||||
}
|
||||
|
||||
// load properties
|
||||
Properties props = new Properties()
|
||||
def propfile = file('../local.properties')
|
||||
if (propfile.exists())
|
||||
props.load(new FileInputStream(propfile))
|
||||
|
||||
if (props.getProperty('keystore') != null) {
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(props['keystore'])
|
||||
storePassword props['keystore.password']
|
||||
keyAlias props['key']
|
||||
keyPassword props['key.password']
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for multiple APKs
|
||||
splits {
|
||||
abi {
|
||||
enable true
|
||||
reset()
|
||||
include 'armeabi-v7a', 'arm64-v8a'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
task prepareAssets() {
|
||||
def assetsFolder = "build/assets"
|
||||
def projRoot = "../../.."
|
||||
def gameToCopy = "minetest_game"
|
||||
|
||||
copy {
|
||||
from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into assetsFolder
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/doc/lgpl-2.1.txt" into "${assetsFolder}"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/builtin" into "${assetsFolder}/builtin"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
|
||||
}
|
||||
copy {
|
||||
from "../native/deps/Android/Irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
|
||||
}
|
||||
/*copy {
|
||||
// ToDo: fix broken locales
|
||||
from "${projRoot}/po" into "${assetsFolder}/po"
|
||||
}*/
|
||||
copy {
|
||||
from "${projRoot}/textures" into "${assetsFolder}/textures"
|
||||
}
|
||||
|
||||
file("${assetsFolder}/.nomedia").text = "";
|
||||
|
||||
task zipAssets(type: Zip) {
|
||||
archiveName "Minetest.zip"
|
||||
from "${assetsFolder}"
|
||||
destinationDir file("src/main/assets")
|
||||
}
|
||||
}
|
||||
|
||||
preBuild.dependsOn zipAssets
|
||||
|
||||
// Map for the version code that gives each ABI a value.
|
||||
import com.android.build.OutputFile
|
||||
|
||||
def abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1]
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.each {
|
||||
output ->
|
||||
def abiName = output.getFilter(OutputFile.ABI)
|
||||
output.versionCodeOverride = abiCodes.get(abiName, 0) + variant.versionCode
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':native')
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
}
|
||||
@@ -1,30 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="net.minetest.minetest"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00010000"
|
||||
android:required="true" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!--
|
||||
`android:requestLegacyExternalStorage="true"` is workaround for using `/sdcard`
|
||||
instead of the `getFilesDir()` patch for assets. Check link below for more information:
|
||||
https://developer.android.com/training/data-storage/compatibility
|
||||
-->
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="${project}"
|
||||
android:resizeableActivity="false">
|
||||
android:label="@string/label"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:resizeableActivity="false"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="2.1" />
|
||||
android:value="3.0" />
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
|
||||
android:label="${project}"
|
||||
android:launchMode="singleTask"
|
||||
android:maxAspectRatio="3.0"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
@@ -32,11 +36,13 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".MtNativeActivity"
|
||||
android:name=".GameActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation|screenSize|smallestScreenSize"
|
||||
android:hardwareAccelerated="true"
|
||||
android:launchMode="singleTask"
|
||||
android:maxAspectRatio="3.0"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
@@ -44,16 +50,13 @@
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="minetest" />
|
||||
android:value="Minetest" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MinetestTextEntry"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:theme="@style/Theme.Dialog"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"/>
|
||||
<activity
|
||||
android:name=".MinetestAssetCopy"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/AppTheme"/>
|
||||
|
||||
<service
|
||||
android:name=".UnzipService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2014-2020 MoNTE48, Maksim Gamarnik <MoNTE48@mail.ua>
|
||||
Copyright (C) 2014-2020 ubulem, Bektur Mambetov <berkut87@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class CopyZipTask extends AsyncTask<String, Void, String> {
|
||||
|
||||
private final WeakReference<AppCompatActivity> activityRef;
|
||||
|
||||
CopyZipTask(AppCompatActivity activity) {
|
||||
activityRef = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
protected String doInBackground(String... params) {
|
||||
copyAsset(params[0]);
|
||||
return params[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
startUnzipService(result);
|
||||
}
|
||||
|
||||
private void copyAsset(String zipName) {
|
||||
String filename = zipName.substring(zipName.lastIndexOf("/") + 1);
|
||||
try (InputStream in = activityRef.get().getAssets().open(filename);
|
||||
OutputStream out = new FileOutputStream(zipName)) {
|
||||
copyFile(in, out);
|
||||
} catch (IOException e) {
|
||||
AppCompatActivity activity = activityRef.get();
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> Toast.makeText(activityRef.get(), e.getLocalizedMessage(), Toast.LENGTH_LONG).show());
|
||||
}
|
||||
cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyFile(InputStream in, OutputStream out) throws IOException {
|
||||
byte[] buffer = new byte[1024];
|
||||
int read;
|
||||
while ((read = in.read(buffer)) != -1)
|
||||
out.write(buffer, 0, read);
|
||||
}
|
||||
|
||||
private void startUnzipService(String file) {
|
||||
Intent intent = new Intent(activityRef.get(), UnzipService.class);
|
||||
intent.putExtra(UnzipService.EXTRA_KEY_IN_FILE, file);
|
||||
AppCompatActivity activity = activityRef.get();
|
||||
if (activity != null) {
|
||||
activity.startService(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2014-2020 MoNTE48, Maksim Gamarnik <MoNTE48@mail.ua>
|
||||
Copyright (C) 2014-2020 ubulem, Bektur Mambetov <berkut87@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatEditText;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CustomEditText extends AppCompatEditText {
|
||||
public CustomEditText(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
InputMethodManager mgr = (InputMethodManager)
|
||||
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
Objects.requireNonNull(mgr).hideSoftInputFromWindow(this.getWindowToken(), 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2014-2020 MoNTE48, Maksim Gamarnik <MoNTE48@mail.ua>
|
||||
Copyright (C) 2014-2020 ubulem, Bektur Mambetov <berkut87@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class GameActivity extends NativeActivity {
|
||||
static {
|
||||
System.loadLibrary("c++_shared");
|
||||
System.loadLibrary("Minetest");
|
||||
}
|
||||
|
||||
private int messageReturnCode = -1;
|
||||
private String messageReturnValue = "";
|
||||
|
||||
public static native void putMessageBoxResult(String text);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
private void makeFullScreen() {
|
||||
if (Build.VERSION.SDK_INT >= 19)
|
||||
this.getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus)
|
||||
makeFullScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
makeFullScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// Ignore the back press so Minetest can handle it
|
||||
}
|
||||
|
||||
public void showDialog(String acceptButton, String hint, String current, int editType) {
|
||||
runOnUiThread(() -> showDialogUI(hint, current, editType));
|
||||
}
|
||||
|
||||
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);
|
||||
AlertDialog alertDialog = builder.create();
|
||||
editText.requestFocus();
|
||||
editText.setHint(hint);
|
||||
editText.setText(current);
|
||||
final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.SHOW_FORCED,
|
||||
InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||
if (editType == 1)
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_FLAG_MULTI_LINE);
|
||||
else if (editType == 3)
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
else
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
editText.setSelection(editText.getText().length());
|
||||
editText.setOnKeyListener((view, KeyCode, event) -> {
|
||||
if (KeyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
messageReturnCode = 0;
|
||||
messageReturnValue = editText.getText().toString();
|
||||
alertDialog.dismiss();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
alertDialog.show();
|
||||
alertDialog.setOnCancelListener(dialog -> {
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
messageReturnValue = current;
|
||||
messageReturnCode = -1;
|
||||
});
|
||||
}
|
||||
|
||||
public int getDialogState() {
|
||||
return messageReturnCode;
|
||||
}
|
||||
|
||||
public String getDialogValue() {
|
||||
messageReturnCode = -1;
|
||||
return messageReturnValue;
|
||||
}
|
||||
|
||||
public float getDensity() {
|
||||
return getResources().getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
public int getDisplayHeight() {
|
||||
return getResources().getDisplayMetrics().heightPixels;
|
||||
}
|
||||
|
||||
public int getDisplayWidth() {
|
||||
return getResources().getDisplayMetrics().widthPixels;
|
||||
}
|
||||
|
||||
public void openURI(String uri) {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2014-2020 MoNTE48, Maksim Gamarnik <MoNTE48@mail.ua>
|
||||
Copyright (C) 2014-2020 ubulem, Bektur Mambetov <berkut87@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static net.minetest.minetest.UnzipService.ACTION_FAILURE;
|
||||
import static net.minetest.minetest.UnzipService.ACTION_PROGRESS;
|
||||
import static net.minetest.minetest.UnzipService.ACTION_UPDATE;
|
||||
import static net.minetest.minetest.UnzipService.FAILURE;
|
||||
import static net.minetest.minetest.UnzipService.SUCCESS;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private final static int versionCode = BuildConfig.VERSION_CODE;
|
||||
private final static int PERMISSIONS = 1;
|
||||
private static final String[] REQUIRED_SDK_PERMISSIONS =
|
||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
||||
private static final String SETTINGS = "MinetestSettings";
|
||||
private static final String TAG_VERSION_CODE = "versionCode";
|
||||
private ProgressBar mProgressBar;
|
||||
private TextView mTextView;
|
||||
private SharedPreferences sharedPreferences;
|
||||
private final BroadcastReceiver myReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
int progress = 0;
|
||||
if (intent != null)
|
||||
progress = intent.getIntExtra(ACTION_PROGRESS, 0);
|
||||
if (progress >= 0) {
|
||||
if (mProgressBar != null) {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
mProgressBar.setProgress(progress);
|
||||
}
|
||||
mTextView.setVisibility(View.VISIBLE);
|
||||
} else if (progress == FAILURE) {
|
||||
Toast.makeText(MainActivity.this, intent.getStringExtra(ACTION_FAILURE), Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
} else if (progress == SUCCESS)
|
||||
startNative();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
IntentFilter filter = new IntentFilter(ACTION_UPDATE);
|
||||
registerReceiver(myReceiver, filter);
|
||||
mProgressBar = findViewById(R.id.progressBar);
|
||||
mTextView = findViewById(R.id.textView);
|
||||
sharedPreferences = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
checkPermission();
|
||||
else
|
||||
checkAppVersion();
|
||||
}
|
||||
|
||||
private void checkPermission() {
|
||||
final List<String> missingPermissions = new ArrayList<>();
|
||||
for (final String permission : REQUIRED_SDK_PERMISSIONS) {
|
||||
final int result = ContextCompat.checkSelfPermission(this, permission);
|
||||
if (result != PackageManager.PERMISSION_GRANTED)
|
||||
missingPermissions.add(permission);
|
||||
}
|
||||
if (!missingPermissions.isEmpty()) {
|
||||
final String[] permissions = missingPermissions
|
||||
.toArray(new String[0]);
|
||||
ActivityCompat.requestPermissions(this, permissions, PERMISSIONS);
|
||||
} else {
|
||||
final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length];
|
||||
Arrays.fill(grantResults, PackageManager.PERMISSION_GRANTED);
|
||||
onRequestPermissionsResult(PERMISSIONS, REQUIRED_SDK_PERMISSIONS, grantResults);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
@NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
if (requestCode == PERMISSIONS) {
|
||||
for (int grantResult : grantResults) {
|
||||
if (grantResult != PackageManager.PERMISSION_GRANTED) {
|
||||
Toast.makeText(this, R.string.not_granted, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
checkAppVersion();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAppVersion() {
|
||||
if (sharedPreferences.getInt(TAG_VERSION_CODE, 0) == versionCode)
|
||||
startNative();
|
||||
else
|
||||
new CopyZipTask(this).execute(getCacheDir() + "/Minetest.zip");
|
||||
}
|
||||
|
||||
private void startNative() {
|
||||
sharedPreferences.edit().putInt(TAG_VERSION_CODE, versionCode).apply();
|
||||
Intent intent = new Intent(this, GameActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// Prevent abrupt interruption when copy game files from assets
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
unregisterReceiver(myReceiver);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
Minetest
|
||||
Copyright (C) 2014-2020 MoNTE48, Maksim Gamarnik <MoNTE48@mail.ua>
|
||||
Copyright (C) 2014-2020 ubulem, Bektur Mambetov <berkut87@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
public class UnzipService extends IntentService {
|
||||
public static final String ACTION_UPDATE = "net.minetest.minetest.UPDATE";
|
||||
public static final String ACTION_PROGRESS = "net.minetest.minetest.PROGRESS";
|
||||
public static final String ACTION_FAILURE = "net.minetest.minetest.FAILURE";
|
||||
public static final String EXTRA_KEY_IN_FILE = "file";
|
||||
public static final int SUCCESS = -1;
|
||||
public static final int FAILURE = -2;
|
||||
private final int id = 1;
|
||||
private NotificationManager mNotifyManager;
|
||||
private boolean isSuccess = true;
|
||||
private String failureMessage;
|
||||
|
||||
public UnzipService() {
|
||||
super("net.minetest.minetest.UnzipService");
|
||||
}
|
||||
|
||||
private void isDir(String dir, String location) {
|
||||
File f = new File(location, dir);
|
||||
if (!f.isDirectory())
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
createNotification();
|
||||
unzip(intent);
|
||||
}
|
||||
|
||||
private void createNotification() {
|
||||
String name = "net.minetest.minetest";
|
||||
String channelId = "Minetest channel";
|
||||
String description = "notifications from Minetest";
|
||||
Notification.Builder builder;
|
||||
if (mNotifyManager == null)
|
||||
mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
int importance = NotificationManager.IMPORTANCE_LOW;
|
||||
NotificationChannel mChannel = null;
|
||||
if (mNotifyManager != null)
|
||||
mChannel = mNotifyManager.getNotificationChannel(channelId);
|
||||
if (mChannel == null) {
|
||||
mChannel = new NotificationChannel(channelId, name, importance);
|
||||
mChannel.setDescription(description);
|
||||
// Configure the notification channel, NO SOUND
|
||||
mChannel.setSound(null, null);
|
||||
mChannel.enableLights(false);
|
||||
mChannel.enableVibration(false);
|
||||
mNotifyManager.createNotificationChannel(mChannel);
|
||||
}
|
||||
builder = new Notification.Builder(this, channelId);
|
||||
} else {
|
||||
builder = new Notification.Builder(this);
|
||||
}
|
||||
builder.setContentTitle(getString(R.string.notification_title))
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentText(getString(R.string.notification_description));
|
||||
mNotifyManager.notify(id, builder.build());
|
||||
}
|
||||
|
||||
private void unzip(Intent intent) {
|
||||
String zip = intent.getStringExtra(EXTRA_KEY_IN_FILE);
|
||||
isDir("Minetest", Environment.getExternalStorageDirectory().toString());
|
||||
String location = Environment.getExternalStorageDirectory() + File.separator + "Minetest" + File.separator;
|
||||
int per = 0;
|
||||
int size = getSummarySize(zip);
|
||||
File zipFile = new File(zip);
|
||||
int readLen;
|
||||
byte[] readBuffer = new byte[8192];
|
||||
try (FileInputStream fileInputStream = new FileInputStream(zipFile);
|
||||
ZipInputStream zipInputStream = new ZipInputStream(fileInputStream)) {
|
||||
ZipEntry ze;
|
||||
while ((ze = zipInputStream.getNextEntry()) != null) {
|
||||
if (ze.isDirectory()) {
|
||||
++per;
|
||||
isDir(ze.getName(), location);
|
||||
} else {
|
||||
publishProgress(100 * ++per / size);
|
||||
try (OutputStream outputStream = new FileOutputStream(location + ze.getName())) {
|
||||
while ((readLen = zipInputStream.read(readBuffer)) != -1) {
|
||||
outputStream.write(readBuffer, 0, readLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
zipFile.delete();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
isSuccess = false;
|
||||
failureMessage = e.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
|
||||
private void publishProgress(int progress) {
|
||||
Intent intentUpdate = new Intent(ACTION_UPDATE);
|
||||
intentUpdate.putExtra(ACTION_PROGRESS, progress);
|
||||
if (!isSuccess) intentUpdate.putExtra(ACTION_FAILURE, failureMessage);
|
||||
sendBroadcast(intentUpdate);
|
||||
}
|
||||
|
||||
private int getSummarySize(String zip) {
|
||||
int size = 0;
|
||||
try {
|
||||
ZipFile zipSize = new ZipFile(zip);
|
||||
size += zipSize.size();
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mNotifyManager.cancel(id);
|
||||
publishProgress(isSuccess ? SUCCESS : FAILURE);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 83 B After Width: | Height: | Size: 83 B |
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/background"
|
||||
android:tileMode="repeat" />
|
||||
android:tileMode="repeat" />
|
||||
30
build/android/app/src/main/res/layout/activity_main.xml
Normal file
30
build/android/app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="@style/CustomProgressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginLeft="90dp"
|
||||
android:layout_marginRight="90dp"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/progressBar"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/loading"
|
||||
android:textColor="#FEFEFE"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
10
build/android/app/src/main/res/values/strings.xml
Normal file
10
build/android/app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="label">Minetest</string>
|
||||
<string name="loading">Loading…</string>
|
||||
<string name="not_granted">Required permission wasn\'t granted, Minetest can\'t run without it</string>
|
||||
<string name="notification_title">Loading Minetest</string>
|
||||
<string name="notification_description">Less than 1 minute…</string>
|
||||
|
||||
</resources>
|
||||
15
build/android/app/src/main/res/values/styles.xml
Normal file
15
build/android/app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowBackground">@drawable/bg</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
|
||||
<item name="android:indeterminateOnly">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,170 +1,35 @@
|
||||
// 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", 0) // Version Patch
|
||||
project.ext.set("versionExtra", "") // Version Extra
|
||||
project.ext.set("versionCode", 32) // Android Version Code
|
||||
// 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 {
|
||||
repositories {
|
||||
maven { url 'https://maven.google.com' }
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url 'https://maven.google.com' }
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
def curl_version = "7.60.0"
|
||||
def irrlicht_revision = "5150"
|
||||
def openal_version = "1.18.2"
|
||||
def openssl_version = "1.0.2n"
|
||||
def sqlite3_version = "3240000"
|
||||
|
||||
apply plugin: "com.android.application"
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
|
||||
defaultConfig {
|
||||
versionCode 24
|
||||
versionName "${System.env.VERSION_STR}.${versionCode}"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
applicationId "net.minetest.minetest"
|
||||
manifestPlaceholders = [package: "net.minetest.minetest", project: project.name]
|
||||
ndk {
|
||||
// Specifies the ABI configurations of your native
|
||||
// libraries Gradle should build and package with your APK.
|
||||
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
abiFilters 'armeabi-v7a', 'x86'
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable "OldTargetApi", "GoogleAppIndexingWarning"
|
||||
}
|
||||
|
||||
Properties props = new Properties()
|
||||
props.load(new FileInputStream(file("local.properties")))
|
||||
|
||||
if (props.getProperty("keystore") != null) {
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(props["keystore"])
|
||||
storePassword props["keystore.password"]
|
||||
keyAlias props["key"]
|
||||
keyPassword props["key.password"]
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task cleanAssets(type: Delete) {
|
||||
delete 'src/main/assets'
|
||||
}
|
||||
|
||||
task copyAssets {
|
||||
dependsOn 'cleanAssets'
|
||||
mkdir "src/main/assets"
|
||||
|
||||
def mtAssetsFolder = "src/main/assets/Minetest"
|
||||
def projRoot = "../.."
|
||||
def gameToCopy = "minetest_game"
|
||||
|
||||
doLast {
|
||||
mkdir "${mtAssetsFolder}"
|
||||
mkdir "${mtAssetsFolder}/client"
|
||||
mkdir "${mtAssetsFolder}/fonts"
|
||||
mkdir "${mtAssetsFolder}/games"
|
||||
mkdir "${mtAssetsFolder}/media"
|
||||
|
||||
copy {
|
||||
from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into mtAssetsFolder
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/doc/lgpl-2.1.txt" into "${mtAssetsFolder}/LICENSE.txt"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/builtin" into "${mtAssetsFolder}/builtin"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/client/shaders" into "${mtAssetsFolder}/client/shaders"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/fonts" include "*.ttf" into "${mtAssetsFolder}/fonts"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/games/${gameToCopy}" into "${mtAssetsFolder}/games/${gameToCopy}"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/po" into "${mtAssetsFolder}/po"
|
||||
}
|
||||
copy {
|
||||
from "${projRoot}/textures" into "${mtAssetsFolder}/textures"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task cleanIconv(type: Delete) {
|
||||
delete 'deps/libiconv'
|
||||
}
|
||||
|
||||
task cleanIrrlicht(type: Delete) {
|
||||
delete 'deps/irrlicht'
|
||||
}
|
||||
|
||||
task cleanLevelDB(type: Delete) {
|
||||
delete 'deps/leveldb'
|
||||
}
|
||||
|
||||
task cleanCURL(type: Delete) {
|
||||
delete 'deps/curl'
|
||||
delete 'deps/curl-' + curl_version
|
||||
}
|
||||
|
||||
task cleanOpenSSL(type: Delete) {
|
||||
delete 'deps/openssl'
|
||||
delete 'deps/openssl-' + openssl_version
|
||||
delete 'deps/openssl-' + openssl_version + '.tar.gz'
|
||||
}
|
||||
|
||||
task cleanOpenAL(type: Delete) {
|
||||
delete 'deps/openal-soft'
|
||||
}
|
||||
|
||||
task cleanFreetype(type: Delete) {
|
||||
delete 'deps/freetype2-android'
|
||||
}
|
||||
|
||||
task cleanOgg(type: Delete) {
|
||||
delete 'deps/libvorbis-libogg-android'
|
||||
}
|
||||
|
||||
task cleanSQLite3(type: Delete) {
|
||||
delete 'deps/sqlite-amalgamation-' + sqlite3_version
|
||||
delete 'deps/sqlite-amalgamation-' + sqlite3_version + '.zip'
|
||||
}
|
||||
|
||||
task cleanAll(type: Delete, dependsOn: [clean, cleanAssets, cleanIconv,
|
||||
cleanFreetype, cleanIrrlicht, cleanLevelDB, cleanSQLite3, cleanCURL,
|
||||
cleanOpenSSL, cleanOpenAL, cleanOgg]) {
|
||||
delete 'deps'
|
||||
delete 'gen'
|
||||
delete 'libs'
|
||||
delete 'obj'
|
||||
delete 'bin'
|
||||
delete 'Debug'
|
||||
delete 'and_env'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.android.support:support-v4:28.0.0'
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
delete 'native/deps'
|
||||
}
|
||||
|
||||
11
build/android/gradle.properties
Normal file
11
build/android/gradle.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
<#if isLowMemory>
|
||||
org.gradle.jvmargs=-Xmx4G -XX:MaxPermSize=2G -XX:+HeapDumpOnOutOfMemoryError
|
||||
<#else>
|
||||
org.gradle.jvmargs=-Xmx16G -XX:MaxPermSize=8G -XX:+HeapDumpOnOutOfMemoryError
|
||||
</#if>
|
||||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.parallel.threads=8
|
||||
org.gradle.configureondemand=true
|
||||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
BIN
build/android/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
build/android/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
#Mon Oct 15 00:47:03 CEST 2018
|
||||
#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-4.10.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip
|
||||
|
||||
22
build/android/gradlew
vendored
22
build/android/gradlew
vendored
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
@@ -109,8 +125,8 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
18
build/android/gradlew.bat
vendored
18
build/android/gradlew.bat
vendored
@@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
@@ -1,434 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)/..
|
||||
|
||||
#LOCAL_ADDRESS_SANITIZER:=true
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Irrlicht
|
||||
LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
ifeq ($(HAVE_LEVELDB), 1)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := LevelDB
|
||||
LOCAL_SRC_FILES := deps/leveldb/libleveldb.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := curl
|
||||
LOCAL_SRC_FILES := deps/curl/lib/.libs/libcurl.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := freetype
|
||||
LOCAL_SRC_FILES := deps/freetype2-android/Android/obj/local/$(TARGET_ARCH_ABI)/libfreetype2-static.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := iconv
|
||||
LOCAL_SRC_FILES := deps/libiconv/lib/.libs/libiconv.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := openal
|
||||
LOCAL_SRC_FILES := deps/openal-soft/libs/$(TARGET_LIBDIR)/libopenal.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := ogg
|
||||
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libogg.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := vorbis
|
||||
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := ssl
|
||||
LOCAL_SRC_FILES := deps/openssl/libssl.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := crypto
|
||||
LOCAL_SRC_FILES := deps/openssl/libcrypto.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := minetest
|
||||
|
||||
LOCAL_CPP_FEATURES += exceptions
|
||||
|
||||
ifdef GPROF
|
||||
GPROF_DEF=-DGPROF
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \
|
||||
-DHAVE_TOUCHSCREENGUI \
|
||||
-DUSE_CURL=1 \
|
||||
-DUSE_SOUND=1 \
|
||||
-DUSE_FREETYPE=1 \
|
||||
-DUSE_LEVELDB=$(HAVE_LEVELDB) \
|
||||
$(GPROF_DEF) \
|
||||
-pipe -fstrict-aliasing
|
||||
|
||||
ifndef NDEBUG
|
||||
LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer
|
||||
else
|
||||
LOCAL_CFLAGS += $(TARGET_CFLAGS_ADDON)
|
||||
endif
|
||||
|
||||
ifdef GPROF
|
||||
PROFILER_LIBS := android-ndk-profiler
|
||||
LOCAL_CFLAGS += -pg
|
||||
endif
|
||||
|
||||
# LOCAL_CFLAGS += -fsanitize=address
|
||||
# LOCAL_LDFLAGS += -fsanitize=address
|
||||
|
||||
ifeq ($(TARGET_ABI),x86)
|
||||
LOCAL_CFLAGS += -fno-stack-protector
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
jni/src \
|
||||
jni/src/script \
|
||||
jni/lib/gmp \
|
||||
jni/lib/lua/src \
|
||||
jni/lib/jsoncpp \
|
||||
jni/src/cguittfont \
|
||||
deps/irrlicht/include \
|
||||
deps/libiconv/include \
|
||||
deps/freetype2-android/include \
|
||||
deps/curl/include \
|
||||
deps/openal-soft/jni/OpenAL/include \
|
||||
deps/libvorbis-libogg-android/jni/include \
|
||||
deps/leveldb/include \
|
||||
deps/sqlite/
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
jni/src/ban.cpp \
|
||||
jni/src/chat.cpp \
|
||||
jni/src/client/activeobjectmgr.cpp \
|
||||
jni/src/client/camera.cpp \
|
||||
jni/src/client/client.cpp \
|
||||
jni/src/client/clientenvironment.cpp \
|
||||
jni/src/client/clientlauncher.cpp \
|
||||
jni/src/client/clientmap.cpp \
|
||||
jni/src/client/clientmedia.cpp \
|
||||
jni/src/client/clientobject.cpp \
|
||||
jni/src/client/clouds.cpp \
|
||||
jni/src/client/content_cao.cpp \
|
||||
jni/src/client/content_cso.cpp \
|
||||
jni/src/client/content_mapblock.cpp \
|
||||
jni/src/client/filecache.cpp \
|
||||
jni/src/client/fontengine.cpp \
|
||||
jni/src/client/game.cpp \
|
||||
jni/src/client/gameui.cpp \
|
||||
jni/src/client/guiscalingfilter.cpp \
|
||||
jni/src/client/hud.cpp \
|
||||
jni/src/clientiface.cpp \
|
||||
jni/src/client/imagefilters.cpp \
|
||||
jni/src/client/inputhandler.cpp \
|
||||
jni/src/client/joystick_controller.cpp \
|
||||
jni/src/client/keycode.cpp \
|
||||
jni/src/client/localplayer.cpp \
|
||||
jni/src/client/mapblock_mesh.cpp \
|
||||
jni/src/client/mesh.cpp \
|
||||
jni/src/client/meshgen/collector.cpp \
|
||||
jni/src/client/mesh_generator_thread.cpp \
|
||||
jni/src/client/minimap.cpp \
|
||||
jni/src/client/particles.cpp \
|
||||
jni/src/client/render/anaglyph.cpp \
|
||||
jni/src/client/render/core.cpp \
|
||||
jni/src/client/render/factory.cpp \
|
||||
jni/src/client/renderingengine.cpp \
|
||||
jni/src/client/render/interlaced.cpp \
|
||||
jni/src/client/render/pageflip.cpp \
|
||||
jni/src/client/render/plain.cpp \
|
||||
jni/src/client/render/sidebyside.cpp \
|
||||
jni/src/client/render/stereo.cpp \
|
||||
jni/src/client/shader.cpp \
|
||||
jni/src/client/sky.cpp \
|
||||
jni/src/client/sound.cpp \
|
||||
jni/src/client/sound_openal.cpp \
|
||||
jni/src/client/tile.cpp \
|
||||
jni/src/client/wieldmesh.cpp \
|
||||
jni/src/collision.cpp \
|
||||
jni/src/content/content.cpp \
|
||||
jni/src/content_mapnode.cpp \
|
||||
jni/src/content/mods.cpp \
|
||||
jni/src/content_nodemeta.cpp \
|
||||
jni/src/content/packages.cpp \
|
||||
jni/src/content_sao.cpp \
|
||||
jni/src/content/subgames.cpp \
|
||||
jni/src/convert_json.cpp \
|
||||
jni/src/craftdef.cpp \
|
||||
jni/src/database/database.cpp \
|
||||
jni/src/database/database-dummy.cpp \
|
||||
jni/src/database/database-files.cpp \
|
||||
jni/src/database/database-leveldb.cpp \
|
||||
jni/src/database/database-sqlite3.cpp \
|
||||
jni/src/debug.cpp \
|
||||
jni/src/defaultsettings.cpp \
|
||||
jni/src/emerge.cpp \
|
||||
jni/src/environment.cpp \
|
||||
jni/src/face_position_cache.cpp \
|
||||
jni/src/filesys.cpp \
|
||||
jni/src/genericobject.cpp \
|
||||
jni/src/gettext.cpp \
|
||||
jni/src/gui/guiChatConsole.cpp \
|
||||
jni/src/gui/guiConfirmRegistration.cpp \
|
||||
jni/src/gui/guiEditBoxWithScrollbar.cpp \
|
||||
jni/src/gui/guiEngine.cpp \
|
||||
jni/src/gui/guiFormSpecMenu.cpp \
|
||||
jni/src/gui/guiKeyChangeMenu.cpp \
|
||||
jni/src/gui/guiPasswordChange.cpp \
|
||||
jni/src/gui/guiPathSelectMenu.cpp \
|
||||
jni/src/gui/guiTable.cpp \
|
||||
jni/src/gui/guiVolumeChange.cpp \
|
||||
jni/src/gui/intlGUIEditBox.cpp \
|
||||
jni/src/gui/modalMenu.cpp \
|
||||
jni/src/gui/profilergraph.cpp \
|
||||
jni/src/gui/touchscreengui.cpp \
|
||||
jni/src/httpfetch.cpp \
|
||||
jni/src/hud.cpp \
|
||||
jni/src/inventory.cpp \
|
||||
jni/src/inventorymanager.cpp \
|
||||
jni/src/irrlicht_changes/CGUITTFont.cpp \
|
||||
jni/src/irrlicht_changes/static_text.cpp \
|
||||
jni/src/itemdef.cpp \
|
||||
jni/src/itemstackmetadata.cpp \
|
||||
jni/src/light.cpp \
|
||||
jni/src/log.cpp \
|
||||
jni/src/main.cpp \
|
||||
jni/src/mapblock.cpp \
|
||||
jni/src/map.cpp \
|
||||
jni/src/mapgen/cavegen.cpp \
|
||||
jni/src/mapgen/dungeongen.cpp \
|
||||
jni/src/mapgen/mapgen_carpathian.cpp \
|
||||
jni/src/mapgen/mapgen.cpp \
|
||||
jni/src/mapgen/mapgen_flat.cpp \
|
||||
jni/src/mapgen/mapgen_fractal.cpp \
|
||||
jni/src/mapgen/mapgen_singlenode.cpp \
|
||||
jni/src/mapgen/mapgen_v5.cpp \
|
||||
jni/src/mapgen/mapgen_v6.cpp \
|
||||
jni/src/mapgen/mapgen_v7.cpp \
|
||||
jni/src/mapgen/mapgen_valleys.cpp \
|
||||
jni/src/mapgen/mg_biome.cpp \
|
||||
jni/src/mapgen/mg_decoration.cpp \
|
||||
jni/src/mapgen/mg_ore.cpp \
|
||||
jni/src/mapgen/mg_schematic.cpp \
|
||||
jni/src/mapgen/treegen.cpp \
|
||||
jni/src/mapnode.cpp \
|
||||
jni/src/mapsector.cpp \
|
||||
jni/src/map_settings_manager.cpp \
|
||||
jni/src/metadata.cpp \
|
||||
jni/src/modchannels.cpp \
|
||||
jni/src/nameidmapping.cpp \
|
||||
jni/src/nodedef.cpp \
|
||||
jni/src/nodemetadata.cpp \
|
||||
jni/src/nodetimer.cpp \
|
||||
jni/src/noise.cpp \
|
||||
jni/src/objdef.cpp \
|
||||
jni/src/object_properties.cpp \
|
||||
jni/src/pathfinder.cpp \
|
||||
jni/src/player.cpp \
|
||||
jni/src/porting_android.cpp \
|
||||
jni/src/porting.cpp \
|
||||
jni/src/profiler.cpp \
|
||||
jni/src/quicktune.cpp \
|
||||
jni/src/raycast.cpp \
|
||||
jni/src/reflowscan.cpp \
|
||||
jni/src/remoteplayer.cpp \
|
||||
jni/src/rollback.cpp \
|
||||
jni/src/rollback_interface.cpp \
|
||||
jni/src/serialization.cpp \
|
||||
jni/src/server/activeobjectmgr.cpp \
|
||||
jni/src/server.cpp \
|
||||
jni/src/serverenvironment.cpp \
|
||||
jni/src/serverlist.cpp \
|
||||
jni/src/server/mods.cpp \
|
||||
jni/src/serverobject.cpp \
|
||||
jni/src/settings.cpp \
|
||||
jni/src/staticobject.cpp \
|
||||
jni/src/tileanimation.cpp \
|
||||
jni/src/tool.cpp \
|
||||
jni/src/translation.cpp \
|
||||
jni/src/unittest/test_authdatabase.cpp \
|
||||
jni/src/unittest/test_collision.cpp \
|
||||
jni/src/unittest/test_compression.cpp \
|
||||
jni/src/unittest/test_connection.cpp \
|
||||
jni/src/unittest/test.cpp \
|
||||
jni/src/unittest/test_filepath.cpp \
|
||||
jni/src/unittest/test_gameui.cpp \
|
||||
jni/src/unittest/test_inventory.cpp \
|
||||
jni/src/unittest/test_mapnode.cpp \
|
||||
jni/src/unittest/test_map_settings_manager.cpp \
|
||||
jni/src/unittest/test_nodedef.cpp \
|
||||
jni/src/unittest/test_noderesolver.cpp \
|
||||
jni/src/unittest/test_noise.cpp \
|
||||
jni/src/unittest/test_objdef.cpp \
|
||||
jni/src/unittest/test_profiler.cpp \
|
||||
jni/src/unittest/test_random.cpp \
|
||||
jni/src/unittest/test_schematic.cpp \
|
||||
jni/src/unittest/test_serialization.cpp \
|
||||
jni/src/unittest/test_settings.cpp \
|
||||
jni/src/unittest/test_socket.cpp \
|
||||
jni/src/unittest/test_utilities.cpp \
|
||||
jni/src/unittest/test_voxelalgorithms.cpp \
|
||||
jni/src/unittest/test_voxelmanipulator.cpp \
|
||||
jni/src/util/areastore.cpp \
|
||||
jni/src/util/auth.cpp \
|
||||
jni/src/util/base64.cpp \
|
||||
jni/src/util/directiontables.cpp \
|
||||
jni/src/util/enriched_string.cpp \
|
||||
jni/src/util/ieee_float.cpp \
|
||||
jni/src/util/numeric.cpp \
|
||||
jni/src/util/pointedthing.cpp \
|
||||
jni/src/util/serialize.cpp \
|
||||
jni/src/util/sha1.cpp \
|
||||
jni/src/util/srp.cpp \
|
||||
jni/src/util/string.cpp \
|
||||
jni/src/util/timetaker.cpp \
|
||||
jni/src/version.cpp \
|
||||
jni/src/voxelalgorithms.cpp \
|
||||
jni/src/voxel.cpp
|
||||
|
||||
|
||||
# intentionally kept out (we already build openssl itself): jni/src/util/sha256.c
|
||||
|
||||
# Network
|
||||
LOCAL_SRC_FILES += \
|
||||
jni/src/network/address.cpp \
|
||||
jni/src/network/connection.cpp \
|
||||
jni/src/network/networkpacket.cpp \
|
||||
jni/src/network/clientopcodes.cpp \
|
||||
jni/src/network/clientpackethandler.cpp \
|
||||
jni/src/network/connectionthreads.cpp \
|
||||
jni/src/network/serveropcodes.cpp \
|
||||
jni/src/network/serverpackethandler.cpp \
|
||||
jni/src/network/socket.cpp \
|
||||
|
||||
# lua api
|
||||
LOCAL_SRC_FILES += \
|
||||
jni/src/script/common/c_content.cpp \
|
||||
jni/src/script/common/c_converter.cpp \
|
||||
jni/src/script/common/c_internal.cpp \
|
||||
jni/src/script/common/c_types.cpp \
|
||||
jni/src/script/common/helper.cpp \
|
||||
jni/src/script/cpp_api/s_async.cpp \
|
||||
jni/src/script/cpp_api/s_base.cpp \
|
||||
jni/src/script/cpp_api/s_client.cpp \
|
||||
jni/src/script/cpp_api/s_entity.cpp \
|
||||
jni/src/script/cpp_api/s_env.cpp \
|
||||
jni/src/script/cpp_api/s_inventory.cpp \
|
||||
jni/src/script/cpp_api/s_item.cpp \
|
||||
jni/src/script/cpp_api/s_mainmenu.cpp \
|
||||
jni/src/script/cpp_api/s_modchannels.cpp \
|
||||
jni/src/script/cpp_api/s_node.cpp \
|
||||
jni/src/script/cpp_api/s_nodemeta.cpp \
|
||||
jni/src/script/cpp_api/s_player.cpp \
|
||||
jni/src/script/cpp_api/s_security.cpp \
|
||||
jni/src/script/cpp_api/s_server.cpp \
|
||||
jni/src/script/lua_api/l_areastore.cpp \
|
||||
jni/src/script/lua_api/l_auth.cpp \
|
||||
jni/src/script/lua_api/l_base.cpp \
|
||||
jni/src/script/lua_api/l_camera.cpp \
|
||||
jni/src/script/lua_api/l_client.cpp \
|
||||
jni/src/script/lua_api/l_craft.cpp \
|
||||
jni/src/script/lua_api/l_env.cpp \
|
||||
jni/src/script/lua_api/l_inventory.cpp \
|
||||
jni/src/script/lua_api/l_item.cpp \
|
||||
jni/src/script/lua_api/l_itemstackmeta.cpp\
|
||||
jni/src/script/lua_api/l_localplayer.cpp \
|
||||
jni/src/script/lua_api/l_mainmenu.cpp \
|
||||
jni/src/script/lua_api/l_mapgen.cpp \
|
||||
jni/src/script/lua_api/l_metadata.cpp \
|
||||
jni/src/script/lua_api/l_minimap.cpp \
|
||||
jni/src/script/lua_api/l_modchannels.cpp \
|
||||
jni/src/script/lua_api/l_nodemeta.cpp \
|
||||
jni/src/script/lua_api/l_nodetimer.cpp \
|
||||
jni/src/script/lua_api/l_noise.cpp \
|
||||
jni/src/script/lua_api/l_object.cpp \
|
||||
jni/src/script/lua_api/l_playermeta.cpp \
|
||||
jni/src/script/lua_api/l_particles.cpp \
|
||||
jni/src/script/lua_api/l_particles_local.cpp\
|
||||
jni/src/script/lua_api/l_rollback.cpp \
|
||||
jni/src/script/lua_api/l_server.cpp \
|
||||
jni/src/script/lua_api/l_settings.cpp \
|
||||
jni/src/script/lua_api/l_sound.cpp \
|
||||
jni/src/script/lua_api/l_http.cpp \
|
||||
jni/src/script/lua_api/l_storage.cpp \
|
||||
jni/src/script/lua_api/l_util.cpp \
|
||||
jni/src/script/lua_api/l_vmanip.cpp \
|
||||
jni/src/script/scripting_client.cpp \
|
||||
jni/src/script/scripting_server.cpp \
|
||||
jni/src/script/scripting_mainmenu.cpp
|
||||
|
||||
#freetype2 support
|
||||
#LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
|
||||
|
||||
# GMP
|
||||
LOCAL_SRC_FILES += jni/lib/gmp/mini-gmp.c
|
||||
|
||||
# Lua
|
||||
LOCAL_SRC_FILES += \
|
||||
jni/lib/lua/src/lapi.c \
|
||||
jni/lib/lua/src/lauxlib.c \
|
||||
jni/lib/lua/src/lbaselib.c \
|
||||
jni/lib/lua/src/lcode.c \
|
||||
jni/lib/lua/src/ldblib.c \
|
||||
jni/lib/lua/src/ldebug.c \
|
||||
jni/lib/lua/src/ldo.c \
|
||||
jni/lib/lua/src/ldump.c \
|
||||
jni/lib/lua/src/lfunc.c \
|
||||
jni/lib/lua/src/lgc.c \
|
||||
jni/lib/lua/src/linit.c \
|
||||
jni/lib/lua/src/liolib.c \
|
||||
jni/lib/lua/src/llex.c \
|
||||
jni/lib/lua/src/lmathlib.c \
|
||||
jni/lib/lua/src/lmem.c \
|
||||
jni/lib/lua/src/loadlib.c \
|
||||
jni/lib/lua/src/lobject.c \
|
||||
jni/lib/lua/src/lopcodes.c \
|
||||
jni/lib/lua/src/loslib.c \
|
||||
jni/lib/lua/src/lparser.c \
|
||||
jni/lib/lua/src/lstate.c \
|
||||
jni/lib/lua/src/lstring.c \
|
||||
jni/lib/lua/src/lstrlib.c \
|
||||
jni/lib/lua/src/ltable.c \
|
||||
jni/lib/lua/src/ltablib.c \
|
||||
jni/lib/lua/src/ltm.c \
|
||||
jni/lib/lua/src/lundump.c \
|
||||
jni/lib/lua/src/lvm.c \
|
||||
jni/lib/lua/src/lzio.c \
|
||||
jni/lib/lua/src/print.c
|
||||
|
||||
# SQLite3
|
||||
LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
|
||||
|
||||
# Threading
|
||||
LOCAL_SRC_FILES += \
|
||||
jni/src/threading/event.cpp \
|
||||
jni/src/threading/semaphore.cpp \
|
||||
jni/src/threading/thread.cpp
|
||||
|
||||
# JSONCPP
|
||||
LOCAL_SRC_FILES += jni/lib/jsoncpp/jsoncpp.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis
|
||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
|
||||
|
||||
ifeq ($(HAVE_LEVELDB), 1)
|
||||
LOCAL_STATIC_LIBRARIES += LevelDB
|
||||
endif
|
||||
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
# at the end of Android.mk
|
||||
ifdef GPROF
|
||||
$(call import-module,android-ndk-profiler)
|
||||
endif
|
||||
$(call import-module,android/native_app_glue)
|
||||
@@ -1,9 +0,0 @@
|
||||
APP_PLATFORM := ${APP_PLATFORM}
|
||||
APP_ABI := ${TARGET_ABI}
|
||||
APP_STL := c++_shared
|
||||
APP_MODULES := minetest
|
||||
ifndef NDEBUG
|
||||
APP_OPTIM := debug
|
||||
endif
|
||||
|
||||
APP_CPPFLAGS += -fexceptions -std=c++11 -frtti
|
||||
@@ -1,7 +0,0 @@
|
||||
APP_PLATFORM := ${APP_PLATFORM}
|
||||
APP_ABI := ${TARGET_ABI}
|
||||
APP_STL := c++_shared
|
||||
APP_DEPRECATED_HEADERS := true
|
||||
|
||||
APP_CFLAGS += ${TARGET_CFLAGS_ADDON}
|
||||
APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions -std=c++11
|
||||
@@ -1,8 +0,0 @@
|
||||
APP_PLATFORM := ${APP_PLATFORM}
|
||||
APP_ABI := ${TARGET_ABI}
|
||||
APP_STL := c++_shared
|
||||
APP_DEPRECATED_HEADERS := true
|
||||
APP_MODULES := Irrlicht
|
||||
|
||||
APP_CLAFGS += ${TARGET_CFLAGS_ADDON}
|
||||
APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions
|
||||
BIN
build/android/keystore-minetest.jks
Normal file
BIN
build/android/keystore-minetest.jks
Normal file
Binary file not shown.
98
build/android/native/build.gradle
Normal file
98
build/android/native/build.gradle
Normal file
@@ -0,0 +1,98 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'de.undercouch.download'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '30.0.3'
|
||||
ndkVersion '22.0.7026061'
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments '-j' + Runtime.getRuntime().availableProcessors(),
|
||||
"versionMajor=${versionMajor}",
|
||||
"versionMinor=${versionMinor}",
|
||||
"versionPatch=${versionPatch}",
|
||||
"versionExtra=${versionExtra}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path file('jni/Android.mk')
|
||||
}
|
||||
}
|
||||
|
||||
// supported architectures
|
||||
splits {
|
||||
abi {
|
||||
enable true
|
||||
reset()
|
||||
include 'armeabi-v7a', 'arm64-v8a'//, 'x86'
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments 'NDEBUG=1'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get precompiled deps
|
||||
def folder = 'minetest_android_deps_binaries'
|
||||
|
||||
task downloadDeps(type: Download) {
|
||||
src 'https://github.com/minetest/' + folder + '/archive/master.zip'
|
||||
dest new File(buildDir, 'deps.zip')
|
||||
overwrite false
|
||||
}
|
||||
|
||||
task getDeps(dependsOn: downloadDeps, type: Copy) {
|
||||
def deps = file('deps')
|
||||
def f = file("$buildDir/" + folder + "-master")
|
||||
|
||||
if (!deps.exists() && !f.exists()) {
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
preBuild.dependsOn getDeps
|
||||
preBuild.dependsOn getSqlite
|
||||
219
build/android/native/jni/Android.mk
Normal file
219
build/android/native/jni/Android.mk
Normal file
@@ -0,0 +1,219 @@
|
||||
LOCAL_PATH := $(call my-dir)/..
|
||||
|
||||
#LOCAL_ADDRESS_SANITIZER:=true
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Curl
|
||||
LOCAL_SRC_FILES := deps/Android/Curl/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libcurl.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Freetype
|
||||
LOCAL_SRC_FILES := deps/Android/Freetype/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libfreetype.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Irrlicht
|
||||
LOCAL_SRC_FILES := deps/Android/Irrlicht/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libIrrlicht.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)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := LuaJIT
|
||||
LOCAL_SRC_FILES := deps/Android/LuaJIT/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/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)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := OpenAL
|
||||
LOCAL_SRC_FILES := deps/Android/OpenAL-Soft/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/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 := Crypto
|
||||
#LOCAL_SRC_FILES := deps/Android/OpenSSL/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libcrypto.a
|
||||
#include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Vorbis
|
||||
LOCAL_SRC_FILES := deps/Android/Vorbis/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libvorbis.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := Minetest
|
||||
|
||||
LOCAL_CFLAGS += \
|
||||
-DJSONCPP_NO_LOCALE_SUPPORT \
|
||||
-DHAVE_TOUCHSCREENGUI \
|
||||
-DENABLE_GLES=1 \
|
||||
-DUSE_CURL=1 \
|
||||
-DUSE_SOUND=1 \
|
||||
-DUSE_FREETYPE=1 \
|
||||
-DUSE_LEVELDB=0 \
|
||||
-DUSE_LUAJIT=1 \
|
||||
-DVERSION_MAJOR=${versionMajor} \
|
||||
-DVERSION_MINOR=${versionMinor} \
|
||||
-DVERSION_PATCH=${versionPatch} \
|
||||
-DVERSION_EXTRA=${versionExtra} \
|
||||
$(GPROF_DEF)
|
||||
|
||||
ifdef NDEBUG
|
||||
LOCAL_CFLAGS += -DNDEBUG=1
|
||||
endif
|
||||
|
||||
ifdef GPROF
|
||||
GPROF_DEF := -DGPROF
|
||||
PROFILER_LIBS := android-ndk-profiler
|
||||
LOCAL_CFLAGS += -pg
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
../../../src \
|
||||
../../../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
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(wildcard ../../../src/client/*.cpp) \
|
||||
$(wildcard ../../../src/client/*/*.cpp) \
|
||||
$(wildcard ../../../src/content/*.cpp) \
|
||||
../../../src/database/database.cpp \
|
||||
../../../src/database/database-dummy.cpp \
|
||||
../../../src/database/database-files.cpp \
|
||||
../../../src/database/database-sqlite3.cpp \
|
||||
$(wildcard ../../../src/gui/*.cpp) \
|
||||
$(wildcard ../../../src/irrlicht_changes/*.cpp) \
|
||||
$(wildcard ../../../src/mapgen/*.cpp) \
|
||||
$(wildcard ../../../src/network/*.cpp) \
|
||||
$(wildcard ../../../src/script/*.cpp) \
|
||||
$(wildcard ../../../src/script/*/*.cpp) \
|
||||
$(wildcard ../../../src/server/*.cpp) \
|
||||
$(wildcard ../../../src/threading/*.cpp) \
|
||||
$(wildcard ../../../src/util/*.c) \
|
||||
$(wildcard ../../../src/util/*.cpp) \
|
||||
../../../src/ban.cpp \
|
||||
../../../src/chat.cpp \
|
||||
../../../src/clientiface.cpp \
|
||||
../../../src/collision.cpp \
|
||||
../../../src/content_mapnode.cpp \
|
||||
../../../src/content_nodemeta.cpp \
|
||||
../../../src/convert_json.cpp \
|
||||
../../../src/craftdef.cpp \
|
||||
../../../src/debug.cpp \
|
||||
../../../src/defaultsettings.cpp \
|
||||
../../../src/emerge.cpp \
|
||||
../../../src/environment.cpp \
|
||||
../../../src/face_position_cache.cpp \
|
||||
../../../src/filesys.cpp \
|
||||
../../../src/gettext.cpp \
|
||||
../../../src/httpfetch.cpp \
|
||||
../../../src/hud.cpp \
|
||||
../../../src/inventory.cpp \
|
||||
../../../src/inventorymanager.cpp \
|
||||
../../../src/itemdef.cpp \
|
||||
../../../src/itemstackmetadata.cpp \
|
||||
../../../src/light.cpp \
|
||||
../../../src/log.cpp \
|
||||
../../../src/main.cpp \
|
||||
../../../src/map.cpp \
|
||||
../../../src/map_settings_manager.cpp \
|
||||
../../../src/mapblock.cpp \
|
||||
../../../src/mapnode.cpp \
|
||||
../../../src/mapsector.cpp \
|
||||
../../../src/metadata.cpp \
|
||||
../../../src/modchannels.cpp \
|
||||
../../../src/nameidmapping.cpp \
|
||||
../../../src/nodedef.cpp \
|
||||
../../../src/nodemetadata.cpp \
|
||||
../../../src/nodetimer.cpp \
|
||||
../../../src/noise.cpp \
|
||||
../../../src/objdef.cpp \
|
||||
../../../src/object_properties.cpp \
|
||||
../../../src/particles.cpp \
|
||||
../../../src/pathfinder.cpp \
|
||||
../../../src/player.cpp \
|
||||
../../../src/porting.cpp \
|
||||
../../../src/porting_android.cpp \
|
||||
../../../src/profiler.cpp \
|
||||
../../../src/raycast.cpp \
|
||||
../../../src/reflowscan.cpp \
|
||||
../../../src/remoteplayer.cpp \
|
||||
../../../src/rollback.cpp \
|
||||
../../../src/rollback_interface.cpp \
|
||||
../../../src/serialization.cpp \
|
||||
../../../src/server.cpp \
|
||||
../../../src/serverenvironment.cpp \
|
||||
../../../src/serverlist.cpp \
|
||||
../../../src/settings.cpp \
|
||||
../../../src/staticobject.cpp \
|
||||
../../../src/texture_override.cpp \
|
||||
../../../src/tileanimation.cpp \
|
||||
../../../src/tool.cpp \
|
||||
../../../src/translation.cpp \
|
||||
../../../src/version.cpp \
|
||||
../../../src/voxel.cpp \
|
||||
../../../src/voxelalgorithms.cpp
|
||||
|
||||
# LevelDB backend is disabled
|
||||
# ../../../src/database/database-leveldb.cpp
|
||||
|
||||
# GMP
|
||||
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_LDLIBS := -lEGL -lGLESv1_CM -lGLESv2 -landroid -lOpenSLES
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
ifdef GPROF
|
||||
$(call import-module,android-ndk-profiler)
|
||||
endif
|
||||
$(call import-module,android/native_app_glue)
|
||||
32
build/android/native/jni/Application.mk
Normal file
32
build/android/native/jni/Application.mk
Normal file
@@ -0,0 +1,32 @@
|
||||
APP_PLATFORM := ${APP_PLATFORM}
|
||||
APP_ABI := ${TARGET_ABI}
|
||||
APP_STL := c++_shared
|
||||
NDK_TOOLCHAIN_VERSION := clang
|
||||
APP_SHORT_COMMANDS := true
|
||||
APP_MODULES := Minetest
|
||||
|
||||
APP_CPPFLAGS := -Ofast -fvisibility=hidden -fexceptions -Wno-deprecated-declarations -Wno-extra-tokens
|
||||
|
||||
ifeq ($(APP_ABI),armeabi-v7a)
|
||||
APP_CPPFLAGS += -march=armv7-a -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
|
||||
|
||||
ifndef NDEBUG
|
||||
APP_CPPFLAGS := -g -D_DEBUG -O0 -fno-omit-frame-pointer -fexceptions
|
||||
endif
|
||||
|
||||
APP_CFLAGS := $(APP_CPPFLAGS) -Wno-parentheses-equality #-Werror=shorten-64-to-32
|
||||
APP_CXXFLAGS := $(APP_CPPFLAGS) -frtti -std=gnu++17
|
||||
APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
|
||||
|
||||
ifeq ($(APP_ABI),arm64-v8a)
|
||||
APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections
|
||||
endif
|
||||
|
||||
ifndef NDEBUG
|
||||
APP_LDFLAGS :=
|
||||
endif
|
||||
1
build/android/native/src/main/AndroidManifest.xml
Normal file
1
build/android/native/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1 @@
|
||||
<manifest package="net.minetest" />
|
||||
@@ -1,20 +0,0 @@
|
||||
--- irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp.orig 2015-08-29 15:43:09.000000000 +0300
|
||||
+++ irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2016-05-13 21:36:22.880388505 +0300
|
||||
@@ -486,7 +486,7 @@
|
||||
event.KeyInput.Char = 0;
|
||||
}
|
||||
|
||||
- device->postEventFromUser(event);
|
||||
+ status = device->postEventFromUser(event);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -543,7 +543,7 @@
|
||||
KeyMap[1] = KEY_LBUTTON; // AKEYCODE_SOFT_LEFT
|
||||
KeyMap[2] = KEY_RBUTTON; // AKEYCODE_SOFT_RIGHT
|
||||
KeyMap[3] = KEY_HOME; // AKEYCODE_HOME
|
||||
- KeyMap[4] = KEY_BACK; // AKEYCODE_BACK
|
||||
+ KeyMap[4] = KEY_CANCEL; // AKEYCODE_BACK
|
||||
KeyMap[5] = KEY_UNKNOWN; // AKEYCODE_CALL
|
||||
KeyMap[6] = KEY_UNKNOWN; // AKEYCODE_ENDCALL
|
||||
KeyMap[7] = KEY_KEY_0; // AKEYCODE_0
|
||||
@@ -1,13 +0,0 @@
|
||||
--- irrlicht/source/Irrlicht/CEGLManager.cpp.orig 2018-09-11 18:19:51.453403631 +0300
|
||||
+++ irrlicht/source/Irrlicht/CEGLManager.cpp 2018-09-11 18:36:24.603471869 +0300
|
||||
@@ -9,6 +9,10 @@
|
||||
#include "irrString.h"
|
||||
#include "os.h"
|
||||
|
||||
+#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
+#include <android/native_activity.h>
|
||||
+#endif
|
||||
+
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
@@ -1,240 +0,0 @@
|
||||
--- irrlicht/source/Irrlicht/COGLESTexture.cpp.orig 2014-06-22 17:01:13.266568869 +0200
|
||||
+++ irrlicht/source/Irrlicht/COGLESTexture.cpp 2014-06-22 17:03:59.298572810 +0200
|
||||
@@ -366,112 +366,140 @@
|
||||
void(*convert)(const void*, s32, void*) = 0;
|
||||
getFormatParameters(ColorFormat, InternalFormat, filtering, PixelFormat, PixelType, convert);
|
||||
|
||||
- // make sure we don't change the internal format of existing images
|
||||
- if (!newTexture)
|
||||
- InternalFormat = oldInternalFormat;
|
||||
-
|
||||
- Driver->setActiveTexture(0, this);
|
||||
-
|
||||
- if (Driver->testGLError())
|
||||
- os::Printer::log("Could not bind Texture", ELL_ERROR);
|
||||
-
|
||||
- // mipmap handling for main texture
|
||||
- if (!level && newTexture)
|
||||
- {
|
||||
- // auto generate if possible and no mipmap data is given
|
||||
- if (!IsCompressed && HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE))
|
||||
- {
|
||||
- if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||
- glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||
- else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY))
|
||||
- glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
- else
|
||||
- glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
||||
+ bool retry = false;
|
||||
+
|
||||
+ do {
|
||||
+ if (retry) {
|
||||
+ InternalFormat = GL_RGBA;
|
||||
+ PixelFormat = GL_RGBA;
|
||||
+ convert = CColorConverter::convert_A8R8G8B8toA8B8G8R8;
|
||||
+ }
|
||||
+ // make sure we don't change the internal format of existing images
|
||||
+ if (!newTexture)
|
||||
+ InternalFormat = oldInternalFormat;
|
||||
|
||||
- glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
- AutomaticMipmapUpdate=true;
|
||||
- }
|
||||
+ Driver->setActiveTexture(0, this);
|
||||
|
||||
- // enable bilinear filter without mipmaps
|
||||
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
|
||||
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
|
||||
- }
|
||||
+ if (Driver->testGLError())
|
||||
+ os::Printer::log("Could not bind Texture", ELL_ERROR);
|
||||
|
||||
- // now get image data and upload to GPU
|
||||
+ // mipmap handling for main texture
|
||||
+ if (!level && newTexture)
|
||||
+ {
|
||||
+ // auto generate if possible and no mipmap data is given
|
||||
+ if (!IsCompressed && HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE))
|
||||
+ {
|
||||
+ if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||
+ glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||
+ else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY))
|
||||
+ glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
+ else
|
||||
+ glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
||||
+
|
||||
+ glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
+ AutomaticMipmapUpdate=true;
|
||||
+ }
|
||||
+
|
||||
+ // enable bilinear filter without mipmaps
|
||||
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
|
||||
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
|
||||
+ }
|
||||
|
||||
- u32 compressedImageSize = IImage::getCompressedImageSize(ColorFormat, image->getDimension().Width, image->getDimension().Height);
|
||||
+ // now get image data and upload to GPU
|
||||
|
||||
- void* source = image->lock();
|
||||
+ u32 compressedImageSize = IImage::getCompressedImageSize(ColorFormat, image->getDimension().Width, image->getDimension().Height);
|
||||
|
||||
- IImage* tmpImage = 0;
|
||||
+ void* source = image->lock();
|
||||
|
||||
- if (convert)
|
||||
- {
|
||||
- tmpImage = new CImage(image->getColorFormat(), image->getDimension());
|
||||
- void* dest = tmpImage->lock();
|
||||
- convert(source, image->getDimension().getArea(), dest);
|
||||
- image->unlock();
|
||||
- source = dest;
|
||||
- }
|
||||
+ IImage* tmpImage = 0;
|
||||
|
||||
- if (newTexture)
|
||||
- {
|
||||
- if (IsCompressed)
|
||||
+ if (convert)
|
||||
{
|
||||
- glCompressedTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, image->getDimension().Width,
|
||||
- image->getDimension().Height, 0, compressedImageSize, source);
|
||||
+ tmpImage = new CImage(image->getColorFormat(), image->getDimension());
|
||||
+ void* dest = tmpImage->lock();
|
||||
+ convert(source, image->getDimension().getArea(), dest);
|
||||
+ image->unlock();
|
||||
+ source = dest;
|
||||
}
|
||||
- else
|
||||
- glTexImage2D(GL_TEXTURE_2D, level, InternalFormat, image->getDimension().Width,
|
||||
- image->getDimension().Height, 0, PixelFormat, PixelType, source);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- if (IsCompressed)
|
||||
+
|
||||
+ if (newTexture)
|
||||
{
|
||||
- glCompressedTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width,
|
||||
- image->getDimension().Height, PixelFormat, compressedImageSize, source);
|
||||
+ if (IsCompressed)
|
||||
+ {
|
||||
+ glCompressedTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, image->getDimension().Width,
|
||||
+ image->getDimension().Height, 0, compressedImageSize, source);
|
||||
+ }
|
||||
+ else
|
||||
+ glTexImage2D(GL_TEXTURE_2D, level, InternalFormat, image->getDimension().Width,
|
||||
+ image->getDimension().Height, 0, PixelFormat, PixelType, source);
|
||||
}
|
||||
else
|
||||
- glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width,
|
||||
- image->getDimension().Height, PixelFormat, PixelType, source);
|
||||
- }
|
||||
-
|
||||
- if (convert)
|
||||
- {
|
||||
- tmpImage->unlock();
|
||||
- tmpImage->drop();
|
||||
- }
|
||||
- else
|
||||
- image->unlock();
|
||||
-
|
||||
- if (!level && newTexture)
|
||||
- {
|
||||
- if (IsCompressed && !mipmapData)
|
||||
{
|
||||
- if (image->hasMipMaps())
|
||||
- mipmapData = static_cast<u8*>(image->lock())+compressedImageSize;
|
||||
+ if (IsCompressed)
|
||||
+ {
|
||||
+ glCompressedTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width,
|
||||
+ image->getDimension().Height, PixelFormat, compressedImageSize, source);
|
||||
+ }
|
||||
else
|
||||
- HasMipMaps = false;
|
||||
+ glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width,
|
||||
+ image->getDimension().Height, PixelFormat, PixelType, source);
|
||||
}
|
||||
|
||||
- regenerateMipMapLevels(mipmapData);
|
||||
-
|
||||
- if (HasMipMaps) // might have changed in regenerateMipMapLevels
|
||||
+ if (convert)
|
||||
{
|
||||
- // enable bilinear mipmap filter
|
||||
- GLint filteringMipMaps = GL_LINEAR_MIPMAP_NEAREST;
|
||||
-
|
||||
- if (filtering != GL_LINEAR)
|
||||
- filteringMipMaps = GL_NEAREST_MIPMAP_NEAREST;
|
||||
+ tmpImage->unlock();
|
||||
+ tmpImage->drop();
|
||||
+ }
|
||||
+ else
|
||||
+ image->unlock();
|
||||
+
|
||||
+ if (glGetError() != GL_NO_ERROR) {
|
||||
+ static bool warned = false;
|
||||
+ if ((!retry) && (ColorFormat == ECF_A8R8G8B8)) {
|
||||
+
|
||||
+ if (!warned) {
|
||||
+ os::Printer::log("Your driver claims to support GL_BGRA but fails on trying to upload a texture, converting to GL_RGBA and trying again", ELL_ERROR);
|
||||
+ warned = true;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (retry) {
|
||||
+ os::Printer::log("Neither uploading texture as GL_BGRA nor, converted one using GL_RGBA succeeded", ELL_ERROR);
|
||||
+ }
|
||||
+ retry = !retry;
|
||||
+ continue;
|
||||
+ } else {
|
||||
+ retry = false;
|
||||
+ }
|
||||
|
||||
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filteringMipMaps);
|
||||
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
|
||||
+ if (!level && newTexture)
|
||||
+ {
|
||||
+ if (IsCompressed && !mipmapData)
|
||||
+ {
|
||||
+ if (image->hasMipMaps())
|
||||
+ mipmapData = static_cast<u8*>(image->lock())+compressedImageSize;
|
||||
+ else
|
||||
+ HasMipMaps = false;
|
||||
+ }
|
||||
+
|
||||
+ regenerateMipMapLevels(mipmapData);
|
||||
+
|
||||
+ if (HasMipMaps) // might have changed in regenerateMipMapLevels
|
||||
+ {
|
||||
+ // enable bilinear mipmap filter
|
||||
+ GLint filteringMipMaps = GL_LINEAR_MIPMAP_NEAREST;
|
||||
+
|
||||
+ if (filtering != GL_LINEAR)
|
||||
+ filteringMipMaps = GL_NEAREST_MIPMAP_NEAREST;
|
||||
+
|
||||
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filteringMipMaps);
|
||||
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- if (Driver->testGLError())
|
||||
- os::Printer::log("Could not glTexImage2D", ELL_ERROR);
|
||||
+ if (Driver->testGLError())
|
||||
+ os::Printer::log("Could not glTexImage2D", ELL_ERROR);
|
||||
+ }
|
||||
+ while(retry);
|
||||
}
|
||||
|
||||
|
||||
--- irrlicht/source/Irrlicht/COGLESTexture.cpp.orig 2014-06-25 00:28:50.820501856 +0200
|
||||
+++ irrlicht/source/Irrlicht/COGLESTexture.cpp 2014-06-25 00:08:37.712544692 +0200
|
||||
@@ -422,6 +422,9 @@
|
||||
source = dest;
|
||||
}
|
||||
|
||||
+ //clear old error
|
||||
+ glGetError();
|
||||
+
|
||||
if (newTexture)
|
||||
{
|
||||
if (IsCompressed)
|
||||
@@ -1,30 +0,0 @@
|
||||
--- irrlicht.orig/include/IEventReceiver.h 2014-06-03 19:43:50.433713133 +0200
|
||||
+++ irrlicht/include/IEventReceiver.h 2014-06-03 19:44:36.993711489 +0200
|
||||
@@ -375,6 +375,9 @@
|
||||
// Y position of simple touch.
|
||||
s32 Y;
|
||||
|
||||
+ // number of current touches
|
||||
+ s32 touchedCount;
|
||||
+
|
||||
//! Type of touch event.
|
||||
ETOUCH_INPUT_EVENT Event;
|
||||
};
|
||||
--- irrlicht.orig/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2014-06-03 19:43:50.505713130 +0200
|
||||
+++ irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2014-06-03 19:45:37.265709359 +0200
|
||||
@@ -315,6 +315,7 @@
|
||||
event.TouchInput.ID = AMotionEvent_getPointerId(androidEvent, i);
|
||||
event.TouchInput.X = AMotionEvent_getX(androidEvent, i);
|
||||
event.TouchInput.Y = AMotionEvent_getY(androidEvent, i);
|
||||
+ event.TouchInput.touchedCount = AMotionEvent_getPointerCount(androidEvent);
|
||||
|
||||
device->postEventFromUser(event);
|
||||
}
|
||||
@@ -326,6 +327,7 @@
|
||||
event.TouchInput.ID = AMotionEvent_getPointerId(androidEvent, pointerIndex);
|
||||
event.TouchInput.X = AMotionEvent_getX(androidEvent, pointerIndex);
|
||||
event.TouchInput.Y = AMotionEvent_getY(androidEvent, pointerIndex);
|
||||
+ event.TouchInput.touchedCount = AMotionEvent_getPointerCount(androidEvent);
|
||||
|
||||
device->postEventFromUser(event);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
--- a/libcharset/lib/localcharset.c 2015-06-10 11:55:25.933870724 +0200
|
||||
+++ b/libcharset/lib/localcharset.c 2015-06-10 11:55:39.578063493 +0200
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
#if !defined WIN32_NATIVE
|
||||
# include <unistd.h>
|
||||
-# if HAVE_LANGINFO_CODESET
|
||||
+# if HAVE_LANGINFO_CODESET && !(defined __ANDROID__)
|
||||
# include <langinfo.h>
|
||||
# else
|
||||
# if 0 /* see comment below */
|
||||
@@ -124,7 +124,7 @@ get_charset_aliases (void)
|
||||
cp = charset_aliases;
|
||||
if (cp == NULL)
|
||||
{
|
||||
-#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
|
||||
+#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__ || defined __ANDROID__)
|
||||
const char *dir;
|
||||
const char *base = "charset.alias";
|
||||
char *file_name;
|
||||
@@ -338,6 +338,9 @@ get_charset_aliases (void)
|
||||
"CP54936" "\0" "GB18030" "\0"
|
||||
"CP65001" "\0" "UTF-8" "\0";
|
||||
# endif
|
||||
+# if defined __ANDROID__
|
||||
+ cp = "*" "\0" "UTF-8" "\0";
|
||||
+# endif
|
||||
#endif
|
||||
|
||||
charset_aliases = cp;
|
||||
@@ -361,7 +364,7 @@ locale_charset (void)
|
||||
const char *codeset;
|
||||
const char *aliases;
|
||||
|
||||
-#if !(defined WIN32_NATIVE || defined OS2)
|
||||
+#if !(defined WIN32_NATIVE || defined OS2 || defined __ANDROID__)
|
||||
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--- a/srclib/stdio.in.h 2011-08-07 15:42:06.000000000 +0200
|
||||
+++ b/srclib/stdio.in.h 2015-06-10 09:27:58.129056262 +0200
|
||||
@@ -695,8 +696,9 @@ _GL_CXXALIASWARN (gets);
|
||||
/* It is very rare that the developer ever has full control of stdin,
|
||||
so any use of gets warrants an unconditional warning. Assume it is
|
||||
always declared, since it is required by C89. */
|
||||
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
|
||||
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/
|
||||
+#define gets(a) fgets( a, sizeof(*(a)), stdin)
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
|
||||
@@ -1,37 +0,0 @@
|
||||
--- libvorbis-libogg-android/jni/libvorbis-jni/Android.mk.orig 2014-06-17 19:22:50.621559073 +0200
|
||||
+++ libvorbis-libogg-android/jni/libvorbis-jni/Android.mk 2014-06-17 19:38:20.641581140 +0200
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
LOCAL_MODULE := vorbis-jni
|
||||
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -fsigned-char
|
||||
-ifeq ($(TARGET_ARCH),arm)
|
||||
- LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
|
||||
-endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := libogg libvorbis
|
||||
|
||||
--- libvorbis-libogg-android/jni/libvorbis/Android.mk.orig 2014-06-17 19:22:39.077558797 +0200
|
||||
+++ libvorbis-libogg-android/jni/libvorbis/Android.mk 2014-06-17 19:38:52.121581887 +0200
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
LOCAL_MODULE := libvorbis
|
||||
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char
|
||||
-ifeq ($(TARGET_ARCH),arm)
|
||||
- LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
|
||||
-endif
|
||||
LOCAL_SHARED_LIBRARIES := libogg
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
--- libvorbis-libogg-android/jni/libogg/Android.mk.orig 2014-06-17 19:22:33.965558675 +0200
|
||||
+++ libvorbis-libogg-android/jni/libogg/Android.mk 2014-06-17 19:38:25.337581252 +0200
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
LOCAL_MODULE := libogg
|
||||
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char
|
||||
-ifeq ($(TARGET_ARCH),arm)
|
||||
- LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
|
||||
-endif
|
||||
-
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
bitwise.c \
|
||||
@@ -1,13 +0,0 @@
|
||||
--- openssl-1.0.2e.orig/Configure 2015-12-03 15:04:23.000000000 +0100
|
||||
+++ openssl-1.0.2e/Configure 2015-12-14 21:01:40.351265968 +0100
|
||||
@@ -464,8 +464,10 @@
|
||||
# Android: linux-* but without pointers to headers and libs.
|
||||
"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
+"android-arm","gcc:-march=armv4 -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
+"android-mips32","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
#### *BSD [do see comment about ${BSDthreads} above!]
|
||||
"BSD-generic32","gcc:-O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
@@ -1 +1,2 @@
|
||||
rootProject.name = "Minetest"
|
||||
include ':app', ':native'
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.SET_DEBUG_APP" />
|
||||
</manifest>
|
||||
@@ -1,79 +0,0 @@
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private final static int PERMISSIONS = 1;
|
||||
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
checkPermission();
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkPermission() {
|
||||
final List<String> missingPermissions = new ArrayList<String>();
|
||||
// check required permission
|
||||
for (final String permission : REQUIRED_SDK_PERMISSIONS) {
|
||||
final int result = ContextCompat.checkSelfPermission(this, permission);
|
||||
if (result != PackageManager.PERMISSION_GRANTED) {
|
||||
missingPermissions.add(permission);
|
||||
}
|
||||
}
|
||||
if (!missingPermissions.isEmpty()) {
|
||||
// request permission
|
||||
final String[] permissions = missingPermissions
|
||||
.toArray(new String[missingPermissions.size()]);
|
||||
ActivityCompat.requestPermissions(this, permissions, PERMISSIONS);
|
||||
} else {
|
||||
final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length];
|
||||
Arrays.fill(grantResults, PackageManager.PERMISSION_GRANTED);
|
||||
onRequestPermissionsResult(PERMISSIONS, REQUIRED_SDK_PERMISSIONS,
|
||||
grantResults);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
|
||||
@NonNull int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case PERMISSIONS:
|
||||
for (int index = 0; index < permissions.length; index++) {
|
||||
if (grantResults[index] != PackageManager.PERMISSION_GRANTED) {
|
||||
// permission not granted - toast and exit
|
||||
Toast.makeText(this, R.string.not_granted, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// permission were granted - run
|
||||
next();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void next() {
|
||||
Intent intent = new Intent(this, MtNativeActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@@ -1,373 +0,0 @@
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
public class MinetestAssetCopy extends Activity {
|
||||
ProgressBar m_ProgressBar;
|
||||
TextView m_Filename;
|
||||
copyAssetTask m_AssetCopy;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.assetcopy);
|
||||
m_ProgressBar = findViewById(R.id.progressBar1);
|
||||
m_Filename = findViewById(R.id.textView1);
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
m_ProgressBar.getLayoutParams().width = (int) (display.getWidth() * 0.8);
|
||||
m_ProgressBar.invalidate();
|
||||
|
||||
/* check if there's already a copy in progress and reuse in case it is*/
|
||||
MinetestAssetCopy prevActivity =
|
||||
(MinetestAssetCopy) getLastNonConfigurationInstance();
|
||||
if (prevActivity != null) {
|
||||
m_AssetCopy = prevActivity.m_AssetCopy;
|
||||
} else {
|
||||
m_AssetCopy = new copyAssetTask();
|
||||
m_AssetCopy.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
makeFullScreen();
|
||||
}
|
||||
|
||||
public void makeFullScreen() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
this.getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus) {
|
||||
makeFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
/* preserve asset copy background task to prevent restart of copying */
|
||||
/* this way of doing it is not recommended for latest android version */
|
||||
/* but the recommended way isn't available on android 2.x */
|
||||
public Object onRetainNonConfigurationInstance() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private class copyAssetTask extends AsyncTask<String, Integer, String> {
|
||||
boolean m_copy_started = false;
|
||||
String m_Foldername = "media";
|
||||
Vector<String> m_foldernames;
|
||||
Vector<String> m_filenames;
|
||||
Vector<String> m_tocopy;
|
||||
Vector<String> m_asset_size_unknown;
|
||||
|
||||
private long getFullSize(String filename) {
|
||||
long size = 0;
|
||||
try {
|
||||
InputStream src = getAssets().open(filename);
|
||||
byte[] buf = new byte[4096];
|
||||
|
||||
int len = 0;
|
||||
while ((len = src.read(buf)) > 0) {
|
||||
size += len;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... files) {
|
||||
m_foldernames = new Vector<String>();
|
||||
m_filenames = new Vector<String>();
|
||||
m_tocopy = new Vector<String>();
|
||||
m_asset_size_unknown = new Vector<String>();
|
||||
String baseDir =
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||
+ "/";
|
||||
|
||||
|
||||
// prepare temp folder
|
||||
File TempFolder = new File(baseDir + "Minetest/tmp/");
|
||||
|
||||
if (!TempFolder.exists()) {
|
||||
TempFolder.mkdir();
|
||||
} else {
|
||||
File[] todel = TempFolder.listFiles();
|
||||
|
||||
for (int i = 0; i < todel.length; i++) {
|
||||
Log.v("MinetestAssetCopy", "deleting: " + todel[i].getAbsolutePath());
|
||||
todel[i].delete();
|
||||
}
|
||||
}
|
||||
|
||||
// add a .nomedia file
|
||||
try {
|
||||
OutputStream dst = new FileOutputStream(baseDir + "Minetest/.nomedia");
|
||||
dst.close();
|
||||
} catch (IOException e) {
|
||||
Log.e("MinetestAssetCopy", "Failed to create .nomedia file");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
// build lists from prepared data
|
||||
BuildFolderList();
|
||||
BuildFileList();
|
||||
|
||||
// scan filelist
|
||||
ProcessFileList();
|
||||
|
||||
// doing work
|
||||
m_copy_started = true;
|
||||
m_ProgressBar.setMax(m_tocopy.size());
|
||||
|
||||
for (int i = 0; i < m_tocopy.size(); i++) {
|
||||
try {
|
||||
String filename = m_tocopy.get(i);
|
||||
publishProgress(i);
|
||||
|
||||
boolean asset_size_unknown = false;
|
||||
long filesize = -1;
|
||||
|
||||
if (m_asset_size_unknown.contains(filename)) {
|
||||
File testme = new File(baseDir + "/" + filename);
|
||||
|
||||
if (testme.exists()) {
|
||||
filesize = testme.length();
|
||||
}
|
||||
asset_size_unknown = true;
|
||||
}
|
||||
|
||||
InputStream src;
|
||||
try {
|
||||
src = getAssets().open(filename);
|
||||
} catch (IOException e) {
|
||||
Log.e("MinetestAssetCopy", "Copying file: " + filename + " FAILED (not in assets)");
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Transfer bytes from in to out
|
||||
byte[] buf = new byte[1024];
|
||||
int len = src.read(buf, 0, 1024);
|
||||
|
||||
/* following handling is crazy but we need to deal with */
|
||||
/* compressed assets.Flash chips limited livetime due to */
|
||||
/* write operations, we can't allow large files to destroy */
|
||||
/* users flash. */
|
||||
if (asset_size_unknown) {
|
||||
if ((len > 0) && (len < buf.length) && (len == filesize)) {
|
||||
src.close();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (len == buf.length) {
|
||||
src.close();
|
||||
long size = getFullSize(filename);
|
||||
if (size == filesize) {
|
||||
continue;
|
||||
}
|
||||
src = getAssets().open(filename);
|
||||
len = src.read(buf, 0, 1024);
|
||||
}
|
||||
}
|
||||
if (len > 0) {
|
||||
int total_filesize = 0;
|
||||
OutputStream dst;
|
||||
try {
|
||||
dst = new FileOutputStream(baseDir + "/" + filename);
|
||||
} catch (IOException e) {
|
||||
Log.e("MinetestAssetCopy", "Copying file: " + baseDir +
|
||||
"/" + filename + " FAILED (couldn't open output file)");
|
||||
e.printStackTrace();
|
||||
src.close();
|
||||
continue;
|
||||
}
|
||||
dst.write(buf, 0, len);
|
||||
total_filesize += len;
|
||||
|
||||
while ((len = src.read(buf)) > 0) {
|
||||
dst.write(buf, 0, len);
|
||||
total_filesize += len;
|
||||
}
|
||||
|
||||
dst.close();
|
||||
Log.v("MinetestAssetCopy", "Copied file: " +
|
||||
m_tocopy.get(i) + " (" + total_filesize +
|
||||
" bytes)");
|
||||
} else if (len < 0) {
|
||||
Log.e("MinetestAssetCopy", "Copying file: " +
|
||||
m_tocopy.get(i) + " failed, size < 0");
|
||||
}
|
||||
src.close();
|
||||
} catch (IOException e) {
|
||||
Log.e("MinetestAssetCopy", "Copying file: " +
|
||||
m_tocopy.get(i) + " failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* update progress bar
|
||||
*/
|
||||
protected void onProgressUpdate(Integer... progress) {
|
||||
|
||||
if (m_copy_started) {
|
||||
boolean shortened = false;
|
||||
String todisplay = m_tocopy.get(progress[0]);
|
||||
m_ProgressBar.setProgress(progress[0]);
|
||||
m_Filename.setText(todisplay);
|
||||
} else {
|
||||
boolean shortened = false;
|
||||
String todisplay = m_Foldername;
|
||||
String full_text = "scanning " + todisplay + " ...";
|
||||
m_Filename.setText(full_text);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check all files and folders in filelist
|
||||
*/
|
||||
protected void ProcessFileList() {
|
||||
String FlashBaseDir =
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
|
||||
Iterator itr = m_filenames.iterator();
|
||||
|
||||
while (itr.hasNext()) {
|
||||
String current_path = (String) itr.next();
|
||||
String FlashPath = FlashBaseDir + "/" + current_path;
|
||||
|
||||
if (isAssetFolder(current_path)) {
|
||||
/* store information and update gui */
|
||||
m_Foldername = current_path;
|
||||
publishProgress(0);
|
||||
|
||||
/* open file in order to check if it's a folder */
|
||||
File current_folder = new File(FlashPath);
|
||||
if (!current_folder.exists()) {
|
||||
if (!current_folder.mkdirs()) {
|
||||
Log.e("MinetestAssetCopy", "\t failed create folder: " +
|
||||
FlashPath);
|
||||
} else {
|
||||
Log.v("MinetestAssetCopy", "\t created folder: " +
|
||||
FlashPath);
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if it's not a folder it's most likely a file */
|
||||
boolean refresh = true;
|
||||
|
||||
File testme = new File(FlashPath);
|
||||
|
||||
long asset_filesize = -1;
|
||||
long stored_filesize = -1;
|
||||
|
||||
if (testme.exists()) {
|
||||
try {
|
||||
AssetFileDescriptor fd = getAssets().openFd(current_path);
|
||||
asset_filesize = fd.getLength();
|
||||
fd.close();
|
||||
} catch (IOException e) {
|
||||
refresh = true;
|
||||
m_asset_size_unknown.add(current_path);
|
||||
Log.e("MinetestAssetCopy", "Failed to open asset file \"" +
|
||||
FlashPath + "\" for size check");
|
||||
}
|
||||
|
||||
stored_filesize = testme.length();
|
||||
|
||||
if (asset_filesize == stored_filesize) {
|
||||
refresh = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
m_tocopy.add(current_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read list of folders prepared on package build
|
||||
*/
|
||||
protected void BuildFolderList() {
|
||||
try {
|
||||
InputStream is = getAssets().open("index.txt");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
m_foldernames.add(line);
|
||||
line = reader.readLine();
|
||||
}
|
||||
is.close();
|
||||
} catch (IOException e1) {
|
||||
Log.e("MinetestAssetCopy", "Error on processing index.txt");
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read list of asset files prepared on package build
|
||||
*/
|
||||
protected void BuildFileList() {
|
||||
long entrycount = 0;
|
||||
try {
|
||||
InputStream is = getAssets().open("filelist.txt");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
m_filenames.add(line);
|
||||
line = reader.readLine();
|
||||
entrycount++;
|
||||
}
|
||||
is.close();
|
||||
} catch (IOException e1) {
|
||||
Log.e("MinetestAssetCopy", "Error on processing filelist.txt");
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute(String result) {
|
||||
finish();
|
||||
}
|
||||
|
||||
protected boolean isAssetFolder(String path) {
|
||||
return m_foldernames.contains(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class MinetestTextEntry extends Activity {
|
||||
private final int MultiLineTextInput = 1;
|
||||
private final int SingleLineTextInput = 2;
|
||||
private final int SingleLinePasswordInput = 3;
|
||||
public AlertDialog mTextInputDialog;
|
||||
public EditText mTextInputWidget;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Bundle b = getIntent().getExtras();
|
||||
String acceptButton = b.getString("EnterButton");
|
||||
String hint = b.getString("hint");
|
||||
String current = b.getString("current");
|
||||
int editType = b.getInt("editType");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
mTextInputWidget = new EditText(this);
|
||||
mTextInputWidget.setHint(hint);
|
||||
mTextInputWidget.setText(current);
|
||||
mTextInputWidget.setMinWidth(300);
|
||||
if (editType == SingleLinePasswordInput) {
|
||||
mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
} else {
|
||||
mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
}
|
||||
|
||||
builder.setView(mTextInputWidget);
|
||||
|
||||
if (editType == MultiLineTextInput) {
|
||||
builder.setPositiveButton(acceptButton, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
pushResult(mTextInputWidget.getText().toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
cancelDialog();
|
||||
}
|
||||
});
|
||||
|
||||
mTextInputWidget.setOnKeyListener(new OnKeyListener() {
|
||||
@Override
|
||||
public boolean onKey(View view, int KeyCode, KeyEvent event) {
|
||||
if (KeyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
|
||||
pushResult(mTextInputWidget.getText().toString());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mTextInputDialog = builder.create();
|
||||
mTextInputDialog.show();
|
||||
}
|
||||
|
||||
public void pushResult(String text) {
|
||||
Intent resultData = new Intent();
|
||||
resultData.putExtra("text", text);
|
||||
setResult(Activity.RESULT_OK, resultData);
|
||||
mTextInputDialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
|
||||
public void cancelDialog() {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
mTextInputDialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package net.minetest.minetest;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public class MtNativeActivity extends NativeActivity {
|
||||
|
||||
static {
|
||||
System.loadLibrary("c++_shared");
|
||||
System.loadLibrary("openal");
|
||||
System.loadLibrary("ogg");
|
||||
System.loadLibrary("vorbis");
|
||||
System.loadLibrary("iconv");
|
||||
System.loadLibrary("minetest");
|
||||
}
|
||||
|
||||
private int m_MessagReturnCode;
|
||||
private String m_MessageReturnValue;
|
||||
|
||||
public static native void putMessageBoxResult(String text);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
m_MessagReturnCode = -1;
|
||||
m_MessageReturnValue = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
makeFullScreen();
|
||||
}
|
||||
|
||||
public void makeFullScreen() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
this.getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus) {
|
||||
makeFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
public void copyAssets() {
|
||||
Intent intent = new Intent(this, MinetestAssetCopy.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void showDialog(String acceptButton, String hint, String current,
|
||||
int editType) {
|
||||
|
||||
Intent intent = new Intent(this, MinetestTextEntry.class);
|
||||
Bundle params = new Bundle();
|
||||
params.putString("acceptButton", acceptButton);
|
||||
params.putString("hint", hint);
|
||||
params.putString("current", current);
|
||||
params.putInt("editType", editType);
|
||||
intent.putExtras(params);
|
||||
startActivityForResult(intent, 101);
|
||||
m_MessageReturnValue = "";
|
||||
m_MessagReturnCode = -1;
|
||||
}
|
||||
|
||||
/* ugly code to workaround putMessageBoxResult not beeing found */
|
||||
public int getDialogState() {
|
||||
return m_MessagReturnCode;
|
||||
}
|
||||
|
||||
public String getDialogValue() {
|
||||
m_MessagReturnCode = -1;
|
||||
return m_MessageReturnValue;
|
||||
}
|
||||
|
||||
public float getDensity() {
|
||||
return getResources().getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
public int getDisplayWidth() {
|
||||
return getResources().getDisplayMetrics().widthPixels;
|
||||
}
|
||||
|
||||
public int getDisplayHeight() {
|
||||
return getResources().getDisplayMetrics().heightPixels;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
if (requestCode == 101) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
String text = data.getStringExtra("text");
|
||||
m_MessagReturnCode = 0;
|
||||
m_MessageReturnValue = text;
|
||||
} else {
|
||||
m_MessagReturnCode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar1"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginLeft="90dp"
|
||||
android:layout_marginRight="90dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/progressBar1"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="@string/preparing_media" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="@android:style/android:Theme.Material.Light.NoActionBar.Fullscreen">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@drawable/bg</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Dialog" parent="@android:style/Theme.Material.Light.Dialog.NoActionBar"/>
|
||||
|
||||
</resources>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="preparing_media">Preparing media…</string>
|
||||
<string name="not_granted">Required permission wasn\'t granted, Minetest can\'t run without it</string>
|
||||
</resources>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="@android:style/android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@drawable/bg</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Dialog" parent="@android:style/android:Theme.Holo.Light.Dialog.NoActionBar"/>
|
||||
|
||||
</resources>
|
||||
@@ -16,19 +16,24 @@ core.register_on_sending_chat_message(function(message)
|
||||
end
|
||||
|
||||
local cmd, param = string.match(message, "^%.([^ ]+) *(.*)")
|
||||
param = param or ""
|
||||
param = param or ""
|
||||
|
||||
if not cmd then
|
||||
core.display_chat_message(core.gettext("-!- Empty command"))
|
||||
return true
|
||||
end
|
||||
|
||||
-- Run core.registered_on_chatcommand callbacks.
|
||||
if core.run_callbacks(core.registered_on_chatcommand, 5, cmd, param) then
|
||||
return true
|
||||
end
|
||||
|
||||
local cmd_def = core.registered_chatcommands[cmd]
|
||||
if cmd_def then
|
||||
core.set_last_run_mod(cmd_def.mod_origin)
|
||||
local _, message = cmd_def.func(param)
|
||||
if message then
|
||||
core.display_chat_message(message)
|
||||
local _, result = cmd_def.func(param)
|
||||
if result then
|
||||
core.display_chat_message(result)
|
||||
end
|
||||
else
|
||||
core.display_chat_message(core.gettext("-!- Invalid command: ") .. cmd)
|
||||
|
||||
@@ -4,6 +4,13 @@ core.callback_origins = {}
|
||||
local getinfo = debug.getinfo
|
||||
debug.getinfo = nil
|
||||
|
||||
--- Runs given callbacks.
|
||||
--
|
||||
-- Note: this function is also called from C++
|
||||
-- @tparam table callbacks a table with registered callbacks, like `core.registered_on_*`
|
||||
-- @tparam number mode a RunCallbacksMode, as defined in src/script/common/c_internal.h
|
||||
-- @param ... arguments for the callback
|
||||
-- @return depends on mode
|
||||
function core.run_callbacks(callbacks, mode, ...)
|
||||
assert(type(callbacks) == "table")
|
||||
local cb_len = #callbacks
|
||||
@@ -63,6 +70,7 @@ core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration
|
||||
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
|
||||
core.registered_on_receiving_chat_message, core.register_on_receiving_chat_message = make_registration()
|
||||
core.registered_on_sending_chat_message, core.register_on_sending_chat_message = make_registration()
|
||||
core.registered_on_chatcommand, core.register_on_chatcommand = make_registration()
|
||||
core.registered_on_death, core.register_on_death = make_registration()
|
||||
core.registered_on_hp_modification, core.register_on_hp_modification = make_registration()
|
||||
core.registered_on_damage_taken, core.register_on_damage_taken = make_registration()
|
||||
|
||||
@@ -1,33 +1,43 @@
|
||||
local jobs = {}
|
||||
local time = 0.0
|
||||
local time_next = math.huge
|
||||
|
||||
core.register_globalstep(function(dtime)
|
||||
time = time + dtime
|
||||
|
||||
if #jobs < 1 then
|
||||
if time < time_next then
|
||||
return
|
||||
end
|
||||
|
||||
time_next = math.huge
|
||||
|
||||
-- Iterate backwards so that we miss any new timers added by
|
||||
-- a timer callback, and so that we don't skip the next timer
|
||||
-- in the list if we remove one.
|
||||
-- a timer callback.
|
||||
for i = #jobs, 1, -1 do
|
||||
local job = jobs[i]
|
||||
if time >= job.expire then
|
||||
core.set_last_run_mod(job.mod_origin)
|
||||
job.func(unpack(job.arg))
|
||||
table.remove(jobs, i)
|
||||
local jobs_l = #jobs
|
||||
jobs[i] = jobs[jobs_l]
|
||||
jobs[jobs_l] = nil
|
||||
elseif job.expire < time_next then
|
||||
time_next = job.expire
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function core.after(after, func, ...)
|
||||
assert(tonumber(after) and type(func) == "function",
|
||||
"Invalid core.after invocation")
|
||||
jobs[#jobs + 1] = {
|
||||
"Invalid minetest.after invocation")
|
||||
local expire = time + after
|
||||
local new_job = {
|
||||
func = func,
|
||||
expire = time + after,
|
||||
expire = expire,
|
||||
arg = {...},
|
||||
mod_origin = core.get_last_run_mod()
|
||||
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 }
|
||||
end
|
||||
|
||||
@@ -250,7 +250,6 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function compare_worlds(world1,world2)
|
||||
|
||||
if world1.path ~= world2.path then
|
||||
return false
|
||||
end
|
||||
|
||||
152
builtin/common/information_formspecs.lua
Normal file
152
builtin/common/information_formspecs.lua
Normal file
@@ -0,0 +1,152 @@
|
||||
local COLOR_BLUE = "#7AF"
|
||||
local COLOR_GREEN = "#7F7"
|
||||
local COLOR_GRAY = "#BBB"
|
||||
|
||||
local LIST_FORMSPEC = [[
|
||||
size[13,6.5]
|
||||
label[0,-0.1;%s]
|
||||
tablecolumns[color;tree;text;text]
|
||||
table[0,0.5;12.8,5.5;list;%s;0]
|
||||
button_exit[5,6;3,1;quit;%s]
|
||||
]]
|
||||
|
||||
local LIST_FORMSPEC_DESCRIPTION = [[
|
||||
size[13,7.5]
|
||||
label[0,-0.1;%s]
|
||||
tablecolumns[color;tree;text;text]
|
||||
table[0,0.5;12.8,4.8;list;%s;%i]
|
||||
box[0,5.5;12.8,1.5;#000]
|
||||
textarea[0.3,5.5;13.05,1.9;;;%s]
|
||||
button_exit[5,7;3,1;quit;%s]
|
||||
]]
|
||||
|
||||
local formspec_escape = core.formspec_escape
|
||||
local check_player_privs = core.check_player_privs
|
||||
|
||||
|
||||
-- CHAT COMMANDS FORMSPEC
|
||||
|
||||
local mod_cmds = {}
|
||||
|
||||
local function load_mod_command_tree()
|
||||
mod_cmds = {}
|
||||
|
||||
for name, def in pairs(core.registered_chatcommands) do
|
||||
mod_cmds[def.mod_origin] = mod_cmds[def.mod_origin] or {}
|
||||
local cmds = mod_cmds[def.mod_origin]
|
||||
|
||||
-- Could be simplified, but avoid the priv checks whenever possible
|
||||
cmds[#cmds + 1] = { name, def }
|
||||
end
|
||||
local sorted_mod_cmds = {}
|
||||
for modname, cmds in pairs(mod_cmds) do
|
||||
table.sort(cmds, function(a, b) return a[1] < b[1] end)
|
||||
sorted_mod_cmds[#sorted_mod_cmds + 1] = { modname, cmds }
|
||||
end
|
||||
table.sort(sorted_mod_cmds, function(a, b) return a[1] < b[1] end)
|
||||
mod_cmds = sorted_mod_cmds
|
||||
end
|
||||
|
||||
core.after(0, load_mod_command_tree)
|
||||
|
||||
local function build_chatcommands_formspec(name, sel, copy)
|
||||
local rows = {}
|
||||
rows[1] = "#FFF,0,Command,Parameters"
|
||||
|
||||
local description = "For more information, click on any entry in the list.\n" ..
|
||||
"Double-click to copy the entry to the chat history."
|
||||
|
||||
for i, data in ipairs(mod_cmds) do
|
||||
rows[#rows + 1] = COLOR_BLUE .. ",0," .. formspec_escape(data[1]) .. ","
|
||||
for j, cmds in ipairs(data[2]) do
|
||||
local has_priv = check_player_privs(name, 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))
|
||||
if sel == #rows then
|
||||
description = cmds[2].description
|
||||
if copy then
|
||||
core.chat_send_player(name, ("Command: %s %s"):format(
|
||||
core.colorize("#0FF", "/" .. cmds[1]), cmds[2].params))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return LIST_FORMSPEC_DESCRIPTION:format(
|
||||
"Available commands: (see also: /help <cmd>)",
|
||||
table.concat(rows, ","), sel or 0,
|
||||
description, "Close"
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
-- PRIVILEGES FORMSPEC
|
||||
|
||||
local function build_privs_formspec(name)
|
||||
local privs = {}
|
||||
for priv_name, def in pairs(core.registered_privileges) do
|
||||
privs[#privs + 1] = { priv_name, def }
|
||||
end
|
||||
table.sort(privs, function(a, b) return a[1] < b[1] end)
|
||||
|
||||
local rows = {}
|
||||
rows[1] = "#FFF,0,Privilege,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))
|
||||
end
|
||||
|
||||
return LIST_FORMSPEC:format(
|
||||
"Available privileges:",
|
||||
table.concat(rows, ","),
|
||||
"Close"
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
-- DETAILED CHAT COMMAND INFORMATION
|
||||
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "__builtin:help_cmds" or fields.quit then
|
||||
return
|
||||
end
|
||||
|
||||
local event = core.explode_table_event(fields.list)
|
||||
if event.type ~= "INV" then
|
||||
local name = player:get_player_name()
|
||||
core.show_formspec(name, "__builtin:help_cmds",
|
||||
build_chatcommands_formspec(name, event.row, event.type == "DCL"))
|
||||
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)
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
local string_sub, string_find = string.sub, string.find
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function basic_dump(o)
|
||||
local function basic_dump(o)
|
||||
local tp = type(o)
|
||||
if tp == "number" then
|
||||
return tostring(o)
|
||||
@@ -20,6 +20,8 @@ function basic_dump(o)
|
||||
-- dump's output is intended for humans.
|
||||
--elseif tp == "function" then
|
||||
-- return string.format("loadstring(%q)", string.dump(o))
|
||||
elseif tp == "userdata" then
|
||||
return tostring(o)
|
||||
else
|
||||
return string.format("<%s>", tp)
|
||||
end
|
||||
@@ -128,6 +130,7 @@ function dump(o, indent, nested, level)
|
||||
if t ~= "table" then
|
||||
return basic_dump(o)
|
||||
end
|
||||
|
||||
-- Contains table -> true/nil of currently nested tables
|
||||
nested = nested or {}
|
||||
if nested[o] then
|
||||
@@ -136,10 +139,11 @@ function dump(o, indent, nested, level)
|
||||
nested[o] = true
|
||||
indent = indent or "\t"
|
||||
level = level or 1
|
||||
local t = {}
|
||||
|
||||
local ret = {}
|
||||
local dumped_indexes = {}
|
||||
for i, v in ipairs(o) do
|
||||
t[#t + 1] = dump(v, indent, nested, level + 1)
|
||||
ret[#ret + 1] = dump(v, indent, nested, level + 1)
|
||||
dumped_indexes[i] = true
|
||||
end
|
||||
for k, v in pairs(o) do
|
||||
@@ -148,7 +152,7 @@ function dump(o, indent, nested, level)
|
||||
k = "["..dump(k, indent, nested, level + 1).."]"
|
||||
end
|
||||
v = dump(v, indent, nested, level + 1)
|
||||
t[#t + 1] = k.." = "..v
|
||||
ret[#ret + 1] = k.." = "..v
|
||||
end
|
||||
end
|
||||
nested[o] = nil
|
||||
@@ -157,10 +161,10 @@ function dump(o, indent, nested, level)
|
||||
local end_indent_str = "\n"..string.rep(indent, level - 1)
|
||||
return string.format("{%s%s%s}",
|
||||
indent_str,
|
||||
table.concat(t, ","..indent_str),
|
||||
table.concat(ret, ","..indent_str),
|
||||
end_indent_str)
|
||||
end
|
||||
return "{"..table.concat(t, ", ").."}"
|
||||
return "{"..table.concat(ret, ", ").."}"
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -198,28 +202,11 @@ function table.indexof(list, val)
|
||||
return -1
|
||||
end
|
||||
|
||||
assert(table.indexof({"foo", "bar"}, "foo") == 1)
|
||||
assert(table.indexof({"foo", "bar"}, "baz") == -1)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
if INIT ~= "client" then
|
||||
function file_exists(filename)
|
||||
local f = io.open(filename, "r")
|
||||
if f == nil then
|
||||
return false
|
||||
else
|
||||
f:close()
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
function string:trim()
|
||||
return (self:gsub("^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
assert(string.trim("\n \t\tfoo bar\t ") == "foo bar")
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function math.hypot(x, y)
|
||||
local t
|
||||
@@ -244,61 +231,17 @@ function math.sign(x, tolerance)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function get_last_folder(text,count)
|
||||
local parts = text:split(DIR_DELIM)
|
||||
|
||||
if count == nil then
|
||||
return parts[#parts]
|
||||
function math.factorial(x)
|
||||
assert(x % 1 == 0 and x >= 0, "factorial expects a non-negative integer")
|
||||
if x >= 171 then
|
||||
-- 171! is greater than the biggest double, no need to calculate
|
||||
return math.huge
|
||||
end
|
||||
|
||||
local retval = ""
|
||||
for i=1,count,1 do
|
||||
retval = retval .. parts[#parts - (count-i)] .. DIR_DELIM
|
||||
local v = 1
|
||||
for k = 2, x do
|
||||
v = v * k
|
||||
end
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function cleanup_path(temppath)
|
||||
|
||||
local parts = temppath:split("-")
|
||||
temppath = ""
|
||||
for i=1,#parts,1 do
|
||||
if temppath ~= "" then
|
||||
temppath = temppath .. "_"
|
||||
end
|
||||
temppath = temppath .. parts[i]
|
||||
end
|
||||
|
||||
parts = temppath:split(".")
|
||||
temppath = ""
|
||||
for i=1,#parts,1 do
|
||||
if temppath ~= "" then
|
||||
temppath = temppath .. "_"
|
||||
end
|
||||
temppath = temppath .. parts[i]
|
||||
end
|
||||
|
||||
parts = temppath:split("'")
|
||||
temppath = ""
|
||||
for i=1,#parts,1 do
|
||||
if temppath ~= "" then
|
||||
temppath = temppath .. ""
|
||||
end
|
||||
temppath = temppath .. parts[i]
|
||||
end
|
||||
|
||||
parts = temppath:split(" ")
|
||||
temppath = ""
|
||||
for i=1,#parts,1 do
|
||||
if temppath ~= "" then
|
||||
temppath = temppath
|
||||
end
|
||||
temppath = temppath .. parts[i]
|
||||
end
|
||||
|
||||
return temppath
|
||||
return v
|
||||
end
|
||||
|
||||
function core.formspec_escape(text)
|
||||
@@ -349,7 +292,8 @@ if INIT == "game" then
|
||||
return
|
||||
end
|
||||
local undef = core.registered_nodes[unode.name]
|
||||
if undef and undef.on_rightclick then
|
||||
local sneaking = placer and placer:get_player_control().sneak
|
||||
if undef and undef.on_rightclick and not sneaking then
|
||||
return undef.on_rightclick(pointed_thing.under, unode, placer,
|
||||
itemstack, pointed_thing)
|
||||
end
|
||||
@@ -393,9 +337,8 @@ if INIT == "game" then
|
||||
end
|
||||
|
||||
local old_itemstack = ItemStack(itemstack)
|
||||
local new_itemstack, removed = core.item_place_node(
|
||||
itemstack, placer, pointed_thing, param2, prevent_after_place
|
||||
)
|
||||
local new_itemstack = core.item_place_node(itemstack, placer,
|
||||
pointed_thing, param2, prevent_after_place)
|
||||
return infinitestacks and old_itemstack or new_itemstack
|
||||
end
|
||||
|
||||
@@ -404,19 +347,12 @@ if INIT == "game" then
|
||||
--Wrapper for rotate_and_place() to check for sneak and assume Creative mode
|
||||
--implies infinite stacks when performing a 6d rotation.
|
||||
--------------------------------------------------------------------------------
|
||||
local creative_mode_cache = core.settings:get_bool("creative_mode")
|
||||
local function is_creative(name)
|
||||
return creative_mode_cache or
|
||||
core.check_player_privs(name, {creative = true})
|
||||
end
|
||||
|
||||
core.rotate_node = function(itemstack, placer, pointed_thing)
|
||||
local name = placer and placer:get_player_name() or ""
|
||||
local invert_wall = placer and placer:get_player_control().sneak or false
|
||||
core.rotate_and_place(itemstack, placer, pointed_thing,
|
||||
is_creative(name),
|
||||
{invert_wall = invert_wall}, true)
|
||||
return itemstack
|
||||
return core.rotate_and_place(itemstack, placer, pointed_thing,
|
||||
core.is_creative_enabled(name),
|
||||
{invert_wall = invert_wall}, true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -506,9 +442,6 @@ function core.string_to_pos(value)
|
||||
return nil
|
||||
end
|
||||
|
||||
assert(core.string_to_pos("10.0, 5, -2").x == 10)
|
||||
assert(core.string_to_pos("( 10.0, 5, -2)").z == -2)
|
||||
assert(core.string_to_pos("asd, 5, -2)") == nil)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function core.string_to_area(value)
|
||||
@@ -561,6 +494,29 @@ function table.insert_all(t, other)
|
||||
end
|
||||
|
||||
|
||||
function table.key_value_swap(t)
|
||||
local ti = {}
|
||||
for k,v in pairs(t) do
|
||||
ti[v] = k
|
||||
end
|
||||
return ti
|
||||
end
|
||||
|
||||
|
||||
function table.shuffle(t, from, to, random)
|
||||
from = from or 1
|
||||
to = to or #t
|
||||
random = random or math.random
|
||||
local n = to - from + 1
|
||||
while n > 1 do
|
||||
local r = from + n-1
|
||||
local l = from + random(0, n-1)
|
||||
t[l], t[r] = t[r], t[l]
|
||||
n = n-1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- mainmenu only functions
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -742,5 +698,6 @@ function core.privs_to_string(privs, delim)
|
||||
return table.concat(list, delim)
|
||||
end
|
||||
|
||||
assert(core.string_to_privs("a,b").b == true)
|
||||
assert(core.privs_to_string({a=true,b=true}) == "a,b")
|
||||
function core.is_nan(number)
|
||||
return number ~= number
|
||||
end
|
||||
|
||||
@@ -120,15 +120,8 @@ function core.serialize(x)
|
||||
elseif tp == "function" then
|
||||
return string.format("loadstring(%q)", string.dump(x))
|
||||
elseif tp == "number" then
|
||||
-- Serialize integers with string.format to prevent
|
||||
-- scientific notation, which doesn't preserve
|
||||
-- precision and breaks things like node position
|
||||
-- hashes. Serialize floats normally.
|
||||
if math.floor(x) == x then
|
||||
return string.format("%d", x)
|
||||
else
|
||||
return tostring(x)
|
||||
end
|
||||
-- Serialize numbers reversibly with string.format
|
||||
return string.format("%.17g", x)
|
||||
elseif tp == "table" then
|
||||
local vals = {}
|
||||
local idx_dumped = {}
|
||||
@@ -177,13 +170,16 @@ end
|
||||
|
||||
-- Deserialization
|
||||
|
||||
local env = {
|
||||
loadstring = loadstring,
|
||||
}
|
||||
local function safe_loadstring(...)
|
||||
local func, err = loadstring(...)
|
||||
if func then
|
||||
setfenv(func, {})
|
||||
return func
|
||||
end
|
||||
return nil, err
|
||||
end
|
||||
|
||||
local safe_env = {
|
||||
loadstring = function() end,
|
||||
}
|
||||
local function dummy_func() end
|
||||
|
||||
function core.deserialize(str, safe)
|
||||
if type(str) ~= "string" then
|
||||
@@ -195,7 +191,10 @@ function core.deserialize(str, safe)
|
||||
end
|
||||
local f, err = loadstring(str)
|
||||
if not f then return nil, err end
|
||||
setfenv(f, safe and safe_env or env)
|
||||
|
||||
-- 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 good, data = pcall(f)
|
||||
if good then
|
||||
@@ -204,18 +203,3 @@ function core.deserialize(str, safe)
|
||||
return nil, data
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Unit tests
|
||||
local test_in = {cat={sound="nyan", speed=400}, dog={sound="woof"}}
|
||||
local test_out = core.deserialize(core.serialize(test_in))
|
||||
|
||||
assert(test_in.cat.sound == test_out.cat.sound)
|
||||
assert(test_in.cat.speed == test_out.cat.speed)
|
||||
assert(test_in.dog.sound == test_out.dog.sound)
|
||||
|
||||
test_in = {escape_chars="\n\r\t\v\\\"\'", non_european="θשׁ٩∂"}
|
||||
test_out = core.deserialize(core.serialize(test_in))
|
||||
assert(test_in.escape_chars == test_out.escape_chars)
|
||||
assert(test_in.non_european == test_out.non_european)
|
||||
|
||||
|
||||
73
builtin/common/tests/misc_helpers_spec.lua
Normal file
73
builtin/common/tests/misc_helpers_spec.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
_G.core = {}
|
||||
dofile("builtin/common/misc_helpers.lua")
|
||||
|
||||
describe("string", function()
|
||||
it("trim()", function()
|
||||
assert.equal("foo bar", string.trim("\n \t\tfoo bar\t "))
|
||||
end)
|
||||
|
||||
describe("split()", function()
|
||||
it("removes empty", function()
|
||||
assert.same({ "hello" }, string.split("hello"))
|
||||
assert.same({ "hello", "world" }, string.split("hello,world"))
|
||||
assert.same({ "hello", "world" }, string.split("hello,world,,,"))
|
||||
assert.same({ "hello", "world" }, string.split(",,,hello,world"))
|
||||
assert.same({ "hello", "world", "2" }, string.split("hello,,,world,2"))
|
||||
assert.same({ "hello ", " world" }, string.split("hello :| world", ":|"))
|
||||
end)
|
||||
|
||||
it("keeps empty", function()
|
||||
assert.same({ "hello" }, string.split("hello", ",", true))
|
||||
assert.same({ "hello", "world" }, string.split("hello,world", ",", true))
|
||||
assert.same({ "hello", "world", "" }, string.split("hello,world,", ",", true))
|
||||
assert.same({ "hello", "", "", "world", "2" }, string.split("hello,,,world,2", ",", true))
|
||||
assert.same({ "", "", "hello", "world", "2" }, string.split(",,hello,world,2", ",", true))
|
||||
assert.same({ "hello ", " world | :" }, string.split("hello :| world | :", ":|"))
|
||||
end)
|
||||
|
||||
it("max_splits", function()
|
||||
assert.same({ "one" }, string.split("one", ",", true, 2))
|
||||
assert.same({ "one,two,three,four" }, string.split("one,two,three,four", ",", true, 0))
|
||||
assert.same({ "one", "two", "three,four" }, string.split("one,two,three,four", ",", true, 2))
|
||||
assert.same({ "one", "", "two,three,four" }, string.split("one,,two,three,four", ",", true, 2))
|
||||
assert.same({ "one", "two", "three,four" }, string.split("one,,,,,,two,three,four", ",", false, 2))
|
||||
end)
|
||||
|
||||
it("pattern", function()
|
||||
assert.same({ "one", "two" }, string.split("one,two", ",", false, -1, true))
|
||||
assert.same({ "one", "two", "three" }, string.split("one2two3three", "%d", false, -1, true))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("privs", function()
|
||||
it("from string", function()
|
||||
assert.same({ a = true, b = true }, core.string_to_privs("a,b"))
|
||||
end)
|
||||
|
||||
it("to string", function()
|
||||
assert.equal("one", core.privs_to_string({ one=true }))
|
||||
|
||||
local ret = core.privs_to_string({ a=true, b=true })
|
||||
assert(ret == "a,b" or ret == "b,a")
|
||||
end)
|
||||
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.is_nil(core.string_to_pos("asd, 5, -2)"))
|
||||
end)
|
||||
|
||||
it("to string", function()
|
||||
assert.equal("(10.1,5.2,-2.3)", core.pos_to_string({ x = 10.1, y = 5.2, z = -2.3}))
|
||||
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)
|
||||
56
builtin/common/tests/serialize_spec.lua
Normal file
56
builtin/common/tests/serialize_spec.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
_G.core = {}
|
||||
|
||||
_G.setfenv = require 'busted.compatibility'.setfenv
|
||||
|
||||
dofile("builtin/common/serialize.lua")
|
||||
|
||||
describe("serialize", function()
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
end)
|
||||
|
||||
it("handles recursive structures", function()
|
||||
local test_in = { hello = "world" }
|
||||
test_in.foo = test_in
|
||||
|
||||
local test_out = core.deserialize(core.serialize(test_in))
|
||||
assert.same(test_in, test_out)
|
||||
end)
|
||||
|
||||
it("strips functions in safe mode", function()
|
||||
local test_in = {
|
||||
func = function(a, b)
|
||||
error("test")
|
||||
end,
|
||||
foo = "bar"
|
||||
}
|
||||
|
||||
local str = core.serialize(test_in)
|
||||
assert.not_nil(str:find("loadstring"))
|
||||
|
||||
local test_out = core.deserialize(str, true)
|
||||
assert.is_nil(test_out.func)
|
||||
assert.equals(test_out.foo, "bar")
|
||||
end)
|
||||
end)
|
||||
192
builtin/common/tests/vector_spec.lua
Normal file
192
builtin/common/tests/vector_spec.lua
Normal file
@@ -0,0 +1,192 @@
|
||||
_G.vector = {}
|
||||
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 }))
|
||||
|
||||
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)
|
||||
end)
|
||||
|
||||
it("throws on invalid input", function()
|
||||
assert.has.errors(function()
|
||||
vector.new({ x = 3 })
|
||||
end)
|
||||
|
||||
assert.has.errors(function()
|
||||
vector.new({ d = 3 })
|
||||
end)
|
||||
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)
|
||||
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 }))
|
||||
end)
|
||||
|
||||
it("offset()", function()
|
||||
assert.same({ x = 41, y = 52, z = 63 }, vector.offset(vector.new(1, 2, 3), 40, 50, 60))
|
||||
end)
|
||||
|
||||
-- This function is needed because of floating point imprecision.
|
||||
local function almost_equal(a, b)
|
||||
if type(a) == "number" then
|
||||
return math.abs(a - b) < 0.00000000001
|
||||
end
|
||||
return vector.distance(a, b) < 0.000000000001
|
||||
end
|
||||
|
||||
describe("rotate_around_axis()", function()
|
||||
it("rotates", function()
|
||||
assert.True(almost_equal({x = -1, y = 0, z = 0},
|
||||
vector.rotate_around_axis({x = 1, y = 0, z = 0}, {x = 0, y = 1, z = 0}, math.pi)))
|
||||
assert.True(almost_equal({x = 0, y = 1, z = 0},
|
||||
vector.rotate_around_axis({x = 0, y = 0, z = 1}, {x = 1, y = 0, z = 0}, math.pi / 2)))
|
||||
assert.True(almost_equal({x = 4, y = 1, z = 1},
|
||||
vector.rotate_around_axis({x = 4, y = 1, z = 1}, {x = 4, y = 1, z = 1}, math.pi / 6)))
|
||||
end)
|
||||
it("keeps distance to axis", function()
|
||||
local rotate1 = {x = 1, y = 3, z = 1}
|
||||
local axis1 = {x = 1, y = 3, z = 2}
|
||||
local rotated1 = vector.rotate_around_axis(rotate1, axis1, math.pi / 13)
|
||||
assert.True(almost_equal(vector.distance(axis1, rotate1), vector.distance(axis1, rotated1)))
|
||||
local rotate2 = {x = 1, y = 1, z = 3}
|
||||
local axis2 = {x = 2, y = 6, z = 100}
|
||||
local rotated2 = vector.rotate_around_axis(rotate2, axis2, math.pi / 23)
|
||||
assert.True(almost_equal(vector.distance(axis2, rotate2), vector.distance(axis2, rotated2)))
|
||||
local rotate3 = {x = 1, y = -1, z = 3}
|
||||
local axis3 = {x = 2, y = 6, z = 100}
|
||||
local rotated3 = vector.rotate_around_axis(rotate3, axis3, math.pi / 2)
|
||||
assert.True(almost_equal(vector.distance(axis3, rotate3), vector.distance(axis3, rotated3)))
|
||||
end)
|
||||
it("rotates back", function()
|
||||
local rotate1 = {x = 1, y = 3, z = 1}
|
||||
local axis1 = {x = 1, y = 3, z = 2}
|
||||
local rotated1 = vector.rotate_around_axis(rotate1, axis1, math.pi / 13)
|
||||
rotated1 = vector.rotate_around_axis(rotated1, axis1, -math.pi / 13)
|
||||
assert.True(almost_equal(rotate1, rotated1))
|
||||
local rotate2 = {x = 1, y = 1, z = 3}
|
||||
local axis2 = {x = 2, y = 6, z = 100}
|
||||
local rotated2 = vector.rotate_around_axis(rotate2, axis2, math.pi / 23)
|
||||
rotated2 = vector.rotate_around_axis(rotated2, axis2, -math.pi / 23)
|
||||
assert.True(almost_equal(rotate2, rotated2))
|
||||
local rotate3 = {x = 1, y = -1, z = 3}
|
||||
local axis3 = {x = 2, y = 6, z = 100}
|
||||
local rotated3 = vector.rotate_around_axis(rotate3, axis3, math.pi / 2)
|
||||
rotated3 = vector.rotate_around_axis(rotated3, axis3, -math.pi / 2)
|
||||
assert.True(almost_equal(rotate3, rotated3))
|
||||
end)
|
||||
it("is right handed", function()
|
||||
local v_before1 = {x = 0, y = 1, z = -1}
|
||||
local v_after1 = vector.rotate_around_axis(v_before1, {x = 1, y = 0, z = 0}, math.pi / 4)
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after1, v_before1)), {x = 1, y = 0, z = 0}))
|
||||
|
||||
local v_before2 = {x = 0, y = 3, z = 4}
|
||||
local v_after2 = vector.rotate_around_axis(v_before2, {x = 1, y = 0, z = 0}, 2 * math.pi / 5)
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after2, v_before2)), {x = 1, y = 0, z = 0}))
|
||||
|
||||
local v_before3 = {x = 1, y = 0, z = -1}
|
||||
local v_after3 = vector.rotate_around_axis(v_before3, {x = 0, y = 1, z = 0}, math.pi / 4)
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after3, v_before3)), {x = 0, y = 1, z = 0}))
|
||||
|
||||
local v_before4 = {x = 3, y = 0, z = 4}
|
||||
local v_after4 = vector.rotate_around_axis(v_before4, {x = 0, y = 1, z = 0}, 2 * math.pi / 5)
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after4, v_before4)), {x = 0, y = 1, z = 0}))
|
||||
|
||||
local v_before5 = {x = 1, y = -1, z = 0}
|
||||
local v_after5 = vector.rotate_around_axis(v_before5, {x = 0, y = 0, z = 1}, math.pi / 4)
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after5, v_before5)), {x = 0, y = 0, z = 1}))
|
||||
|
||||
local v_before6 = {x = 3, y = 4, z = 0}
|
||||
local v_after6 = vector.rotate_around_axis(v_before6, {x = 0, y = 0, z = 1}, 2 * math.pi / 5)
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after6, v_before6)), {x = 0, y = 0, z = 1}))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("rotate()", function()
|
||||
it("rotates", function()
|
||||
assert.True(almost_equal({x = -1, y = 0, z = 0},
|
||||
vector.rotate({x = 1, y = 0, z = 0}, {x = 0, y = math.pi, z = 0})))
|
||||
assert.True(almost_equal({x = 0, y = -1, z = 0},
|
||||
vector.rotate({x = 1, y = 0, z = 0}, {x = 0, y = 0, z = math.pi / 2})))
|
||||
assert.True(almost_equal({x = 1, y = 0, z = 0},
|
||||
vector.rotate({x = 1, y = 0, z = 0}, {x = math.pi / 123, y = 0, z = 0})))
|
||||
end)
|
||||
it("is counterclockwise", function()
|
||||
local v_before1 = {x = 0, y = 1, z = -1}
|
||||
local v_after1 = vector.rotate(v_before1, {x = math.pi / 4, y = 0, z = 0})
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after1, v_before1)), {x = 1, y = 0, z = 0}))
|
||||
|
||||
local v_before2 = {x = 0, y = 3, z = 4}
|
||||
local v_after2 = vector.rotate(v_before2, {x = 2 * math.pi / 5, y = 0, z = 0})
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after2, v_before2)), {x = 1, y = 0, z = 0}))
|
||||
|
||||
local v_before3 = {x = 1, y = 0, z = -1}
|
||||
local v_after3 = vector.rotate(v_before3, {x = 0, y = math.pi / 4, z = 0})
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after3, v_before3)), {x = 0, y = 1, z = 0}))
|
||||
|
||||
local v_before4 = {x = 3, y = 0, z = 4}
|
||||
local v_after4 = vector.rotate(v_before4, {x = 0, y = 2 * math.pi / 5, z = 0})
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after4, v_before4)), {x = 0, y = 1, z = 0}))
|
||||
|
||||
local v_before5 = {x = 1, y = -1, z = 0}
|
||||
local v_after5 = vector.rotate(v_before5, {x = 0, y = 0, z = math.pi / 4})
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after5, v_before5)), {x = 0, y = 0, z = 1}))
|
||||
|
||||
local v_before6 = {x = 3, y = 4, z = 0}
|
||||
local v_after6 = vector.rotate(v_before6, {x = 0, y = 0, z = 2 * math.pi / 5})
|
||||
assert.True(almost_equal(vector.normalize(vector.cross(v_after6, v_before6)), {x = 0, y = 0, z = 1}))
|
||||
end)
|
||||
end)
|
||||
|
||||
it("dir_to_rotation()", function()
|
||||
-- Comparing rotations (pitch, yaw, roll) is hard because of certain ambiguities,
|
||||
-- e.g. (pi, 0, pi) looks exactly the same as (0, pi, 0)
|
||||
-- So instead we convert the rotation back to vectors and compare these.
|
||||
local function forward_at_rot(rot)
|
||||
return vector.rotate(vector.new(0, 0, 1), rot)
|
||||
end
|
||||
local function up_at_rot(rot)
|
||||
return vector.rotate(vector.new(0, 1, 0), rot)
|
||||
end
|
||||
local rot1 = vector.dir_to_rotation({x = 1, y = 0, z = 0}, {x = 0, y = 1, z = 0})
|
||||
assert.True(almost_equal({x = 1, y = 0, z = 0}, forward_at_rot(rot1)))
|
||||
assert.True(almost_equal({x = 0, y = 1, z = 0}, up_at_rot(rot1)))
|
||||
local rot2 = vector.dir_to_rotation({x = 1, y = 1, z = 0}, {x = 0, y = 0, z = 1})
|
||||
assert.True(almost_equal({x = 1/math.sqrt(2), y = 1/math.sqrt(2), z = 0}, forward_at_rot(rot2)))
|
||||
assert.True(almost_equal({x = 0, y = 0, z = 1}, up_at_rot(rot2)))
|
||||
for i = 1, 1000 do
|
||||
local rand_vec = vector.new(math.random(), math.random(), math.random())
|
||||
if vector.length(rand_vec) ~= 0 then
|
||||
local rot_1 = vector.dir_to_rotation(rand_vec)
|
||||
local rot_2 = {
|
||||
x = math.atan2(rand_vec.y, math.sqrt(rand_vec.z * rand_vec.z + rand_vec.x * rand_vec.x)),
|
||||
y = -math.atan2(rand_vec.x, rand_vec.z),
|
||||
z = 0
|
||||
}
|
||||
assert.True(almost_equal(rot_1, rot_2))
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
end)
|
||||
@@ -70,6 +70,25 @@ function vector.direction(pos1, pos2)
|
||||
})
|
||||
end
|
||||
|
||||
function vector.angle(a, b)
|
||||
local dotp = vector.dot(a, b)
|
||||
local cp = vector.cross(a, b)
|
||||
local crossplen = vector.length(cp)
|
||||
return math.atan2(crossplen, dotp)
|
||||
end
|
||||
|
||||
function vector.dot(a, b)
|
||||
return a.x * b.x + a.y * b.y + a.z * b.z
|
||||
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
|
||||
}
|
||||
end
|
||||
|
||||
function vector.add(a, b)
|
||||
if type(b) == "table" then
|
||||
return {x = a.x + b.x,
|
||||
@@ -118,7 +137,106 @@ function vector.divide(a, b)
|
||||
end
|
||||
end
|
||||
|
||||
function vector.offset(v, x, y, z)
|
||||
return {x = v.x + x,
|
||||
y = v.y + y,
|
||||
z = 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)}
|
||||
end
|
||||
|
||||
local function sin(x)
|
||||
if x % math.pi == 0 then
|
||||
return 0
|
||||
else
|
||||
return math.sin(x)
|
||||
end
|
||||
end
|
||||
|
||||
local function cos(x)
|
||||
if x % math.pi == math.pi / 2 then
|
||||
return 0
|
||||
else
|
||||
return math.cos(x)
|
||||
end
|
||||
end
|
||||
|
||||
function vector.rotate_around_axis(v, axis, angle)
|
||||
local cosangle = cos(angle)
|
||||
local sinangle = sin(angle)
|
||||
axis = vector.normalize(axis)
|
||||
-- https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula
|
||||
local dot_axis = vector.multiply(axis, vector.dot(axis, v))
|
||||
local cross = vector.cross(v, axis)
|
||||
return vector.new(
|
||||
cross.x * sinangle + (v.x - dot_axis.x) * cosangle + dot_axis.x,
|
||||
cross.y * sinangle + (v.y - dot_axis.y) * cosangle + dot_axis.y,
|
||||
cross.z * sinangle + (v.z - dot_axis.z) * cosangle + dot_axis.z
|
||||
)
|
||||
end
|
||||
|
||||
function vector.rotate(v, rot)
|
||||
local sinpitch = sin(-rot.x)
|
||||
local sinyaw = sin(-rot.y)
|
||||
local sinroll = sin(-rot.z)
|
||||
local cospitch = cos(rot.x)
|
||||
local cosyaw = cos(rot.y)
|
||||
local cosroll = math.cos(rot.z)
|
||||
-- Rotation matrix that applies yaw, pitch and roll
|
||||
local matrix = {
|
||||
{
|
||||
sinyaw * sinpitch * sinroll + cosyaw * cosroll,
|
||||
sinyaw * sinpitch * cosroll - cosyaw * sinroll,
|
||||
sinyaw * cospitch,
|
||||
},
|
||||
{
|
||||
cospitch * sinroll,
|
||||
cospitch * cosroll,
|
||||
-sinpitch,
|
||||
},
|
||||
{
|
||||
cosyaw * sinpitch * sinroll - sinyaw * cosroll,
|
||||
cosyaw * sinpitch * cosroll + sinyaw * sinroll,
|
||||
cosyaw * cospitch,
|
||||
},
|
||||
}
|
||||
-- Compute matrix multiplication: `matrix` * `v`
|
||||
return vector.new(
|
||||
matrix[1][1] * v.x + matrix[1][2] * v.y + matrix[1][3] * v.z,
|
||||
matrix[2][1] * v.x + matrix[2][2] * v.y + matrix[2][3] * v.z,
|
||||
matrix[3][1] * v.x + matrix[3][2] * v.y + matrix[3][3] * v.z
|
||||
)
|
||||
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}
|
||||
if not up then
|
||||
return rot
|
||||
end
|
||||
assert(vector.dot(forward, up) < 0.000001,
|
||||
"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)
|
||||
-- '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)
|
||||
|
||||
-- Since vector.angle never returns a negative value or a value greater
|
||||
-- than math.pi, rot.z has to be inverted sometimes.
|
||||
-- To determine wether this is the case, we rotate the up vector back around
|
||||
-- the forward vector and check if it worked out.
|
||||
local back = vector.rotate_around_axis(up, forward, -rot.z)
|
||||
|
||||
-- We don't use vector.equals for this because of floating point imprecision.
|
||||
if (back.x - forwup.x) * (back.x - forwup.x) +
|
||||
(back.y - forwup.y) * (back.y - forwup.y) +
|
||||
(back.z - forwup.z) * (back.z - forwup.z) > 0.0000001 then
|
||||
rot.z = -rot.z
|
||||
end
|
||||
return rot
|
||||
end
|
||||
|
||||
@@ -67,3 +67,22 @@ function dialog_create(name,get_formspec,buttonhandler,eventhandler)
|
||||
ui.add(self)
|
||||
return self
|
||||
end
|
||||
|
||||
function messagebox(name, message)
|
||||
return dialog_create(name,
|
||||
function()
|
||||
return ([[
|
||||
formspec_version[3]
|
||||
size[8,3]
|
||||
textarea[0.375,0.375;7.25,1.2;;;%s]
|
||||
button[3,1.825;2,0.8;ok;%s]
|
||||
]]):format(message, fgettext("OK"))
|
||||
end,
|
||||
function(this, fields)
|
||||
if fields.ok then
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
end,
|
||||
nil)
|
||||
end
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
ui = {}
|
||||
ui.childlist = {}
|
||||
ui.default = nil
|
||||
-- Whether fstk is currently showing its own formspec instead of active ui elements.
|
||||
ui.overridden = false
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function ui.add(child)
|
||||
@@ -54,52 +56,44 @@ end
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local function wordwrap_quickhack(str)
|
||||
local res = ""
|
||||
local ar = str:split("\n")
|
||||
for i = 1, #ar do
|
||||
local text = ar[i]
|
||||
-- Hack to add word wrapping.
|
||||
-- TODO: Add engine support for wrapping in formspecs
|
||||
while #text > 80 do
|
||||
if res ~= "" then
|
||||
res = res .. ","
|
||||
end
|
||||
res = res .. core.formspec_escape(string.sub(text, 1, 79))
|
||||
text = string.sub(text, 80, #text)
|
||||
end
|
||||
if res ~= "" then
|
||||
res = res .. ","
|
||||
end
|
||||
res = res .. core.formspec_escape(text)
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function ui.update()
|
||||
local formspec = ""
|
||||
ui.overridden = false
|
||||
local formspec = {}
|
||||
|
||||
-- handle errors
|
||||
if gamedata ~= nil and gamedata.reconnect_requested then
|
||||
formspec = wordwrap_quickhack(gamedata.errormessage or "")
|
||||
formspec = "size[12,5]" ..
|
||||
"label[0.5,0;" .. fgettext("The server has requested a reconnect:") ..
|
||||
"]textlist[0.2,0.8;11.5,3.5;;" .. formspec ..
|
||||
"]button[6,4.6;3,0.5;btn_reconnect_no;" .. fgettext("Main menu") .. "]" ..
|
||||
"button[3,4.6;3,0.5;btn_reconnect_yes;" .. fgettext("Reconnect") .. "]"
|
||||
local error_message = core.formspec_escape(
|
||||
gamedata.errormessage or "<none available>")
|
||||
formspec = {
|
||||
"size[14,8]",
|
||||
"real_coordinates[true]",
|
||||
"set_focus[btn_reconnect_yes;true]",
|
||||
"box[0.5,1.2;13,5;#000]",
|
||||
("textarea[0.5,1.2;13,5;;%s;%s]"):format(
|
||||
fgettext("The server has requested a reconnect:"), error_message),
|
||||
"button[2,6.6;4,1;btn_reconnect_yes;" .. fgettext("Reconnect") .. "]",
|
||||
"button[8,6.6;4,1;btn_reconnect_no;" .. fgettext("Main menu") .. "]"
|
||||
}
|
||||
ui.overridden = true
|
||||
elseif gamedata ~= nil and gamedata.errormessage ~= nil then
|
||||
formspec = wordwrap_quickhack(gamedata.errormessage)
|
||||
local error_message = core.formspec_escape(gamedata.errormessage)
|
||||
|
||||
local error_title
|
||||
if string.find(gamedata.errormessage, "ModError") then
|
||||
error_title = fgettext("An error occurred in a Lua script, such as a mod:")
|
||||
error_title = fgettext("An error occurred in a Lua script:")
|
||||
else
|
||||
error_title = fgettext("An error occurred:")
|
||||
end
|
||||
formspec = "size[12,5]" ..
|
||||
"label[0.5,0;" .. error_title ..
|
||||
"]textlist[0.2,0.8;11.5,3.5;;" .. formspec ..
|
||||
"]button[4.5,4.6;3,0.5;btn_error_confirm;" .. fgettext("Ok") .. "]"
|
||||
formspec = {
|
||||
"size[14,8]",
|
||||
"real_coordinates[true]",
|
||||
"set_focus[btn_error_confirm;true]",
|
||||
"box[0.5,1.2;13,5;#000]",
|
||||
("textarea[0.5,1.2;13,5;;%s;%s]"):format(
|
||||
error_title, error_message),
|
||||
"button[5,6.6;4,1;btn_error_confirm;" .. fgettext("OK") .. "]"
|
||||
}
|
||||
ui.overridden = true
|
||||
else
|
||||
local active_toplevel_ui_elements = 0
|
||||
for key,value in pairs(ui.childlist) do
|
||||
@@ -107,8 +101,8 @@ function ui.update()
|
||||
local retval = value:get_formspec()
|
||||
|
||||
if retval ~= nil and retval ~= "" then
|
||||
active_toplevel_ui_elements = active_toplevel_ui_elements +1
|
||||
formspec = formspec .. retval
|
||||
active_toplevel_ui_elements = active_toplevel_ui_elements + 1
|
||||
table.insert(formspec, retval)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -120,7 +114,7 @@ function ui.update()
|
||||
local retval = value:get_formspec()
|
||||
|
||||
if retval ~= nil and retval ~= "" then
|
||||
formspec = formspec .. retval
|
||||
table.insert(formspec, retval)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -135,10 +129,10 @@ function ui.update()
|
||||
core.log("warning", "no toplevel ui element "..
|
||||
"active; switching to default")
|
||||
ui.childlist[ui.default]:show()
|
||||
formspec = ui.childlist[ui.default]:get_formspec()
|
||||
formspec = {ui.childlist[ui.default]:get_formspec()}
|
||||
end
|
||||
end
|
||||
core.update_formspec(formspec)
|
||||
core.update_formspec(table.concat(formspec))
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -196,6 +190,16 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
core.event_handler = function(event)
|
||||
-- Handle error messages
|
||||
if ui.overridden then
|
||||
if event == "MenuQuit" then
|
||||
gamedata.errormessage = nil
|
||||
gamedata.reconnect_requested = false
|
||||
ui.update()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if ui.handle_events(event) then
|
||||
ui.update()
|
||||
return
|
||||
|
||||
@@ -41,7 +41,6 @@ core.builtin_auth_handler = {
|
||||
return {
|
||||
password = auth_entry.password,
|
||||
privileges = privileges,
|
||||
-- Is set to nil if unknown
|
||||
last_login = auth_entry.last_login,
|
||||
}
|
||||
end,
|
||||
@@ -53,7 +52,7 @@ core.builtin_auth_handler = {
|
||||
name = name,
|
||||
password = password,
|
||||
privileges = core.string_to_privs(core.settings:get("default_privs")),
|
||||
last_login = os.time(),
|
||||
last_login = -1, -- Defer login time calculation until record_login (called by on_joinplayer)
|
||||
})
|
||||
end,
|
||||
delete_auth = function(name)
|
||||
|
||||
@@ -1,4 +1,43 @@
|
||||
-- Minetest: builtin/game/chatcommands.lua
|
||||
-- Minetest: builtin/game/chat.lua
|
||||
|
||||
-- Helper function that implements search and replace without pattern matching
|
||||
-- Returns the string and a boolean indicating whether or not the string was modified
|
||||
local function safe_gsub(s, replace, with)
|
||||
local i1, i2 = s:find(replace, 1, true)
|
||||
if not i1 then
|
||||
return s, false
|
||||
end
|
||||
|
||||
return s:sub(1, i1 - 1) .. with .. s:sub(i2 + 1), true
|
||||
end
|
||||
|
||||
--
|
||||
-- Chat message formatter
|
||||
--
|
||||
|
||||
-- Implemented in Lua to allow redefinition
|
||||
function core.format_chat_message(name, message)
|
||||
local error_str = "Invalid chat message format - missing %s"
|
||||
local str = core.settings:get("chat_message_format")
|
||||
local replaced
|
||||
|
||||
-- Name
|
||||
str, replaced = safe_gsub(str, "@name", name)
|
||||
if not replaced then
|
||||
error(error_str:format("@name"), 2)
|
||||
end
|
||||
|
||||
-- Timestamp
|
||||
str = safe_gsub(str, "@timestamp", os.date("%H:%M:%S", os.time()))
|
||||
|
||||
-- Insert the message into the string only after finishing all other processing
|
||||
str, replaced = safe_gsub(str, "@message", message)
|
||||
if not replaced then
|
||||
error(error_str:format("@message"), 2)
|
||||
end
|
||||
|
||||
return str
|
||||
end
|
||||
|
||||
--
|
||||
-- Chat command handler
|
||||
@@ -19,6 +58,11 @@ core.register_on_chat_message(function(name, message)
|
||||
|
||||
param = param or ""
|
||||
|
||||
-- Run core.registered_on_chatcommands callbacks.
|
||||
if core.run_callbacks(core.registered_on_chatcommands, 5, name, cmd, param) then
|
||||
return true
|
||||
end
|
||||
|
||||
local cmd_def = core.registered_chatcommands[cmd]
|
||||
if not cmd_def then
|
||||
core.chat_send_player(name, "-!- Invalid command: " .. cmd)
|
||||
@@ -27,9 +71,18 @@ core.register_on_chat_message(function(name, message)
|
||||
local has_privs, missing_privs = core.check_player_privs(name, cmd_def.privs)
|
||||
if has_privs then
|
||||
core.set_last_run_mod(cmd_def.mod_origin)
|
||||
local success, message = cmd_def.func(name, param)
|
||||
if message then
|
||||
core.chat_send_player(name, message)
|
||||
local success, result = cmd_def.func(name, param)
|
||||
if success == false and result == nil then
|
||||
core.chat_send_player(name, "-!- Invalid command usage")
|
||||
local help_def = core.registered_chatcommands["help"]
|
||||
if help_def then
|
||||
local _, helpmsg = help_def.func(name, cmd)
|
||||
if helpmsg then
|
||||
core.chat_send_player(name, helpmsg)
|
||||
end
|
||||
end
|
||||
elseif result then
|
||||
core.chat_send_player(name, result)
|
||||
end
|
||||
else
|
||||
core.chat_send_player(name, "You don't have permission"
|
||||
@@ -76,6 +129,7 @@ core.register_chatcommand("me", {
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
core.chat_send_all("* " .. name .. " " .. param)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -102,7 +156,7 @@ core.register_chatcommand("privs", {
|
||||
end
|
||||
return true, "Privileges of " .. name .. ": "
|
||||
.. core.privs_to_string(
|
||||
core.get_player_privs(name), ' ')
|
||||
core.get_player_privs(name), ", ")
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -125,10 +179,10 @@ core.register_chatcommand("haspriv", {
|
||||
if core.check_player_privs(player_name, privs) then
|
||||
table.insert(players_with_priv, player_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
return true, "Players online with the \"" .. param .. "\" privilege: " ..
|
||||
table.concat(players_with_priv, ", ")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
local function handle_grant_command(caller, grantname, grantprivstr)
|
||||
@@ -161,6 +215,7 @@ local function handle_grant_command(caller, grantname, grantprivstr)
|
||||
return false, privs_unknown
|
||||
end
|
||||
for priv, _ in pairs(grantprivs) do
|
||||
-- call the on_grant callbacks
|
||||
core.run_priv_callbacks(grantname, priv, caller, "grant")
|
||||
end
|
||||
core.set_player_privs(grantname, privs)
|
||||
@@ -198,56 +253,76 @@ core.register_chatcommand("grantme", {
|
||||
end,
|
||||
})
|
||||
|
||||
local function handle_revoke_command(caller, revokename, revokeprivstr)
|
||||
local caller_privs = core.get_player_privs(caller)
|
||||
if not (caller_privs.privs or caller_privs.basic_privs) then
|
||||
return false, "Your privileges are insufficient."
|
||||
end
|
||||
|
||||
if not core.get_auth_handler().get_auth(revokename) then
|
||||
return false, "Player " .. revokename .. " does not exist."
|
||||
end
|
||||
|
||||
local revokeprivs = core.string_to_privs(revokeprivstr)
|
||||
local privs = core.get_player_privs(revokename)
|
||||
local basic_privs =
|
||||
core.string_to_privs(core.settings:get("basic_privs") or "interact,shout")
|
||||
for priv, _ in pairs(revokeprivs) do
|
||||
if not basic_privs[priv] and not caller_privs.privs then
|
||||
return false, "Your privileges are insufficient."
|
||||
end
|
||||
end
|
||||
|
||||
if revokeprivstr == "all" then
|
||||
revokeprivs = privs
|
||||
privs = {}
|
||||
else
|
||||
for priv, _ in pairs(revokeprivs) do
|
||||
privs[priv] = nil
|
||||
end
|
||||
end
|
||||
|
||||
for priv, _ in pairs(revokeprivs) do
|
||||
-- call the on_revoke callbacks
|
||||
core.run_priv_callbacks(revokename, priv, caller, "revoke")
|
||||
end
|
||||
|
||||
core.set_player_privs(revokename, privs)
|
||||
core.log("action", caller..' revoked ('
|
||||
..core.privs_to_string(revokeprivs, ', ')
|
||||
..') privileges from '..revokename)
|
||||
if revokename ~= caller then
|
||||
core.chat_send_player(revokename, caller
|
||||
.. " revoked privileges from you: "
|
||||
.. core.privs_to_string(revokeprivs, ' '))
|
||||
end
|
||||
return true, "Privileges of " .. revokename .. ": "
|
||||
.. core.privs_to_string(
|
||||
core.get_player_privs(revokename), ' ')
|
||||
end
|
||||
|
||||
core.register_chatcommand("revoke", {
|
||||
params = "<name> (<privilege> | all)",
|
||||
description = "Remove privileges from player",
|
||||
privs = {},
|
||||
func = function(name, param)
|
||||
if not core.check_player_privs(name, {privs=true}) and
|
||||
not core.check_player_privs(name, {basic_privs=true}) then
|
||||
return false, "Your privileges are insufficient."
|
||||
end
|
||||
local revoke_name, revoke_priv_str = string.match(param, "([^ ]+) (.+)")
|
||||
if not revoke_name or not revoke_priv_str then
|
||||
local revokename, revokeprivstr = string.match(param, "([^ ]+) (.+)")
|
||||
if not revokename or not revokeprivstr then
|
||||
return false, "Invalid parameters (see /help revoke)"
|
||||
elseif not core.get_auth_handler().get_auth(revoke_name) then
|
||||
return false, "Player " .. revoke_name .. " does not exist."
|
||||
end
|
||||
local revoke_privs = core.string_to_privs(revoke_priv_str)
|
||||
local privs = core.get_player_privs(revoke_name)
|
||||
local basic_privs =
|
||||
core.string_to_privs(core.settings:get("basic_privs") or "interact,shout")
|
||||
for priv, _ in pairs(revoke_privs) do
|
||||
if not basic_privs[priv] and
|
||||
not core.check_player_privs(name, {privs=true}) then
|
||||
return false, "Your privileges are insufficient."
|
||||
end
|
||||
end
|
||||
if revoke_priv_str == "all" then
|
||||
revoke_privs = privs
|
||||
privs = {}
|
||||
else
|
||||
for priv, _ in pairs(revoke_privs) do
|
||||
privs[priv] = nil
|
||||
end
|
||||
end
|
||||
return handle_revoke_command(name, revokename, revokeprivstr)
|
||||
end,
|
||||
})
|
||||
|
||||
for priv, _ in pairs(revoke_privs) do
|
||||
core.run_priv_callbacks(revoke_name, priv, name, "revoke")
|
||||
core.register_chatcommand("revokeme", {
|
||||
params = "<privilege> | all",
|
||||
description = "Revoke privileges from yourself",
|
||||
privs = {},
|
||||
func = function(name, param)
|
||||
if param == "" then
|
||||
return false, "Invalid parameters (see /help revokeme)"
|
||||
end
|
||||
|
||||
core.set_player_privs(revoke_name, privs)
|
||||
core.log("action", name..' revoked ('
|
||||
..core.privs_to_string(revoke_privs, ', ')
|
||||
..') privileges from '..revoke_name)
|
||||
if revoke_name ~= name then
|
||||
core.chat_send_player(revoke_name, name
|
||||
.. " revoked privileges from you: "
|
||||
.. core.privs_to_string(revoke_privs, ' '))
|
||||
end
|
||||
return true, "Privileges of " .. revoke_name .. ": "
|
||||
.. core.privs_to_string(
|
||||
core.get_player_privs(revoke_name), ' ')
|
||||
return handle_revoke_command(name, name, param)
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -261,11 +336,12 @@ core.register_chatcommand("setpassword", {
|
||||
toname = param:match("^([^ ]+) *$")
|
||||
raw_password = nil
|
||||
end
|
||||
|
||||
if not toname then
|
||||
return false, "Name field required"
|
||||
end
|
||||
local act_str_past = "?"
|
||||
local act_str_pres = "?"
|
||||
|
||||
local act_str_past, act_str_pres
|
||||
if not raw_password then
|
||||
core.set_player_password(toname, "")
|
||||
act_str_past = "cleared"
|
||||
@@ -277,13 +353,14 @@ core.register_chatcommand("setpassword", {
|
||||
act_str_past = "set"
|
||||
act_str_pres = "sets"
|
||||
end
|
||||
|
||||
if toname ~= name then
|
||||
core.chat_send_player(toname, "Your password was "
|
||||
.. act_str_past .. " by " .. name)
|
||||
end
|
||||
|
||||
core.log("action", name .. " " .. act_str_pres
|
||||
.. " password of " .. toname .. ".")
|
||||
core.log("action", name .. " " .. act_str_pres ..
|
||||
" password of " .. toname .. ".")
|
||||
|
||||
return true, "Password of player \"" .. toname .. "\" " .. act_str_past
|
||||
end,
|
||||
@@ -367,36 +444,42 @@ core.register_chatcommand("teleport", {
|
||||
return pos, false
|
||||
end
|
||||
|
||||
local teleportee = nil
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(param, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
if p.x and p.y and p.z then
|
||||
|
||||
local lm = 31000
|
||||
if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm or p.z < -lm or p.z > lm then
|
||||
return false, "Cannot teleport out of map bounds!"
|
||||
end
|
||||
teleportee = core.get_player_by_name(name)
|
||||
local teleportee = core.get_player_by_name(name)
|
||||
if teleportee then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, you're attached to an object!"
|
||||
end
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting to "..core.pos_to_string(p)
|
||||
end
|
||||
end
|
||||
|
||||
local teleportee = nil
|
||||
local p = nil
|
||||
local target_name = nil
|
||||
target_name = param:match("^([^ ]+)$")
|
||||
teleportee = core.get_player_by_name(name)
|
||||
local target_name = param:match("^([^ ]+)$")
|
||||
local teleportee = core.get_player_by_name(name)
|
||||
|
||||
p = nil
|
||||
if target_name then
|
||||
local target = core.get_player_by_name(target_name)
|
||||
if target then
|
||||
p = target:get_pos()
|
||||
end
|
||||
end
|
||||
|
||||
if teleportee and p then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, you're attached to an object!"
|
||||
end
|
||||
p = find_free_position_near(p)
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting to " .. target_name
|
||||
@@ -407,9 +490,9 @@ core.register_chatcommand("teleport", {
|
||||
return false, "You don't have permission to teleport other players (missing bring privilege)"
|
||||
end
|
||||
|
||||
local teleportee = nil
|
||||
local p = {}
|
||||
local teleportee_name = nil
|
||||
teleportee = nil
|
||||
p = {}
|
||||
local teleportee_name
|
||||
teleportee_name, p.x, p.y, p.z = param:match(
|
||||
"^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
p.x, p.y, p.z = tonumber(p.x), tonumber(p.y), tonumber(p.z)
|
||||
@@ -417,15 +500,16 @@ core.register_chatcommand("teleport", {
|
||||
teleportee = core.get_player_by_name(teleportee_name)
|
||||
end
|
||||
if teleportee and p.x and p.y and p.z then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, player is attached to an object!"
|
||||
end
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting " .. teleportee_name
|
||||
.. " to " .. core.pos_to_string(p)
|
||||
end
|
||||
|
||||
local teleportee = nil
|
||||
local p = nil
|
||||
local teleportee_name = nil
|
||||
local target_name = nil
|
||||
teleportee = nil
|
||||
p = nil
|
||||
teleportee_name, target_name = string.match(param, "^([^ ]+) +([^ ]+)$")
|
||||
if teleportee_name then
|
||||
teleportee = core.get_player_by_name(teleportee_name)
|
||||
@@ -437,6 +521,9 @@ core.register_chatcommand("teleport", {
|
||||
end
|
||||
end
|
||||
if teleportee and p then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, player is attached to an object!"
|
||||
end
|
||||
p = find_free_position_near(p)
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting " .. teleportee_name
|
||||
@@ -459,7 +546,8 @@ core.register_chatcommand("set", {
|
||||
core.settings:set(setname, setvalue)
|
||||
return true, setname .. " = " .. setvalue
|
||||
end
|
||||
local setname, setvalue = string.match(param, "([^ ]+) (.+)")
|
||||
|
||||
setname, setvalue = string.match(param, "([^ ]+) (.+)")
|
||||
if setname and setvalue then
|
||||
if not core.settings:get(setname) then
|
||||
return false, "Failed. Use '/set -n <name> <value>' to create a new setting."
|
||||
@@ -467,14 +555,16 @@ core.register_chatcommand("set", {
|
||||
core.settings:set(setname, setvalue)
|
||||
return true, setname .. " = " .. setvalue
|
||||
end
|
||||
local setname = string.match(param, "([^ ]+)")
|
||||
|
||||
setname = string.match(param, "([^ ]+)")
|
||||
if setname then
|
||||
local setvalue = core.settings:get(setname)
|
||||
setvalue = core.settings:get(setname)
|
||||
if not setvalue then
|
||||
setvalue = "<not set>"
|
||||
end
|
||||
return true, setname .. " = " .. setvalue
|
||||
end
|
||||
|
||||
return false, "Invalid parameters (see /help set)."
|
||||
end,
|
||||
})
|
||||
@@ -672,8 +762,9 @@ core.register_chatcommand("spawnentity", {
|
||||
end
|
||||
end
|
||||
p.y = p.y + 1
|
||||
core.add_entity(p, entityname)
|
||||
return true, ("%q spawned."):format(entityname)
|
||||
local obj = core.add_entity(p, entityname)
|
||||
local msg = obj and "%q spawned." or "%q failed to spawn."
|
||||
return true, msg:format(entityname)
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -692,7 +783,7 @@ core.register_chatcommand("pulverize", {
|
||||
end
|
||||
core.log("action", name .. " pulverized \"" ..
|
||||
wielded_item:get_name() .. " " .. wielded_item:get_count() .. "\"")
|
||||
player:set_wielded_item(nil)
|
||||
player:set_wielded_item(nil)
|
||||
return true, "An item was pulverized."
|
||||
end,
|
||||
})
|
||||
@@ -712,7 +803,7 @@ core.register_chatcommand("rollback_check", {
|
||||
params = "[<range>] [<seconds>] [<limit>]",
|
||||
description = "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",
|
||||
.. " seconds = 86400 = 24h, limit = 5. Set <seconds> to inf for no time limit",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.settings:get_bool("enable_rollback_recording") then
|
||||
@@ -763,7 +854,7 @@ core.register_chatcommand("rollback_check", {
|
||||
|
||||
core.register_chatcommand("rollback", {
|
||||
params = "(<name> [<seconds>]) | (:<actor> [<seconds>])",
|
||||
description = "Revert actions of a player. Default for <seconds> is 60",
|
||||
description = "Revert actions of a player. Default for <seconds> is 60. Set <seconds> to inf for no time limit",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.settings:get_bool("enable_rollback_recording") then
|
||||
@@ -771,7 +862,7 @@ core.register_chatcommand("rollback", {
|
||||
end
|
||||
local target_name, seconds = string.match(param, ":([^ ]+) *(%d*)")
|
||||
if not target_name then
|
||||
local player_name = nil
|
||||
local player_name
|
||||
player_name, seconds = string.match(param, "([^ ]+) *(%d*)")
|
||||
if not player_name then
|
||||
return false, "Invalid parameters. See /help rollback"
|
||||
@@ -875,12 +966,13 @@ core.register_chatcommand("shutdown", {
|
||||
core.chat_send_all("*** Server shutting down (operator request).")
|
||||
end
|
||||
core.request_shutdown(message:trim(), core.is_yes(reconnect), delay)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("ban", {
|
||||
params = "[<name> | <IP_address>]",
|
||||
description = "Ban player or show ban list",
|
||||
params = "[<name>]",
|
||||
description = "Ban the IP of a player or show the ban list",
|
||||
privs = {ban=true},
|
||||
func = function(name, param)
|
||||
if param == "" then
|
||||
@@ -892,7 +984,7 @@ core.register_chatcommand("ban", {
|
||||
end
|
||||
end
|
||||
if not core.get_player_by_name(param) then
|
||||
return false, "No such player."
|
||||
return false, "Player is not online."
|
||||
end
|
||||
if not core.ban_player(param) then
|
||||
return false, "Failed to ban player."
|
||||
@@ -905,7 +997,7 @@ core.register_chatcommand("ban", {
|
||||
|
||||
core.register_chatcommand("unban", {
|
||||
params = "<name> | <IP_address>",
|
||||
description = "Remove player ban",
|
||||
description = "Remove IP ban belonging to a player/IP",
|
||||
privs = {ban=true},
|
||||
func = function(name, param)
|
||||
if not core.unban_player_or_ip(param) then
|
||||
@@ -951,18 +1043,19 @@ core.register_chatcommand("clearobjects", {
|
||||
|
||||
core.log("action", name .. " clears all objects ("
|
||||
.. options.mode .. " mode).")
|
||||
core.chat_send_all("Clearing all objects. This may take long."
|
||||
.. " You may experience a timeout. (by "
|
||||
core.chat_send_all("Clearing all objects. This may take a long time."
|
||||
.. " You may experience a timeout. (by "
|
||||
.. name .. ")")
|
||||
core.clear_objects(options)
|
||||
core.log("action", "Object clearing done.")
|
||||
core.chat_send_all("*** Cleared all objects.")
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("msg", {
|
||||
params = "<name> <message>",
|
||||
description = "Send a private message",
|
||||
description = "Send a direct message to a player",
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
local sendto, message = param:match("^(%S+)%s(.+)$")
|
||||
@@ -973,9 +1066,9 @@ core.register_chatcommand("msg", {
|
||||
return false, "The player " .. sendto
|
||||
.. " is not online."
|
||||
end
|
||||
core.log("action", "PM from " .. name .. " to " .. sendto
|
||||
core.log("action", "DM from " .. name .. " to " .. sendto
|
||||
.. ": " .. message)
|
||||
core.chat_send_player(sendto, "PM from " .. name .. ": "
|
||||
core.chat_send_player(sendto, "DM from " .. name .. ": "
|
||||
.. message)
|
||||
return true, "Message sent."
|
||||
end,
|
||||
@@ -989,12 +1082,12 @@ core.register_chatcommand("last-login", {
|
||||
param = name
|
||||
end
|
||||
local pauth = core.get_auth_handler().get_auth(param)
|
||||
if pauth and pauth.last_login then
|
||||
if pauth and pauth.last_login and pauth.last_login ~= -1 then
|
||||
-- Time in UTC, ISO 8601 format
|
||||
return true, "Last login time was " ..
|
||||
return true, param.."'s last login time was " ..
|
||||
os.date("!%Y-%m-%dT%H:%M:%SZ", pauth.last_login)
|
||||
end
|
||||
return false, "Last login time is unknown"
|
||||
return false, param.."'s last login time is unknown"
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ core.MAP_BLOCKSIZE = 16
|
||||
-- Default maximal HP of a player
|
||||
core.PLAYER_MAX_HP_DEFAULT = 20
|
||||
-- Default maximal breath of a player
|
||||
core.PLAYER_MAX_BREATH_DEFAULT = 11
|
||||
core.PLAYER_MAX_BREATH_DEFAULT = 10
|
||||
|
||||
-- light.h
|
||||
-- Maximum value for node 'light_source' parameter
|
||||
|
||||
@@ -1,28 +1,5 @@
|
||||
-- Minetest: builtin/deprecated.lua
|
||||
|
||||
--
|
||||
-- Default material types
|
||||
--
|
||||
local function digprop_err()
|
||||
core.log("deprecated", "The core.digprop_* functions are obsolete and need to be replaced by item groups.")
|
||||
end
|
||||
|
||||
core.digprop_constanttime = digprop_err
|
||||
core.digprop_stonelike = digprop_err
|
||||
core.digprop_dirtlike = digprop_err
|
||||
core.digprop_gravellike = digprop_err
|
||||
core.digprop_woodlike = digprop_err
|
||||
core.digprop_leaveslike = digprop_err
|
||||
core.digprop_glasslike = digprop_err
|
||||
|
||||
function core.node_metadata_inventory_move_allow_all()
|
||||
core.log("deprecated", "core.node_metadata_inventory_move_allow_all is obsolete and does nothing.")
|
||||
end
|
||||
|
||||
function core.add_to_creative_inventory(itemstring)
|
||||
core.log("deprecated", "core.add_to_creative_inventory: This function is deprecated and does nothing.")
|
||||
end
|
||||
|
||||
--
|
||||
-- EnvRef
|
||||
--
|
||||
@@ -70,3 +47,19 @@ core.setting_get = setting_proxy("get")
|
||||
core.setting_setbool = setting_proxy("set_bool")
|
||||
core.setting_getbool = setting_proxy("get_bool")
|
||||
core.setting_save = setting_proxy("write")
|
||||
|
||||
--
|
||||
-- core.register_on_auth_fail
|
||||
--
|
||||
|
||||
function core.register_on_auth_fail(func)
|
||||
core.log("deprecated", "core.register_on_auth_fail " ..
|
||||
"is deprecated and should be replaced by " ..
|
||||
"core.register_on_authplayer instead.")
|
||||
|
||||
core.register_on_authplayer(function (player_name, ip, is_success)
|
||||
if not is_success then
|
||||
func(player_name, ip)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,36 @@
|
||||
-- Minetest: builtin/item.lua
|
||||
|
||||
local builtin_shared = ...
|
||||
local SCALE = 0.667
|
||||
|
||||
local facedir_to_euler = {
|
||||
{y = 0, x = 0, z = 0},
|
||||
{y = -math.pi/2, x = 0, z = 0},
|
||||
{y = math.pi, x = 0, z = 0},
|
||||
{y = math.pi/2, x = 0, z = 0},
|
||||
{y = math.pi/2, x = -math.pi/2, z = math.pi/2},
|
||||
{y = math.pi/2, x = math.pi, z = math.pi/2},
|
||||
{y = math.pi/2, x = math.pi/2, z = math.pi/2},
|
||||
{y = math.pi/2, x = 0, z = math.pi/2},
|
||||
{y = -math.pi/2, x = math.pi/2, z = math.pi/2},
|
||||
{y = -math.pi/2, x = 0, z = math.pi/2},
|
||||
{y = -math.pi/2, x = -math.pi/2, z = math.pi/2},
|
||||
{y = -math.pi/2, x = math.pi, z = math.pi/2},
|
||||
{y = 0, x = 0, z = math.pi/2},
|
||||
{y = 0, x = -math.pi/2, z = math.pi/2},
|
||||
{y = 0, x = math.pi, z = math.pi/2},
|
||||
{y = 0, x = math.pi/2, z = math.pi/2},
|
||||
{y = math.pi, x = math.pi, z = math.pi/2},
|
||||
{y = math.pi, x = math.pi/2, z = math.pi/2},
|
||||
{y = math.pi, x = 0, z = math.pi/2},
|
||||
{y = math.pi, x = -math.pi/2, z = math.pi/2},
|
||||
{y = math.pi, x = math.pi, z = 0},
|
||||
{y = -math.pi/2, x = math.pi, z = 0},
|
||||
{y = 0, x = math.pi, z = 0},
|
||||
{y = math.pi/2, x = math.pi, z = 0}
|
||||
}
|
||||
|
||||
local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81
|
||||
|
||||
--
|
||||
-- Falling stuff
|
||||
@@ -8,25 +38,178 @@ local builtin_shared = ...
|
||||
|
||||
core.register_entity(":__builtin:falling_node", {
|
||||
initial_properties = {
|
||||
visual = "wielditem",
|
||||
visual_size = {x = 0.667, y = 0.667},
|
||||
visual = "item",
|
||||
visual_size = {x = SCALE, y = SCALE, z = SCALE},
|
||||
textures = {},
|
||||
physical = true,
|
||||
is_visible = false,
|
||||
collide_with_objects = false,
|
||||
collide_with_objects = true,
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
|
||||
node = {},
|
||||
meta = {},
|
||||
floats = false,
|
||||
|
||||
set_node = function(self, node, meta)
|
||||
node.param2 = node.param2 or 0
|
||||
self.node = node
|
||||
self.meta = meta or {}
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
textures = {node.name},
|
||||
})
|
||||
meta = meta or {}
|
||||
if type(meta.to_table) == "function" then
|
||||
meta = meta:to_table()
|
||||
end
|
||||
for _, list in pairs(meta.inventory or {}) do
|
||||
for i, stack in pairs(list) do
|
||||
if type(stack) == "userdata" then
|
||||
list[i] = stack:to_string()
|
||||
end
|
||||
end
|
||||
end
|
||||
local def = core.registered_nodes[node.name]
|
||||
if not def then
|
||||
-- Don't allow unknown nodes to fall
|
||||
core.log("info",
|
||||
"Unknown falling node removed at "..
|
||||
core.pos_to_string(self.object:get_pos()))
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
self.meta = meta
|
||||
|
||||
-- Cache whether we're supposed to float on water
|
||||
self.floats = core.get_item_group(node.name, "float") ~= 0
|
||||
|
||||
-- Set entity visuals
|
||||
if def.drawtype == "torchlike" or def.drawtype == "signlike" then
|
||||
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
|
||||
if def.drawtype == "torchlike" then
|
||||
textures = { "("..tile..")^[transformFX", tile }
|
||||
else
|
||||
textures = { tile, "("..tile..")^[transformFX" }
|
||||
end
|
||||
end
|
||||
local vsize
|
||||
if def.visual_scale then
|
||||
local s = def.visual_scale
|
||||
vsize = {x = s, y = s, z = s}
|
||||
end
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
visual = "upright_sprite",
|
||||
visual_size = vsize,
|
||||
textures = textures,
|
||||
glow = def.light_source,
|
||||
})
|
||||
elseif def.drawtype ~= "airlike" then
|
||||
local itemstring = node.name
|
||||
if core.is_colored_paramtype(def.paramtype2) then
|
||||
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}
|
||||
end
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
wield_item = itemstring,
|
||||
visual_size = vsize,
|
||||
glow = def.light_source,
|
||||
})
|
||||
end
|
||||
|
||||
-- Set collision box (certain nodeboxes only for now)
|
||||
local nb_types = {fixed=true, leveled=true, connected=true}
|
||||
if def.drawtype == "nodebox" and def.node_box and
|
||||
nb_types[def.node_box.type] and def.node_box.fixed then
|
||||
local box = table.copy(def.node_box.fixed)
|
||||
if type(box[1]) == "table" then
|
||||
box = #box == 1 and box[1] or nil -- We can only use a single box
|
||||
end
|
||||
if box then
|
||||
if def.paramtype2 == "leveled" and (self.node.level or 0) > 0 then
|
||||
box[5] = -0.5 + self.node.level / 64
|
||||
end
|
||||
self.object:set_properties({
|
||||
collisionbox = box
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- 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
|
||||
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"
|
||||
or def.drawtype == "mesh"
|
||||
or def.drawtype == "normal"
|
||||
or def.drawtype == "nodebox" then
|
||||
if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") then
|
||||
local fdir = node.param2 % 32
|
||||
-- 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
|
||||
local rot = node.param2 % 8
|
||||
local pitch, yaw, roll = 0, 0, 0
|
||||
if def.drawtype == "nodebox" or def.drawtype == "mesh" then
|
||||
if rot == 0 then
|
||||
pitch, yaw = math.pi/2, 0
|
||||
elseif rot == 1 then
|
||||
pitch, yaw = -math.pi/2, math.pi
|
||||
elseif rot == 2 then
|
||||
pitch, yaw = 0, math.pi/2
|
||||
elseif rot == 3 then
|
||||
pitch, yaw = 0, -math.pi/2
|
||||
elseif rot == 4 then
|
||||
pitch, yaw = 0, math.pi
|
||||
end
|
||||
else
|
||||
if rot == 1 then
|
||||
pitch, yaw = math.pi, math.pi
|
||||
elseif rot == 2 then
|
||||
pitch, yaw = math.pi/2, math.pi/2
|
||||
elseif rot == 3 then
|
||||
pitch, yaw = math.pi/2, -math.pi/2
|
||||
elseif rot == 4 then
|
||||
pitch, yaw = math.pi/2, math.pi
|
||||
elseif rot == 5 then
|
||||
pitch, yaw = math.pi/2, 0
|
||||
end
|
||||
end
|
||||
if def.drawtype == "signlike" then
|
||||
pitch = pitch - math.pi/2
|
||||
if rot == 0 then
|
||||
yaw = yaw + math.pi/2
|
||||
elseif rot == 1 then
|
||||
yaw = yaw - math.pi/2
|
||||
end
|
||||
elseif def.drawtype == "mesh" or def.drawtype == "normal" or def.drawtype == "nodebox" then
|
||||
if rot >= 0 and rot <= 1 then
|
||||
roll = roll + math.pi
|
||||
else
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
end
|
||||
self.object:set_rotation({x=pitch, y=yaw, z=roll})
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
@@ -39,6 +222,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})
|
||||
|
||||
local ds = core.deserialize(staticdata)
|
||||
if ds and ds.node then
|
||||
@@ -50,85 +234,159 @@ core.register_entity(":__builtin:falling_node", {
|
||||
end
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
-- Set gravity
|
||||
local acceleration = self.object:get_acceleration()
|
||||
if not vector.equals(acceleration, {x = 0, y = -10, z = 0}) then
|
||||
self.object:set_acceleration({x = 0, y = -10, z = 0})
|
||||
try_place = function(self, bcp, bcn)
|
||||
local bcd = core.registered_nodes[bcn.name]
|
||||
-- Add levels if dropped on same leveled node
|
||||
if bcd and bcd.paramtype2 == "leveled" and
|
||||
bcn.name == self.node.name then
|
||||
local addlevel = self.node.level
|
||||
if (addlevel or 0) <= 0 then
|
||||
addlevel = bcd.leveled
|
||||
end
|
||||
if core.add_node_level(bcp, addlevel) < addlevel then
|
||||
return true
|
||||
elseif bcd.buildable_to then
|
||||
-- Node level has already reached max, don't place anything
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- Turn to actual node when colliding with ground, or continue to move
|
||||
local pos = self.object:get_pos()
|
||||
-- Position of bottom center point
|
||||
local bcp = {x = pos.x, y = pos.y - 0.7, z = pos.z}
|
||||
-- 'bcn' is nil for unloaded nodes
|
||||
local bcn = core.get_node_or_nil(bcp)
|
||||
-- Delete on contact with ignore at world edges
|
||||
if bcn and bcn.name == "ignore" then
|
||||
self.object:remove()
|
||||
return
|
||||
|
||||
-- Decide if we're replacing the node or placing on top
|
||||
local np = vector.new(bcp)
|
||||
if bcd and bcd.buildable_to and
|
||||
(not self.floats or bcd.liquidtype == "none") then
|
||||
core.remove_node(bcp)
|
||||
else
|
||||
np.y = np.y + 1
|
||||
end
|
||||
local bcd = bcn and core.registered_nodes[bcn.name]
|
||||
if bcn and
|
||||
(not bcd or bcd.walkable or
|
||||
(core.get_item_group(self.node.name, "float") ~= 0 and
|
||||
bcd.liquidtype ~= "none")) then
|
||||
if bcd and bcd.leveled and
|
||||
bcn.name == self.node.name then
|
||||
local addlevel = self.node.level
|
||||
if not addlevel or addlevel <= 0 then
|
||||
addlevel = bcd.leveled
|
||||
|
||||
-- Check what's here
|
||||
local n2 = core.get_node(np)
|
||||
local nd = core.registered_nodes[n2.name]
|
||||
-- If it's not air or liquid, remove node and replace it with
|
||||
-- it's drops
|
||||
if n2.name ~= "air" and (not nd or nd.liquidtype == "none") then
|
||||
if nd and nd.buildable_to == false then
|
||||
nd.on_dig(np, n2, nil)
|
||||
-- If it's still there, it might be protected
|
||||
if core.get_node(np).name == n2.name then
|
||||
return false
|
||||
end
|
||||
if core.add_node_level(bcp, addlevel) == 0 then
|
||||
else
|
||||
core.remove_node(np)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create node
|
||||
local def = core.registered_nodes[self.node.name]
|
||||
if def then
|
||||
core.add_node(np, self.node)
|
||||
if self.meta then
|
||||
core.get_meta(np):from_table(self.meta)
|
||||
end
|
||||
if def.sounds and def.sounds.place then
|
||||
core.sound_play(def.sounds.place, {pos = np}, true)
|
||||
end
|
||||
end
|
||||
core.check_for_falling(np)
|
||||
return true
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime, moveresult)
|
||||
-- Fallback code since collision detection can't tell us
|
||||
-- about liquids (which do not collide)
|
||||
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 bcn = core.get_node(bcp)
|
||||
|
||||
local bcd = core.registered_nodes[bcn.name]
|
||||
if bcd and bcd.liquidtype ~= "none" then
|
||||
if self:try_place(bcp, bcn) then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
elseif bcd and bcd.buildable_to and
|
||||
(core.get_item_group(self.node.name, "float") == 0 or
|
||||
bcd.liquidtype == "none") then
|
||||
core.remove_node(bcp)
|
||||
return
|
||||
end
|
||||
local np = {x = bcp.x, y = bcp.y + 1, z = bcp.z}
|
||||
-- Check what's here
|
||||
local n2 = core.get_node(np)
|
||||
local nd = core.registered_nodes[n2.name]
|
||||
-- If it's not air or liquid, remove node and replace it with
|
||||
-- it's drops
|
||||
if n2.name ~= "air" and (not nd or nd.liquidtype == "none") then
|
||||
core.remove_node(np)
|
||||
if nd and nd.buildable_to == false then
|
||||
-- Add dropped items
|
||||
local drops = core.get_node_drops(n2, "")
|
||||
for _, dropped_item in pairs(drops) do
|
||||
core.add_item(np, dropped_item)
|
||||
end
|
||||
|
||||
assert(moveresult)
|
||||
if not moveresult.collides then
|
||||
return -- Nothing to do :)
|
||||
end
|
||||
|
||||
local bcp, bcn
|
||||
local player_collision
|
||||
if moveresult.touching_ground then
|
||||
for _, info in ipairs(moveresult.collisions) do
|
||||
if info.type == "object" then
|
||||
if info.axis == "y" and info.object:is_player() then
|
||||
player_collision = info
|
||||
end
|
||||
end
|
||||
-- Run script hook
|
||||
for _, callback in pairs(core.registered_on_dignodes) do
|
||||
callback(np, n2)
|
||||
elseif info.axis == "y" then
|
||||
bcp = info.node_pos
|
||||
bcn = core.get_node(bcp)
|
||||
break
|
||||
end
|
||||
end
|
||||
-- Create node and remove entity
|
||||
local def = core.registered_nodes[self.node.name]
|
||||
if def then
|
||||
core.add_node(np, self.node)
|
||||
if self.meta then
|
||||
local meta = core.get_meta(np)
|
||||
meta:from_table(self.meta)
|
||||
end
|
||||
if def.sounds and def.sounds.place and def.sounds.place.name then
|
||||
core.sound_play(def.sounds.place, {pos = np})
|
||||
end
|
||||
end
|
||||
|
||||
if not bcp then
|
||||
-- We're colliding with something, but not the ground. Irrelevant to us.
|
||||
if player_collision then
|
||||
-- Continue falling through players by moving a little into
|
||||
-- their collision box
|
||||
-- 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}))
|
||||
end
|
||||
return
|
||||
elseif bcn.name == "ignore" then
|
||||
-- Delete on contact with ignore at world edges
|
||||
self.object:remove()
|
||||
core.check_for_falling(np)
|
||||
return
|
||||
end
|
||||
local vel = self.object:get_velocity()
|
||||
if vector.equals(vel, {x = 0, y = 0, z = 0}) then
|
||||
local npos = self.object:get_pos()
|
||||
self.object:set_pos(vector.round(npos))
|
||||
|
||||
local failure = false
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
local distance = vector.apply(vector.subtract(pos, bcp), math.abs)
|
||||
if distance.x >= 1 or distance.z >= 1 then
|
||||
-- We're colliding with some part of a node that's sticking out
|
||||
-- Since we don't want to visually teleport, drop as item
|
||||
failure = true
|
||||
elseif distance.y >= 2 then
|
||||
-- Doors consist of a hidden top node and a bottom node that is
|
||||
-- the actual door. Despite the top node being solid, the moveresult
|
||||
-- almost always indicates collision with the bottom node.
|
||||
-- Compensate for this by checking the top node
|
||||
bcp.y = bcp.y + 1
|
||||
bcn = core.get_node(bcp)
|
||||
local def = core.registered_nodes[bcn.name]
|
||||
if not (def and def.walkable) then
|
||||
failure = true -- This is unexpected, fail
|
||||
end
|
||||
end
|
||||
|
||||
-- Try to actually place ourselves
|
||||
if not failure then
|
||||
failure = not self:try_place(bcp, bcn)
|
||||
end
|
||||
|
||||
if failure then
|
||||
local drops = core.get_node_drops(self.node, "")
|
||||
for _, item in pairs(drops) do
|
||||
core.add_item(pos, item)
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
})
|
||||
|
||||
@@ -137,10 +395,16 @@ local function convert_to_falling_node(pos, node)
|
||||
if not obj then
|
||||
return false
|
||||
end
|
||||
-- remember node level, the entities' set_node() uses this
|
||||
node.level = core.get_node_level(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
local metatable = meta and meta:to_table() or {}
|
||||
|
||||
local def = core.registered_nodes[node.name]
|
||||
if def and def.sounds and def.sounds.fall then
|
||||
core.sound_play(def.sounds.fall, {pos = pos}, true)
|
||||
end
|
||||
|
||||
obj:get_luaentity():set_node(node, metatable)
|
||||
core.remove_node(pos)
|
||||
return true
|
||||
@@ -170,6 +434,9 @@ local function drop_attached_node(p)
|
||||
drops = drop_stacks
|
||||
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
||||
end
|
||||
if def and def.sounds and def.sounds.fall then
|
||||
core.sound_play(def.sounds.fall, {pos = p}, true)
|
||||
end
|
||||
core.remove_node(p)
|
||||
for _, item in pairs(drops) do
|
||||
local pos = {
|
||||
@@ -214,18 +481,23 @@ function core.check_single_for_falling(p)
|
||||
-- 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]
|
||||
if d_bottom and
|
||||
|
||||
(core.get_item_group(n.name, "float") == 0 or
|
||||
d_bottom.liquidtype == "none") and
|
||||
|
||||
(n.name ~= n_bottom.name or (d_bottom.leveled and
|
||||
core.get_node_level(p_bottom) <
|
||||
core.get_node_max_level(p_bottom))) and
|
||||
|
||||
(not d_bottom.walkable or d_bottom.buildable_to) then
|
||||
convert_to_falling_node(p, n)
|
||||
return true
|
||||
if d_bottom then
|
||||
local same = n.name == n_bottom.name
|
||||
-- Let leveled nodes fall if it can merge with the bottom node
|
||||
if same and d_bottom.paramtype2 == "leveled" and
|
||||
core.get_node_level(p_bottom) <
|
||||
core.get_node_max_level(p_bottom) then
|
||||
convert_to_falling_node(p, n)
|
||||
return true
|
||||
end
|
||||
-- Otherwise only if the bottom node is considered "fall through"
|
||||
if not same and
|
||||
(not d_bottom.walkable or d_bottom.buildable_to) and
|
||||
(core.get_item_group(n.name, "float") == 0 or
|
||||
d_bottom.liquidtype == "none") then
|
||||
convert_to_falling_node(p, n)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,6 +12,13 @@ core.features = {
|
||||
no_chat_message_prediction = true,
|
||||
object_use_texture_alpha = true,
|
||||
object_independent_selectionbox = true,
|
||||
httpfetch_binary_data = true,
|
||||
formspec_version_element = true,
|
||||
area_store_persistent_ids = true,
|
||||
pathfinder_works = true,
|
||||
object_step_has_moveresult = true,
|
||||
direct_velocity_on_players = true,
|
||||
use_texture_alpha_string_modes = true,
|
||||
}
|
||||
|
||||
function core.has_feature(arg)
|
||||
|
||||
@@ -8,6 +8,9 @@ local blocks_forceloaded
|
||||
local blocks_temploaded = {}
|
||||
local total_forceloaded = 0
|
||||
|
||||
-- true, if the forceloaded blocks got changed (flag for persistence on-disk)
|
||||
local forceload_blocks_changed = false
|
||||
|
||||
local BLOCKSIZE = core.MAP_BLOCKSIZE
|
||||
local function get_blockpos(pos)
|
||||
return {
|
||||
@@ -31,6 +34,9 @@ local function get_relevant_tables(transient)
|
||||
end
|
||||
|
||||
function core.forceload_block(pos, transient)
|
||||
-- set changed flag
|
||||
forceload_blocks_changed = true
|
||||
|
||||
local blockpos = get_blockpos(pos)
|
||||
local hash = core.hash_node_position(blockpos)
|
||||
local relevant_table, other_table = get_relevant_tables(transient)
|
||||
@@ -51,6 +57,9 @@ function core.forceload_block(pos, transient)
|
||||
end
|
||||
|
||||
function core.forceload_free_block(pos, transient)
|
||||
-- set changed flag
|
||||
forceload_blocks_changed = true
|
||||
|
||||
local blockpos = get_blockpos(pos)
|
||||
local hash = core.hash_node_position(blockpos)
|
||||
local relevant_table, other_table = get_relevant_tables(transient)
|
||||
@@ -95,6 +104,28 @@ core.after(5, function()
|
||||
end
|
||||
end)
|
||||
|
||||
core.register_on_shutdown(function()
|
||||
-- persists the currently forceloaded blocks to disk
|
||||
local function persist_forceloaded_blocks()
|
||||
write_file(wpath.."/force_loaded.txt", blocks_forceloaded)
|
||||
end)
|
||||
end
|
||||
|
||||
-- periodical forceload persistence
|
||||
local function periodically_persist_forceloaded_blocks()
|
||||
|
||||
-- only persist if the blocks actually changed
|
||||
if forceload_blocks_changed then
|
||||
persist_forceloaded_blocks()
|
||||
|
||||
-- reset changed flag
|
||||
forceload_blocks_changed = false
|
||||
end
|
||||
|
||||
-- recheck after some time
|
||||
core.after(10, periodically_persist_forceloaded_blocks)
|
||||
end
|
||||
|
||||
-- persist periodically
|
||||
core.after(5, periodically_persist_forceloaded_blocks)
|
||||
|
||||
-- persist on shutdown
|
||||
core.register_on_shutdown(persist_forceloaded_blocks)
|
||||
|
||||
@@ -1,36 +1,38 @@
|
||||
|
||||
local scriptpath = core.get_builtin_path()
|
||||
local commonpath = scriptpath.."common"..DIR_DELIM
|
||||
local gamepath = scriptpath.."game"..DIR_DELIM
|
||||
local commonpath = scriptpath .. "common" .. DIR_DELIM
|
||||
local gamepath = scriptpath .. "game".. DIR_DELIM
|
||||
|
||||
-- Shared between builtin files, but
|
||||
-- not exposed to outer context
|
||||
local builtin_shared = {}
|
||||
|
||||
dofile(commonpath.."vector.lua")
|
||||
dofile(commonpath .. "vector.lua")
|
||||
|
||||
dofile(gamepath.."constants.lua")
|
||||
assert(loadfile(gamepath.."item.lua"))(builtin_shared)
|
||||
dofile(gamepath.."register.lua")
|
||||
dofile(gamepath .. "constants.lua")
|
||||
assert(loadfile(gamepath .. "item.lua"))(builtin_shared)
|
||||
dofile(gamepath .. "register.lua")
|
||||
|
||||
if core.settings:get_bool("profiler.load") then
|
||||
profiler = dofile(scriptpath.."profiler"..DIR_DELIM.."init.lua")
|
||||
profiler = dofile(scriptpath .. "profiler" .. DIR_DELIM .. "init.lua")
|
||||
end
|
||||
|
||||
dofile(commonpath .. "after.lua")
|
||||
dofile(gamepath.."item_entity.lua")
|
||||
dofile(gamepath.."deprecated.lua")
|
||||
dofile(gamepath.."misc.lua")
|
||||
dofile(gamepath.."privileges.lua")
|
||||
dofile(gamepath.."auth.lua")
|
||||
dofile(gamepath .. "item_entity.lua")
|
||||
dofile(gamepath .. "deprecated.lua")
|
||||
dofile(gamepath .. "misc.lua")
|
||||
dofile(gamepath .. "privileges.lua")
|
||||
dofile(gamepath .. "auth.lua")
|
||||
dofile(commonpath .. "chatcommands.lua")
|
||||
dofile(gamepath.."chatcommands.lua")
|
||||
dofile(gamepath.."static_spawn.lua")
|
||||
dofile(gamepath.."detached_inventory.lua")
|
||||
assert(loadfile(gamepath.."falling.lua"))(builtin_shared)
|
||||
dofile(gamepath.."features.lua")
|
||||
dofile(gamepath.."voxelarea.lua")
|
||||
dofile(gamepath.."forceloading.lua")
|
||||
dofile(gamepath.."statbars.lua")
|
||||
dofile(gamepath .. "chat.lua")
|
||||
dofile(commonpath .. "information_formspecs.lua")
|
||||
dofile(gamepath .. "static_spawn.lua")
|
||||
dofile(gamepath .. "detached_inventory.lua")
|
||||
assert(loadfile(gamepath .. "falling.lua"))(builtin_shared)
|
||||
dofile(gamepath .. "features.lua")
|
||||
dofile(gamepath .. "voxelarea.lua")
|
||||
dofile(gamepath .. "forceloading.lua")
|
||||
dofile(gamepath .. "statbars.lua")
|
||||
dofile(gamepath .. "knockback.lua")
|
||||
|
||||
profiler = nil
|
||||
|
||||
@@ -206,7 +206,6 @@ function core.get_node_drops(node, toolname)
|
||||
-- Extended drop table
|
||||
local got_items = {}
|
||||
local got_count = 0
|
||||
local _, item, tool
|
||||
for _, item in ipairs(drop.items) do
|
||||
local good_rarity = true
|
||||
local good_tool = true
|
||||
@@ -251,11 +250,6 @@ local function user_name(user)
|
||||
return user and user:get_player_name() or ""
|
||||
end
|
||||
|
||||
local function is_protected(pos, name)
|
||||
return core.is_protected(pos, name) and
|
||||
not minetest.check_player_privs(name, "protection_bypass")
|
||||
end
|
||||
|
||||
-- Returns a logging function. For empty names, does not log.
|
||||
local function make_log(name)
|
||||
return name ~= "" and core.log or function() end
|
||||
@@ -265,7 +259,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
prevent_after_place)
|
||||
local def = itemstack:get_definition()
|
||||
if def.type ~= "node" or pointed_thing.type ~= "node" then
|
||||
return itemstack, false
|
||||
return itemstack, nil
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
@@ -278,7 +272,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
if not oldnode_under or not oldnode_above then
|
||||
log("info", playername .. " tried to place"
|
||||
.. " node in unloaded position " .. core.pos_to_string(above))
|
||||
return itemstack, false
|
||||
return itemstack, nil
|
||||
end
|
||||
|
||||
local olddef_under = core.registered_nodes[oldnode_under.name]
|
||||
@@ -290,7 +284,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
log("info", playername .. " tried to place"
|
||||
.. " node in invalid position " .. core.pos_to_string(above)
|
||||
.. ", replacing " .. oldnode_above.name)
|
||||
return itemstack, false
|
||||
return itemstack, nil
|
||||
end
|
||||
|
||||
-- Place above pointed node
|
||||
@@ -302,18 +296,15 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
place_to = {x = under.x, y = under.y, z = under.z}
|
||||
end
|
||||
|
||||
if is_protected(place_to, playername) then
|
||||
if core.is_protected(place_to, playername) then
|
||||
log("action", playername
|
||||
.. " tried to place " .. def.name
|
||||
.. " at protected position "
|
||||
.. core.pos_to_string(place_to))
|
||||
core.record_protection_violation(place_to, playername)
|
||||
return itemstack
|
||||
return itemstack, nil
|
||||
end
|
||||
|
||||
log("action", playername .. " places node "
|
||||
.. def.name .. " at " .. core.pos_to_string(place_to))
|
||||
|
||||
local oldnode = core.get_node(place_to)
|
||||
local newnode = {name = def.name, param1 = 0, param2 = param2 or 0}
|
||||
|
||||
@@ -339,7 +330,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
z = above.z - placer_pos.z
|
||||
}
|
||||
newnode.param2 = core.dir_to_facedir(dir)
|
||||
log("action", "facedir: " .. newnode.param2)
|
||||
log("info", "facedir: " .. newnode.param2)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -367,12 +358,23 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
not builtin_shared.check_attached_node(place_to, newnode) then
|
||||
log("action", "attached node " .. def.name ..
|
||||
" can not be placed at " .. core.pos_to_string(place_to))
|
||||
return itemstack, false
|
||||
return itemstack, nil
|
||||
end
|
||||
|
||||
log("action", playername .. " places node "
|
||||
.. def.name .. " at " .. core.pos_to_string(place_to))
|
||||
|
||||
-- Add node and update
|
||||
core.add_node(place_to, newnode)
|
||||
|
||||
-- Play sound if it was done by a player
|
||||
if playername ~= "" and def.sounds and def.sounds.place then
|
||||
core.sound_play(def.sounds.place, {
|
||||
pos = place_to,
|
||||
exclude_player = playername,
|
||||
}, true)
|
||||
end
|
||||
|
||||
local take_item = true
|
||||
|
||||
-- Run callback
|
||||
@@ -401,9 +403,10 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||
if take_item then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack, true
|
||||
return itemstack, place_to
|
||||
end
|
||||
|
||||
-- deprecated, item_place does not call this
|
||||
function core.item_place_object(itemstack, placer, pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing, true)
|
||||
if pos ~= nil then
|
||||
@@ -421,14 +424,15 @@ function core.item_place(itemstack, placer, pointed_thing, param2)
|
||||
local nn = n.name
|
||||
if core.registered_nodes[nn] and core.registered_nodes[nn].on_rightclick then
|
||||
return core.registered_nodes[nn].on_rightclick(pointed_thing.under, n,
|
||||
placer, itemstack, pointed_thing) or itemstack, false
|
||||
placer, itemstack, pointed_thing) or itemstack, nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Place if node, otherwise do nothing
|
||||
if itemstack:get_definition().type == "node" then
|
||||
return core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
end
|
||||
return itemstack
|
||||
return itemstack, nil
|
||||
end
|
||||
|
||||
function core.item_secondary_use(itemstack, placer)
|
||||
@@ -466,12 +470,15 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
|
||||
return result
|
||||
end
|
||||
end
|
||||
local def = itemstack:get_definition()
|
||||
if itemstack:take_item() ~= nil then
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
|
||||
local def = itemstack:get_definition()
|
||||
if def and def.sound and def.sound.eat then
|
||||
minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 })
|
||||
core.sound_play(def.sound.eat, {
|
||||
pos = user:get_pos(),
|
||||
max_hear_distance = 16
|
||||
}, true)
|
||||
end
|
||||
|
||||
if replace_with_item then
|
||||
@@ -544,21 +551,22 @@ function core.node_dig(pos, node, digger)
|
||||
local diggername = user_name(digger)
|
||||
local log = make_log(diggername)
|
||||
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(pos, digger))) then
|
||||
(def.can_dig and not def.can_dig(vector.new(pos), digger))) then
|
||||
log("info", diggername .. " tried to dig "
|
||||
.. node.name .. " which is not diggable "
|
||||
.. core.pos_to_string(pos))
|
||||
return
|
||||
return false
|
||||
end
|
||||
|
||||
if is_protected(pos, diggername) then
|
||||
if core.is_protected(pos, diggername) then
|
||||
log("action", diggername
|
||||
.. " tried to dig " .. node.name
|
||||
.. " at protected position "
|
||||
.. core.pos_to_string(pos))
|
||||
core.record_protection_violation(pos, diggername)
|
||||
return
|
||||
return false
|
||||
end
|
||||
|
||||
log('action', diggername .. " digs "
|
||||
@@ -575,10 +583,13 @@ function core.node_dig(pos, node, digger)
|
||||
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||
else
|
||||
-- Wear out tool
|
||||
if not core.settings:get_bool("creative_mode") then
|
||||
if not core.is_creative_enabled(diggername) then
|
||||
wielded:add_wear(dp.wear)
|
||||
if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
||||
core.sound_play(wdef.sound.breaks, {pos = pos, gain = 0.5})
|
||||
core.sound_play(wdef.sound.breaks, {
|
||||
pos = pos,
|
||||
gain = 0.5
|
||||
}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -610,6 +621,14 @@ function core.node_dig(pos, node, digger)
|
||||
-- Remove node and update
|
||||
core.remove_node(pos)
|
||||
|
||||
-- Play sound if it was done by a player
|
||||
if diggername ~= "" and def and def.sounds and def.sounds.dug then
|
||||
core.sound_play(def.sounds.dug, {
|
||||
pos = pos,
|
||||
exclude_player = diggername,
|
||||
}, true)
|
||||
end
|
||||
|
||||
-- Run callback
|
||||
if def and def.after_dig_node then
|
||||
-- Copy pos and node because callback can modify them
|
||||
@@ -619,15 +638,10 @@ function core.node_dig(pos, node, digger)
|
||||
end
|
||||
|
||||
-- Run script hook
|
||||
local _, callback
|
||||
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)
|
||||
--print("Running " .. tostring(callback) ..
|
||||
-- " (a " .. origin.name .. " callback in " .. origin.mod .. ")")
|
||||
else
|
||||
--print("No data associated with callback")
|
||||
end
|
||||
|
||||
-- Copy pos and node because callback can modify them
|
||||
@@ -635,6 +649,8 @@ function core.node_dig(pos, node, digger)
|
||||
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||
callback(pos_copy, node_copy, digger)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function core.itemstring_with_palette(item, palette_index)
|
||||
@@ -662,6 +678,8 @@ end
|
||||
-- Item definition defaults
|
||||
--
|
||||
|
||||
local default_stack_max = tonumber(core.settings:get("default_stack_max")) or 99
|
||||
|
||||
core.nodedef_default = {
|
||||
-- Item properties
|
||||
type="node",
|
||||
@@ -671,7 +689,7 @@ core.nodedef_default = {
|
||||
inventory_image = "",
|
||||
wield_image = "",
|
||||
wield_scale = {x=1,y=1,z=1},
|
||||
stack_max = 99,
|
||||
stack_max = default_stack_max,
|
||||
usable = false,
|
||||
liquids_pointable = false,
|
||||
tool_capabilities = nil,
|
||||
@@ -689,10 +707,6 @@ core.nodedef_default = {
|
||||
|
||||
on_receive_fields = nil,
|
||||
|
||||
on_metadata_inventory_move = core.node_metadata_inventory_move_allow_all,
|
||||
on_metadata_inventory_offer = core.node_metadata_inventory_offer_allow_all,
|
||||
on_metadata_inventory_take = core.node_metadata_inventory_take_allow_all,
|
||||
|
||||
-- Node properties
|
||||
drawtype = "normal",
|
||||
visual_scale = 1.0,
|
||||
@@ -703,7 +717,6 @@ core.nodedef_default = {
|
||||
-- {name="", backface_culling=true},
|
||||
-- {name="", backface_culling=true},
|
||||
--},
|
||||
alpha = 255,
|
||||
post_effect_color = {a=0, r=0, g=0, b=0},
|
||||
paramtype = "none",
|
||||
paramtype2 = "none",
|
||||
@@ -735,7 +748,7 @@ core.craftitemdef_default = {
|
||||
inventory_image = "",
|
||||
wield_image = "",
|
||||
wield_scale = {x=1,y=1,z=1},
|
||||
stack_max = 99,
|
||||
stack_max = default_stack_max,
|
||||
liquids_pointable = false,
|
||||
tool_capabilities = nil,
|
||||
|
||||
@@ -773,7 +786,7 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items
|
||||
inventory_image = "",
|
||||
wield_image = "",
|
||||
wield_scale = {x=1,y=1,z=1},
|
||||
stack_max = 99,
|
||||
stack_max = default_stack_max,
|
||||
liquids_pointable = false,
|
||||
tool_capabilities = nil,
|
||||
|
||||
|
||||
@@ -27,15 +27,17 @@ core.register_entity(":__builtin:item", {
|
||||
visual = "wielditem",
|
||||
visual_size = {x = 0.4, y = 0.4},
|
||||
textures = {""},
|
||||
spritediv = {x = 1, y = 1},
|
||||
initial_sprite_basepos = {x = 0, y = 0},
|
||||
is_visible = false,
|
||||
},
|
||||
|
||||
itemstring = "",
|
||||
moving_state = true,
|
||||
slippery_state = false,
|
||||
physical_state = true,
|
||||
-- Item expiry
|
||||
age = 0,
|
||||
-- Pushing item out of solid nodes
|
||||
force_out = nil,
|
||||
force_out_start = nil,
|
||||
|
||||
set_item = function(self, item)
|
||||
local stack = ItemStack(item or self.itemstring)
|
||||
@@ -52,18 +54,19 @@ core.register_entity(":__builtin:item", {
|
||||
local max_count = stack:get_stack_max()
|
||||
local count = math.min(stack:get_count(), max_count)
|
||||
local size = 0.2 + 0.1 * (count / max_count) ^ (1 / 3)
|
||||
local coll_height = size * 0.75
|
||||
local def = core.registered_items[itemname]
|
||||
local glow = def and def.light_source and
|
||||
math.floor(def.light_source / 2 + 0.5)
|
||||
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
visual = "wielditem",
|
||||
textures = {itemname},
|
||||
visual_size = {x = size, y = size},
|
||||
collisionbox = {-size, -coll_height, -size,
|
||||
size, coll_height, size},
|
||||
selectionbox = {-size, -size, -size, size, size, size},
|
||||
collisionbox = {-size, -size, -size, size, size, size},
|
||||
automatic_rotate = math.pi * 0.5 * 0.2 / size,
|
||||
wield_item = self.itemstring,
|
||||
glow = glow,
|
||||
})
|
||||
|
||||
end,
|
||||
@@ -131,7 +134,25 @@ core.register_entity(":__builtin:item", {
|
||||
return true
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
enable_physics = function(self)
|
||||
if not self.physical_state then
|
||||
self.physical_state = true
|
||||
self.object:set_properties({physical = true})
|
||||
self.object:set_velocity({x=0, y=0, z=0})
|
||||
self.object:set_acceleration({x=0, y=-gravity, z=0})
|
||||
end
|
||||
end,
|
||||
|
||||
disable_physics = function(self)
|
||||
if self.physical_state then
|
||||
self.physical_state = false
|
||||
self.object:set_properties({physical = false})
|
||||
self.object:set_velocity({x=0, y=0, z=0})
|
||||
self.object:set_acceleration({x=0, y=0, z=0})
|
||||
end
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime, moveresult)
|
||||
self.age = self.age + dtime
|
||||
if time_to_live > 0 and self.age > time_to_live then
|
||||
self.itemstring = ""
|
||||
@@ -152,46 +173,125 @@ core.register_entity(":__builtin:item", {
|
||||
return
|
||||
end
|
||||
|
||||
local vel = self.object:get_velocity()
|
||||
local def = node and core.registered_nodes[node.name]
|
||||
local is_moving = (def and not def.walkable) or
|
||||
vel.x ~= 0 or vel.y ~= 0 or vel.z ~= 0
|
||||
local is_slippery = false
|
||||
|
||||
if def and def.walkable then
|
||||
local slippery = core.get_item_group(node.name, "slippery")
|
||||
is_slippery = slippery ~= 0
|
||||
if is_slippery and (math.abs(vel.x) > 0.2 or math.abs(vel.z) > 0.2) then
|
||||
-- Horizontal deceleration
|
||||
local slip_factor = 4.0 / (slippery + 4)
|
||||
self.object:set_acceleration({
|
||||
x = -vel.x * slip_factor,
|
||||
y = 0,
|
||||
z = -vel.z * slip_factor
|
||||
})
|
||||
elseif vel.y == 0 then
|
||||
is_moving = false
|
||||
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 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
|
||||
(f.y > 0 and pos.y + c[2] > s.y + 0.5) or
|
||||
(f.z > 0 and pos.z + c[3] > s.z + 0.5) or
|
||||
(f.x < 0 and pos.x + c[4] < s.x - 0.5) or
|
||||
(f.z < 0 and pos.z + c[6] < s.z - 0.5)
|
||||
if ok then
|
||||
-- Item was successfully forced out
|
||||
self.force_out = nil
|
||||
self:enable_physics()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if self.moving_state == is_moving and
|
||||
self.slippery_state == is_slippery then
|
||||
-- Do not update anything until the moving state changes
|
||||
if not self.physical_state then
|
||||
return -- Don't do anything
|
||||
end
|
||||
|
||||
assert(moveresult,
|
||||
"Collision info missing, this is caused by an out-of-date/buggy mod or game")
|
||||
|
||||
if not moveresult.collides then
|
||||
-- future TODO: items should probably decelerate in air
|
||||
return
|
||||
end
|
||||
|
||||
self.moving_state = is_moving
|
||||
self.slippery_state = is_slippery
|
||||
|
||||
if is_moving then
|
||||
self.object:set_acceleration({x = 0, y = -gravity, z = 0})
|
||||
else
|
||||
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
||||
self.object:set_velocity({x = 0, y = 0, z = 0})
|
||||
-- Push item out when stuck inside solid node
|
||||
local is_stuck = false
|
||||
local snode = core.get_node_or_nil(pos)
|
||||
if snode then
|
||||
local sdef = core.registered_nodes[snode.name] or {}
|
||||
is_stuck = (sdef.walkable == nil or sdef.walkable == true)
|
||||
and (sdef.collision_box == nil or sdef.collision_box.type == "regular")
|
||||
and (sdef.node_box == nil or sdef.node_box.type == "regular")
|
||||
end
|
||||
|
||||
--Only collect items if not moving
|
||||
if is_moving then
|
||||
if is_stuck then
|
||||
local shootdir
|
||||
local order = {
|
||||
{x=1, y=0, z=0}, {x=-1, y=0, z= 0},
|
||||
{x=0, y=0, z=1}, {x= 0, y=0, z=-1},
|
||||
}
|
||||
|
||||
-- Check which one of the 4 sides is free
|
||||
for o = 1, #order do
|
||||
local cnode = core.get_node(vector.add(pos, order[o])).name
|
||||
local cdef = core.registered_nodes[cnode] or {}
|
||||
if cnode ~= "ignore" and cdef.walkable == false then
|
||||
shootdir = order[o]
|
||||
break
|
||||
end
|
||||
end
|
||||
-- If none of the 4 sides is free, check upwards
|
||||
if not shootdir then
|
||||
shootdir = {x=0, y=1, z=0}
|
||||
local cnode = core.get_node(vector.add(pos, shootdir)).name
|
||||
if cnode == "ignore" then
|
||||
shootdir = nil -- Do not push into ignore
|
||||
end
|
||||
end
|
||||
|
||||
if shootdir then
|
||||
-- Set new item moving speed accordingly
|
||||
local newv = vector.multiply(shootdir, 3)
|
||||
self:disable_physics()
|
||||
self.object:set_velocity(newv)
|
||||
|
||||
self.force_out = newv
|
||||
self.force_out_start = vector.round(pos)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
node = nil -- ground node we're colliding with
|
||||
if moveresult.touching_ground then
|
||||
for _, info in ipairs(moveresult.collisions) do
|
||||
if info.axis == "y" then
|
||||
node = core.get_node(info.node_pos)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Slide on slippery nodes
|
||||
local def = node and core.registered_nodes[node.name]
|
||||
local keep_movement = false
|
||||
|
||||
if def then
|
||||
local slippery = core.get_item_group(node.name, "slippery")
|
||||
local vel = self.object:get_velocity()
|
||||
if slippery ~= 0 and (math.abs(vel.x) > 0.1 or math.abs(vel.z) > 0.1) then
|
||||
-- Horizontal deceleration
|
||||
local factor = math.min(4 / (slippery + 4) * dtime, 1)
|
||||
self.object:set_velocity({
|
||||
x = vel.x * (1 - factor),
|
||||
y = 0,
|
||||
z = vel.z * (1 - factor)
|
||||
})
|
||||
keep_movement = true
|
||||
end
|
||||
end
|
||||
|
||||
if not keep_movement then
|
||||
self.object:set_velocity({x=0, y=0, z=0})
|
||||
end
|
||||
|
||||
if self.moving_state == keep_movement then
|
||||
-- Do not update anything until the moving state changes
|
||||
return
|
||||
end
|
||||
self.moving_state = keep_movement
|
||||
|
||||
-- Only collect items if not moving
|
||||
if self.moving_state then
|
||||
return
|
||||
end
|
||||
-- Collect the items around to merge with
|
||||
|
||||
46
builtin/game/knockback.lua
Normal file
46
builtin/game/knockback.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
-- can be overriden by mods
|
||||
function core.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
|
||||
if damage == 0 or player:get_armor_groups().immortal then
|
||||
return 0.0
|
||||
end
|
||||
|
||||
local m = 8
|
||||
-- solve m - m*e^(k*4) = 4 for k
|
||||
local k = -0.17328
|
||||
local res = m - m * math.exp(k * damage)
|
||||
|
||||
if distance < 2.0 then
|
||||
res = res * 1.1 -- more knockback when closer
|
||||
elseif distance > 4.0 then
|
||||
res = res * 0.9 -- less when far away
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
local function vector_absmax(v)
|
||||
local max, abs = math.max, math.abs
|
||||
return max(max(abs(v.x), abs(v.y)), abs(v.z))
|
||||
end
|
||||
|
||||
core.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, unused_dir, damage)
|
||||
if player:get_hp() == 0 then
|
||||
return -- RIP
|
||||
end
|
||||
|
||||
-- Server::handleCommand_Interact() adds eye offset to one but not the other
|
||||
-- so the direction is slightly off, calculate it ourselves
|
||||
local dir = vector.subtract(player:get_pos(), hitter:get_pos())
|
||||
local d = vector.length(dir)
|
||||
if d ~= 0.0 then
|
||||
dir = vector.divide(dir, d)
|
||||
end
|
||||
|
||||
local k = core.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, d, damage)
|
||||
|
||||
local kdir = vector.multiply(dir, k)
|
||||
if vector_absmax(kdir) < 1.0 then
|
||||
return -- barely noticeable, so don't even send
|
||||
end
|
||||
|
||||
player:add_velocity(kdir)
|
||||
end)
|
||||
@@ -40,9 +40,6 @@ function core.check_player_privs(name, ...)
|
||||
end
|
||||
|
||||
|
||||
local player_list = {}
|
||||
|
||||
|
||||
function core.send_join_message(player_name)
|
||||
if not core.is_singleplayer() then
|
||||
core.chat_send_all("*** " .. player_name .. " joined the game.")
|
||||
@@ -61,8 +58,7 @@ end
|
||||
|
||||
core.register_on_joinplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
player_list[player_name] = player
|
||||
if not minetest.is_singleplayer() then
|
||||
if not core.is_singleplayer() then
|
||||
local status = core.get_server_status(player_name, true)
|
||||
if status and status ~= "" then
|
||||
core.chat_send_player(player_name, status)
|
||||
@@ -74,22 +70,10 @@ end)
|
||||
|
||||
core.register_on_leaveplayer(function(player, timed_out)
|
||||
local player_name = player:get_player_name()
|
||||
player_list[player_name] = nil
|
||||
core.send_leave_message(player_name, timed_out)
|
||||
end)
|
||||
|
||||
|
||||
function core.get_connected_players()
|
||||
local temp_table = {}
|
||||
for index, value in pairs(player_list) do
|
||||
if value:is_player_connected() then
|
||||
temp_table[#temp_table + 1] = value
|
||||
end
|
||||
end
|
||||
return temp_table
|
||||
end
|
||||
|
||||
|
||||
function core.is_player(player)
|
||||
-- a table being a player is also supported because it quacks sufficiently
|
||||
-- like a player if it has the is_player function
|
||||
@@ -167,6 +151,12 @@ function core.setting_get_pos(name)
|
||||
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)
|
||||
@@ -180,6 +170,12 @@ function core.record_protection_violation(pos, name)
|
||||
end
|
||||
end
|
||||
|
||||
-- To be overridden by Creative mods
|
||||
|
||||
local creative_mode_cache = core.settings:get_bool("creative_mode")
|
||||
function core.is_creative_enabled(name)
|
||||
return creative_mode_cache
|
||||
end
|
||||
|
||||
-- Checks if specified volume intersects a protected volume
|
||||
|
||||
@@ -270,3 +266,26 @@ end
|
||||
function core.cancel_shutdown_requests()
|
||||
core.request_shutdown("", false, -1)
|
||||
end
|
||||
|
||||
|
||||
-- Callback handling for dynamic_add_media
|
||||
|
||||
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
|
||||
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
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ function core.register_privilege(name, param)
|
||||
def.description = "(no description)"
|
||||
end
|
||||
end
|
||||
local def = {}
|
||||
local def
|
||||
if type(param) == "table" then
|
||||
def = param
|
||||
else
|
||||
|
||||
@@ -79,6 +79,7 @@ end
|
||||
|
||||
function core.register_abm(spec)
|
||||
-- Add to core.registered_abms
|
||||
assert(type(spec.action) == "function", "Required field 'action' of type function")
|
||||
core.registered_abms[#core.registered_abms + 1] = spec
|
||||
spec.mod_origin = core.get_current_modname() or "??"
|
||||
end
|
||||
@@ -86,6 +87,7 @@ end
|
||||
function core.register_lbm(spec)
|
||||
-- Add to core.registered_lbms
|
||||
check_modname_prefix(spec.name)
|
||||
assert(type(spec.action) == "function", "Required field 'action' of type function")
|
||||
core.registered_lbms[#core.registered_lbms + 1] = spec
|
||||
spec.mod_origin = core.get_current_modname() or "??"
|
||||
end
|
||||
@@ -254,6 +256,18 @@ function core.register_tool(name, tooldef)
|
||||
end
|
||||
-- END Legacy stuff
|
||||
|
||||
-- This isn't just legacy, but more of a convenience feature
|
||||
local toolcaps = tooldef.tool_capabilities
|
||||
if toolcaps and toolcaps.punch_attack_uses == nil then
|
||||
for _, cap in pairs(toolcaps.groupcaps or {}) do
|
||||
local level = (cap.maxlevel or 0) - 1
|
||||
if (cap.uses or 0) ~= 0 and level >= 0 then
|
||||
toolcaps.punch_attack_uses = cap.uses * (3 ^ level)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
core.register_item(name, tooldef)
|
||||
end
|
||||
|
||||
@@ -301,19 +315,11 @@ end
|
||||
|
||||
-- Alias the forbidden item names to "" so they can't be
|
||||
-- created via itemstrings (e.g. /give)
|
||||
local name
|
||||
for name in pairs(forbidden_item_names) do
|
||||
core.registered_aliases[name] = ""
|
||||
register_alias_raw(name, "")
|
||||
end
|
||||
|
||||
|
||||
-- Deprecated:
|
||||
-- Aliases for core.register_alias (how ironic...)
|
||||
--core.alias_node = core.register_alias
|
||||
--core.alias_tool = core.register_alias
|
||||
--core.alias_craftitem = core.register_alias
|
||||
|
||||
--
|
||||
-- Built-in node definitions. Also defined in C.
|
||||
--
|
||||
@@ -361,9 +367,9 @@ core.register_node(":ignore", {
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
minetest.chat_send_player(
|
||||
core.chat_send_player(
|
||||
placer:get_player_name(),
|
||||
minetest.colorize("#FF0000",
|
||||
core.colorize("#FF0000",
|
||||
"You can't place 'ignore' nodes!"))
|
||||
return ""
|
||||
end,
|
||||
@@ -372,6 +378,7 @@ core.register_node(":ignore", {
|
||||
-- The hand (bare definition)
|
||||
core.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
@@ -411,10 +418,6 @@ function core.run_callbacks(callbacks, mode, ...)
|
||||
local origin = core.callback_origins[callbacks[i]]
|
||||
if origin then
|
||||
core.set_last_run_mod(origin.mod)
|
||||
--print("Running " .. tostring(callbacks[i]) ..
|
||||
-- " (a " .. origin.name .. " callback in " .. origin.mod .. ")")
|
||||
else
|
||||
--print("No data associated with callback")
|
||||
end
|
||||
local cb_ret = callbacks[i](...)
|
||||
|
||||
@@ -514,11 +517,17 @@ local function make_registration_wrap(reg_fn_name, clear_fn_name)
|
||||
end
|
||||
|
||||
local function make_wrap_deregistration(reg_fn, clear_fn, list)
|
||||
local unregister = function (unregistered_key)
|
||||
local unregister = function (key)
|
||||
if type(key) ~= "string" then
|
||||
error("key is not a string", 2)
|
||||
end
|
||||
if not list[key] then
|
||||
error("Attempt to unregister non-existent element - '" .. key .. "'", 2)
|
||||
end
|
||||
local temporary_list = table.copy(list)
|
||||
clear_fn()
|
||||
for k,v in pairs(temporary_list) do
|
||||
if unregistered_key ~= k then
|
||||
if key ~= k then
|
||||
reg_fn(v)
|
||||
end
|
||||
end
|
||||
@@ -529,7 +538,7 @@ end
|
||||
core.registered_on_player_hpchanges = { modifiers = { }, loggers = { } }
|
||||
|
||||
function core.registered_on_player_hpchange(player, hp_change, reason)
|
||||
local last = false
|
||||
local last
|
||||
for i = #core.registered_on_player_hpchanges.modifiers, 1, -1 do
|
||||
local func = core.registered_on_player_hpchanges.modifiers[i]
|
||||
hp_change, last = func(player, hp_change, reason)
|
||||
@@ -564,9 +573,11 @@ core.registered_biomes = make_registration_wrap("register_biome", "cle
|
||||
core.registered_ores = make_registration_wrap("register_ore", "clear_registered_ores")
|
||||
core.registered_decorations = make_registration_wrap("register_decoration", "clear_registered_decorations")
|
||||
|
||||
core.unregister_biome = make_wrap_deregistration(core.register_biome, core.clear_registered_biomes, core.registered_biomes)
|
||||
core.unregister_biome = make_wrap_deregistration(core.register_biome,
|
||||
core.clear_registered_biomes, core.registered_biomes)
|
||||
|
||||
core.registered_on_chat_messages, core.register_on_chat_message = make_registration()
|
||||
core.registered_on_chatcommands, core.register_on_chatcommand = make_registration()
|
||||
core.registered_globalsteps, core.register_globalstep = make_registration()
|
||||
core.registered_playerevents, core.register_playerevent = make_registration()
|
||||
core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration()
|
||||
@@ -590,11 +601,12 @@ core.registered_on_item_eats, core.register_on_item_eat = make_registration()
|
||||
core.registered_on_punchplayers, core.register_on_punchplayer = make_registration()
|
||||
core.registered_on_priv_grant, core.register_on_priv_grant = make_registration()
|
||||
core.registered_on_priv_revoke, core.register_on_priv_revoke = make_registration()
|
||||
core.registered_on_authplayers, core.register_on_authplayer = make_registration()
|
||||
core.registered_can_bypass_userlimit, core.register_can_bypass_userlimit = make_registration()
|
||||
core.registered_on_modchannel_message, core.register_on_modchannel_message = make_registration()
|
||||
core.registered_on_auth_fail, core.register_on_auth_fail = make_registration()
|
||||
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()
|
||||
|
||||
--
|
||||
-- Compatibility for on_mapgen_init()
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
-- cache setting
|
||||
local enable_damage = core.settings:get_bool("enable_damage")
|
||||
|
||||
local health_bar_definition =
|
||||
{
|
||||
local health_bar_definition = {
|
||||
hud_elem_type = "statbar",
|
||||
position = { x=0.5, y=1 },
|
||||
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)},
|
||||
size = {x = 24, y = 24},
|
||||
offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)},
|
||||
}
|
||||
|
||||
local breath_bar_definition =
|
||||
{
|
||||
local breath_bar_definition = {
|
||||
hud_elem_type = "statbar",
|
||||
position = { x=0.5, y=1 },
|
||||
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)},
|
||||
size = {x = 24, y = 24},
|
||||
offset = {x = 25, y= -(48 + 24 + 16)},
|
||||
}
|
||||
|
||||
local hud_ids = {}
|
||||
@@ -28,10 +30,10 @@ local hud_ids = {}
|
||||
local function scaleToDefault(player, field)
|
||||
-- Scale "hp" or "breath" to the default dimensions
|
||||
local current = player["get_" .. field](player)
|
||||
local nominal = core["PLAYER_MAX_".. field:upper() .. "_DEFAULT"]
|
||||
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
|
||||
math.max(player:get_properties()[field .. "_max"], current))
|
||||
return current / max_display * nominal
|
||||
end
|
||||
|
||||
local function update_builtin_statbars(player)
|
||||
@@ -50,10 +52,12 @@ local function update_builtin_statbars(player)
|
||||
end
|
||||
local hud = hud_ids[name]
|
||||
|
||||
if flags.healthbar and enable_damage then
|
||||
local immortal = player:get_armor_groups().immortal == 1
|
||||
|
||||
if flags.healthbar and enable_damage and not immortal then
|
||||
local number = scaleToDefault(player, "hp")
|
||||
if hud.id_healthbar == nil then
|
||||
local hud_def = table.copy(health_bar_definition)
|
||||
if hud.id_healthbar == nil then
|
||||
local hud_def = table.copy(health_bar_definition)
|
||||
hud_def.number = number
|
||||
hud.id_healthbar = player:hud_add(hud_def)
|
||||
else
|
||||
@@ -64,19 +68,28 @@ local function update_builtin_statbars(player)
|
||||
hud.id_healthbar = nil
|
||||
end
|
||||
|
||||
local show_breathbar = flags.breathbar and enable_damage and not immortal
|
||||
|
||||
local breath = player:get_breath()
|
||||
local breath_max = player:get_properties().breath_max
|
||||
if flags.breathbar and enable_damage and
|
||||
player:get_breath() < breath_max then
|
||||
if show_breathbar and breath <= breath_max then
|
||||
local number = 2 * scaleToDefault(player, "breath")
|
||||
if hud.id_breathbar == nil then
|
||||
local hud_def = table.copy(breath_bar_definition)
|
||||
if not hud.id_breathbar and breath < breath_max then
|
||||
local hud_def = table.copy(breath_bar_definition)
|
||||
hud_def.number = number
|
||||
hud.id_breathbar = player:hud_add(hud_def)
|
||||
else
|
||||
elseif hud.id_breathbar then
|
||||
player:hud_change(hud.id_breathbar, "number", number)
|
||||
end
|
||||
elseif hud.id_breathbar then
|
||||
player:hud_remove(hud.id_breathbar)
|
||||
end
|
||||
|
||||
if hud.id_breathbar and (not show_breathbar or breath == breath_max) then
|
||||
core.after(1, function(player_name, breath_bar)
|
||||
local player = core.get_player_by_name(player_name)
|
||||
if player then
|
||||
player:hud_remove(breath_bar)
|
||||
end
|
||||
end, name, hud.id_breathbar)
|
||||
hud.id_breathbar = nil
|
||||
end
|
||||
end
|
||||
@@ -116,7 +129,7 @@ local function player_event_handler(player,eventname)
|
||||
end
|
||||
end
|
||||
|
||||
if eventname == "hud_changed" then
|
||||
if eventname == "hud_changed" or eventname == "properties_changed" then
|
||||
update_builtin_statbars(player)
|
||||
return true
|
||||
end
|
||||
@@ -124,14 +137,14 @@ local function player_event_handler(player,eventname)
|
||||
return false
|
||||
end
|
||||
|
||||
function core.hud_replace_builtin(name, definition)
|
||||
function core.hud_replace_builtin(hud_name, definition)
|
||||
|
||||
if type(definition) ~= "table" or
|
||||
definition.hud_elem_type ~= "statbar" then
|
||||
return false
|
||||
end
|
||||
|
||||
if name == "health" then
|
||||
if hud_name == "health" then
|
||||
health_bar_definition = definition
|
||||
|
||||
for name, ids in pairs(hud_ids) do
|
||||
@@ -145,7 +158,7 @@ function core.hud_replace_builtin(name, definition)
|
||||
return true
|
||||
end
|
||||
|
||||
if name == "breath" then
|
||||
if hud_name == "breath" then
|
||||
breath_bar_definition = definition
|
||||
|
||||
for name, ids in pairs(hud_ids) do
|
||||
|
||||
@@ -36,11 +36,23 @@ dofile(commonpath .. "misc_helpers.lua")
|
||||
|
||||
if INIT == "game" then
|
||||
dofile(gamepath .. "init.lua")
|
||||
assert(not core.get_http_api)
|
||||
elseif INIT == "mainmenu" then
|
||||
local mm_script = core.settings:get("main_menu_script")
|
||||
local custom_loaded = false
|
||||
if mm_script and mm_script ~= "" then
|
||||
dofile(mm_script)
|
||||
else
|
||||
local testfile = io.open(mm_script, "r")
|
||||
if testfile then
|
||||
testfile:close()
|
||||
dofile(mm_script)
|
||||
custom_loaded = true
|
||||
core.log("info", "Loaded custom main menu script: "..mm_script)
|
||||
else
|
||||
core.log("error", "Failed to load custom main menu script: "..mm_script)
|
||||
core.log("info", "Falling back to default main menu script")
|
||||
end
|
||||
end
|
||||
if not custom_loaded then
|
||||
dofile(core.get_mainmenu_path() .. DIR_DELIM .. "init.lua")
|
||||
end
|
||||
elseif INIT == "async" then
|
||||
|
||||
@@ -8,15 +8,7 @@ local function handle_job(jobid, serialized_retval)
|
||||
core.async_jobs[jobid] = nil
|
||||
end
|
||||
|
||||
if core.register_globalstep then
|
||||
core.register_globalstep(function(dtime)
|
||||
for i, job in ipairs(core.get_finished_jobs()) do
|
||||
handle_job(job.jobid, job.retval)
|
||||
end
|
||||
end)
|
||||
else
|
||||
core.async_event_handler = handle_job
|
||||
end
|
||||
core.async_event_handler = handle_job
|
||||
|
||||
function core.handle_async(func, parameter, callback)
|
||||
-- Serialize function
|
||||
@@ -62,24 +62,6 @@ function image_column(tooltip, flagname)
|
||||
"5=" .. core.formspec_escape(defaulttexturedir .. "server_ping_1.png")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function order_favorite_list(list)
|
||||
local res = {}
|
||||
--orders the favorite list after support
|
||||
for i = 1, #list do
|
||||
local fav = list[i]
|
||||
if is_server_protocol_compat(fav.proto_min, fav.proto_max) then
|
||||
res[#res + 1] = fav
|
||||
end
|
||||
end
|
||||
for i = 1, #list do
|
||||
local fav = list[i]
|
||||
if not is_server_protocol_compat(fav.proto_min, fav.proto_max) then
|
||||
res[#res + 1] = fav
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function render_serverlist_row(spec, is_favorite)
|
||||
@@ -87,15 +69,15 @@ function render_serverlist_row(spec, is_favorite)
|
||||
if spec.name then
|
||||
text = text .. core.formspec_escape(spec.name:trim())
|
||||
elseif spec.address then
|
||||
text = text .. spec.address:trim()
|
||||
text = text .. core.formspec_escape(spec.address:trim())
|
||||
if spec.port then
|
||||
text = text .. ":" .. spec.port
|
||||
end
|
||||
end
|
||||
|
||||
local details = ""
|
||||
local grey_out = not is_server_protocol_compat(spec.proto_min, spec.proto_max)
|
||||
|
||||
local details
|
||||
if is_favorite then
|
||||
details = "1,"
|
||||
else
|
||||
@@ -118,11 +100,11 @@ function render_serverlist_row(spec, is_favorite)
|
||||
end
|
||||
|
||||
if spec.clients and spec.clients_max then
|
||||
local clients_color = ''
|
||||
local clients_percent = 100 * spec.clients / spec.clients_max
|
||||
|
||||
-- Choose a color depending on how many clients are connected
|
||||
-- (relatively to clients_max)
|
||||
local clients_color
|
||||
if grey_out then clients_color = '#aaaaaa'
|
||||
elseif spec.clients == 0 then clients_color = '' -- 0 players: default/white
|
||||
elseif clients_percent <= 60 then clients_color = '#a1e587' -- 0-60%: green
|
||||
@@ -164,34 +146,15 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
os.tempfolder = function()
|
||||
if core.settings:get("TMPFolder") then
|
||||
return core.settings:get("TMPFolder") .. DIR_DELIM .. "MT_" .. math.random(0,10000)
|
||||
end
|
||||
local temp = core.get_temp_path()
|
||||
return temp .. DIR_DELIM .. "MT_" .. math.random(0, 10000)
|
||||
end
|
||||
|
||||
local filetocheck = os.tmpname()
|
||||
os.remove(filetocheck)
|
||||
|
||||
-- https://blogs.msdn.microsoft.com/vcblog/2014/06/18/c-runtime-crt-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1/
|
||||
-- The C runtime (CRT) function called by os.tmpname is tmpnam.
|
||||
-- Microsofts tmpnam implementation in older CRT / MSVC releases is defective.
|
||||
-- tmpnam return values starting with a backslash characterize this behavior.
|
||||
-- https://sourceforge.net/p/mingw-w64/bugs/555/
|
||||
-- MinGW tmpnam implementation is forwarded to the CRT directly.
|
||||
-- https://sourceforge.net/p/mingw-w64/discussion/723797/thread/55520785/
|
||||
-- MinGW links to an older CRT release (msvcrt.dll).
|
||||
-- Due to legal concerns MinGW will never use a newer CRT.
|
||||
--
|
||||
-- Make use of TEMP to compose the temporary filename if an old
|
||||
-- style tmpnam return value is detected.
|
||||
if filetocheck:sub(1, 1) == "\\" then
|
||||
local tempfolder = os.getenv("TEMP")
|
||||
return tempfolder .. filetocheck
|
||||
end
|
||||
|
||||
local randname = "MTTempModFolder_" .. math.random(0,10000)
|
||||
local backstring = filetocheck:reverse()
|
||||
return filetocheck:sub(0, filetocheck:len() - backstring:find(DIR_DELIM) + 1) ..
|
||||
randname
|
||||
--------------------------------------------------------------------------------
|
||||
os.tmpname = function()
|
||||
local path = os.tempfolder()
|
||||
io.open(path, "w"):close()
|
||||
return path
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -225,41 +188,6 @@ function menu_handle_key_up_down(fields, textlist, settingname)
|
||||
return false
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function asyncOnlineFavourites()
|
||||
if not menudata.public_known then
|
||||
menudata.public_known = {{
|
||||
name = fgettext("Loading..."),
|
||||
description = fgettext_ne("Try reenabling public serverlist and check your internet connection.")
|
||||
}}
|
||||
end
|
||||
menudata.favorites = menudata.public_known
|
||||
menudata.favorites_is_public = true
|
||||
|
||||
if not menudata.public_downloading then
|
||||
menudata.public_downloading = true
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
core.handle_async(
|
||||
function(param)
|
||||
return core.get_favorites("online")
|
||||
end,
|
||||
nil,
|
||||
function(result)
|
||||
menudata.public_downloading = nil
|
||||
local favs = order_favorite_list(result)
|
||||
if favs[1] then
|
||||
menudata.public_known = favs
|
||||
menudata.favorites = menudata.public_known
|
||||
menudata.favorites_is_public = true
|
||||
end
|
||||
core.event_handler("Refresh")
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function text2textlist(xpos, ypos, width, height, tl_name, textlen, text, transparency)
|
||||
local textlines = core.wrap_text(text, textlen, true)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user