Compare commits
263 Commits
stable-5.2
...
stable-4.X
Author | SHA1 | Date | |
---|---|---|---|
a164244d29 | |||
0375e89047 | |||
e36906f5ba | |||
ed9fcb842e | |||
e406c1d5f5 | |||
aa3e2220d6 | |||
6f48f790d4 | |||
23759f5ce4 | |||
2073e5409b | |||
e713d3567c | |||
696ec9a022 | |||
cb8fa1e674 | |||
02da4d6a59 | |||
a1eecb0267 | |||
ae90f8d699 | |||
6ced19624f | |||
3a9313b0c3 | |||
2f2c13068c | |||
e9dda911e2 | |||
aa98a66666 | |||
23d8b837f4 | |||
209f31601d | |||
4c3adcf77c | |||
0cab4b1c19 | |||
9cf276044a | |||
416068c790 | |||
e1f5d81550 | |||
ff4334f40c | |||
bd6cdda2b1 | |||
e31a6b99b7 | |||
|
5cb24d5327 | ||
a1402c0b0e | |||
31c5301083 | |||
54aac56a24 | |||
72f2e27ed8 | |||
da9cadc875 | |||
d18f422205 | |||
e5cb5c242d | |||
55b53cfe67 | |||
3eabd6eba3 | |||
6a757711fb | |||
|
9cd74b3419 | ||
83a552ed1a | |||
|
1783ccf348 | ||
582ee14446 | |||
0f9d6c3982 | |||
d5b84dfe46 | |||
61e382387d | |||
5b36c2c2c0 | |||
ee31b5db78 | |||
896eb23701 | |||
809dc316f9 | |||
1fdb8a11ab | |||
ffba2b7646 | |||
|
46e0be8c26 | ||
00c3a46e83 | |||
dda9276abb | |||
1062de4925 | |||
1fea9f2e10 | |||
7336cbdfe2 | |||
|
ca7eccfcb6 | ||
866f9f78c5 | |||
|
1344b5dcc3 | ||
|
21b1462b58 | ||
a4751255ed | |||
9868760f6c | |||
|
a4cd5f8e48 | ||
|
8507e651eb | ||
|
c1b07acf4a | ||
|
acb0f3450d | ||
|
55a77e8094 | ||
|
c8520b8e2b | ||
|
13ad926546 | ||
|
57c73a6c84 | ||
15cccd7fde | |||
263f4574ac | |||
|
426b5d3149 | ||
|
dda844be16 | ||
|
899dcbf1ee | ||
|
957c59a678 | ||
|
3d15a6774d | ||
|
3c24f941e0 | ||
|
9d64805ec1 | ||
|
ce4497224f | ||
|
a873a3f4f8 | ||
|
86e29ae586 | ||
|
dd5f03731a | ||
|
5e7faf3f50 | ||
|
8427ae529a | ||
|
2e85254e91 | ||
|
971dea7efd | ||
|
85ce23b165 | ||
|
e66d5e500c | ||
|
ea86ecf015 | ||
|
4a48cd57e8 | ||
|
289c8dfde5 | ||
|
9dfe9be1f3 | ||
|
f5c9c760e3 | ||
|
6dc7177a5d | ||
|
24a2fd4dc4 | ||
|
2515207606 | ||
|
119aa5c919 | ||
|
fb4bfc60de | ||
|
9bbe99b4f8 | ||
|
0ef9c53a8c | ||
|
b5350e27ad | ||
|
ecbb9310de | ||
|
aac35a6e7c | ||
|
04fe8cc0a2 | ||
|
24abdf45b9 | ||
|
263400b3d8 | ||
|
695d02e6bd | ||
|
e2815d27f1 | ||
|
ebfdb21624 | ||
|
0088fa6db4 | ||
|
e660b05523 | ||
|
14d20f5827 | ||
|
0414322d23 | ||
|
a6cfe73cb0 | ||
|
1d06a8ef6c | ||
|
875972ffa6 | ||
|
396daf1be1 | ||
|
fe41725e50 | ||
|
5624cf750f | ||
|
1d7fbd035d | ||
|
a6b9acb7af | ||
|
c40f535df8 | ||
|
79fde0dd52 | ||
|
8aaf526730 | ||
|
c683e050d4 | ||
|
c2e39b9363 | ||
|
f8cc92c190 | ||
|
858c41b842 | ||
|
2a4fbbbff8 | ||
|
6d346a817b | ||
|
529f00a240 | ||
|
7725030067 | ||
|
bb28afcfc3 | ||
|
880a25c921 | ||
|
0268c9d7c9 | ||
|
f72490950a | ||
|
9d3fa874be | ||
|
842eccee19 | ||
|
127b1fa6f8 | ||
|
6b5e2618fb | ||
|
b2099d4277 | ||
|
df0a8574dc | ||
|
6698067256 | ||
|
bb219e1059 | ||
|
b3167d4e57 | ||
|
8a849e893a | ||
|
f9738c1909 | ||
|
6f80e302fd | ||
|
48ebbf0fc6 | ||
|
7d9dbbbf3c | ||
|
7cc1a36b3c | ||
|
3f1094475f | ||
|
f72ac42ca0 | ||
|
8fba3c93d5 | ||
|
a90c314c80 | ||
|
222fab3d20 | ||
|
1cf32b22be | ||
|
6f803b9c89 | ||
|
0fe3e7574d | ||
|
b816c63196 | ||
|
313ca53b36 | ||
|
a65a46b889 | ||
|
0cfe3a810a | ||
|
6808a3d144 | ||
|
4d9bf75d3a | ||
|
416c4535c7 | ||
|
73baeb82ef | ||
|
7b8288d605 | ||
|
2f969196b8 | ||
|
0041bcc73e | ||
|
cc48c95ca7 | ||
|
0129c9a9dd | ||
|
9dc1f2d638 | ||
|
d215198fe8 | ||
|
c56c3d8d6f | ||
|
0034abb560 | ||
|
200e9cc4a2 | ||
|
6b0fb94d60 | ||
|
017815161b | ||
|
ab72100a2c | ||
|
9927076b47 | ||
|
bd8d6f8f2f | ||
|
3a9d500396 | ||
|
01b9da870b | ||
|
e8286e8894 | ||
|
b8f473be21 | ||
|
b1fae4c7be | ||
|
c2a0333901 | ||
|
5b2461c713 | ||
|
e9087d1be7 | ||
|
bb4ef52954 | ||
|
888b99e1b6 | ||
|
2c450ed93f | ||
|
d9c7af109a | ||
|
12562be393 | ||
|
151c19a6be | ||
|
9d40d89d27 | ||
|
037b01eac7 | ||
|
c789c532bb | ||
|
b3ffe675c3 | ||
|
90a9e4e69f | ||
|
e5311a4d56 | ||
|
4be7d8b43a | ||
|
070ab6654a | ||
|
ebf9dda2e6 | ||
|
c352ff71e8 | ||
|
26d0753d87 | ||
|
46ff2e2cef | ||
|
a08a93bc9c | ||
|
6e0557e20c | ||
|
0c91c65a11 | ||
|
849fe19f8c | ||
|
cfa6216694 | ||
|
322e5aaf92 | ||
|
03bc584f57 | ||
|
5f796f7a04 | ||
|
7aa52fe4e1 | ||
|
0664b5f772 | ||
|
14b039f0b4 | ||
|
c399f5a541 | ||
|
f736226c1a | ||
|
e665e75e77 | ||
|
cba783f7fa | ||
|
87b9451820 | ||
|
41b7823057 | ||
|
7968f1ddaa | ||
|
caecdb681c | ||
|
81d56b9491 | ||
|
8077612dcb | ||
|
07fddf1f6c | ||
|
315b00d150 | ||
|
0c0248a19c | ||
|
0429ec4cfd | ||
|
a740a48f62 | ||
|
b12f569fc6 | ||
|
7993a403f2 | ||
|
b0df67d9c0 | ||
|
45ff8569d7 | ||
|
82bfa2ee7b | ||
|
9ef2e5000f | ||
|
678546308e | ||
|
6f688c50ee | ||
|
bb603ff18e | ||
|
4208fdfd22 | ||
|
4875213168 | ||
|
f92540e8ad | ||
|
ec0bf899ed | ||
|
2b635a892c | ||
|
7f6fc148bd | ||
|
878e9f7594 | ||
|
c7249f5983 | ||
|
7f07858209 | ||
|
9e9688fc61 | ||
|
93e5ab367a | ||
|
60fa5807b9 | ||
|
9dbca41385 | ||
|
61588a43dd | ||
|
e62927ed71 |
@ -2,7 +2,7 @@ BasedOnStyle: LLVM
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Custom
|
||||
Standard: Cpp03
|
||||
Standard: Cpp11
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: false
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -35,6 +35,7 @@ gtags.files
|
||||
/bin/
|
||||
/games/*
|
||||
!/games/minimal/
|
||||
!/games/minetest/
|
||||
/cache
|
||||
/textures/*
|
||||
!/textures/base/
|
||||
@ -77,6 +78,7 @@ src/cmake_config_githash.h
|
||||
src/lua/build/
|
||||
locale/
|
||||
.directory
|
||||
.gradle/
|
||||
*.cbp
|
||||
*.layout
|
||||
*.o
|
||||
@ -84,6 +86,8 @@ locale/
|
||||
*.ninja
|
||||
.ninja*
|
||||
*.gch
|
||||
*.iml
|
||||
test_config.h
|
||||
cmake-build-debug/
|
||||
cmake-build-release/
|
||||
|
||||
|
409
.gitlab-ci.yml
409
.gitlab-ci.yml
@ -1,7 +1,9 @@
|
||||
---
|
||||
# Github repository is cloned every day on Gitlab.com
|
||||
# https://gitlab.com/minetest/minetest
|
||||
# Pipelines URL: https://gitlab.com/minetest/minetest/pipelines
|
||||
|
||||
# Github repository is really at minetest.org using the poikilos git.minetest.io
|
||||
# https://gitlab.com/minenux/minetest-engine-minetest
|
||||
# Pipelines URL: https://gitlab.com/minenux/minetest-engine-minetest/pipelines
|
||||
# packages moved to https://build.opensuse.org/project/show/home:venenux:minenux
|
||||
# in future we only build here, or made apk packs for alpine
|
||||
|
||||
stages:
|
||||
- build
|
||||
@ -9,215 +11,294 @@ stages:
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git"
|
||||
MINETEST_GAME_REPO: "https://gitlab.com/minenux/minetest-game-minetest.git"
|
||||
|
||||
.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 ..
|
||||
- make -j2
|
||||
- cmake -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DBUILD_SERVER=ON -DBUILD_CLIENT=ON -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=TRUE -DENABLE_GETTEXT=TRUE -DENABLE_SYSTEM_JSONCPP=TRUE APPLY_LOCALE_BLACKLIST=FALSE ..
|
||||
- make -j$(nproc)
|
||||
- make install
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 1h
|
||||
expire_in: 5h
|
||||
paths:
|
||||
- artifact/*
|
||||
|
||||
.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/
|
||||
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
|
||||
- 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/
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 30 day
|
||||
paths:
|
||||
- build/deb/*.deb
|
||||
|
||||
.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 build/deb/*.deb
|
||||
|
||||
##
|
||||
## Debian
|
||||
## Debian mother of many distros
|
||||
##
|
||||
|
||||
# Jessie
|
||||
|
||||
build:debian-8:
|
||||
<<: *build_definition
|
||||
image: debian:8
|
||||
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-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
|
||||
extends: .build_template
|
||||
image: debian:8
|
||||
before_script:
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
# - echo "Acquire::https::download.opensuse.org::Verify-Peer "false";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- rm -rf /etc/apt/sources.list
|
||||
- echo "deb http://archive.debian.org/debian/ jessie main contrib" > /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://archive.debian.org/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://deb.freexian.com/extended-lts jessie main contrib non-free" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes install build-essential cmake pkg-config cmake-data debhelper lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libjsoncpp-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libspatialindex-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev libpq-dev libhiredis-dev zlib1g-dev doxygen libxrandr-dev x11proto-xf86vidmode-dev
|
||||
|
||||
# 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
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- rm -rf /etc/apt/sources.list
|
||||
- echo "deb http://archive.debian.org/debian/ stretch main contrib" > /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://archive.debian.org/debian/ stretch-backports main contrib non-free" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://deb.freexian.com/extended-lts stretch main contrib non-free" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes install build-essential cmake pkg-config cmake-data debhelper lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libjsoncpp-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libspatialindex-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev postgresql-server-dev-all libpq-dev libhiredis-dev zlib1g-dev doxygen libxrandr-dev mesa-common-dev x11proto-xf86vidmode-dev libzstd-dev
|
||||
|
||||
package:debian-9:
|
||||
image: debian:9
|
||||
dependencies:
|
||||
- build:debian-9
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
# Bullseye
|
||||
|
||||
build:debian-11:
|
||||
extends: .build_template
|
||||
image: debian:11
|
||||
before_script:
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake pkg-config cmake-data debhelper lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libjsoncpp-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libspatialindex-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev postgresql-server-dev-all libpq-dev libhiredis-dev zlib1g-dev doxygen libxrandr-dev mesa-common-dev x11proto-xf86vidmode-dev libzstd-dev
|
||||
|
||||
# bookworm
|
||||
|
||||
build:debian-12:
|
||||
extends: .build_template
|
||||
image: debian:12
|
||||
before_script:
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake pkg-config cmake-data debhelper lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libjsoncpp-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libspatialindex-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev postgresql-server-dev-all libpq-dev libhiredis-dev zlib1g-dev doxygen libxrandr-dev mesa-common-dev x11proto-xf86vidmode-dev libzstd-dev
|
||||
|
||||
deploy:debian-9:
|
||||
image: debian:9
|
||||
dependencies:
|
||||
- package:debian-9
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
|
||||
##
|
||||
## Ubuntu
|
||||
##
|
||||
|
||||
# Trusty
|
||||
# Utopic most close to jessie
|
||||
|
||||
build:ubuntu-14.04:
|
||||
<<: *build_definition
|
||||
image: ubuntu:trusty
|
||||
build:ubuntu-14.10:
|
||||
extends: .build_template
|
||||
image: ubuntu:utopic
|
||||
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
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- rm -rf /etc/apt/sources.list
|
||||
- echo "deb http://old-releases.ubuntu.com/ubuntu/ utopic main restricted universe multiverse" > /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://old-releases.ubuntu.com/ubuntu/ utopic-updates main restricted universe multiverse" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://old-releases.ubuntu.com/ubuntu utopic-security main restricted universe multiverse" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- apt-get update -y || true
|
||||
- apt-get -y --force-yes install build-essential cmake pkg-config cmake-data debhelper lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libjsoncpp-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev libpq-dev libhiredis-dev zlib1g-dev doxygen libxrandr-dev mesa-common-dev x11proto-xf86vidmode-dev
|
||||
|
||||
package:ubuntu-14.04:
|
||||
image: ubuntu:trusty
|
||||
dependencies:
|
||||
- build:ubuntu-14.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_template
|
||||
# Zesty most close to stretch
|
||||
|
||||
deploy:ubuntu-14.04:
|
||||
image: ubuntu:trusty
|
||||
dependencies:
|
||||
- package:ubuntu-14.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_install
|
||||
build:ubuntu-17.10:
|
||||
extends: .build_template
|
||||
image: ubuntu:zesty
|
||||
before_script:
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- rm -rf /etc/apt/sources.list
|
||||
- echo "deb http://old-releases.ubuntu.com/ubuntu/ zesty main restricted universe multiverse" > /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://old-releases.ubuntu.com/ubuntu/ zesty-updates main restricted universe multiverse" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- echo "deb http://old-releases.ubuntu.com/ubuntu zesty-security main restricted universe multiverse" >> /etc/apt/sources.list.d/50debianoficial.list
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes install build-essential cmake pkg-config cmake-data debhelper dh-systemd dh-autoreconf lsb-release gettext libbz2-dev libcurl4-gnutls-dev libnl-genl-3-dev libnl-3-dev librtmp-dev libidn11-dev libncurses-dev libfreetype6-dev libglu1-mesa-dev libgmp-dev libirrlicht-dev libjpeg-dev libjsoncpp-dev libleveldb-dev libluajit-5.1-dev liblua5.1-dev libogg-dev libopenal-dev libpng-dev libpq-dev libhiredis-dev libspatialindex-dev libsqlite3-dev libvorbis-dev libx11-dev libxxf86vm-dev postgresql-server-dev-all libpq-dev libhiredis-dev zlib1g-dev doxygen libxrandr-dev mesa-common-dev x11proto-xf86vidmode-dev libzstd-dev
|
||||
|
||||
# Xenial
|
||||
|
||||
build:ubuntu-16.04:
|
||||
<<: *build_definition
|
||||
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: .build_template
|
||||
image: ubuntu:xenial
|
||||
dependencies:
|
||||
- build:ubuntu-16.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
before_script:
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake pkg-config 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
|
||||
|
||||
deploy:ubuntu-16.04:
|
||||
image: ubuntu:xenial
|
||||
dependencies:
|
||||
- package:ubuntu-16.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
# Bionic
|
||||
|
||||
# Yakkety
|
||||
build:ubuntu-18.04:
|
||||
extends: .build_template
|
||||
image: ubuntu:bionic
|
||||
before_script:
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake pkg-config 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
|
||||
|
||||
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
|
||||
# Focal
|
||||
|
||||
package:ubuntu-16.10:
|
||||
image: ubuntu:yakkety
|
||||
dependencies:
|
||||
- build:ubuntu-16.10
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
build:ubuntu-20.04:
|
||||
extends: .build_template
|
||||
image: ubuntu:focal
|
||||
before_script:
|
||||
- echo "" > /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "APT::Get::AllowUnauthenticated \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowDowngradeToInsecureRepositories \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::AllowReleaseInfoChange::Suite \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Check-Valid-Until \"false\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Acquire::Languages \"en\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> /etc/apt/apt.conf.d/50venenuxcustom
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake pkg-config 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
|
||||
|
||||
deploy:ubuntu-16.10:
|
||||
image: ubuntu:yakkety
|
||||
dependencies:
|
||||
- package:ubuntu-16.10
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
# jammy
|
||||
|
||||
# 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
|
||||
build:ubuntu-22.04:
|
||||
extends: .build_template
|
||||
image: ubuntu:jammy
|
||||
before_script:
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake pkg-config 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
|
||||
|
||||
##
|
||||
## 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 pkgconfig libidn-devel 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
|
||||
|
||||
# Fedora 36
|
||||
build:fedora-36:
|
||||
extends: .build_template
|
||||
image: fedora:36
|
||||
before_script:
|
||||
- dnf -y install make automake gcc gcc-c++ kernel-devel cmake pkgconfig libidn-devel bzip2-devel gettext-devel sqlite-devel zlib-devel libpng-devel libjpeg-turbo-devel libXxf86vm-devel mesa-libGL-devel irrlicht-devel desktop-file-utils systemd openal* libvorbis* jsoncpp-devel libcurl-devel libcurl luajit-devel leveldb-devel gmp-devel libappstream-glib freetype-devel spatialindex-devel openssl-devel libogg-devel libpq-devel hiredis-devel libzstd-devel libXi-devel ncurses-devel doxygen
|
||||
|
||||
# Fedora 37
|
||||
build:fedora-37:
|
||||
extends: .build_template
|
||||
image: fedora:37
|
||||
before_script:
|
||||
- dnf -y install make automake gcc gcc-c++ kernel-devel cmake pkgconfig libidn-devel bzip2-devel gettext-devel sqlite-devel zlib-devel libpng-devel libjpeg-turbo-devel libXxf86vm-devel mesa-libGL-devel irrlicht-devel desktop-file-utils systemd openal* libvorbis* jsoncpp-devel libcurl-devel libcurl luajit-devel leveldb-devel gmp-devel libappstream-glib freetype-devel spatialindex-devel openssl-devel libogg-devel libpq-devel hiredis-devel libzstd-devel libXi-devel ncurses-devel doxygen
|
||||
|
||||
# Fedora 38
|
||||
build:fedora-38:
|
||||
extends: .build_template
|
||||
image: fedora:38
|
||||
before_script:
|
||||
- dnf -y install make automake gcc gcc-c++ kernel-devel cmake pkgconfig libidn-devel bzip2-devel gettext-devel sqlite-devel zlib-devel libpng-devel libjpeg-turbo-devel libXxf86vm-devel mesa-libGL-devel irrlicht-devel desktop-file-utils systemd openal* libvorbis* jsoncpp-devel libcurl-devel libcurl luajit-devel leveldb-devel gmp-devel libappstream-glib freetype-devel spatialindex-devel openssl-devel libogg-devel libpq-devel hiredis-devel libzstd-devel libXi-devel ncurses-devel doxygen
|
||||
|
||||
##
|
||||
## MinGW for Windows
|
||||
##
|
||||
|
||||
.generic_win_template:
|
||||
image: ubuntu:bionic
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y wget xz-utils unzip git cmake pkg-config 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:
|
||||
extends: .generic_win_template
|
||||
stage: build
|
||||
artifacts:
|
||||
expire_in: 1h
|
||||
paths:
|
||||
- build/minetest/_build/*
|
||||
|
||||
.package_win_template:
|
||||
extends: .generic_win_template
|
||||
stage: package
|
||||
script:
|
||||
- unzip build/minetest/_build/minetest-*.zip
|
||||
- cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libgcc*.dll minetest-*-win*/bin/
|
||||
- cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libstdc++*.dll minetest-*-win*/bin/
|
||||
- cp -p /usr/${WIN_ARCH}-w64-mingw32/bin/libwinpthread*.dll minetest-*-win*/bin/
|
||||
artifacts:
|
||||
expire_in: 90 day
|
||||
paths:
|
||||
- minetest-*-win*/*
|
||||
|
||||
build:win32:
|
||||
extends: .build_win_template
|
||||
script:
|
||||
- ./util/buildbot/buildwin32.sh build
|
||||
variables:
|
||||
WIN_ARCH: "i686"
|
||||
|
||||
package:win32:
|
||||
extends: .package_win_template
|
||||
needs:
|
||||
- build:win32
|
||||
variables:
|
||||
WIN_ARCH: "i686"
|
||||
|
||||
|
||||
build:win64:
|
||||
extends: .build_win_template
|
||||
script:
|
||||
- ./util/buildbot/buildwin64.sh build
|
||||
variables:
|
||||
WIN_ARCH: "x86_64"
|
||||
|
||||
package:win64:
|
||||
extends: .package_win_template
|
||||
needs:
|
||||
- build:win64
|
||||
variables:
|
||||
WIN_ARCH: "x86_64"
|
||||
|
||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "games/minetest"]
|
||||
path = games/minetest
|
||||
url = https://codeberg.org/minenux/minetest-game-minetest.git
|
@ -7,21 +7,65 @@ endif()
|
||||
|
||||
# This can be read from ${PROJECT_NAME} after project() is called
|
||||
project(minetest)
|
||||
set(PROJECT_NAME_CAPITALIZED "Minetest")
|
||||
set(PROJECT_NAME_CAPITALIZED "Minetest4")
|
||||
|
||||
# check compatible compileer must be after project definition and set flags, assume if C++ is installed also CC is installed
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
endif()
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
||||
elseif (CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.6)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu1x")
|
||||
else()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
endif()
|
||||
message(STATUS "using gnu compiler")
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++1y")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
endif()
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
endif()
|
||||
message(STATUS "using clang compiler")
|
||||
else()
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.0)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
else()
|
||||
if(APPLE)
|
||||
# Fix behavior of CMAKE_CXX_STANDARD when targeting macOS.
|
||||
if (POLICY CMP0025)
|
||||
cmake_policy(SET CMP0025 NEW)
|
||||
endif ()
|
||||
endif ()
|
||||
endif()
|
||||
message(STATUS "using default installed compiler")
|
||||
endif()
|
||||
|
||||
# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH 16)
|
||||
set(VERSION_MAJOR 4)
|
||||
set(VERSION_MINOR 0)
|
||||
set(VERSION_PATCH 18)
|
||||
set(VERSION_TWEAK 0)
|
||||
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||
|
||||
# Change to false for releases
|
||||
set(DEVELOPMENT_BUILD FALSE)
|
||||
|
||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
|
||||
if(NOT ${VERSION_TWEAK} EQUAL 0)
|
||||
set(VERSION_STRING "${VERSION_STRING}.${VERSION_TWEAK}")
|
||||
endif()
|
||||
if(VERSION_EXTRA)
|
||||
set(VERSION_STRING ${VERSION_STRING}-${VERSION_EXTRA})
|
||||
set(VERSION_STRING "${VERSION_STRING}-${VERSION_EXTRA}")
|
||||
elseif(DEVELOPMENT_BUILD)
|
||||
set(VERSION_STRING "${VERSION_STRING}-dev")
|
||||
endif()
|
||||
@ -71,11 +115,11 @@ if(WIN32)
|
||||
set(EXAMPLE_CONF_DIR ".")
|
||||
set(LOCALEDIR "locale")
|
||||
elseif(APPLE)
|
||||
set(BUNDLE_NAME ${PROJECT_NAME}.app)
|
||||
set(BUNDLE_NAME ${PROJECT_NAME}${VERSION_MAJOR}.app)
|
||||
set(BUNDLE_PATH "${BUNDLE_NAME}")
|
||||
set(BINDIR ${BUNDLE_NAME}/Contents/MacOS)
|
||||
set(SHAREDIR ${BUNDLE_NAME}/Contents/Resources)
|
||||
set(DOCDIR "${SHAREDIR}/${PROJECT_NAME}")
|
||||
set(DOCDIR "${SHAREDIR}/${PROJECT_NAME}${VERSION_MAJOR}")
|
||||
set(EXAMPLE_CONF_DIR ${DOCDIR})
|
||||
set(LOCALEDIR "${SHAREDIR}/locale")
|
||||
elseif(UNIX) # Linux, BSD etc
|
||||
@ -90,15 +134,15 @@ elseif(UNIX) # Linux, BSD etc
|
||||
set(ICONDIR "unix/icons")
|
||||
set(LOCALEDIR "locale")
|
||||
else()
|
||||
set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
|
||||
set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}${VERSION_MAJOR}")
|
||||
set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}")
|
||||
set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}${VERSION_MAJOR}")
|
||||
set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
|
||||
set(EXAMPLE_CONF_DIR ${DOCDIR})
|
||||
set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
|
||||
set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo")
|
||||
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
|
||||
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale")
|
||||
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -157,7 +201,7 @@ endif()
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client" DESTINATION "${SHAREDIR}")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games" DESTINATION "${SHAREDIR}" PATTERN ".git*" EXCLUDE)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/" DESTINATION "${SHAREDIR}/games" PATTERN ".git*" EXCLUDE)
|
||||
|
||||
if(BUILD_CLIENT)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base")
|
||||
@ -177,17 +221,16 @@ install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}")
|
||||
install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
install(FILES "doc/minetest.6" "doc/minetestserver.6" DESTINATION "${MANDIR}/man6")
|
||||
install(FILES "misc/net.minetest.minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
|
||||
install(FILES "misc/net.minetest.minetest.appdata.xml" DESTINATION "${APPDATADIR}")
|
||||
install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
|
||||
install(FILES "misc/minetest-xorg-icon-128.png"
|
||||
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
|
||||
RENAME "minetest.png")
|
||||
install(FILES "doc/minetest.6" DESTINATION "${MANDIR}/man6" RENAME "minetest${VERSION_MAJOR}.6")
|
||||
install(FILES "doc/minetestserver.6" DESTINATION "${MANDIR}/man6" RENAME "minetest${VERSION_MAJOR}server.6")
|
||||
install(FILES "misc/net.minetest.minetest.desktop" DESTINATION "${XDG_APPS_DIR}" RENAME "net.minetest.minetest${VERSION_MAJOR}.desktop")
|
||||
install(FILES "misc/net.minetest.minetest.appdata.xml" DESTINATION "${APPDATADIR}" RENAME "net.minetest.minetest${VERSION_MAJOR}.appdata.xml")
|
||||
install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps" RENAME "minetest${VERSION_MAJOR}.svg")
|
||||
install(FILES "misc/minetest-xorg-icon-128.png" DESTINATION "${ICONDIR}/hicolor/128x128/apps" RENAME "minetest${VERSION_MAJOR}.png")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
install(FILES "misc/minetest-icon.icns" DESTINATION "${SHAREDIR}")
|
||||
install(FILES "misc/minetest-icon.icns" DESTINATION "${SHAREDIR}" RENAME "minetest-icon${VERSION_MAJOR}.icns")
|
||||
install(FILES "misc/Info.plist" DESTINATION "${BUNDLE_PATH}/Contents")
|
||||
endif()
|
||||
|
||||
@ -204,7 +247,7 @@ add_subdirectory(src)
|
||||
|
||||
# CPack
|
||||
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner game")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
||||
@ -213,18 +256,18 @@ set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
|
||||
|
||||
if(WIN32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-win64")
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-win32")
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR ZIP)
|
||||
elseif(APPLE)
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-osx")
|
||||
set(CPACK_GENERATOR ZIP)
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-linux")
|
||||
set(CPACK_GENERATOR TGZ)
|
||||
set(CPACK_SOURCE_GENERATOR TGZ)
|
||||
endif()
|
||||
|
85
README.txt
85
README.txt
@ -1,31 +1,43 @@
|
||||
Minetest
|
||||
Minetest4
|
||||
========
|
||||
|
||||
An InfiniMiner/Minecraft inspired game.
|
||||
this source is minetest modified up to 4.0.18 with namespace execution for distros integration with OS's
|
||||
also features the client identification patch to property get rid of cheaters.
|
||||
|
||||
Copyright (c) 2010-2017 Perttu Ahola <celeron55@gmail.com>
|
||||
and contributors (see source file comments and the version control log)
|
||||
|
||||
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 project too:
|
||||
https://github.com/minetest/minetest_game/
|
||||
See the README.txt in it.
|
||||
In case you downloaded the source code
|
||||
--------------------------------------
|
||||
|
||||
If you downloaded the **Minetest4 Engine** source code from git, in which this file is
|
||||
contained, you probably want to download the Minetest4 Game at https://codeberg.org/minenux/minetest-game-minetest/src/branch/stable-4.0
|
||||
project too. See its README.md information. Those sources are a little modification of original Minetest.
|
||||
|
||||
For Minetest5 series of same engine please use the respective branch.
|
||||
|
||||
Further documentation
|
||||
----------------------
|
||||
- Website: http://minetest.net/
|
||||
- Wiki: http://wiki.minetest.net/
|
||||
- Developer wiki: http://dev.minetest.net/
|
||||
- Forum: http://forum.minetest.net/
|
||||
- Github: https://github.com/minetest/minetest/
|
||||
- Website: http://minetest.org/
|
||||
- Wiki: http://wiki.minetest.org/
|
||||
- Forum: http://forum.minetest.org/
|
||||
- Github: https://github.com/minenux/minetest-engine-minetest/
|
||||
- doc/ directory of source distribution
|
||||
|
||||
This game is not finished
|
||||
--------------------------
|
||||
- Don't expect it to work as well as a finished game will.
|
||||
- Please report any bugs. When doing that, debug.txt is useful.
|
||||
Generals of game
|
||||
----------------
|
||||
|
||||
This is **an engine that can acts as server and client**, it has **two main components**:
|
||||
|
||||
1. the **games** (that contains the mods and definition of how to play) and
|
||||
2. the **world** (that contains the creeated and playable data).
|
||||
|
||||
Paths places of those are in the [Paths](#paths) sections of this file.
|
||||
|
||||
Players used the client role of the program, that joins to a server that can be the same invoked
|
||||
or a remote server, currently many phone clients (apps like minetest that stolen its name)
|
||||
just used those remote servers to play.
|
||||
|
||||
Default controls
|
||||
-----------------
|
||||
@ -50,6 +62,7 @@ Default controls
|
||||
- +: Increase view range
|
||||
- -: Decrease view range
|
||||
- K: Enable/disable fly mode (needs fly privilege)
|
||||
- L: Enable/disable fly pitch mode or smooth fly mode (if are in fly mode)
|
||||
- J: Enable/disable fast mode (needs fast privilege)
|
||||
- H: Enable/disable noclip mode (needs noclip privilege)
|
||||
|
||||
@ -75,20 +88,20 @@ $bin - Compiled binaries
|
||||
$share - Distributed read-only data
|
||||
$user - User-created modifiable data
|
||||
|
||||
Windows .zip / RUN_IN_PLACE source:
|
||||
Other's OS: .zip / RUN_IN_PLACE source:
|
||||
$bin = bin
|
||||
$share = .
|
||||
$user = .
|
||||
|
||||
Linux installed:
|
||||
$bin = /usr/bin
|
||||
$share = /usr/share/minetest
|
||||
$user = ~/.minetest
|
||||
$share = /usr/share/minetest4
|
||||
$user = ~/.minetest4
|
||||
|
||||
macOS:
|
||||
$bin = Contents/MacOS
|
||||
$share = Contents/Resources
|
||||
$user = Contents/User OR ~/Library/Application Support/minetest
|
||||
$user = Contents/User OR ~/Library/Application Support/minetest4
|
||||
|
||||
World directory
|
||||
----------------
|
||||
@ -103,7 +116,7 @@ Configuration file:
|
||||
- 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
|
||||
$location_of_bin/../minetest.conf and also $location_of_bin/../../minetest.conf
|
||||
|
||||
Command-line options:
|
||||
---------------------
|
||||
@ -127,23 +140,29 @@ For Fedora users:
|
||||
$ sudo dnf install git
|
||||
|
||||
Download source (this is the URL to the latest of source repository, which might not work at all times) using git:
|
||||
$ git clone --depth 1 https://github.com/minetest/minetest.git
|
||||
$ cd minetest
|
||||
|
||||
$ git clone --recursive https://codeberg.org/minenux/minetest-engine-minetest.git minetest
|
||||
$ cd minetest
|
||||
$ git checkout stable-4.0
|
||||
|
||||
Download minetest_game (otherwise only the "Minimal development test" game is available) using git:
|
||||
$ git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
|
||||
|
||||
$ rm -r games/minetest && git clone https://codeberg.org/minenux/minetest-game-minetest.git games/minetest
|
||||
$ cd games/minetest && git checkout stable-4.0
|
||||
|
||||
Download source, without using git:
|
||||
$ wget https://github.com/minetest/minetest/archive/master.tar.gz
|
||||
$ tar xf master.tar.gz
|
||||
$ cd minetest-master
|
||||
|
||||
$ wget https://codeberg.org/minenux/minetest-engine/archive/stable-4.0.tar.gz
|
||||
$ tar xf stable-4.0.tar.gz
|
||||
$ cd stable-4.0
|
||||
|
||||
Download minetest_game, without using git:
|
||||
$ cd games/
|
||||
$ wget https://github.com/minetest/minetest_game/archive/master.tar.gz
|
||||
$ tar xf master.tar.gz
|
||||
$ mv minetest_game-master minetest_game
|
||||
$ cd ..
|
||||
|
||||
$ cd games/
|
||||
$ wget https://codeberg.org/minenux/minetest-game-minetest/archive/stable-4.0.tar.gz
|
||||
$ tar xf stable-4.0.tar.gz
|
||||
$ mv minetest-game-minetest_stable-4.0 minetest
|
||||
$ cd ..
|
||||
|
||||
Build a version that runs directly from the source directory:
|
||||
$ cmake . -DRUN_IN_PLACE=TRUE
|
||||
@ -268,7 +287,7 @@ Compiling on Windows:
|
||||
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
|
||||
http://minetest.org/download
|
||||
- Steps:
|
||||
- Select a directory called DIR hereafter in which you will operate.
|
||||
- Make sure you have CMake and a compiler installed.
|
||||
|
@ -6,7 +6,8 @@ OS := $(shell uname)
|
||||
# GPROF = 1
|
||||
|
||||
# build for build platform
|
||||
APP_PLATFORM = android-9
|
||||
API = 14
|
||||
APP_PLATFORM = android-$(API)
|
||||
|
||||
ANDR_ROOT = $(shell pwd)
|
||||
PROJ_ROOT = $(shell realpath $(ANDR_ROOT)/../..)
|
||||
@ -30,7 +31,7 @@ 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_CFLAGS_ADDON = -mfloat-abi=softfp -mfpu=vfpv3 -O3 -D__ANDROID_API__=$(API)
|
||||
TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
|
||||
TARGET_ARCH = armv7
|
||||
CROSS_PREFIX = arm-linux-androideabi-
|
||||
@ -82,7 +83,7 @@ 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://github.com/vincentjames501/libvorbis-libogg-android
|
||||
OGG_URL_GIT = https://gitlab.com/minetest/libvorbis-libogg-android
|
||||
|
||||
IRRLICHT_REVISION = 5145
|
||||
IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht/
|
||||
@ -99,20 +100,13 @@ 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.54.0
|
||||
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
|
||||
|
||||
GMP_VERSION = 6.1.2
|
||||
GMP_DIR = $(ANDR_ROOT)/deps/gmp-$(GMP_VERSION)
|
||||
GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.so
|
||||
GMP_TIMESTAMP = $(GMP_DIR)/timestamp
|
||||
GMP_TIMESTAMP_INT = $(ANDR_ROOT)/deps/gmp_timestamp
|
||||
GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_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
|
||||
@ -126,12 +120,11 @@ 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-3180000
|
||||
SQLITE3_URL = https://www.sqlite.org/2017/$(SQLITE3_FOLDER).zip
|
||||
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:]]*//')
|
||||
NDK_MODULE_PATH = $(ANDROID_NDK)/toolchains
|
||||
|
||||
#use interim target variable to switch leveldb on or off
|
||||
ifeq ($(HAVE_LEVELDB),1)
|
||||
@ -217,14 +210,10 @@ $(OPENAL_LIB): $(OPENAL_TIMESTAMP)
|
||||
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}; \
|
||||
${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \
|
||||
NDK_MODULE_PATH=${NDK_MODULE_PATH} APP_ABI=${TARGET_ABI} \
|
||||
TARGET_ARCH_ABI=${TARGET_ABI} APP_PLATFORM=${APP_PLATFORM} \
|
||||
PRIVATE_CC=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}gcc \
|
||||
PRIVATE_CXX=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}g++ \
|
||||
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
|
||||
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
|
||||
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
|
||||
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \
|
||||
touch ${OPENAL_TIMESTAMP}; \
|
||||
touch ${OPENAL_TIMESTAMP_INT}; \
|
||||
else \
|
||||
@ -248,7 +237,6 @@ ogg_download :
|
||||
git clone ${OGG_URL_GIT}|| exit 1; \
|
||||
cd libvorbis-libogg-android ; \
|
||||
patch -p1 < ${ANDR_ROOT}/patches/libvorbis-libogg-fpu.patch || exit 1; \
|
||||
sed -i 's-:-?-' jni/Application.mk; \
|
||||
fi
|
||||
|
||||
ogg : $(OGG_LIB)
|
||||
@ -265,14 +253,12 @@ $(OGG_LIB): $(OGG_TIMESTAMP)
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
echo "changed timestamp for ogg detected building..."; \
|
||||
cd ${OGG_DIR}; \
|
||||
${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \
|
||||
NDK_MODULE_PATH=${NDK_MODULE_PATH} \
|
||||
APP_ABI=${TARGET_ABI} APP_PLATFORM=${APP_PLATFORM} \
|
||||
PRIVATE_CC=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}gcc \
|
||||
PRIVATE_CXX=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}g++ \
|
||||
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
|
||||
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
|
||||
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
|
||||
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 \
|
||||
@ -301,7 +287,7 @@ openssl_download :
|
||||
|
||||
openssl : $(OPENSSL_LIB)
|
||||
|
||||
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB)
|
||||
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${OPENSSL_TIMESTAMP_INT} ] ; then \
|
||||
echo "${OPENSSL_TIMESTAMP_INT} doesn't exist"; \
|
||||
@ -317,10 +303,10 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB)
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-openssl; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=android-9 \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
CC=${CROSS_PREFIX}gcc ./Configure enable-gmp -DL_ENDIAN -I${GMP_DIR} -L${GMP_DIR}/usr/lib android-${TARGET_ARCH};\
|
||||
CC=${CROSS_PREFIX}gcc ./Configure -DL_ENDIAN android-${TARGET_ARCH};\
|
||||
CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \
|
||||
CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \
|
||||
touch ${OPENSSL_TIMESTAMP}; \
|
||||
@ -368,7 +354,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-leveldb; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=android-9 \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CC=${CROSS_PREFIX}gcc; \
|
||||
@ -420,14 +406,10 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
|
||||
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}; \
|
||||
${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \
|
||||
NDK_MODULE_PATH=${NDK_MODULE_PATH} \
|
||||
APP_PLATFORM=${APP_PLATFORM} APP_ABI=${TARGET_ABI} \
|
||||
PRIVATE_CC=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}gcc \
|
||||
PRIVATE_CXX=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}g++ \
|
||||
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
|
||||
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
|
||||
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
|
||||
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \
|
||||
touch ${FREETYPE_TIMESTAMP}; \
|
||||
touch ${FREETYPE_TIMESTAMP_INT}; \
|
||||
else \
|
||||
@ -478,9 +460,10 @@ $(ICONV_LIB) : $(ICONV_TIMESTAMP)
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-iconv; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=android-9 \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export CC=${CROSS_PREFIX}gcc; \
|
||||
export CXX=${CROSS_PREFIX}g++; \
|
||||
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
|
||||
@ -513,6 +496,7 @@ irrlicht_download :
|
||||
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
|
||||
@ -538,14 +522,10 @@ $(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB)
|
||||
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}; \
|
||||
${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \
|
||||
NDK_MODULE_PATH=${NDK_MODULE_PATH} \
|
||||
APP_ABI=${TARGET_ABI} APP_PLATFORM=${APP_PLATFORM} \
|
||||
PRIVATE_CC=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}gcc \
|
||||
PRIVATE_CXX=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}g++ \
|
||||
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
|
||||
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
|
||||
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
|
||||
NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Irrlicht.mk || exit 1; \
|
||||
touch ${IRRLICHT_TIMESTAMP}; \
|
||||
touch ${IRRLICHT_TIMESTAMP_INT}; \
|
||||
else \
|
||||
@ -593,7 +573,7 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB)
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-curl; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=android-9 \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CC=${CROSS_PREFIX}gcc; \
|
||||
@ -615,64 +595,6 @@ clean_curl :
|
||||
$(RM) -rf deps/curl-${CURL_VERSION} \
|
||||
$(RM) -f deps/curl
|
||||
|
||||
$(GMP_TIMESTAMP) : gmp_download
|
||||
@LAST_MODIF=$$(find ${GMP_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${GMP_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
gmp_download :
|
||||
@if [ ! -d "${GMP_DIR}" ] ; then \
|
||||
echo "gmp sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd deps; \
|
||||
wget ${GMP_URL_HTTP} || exit 1; \
|
||||
tar -xjf gmp-${GMP_VERSION}.tar.bz2 || exit 1; \
|
||||
rm gmp-${GMP_VERSION}.tar.bz2; \
|
||||
ln -s gmp-${GMP_VERSION} gmp; \
|
||||
fi
|
||||
|
||||
gmp : $(GMP_LIB)
|
||||
|
||||
$(GMP_LIB): $(GMP_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${GMP_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -e ${GMP_LIB} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${GMP_TIMESTAMP} -nt ${GMP_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
mkdir -p ${GMP_DIR}; \
|
||||
echo "changed timestamp for gmp detected building..."; \
|
||||
cd deps/gmp-${GMP_VERSION}; \
|
||||
export CROSS_PREFIX=${CROSS_PREFIX}; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=android-9 \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CC=${CROSS_PREFIX}gcc; \
|
||||
export CXX=${CROSS_PREFIX}g++; \
|
||||
export LIBGMP_LDFLAGS="-avoid-version"; \
|
||||
export LIBGMPXX_LDFLAGS="-avoid-version"; \
|
||||
./configure --disable-static --host=${TARGET_HOST} --prefix=/usr; \
|
||||
$(MAKE) install DESTDIR=/${GMP_DIR} || exit 1; \
|
||||
touch ${GMP_TIMESTAMP}; \
|
||||
touch ${GMP_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for gmp"; \
|
||||
fi
|
||||
|
||||
clean_gmp:
|
||||
$(RM) -rf deps/gmp-${GMP_VERSION} \
|
||||
$(RM) -f deps/gmp
|
||||
|
||||
sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c
|
||||
|
||||
deps/${SQLITE3_FOLDER}/sqlite3.c :
|
||||
@ -762,20 +684,16 @@ assets : $(ASSETS_TIMESTAMP)
|
||||
fi
|
||||
|
||||
clean_assets :
|
||||
@$(RM) -r assets
|
||||
@$(RM) -r ${APP_ROOT}/assets
|
||||
|
||||
apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \
|
||||
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
|
||||
+ @${ANDROID_NDK}/ndk-build NDK_MODULE_PATH=${NDK_MODULE_PATH} \
|
||||
GPROF=${GPROF} APP_ABI=${TARGET_ABI} HAVE_LEVELDB=${HAVE_LEVELDB} \
|
||||
APP_PLATFORM=${APP_PLATFORM} \
|
||||
PRIVATE_CC=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}gcc \
|
||||
PRIVATE_CXX=${NDK_MODULE_PATH}/${TARGET_TOOLCHAIN}${COMPILER_VERSION}/prebuilt/linux-x86_64/bin/${TARGET_TOOLCHAIN}g++ \
|
||||
TARGET_LIBDIR=${TARGET_LIBDIR} \
|
||||
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
|
||||
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
|
||||
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
|
||||
+ @export TARGET_LIBDIR=${TARGET_LIBDIR}; \
|
||||
export HAVE_LEVELDB=${HAVE_LEVELDB}; \
|
||||
export APP_PLATFORM=${APP_PLATFORM}; \
|
||||
export TARGET_ABI=${TARGET_ABI}; \
|
||||
${ANDROID_NDK}/ndk-build || exit 1; \
|
||||
if [ ! -e ${APP_ROOT}/jniLibs ]; then \
|
||||
ln -s ${ANDR_ROOT}/libs ${APP_ROOT}/jniLibs || exit 1; \
|
||||
fi; \
|
||||
@ -807,7 +725,7 @@ clean_apk :
|
||||
clean_all :
|
||||
@$(MAKE) clean_apk; \
|
||||
$(MAKE) clean_assets clean_iconv clean_irrlicht clean_leveldb clean_curl \
|
||||
clean_openssl clean_openal clean_ogg clean_gmp; \
|
||||
clean_openssl clean_openal clean_ogg; \
|
||||
sleep 1; \
|
||||
$(RM) -r gen libs obj deps bin Debug and_env
|
||||
|
||||
|
@ -1,25 +1,46 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.google.com' }
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:1.5.0"
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url 'https://maven.google.com' }
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
def curl_version = "7.60.0"
|
||||
def gmp_version = "6.1.2"
|
||||
def irrlicht_revision = "5150"
|
||||
def openal_version = "1.18.2"
|
||||
def openssl_version = "1.0.2n"
|
||||
def sqlite3_version = "3260000"
|
||||
|
||||
apply plugin: "com.android.application"
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
|
||||
defaultConfig {
|
||||
versionCode 17
|
||||
versionCode 22
|
||||
versionName "${System.env.VERSION_STR}.${versionCode}"
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 9
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
applicationId "net.minetest.minetest"
|
||||
manifestPlaceholders = [ package: "net.minetest.minetest", project: project.name ]
|
||||
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',
|
||||
'arm64-v8a'
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
@ -46,3 +67,68 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task cleanAssets(type: Delete) {
|
||||
delete 'src/main/assets'
|
||||
}
|
||||
|
||||
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 cleanGMP(type: Delete) {
|
||||
delete 'deps/gmp'
|
||||
delete 'deps/gmp-' + gmp_version
|
||||
}
|
||||
|
||||
task cleanAll(type: Delete, dependsOn: [clean, cleanAssets, cleanIconv,
|
||||
cleanFreetype, cleanIrrlicht, cleanLevelDB, cleanSQLite3, cleanCURL,
|
||||
cleanOpenSSL, cleanOpenAL, cleanOgg, cleanGMP]) {
|
||||
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'
|
||||
}
|
||||
|
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 @@
|
||||
#Sat Aug 27 20:10:09 CEST 2016
|
||||
#Mon Oct 15 00:47:03 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
|
||||
|
110
build/android/gradlew
vendored
110
build/android/gradlew
vendored
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@ -6,47 +6,6 @@
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@ -61,9 +20,49 @@ while [ -h "$PRG" ] ; do
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
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=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
@ -90,7 +89,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
@ -114,6 +113,7 @@ fi
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
@ -154,11 +154,19 @@ if $cygwin ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
14
build/android/gradlew.bat
vendored
14
build/android/gradlew.bat
vendored
@ -8,14 +8,14 @@
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@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 DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
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=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
@ -46,10 +46,9 @@ echo location of your Java installation.
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@ -60,11 +59,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
@ -44,11 +44,6 @@ LOCAL_MODULE := vorbis
|
||||
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gmp
|
||||
LOCAL_SRC_FILES := deps/gmp/usr/lib/libgmp.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := ssl
|
||||
LOCAL_SRC_FILES := deps/openssl/libssl.a
|
||||
@ -98,6 +93,7 @@ endif
|
||||
LOCAL_C_INCLUDES := \
|
||||
jni/src \
|
||||
jni/src/script \
|
||||
jni/lib/gmp \
|
||||
jni/lib/lua/src \
|
||||
jni/lib/jsoncpp \
|
||||
jni/src/cguittfont \
|
||||
@ -107,7 +103,6 @@ LOCAL_C_INCLUDES := \
|
||||
deps/curl/include \
|
||||
deps/openal-soft/jni/OpenAL/include \
|
||||
deps/libvorbis-libogg-android/jni/include \
|
||||
deps/gmp/usr/include \
|
||||
deps/leveldb/include \
|
||||
deps/sqlite/
|
||||
|
||||
@ -339,6 +334,9 @@ LOCAL_SRC_FILES += \
|
||||
#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 \
|
||||
@ -385,7 +383,7 @@ LOCAL_SRC_FILES += \
|
||||
# JSONCPP
|
||||
LOCAL_SRC_FILES += jni/lib/jsoncpp/jsoncpp.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis gmp
|
||||
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)
|
||||
|
@ -1,9 +1,6 @@
|
||||
# NDK_TOOLCHAIN_VERSION := clang3.8
|
||||
|
||||
APP_PLATFORM := android-9
|
||||
APP_PLATFORM := ${APP_PLATFORM}
|
||||
APP_ABI := ${TARGET_ABI}
|
||||
APP_STL := c++_shared
|
||||
APP_MODULES := minetest
|
||||
APP_STL := gnustl_static
|
||||
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
APP_GNUSTL_FORCE_CPP_FEATURES := rtti
|
||||
|
||||
APP_CPPFLAGS += -fexceptions -frtti
|
||||
|
7
build/android/jni/Deps.mk
Normal file
7
build/android/jni/Deps.mk
Normal file
@ -0,0 +1,7 @@
|
||||
APP_PLATFORM := ${APP_PLATFORM}
|
||||
APP_ABI := ${TARGET_ABI}
|
||||
APP_STL := c++_shared
|
||||
APP_DEPRECATED_HEADERS := true
|
||||
|
||||
APP_CFLAGS += -mfloat-abi=softfp -mfpu=vfpv3 -O3
|
||||
APP_CPPFLAGS += -fexceptions
|
8
build/android/jni/Irrlicht.mk
Normal file
8
build/android/jni/Irrlicht.mk
Normal file
@ -0,0 +1,8 @@
|
||||
APP_PLATFORM := ${APP_PLATFORM}
|
||||
APP_ABI := ${TARGET_ABI}
|
||||
APP_STL := c++_static
|
||||
APP_DEPRECATED_HEADERS := true
|
||||
APP_MODULES := Irrlicht
|
||||
|
||||
APP_CFLAGS += -mfloat-abi=softfp -mfpu=vfpv3 -O3
|
||||
APP_CPPFLAGS += -fexceptions
|
13
build/android/patches/irrlicht-native_activity.patch
Normal file
13
build/android/patches/irrlicht-native_activity.patch
Normal file
@ -0,0 +1,13 @@
|
||||
--- irrlicht/source/Irrlicht/CEGLManager.cpp.orig 2018-06-10 16:58:11.357709173 +0200
|
||||
+++ irrlicht/source/Irrlicht/CEGLManager.cpp 2018-06-10 16:58:25.100709843 +0200
|
||||
@@ -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,2 +1 @@
|
||||
rootProject.name = "Minetest"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?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" />
|
||||
|
||||
<uses-permission android:name="android.permission.SET_DEBUG_APP" />
|
||||
</manifest>
|
||||
|
@ -1,34 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.minetest.minetest"
|
||||
android:installLocation="auto">
|
||||
<uses-feature android:glEsVersion="0x00010000" android:required="true"/>
|
||||
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.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<application android:icon="@drawable/irr_icon"
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="${project}"
|
||||
android:resizeableActivity="false">
|
||||
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="2.1" />
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
|
||||
android:label="${project}"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:allowBackup="true">
|
||||
<activity android:name=".MtNativeActivity"
|
||||
android:label="${project}"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:clearTaskOnLaunch="true">
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.lib_name" android:value="minetest" />
|
||||
</activity>
|
||||
<activity android:name=".MinetestTextEntry"
|
||||
android:theme="@style/Theme.Transparent"
|
||||
android:excludeFromRecents="true">
|
||||
</activity>
|
||||
<activity android:name=".MinetestAssetCopy"
|
||||
android:theme="@style/Theme.Transparent"
|
||||
android:excludeFromRecents="true">
|
||||
<activity
|
||||
android:name=".MtNativeActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation|screenSize|smallestScreenSize"
|
||||
android:hardwareAccelerated="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
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"/>
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -0,0 +1,79 @@
|
||||
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,5 +1,17 @@
|
||||
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;
|
||||
@ -7,410 +19,355 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Vector;
|
||||
import java.util.Iterator;
|
||||
import java.lang.Object;
|
||||
import java.util.Vector;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
public class MinetestAssetCopy extends Activity {
|
||||
ProgressBar m_ProgressBar;
|
||||
TextView m_Filename;
|
||||
copyAssetTask m_AssetCopy;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Paint;
|
||||
import android.text.TextPaint;
|
||||
|
||||
public class MinetestAssetCopy extends Activity
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.assetcopy);
|
||||
|
||||
m_ProgressBar = (ProgressBar) findViewById(R.id.progressBar1);
|
||||
m_Filename = (TextView) findViewById(R.id.textView1);
|
||||
|
||||
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 prevActivity =
|
||||
(MinetestAssetCopy) getLastNonConfigurationInstance();
|
||||
if(prevActivity!= null) {
|
||||
if (prevActivity != null) {
|
||||
m_AssetCopy = prevActivity.m_AssetCopy;
|
||||
}
|
||||
else {
|
||||
} 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()
|
||||
{
|
||||
public Object onRetainNonConfigurationInstance() {
|
||||
return this;
|
||||
}
|
||||
|
||||
ProgressBar m_ProgressBar;
|
||||
TextView m_Filename;
|
||||
|
||||
copyAssetTask m_AssetCopy;
|
||||
|
||||
private class copyAssetTask extends AsyncTask<String, Integer, String>
|
||||
{
|
||||
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[1*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 al 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,63 +6,59 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
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;
|
||||
|
||||
private final int MultiLineTextInput = 1;
|
||||
private final int SingleLineTextInput = 2;
|
||||
private final int SingleLinePasswordInput = 3;
|
||||
|
||||
|
||||
@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");
|
||||
|
||||
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 |
|
||||
mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
}
|
||||
else {
|
||||
} 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()); }
|
||||
});
|
||||
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){
|
||||
if (KeyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
|
||||
pushResult(mTextInputWidget.getText().toString());
|
||||
return true;
|
||||
@ -70,19 +66,19 @@ public class MinetestTextEntry extends Activity {
|
||||
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);
|
||||
setResult(Activity.RESULT_OK, resultData);
|
||||
mTextInputDialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
public void cancelDialog() {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
mTextInputDialog.dismiss();
|
||||
|
@ -2,22 +2,54 @@ package net.minetest.minetest;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
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);
|
||||
m_MessagReturnCode = -1;
|
||||
m_MessageReturnValue = "";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
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() {
|
||||
@ -26,7 +58,7 @@ public class MtNativeActivity extends NativeActivity {
|
||||
}
|
||||
|
||||
public void showDialog(String acceptButton, String hint, String current,
|
||||
int editType) {
|
||||
int editType) {
|
||||
|
||||
Intent intent = new Intent(this, MinetestTextEntry.class);
|
||||
Bundle params = new Bundle();
|
||||
@ -37,11 +69,9 @@ public class MtNativeActivity extends NativeActivity {
|
||||
intent.putExtras(params);
|
||||
startActivityForResult(intent, 101);
|
||||
m_MessageReturnValue = "";
|
||||
m_MessagReturnCode = -1;
|
||||
m_MessagReturnCode = -1;
|
||||
}
|
||||
|
||||
public static native void putMessageBoxResult(String text);
|
||||
|
||||
/* ugly code to workaround putMessageBoxResult not beeing found */
|
||||
public int getDialogState() {
|
||||
return m_MessagReturnCode;
|
||||
@ -66,34 +96,15 @@ public class MtNativeActivity extends NativeActivity {
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
Intent data) {
|
||||
if (requestCode == 101) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
String text = data.getStringExtra("text");
|
||||
m_MessagReturnCode = 0;
|
||||
m_MessageReturnValue = text;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
m_MessagReturnCode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("openal");
|
||||
System.loadLibrary("ogg");
|
||||
System.loadLibrary("vorbis");
|
||||
System.loadLibrary("ssl");
|
||||
System.loadLibrary("crypto");
|
||||
System.loadLibrary("gmp");
|
||||
System.loadLibrary("iconv");
|
||||
|
||||
// We don't have to load libminetest.so ourselves,
|
||||
// but if we do, we get nicer logcat errors when
|
||||
// loading fails.
|
||||
System.loadLibrary("minetest");
|
||||
}
|
||||
|
||||
private int m_MessagReturnCode;
|
||||
private String m_MessageReturnValue;
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB |
BIN
build/android/src/main/res/drawable/background.png
Normal file
BIN
build/android/src/main/res/drawable/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 B |
4
build/android/src/main/res/drawable/bg.xml
Normal file
4
build/android/src/main/res/drawable/bg.xml
Normal file
@ -0,0 +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" />
|
@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
<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="wrap_content"
|
||||
android:layout_gravity="center_vertical" />
|
||||
<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="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="middle"
|
||||
android:singleLine="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/preparing_media"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<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" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
BIN
build/android/src/main/res/mipmap/ic_launcher.png
Normal file
BIN
build/android/src/main/res/mipmap/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
12
build/android/src/main/res/values-v21/styles.xml
Normal file
12
build/android/src/main/res/values-v21/styles.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?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 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="preparing_media">Preparing media...</string>
|
||||
</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,11 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Transparent" parent="android:Theme">
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
|
||||
<style name="AppTheme" parent="@android:style/android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@drawable/bg</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
<style name="Theme.Dialog" parent="@android:style/android:Theme.Holo.Light.Dialog.NoActionBar"/>
|
||||
|
||||
</resources>
|
||||
|
@ -120,7 +120,12 @@ end
|
||||
-- The dumped and level arguments are internal-only.
|
||||
|
||||
function dump(o, indent, nested, level)
|
||||
if type(o) ~= "table" then
|
||||
local t = type(o)
|
||||
if not level and t == "userdata" then
|
||||
-- when userdata (e.g. player) is passed directly, print its metatable:
|
||||
return "userdata metatable: " .. dump(getmetatable(o))
|
||||
end
|
||||
if t ~= "table" then
|
||||
return basic_dump(o)
|
||||
end
|
||||
-- Contains table -> true/nil of currently nested tables
|
||||
@ -308,59 +313,25 @@ function core.formspec_escape(text)
|
||||
end
|
||||
|
||||
|
||||
function core.wrap_text(text, charlimit)
|
||||
local retval = {}
|
||||
|
||||
local current_idx = 1
|
||||
|
||||
local start,stop = string_find(text, " ", current_idx)
|
||||
local nl_start,nl_stop = string_find(text, "\n", current_idx)
|
||||
local gotnewline = false
|
||||
if nl_start ~= nil and (start == nil or nl_start < start) then
|
||||
start = nl_start
|
||||
stop = nl_stop
|
||||
gotnewline = true
|
||||
end
|
||||
local last_line = ""
|
||||
while start ~= nil do
|
||||
if string.len(last_line) + (stop-start) > charlimit then
|
||||
retval[#retval + 1] = last_line
|
||||
last_line = ""
|
||||
end
|
||||
|
||||
if last_line ~= "" then
|
||||
last_line = last_line .. " "
|
||||
end
|
||||
|
||||
last_line = last_line .. string_sub(text, current_idx, stop - 1)
|
||||
|
||||
if gotnewline then
|
||||
retval[#retval + 1] = last_line
|
||||
last_line = ""
|
||||
gotnewline = false
|
||||
end
|
||||
current_idx = stop+1
|
||||
|
||||
start,stop = string_find(text, " ", current_idx)
|
||||
nl_start,nl_stop = string_find(text, "\n", current_idx)
|
||||
|
||||
if nl_start ~= nil and (start == nil or nl_start < start) then
|
||||
start = nl_start
|
||||
stop = nl_stop
|
||||
gotnewline = true
|
||||
end
|
||||
function core.wrap_text(text, max_length, as_table)
|
||||
local result = {}
|
||||
local line = {}
|
||||
if #text <= max_length then
|
||||
return as_table and {text} or text
|
||||
end
|
||||
|
||||
--add last part of text
|
||||
if string.len(last_line) + (string.len(text) - current_idx) > charlimit then
|
||||
retval[#retval + 1] = last_line
|
||||
retval[#retval + 1] = string_sub(text, current_idx)
|
||||
else
|
||||
last_line = last_line .. " " .. string_sub(text, current_idx)
|
||||
retval[#retval + 1] = last_line
|
||||
for word in text:gmatch('%S+') do
|
||||
local cur_length = #table.concat(line, ' ')
|
||||
if cur_length > 0 and cur_length + #word + 1 >= max_length then
|
||||
-- word wouldn't fit on current line, move to next line
|
||||
table.insert(result, table.concat(line, ' '))
|
||||
line = {}
|
||||
end
|
||||
table.insert(line, word)
|
||||
end
|
||||
|
||||
return retval
|
||||
table.insert(result, table.concat(line, ' '))
|
||||
return as_table and result or table.concat(result, '\n')
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -370,7 +341,7 @@ if INIT == "game" then
|
||||
local dirs2 = {20, 23, 22, 21}
|
||||
|
||||
function core.rotate_and_place(itemstack, placer, pointed_thing,
|
||||
infinitestacks, orient_flags)
|
||||
infinitestacks, orient_flags, prevent_after_place)
|
||||
orient_flags = orient_flags or {}
|
||||
|
||||
local unode = core.get_node_or_nil(pointed_thing.under)
|
||||
@ -379,41 +350,20 @@ if INIT == "game" then
|
||||
end
|
||||
local undef = core.registered_nodes[unode.name]
|
||||
if undef and undef.on_rightclick then
|
||||
undef.on_rightclick(pointed_thing.under, unode, placer,
|
||||
return undef.on_rightclick(pointed_thing.under, unode, placer,
|
||||
itemstack, pointed_thing)
|
||||
return
|
||||
end
|
||||
local fdir = core.dir_to_facedir(placer:get_look_dir())
|
||||
local wield_name = itemstack:get_name()
|
||||
local fdir = placer and core.dir_to_facedir(placer:get_look_dir()) or 0
|
||||
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
local iswall = (above.y == under.y)
|
||||
local isceiling = not iswall and (above.y < under.y)
|
||||
local anode = core.get_node_or_nil(above)
|
||||
if not anode then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.above
|
||||
local node = anode
|
||||
|
||||
if undef and undef.buildable_to then
|
||||
pos = pointed_thing.under
|
||||
node = unode
|
||||
iswall = false
|
||||
end
|
||||
|
||||
if core.is_protected(pos, placer:get_player_name()) then
|
||||
core.record_protection_violation(pos,
|
||||
placer:get_player_name())
|
||||
return
|
||||
end
|
||||
|
||||
local ndef = core.registered_nodes[node.name]
|
||||
if not ndef or not ndef.buildable_to then
|
||||
return
|
||||
end
|
||||
|
||||
if orient_flags.force_floor then
|
||||
iswall = false
|
||||
isceiling = false
|
||||
@ -427,31 +377,26 @@ if INIT == "game" then
|
||||
iswall = not iswall
|
||||
end
|
||||
|
||||
local param2 = fdir
|
||||
if iswall then
|
||||
core.set_node(pos, {name = wield_name,
|
||||
param2 = dirs1[fdir + 1]})
|
||||
param2 = dirs1[fdir + 1]
|
||||
elseif isceiling then
|
||||
if orient_flags.force_facedir then
|
||||
core.set_node(pos, {name = wield_name,
|
||||
param2 = 20})
|
||||
cparam2 = 20
|
||||
else
|
||||
core.set_node(pos, {name = wield_name,
|
||||
param2 = dirs2[fdir + 1]})
|
||||
param2 = dirs2[fdir + 1]
|
||||
end
|
||||
else -- place right side up
|
||||
if orient_flags.force_facedir then
|
||||
core.set_node(pos, {name = wield_name,
|
||||
param2 = 0})
|
||||
else
|
||||
core.set_node(pos, {name = wield_name,
|
||||
param2 = fdir})
|
||||
param2 = 0
|
||||
end
|
||||
end
|
||||
|
||||
if not infinitestacks then
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end
|
||||
local old_itemstack = ItemStack(itemstack)
|
||||
local new_itemstack, removed = core.item_place_node(
|
||||
itemstack, placer, pointed_thing, param2, prevent_after_place
|
||||
)
|
||||
return infinitestacks and old_itemstack or new_itemstack
|
||||
end
|
||||
|
||||
|
||||
@ -459,12 +404,18 @@ 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,
|
||||
core.settings:get_bool("creative_mode"),
|
||||
{invert_wall = placer:get_player_control().sneak})
|
||||
is_creative(name),
|
||||
{invert_wall = invert_wall}, true)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
@ -642,44 +593,26 @@ end
|
||||
|
||||
local ESCAPE_CHAR = string.char(0x1b)
|
||||
|
||||
-- Client-side mods don't have access to settings
|
||||
if core.settings and core.settings:get_bool("disable_escape_sequences") then
|
||||
|
||||
function core.get_color_escape_sequence(color)
|
||||
return ""
|
||||
end
|
||||
|
||||
function core.get_background_escape_sequence(color)
|
||||
return ""
|
||||
end
|
||||
|
||||
function core.colorize(color, message)
|
||||
return message
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
function core.get_color_escape_sequence(color)
|
||||
return ESCAPE_CHAR .. "(c@" .. color .. ")"
|
||||
end
|
||||
|
||||
function core.get_background_escape_sequence(color)
|
||||
return ESCAPE_CHAR .. "(b@" .. color .. ")"
|
||||
end
|
||||
|
||||
function core.colorize(color, message)
|
||||
local lines = tostring(message):split("\n", true)
|
||||
local color_code = core.get_color_escape_sequence(color)
|
||||
|
||||
for i, line in ipairs(lines) do
|
||||
lines[i] = color_code .. line
|
||||
end
|
||||
|
||||
return table.concat(lines, "\n") .. core.get_color_escape_sequence("#ffffff")
|
||||
end
|
||||
|
||||
function core.get_color_escape_sequence(color)
|
||||
return ESCAPE_CHAR .. "(c@" .. color .. ")"
|
||||
end
|
||||
|
||||
function core.get_background_escape_sequence(color)
|
||||
return ESCAPE_CHAR .. "(b@" .. color .. ")"
|
||||
end
|
||||
|
||||
function core.colorize(color, message)
|
||||
local lines = tostring(message):split("\n", true)
|
||||
local color_code = core.get_color_escape_sequence(color)
|
||||
|
||||
for i, line in ipairs(lines) do
|
||||
lines[i] = color_code .. line
|
||||
end
|
||||
|
||||
return table.concat(lines, "\n") .. core.get_color_escape_sequence("#ffffff")
|
||||
end
|
||||
|
||||
|
||||
function core.strip_foreground_colors(str)
|
||||
return (str:gsub(ESCAPE_CHAR .. "%(c@[^)]+%)", ""))
|
||||
end
|
||||
|
@ -67,16 +67,15 @@ local function save_auth_file()
|
||||
assert(type(stuff.privileges) == "table")
|
||||
assert(stuff.last_login == nil or type(stuff.last_login) == "number")
|
||||
end
|
||||
local file, errmsg = io.open(core.auth_file_path, 'w+b')
|
||||
if not file then
|
||||
error(core.auth_file_path.." could not be opened for writing: "..errmsg)
|
||||
end
|
||||
local content = {}
|
||||
for name, stuff in pairs(core.auth_table) do
|
||||
local priv_string = core.privs_to_string(stuff.privileges)
|
||||
local parts = {name, stuff.password, priv_string, stuff.last_login or ""}
|
||||
file:write(table.concat(parts, ":").."\n")
|
||||
content[#content + 1] = table.concat(parts, ":")
|
||||
end
|
||||
if not core.safe_file_write(core.auth_file_path, table.concat(content, "\n")) then
|
||||
error(core.auth_file_path.." could not be written to")
|
||||
end
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
read_auth_file()
|
||||
|
@ -7,7 +7,10 @@
|
||||
core.chatcommands = core.registered_chatcommands -- BACKWARDS COMPATIBILITY
|
||||
|
||||
core.register_on_chat_message(function(name, message)
|
||||
if message:sub(1,1) ~= "/" then
|
||||
if message:find("[\r\n]") then
|
||||
core.chat_send_player(name, "You cannot use newlines in chat messages.")
|
||||
return true
|
||||
elseif message:sub(1,1) ~= "/" then
|
||||
return
|
||||
end
|
||||
|
||||
@ -653,8 +656,8 @@ core.register_chatcommand("pulverize", {
|
||||
core.rollback_punch_callbacks = {}
|
||||
|
||||
core.register_on_punchnode(function(pos, node, puncher)
|
||||
local name = puncher:get_player_name()
|
||||
if core.rollback_punch_callbacks[name] then
|
||||
local name = puncher and puncher:get_player_name()
|
||||
if name and core.rollback_punch_callbacks[name] then
|
||||
core.rollback_punch_callbacks[name](pos, node, puncher)
|
||||
core.rollback_punch_callbacks[name] = nil
|
||||
end
|
||||
@ -814,7 +817,7 @@ core.register_chatcommand("shutdown", {
|
||||
message = message or ""
|
||||
|
||||
if delay ~= "" then
|
||||
delay = tonumber(param) or 0
|
||||
delay = tonumber(delay) or 0
|
||||
else
|
||||
delay = 0
|
||||
core.log("action", name .. " shuts down server")
|
||||
@ -835,6 +838,9 @@ core.register_chatcommand("ban", {
|
||||
if not core.get_player_by_name(param) then
|
||||
return false, "No such player."
|
||||
end
|
||||
if core.is_singleplayer() then
|
||||
return false, "You cannot ban players in singleplayer!"
|
||||
end
|
||||
if not core.ban_player(param) then
|
||||
return false, "Failed to ban player."
|
||||
end
|
||||
|
@ -21,6 +21,10 @@ core.EMERGE_GENERATED = 4
|
||||
-- constants.h
|
||||
-- Size of mapblocks in nodes
|
||||
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
|
||||
|
||||
-- light.h
|
||||
-- Maximum value for node 'light_source' parameter
|
||||
|
@ -60,8 +60,13 @@ core.register_entity(":__builtin:falling_node", {
|
||||
local pos = self.object:getpos()
|
||||
-- Position of bottom center point
|
||||
local bcp = {x = pos.x, y = pos.y - 0.7, z = pos.z}
|
||||
-- Avoid bugs caused by an unloaded node below
|
||||
-- '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
|
||||
end
|
||||
local bcd = bcn and core.registered_nodes[bcn.name]
|
||||
if bcn and
|
||||
(not bcd or bcd.walkable or
|
||||
@ -93,7 +98,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
core.remove_node(np)
|
||||
if nd and nd.buildable_to == false then
|
||||
-- Add dropped items
|
||||
local drops = core.get_node_drops(n2.name, "")
|
||||
local drops = core.get_node_drops(n2, "")
|
||||
for _, dropped_item in pairs(drops) do
|
||||
core.add_item(np, dropped_item)
|
||||
end
|
||||
@ -145,9 +150,9 @@ function core.spawn_falling_node(pos)
|
||||
end
|
||||
|
||||
local function drop_attached_node(p)
|
||||
local nn = core.get_node(p).name
|
||||
local n = core.get_node(p)
|
||||
core.remove_node(p)
|
||||
for _, item in pairs(core.get_node_drops(nn, "")) do
|
||||
for _, item in pairs(core.get_node_drops(n, "")) do
|
||||
local pos = {
|
||||
x = p.x + math.random()/2 - 0.25,
|
||||
y = p.y + math.random()/2 - 0.25,
|
||||
|
@ -155,11 +155,45 @@ function core.yaw_to_dir(yaw)
|
||||
return {x = -math.sin(yaw), y = 0, z = math.cos(yaw)}
|
||||
end
|
||||
|
||||
function core.get_node_drops(nodename, toolname)
|
||||
function core.is_colored_paramtype(ptype)
|
||||
return (ptype == "color") or (ptype == "colorfacedir") or
|
||||
(ptype == "colorwallmounted")
|
||||
end
|
||||
|
||||
function core.strip_param2_color(param2, paramtype2)
|
||||
if not core.is_colored_paramtype(paramtype2) then
|
||||
return nil
|
||||
end
|
||||
if paramtype2 == "colorfacedir" then
|
||||
param2 = math.floor(param2 / 32) * 32
|
||||
elseif paramtype2 == "colorwallmounted" then
|
||||
param2 = math.floor(param2 / 8) * 8
|
||||
end
|
||||
-- paramtype2 == "color" requires no modification.
|
||||
return param2
|
||||
end
|
||||
|
||||
function core.get_node_drops(node, toolname)
|
||||
-- Compatibility, if node is string
|
||||
local nodename = node
|
||||
local param2 = 0
|
||||
-- New format, if node is table
|
||||
if (type(node) == "table") then
|
||||
nodename = node.name
|
||||
param2 = node.param2
|
||||
end
|
||||
local def = core.registered_nodes[nodename]
|
||||
local drop = def and def.drop
|
||||
local ptype = def and def.paramtype2
|
||||
-- get color, if there is color (otherwise nil)
|
||||
local palette_index = core.strip_param2_color(param2, ptype)
|
||||
if drop == nil then
|
||||
-- default drop
|
||||
if palette_index then
|
||||
local stack = ItemStack(nodename)
|
||||
stack:get_meta():set_int("palette_index", palette_index)
|
||||
return {stack:to_string()}
|
||||
end
|
||||
return {nodename}
|
||||
elseif type(drop) == "string" then
|
||||
-- itemstring drop
|
||||
@ -181,6 +215,8 @@ function core.get_node_drops(nodename, toolname)
|
||||
end
|
||||
if item.tools ~= nil then
|
||||
good_tool = false
|
||||
end
|
||||
if item.tools ~= nil and toolname then
|
||||
for _, tool in ipairs(item.tools) do
|
||||
if tool:sub(1, 1) == '~' then
|
||||
good_tool = toolname:find(tool:sub(2)) ~= nil
|
||||
@ -191,10 +227,16 @@ function core.get_node_drops(nodename, toolname)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if good_rarity and good_tool then
|
||||
got_count = got_count + 1
|
||||
for _, add_item in ipairs(item.items) do
|
||||
-- add color, if necessary
|
||||
if item.inherit_color and palette_index then
|
||||
local stack = ItemStack(add_item)
|
||||
stack:get_meta():set_int("palette_index", palette_index)
|
||||
add_item = stack:to_string()
|
||||
end
|
||||
got_items[#got_items+1] = add_item
|
||||
end
|
||||
if drop.max_items ~= nil and got_count == drop.max_items then
|
||||
@ -205,7 +247,22 @@ function core.get_node_drops(nodename, toolname)
|
||||
return got_items
|
||||
end
|
||||
|
||||
function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
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
|
||||
end
|
||||
|
||||
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
|
||||
@ -215,10 +272,11 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
local oldnode_under = core.get_node_or_nil(under)
|
||||
local above = pointed_thing.above
|
||||
local oldnode_above = core.get_node_or_nil(above)
|
||||
local playername = placer:get_player_name()
|
||||
local playername = user_name(placer)
|
||||
local log = make_log(playername)
|
||||
|
||||
if not oldnode_under or not oldnode_above then
|
||||
core.log("info", playername .. " tried to place"
|
||||
log("info", playername .. " tried to place"
|
||||
.. " node in unloaded position " .. core.pos_to_string(above))
|
||||
return itemstack, false
|
||||
end
|
||||
@ -229,7 +287,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
olddef_above = olddef_above or core.nodedef_default
|
||||
|
||||
if not olddef_above.buildable_to and not olddef_under.buildable_to then
|
||||
core.log("info", playername .. " tried to place"
|
||||
log("info", playername .. " tried to place"
|
||||
.. " node in invalid position " .. core.pos_to_string(above)
|
||||
.. ", replacing " .. oldnode_above.name)
|
||||
return itemstack, false
|
||||
@ -240,13 +298,12 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
|
||||
-- If node under is buildable_to, place into it instead (eg. snow)
|
||||
if olddef_under.buildable_to then
|
||||
core.log("info", "node under is buildable to")
|
||||
log("info", "node under is buildable to")
|
||||
place_to = {x = under.x, y = under.y, z = under.z}
|
||||
end
|
||||
|
||||
if core.is_protected(place_to, playername) and
|
||||
not minetest.check_player_privs(placer, "protection_bypass") then
|
||||
core.log("action", playername
|
||||
if is_protected(place_to, playername) then
|
||||
log("action", playername
|
||||
.. " tried to place " .. def.name
|
||||
.. " at protected position "
|
||||
.. core.pos_to_string(place_to))
|
||||
@ -254,11 +311,11 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
core.log("action", playername .. " places node "
|
||||
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}
|
||||
local newnode = {name = def.name, param1 = 0, param2 = param2 or 0}
|
||||
|
||||
-- Calculate direction for wall mounted stuff like torches and signs
|
||||
if def.place_param2 ~= nil then
|
||||
@ -274,7 +331,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
-- Calculate the direction for furnaces and chests and stuff
|
||||
elseif (def.paramtype2 == "facedir" or
|
||||
def.paramtype2 == "colorfacedir") and not param2 then
|
||||
local placer_pos = placer:getpos()
|
||||
local placer_pos = placer and placer:getpos()
|
||||
if placer_pos then
|
||||
local dir = {
|
||||
x = above.x - placer_pos.x,
|
||||
@ -282,14 +339,33 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
z = above.z - placer_pos.z
|
||||
}
|
||||
newnode.param2 = core.dir_to_facedir(dir)
|
||||
core.log("action", "facedir: " .. newnode.param2)
|
||||
log("action", "facedir: " .. newnode.param2)
|
||||
end
|
||||
end
|
||||
|
||||
local metatable = itemstack:get_meta():to_table().fields
|
||||
|
||||
-- Transfer color information
|
||||
if metatable.palette_index and not def.place_param2 then
|
||||
local color_divisor = nil
|
||||
if def.paramtype2 == "color" then
|
||||
color_divisor = 1
|
||||
elseif def.paramtype2 == "colorwallmounted" then
|
||||
color_divisor = 8
|
||||
elseif def.paramtype2 == "colorfacedir" then
|
||||
color_divisor = 32
|
||||
end
|
||||
if color_divisor then
|
||||
local color = math.floor(metatable.palette_index / color_divisor)
|
||||
local other = newnode.param2 % color_divisor
|
||||
newnode.param2 = color * color_divisor + other
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if the node is attached and if it can be placed there
|
||||
if core.get_item_group(def.name, "attached_node") ~= 0 and
|
||||
not builtin_shared.check_attached_node(place_to, newnode) then
|
||||
core.log("action", "attached node " .. def.name ..
|
||||
log("action", "attached node " .. def.name ..
|
||||
" can not be placed at " .. core.pos_to_string(place_to))
|
||||
return itemstack, false
|
||||
end
|
||||
@ -300,7 +376,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
local take_item = true
|
||||
|
||||
-- Run callback
|
||||
if def.after_place_node then
|
||||
if def.after_place_node and not prevent_after_place then
|
||||
-- Deepcopy place_to and pointed_thing because callback can modify it
|
||||
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
|
||||
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
|
||||
@ -360,28 +436,27 @@ function core.item_secondary_use(itemstack, placer)
|
||||
end
|
||||
|
||||
function core.item_drop(itemstack, dropper, pos)
|
||||
if dropper and dropper:is_player() then
|
||||
local v = dropper:get_look_dir()
|
||||
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
||||
local cs = itemstack:get_count()
|
||||
local dropper_is_player = dropper and dropper:is_player()
|
||||
local p = table.copy(pos)
|
||||
local cnt = itemstack:get_count()
|
||||
if dropper_is_player then
|
||||
p.y = p.y + 1.2
|
||||
if dropper:get_player_control().sneak then
|
||||
cs = 1
|
||||
cnt = 1
|
||||
end
|
||||
local item = itemstack:take_item(cs)
|
||||
local obj = core.add_item(p, item)
|
||||
if obj then
|
||||
v.x = v.x*2
|
||||
v.y = v.y*2 + 2
|
||||
v.z = v.z*2
|
||||
obj:setvelocity(v)
|
||||
end
|
||||
local item = itemstack:take_item(cnt)
|
||||
local obj = core.add_item(p, item)
|
||||
if obj then
|
||||
if dropper_is_player then
|
||||
local dir = dropper:get_look_dir()
|
||||
dir.x = dir.x * 2.9
|
||||
dir.y = dir.y * 2.9 + 2
|
||||
dir.z = dir.z * 2.9
|
||||
obj:set_velocity(dir)
|
||||
obj:get_luaentity().dropped_by = dropper:get_player_name()
|
||||
return itemstack
|
||||
end
|
||||
|
||||
else
|
||||
if core.add_item(pos, itemstack) then
|
||||
return itemstack
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
-- If we reach this, adding the object to the
|
||||
-- environment failed
|
||||
@ -402,7 +477,8 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
|
||||
itemstack:add_item(replace_with_item)
|
||||
else
|
||||
local inv = user:get_inventory()
|
||||
if inv:room_for_item("main", {name=replace_with_item}) then
|
||||
-- Check if inv is null, since non-players don't have one
|
||||
if inv and inv:room_for_item("main", {name=replace_with_item}) then
|
||||
inv:add_item("main", replace_with_item)
|
||||
else
|
||||
local pos = user:getpos()
|
||||
@ -417,7 +493,9 @@ end
|
||||
|
||||
function core.item_eat(hp_change, replace_with_item)
|
||||
return function(itemstack, user, pointed_thing) -- closure
|
||||
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
if user then
|
||||
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -434,63 +512,76 @@ end
|
||||
|
||||
function core.handle_node_drops(pos, drops, digger)
|
||||
-- Add dropped items to object's inventory
|
||||
if digger:get_inventory() then
|
||||
local _, dropped_item
|
||||
for _, dropped_item in ipairs(drops) do
|
||||
local left = digger:get_inventory():add_item("main", dropped_item)
|
||||
if not left:is_empty() then
|
||||
local p = {
|
||||
x = pos.x + math.random()/2-0.25,
|
||||
y = pos.y + math.random()/2-0.25,
|
||||
z = pos.z + math.random()/2-0.25,
|
||||
}
|
||||
core.add_item(p, left)
|
||||
end
|
||||
local inv = digger and digger:get_inventory()
|
||||
local give_item
|
||||
if inv then
|
||||
give_item = function(item)
|
||||
return inv:add_item("main", item)
|
||||
end
|
||||
else
|
||||
give_item = function(item)
|
||||
-- itemstring to ItemStack for left:is_empty()
|
||||
return ItemStack(item)
|
||||
end
|
||||
end
|
||||
|
||||
for _, dropped_item in pairs(drops) do
|
||||
local left = give_item(dropped_item)
|
||||
if not left:is_empty() then
|
||||
local p = {
|
||||
x = pos.x + math.random()/2-0.25,
|
||||
y = pos.y + math.random()/2-0.25,
|
||||
z = pos.z + math.random()/2-0.25,
|
||||
}
|
||||
core.add_item(p, left)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function core.node_dig(pos, node, digger)
|
||||
local diggername = user_name(digger)
|
||||
local log = make_log(diggername)
|
||||
local def = core.registered_nodes[node.name]
|
||||
if def and (not def.diggable or
|
||||
(def.can_dig and not def.can_dig(pos, digger))) then
|
||||
core.log("info", digger:get_player_name() .. " tried to dig "
|
||||
log("info", diggername .. " tried to dig "
|
||||
.. node.name .. " which is not diggable "
|
||||
.. core.pos_to_string(pos))
|
||||
return
|
||||
end
|
||||
|
||||
if core.is_protected(pos, digger:get_player_name()) and
|
||||
not minetest.check_player_privs(digger, "protection_bypass") then
|
||||
core.log("action", digger:get_player_name()
|
||||
if 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, digger:get_player_name())
|
||||
core.record_protection_violation(pos, diggername)
|
||||
return
|
||||
end
|
||||
|
||||
core.log('action', digger:get_player_name() .. " digs "
|
||||
log('action', diggername .. " digs "
|
||||
.. node.name .. " at " .. core.pos_to_string(pos))
|
||||
|
||||
local wielded = digger:get_wielded_item()
|
||||
local drops = core.get_node_drops(node.name, wielded:get_name())
|
||||
local wielded = digger and digger:get_wielded_item()
|
||||
local drops = core.get_node_drops(node, wielded and wielded:get_name())
|
||||
|
||||
local wdef = wielded:get_definition()
|
||||
local tp = wielded:get_tool_capabilities()
|
||||
local dp = core.get_dig_params(def and def.groups, tp)
|
||||
if wdef and wdef.after_use then
|
||||
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||
else
|
||||
-- Wear out tool
|
||||
if not core.settings:get_bool("creative_mode") 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})
|
||||
if wielded then
|
||||
local wdef = wielded:get_definition()
|
||||
local tp = wielded:get_tool_capabilities()
|
||||
local dp = core.get_dig_params(def and def.groups, tp)
|
||||
if wdef and wdef.after_use then
|
||||
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||
else
|
||||
-- Wear out tool
|
||||
if not core.settings:get_bool("creative_mode") 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})
|
||||
end
|
||||
end
|
||||
end
|
||||
digger:set_wielded_item(wielded)
|
||||
end
|
||||
digger:set_wielded_item(wielded)
|
||||
|
||||
-- Handle drops
|
||||
core.handle_node_drops(pos, drops, digger)
|
||||
|
@ -174,19 +174,18 @@ core.register_entity(":__builtin:item", {
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y - 0.5
|
||||
local node = core.get_node_or_nil(p)
|
||||
local in_unloaded = (node == nil)
|
||||
if in_unloaded then
|
||||
-- Don't infinetly fall into unloaded map
|
||||
self.object:setvelocity({x = 0, y = 0, z = 0})
|
||||
self.object:setacceleration({x = 0, y = 0, z = 0})
|
||||
self.physical_state = false
|
||||
self.object:set_properties({physical = false})
|
||||
-- Delete in 'ignore' nodes
|
||||
if node and node.name == "ignore" then
|
||||
self.itemstring = ""
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
local nn = node.name
|
||||
-- If node is not registered or node is walkably solid and resting on nodebox
|
||||
|
||||
-- If node is nil (unloaded area), or node is not registered, or node is
|
||||
-- walkably solid and item is resting on nodebox
|
||||
local v = self.object:getvelocity()
|
||||
if not core.registered_nodes[nn] or core.registered_nodes[nn].walkable and v.y == 0 then
|
||||
if not node or not core.registered_nodes[node.name] or
|
||||
core.registered_nodes[node.name].walkable and v.y == 0 then
|
||||
if self.physical_state then
|
||||
local own_stack = ItemStack(self.object:get_luaentity().itemstring)
|
||||
-- Merge with close entities of the same item
|
||||
|
@ -5,12 +5,11 @@
|
||||
--
|
||||
|
||||
function core.check_player_privs(name, ...)
|
||||
local arg_type = type(name)
|
||||
if (arg_type == "userdata" or arg_type == "table") and
|
||||
name.get_player_name then -- If it quacks like a Player...
|
||||
if core.is_player(name) then
|
||||
name = name:get_player_name()
|
||||
elseif arg_type ~= "string" then
|
||||
error("Invalid core.check_player_privs argument type: " .. arg_type, 2)
|
||||
elseif type(name) ~= "string" then
|
||||
error("core.check_player_privs expects a player or playername as " ..
|
||||
"argument.", 2)
|
||||
end
|
||||
|
||||
local requested_privs = {...}
|
||||
@ -70,6 +69,16 @@ function core.get_connected_players()
|
||||
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
|
||||
local t = type(player)
|
||||
return (t == "userdata" or t == "table") and
|
||||
type(player.is_player) == "function" and player:is_player()
|
||||
end
|
||||
|
||||
|
||||
function minetest.player_exists(name)
|
||||
return minetest.get_auth_handler().get_auth(name) ~= nil
|
||||
end
|
||||
@ -178,3 +187,19 @@ function core.cancel_shutdown_requests()
|
||||
core.request_shutdown("", false, -1)
|
||||
end
|
||||
|
||||
-- Enforce security of logs (if cloaking hasn't already done so)
|
||||
core.after(0, function()
|
||||
if core.global_exists("cloaking") and cloaking.hide_player then return end
|
||||
|
||||
local log = core.log
|
||||
function core.log(level, text)
|
||||
level = level:gsub("[\r\n]", " ")
|
||||
if text then
|
||||
text = text:gsub("[\r\n]", " ")
|
||||
else
|
||||
text = level
|
||||
level = "none"
|
||||
end
|
||||
return log(level, text)
|
||||
end
|
||||
end)
|
||||
|
@ -116,6 +116,8 @@ function core.register_item(name, itemdef)
|
||||
end
|
||||
itemdef.name = name
|
||||
|
||||
local is_overriding = core.registered_items[name]
|
||||
|
||||
-- Apply defaults and add to registered_* table
|
||||
if itemdef.type == "node" then
|
||||
-- Use the nodebox as selection box if it's not set manually
|
||||
@ -177,7 +179,13 @@ function core.register_item(name, itemdef)
|
||||
--core.log("Registering item: " .. itemdef.name)
|
||||
core.registered_items[itemdef.name] = itemdef
|
||||
core.registered_aliases[itemdef.name] = nil
|
||||
register_item_raw(itemdef)
|
||||
|
||||
-- Used to allow builtin to register ignore to registered_items
|
||||
if name ~= "ignore" then
|
||||
register_item_raw(itemdef)
|
||||
elseif is_overriding then
|
||||
core.log("warning", "Attempted redefinition of \"ignore\"")
|
||||
end
|
||||
end
|
||||
|
||||
function core.unregister_item(name)
|
||||
|
@ -6,7 +6,7 @@ local health_bar_definition =
|
||||
hud_elem_type = "statbar",
|
||||
position = { x=0.5, y=1 },
|
||||
text = "heart.png",
|
||||
number = 20,
|
||||
number = core.PLAYER_MAX_HP_DEFAULT,
|
||||
direction = 0,
|
||||
size = { x=24, y=24 },
|
||||
offset = { x=(-10*24)-25, y=-(48+24+16)},
|
||||
@ -17,7 +17,7 @@ local breath_bar_definition =
|
||||
hud_elem_type = "statbar",
|
||||
position = { x=0.5, y=1 },
|
||||
text = "bubble.png",
|
||||
number = 20,
|
||||
number = core.PLAYER_MAX_BREATH_DEFAULT,
|
||||
direction = 0,
|
||||
size = { x=24, y=24 },
|
||||
offset = {x=25,y=-(48+24+16)},
|
||||
@ -25,6 +25,15 @@ local breath_bar_definition =
|
||||
|
||||
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 max_display = math.max(nominal,
|
||||
math.max(player:get_properties()[field .. "_max"], current))
|
||||
return current / max_display * nominal
|
||||
end
|
||||
|
||||
local function initialize_builtin_statbars(player)
|
||||
|
||||
if not player:is_player() then
|
||||
@ -37,39 +46,39 @@ local function initialize_builtin_statbars(player)
|
||||
return
|
||||
end
|
||||
|
||||
if (hud_ids[name] == nil) then
|
||||
if not hud_ids[name] then
|
||||
hud_ids[name] = {}
|
||||
-- flags are not transmitted to client on connect, we need to make sure
|
||||
-- our current flags are transmitted by sending them actively
|
||||
player:hud_set_flags(player:hud_get_flags())
|
||||
end
|
||||
local hud = hud_ids[name]
|
||||
|
||||
if player:hud_get_flags().healthbar and enable_damage then
|
||||
if hud_ids[name].id_healthbar == nil then
|
||||
health_bar_definition.number = player:get_hp()
|
||||
hud_ids[name].id_healthbar = player:hud_add(health_bar_definition)
|
||||
end
|
||||
else
|
||||
if hud_ids[name].id_healthbar ~= nil then
|
||||
player:hud_remove(hud_ids[name].id_healthbar)
|
||||
hud_ids[name].id_healthbar = nil
|
||||
if hud.id_healthbar == nil then
|
||||
local hud_def = table.copy(health_bar_definition)
|
||||
hud_def.number = scaleToDefault(player, "hp")
|
||||
hud.id_healthbar = player:hud_add(hud_def)
|
||||
end
|
||||
elseif hud.id_healthbar ~= nil then
|
||||
player:hud_remove(hud.id_healthbar)
|
||||
hud.id_healthbar = nil
|
||||
end
|
||||
|
||||
if (player:get_breath() < 11) then
|
||||
if player:hud_get_flags().breathbar and enable_damage then
|
||||
if hud_ids[name].id_breathbar == nil then
|
||||
hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition)
|
||||
end
|
||||
else
|
||||
if hud_ids[name].id_breathbar ~= nil then
|
||||
player:hud_remove(hud_ids[name].id_breathbar)
|
||||
hud_ids[name].id_breathbar = nil
|
||||
end
|
||||
local breath_max = core.PLAYER_MAX_BREATH_DEFAULT
|
||||
|
||||
if player:get_properties().breath_max then breath_max = player:get_properties().breath_max end
|
||||
|
||||
if player:hud_get_flags().breathbar and enable_damage and
|
||||
player:get_breath() < breath_max then
|
||||
if hud.id_breathbar == nil then
|
||||
local hud_def = table.copy(breath_bar_definition)
|
||||
hud_def.number = 2 * scaleToDefault(player, "breath")
|
||||
hud.id_breathbar = player:hud_add(hud_def)
|
||||
end
|
||||
elseif hud_ids[name].id_breathbar ~= nil then
|
||||
player:hud_remove(hud_ids[name].id_breathbar)
|
||||
hud_ids[name].id_breathbar = nil
|
||||
elseif hud.id_breathbar ~= nil then
|
||||
player:hud_remove(hud.id_breathbar)
|
||||
hud.id_breathbar = nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -101,7 +110,8 @@ local function player_event_handler(player,eventname)
|
||||
initialize_builtin_statbars(player)
|
||||
|
||||
if hud_ids[name].id_healthbar ~= nil then
|
||||
player:hud_change(hud_ids[name].id_healthbar,"number",player:get_hp())
|
||||
player:hud_change(hud_ids[name].id_healthbar,
|
||||
"number", scaleToDefault(player, "hp"))
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -110,7 +120,8 @@ local function player_event_handler(player,eventname)
|
||||
initialize_builtin_statbars(player)
|
||||
|
||||
if hud_ids[name].id_breathbar ~= nil then
|
||||
player:hud_change(hud_ids[name].id_breathbar,"number",player:get_breath()*2)
|
||||
player:hud_change(hud_ids[name].id_breathbar,
|
||||
"number", 2 * scaleToDefault(player, "breath"))
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -160,6 +171,10 @@ function core.hud_replace_builtin(name, definition)
|
||||
return false
|
||||
end
|
||||
|
||||
core.register_on_joinplayer(initialize_builtin_statbars)
|
||||
-- Append "update_builtin_statbars" as late as possible
|
||||
-- This ensures that the HUD is hidden when the flags are updated in this callback
|
||||
core.after(0, function()
|
||||
core.register_on_joinplayer(initialize_builtin_statbars)
|
||||
end)
|
||||
core.register_on_leaveplayer(cleanup_builtin_statbars)
|
||||
core.register_playerevent(player_event_handler)
|
||||
|
@ -21,7 +21,6 @@ if core.print then
|
||||
core.print = nil -- don't pollute our namespace
|
||||
end
|
||||
math.randomseed(os.time())
|
||||
os.setlocale("C", "numeric")
|
||||
minetest = core
|
||||
|
||||
-- Load other files
|
||||
@ -47,7 +46,6 @@ elseif INIT == "mainmenu" then
|
||||
elseif INIT == "async" then
|
||||
dofile(asyncpath .. "init.lua")
|
||||
elseif INIT == "client" then
|
||||
os.setlocale = nil
|
||||
dofile(clientpath .. "init.lua")
|
||||
else
|
||||
error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))
|
||||
|
@ -250,7 +250,7 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function text2textlist(xpos, ypos, width, height, tl_name, textlen, text, transparency)
|
||||
local textlines = core.wrap_text(text, textlen)
|
||||
local textlines = core.wrap_text(text, textlen, true)
|
||||
local retval = "textlist[" .. xpos .. "," .. ypos .. ";" .. width ..
|
||||
"," .. height .. ";" .. tl_name .. ";"
|
||||
|
||||
|
@ -66,11 +66,11 @@ local function create_world_formspec(dialogdata)
|
||||
if #gamemgr.games == 0 then
|
||||
retval = retval .. "box[2,4;8,1;#ff8800]label[2.25,4;" ..
|
||||
fgettext("You have no subgames installed.") .. "]label[2.25,4.4;" ..
|
||||
fgettext("Download one from minetest.net") .. "]"
|
||||
fgettext("Download one from minetest.org") .. "]"
|
||||
elseif #gamemgr.games == 1 and gamemgr.games[1].id == "minimal" then
|
||||
retval = retval .. "box[1.75,4;8.7,1;#ff8800]label[2,4;" ..
|
||||
fgettext("Warning: The minimal development test is meant for developers.") .. "]label[2,4.4;" ..
|
||||
fgettext("Download a subgame, such as minetest_game, from minetest.net") .. "]"
|
||||
fgettext("Download a subgame, such as minetest_game, from minetest.org") .. "]"
|
||||
end
|
||||
|
||||
return retval
|
||||
|
@ -17,39 +17,36 @@
|
||||
|
||||
|
||||
local function delete_world_formspec(dialogdata)
|
||||
|
||||
local retval =
|
||||
"size[11.5,4.5,true]" ..
|
||||
"label[2,2;" ..
|
||||
"size[10,2.5,true]" ..
|
||||
"label[0.5,0.5;" ..
|
||||
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" ..
|
||||
"button[3.25,3.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
|
||||
"button[5.75,3.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
|
||||
"button[0.5,1.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
|
||||
"button[7.0,1.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
|
||||
return retval
|
||||
end
|
||||
|
||||
local function delete_world_buttonhandler(this, fields)
|
||||
if fields["world_delete_confirm"] then
|
||||
|
||||
if this.data.delete_index > 0 and
|
||||
this.data.delete_index <= #menudata.worldlist:get_raw_list() then
|
||||
this.data.delete_index <= #menudata.worldlist:get_raw_list() then
|
||||
core.delete_world(this.data.delete_index)
|
||||
menudata.worldlist:refresh()
|
||||
end
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
if fields["world_delete_cancel"] then
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
function create_delete_world_dlg(name_to_del,index_to_del)
|
||||
|
||||
function create_delete_world_dlg(name_to_del, index_to_del)
|
||||
assert(name_to_del ~= nil and type(name_to_del) == "string" and name_to_del ~= "")
|
||||
assert(index_to_del ~= nil and type(index_to_del) == "number")
|
||||
|
||||
@ -59,6 +56,6 @@ function create_delete_world_dlg(name_to_del,index_to_del)
|
||||
nil)
|
||||
retval.data.delete_name = name_to_del
|
||||
retval.data.delete_index = index_to_del
|
||||
|
||||
|
||||
return retval
|
||||
end
|
||||
|
@ -15,10 +15,10 @@ local minetest_example_header = [[
|
||||
# ../minetest.conf
|
||||
# ../../minetest.conf
|
||||
# Any other path can be chosen by passing the path as a parameter
|
||||
# to the program, eg. "minetest.exe --config ../minetest.conf.example".
|
||||
# to the program, eg. "minetest4 --config ../minetest.conf.example".
|
||||
|
||||
# Further documentation:
|
||||
# http://wiki.minetest.net/
|
||||
# http://wiki.minetest.org/
|
||||
|
||||
]]
|
||||
|
||||
|
@ -402,6 +402,8 @@ function modmgr.preparemodlist(data)
|
||||
if modpath ~= nil and
|
||||
modpath ~= "" then
|
||||
get_mods(modpath,global_mods)
|
||||
else
|
||||
get_mods("/usr/share/games/minetest4/mods",global_mods)
|
||||
end
|
||||
|
||||
for i=1,#global_mods,1 do
|
||||
|
@ -74,7 +74,7 @@ local previous_contributors = {
|
||||
}
|
||||
|
||||
local function buildCreditList(source)
|
||||
ret = {}
|
||||
local ret = {}
|
||||
for i = 1, #source do
|
||||
ret[i] = core.formspec_escape(source[i])
|
||||
end
|
||||
@ -89,17 +89,17 @@ return {
|
||||
local version = core.get_version()
|
||||
return "image[0.5,1;" .. core.formspec_escape(logofile) .. "]" ..
|
||||
"label[0.5,3.2;" .. version.project .. " " .. version.string .. "]" ..
|
||||
"label[0.5,3.5;http://minetest.net]" ..
|
||||
"label[0.5,3.5;http://codeberg.org/minenux]" ..
|
||||
"tablecolumns[color;text]" ..
|
||||
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
|
||||
"table[3.5,-0.25;8.5,6.05;list_credits;" ..
|
||||
"#FFFF00," .. fgettext("Core Developers") .. ",," ..
|
||||
"#FFFF00," .. fgettext("Core Minetest Developers") .. ",," ..
|
||||
buildCreditList(core_developers) .. ",,," ..
|
||||
"#FFFF00," .. fgettext("Active Contributors") .. ",," ..
|
||||
"#FFFF00," .. fgettext("Active Minetest Contributors") .. ",," ..
|
||||
buildCreditList(active_contributors) .. ",,," ..
|
||||
"#FFFF00," .. fgettext("Previous Core Developers") ..",," ..
|
||||
"#FFFF00," .. fgettext("Previous Minetest Core Developers") ..",," ..
|
||||
buildCreditList(previous_core_developers) .. ",,," ..
|
||||
"#FFFF00," .. fgettext("Previous Contributors") .. ",," ..
|
||||
"#FFFF00," .. fgettext("Previous Minetest Contributors") .. ",," ..
|
||||
buildCreditList(previous_contributors) .. "," ..
|
||||
";1]"
|
||||
end
|
||||
|
@ -75,7 +75,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||
if error == nil then
|
||||
local descriptiontext = descriptionfile:read("*all")
|
||||
|
||||
descriptionlines = core.wrap_text(descriptiontext, 42)
|
||||
descriptionlines = core.wrap_text(descriptiontext, 42, true)
|
||||
descriptionfile:close()
|
||||
else
|
||||
descriptionlines = {}
|
||||
|
@ -254,6 +254,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
-- setup the keyword list
|
||||
local keywords = {}
|
||||
for word in input:gmatch("%S+") do
|
||||
word = word:gsub("(%W)", "%%%1")
|
||||
table.insert(keywords, word)
|
||||
end
|
||||
|
||||
@ -295,6 +296,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
local first_server = search_result[1]
|
||||
core.settings:set("address", first_server.address)
|
||||
core.settings:set("remote_port", first_server.port)
|
||||
gamedata.serverdescription = first_server.description
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
@ -176,7 +176,7 @@ end
|
||||
|
||||
local function formspec(tabview, name, tabdata)
|
||||
local tab_string =
|
||||
"box[0,0;3.5,4.5;#999999]" ..
|
||||
"box[0,0;3.75,4.5;#999999]" ..
|
||||
"checkbox[0.25,0;cb_smooth_lighting;" .. fgettext("Smooth Lighting") .. ";"
|
||||
.. dump(core.settings:get_bool("smooth_lighting")) .. "]" ..
|
||||
"checkbox[0.25,0.5;cb_particles;" .. fgettext("Particles") .. ";"
|
||||
@ -187,38 +187,51 @@ local function formspec(tabview, name, tabdata)
|
||||
.. dump(core.settings:get_bool("opaque_water")) .. "]" ..
|
||||
"checkbox[0.25,2.0;cb_connected_glass;" .. fgettext("Connected Glass") .. ";"
|
||||
.. dump(core.settings:get_bool("connected_glass")) .. "]" ..
|
||||
"dropdown[0.25,2.8;3.3;dd_node_highlighting;" .. dd_options.node_highlighting[1] .. ";"
|
||||
"dropdown[0.25,2.8;3.5;dd_node_highlighting;" .. dd_options.node_highlighting[1] .. ";"
|
||||
.. getSettingIndex.NodeHighlighting() .. "]" ..
|
||||
"dropdown[0.25,3.6;3.3;dd_leaves_style;" .. dd_options.leaves[1] .. ";"
|
||||
"dropdown[0.25,3.6;3.5;dd_leaves_style;" .. dd_options.leaves[1] .. ";"
|
||||
.. getSettingIndex.Leaves() .. "]" ..
|
||||
"box[3.75,0;3.75,4.45;#999999]" ..
|
||||
"label[3.85,0.1;" .. fgettext("Texturing:") .. "]" ..
|
||||
"dropdown[3.85,0.55;3.85;dd_filters;" .. dd_options.filters[1] .. ";"
|
||||
"box[4,0;3.75,4.5;#999999]" ..
|
||||
"label[4.25,0.1;" .. fgettext("Texturing:") .. "]" ..
|
||||
"dropdown[4.25,0.55;3.5;dd_filters;" .. dd_options.filters[1] .. ";"
|
||||
.. getSettingIndex.Filter() .. "]" ..
|
||||
"dropdown[3.85,1.35;3.85;dd_mipmap;" .. dd_options.mipmap[1] .. ";"
|
||||
"dropdown[4.25,1.35;3.5;dd_mipmap;" .. dd_options.mipmap[1] .. ";"
|
||||
.. getSettingIndex.Mipmap() .. "]" ..
|
||||
"label[3.85,2.15;" .. fgettext("Antialiasing:") .. "]" ..
|
||||
"dropdown[3.85,2.6;3.85;dd_antialiasing;" .. dd_options.antialiasing[1] .. ";"
|
||||
"label[4.25,2.15;" .. fgettext("Antialiasing:") .. "]" ..
|
||||
"dropdown[4.25,2.6;3.5;dd_antialiasing;" .. dd_options.antialiasing[1] .. ";"
|
||||
.. getSettingIndex.Antialiasing() .. "]" ..
|
||||
"label[3.85,3.45;" .. fgettext("Screen:") .. "]" ..
|
||||
"checkbox[3.85,3.6;cb_autosave_screensize;" .. fgettext("Autosave screen size") .. ";"
|
||||
"label[4.25,3.45;" .. fgettext("Screen:") .. "]" ..
|
||||
"checkbox[4.25,3.6;cb_autosave_screensize;" .. fgettext("Autosave screen size") .. ";"
|
||||
.. dump(core.settings:get_bool("autosave_screensize")) .. "]" ..
|
||||
"box[7.75,0;4,4.4;#999999]" ..
|
||||
"checkbox[8,0;cb_shaders;" .. fgettext("Shaders") .. ";"
|
||||
.. dump(core.settings:get_bool("enable_shaders")) .. "]"
|
||||
"box[8,0;3.75,4.5;#999999]"
|
||||
|
||||
local video_driver = core.settings:get("video_driver")
|
||||
local shaders_supported = video_driver == "opengl"
|
||||
local shaders_enabled = false
|
||||
if shaders_supported then
|
||||
shaders_enabled = core.settings:get_bool("enable_shaders")
|
||||
tab_string = tab_string ..
|
||||
"checkbox[8.25,0;cb_shaders;" .. fgettext("Shaders") .. ";"
|
||||
.. tostring(shaders_enabled) .. "]"
|
||||
else
|
||||
core.settings:set_bool("enable_shaders", false)
|
||||
tab_string = tab_string ..
|
||||
"label[8.38,0.2;" .. core.colorize("#888888",
|
||||
fgettext("Shaders (unavailable)")) .. "]"
|
||||
end
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
tab_string = tab_string ..
|
||||
"button[8,4.75;3.75,0.5;btn_reset_singleplayer;"
|
||||
"button[8,4.75;4.1,1;btn_reset_singleplayer;"
|
||||
.. fgettext("Reset singleplayer world") .. "]"
|
||||
else
|
||||
tab_string = tab_string ..
|
||||
"button[8,4.85;3.75,0.5;btn_change_keys;"
|
||||
"button[8,4.75;4,1;btn_change_keys;"
|
||||
.. fgettext("Change keys") .. "]"
|
||||
end
|
||||
|
||||
tab_string = tab_string ..
|
||||
"button[0,4.85;3.75,0.5;btn_advanced_settings;"
|
||||
"button[0,4.75;4,1;btn_advanced_settings;"
|
||||
.. fgettext("Advanced Settings") .. "]"
|
||||
|
||||
|
||||
@ -229,21 +242,21 @@ local function formspec(tabview, name, tabdata)
|
||||
((tonumber(core.settings:get("touchscreen_threshold")) / 10) + 1) .. "]"
|
||||
end
|
||||
|
||||
if core.settings:get_bool("enable_shaders") then
|
||||
if shaders_enabled then
|
||||
tab_string = tab_string ..
|
||||
"checkbox[8,0.5;cb_bumpmapping;" .. fgettext("Bump Mapping") .. ";"
|
||||
"checkbox[8.25,0.5;cb_bumpmapping;" .. fgettext("Bump Mapping") .. ";"
|
||||
.. dump(core.settings:get_bool("enable_bumpmapping")) .. "]" ..
|
||||
"checkbox[8,1;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";"
|
||||
"checkbox[8.25,1;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";"
|
||||
.. dump(core.settings:get_bool("tone_mapping")) .. "]" ..
|
||||
"checkbox[8,1.5;cb_generate_normalmaps;" .. fgettext("Normal Mapping") .. ";"
|
||||
"checkbox[8.25,1.5;cb_generate_normalmaps;" .. fgettext("Normal Mapping") .. ";"
|
||||
.. dump(core.settings:get_bool("generate_normalmaps")) .. "]" ..
|
||||
"checkbox[8,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
|
||||
"checkbox[8.25,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
|
||||
.. dump(core.settings:get_bool("enable_parallax_occlusion")) .. "]" ..
|
||||
"checkbox[8,2.5;cb_waving_water;" .. fgettext("Waving Water") .. ";"
|
||||
"checkbox[8.25,2.5;cb_waving_water;" .. fgettext("Waving Water") .. ";"
|
||||
.. dump(core.settings:get_bool("enable_waving_water")) .. "]" ..
|
||||
"checkbox[8,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
|
||||
"checkbox[8.25,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
|
||||
.. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
|
||||
"checkbox[8,3.5;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
|
||||
"checkbox[8.25,3.5;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
|
||||
.. dump(core.settings:get_bool("enable_waving_plants")) .. "]"
|
||||
else
|
||||
tab_string = tab_string ..
|
||||
|
@ -88,7 +88,7 @@ local function instrument(def)
|
||||
if not def or not def.func then
|
||||
return
|
||||
end
|
||||
def.mod = def.mod or get_current_modname()
|
||||
def.mod = def.mod or get_current_modname() or "??"
|
||||
local modname = def.mod
|
||||
local instrument_name = generate_name(def)
|
||||
local func = def.func
|
||||
@ -133,7 +133,7 @@ local function instrument_register(func, func_name)
|
||||
return func(instrument {
|
||||
func = callback,
|
||||
func_name = register_name
|
||||
}), ...
|
||||
}, ...)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -62,7 +62,10 @@ enable_build_where_you_stand (Build inside player) bool false
|
||||
# This requires the "fly" privilege on the server.
|
||||
free_move (Flying) bool false
|
||||
|
||||
# Fast movement (via use key).
|
||||
# If enabled together with fly mode, makes move directions relative to the player's pitch.
|
||||
pitch_fly (Pitch fly mode) bool false
|
||||
|
||||
# Fast movement (via the "special" key).
|
||||
# This requires the "fast" privilege on the server.
|
||||
fast_move (Fast movement) bool false
|
||||
|
||||
@ -166,10 +169,6 @@ keymap_cmd (Command key) key /
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_cmd_local (Command key) key .
|
||||
|
||||
# Key for opening the chat console.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keyman_console (Console key) key KEY_F10
|
||||
|
||||
# Key for toggling unlimited view range.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_rangeselect (Range select key) key KEY_KEY_R
|
||||
@ -178,6 +177,10 @@ keymap_rangeselect (Range select key) key KEY_KEY_R
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_freemove (Fly key) key KEY_KEY_K
|
||||
|
||||
# Key for toggling pitch fly mode.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_pitchfly (Pitch fly key) key KEY_KEY_L
|
||||
|
||||
# Key for toggling fast mode.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_fastmove (Fast key) key KEY_KEY_J
|
||||
@ -394,7 +397,7 @@ undersampling (Undersampling) enum 0 0,2,3,4
|
||||
|
||||
# Shaders allow advanced visual effects and may increase performance on some video cards.
|
||||
# This only works with the OpenGL video backend.
|
||||
enable_shaders (Shaders) bool true
|
||||
enable_shaders (Shaders) bool false
|
||||
|
||||
# Path to shader directory. If no path is defined, default location will be used.
|
||||
shader_path (Shader path) path
|
||||
@ -476,6 +479,12 @@ pause_fps_max (FPS in pause menu) int 20
|
||||
# View distance in nodes.
|
||||
viewing_range (Viewing range) int 100 20 4000
|
||||
|
||||
# Camera near plane distance in nodes, between 0 and 0.5
|
||||
# Most users will not need to change this.
|
||||
# Increasing can reduce artifacting on weaker GPUs.
|
||||
# 0.1 = Default, 0.25 = Good value for weaker tablets.
|
||||
near_plane (Near plane) float 0.1 0 0.5
|
||||
|
||||
# Width component of the initial window size.
|
||||
screenW (Screen width) int 800
|
||||
|
||||
@ -709,10 +718,10 @@ server_name (Server name) string Minetest server
|
||||
server_description (Server description) string mine here
|
||||
|
||||
# Domain name of server, to be displayed in the serverlist.
|
||||
server_address (Server address) string game.minetest.net
|
||||
server_address (Server address) string game.minetest.org
|
||||
|
||||
# Homepage of server, to be displayed in the serverlist.
|
||||
server_url (Server URL) string http://minetest.net
|
||||
server_url (Server URL) string http://minetest.org
|
||||
|
||||
# Automaticaly report to the serverlist.
|
||||
server_announce (Announce server) bool false
|
||||
@ -721,10 +730,9 @@ server_announce (Announce server) bool false
|
||||
# If you want to announce your ipv6 address, use serverlist_url = v6.servers.minetest.net.
|
||||
serverlist_url (Serverlist URL) string servers.minetest.net
|
||||
|
||||
# Disable escape sequences, e.g. chat coloring.
|
||||
# Use this if you want to run a server with pre-0.4.14 clients and you want to disable
|
||||
# the escape sequences generated by mods.
|
||||
disable_escape_sequences (Disable escape sequences) bool false
|
||||
# Remove color codes from incoming chat messages
|
||||
# Use this to stop players from being able to use color in their messages
|
||||
strip_color_codes (Strip color codes) bool false
|
||||
|
||||
[*Network]
|
||||
|
||||
@ -1498,11 +1506,19 @@ main_menu_game_mgr (Main menu game manager) int 0
|
||||
|
||||
main_menu_mod_mgr (Main menu mod manager) int 1
|
||||
|
||||
modstore_download_url (Modstore download URL) string https://forum.minetest.net/media/
|
||||
modstore_download_url (Modstore download URL) string https://forum.minetest.org/media/
|
||||
|
||||
modstore_listmods_url (Modstore mods list URL) string https://forum.minetest.net/mmdb/mods/
|
||||
modstore_listmods_url (Modstore mods list URL) string https://forum.minetest.org/mmdb/mods/
|
||||
|
||||
modstore_details_url (Modstore details URL) string https://forum.minetest.net/mmdb/mod/*/
|
||||
modstore_details_url (Modstore details URL) string https://forum.minetest.org/mmdb/mod/*/
|
||||
|
||||
# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers.
|
||||
profiler_print_interval (Engine profiling data print interval) int 0
|
||||
|
||||
[venenux]
|
||||
|
||||
# provides rapid dig, but just break the block, still valid pick must be handle
|
||||
# by example you can dig a stone with a wood pick, with this you are able
|
||||
# to dig with one action, but the tool will sufers same as if you dig normally
|
||||
instant_dig (Dig Nodes on punch) bool true
|
||||
|
||||
|
@ -60,7 +60,7 @@ find_package_handle_standard_args(GetText DEFAULT_MSG ${GETTEXT_REQUIRED_VARS})
|
||||
|
||||
if(GETTEXT_FOUND)
|
||||
# BSD variants require special linkage as they don't use glibc
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "BSD|DragonFly")
|
||||
set(GETTEXT_LIBRARY "intl")
|
||||
endif()
|
||||
|
||||
|
@ -8,17 +8,21 @@ option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JSONCPP. May cause seg
|
||||
|
||||
if(ENABLE_SYSTEM_JSONCPP)
|
||||
find_library(JSON_LIBRARY NAMES jsoncpp)
|
||||
find_path(JSON_INCLUDE_DIR json/features.h PATH_SUFFIXES jsoncpp)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
|
||||
find_path(JSON_INCLUDE_DIR json/features.h PATH_SUFFIXES jsoncpp)
|
||||
else()
|
||||
find_path(JSON_INCLUDE_DIR json/allocator.h PATH_SUFFIXES jsoncpp)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(JSONCPP DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)
|
||||
find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)
|
||||
|
||||
if(JSONCPP_FOUND)
|
||||
if(JSON_FOUND)
|
||||
message(STATUS "Using system JSONCPP library.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT JSONCPP_FOUND)
|
||||
if(NOT JSON_FOUND)
|
||||
message(STATUS "Using bundled JSONCPP library.")
|
||||
set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jsoncpp)
|
||||
set(JSON_LIBRARY jsoncpp)
|
||||
|
@ -9,7 +9,7 @@
|
||||
FIND_PATH(LUA_INCLUDE_DIR luajit.h
|
||||
HINTS
|
||||
$ENV{LUA_DIR}
|
||||
PATH_SUFFIXES include/luajit-2.0 include/luajit-5_1-2.0 include
|
||||
PATH_SUFFIXES include/luajit-2.1 include/luajit-2.0 include/luajit-5_1-2.1 include/luajit-5_1-2.0 include luajit
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
@ -19,19 +19,31 @@ FIND_PATH(LUA_INCLUDE_DIR luajit.h
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LUA_LIBRARY
|
||||
NAMES luajit-5.1
|
||||
HINTS
|
||||
$ENV{LUA_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
# Test if running on vcpkg toolchain
|
||||
if(DEFINED VCPKG_TARGET_TRIPLET AND DEFINED VCPKG_APPLOCAL_DEPS)
|
||||
# On vcpkg luajit is 'lua51' and normal lua is 'lua'
|
||||
FIND_LIBRARY(LUA_LIBRARY
|
||||
NAMES lua51
|
||||
HINTS
|
||||
$ENV{LUA_DIR}
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
else()
|
||||
FIND_LIBRARY(LUA_LIBRARY
|
||||
NAMES luajit-5.1
|
||||
HINTS
|
||||
$ENV{LUA_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h")
|
||||
FILE(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT .+\"")
|
||||
@ -43,7 +55,7 @@ ENDIF()
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT
|
||||
REQUIRED_VARS LUA_LIBRARY LUA_INCLUDE_DIR
|
||||
VERSION_VAR LUA_VERSION_STRING)
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
Minetest Lua Client Modding API Reference 0.4.15
|
||||
================================================
|
||||
* More information at <http://www.minetest.net/>
|
||||
* Developer Wiki: <http://dev.minetest.net/>
|
||||
* More information at <http://www.minetest.org/>
|
||||
|
||||
Introduction
|
||||
------------
|
||||
@ -628,6 +627,9 @@ Minetest namespace reference
|
||||
version entirely. To check for the presence of engine features, test
|
||||
whether the functions exported by the wanted features exist. For example:
|
||||
`if minetest.nodeupdate then ... end`.
|
||||
* `minetest.sha1(data, [raw])`: returns the sha1 hash of data
|
||||
* `data`: string of data to hash
|
||||
* `raw`: return raw bytes instead of hex digits, default: false
|
||||
|
||||
### Logging
|
||||
* `minetest.debug(...)`
|
||||
@ -1117,15 +1119,15 @@ The following functions provide escape sequences:
|
||||
`minetest.get_color_escape_sequence(color) ..
|
||||
message ..
|
||||
minetest.get_color_escape_sequence("#ffffff")`
|
||||
* `color.get_background_escape_sequence(color)`
|
||||
* `minetest.get_background_escape_sequence(color)`
|
||||
* `color` is a [ColorString](#colorstring)
|
||||
* The escape sequence sets the background of the whole text element to
|
||||
`color`. Only defined for item descriptions and tooltips.
|
||||
* `color.strip_foreground_colors(str)`
|
||||
* `minetest.strip_foreground_colors(str)`
|
||||
* Removes foreground colors added by `get_color_escape_sequence`.
|
||||
* `color.strip_background_colors(str)`
|
||||
* `minetest.strip_background_colors(str)`
|
||||
* Removes background colors added by `get_background_escape_sequence`.
|
||||
* `color.strip_colors(str)`
|
||||
* `minetest.strip_colors(str)`
|
||||
* Removes all color escape sequences.
|
||||
|
||||
`ColorString`
|
||||
|
316
doc/lua_api.txt
316
doc/lua_api.txt
@ -1,7 +1,6 @@
|
||||
Minetest Lua Modding API Reference 0.4.16
|
||||
Minetest Lua Modding API Reference 0.4.17
|
||||
=========================================
|
||||
* More information at <http://www.minetest.net/>
|
||||
* Developer Wiki: <http://dev.minetest.net/>
|
||||
* More information at <http://www.minetest.org/>
|
||||
|
||||
Introduction
|
||||
------------
|
||||
@ -211,7 +210,8 @@ when registering it.
|
||||
|
||||
The `:` prefix can also be used for maintaining backwards compatibility.
|
||||
|
||||
### Aliases
|
||||
Aliases
|
||||
-------
|
||||
Aliases can be added by using `minetest.register_alias(name, convert_to)` or
|
||||
`minetest.register_alias_force(name, convert_to)`.
|
||||
|
||||
@ -232,6 +232,75 @@ you have an item called `epiclylongmodname:stuff`, you could do
|
||||
|
||||
and be able to use `/giveme stuff`.
|
||||
|
||||
Mapgen aliases
|
||||
--------------
|
||||
In a game, a certain number of these must be set to tell core mapgens which
|
||||
of the game's nodes are to be used by the core mapgens. For example:
|
||||
|
||||
minetest.register_alias("mapgen_stone", "default:stone")
|
||||
|
||||
### Aliases needed for all mapgens except Mapgen v6
|
||||
|
||||
Base terrain:
|
||||
|
||||
"mapgen_stone"
|
||||
"mapgen_water_source"
|
||||
"mapgen_river_water_source"
|
||||
|
||||
Caves:
|
||||
|
||||
"mapgen_lava_source"
|
||||
|
||||
Dungeons:
|
||||
|
||||
Only needed for registered biomes where 'node_stone' is stone:
|
||||
"mapgen_cobble"
|
||||
"mapgen_stair_cobble"
|
||||
"mapgen_mossycobble"
|
||||
Only needed for registered biomes where 'node_stone' is desert stone:
|
||||
"mapgen_desert_stone"
|
||||
"mapgen_stair_desert_stone"
|
||||
Only needed for registered biomes where 'node_stone' is sandstone:
|
||||
"mapgen_sandstone"
|
||||
"mapgen_sandstonebrick"
|
||||
"mapgen_stair_sandstone_block"
|
||||
|
||||
### Aliases needed for Mapgen v6
|
||||
|
||||
Terrain and biomes:
|
||||
|
||||
"mapgen_stone"
|
||||
"mapgen_water_source"
|
||||
"mapgen_lava_source"
|
||||
"mapgen_dirt"
|
||||
"mapgen_dirt_with_grass"
|
||||
"mapgen_sand"
|
||||
"mapgen_gravel"
|
||||
"mapgen_desert_stone"
|
||||
"mapgen_desert_sand"
|
||||
"mapgen_dirt_with_snow"
|
||||
"mapgen_snowblock"
|
||||
"mapgen_snow"
|
||||
"mapgen_ice"
|
||||
|
||||
Flora:
|
||||
|
||||
"mapgen_tree"
|
||||
"mapgen_leaves"
|
||||
"mapgen_apple"
|
||||
"mapgen_jungletree"
|
||||
"mapgen_jungleleaves"
|
||||
"mapgen_junglegrass"
|
||||
"mapgen_pine_tree"
|
||||
"mapgen_pine_needles"
|
||||
|
||||
Dungeons:
|
||||
|
||||
"mapgen_cobble"
|
||||
"mapgen_stair_cobble"
|
||||
"mapgen_mossycobble"
|
||||
"mapgen_stair_desert_stone"
|
||||
|
||||
Textures
|
||||
--------
|
||||
Mods should generally prefix their textures with `modname_`, e.g. given
|
||||
@ -531,9 +600,26 @@ for conversion.
|
||||
If the `ItemStack`'s metadata contains the `color` field, it will be
|
||||
lost on placement, because nodes on the map can only use palettes.
|
||||
|
||||
If the `ItemStack`'s metadata contains the `palette_index` field, you
|
||||
currently must manually convert between it and the node's `param2` with
|
||||
custom `on_place` and `on_dig` callbacks.
|
||||
If the `ItemStack`'s metadata contains the `palette_index` field, it is
|
||||
automatically transferred between node and item forms by the engine,
|
||||
when a player digs or places a colored node.
|
||||
You can disable this feature by setting the `drop` field of the node
|
||||
to itself (without metadata).
|
||||
To transfer the color to a special drop, you need a drop table.
|
||||
Example:
|
||||
|
||||
minetest.register_node("mod:stone", {
|
||||
description = "Stone",
|
||||
tiles = {"default_stone.png"},
|
||||
paramtype2 = "color",
|
||||
palette = "palette.png",
|
||||
drop = {
|
||||
items = {
|
||||
-- assume that mod:cobblestone also has the same palette
|
||||
{items = {"mod:cobblestone"}, inherit_color = true },
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
### Colored items in craft recipes
|
||||
Craft recipes only support item strings, but fortunately item strings
|
||||
@ -792,6 +878,11 @@ node definition:
|
||||
0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y-
|
||||
facedir modulo 4 = rotation around that axis
|
||||
paramtype2 == "leveled"
|
||||
^ Only valid for "nodebox" with type = "leveled".
|
||||
The level of the top face of the nodebox is stored in param2.
|
||||
The other faces are defined by 'fixed = {}' like 'type = "fixed"' nodeboxes.
|
||||
The nodebox height is param2 / 64 nodes.
|
||||
The maximum accepted value of param2 is 127.
|
||||
paramtype2 == "degrotate"
|
||||
^ The rotation of this node is stored in param2. Plants are rotated this way.
|
||||
Values range 0 - 179. The value stored in param2 is multiplied by two to
|
||||
@ -2060,15 +2151,15 @@ The following functions provide escape sequences:
|
||||
`minetest.get_color_escape_sequence(color) ..
|
||||
message ..
|
||||
minetest.get_color_escape_sequence("#ffffff")`
|
||||
* `color.get_background_escape_sequence(color)`
|
||||
* `minetest.get_background_escape_sequence(color)`
|
||||
* `color` is a ColorString
|
||||
* The escape sequence sets the background of the whole text element to
|
||||
`color`. Only defined for item descriptions and tooltips.
|
||||
* `color.strip_foreground_colors(str)`
|
||||
* `minetest.strip_foreground_colors(str)`
|
||||
* Removes foreground colors added by `get_color_escape_sequence`.
|
||||
* `color.strip_background_colors(str)`
|
||||
* `minetest.strip_background_colors(str)`
|
||||
* Removes background colors added by `get_background_escape_sequence`.
|
||||
* `color.strip_colors(str)`
|
||||
* `minetest.strip_colors(str)`
|
||||
* Removes all color escape sequences.
|
||||
|
||||
Spatial Vectors
|
||||
@ -2111,9 +2202,11 @@ Helper functions
|
||||
* e.g. `string:split("a,b", ",") == {"a","b"}`
|
||||
* `string:trim()`
|
||||
* e.g. `string.trim("\n \t\tfoo bar\t ") == "foo bar"`
|
||||
* `minetest.wrap_text(str, limit)`: returns a string
|
||||
* Adds new lines to the string to keep it within the specified character limit
|
||||
* `minetest.wrap_text(str, limit, [as_table])`: returns a string or table
|
||||
* Adds newlines to the string to keep it within the specified character limit
|
||||
Note that returned lines may be longer than the limit since it only splits at word borders.
|
||||
* limit: Maximal amount of characters in one line
|
||||
* as_table: optional, if true return table of lines instead of string
|
||||
* `minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))`: returns string `"(X,Y,Z)"`
|
||||
* Convert position to a printable string
|
||||
Optional: 'decimal_places' will round the x, y and z of the pos to the given decimal place.
|
||||
@ -2181,15 +2274,16 @@ Helper functions
|
||||
max_jitter = 0.5, -- maximum packet time jitter
|
||||
avg_jitter = 0.03, -- average packet time jitter
|
||||
connection_uptime = 200, -- seconds since client connected
|
||||
prot_vers = 31, -- protocol version used by client
|
||||
-- following information is available on debug build only!!!
|
||||
-- DO NOT USE IN MODS
|
||||
--ser_vers = 26, -- serialization version used by client
|
||||
--major = 0, -- major version number
|
||||
--minor = 4, -- minor version number
|
||||
--patch = 10, -- patch version number
|
||||
--vers_string = "0.4.9-git", -- full version string
|
||||
--state = "Active" -- current client state
|
||||
protocol_version = 32, -- protocol version used by client
|
||||
-- next info is only available in VenenuX minetest versions minenux
|
||||
ser_vers = 26, -- serialization version used by client
|
||||
major = 0, -- major version number
|
||||
minor = 4, -- minor version number
|
||||
patch = 10, -- patch version number
|
||||
version_string = "0.4.9", -- full version string
|
||||
platform = "Linux", -- as PLATFORM variable
|
||||
sysinfo = "Linux/2.6.32 x86",
|
||||
state = "Active" -- current client state
|
||||
}
|
||||
* `minetest.mkdir(path)`: returns success.
|
||||
* Creates a directory specified by `path`, creating parent directories
|
||||
@ -2199,6 +2293,10 @@ Helper functions
|
||||
* nil: return all entries,
|
||||
* true: return only subdirectory names, or
|
||||
* false: return only file names.
|
||||
* `minetest.safe_file_write(path, content)`: returns boolean indicating success
|
||||
* Replaces contents of file at path with new contents in a safe (atomic) way.
|
||||
Use this instead of below code when writing e.g. database files:
|
||||
`local f = io.open(path, "wb"); f:write(content); f:close()`
|
||||
* `minetest.get_version()`: returns a table containing components of the
|
||||
engine version. Components:
|
||||
* `project`: Name of the project, eg, "Minetest"
|
||||
@ -2210,6 +2308,9 @@ Helper functions
|
||||
version entirely. To check for the presence of engine features, test
|
||||
whether the functions exported by the wanted features exist. For example:
|
||||
`if minetest.nodeupdate then ... end`.
|
||||
* `minetest.sha1(data, [raw])`: returns the sha1 hash of data
|
||||
* `data`: string of data to hash
|
||||
* `raw`: return raw bytes instead of hex digits, default: false
|
||||
|
||||
### Logging
|
||||
* `minetest.debug(...)`
|
||||
@ -2229,6 +2330,8 @@ Call these functions only at load time!
|
||||
* `minetest.register_craftitem(name, item definition)`
|
||||
* `minetest.unregister_item(name)`
|
||||
* `minetest.register_alias(name, convert_to)`
|
||||
* Also use this to set the 'mapgen aliases' needed in a game for the core
|
||||
* mapgens. See 'Mapgen aliases' section above.
|
||||
* `minetest.register_alias_force(name, convert_to)`
|
||||
* `minetest.register_craft(recipe)`
|
||||
* Check recipe table syntax for different types below.
|
||||
@ -2263,6 +2366,7 @@ Call these functions only at load time!
|
||||
* `minetest.register_on_placenode(func(pos, newnode, placer, oldnode, itemstack, pointed_thing))`
|
||||
* Called when a node has been placed
|
||||
* If return `true` no item is taken from `itemstack`
|
||||
* `placer` may be any valid ObjectRef or nil.
|
||||
* **Not recommended**; use `on_construct` or `after_place_node` in node definition
|
||||
whenever possible
|
||||
* `minetest.register_on_dignode(func(pos, oldnode, digger))`
|
||||
@ -2356,8 +2460,9 @@ Call these functions only at load time!
|
||||
* `definition`: `{ description = "description text", give_to_singleplayer = boolean}`
|
||||
the default of `give_to_singleplayer` is true
|
||||
* To allow players with `basic_privs` to grant, see `basic_privs` minetest.conf setting.
|
||||
* `minetest.register_authentication_handler(handler)`
|
||||
* See `minetest.builtin_auth_handler` in `builtin.lua` for reference
|
||||
* `minetest.register_authentication_handler(authentication handler definition)`
|
||||
* Registers an auth handler that overrides the builtin one
|
||||
* This function can be called by a single mod once only.
|
||||
|
||||
### Setting-related
|
||||
* `minetest.settings`: Settings object containing all of the settings from the
|
||||
@ -2366,37 +2471,44 @@ Call these functions only at load time!
|
||||
parses it as a position (in the format `(1,2,3)`). Returns a position or nil.
|
||||
|
||||
### Authentication
|
||||
* `minetest.notify_authentication_modified(name)`
|
||||
* Should be called by the authentication handler if privileges changes.
|
||||
* To report everybody, set `name=nil`.
|
||||
* `minetest.check_password_entry(name, entry, password)`
|
||||
* Returns true if the "db entry" for a player with name matches given
|
||||
* password, false otherwise.
|
||||
* The "db entry" is the usually player-individual value that is derived
|
||||
* from the player's chosen password and stored on the server in order to allow
|
||||
* authentication whenever the player desires to log in.
|
||||
* Only use this function for making it possible to log in via the password from
|
||||
* via protocols like IRC, other uses for inside the game are frowned upon.
|
||||
* `minetest.get_password_hash(name, raw_password)`
|
||||
* Convert a name-password pair to a password hash that Minetest can use.
|
||||
* The returned value alone is not a good basis for password checks based
|
||||
* on comparing the password hash in the database with the password hash
|
||||
* from the function, with an externally provided password, as the hash
|
||||
* in the db might use the new SRP verifier format.
|
||||
* For this purpose, use `minetest.check_password_entry` instead.
|
||||
* `minetest.string_to_privs(str)`: returns `{priv1=true,...}`
|
||||
* `minetest.privs_to_string(privs)`: returns `"priv1,priv2,..."`
|
||||
* Convert between two privilege representations
|
||||
* `minetest.set_player_password(name, password_hash)`
|
||||
* `minetest.set_player_privs(name, {priv1=true,...})`
|
||||
* `minetest.get_player_privs(name) -> {priv1=true,...}`
|
||||
* `minetest.auth_reload()`
|
||||
* `minetest.check_player_privs(player_or_name, ...)`: returns `bool, missing_privs`
|
||||
* A quickhand for checking privileges.
|
||||
* `player_or_name`: Either a Player object or the name of a player.
|
||||
* `...` is either a list of strings, e.g. `"priva", "privb"` or
|
||||
a table, e.g. `{ priva = true, privb = true }`.
|
||||
* `minetest.get_player_ip(name)`: returns an IP address string
|
||||
* `player_or_name`: Either a Player object or the name of a player.
|
||||
* `...` is either a list of strings, e.g. `"priva", "privb"` or
|
||||
a table, e.g. `{ priva = true, privb = true }`.
|
||||
|
||||
* `minetest.check_password_entry(name, entry, password)`
|
||||
* Returns true if the "password entry" for a player with name matches given
|
||||
password, false otherwise.
|
||||
* The "password entry" is the password representation generated by the engine
|
||||
as returned as part of a `get_auth()` call on the auth handler.
|
||||
* Only use this function for making it possible to log in via password from
|
||||
external protocols such as IRC, other uses are frowned upon.
|
||||
* `minetest.get_password_hash(name, raw_password)`
|
||||
* Convert a name-password pair to a password hash that Minetest can use.
|
||||
* The returned value alone is not a good basis for password checks based
|
||||
on comparing the password hash in the database with the password hash
|
||||
from the function, with an externally provided password, as the hash
|
||||
in the db might use the new SRP verifier format.
|
||||
* For this purpose, use `minetest.check_password_entry` instead.
|
||||
* `minetest.get_player_ip(name)`: returns an IP address string for the player `name`
|
||||
* The player needs to be online for this to be successful.
|
||||
|
||||
* `minetest.get_auth_handler()`: Return the currently active auth handler
|
||||
* See the `Authentication handler definition`
|
||||
* Use this to e.g. get the authentication data for a player:
|
||||
`local auth_data = minetest.get_auth_handler().get_auth(playername)`
|
||||
* `minetest.notify_authentication_modified(name)`
|
||||
* Must be called by the authentication handler for privilege changes.
|
||||
* `name`: string; if omitted, all auth data should be considered modified
|
||||
* `minetest.set_player_password(name, password_hash)`: Set password hash of player `name`
|
||||
* `minetest.set_player_privs(name, {priv1=true,...})`: Set privileges of player `name`
|
||||
* `minetest.auth_reload()`
|
||||
* See `reload()` in authentication handler definition
|
||||
|
||||
`minetest.set_player_password`, `minetest_set_player_privs`, `minetest_get_player_privs`
|
||||
and `minetest.auth_reload` call the authetification handler.
|
||||
@ -2462,12 +2574,15 @@ and `minetest.auth_reload` call the authetification handler.
|
||||
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
|
||||
* `search_center` is an optional boolean (default: `false`)
|
||||
If true `pos` is also checked for the nodes
|
||||
* `minetest.find_nodes_in_area(minp, maxp, nodenames)`: returns a list of positions
|
||||
* returns as second value a table with the count of the individual nodes found
|
||||
* `minetest.find_nodes_in_area(pos1, pos2, nodenames)`: returns a list of positions
|
||||
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
|
||||
* `minetest.find_nodes_in_area_under_air(minp, maxp, nodenames)`: returns a list of positions
|
||||
* returned positions are nodes with a node air above
|
||||
* First return value: Table with all node positions
|
||||
* Second return value: Table with the count of each node with the node name as index
|
||||
* Area volume is limited to 4,096,000 nodes
|
||||
* `minetest.find_nodes_in_area_under_air(pos1, pos2, nodenames)`: returns a list of positions
|
||||
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
|
||||
* Return value: Table with all node positions with a node air above
|
||||
* Area volume is limited to 4,096,000 nodes
|
||||
* `minetest.get_perlin(noiseparams)`
|
||||
* `minetest.get_perlin(seeddiff, octaves, persistence, scale)`
|
||||
* Return world-specific perlin noise (`int(worldseed)+seeddiff`)
|
||||
@ -2676,6 +2791,13 @@ and `minetest.auth_reload` call the authetification handler.
|
||||
* Convert a vector into a yaw (angle)
|
||||
* `minetest.yaw_to_dir(yaw)`
|
||||
* Convert yaw (angle) to a vector
|
||||
* `minetest.is_colored_paramtype(ptype)`
|
||||
* Returns a boolean. Returns `true` if the given `paramtype2` contains color
|
||||
information (`color`, `colorwallmounted` or `colorfacedir`).
|
||||
* `minetest.strip_param2_color(param2, paramtype2)`
|
||||
* Removes everything but the color information from the
|
||||
given `param2` value.
|
||||
* Returns `nil` if the given `paramtype2` does not contain color information
|
||||
* `minetest.get_node_drops(nodename, toolname)`
|
||||
* Returns list of item names.
|
||||
* **Note**: This will be removed or modified in a future version.
|
||||
@ -2711,9 +2833,9 @@ and `minetest.auth_reload` call the authetification handler.
|
||||
* Example query for `"default:gold_ingot"` will return table:
|
||||
|
||||
{
|
||||
[1]={type = "cooking", width = 3, output = "default:gold_ingot",
|
||||
[1]={method = "cooking", width = 3, output = "default:gold_ingot",
|
||||
items = {1 = "default:gold_lump"}},
|
||||
[2]={type = "normal", width = 1, output = "default:gold_ingot 9",
|
||||
[2]={method = "normal", width = 1, output = "default:gold_ingot 9",
|
||||
items = {1 = "default:goldblock"}}
|
||||
}
|
||||
* `minetest.handle_node_drops(pos, drops, digger)`
|
||||
@ -2735,9 +2857,11 @@ and `minetest.auth_reload` call the authetification handler.
|
||||
### Defaults for the `on_*` item definition functions
|
||||
These functions return the leftover itemstack.
|
||||
|
||||
* `minetest.item_place_node(itemstack, placer, pointed_thing, param2)`
|
||||
* `minetest.item_place_node(itemstack, placer, pointed_thing[, param2, prevent_after_place])`
|
||||
* Place item as a node
|
||||
* `param2` overrides `facedir` and wallmounted `param2`
|
||||
* `prevent_after_place`: if set to `true`, `after_place_node` is not called
|
||||
for the newly placed node to prevent a callback and placement loop
|
||||
* returns `itemstack, success`
|
||||
* `minetest.item_place_object(itemstack, placer, pointed_thing)`
|
||||
* Place item as-is
|
||||
@ -2893,6 +3017,7 @@ These functions return the leftover itemstack.
|
||||
|
||||
### Misc.
|
||||
* `minetest.get_connected_players()`: returns list of `ObjectRefs`
|
||||
* `minetest.is_player(o)`: boolean, whether `o` is a player
|
||||
* `minetest.player_exists(name)`: boolean, whether player exists (regardless of online status)
|
||||
* `minetest.hud_replace_builtin(name, hud_definition)`
|
||||
* Replaces definition of a builtin hud element
|
||||
@ -2960,6 +3085,7 @@ These functions return the leftover itemstack.
|
||||
* Returns true, if player `name` shouldn't be abled to dig at `pos` or do other
|
||||
actions, defineable by mods, due to some mod-defined ownership-like concept.
|
||||
Returns false or nil, if the player is allowed to do such actions.
|
||||
* `name` will be "" for non-players or unknown players.
|
||||
* This function should be overridden by protection mods and should be used to
|
||||
check if a player can interact at a position.
|
||||
* This function should call the old version of itself if the position is not
|
||||
@ -2976,25 +3102,29 @@ These functions return the leftover itemstack.
|
||||
* `minetest.record_protection_violation(pos, name)`
|
||||
* This function calls functions registered with
|
||||
`minetest.register_on_protection_violation`.
|
||||
* `minetest.rotate_and_place(itemstack, placer, pointed_thing, infinitestacks, orient_flags)`
|
||||
* `minetest.rotate_and_place(itemstack, placer, pointed_thing[, infinitestacks,
|
||||
orient_flags, prevent_after_place])`
|
||||
* Attempt to predict the desired orientation of the facedir-capable node
|
||||
defined by `itemstack`, and place it accordingly (on-wall, on the floor, or
|
||||
hanging from the ceiling). Stacks are handled normally if the `infinitestacks`
|
||||
field is false or omitted (else, the itemstack is not changed). `orient_flags`
|
||||
is an optional table containing extra tweaks to the placement code:
|
||||
* `invert_wall`: if `true`, place wall-orientation on the ground and ground-
|
||||
orientation on the wall.
|
||||
defined by `itemstack`, and place it accordingly (on-wall, on the floor,
|
||||
or hanging from the ceiling).
|
||||
* `infinitestacks`: if `true`, the itemstack is not changed. Otherwise the
|
||||
stacks are handled normally.
|
||||
* `orient_flags`: Optional table containing extra tweaks to the placement code:
|
||||
* `invert_wall`: if `true`, place wall-orientation on the ground and
|
||||
ground-orientation on the wall.
|
||||
* `force_wall` : if `true`, always place the node in wall orientation.
|
||||
* `force_ceiling`: if `true`, always place on the ceiling.
|
||||
* `force_floor`: if `true`, always place the node on the floor.
|
||||
* `force_facedir`: if `true`, forcefully reset the facedir to north when placing on
|
||||
the floor or ceiling
|
||||
* The first four options are mutually-exclusive; the last in the list takes
|
||||
precedence over the first.
|
||||
* `force_facedir`: if `true`, forcefully reset the facedir to north
|
||||
when placing on the floor or ceiling.
|
||||
* The first four options are mutually-exclusive; the last in the list
|
||||
takes precedence over the first.
|
||||
* `prevent_after_place` is directly passed to `minetest.item_place_node`
|
||||
* Returns the new itemstack after placement
|
||||
* `minetest.rotate_node(itemstack, placer, pointed_thing)`
|
||||
* calls `rotate_and_place()` with infinitestacks set according to the state of
|
||||
the creative mode setting, and checks for "sneak" to set the `invert_wall`
|
||||
parameter.
|
||||
* calls `rotate_and_place()` with `infinitestacks` set according to the state
|
||||
of the creative mode setting, checks for "sneak" to set the `invert_wall`
|
||||
parameter and `prevent_after_place` set to `true`.
|
||||
|
||||
* `minetest.forceload_block(pos[, transient])`
|
||||
* forceloads the position `pos`.
|
||||
@ -3150,7 +3280,7 @@ This is basically a reference to a C++ `ServerActiveObject`
|
||||
* `set_attach(parent, bone, position, rotation)`
|
||||
* `bone`: string
|
||||
* `position`: `{x=num, y=num, z=num}` (relative)
|
||||
* `rotation`: `{x=num, y=num, z=num}`
|
||||
* `rotation`: `{x=num, y=num, z=num}` = Rotation on each axis, in degrees
|
||||
* `get_attach()`: returns parent, bone, position, rotation or nil if it isn't attached
|
||||
* `set_detach()`
|
||||
* `set_bone_position(bone, position, rotation)`
|
||||
@ -3215,10 +3345,11 @@ This is basically a reference to a C++ `ServerActiveObject`
|
||||
* values:
|
||||
* `0`: player is drowning,
|
||||
* `1`-`10`: remaining number of bubbles
|
||||
* `11`: bubbles bar is not shown
|
||||
* max (or 11): bubbles bar is not shown
|
||||
* See Object Properties for more information
|
||||
* `set_attribute(attribute, value)`:
|
||||
* Sets an extra attribute with value on player.
|
||||
* `value` must be a string.
|
||||
* `value` must be a string, or a number which will be converted to a string.
|
||||
* If `value` is `nil`, remove attribute from player.
|
||||
* `get_attribute(attribute)`:
|
||||
* Returns value (a string) for extra attribute.
|
||||
@ -3322,8 +3453,9 @@ An `InvRef` is a reference to an inventory.
|
||||
* `add_item(listname, stack)`: add item somewhere in list, returns leftover `ItemStack`
|
||||
* `room_for_item(listname, stack):` returns `true` if the stack of items
|
||||
can be fully added to the list
|
||||
* `contains_item(listname, stack)`: returns `true` if the stack of items
|
||||
can be fully taken from the list
|
||||
* `contains_item(listname, stack, [match_meta])`: returns `true` if
|
||||
the stack of items can be fully taken from the list.
|
||||
If `match_meta` is false, only the items' names are compared (default: `false`).
|
||||
* `remove_item(listname, stack)`: take as many items as specified from the list,
|
||||
returns the items that were actually removed (as an `ItemStack`) -- note that
|
||||
any item metadata is ignored, so attempting to remove a specific unique
|
||||
@ -3892,6 +4024,9 @@ Definition tables
|
||||
|
||||
{
|
||||
hp_max = 1,
|
||||
-- ^ For players: Defaults to `minetest.PLAYER_MAX_HP_DEFAULT`
|
||||
breath_max = 0,
|
||||
-- ^ For players only. Defaults to `minetest.PLAYER_MAX_BREATH_DEFAULT`
|
||||
physical = true,
|
||||
collide_with_objects = true, -- collide with other objects if physical = true
|
||||
weight = 5,
|
||||
@ -4212,6 +4347,7 @@ Definition tables
|
||||
{
|
||||
items = {"foo:bar", "baz:frob"}, -- Items to drop.
|
||||
rarity = 1, -- Probability of dropping is 1 / rarity.
|
||||
inherit_color = true, -- To inherit palette color from the node
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -4242,6 +4378,7 @@ Definition tables
|
||||
^ Called after constructing node when node was placed using
|
||||
minetest.item_place_node / minetest.place_node
|
||||
^ If return true no item is taken from itemstack
|
||||
^ `placer` may be any valid ObjectRef or nil
|
||||
^ default: nil ]]
|
||||
after_dig_node = func(pos, oldnode, oldmetadata, digger), --[[
|
||||
^ oldmetadata is in table format
|
||||
@ -4257,9 +4394,11 @@ Definition tables
|
||||
^ By default: Calls minetest.register_on_punchnode callbacks ]]
|
||||
on_rightclick = func(pos, node, clicker, itemstack, pointed_thing), --[[
|
||||
^ default: nil
|
||||
^ if defined, itemstack will hold clicker's wielded item
|
||||
^ itemstack will hold clicker's wielded item
|
||||
^ Shall return the leftover itemstack
|
||||
^ Note: pointed_thing can be nil, if a mod calls this function ]]
|
||||
^ Note: pointed_thing can be nil, if a mod calls this function
|
||||
This function does not get triggered by clients <=0.4.16 if the
|
||||
"formspec" node metadata field is set ]]
|
||||
|
||||
on_dig = func(pos, node, digger), --[[
|
||||
^ default: minetest.node_dig
|
||||
@ -4674,3 +4813,26 @@ The Biome API is still in an experimental phase and subject to change.
|
||||
-- ^ HTTP status code
|
||||
data = "response"
|
||||
}
|
||||
|
||||
### Authentication handler definition
|
||||
|
||||
{
|
||||
get_auth = func(name),
|
||||
-- ^ Get authentication data for existing player `name` (`nil` if player doesn't exist)
|
||||
-- ^ returns following structure `{password=<string>, privileges=<table>, last_login=<number or nil>}`
|
||||
create_auth = func(name, password),
|
||||
-- ^ Create new auth data for player `name`
|
||||
-- ^ Note that `password` is not plain-text but an arbitrary representation decided by the engine
|
||||
set_password = func(name, password),
|
||||
-- ^ Set password of player `name` to `password`
|
||||
Auth data should be created if not present
|
||||
set_privileges = func(name, privileges),
|
||||
-- ^ Set privileges of player `name`
|
||||
-- ^ `privileges` is in table form, auth data should be created if not present
|
||||
reload = func(),
|
||||
-- ^ Reload authentication data from the storage location
|
||||
-- ^ Returns boolean indicating success
|
||||
record_login = func(name),
|
||||
-- ^ Called when player joins, used for keeping track of last_login
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Minetest Lua Mainmenu API Reference 0.4.16
|
||||
Minetest Lua Mainmenu API Reference 0.4.17
|
||||
========================================
|
||||
|
||||
Introduction
|
||||
|
@ -1,21 +1,21 @@
|
||||
.TH minetest 6 "10 September 2013" "" ""
|
||||
.TH minetest4 6 "10 September 2013" "" ""
|
||||
|
||||
.SH NAME
|
||||
minetest, minetestserver \- Multiplayer infinite-world block sandbox
|
||||
minetest4, minetest4server \- Multiplayer infinite-world block sandbox v 4.X series
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B minetest
|
||||
.B minetest4
|
||||
[\fB--server SERVER OPTIONS\fR | \fBCLIENT OPTIONS\fR]
|
||||
[\fBCOMMON OPTIONS\fR]
|
||||
[\fBWORLD PATH\fR]
|
||||
|
||||
.B minetestserver
|
||||
.B minetest4server
|
||||
[\fBSERVER OPTIONS\fR]
|
||||
[\fBCOMMON OPTIONS\fR]
|
||||
[\fBWORLD PATH\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B Minetest
|
||||
.B Minetest 4.X
|
||||
is one of the first InfiniMiner/Minecraft(/whatever) inspired games (started October 2010), with a goal of taking the survival multiplayer gameplay to a slightly different direction.
|
||||
.PP
|
||||
The main design philosophy is to keep it technically simple, stable and portable. It will be kept lightweight enough to run on fairly old hardware.
|
||||
@ -99,7 +99,7 @@ Display an interactive terminal over ncurses during execution.
|
||||
Colon delimited list of directories to search for subgames.
|
||||
|
||||
.SH BUGS
|
||||
Please report all bugs to Perttu Ahola <celeron55@gmail.com>.
|
||||
Please report all bugs to https://codeberg.org/minenux/minenux/issues/
|
||||
|
||||
.SH AUTHOR
|
||||
.PP
|
||||
@ -110,5 +110,5 @@ This man page was originally written by
|
||||
Juhani Numminen <juhaninumminen0@gmail.com>.
|
||||
|
||||
.SH WWW
|
||||
http://www.minetest.net/
|
||||
http://www.minetest.org/
|
||||
|
||||
|
1
games/minetest
Submodule
1
games/minetest
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit d5cc8c46f66420eb14f23c83a3b57eff731ceb89
|
@ -1270,7 +1270,9 @@ minetest.register_node("default:chest_locked", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
local pname =
|
||||
placer and placer:get_player_name() or ""
|
||||
meta:set_string("owner", pname)
|
||||
meta:set_string("infotext", "Locked Chest (owned by "..
|
||||
meta:get_string("owner")..")")
|
||||
end,
|
||||
|
@ -63,15 +63,43 @@ endif(LUA_ANSI)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_CFLAGS}")
|
||||
|
||||
|
||||
# Standard flags to use for each build type.
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -Wall -Wextra -Wshadow -W -pedantic -std=gnu99")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g")
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -O1 -g")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2 -g")
|
||||
endif(CMAKE_COMPILER_IS_GNUCC)
|
||||
# determine compiler compatible and set flags, assume if C++ is installed also CC is installed
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -Wall -Wextra -Wshadow -W -pedantic")
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=gnu99")
|
||||
elseif(CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.6)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=gnu1x")
|
||||
else()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=gnu11")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} ")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS} -g")
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${CMAKE_C_FLAGS} -O1 -g")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} ${CMAKE_C_FLAGS} -g")
|
||||
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} ")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS} -g")
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${CMAKE_C_FLAGS} -O1 -g")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} ${CMAKE_C_FLAGS} -g")
|
||||
|
||||
else()
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.0)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
else()
|
||||
if(APPLE)
|
||||
# Fix behavior of CMAKE_CXX_STANDARD when targeting macOS.
|
||||
if (POLICY CMP0025)
|
||||
cmake_policy(SET CMP0025 NEW)
|
||||
endif ()
|
||||
endif ()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(src build)
|
||||
|
||||
|
@ -73,7 +73,7 @@ static void *ll_load (lua_State *L, const char *path) {
|
||||
|
||||
|
||||
static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
|
||||
lua_CFunction f = (lua_CFunction)dlsym(lib, sym);
|
||||
lua_CFunction f = __extension__(lua_CFunction)dlsym(lib, sym);
|
||||
if (f == NULL) lua_pushstring(L, dlerror());
|
||||
return f;
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
# This file contains a list of all available settings and their default value for minetest.conf
|
||||
# This file contains a list of all available settings and their default value for minetest4.conf
|
||||
|
||||
# By default, all the settings are commented and not functional.
|
||||
# Uncomment settings by removing the preceding #.
|
||||
|
||||
# minetest.conf is read by default from:
|
||||
# ../minetest.conf
|
||||
# ../../minetest.conf
|
||||
# minetest4.conf is read by default from:
|
||||
# ../minetest4.conf
|
||||
# ../../minetest4.conf
|
||||
# Any other path can be chosen by passing the path as a parameter
|
||||
# to the program, eg. "minetest.exe --config ../minetest.conf.example".
|
||||
# to the program, eg. "minetest4 --config ../minetest4.conf.example".
|
||||
|
||||
# Further documentation:
|
||||
# http://wiki.minetest.net/
|
||||
# http://wiki.minetest.org/
|
||||
|
||||
#
|
||||
# Client
|
||||
@ -28,7 +28,11 @@
|
||||
# type: bool
|
||||
# free_move = false
|
||||
|
||||
# Fast movement (via use key).
|
||||
# If enabled together with fly mode, makes move directions relative to the player's pitch.
|
||||
# type: bool
|
||||
# pitch_fly = false
|
||||
|
||||
# Fast movement (via the "special" key).
|
||||
# This requires the "fast" privilege on the server.
|
||||
# type: bool
|
||||
# fast_move = false
|
||||
@ -161,11 +165,6 @@
|
||||
# type: key
|
||||
# keymap_cmd_local = .
|
||||
|
||||
# Key for opening the chat console.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
# type: key
|
||||
# keyman_console = KEY_F10
|
||||
|
||||
# Key for toggling unlimited view range.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
# type: key
|
||||
@ -176,6 +175,11 @@
|
||||
# type: key
|
||||
# keymap_freemove = KEY_KEY_K
|
||||
|
||||
# Key for toggling pitch fly mode.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
# type: key
|
||||
# keymap_pitchfly = KEY_KEY_L
|
||||
|
||||
# Key for toggling fast mode.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
# type: key
|
||||
@ -344,8 +348,8 @@
|
||||
# serverlist_file = favoriteservers.txt
|
||||
|
||||
# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited
|
||||
# type: int min: -1
|
||||
max_out_chat_queue_size = 20
|
||||
# type: int
|
||||
# max_out_chat_queue_size = 20
|
||||
|
||||
## Graphics
|
||||
|
||||
@ -555,7 +559,7 @@ max_out_chat_queue_size = 20
|
||||
# type: int
|
||||
# screenH = 600
|
||||
|
||||
# Save the window size automatically when modified.
|
||||
# Save window size automatically when modified.
|
||||
# type: bool
|
||||
# autosave_screensize = true
|
||||
|
||||
@ -852,11 +856,11 @@ max_out_chat_queue_size = 20
|
||||
|
||||
# Domain name of server, to be displayed in the serverlist.
|
||||
# type: string
|
||||
# server_address = game.minetest.net
|
||||
# server_address = game.minetest.org
|
||||
|
||||
# Homepage of server, to be displayed in the serverlist.
|
||||
# type: string
|
||||
# server_url = http://minetest.net
|
||||
# server_url = http://minetest.org
|
||||
|
||||
# Automaticaly report to the serverlist.
|
||||
# type: bool
|
||||
@ -867,11 +871,10 @@ max_out_chat_queue_size = 20
|
||||
# type: string
|
||||
# serverlist_url = servers.minetest.net
|
||||
|
||||
# Disable escape sequences, e.g. chat coloring.
|
||||
# Use this if you want to run a server with pre-0.4.14 clients and you want to disable
|
||||
# the escape sequences generated by mods.
|
||||
# Remove color codes from incoming chat messages
|
||||
# Use this to stop players from being able to use color in their messages
|
||||
# type: bool
|
||||
# disable_escape_sequences = false
|
||||
# strip_color_codes = false
|
||||
|
||||
## Network
|
||||
|
||||
@ -1830,14 +1833,15 @@ max_out_chat_queue_size = 20
|
||||
# main_menu_mod_mgr = 1
|
||||
|
||||
# type: string
|
||||
# modstore_download_url = https://forum.minetest.net/media/
|
||||
# modstore_download_url = https://forum.minetest.org/media/
|
||||
|
||||
# type: string
|
||||
# modstore_listmods_url = https://forum.minetest.net/mmdb/mods/
|
||||
# modstore_listmods_url = https://forum.minetest.org/mmdb/mods/
|
||||
|
||||
# type: string
|
||||
# modstore_details_url = https://forum.minetest.net/mmdb/mod/*/
|
||||
# modstore_details_url = https://forum.minetest.org/mmdb/mod/*/
|
||||
|
||||
# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers.
|
||||
# type: int
|
||||
# profiler_print_interval = 0
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
# This file contains information (some of which was previously stored in
|
||||
# minetest.conf.example) that cannot be automatically generated from
|
||||
# minetest4.conf.example) that cannot be automatically generated from
|
||||
# builtin/settingtypes.txt.
|
||||
# This file contains a list of settings and their default value for minetest.conf
|
||||
# This file contains a list of settings and their default value for minetest4.conf
|
||||
|
||||
# By default, all the settings are commented and not functional.
|
||||
# Uncomment settings by removing the preceding #.
|
||||
|
||||
# minetest.conf is read by default from:
|
||||
# ../minetest.conf
|
||||
# ../../minetest.conf
|
||||
# minetest4.conf is read by default from:
|
||||
# ../minetest4.conf
|
||||
# ../../minetest4.conf
|
||||
# Any other path can be chosen by passing the path as a parameter
|
||||
# to the program, eg. "minetest.exe --config ../minetest.conf.example".
|
||||
# to the program, eg. "minetest4 --config ../minetest4.conf.example".
|
||||
|
||||
# Further documentation:
|
||||
# http://wiki.minetest.net/
|
||||
@ -46,7 +46,7 @@
|
||||
# Mapgen v5
|
||||
|
||||
# Noise parameter in group format, unsupported by advanced settings menu but
|
||||
# settable in minetest.conf.
|
||||
# settable in minetest4.conf.
|
||||
# See documentation of noise parameter formats above.
|
||||
#
|
||||
# 3D noise defining terrain.
|
||||
|
@ -5,10 +5,10 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>minetest</string>
|
||||
<string>minetest4</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>minetest-icon.icns</string>
|
||||
<string>minetest4-icon.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.minetest.minetest</string>
|
||||
<string>net.minetest.minetest4</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -1,22 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>net.minetest.minetest.desktop</id>
|
||||
<id>net.minetest.minetest4.desktop</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>LGPL-2.1+ and CC-BY-SA-3.0 and MIT and Apache-2.0</project_license>
|
||||
<name>Minetest</name>
|
||||
<name>minetest4</name>
|
||||
<summary>Multiplayer infinite-world block sandbox game</summary>
|
||||
<description>
|
||||
<p>
|
||||
Minetest is an infinite-world block sandbox game and game engine.
|
||||
minetest4 is an infinite-world block sandbox game and game engine.
|
||||
</p><p>
|
||||
Players can create and destroy various types of blocks in a
|
||||
three-dimensional open world. This allows forming structures in
|
||||
every possible creation, on multiplayer servers or in singleplayer.
|
||||
</p><p>
|
||||
Minetest is designed to be simple, stable, and portable.
|
||||
minetest4 is designed to be simple, stable, and portable.
|
||||
It is lightweight enough to run on fairly old hardware.
|
||||
</p><p>
|
||||
Minetest has many features, including:
|
||||
minetest4 has many features, including:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Ability to walk around, dig, and build in a near-infinite voxel world</li>
|
||||
@ -27,32 +27,18 @@
|
||||
<li>Beautiful lightning-fast map generator</li>
|
||||
</ul>
|
||||
</description>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image width="1920" height="1080">http://www.minetest.net/media/gallery/1.jpg</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image width="1920" height="1080">http://www.minetest.net/media/gallery/3.jpg</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image width="1920" height="1080">http://www.minetest.net/media/gallery/5.jpg</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<keywords>
|
||||
<keyword>sandbox</keyword>
|
||||
<keyword>world</keyword>
|
||||
<keyword>mining</keyword>
|
||||
<keyword>multiplayer</keyword>
|
||||
</keywords>
|
||||
<url type="homepage">http://minetest.net</url>
|
||||
<url type="bugtracker">http://www.minetest.net/development/#reporting-issues</url>
|
||||
<url type="homepage">http://minetest.org</url>
|
||||
<url type="bugtracker">https://codeberg.org/minenux/minenux/issues</url>
|
||||
<url type="translate">http://dev.minetest.net/Translation</url>
|
||||
<url type="donation">http://www.minetest.net/development/#donate</url>
|
||||
<url type="faq">http://wiki.minetest.net/FAQ</url>
|
||||
<url type="help">http://wiki.minetest.net</url>
|
||||
<url type="donation">https://paypalme/mckayshirou</url>
|
||||
<url type="help">http://wiki.minetest.org</url>
|
||||
<provides>
|
||||
<binary>minetest</binary>
|
||||
<binary>minetest4</binary>
|
||||
</provides>
|
||||
<translation type="gettext">minetest</translation>
|
||||
<update_contact>sfan5@live.de</update_contact>
|
||||
</component>
|
||||
|
@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Name=Minetest
|
||||
GenericName=Minetest
|
||||
Name=Minetest4
|
||||
GenericName=minetest4
|
||||
Comment=Multiplayer infinite-world block sandbox
|
||||
Comment[de]=Mehrspieler-Sandkastenspiel mit unendlichen Blockwelten
|
||||
Comment[es]=Juego sandbox multijugador con mundos infinitos
|
||||
@ -8,8 +8,8 @@ Comment[fr]=Jeu multijoueurs de type bac à sable avec des mondes infinis
|
||||
Comment[ja]=マルチプレイに対応した、無限の世界のブロック型サンドボックスゲームです
|
||||
Comment[ru]=Игра-песочница с безграничным миром, состоящим из блоков
|
||||
Comment[tr]=Tek-Çok oyuncuyla küplerden sonsuz dünyalar inşa et
|
||||
Exec=minetest
|
||||
Icon=minetest
|
||||
Exec=minetest4
|
||||
Icon=minetest4
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Game;Simulation;
|
||||
|
@ -23,7 +23,6 @@ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
|
||||
FORCE
|
||||
)
|
||||
|
||||
|
||||
# Set some random things default to not being visible in the GUI
|
||||
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
|
||||
|
||||
@ -70,6 +69,14 @@ if(ENABLE_GETTEXT)
|
||||
endif()
|
||||
set(USE_GETTEXT TRUE)
|
||||
message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}")
|
||||
# On some platforms, such as Linux with GNU libc, the gettext
|
||||
# functions are present in the C standard library and libintl
|
||||
# is not required. For other libc (uClibc-ng or musl) libintl
|
||||
# may be required.
|
||||
find_package(Intl)
|
||||
if(NOT Intl_LIBRARIES STREQUAL "")
|
||||
message(STATUS "GetText Intl : ${Intl_LIBRARIES}")
|
||||
endif()
|
||||
endif(GETTEXT_FOUND)
|
||||
else()
|
||||
mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
|
||||
@ -174,27 +181,25 @@ option(ENABLE_POSTGRESQL "Enable PostgreSQL backend" TRUE)
|
||||
set(USE_POSTGRESQL FALSE)
|
||||
|
||||
if(ENABLE_POSTGRESQL)
|
||||
find_program(POSTGRESQL_CONFIG_EXECUTABLE pg_config DOC "pg_config")
|
||||
find_library(POSTGRESQL_LIBRARY pq)
|
||||
if(POSTGRESQL_CONFIG_EXECUTABLE)
|
||||
execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE} --includedir-server
|
||||
OUTPUT_VARIABLE POSTGRESQL_SERVER_INCLUDE_DIRS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE}
|
||||
OUTPUT_VARIABLE POSTGRESQL_CLIENT_INCLUDE_DIRS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# This variable is case sensitive for the cmake PostgreSQL module
|
||||
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${POSTGRESQL_SERVER_INCLUDE_DIRS} ${POSTGRESQL_CLIENT_INCLUDE_DIRS})
|
||||
if(CMAKE_VERSION VERSION_LESS "3.20")
|
||||
find_package(PostgreSQL QUIET)
|
||||
# Before CMake 3.20 FindPostgreSQL.cmake always looked for server includes
|
||||
# but we don't need them, so continue anyway if only those are missing.
|
||||
if(PostgreSQL_INCLUDE_DIR AND PostgreSQL_LIBRARY)
|
||||
set(PostgreSQL_FOUND TRUE)
|
||||
set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR})
|
||||
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY})
|
||||
endif()
|
||||
else()
|
||||
find_package(PostgreSQL)
|
||||
endif()
|
||||
|
||||
find_package("PostgreSQL")
|
||||
|
||||
if(POSTGRESQL_FOUND)
|
||||
if(PostgreSQL_FOUND)
|
||||
set(USE_POSTGRESQL TRUE)
|
||||
message(STATUS "PostgreSQL backend enabled")
|
||||
# This variable is case sensitive, don't try to change it to POSTGRESQL_INCLUDE_DIR
|
||||
message(STATUS "PostgreSQL includes: ${PostgreSQL_INCLUDE_DIR}")
|
||||
include_directories(${PostgreSQL_INCLUDE_DIR})
|
||||
message(STATUS "PostgreSQL includes: ${PostgreSQL_INCLUDE_DIRS}")
|
||||
include_directories(${PostgreSQL_INCLUDE_DIRS})
|
||||
else()
|
||||
message(STATUS "PostgreSQL not found!")
|
||||
endif()
|
||||
@ -204,7 +209,7 @@ option(ENABLE_LEVELDB "Enable LevelDB backend" TRUE)
|
||||
set(USE_LEVELDB FALSE)
|
||||
|
||||
if(ENABLE_LEVELDB)
|
||||
find_library(LEVELDB_LIBRARY leveldb)
|
||||
find_library(LEVELDB_LIBRARY NAMES leveldb libleveldb)
|
||||
find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
|
||||
if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
|
||||
set(USE_LEVELDB TRUE)
|
||||
@ -254,6 +259,12 @@ if(NOT MSVC)
|
||||
set(USE_GPROF FALSE CACHE BOOL "Use -pg flag for g++")
|
||||
endif()
|
||||
|
||||
# Haiku endian support
|
||||
if(HAIKU)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_BSD_SOURCE")
|
||||
endif()
|
||||
|
||||
# Use cmake_config.h
|
||||
add_definitions(-DUSE_CMAKE_CONFIG_H)
|
||||
|
||||
@ -268,7 +279,7 @@ if(WIN32)
|
||||
else() # Probably MinGW = GCC
|
||||
set(PLATFORM_LIBS "")
|
||||
endif()
|
||||
set(PLATFORM_LIBS ws2_32.lib shlwapi.lib ${PLATFORM_LIBS})
|
||||
set(PLATFORM_LIBS ws2_32.lib version.lib shlwapi.lib ${PLATFORM_LIBS})
|
||||
|
||||
# Zlib stuff
|
||||
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
|
||||
@ -297,7 +308,9 @@ if(WIN32)
|
||||
else()
|
||||
# Unix probably
|
||||
if(BUILD_CLIENT)
|
||||
find_package(X11 REQUIRED)
|
||||
if(NOT HAIKU AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
endif(NOT HAIKU AND NOT APPLE)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
@ -325,10 +338,15 @@ else()
|
||||
endif(HAVE_LIBRT)
|
||||
endif(APPLE)
|
||||
|
||||
# This way Xxf86vm is found on OpenBSD too
|
||||
find_library(XXF86VM_LIBRARY Xxf86vm)
|
||||
mark_as_advanced(XXF86VM_LIBRARY)
|
||||
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
|
||||
# The following dependencies are transitive dependencies from Irrlicht.
|
||||
# Minetest itself does not use them, but we link them so that statically
|
||||
# linking Irrlicht works.
|
||||
if(NOT HAIKU AND NOT APPLE)
|
||||
# This way Xxf86vm is found on OpenBSD too
|
||||
find_library(XXF86VM_LIBRARY Xxf86vm)
|
||||
mark_as_advanced(XXF86VM_LIBRARY)
|
||||
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
|
||||
endif(NOT HAIKU AND NOT APPLE)
|
||||
|
||||
# Prefer local iconv if installed
|
||||
find_library(ICONV_LIBRARY iconv)
|
||||
@ -336,6 +354,10 @@ else()
|
||||
if (ICONV_LIBRARY)
|
||||
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${ICONV_LIBRARY})
|
||||
endif()
|
||||
if (HAIKU)
|
||||
set(PLATFORM_LIBS ${PLATFORM_LIBS} intl network)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
check_include_files(endian.h HAVE_ENDIAN_H)
|
||||
@ -573,10 +595,10 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
|
||||
|
||||
|
||||
if(BUILD_CLIENT)
|
||||
add_executable(${PROJECT_NAME} ${client_SRCS})
|
||||
add_dependencies(${PROJECT_NAME} GenerateVersion)
|
||||
add_executable(${PROJECT_NAME}${VERSION_MAJOR} ${client_SRCS})
|
||||
add_dependencies(${PROJECT_NAME}${VERSION_MAJOR} GenerateVersion)
|
||||
set(client_LIBS
|
||||
${PROJECT_NAME}
|
||||
${PROJECT_NAME}${VERSION_MAJOR}
|
||||
${ZLIB_LIBRARIES}
|
||||
${IRRLICHT_LIBRARY}
|
||||
${OPENGL_LIBRARIES}
|
||||
@ -585,6 +607,7 @@ if(BUILD_CLIENT)
|
||||
${PNG_LIBRARIES}
|
||||
${X11_LIBRARIES}
|
||||
${GETTEXT_LIBRARY}
|
||||
${Intl_LIBRARIES}
|
||||
${SOUND_LIBRARIES}
|
||||
${SQLITE3_LIBRARY}
|
||||
${LUA_LIBRARY}
|
||||
@ -606,76 +629,79 @@ if(BUILD_CLIENT)
|
||||
endif()
|
||||
if(USE_CURL)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
${PROJECT_NAME}${VERSION_MAJOR}
|
||||
${CURL_LIBRARY}
|
||||
)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lidn")
|
||||
endif()
|
||||
if(USE_FREETYPE)
|
||||
if(FREETYPE_PKGCONFIG_FOUND)
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
set_target_properties(${PROJECT_NAME}${VERSION_MAJOR}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}"
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
${PROJECT_NAME}${VERSION_MAJOR}
|
||||
${FREETYPE_LIBRARY}
|
||||
${CGUITTFONT_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
if (USE_CURSES)
|
||||
target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${CURSES_LIBRARIES})
|
||||
endif()
|
||||
if (USE_POSTGRESQL)
|
||||
target_link_libraries(${PROJECT_NAME} ${POSTGRESQL_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${PostgreSQL_LIBRARIES})
|
||||
endif()
|
||||
if (USE_LEVELDB)
|
||||
target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${LEVELDB_LIBRARY})
|
||||
endif()
|
||||
if (USE_REDIS)
|
||||
target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${REDIS_LIBRARY})
|
||||
endif()
|
||||
if (USE_SPATIAL)
|
||||
target_link_libraries(${PROJECT_NAME} ${SPATIAL_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${SPATIAL_LIBRARY})
|
||||
endif()
|
||||
endif(BUILD_CLIENT)
|
||||
|
||||
|
||||
if(BUILD_SERVER)
|
||||
add_executable(${PROJECT_NAME}server ${server_SRCS})
|
||||
add_dependencies(${PROJECT_NAME}server GenerateVersion)
|
||||
add_executable(${PROJECT_NAME}${VERSION_MAJOR}server ${server_SRCS})
|
||||
add_dependencies(${PROJECT_NAME}${VERSION_MAJOR}server GenerateVersion)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}server
|
||||
${PROJECT_NAME}${VERSION_MAJOR}server
|
||||
${ZLIB_LIBRARIES}
|
||||
${SQLITE3_LIBRARY}
|
||||
${JSON_LIBRARY}
|
||||
${GETTEXT_LIBRARY}
|
||||
${Intl_LIBRARIES}
|
||||
${LUA_LIBRARY}
|
||||
${GMP_LIBRARY}
|
||||
${PLATFORM_LIBS}
|
||||
)
|
||||
set_target_properties(${PROJECT_NAME}server PROPERTIES
|
||||
set_target_properties(${PROJECT_NAME}${VERSION_MAJOR}server PROPERTIES
|
||||
COMPILE_DEFINITIONS "SERVER")
|
||||
if (USE_CURSES)
|
||||
target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${CURSES_LIBRARIES})
|
||||
endif()
|
||||
if (USE_POSTGRESQL)
|
||||
target_link_libraries(${PROJECT_NAME}server ${POSTGRESQL_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${POSTGRESQL_LIBRARY})
|
||||
endif()
|
||||
if (USE_LEVELDB)
|
||||
target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${LEVELDB_LIBRARY})
|
||||
endif()
|
||||
if (USE_REDIS)
|
||||
target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${REDIS_LIBRARY})
|
||||
endif()
|
||||
if (USE_SPATIAL)
|
||||
target_link_libraries(${PROJECT_NAME}server ${SPATIAL_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${SPATIAL_LIBRARY})
|
||||
endif()
|
||||
if(USE_CURL)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}server
|
||||
${PROJECT_NAME}${VERSION_MAJOR}server
|
||||
${CURL_LIBRARY}
|
||||
)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lidn")
|
||||
endif()
|
||||
endif(BUILD_SERVER)
|
||||
|
||||
@ -700,17 +726,19 @@ if (GETTEXT_FOUND AND APPLY_LOCALE_BLACKLIST)
|
||||
endif()
|
||||
endforeach()
|
||||
message(STATUS "Locale blacklist applied; Locales used: ${GETTEXT_USED_LOCALES}")
|
||||
elseif (GETTEXT_FOUND)
|
||||
set(GETTEXT_USED_LOCALES ${GETTEXT_AVAILABLE_LOCALES})
|
||||
endif()
|
||||
|
||||
# Set some optimizations and tweaks
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
if(MSVC)
|
||||
# Visual Studio
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
|
||||
# EHa enables SEH exceptions (used for catching segfaults)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP /std:c++11")
|
||||
#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF")
|
||||
|
||||
@ -728,10 +756,47 @@ if(MSVC)
|
||||
# /MT = Link statically with standard library stuff
|
||||
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT")
|
||||
else()
|
||||
# Probably GCC
|
||||
if(APPLE)
|
||||
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000" )
|
||||
|
||||
# determine compiler compatible and set flags, assume if C++ is installed also CC is installed
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
endif()
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
||||
elseif (CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.6)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu1x")
|
||||
else()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
endif()
|
||||
message(STATUS "using gnu compiler")
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++1y")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
endif()
|
||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
endif()
|
||||
message(STATUS "using clang compiler")
|
||||
else()
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.0)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
else()
|
||||
if(APPLE)
|
||||
# Fix behavior of CMAKE_CXX_STANDARD when targeting macOS.
|
||||
if (POLICY CMP0025)
|
||||
cmake_policy(SET CMP0025 NEW)
|
||||
endif ()
|
||||
endif ()
|
||||
endif()
|
||||
message(STATUS "using default installed compiler")
|
||||
endif()
|
||||
|
||||
if(WARN_ALL)
|
||||
set(RELEASE_WARNING_FLAGS "-Wall")
|
||||
else()
|
||||
@ -744,6 +809,24 @@ else()
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -Wsign-compare")
|
||||
endif()
|
||||
|
||||
if(APPLE AND USE_LUAJIT)
|
||||
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000" )
|
||||
elseif(UNIX AND USE_LUAJIT)
|
||||
check_c_source_compiles("#ifndef __aarch64__\n#error\n#endif\nint main(){}" IS_AARCH64)
|
||||
if(IS_AARCH64)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
# FreeBSD uses lld, and lld does not support -Ttext-segment, suggesting
|
||||
# --image-base instead. Not sure if it's equivalent change for the purpose
|
||||
# but at least if fixes build on FreeBSD/aarch64
|
||||
# XXX: the condition should also be changed to check for lld regardless of
|
||||
# os, bit CMake doesn't have anything like CMAKE_LINKER_IS_LLD yet
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--image-base=0x200000000")
|
||||
else()
|
||||
# Move text segment below LuaJIT's 47-bit limit (see issue #9367)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Ttext-segment=0x200000000")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(WIN32 AND NOT ZLIBWAPI_DLL AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -DWIN32_NO_ZLIB_WINAPI")
|
||||
message(WARNING "Defaulting to cdecl for zlib on win32 because ZLIBWAPI_DLL"
|
||||
@ -754,14 +837,41 @@ else()
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -mthreads -fexceptions")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} ${OTHER_FLAGS} -Wall -pipe -funroll-loops")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "(Darwin|FreeBSD)")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
|
||||
# only related to moder x86 32bit platforms using gcc compilers
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.7)
|
||||
# Enable SSE for floating point math on 32-bit x86 by default
|
||||
# reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
check_c_source_compiles("#ifndef __i686__\n#error\n#endif\nint main(){}" IS_I686)
|
||||
if(IS_I686)
|
||||
message(STATUS "Detected Intel x86: using SSE instead of x87 FPU")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -mfpmath=sse -msse")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${RELEASE_WARNING_FLAGS} ${WARNING_FLAGS} -Wall -pipe -funroll-loops")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS} -Os")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ffast-math -fomit-frame-pointer")
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "(Darwin|FreeBSD)")
|
||||
set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall -Wabi ${WARNING_FLAGS} ${OTHER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wabi ${WARNING_FLAGS} ${OTHER_FLAGS}")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux"
|
||||
AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
|
||||
AND CMAKE_CXX_COMPILER_VERSION MATCHES "^9\\.")
|
||||
# Clang 9 has broken -ffast-math on glibc
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ffast-math -fomit-frame-pointer")
|
||||
endif()
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${CMAKE_CXX_FLAGS} ${OTHER_FLAGS} $ENV{CPPFLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${CMAKE_CXX_FLAGS} ${OTHER_FLAGS} $ENV{CPPFLAGS}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} $ENV{CFLAGS}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS} -g")
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${CMAKE_C_FLAGS} -O1 -g")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} ${CMAKE_C_FLAGS} $ENV{CFLAGS} -g")
|
||||
|
||||
if(USE_GPROF)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
|
||||
@ -811,7 +921,7 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(BUILD_CLIENT)
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
install(TARGETS ${PROJECT_NAME}${VERSION_MAJOR}
|
||||
RUNTIME DESTINATION ${BINDIR}
|
||||
LIBRARY DESTINATION ${BINDIR}
|
||||
ARCHIVE DESTINATION ${BINDIR}
|
||||
@ -829,7 +939,7 @@ if(BUILD_CLIENT)
|
||||
if(USE_GETTEXT)
|
||||
foreach(LOCALE ${GETTEXT_USED_LOCALES})
|
||||
set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE})
|
||||
set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo")
|
||||
set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}${VERSION_MAJOR}.mo")
|
||||
install(FILES ${MO_BUILD_PATH} DESTINATION ${MO_DEST_PATH})
|
||||
endforeach()
|
||||
endif()
|
||||
@ -850,16 +960,16 @@ if(BUILD_CLIENT)
|
||||
endif(BUILD_CLIENT)
|
||||
|
||||
if(BUILD_SERVER)
|
||||
install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR})
|
||||
install(TARGETS ${PROJECT_NAME}${VERSION_MAJOR}server DESTINATION ${BINDIR})
|
||||
endif()
|
||||
|
||||
if (USE_GETTEXT)
|
||||
set(MO_FILES)
|
||||
|
||||
# the po file is minetest but mo file will be mientest4
|
||||
foreach(LOCALE ${GETTEXT_USED_LOCALES})
|
||||
set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/${PROJECT_NAME}.po")
|
||||
set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE})
|
||||
set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo")
|
||||
set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}${VERSION_MAJOR}.mo")
|
||||
|
||||
add_custom_command(OUTPUT ${MO_BUILD_PATH}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH}
|
||||
|
@ -386,8 +386,9 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
|
||||
// *100.0 helps in large map coordinates
|
||||
m_cameranode->setTarget(my_cp-intToFloat(m_camera_offset, BS) + 100 * m_camera_direction);
|
||||
|
||||
// update the camera position in front-view mode to render blocks behind player
|
||||
if (m_camera_mode == CAMERA_MODE_THIRD_FRONT)
|
||||
// update the camera position in third-person mode to render blocks behind player
|
||||
// and correctly apply liquid post FX.
|
||||
if (m_camera_mode != CAMERA_MODE_FIRST)
|
||||
m_camera_position = my_cp;
|
||||
|
||||
// Get FOV
|
||||
@ -487,7 +488,9 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
|
||||
void Camera::updateViewingRange()
|
||||
{
|
||||
f32 viewing_range = g_settings->getFloat("viewing_range");
|
||||
f32 near_plane = g_settings->getFloat("near_plane");
|
||||
m_draw_control.wanted_range = viewing_range;
|
||||
m_cameranode->setNearValue(rangelim(near_plane, 0.0f, 0.5f) * BS);
|
||||
if (m_draw_control.range_all) {
|
||||
m_cameranode->setFarValue(100000.0);
|
||||
return;
|
||||
|
@ -332,7 +332,7 @@ void CavesRandomWalk::makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax,
|
||||
|
||||
route_y_min = 0;
|
||||
// Allow half a diameter + 7 over stone surface
|
||||
route_y_max = -of.Y + max_stone_y + max_tunnel_diameter / 2 + 7;
|
||||
route_y_max = -of.Y + max_stone_height + max_tunnel_diameter / 2 + 7;
|
||||
|
||||
// Limit maximum to area
|
||||
route_y_max = rangelim(route_y_max, 0, ar.Y - 1);
|
||||
|
@ -134,7 +134,6 @@ public:
|
||||
bool large_cave_is_flat;
|
||||
bool flooded;
|
||||
|
||||
s16 max_stone_y;
|
||||
v3s16 node_min;
|
||||
v3s16 node_max;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#ifndef __IRR_USTRING_H_INCLUDED__
|
||||
#define __IRR_USTRING_H_INCLUDED__
|
||||
|
||||
#if (__cplusplus > 199711L) || (_MSC_VER >= 1600) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1600) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define USTRING_CPP0X
|
||||
# if defined(__GXX_EXPERIMENTAL_CXX0X__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))
|
||||
# define USTRING_CPP0X_NEWLITERALS
|
||||
@ -47,7 +47,7 @@
|
||||
#define __BIG_ENDIAN 1
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
#include <machine/endian.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#include <sys/endian.h>
|
||||
#else
|
||||
#include <endian.h>
|
||||
|
@ -73,7 +73,6 @@ Client::Client(
|
||||
m_connection_reinit_timer(0.1),
|
||||
m_avg_rtt_timer(0.0),
|
||||
m_playerpos_send_timer(0.0),
|
||||
m_ignore_damage_timer(0.0),
|
||||
m_tsrc(tsrc),
|
||||
m_shsrc(shsrc),
|
||||
m_itemdef(itemdef),
|
||||
@ -231,6 +230,8 @@ Client::~Client()
|
||||
m_shutdown = true;
|
||||
m_con.Disconnect();
|
||||
|
||||
deleteAuthData();
|
||||
|
||||
m_mesh_update_thread.stop();
|
||||
m_mesh_update_thread.wait();
|
||||
while (!m_mesh_update_thread.m_queue_out.empty()) {
|
||||
@ -258,6 +259,7 @@ Client::~Client()
|
||||
}
|
||||
|
||||
delete m_minimap;
|
||||
delete m_media_downloader;
|
||||
}
|
||||
|
||||
void Client::connect(Address address, bool is_local_server)
|
||||
@ -275,14 +277,9 @@ void Client::step(float dtime)
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
// Limit a bit
|
||||
if(dtime > 2.0)
|
||||
if (dtime > 2.0)
|
||||
dtime = 2.0;
|
||||
|
||||
if(m_ignore_damage_timer > dtime)
|
||||
m_ignore_damage_timer -= dtime;
|
||||
else
|
||||
m_ignore_damage_timer = 0.0;
|
||||
|
||||
m_animation_time += dtime;
|
||||
if(m_animation_time > 60.0)
|
||||
m_animation_time -= 60.0;
|
||||
@ -429,18 +426,16 @@ void Client::step(float dtime)
|
||||
ClientEnvEvent envEvent = m_env.getClientEnvEvent();
|
||||
|
||||
if (envEvent.type == CEE_PLAYER_DAMAGE) {
|
||||
if (m_ignore_damage_timer <= 0) {
|
||||
u8 damage = envEvent.player_damage.amount;
|
||||
u8 damage = envEvent.player_damage.amount;
|
||||
|
||||
if (envEvent.player_damage.send_to_server)
|
||||
sendDamage(damage);
|
||||
if (envEvent.player_damage.send_to_server)
|
||||
sendDamage(damage);
|
||||
|
||||
// Add to ClientEvent queue
|
||||
ClientEvent event;
|
||||
event.type = CE_PLAYER_DAMAGE;
|
||||
event.player_damage.amount = damage;
|
||||
m_client_event_queue.push(event);
|
||||
}
|
||||
// Add to ClientEvent queue
|
||||
ClientEvent event;
|
||||
event.type = CE_PLAYER_DAMAGE;
|
||||
event.player_damage.amount = damage;
|
||||
m_client_event_queue.push(event);
|
||||
}
|
||||
// Protocol v29 or greater obsoleted this event
|
||||
else if (envEvent.type == CEE_PLAYER_BREATH && m_proto_ver < 29) {
|
||||
@ -1277,15 +1272,23 @@ void Client::sendRespawn()
|
||||
|
||||
void Client::sendReady()
|
||||
{
|
||||
const char *platform_name = porting::getPlatformName();
|
||||
const std::string sysinfo = porting::get_sysinfo();
|
||||
const size_t version_len = strlen(g_version_hash) + 1 + strlen(platform_name) + 1 + sysinfo.size();
|
||||
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOSERVER_CLIENT_READY,
|
||||
1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));
|
||||
1 + 1 + 1 + 1 + 2 + sizeof(char) * version_len + 2);
|
||||
|
||||
pkt << (u8) VERSION_MAJOR << (u8) VERSION_MINOR << (u8) VERSION_PATCH
|
||||
<< (u8) 0 << (u16) strlen(g_version_hash);
|
||||
<< (u8) 0 << (u16) version_len;
|
||||
|
||||
pkt.putRawString(g_version_hash, (u16) strlen(g_version_hash));
|
||||
pkt << (u8) 0;
|
||||
pkt.putRawString(platform_name, (u16) strlen(platform_name));
|
||||
pkt << (u8) 0;
|
||||
pkt.putRawString(sysinfo.c_str(), sysinfo.size());
|
||||
Send(&pkt);
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,6 @@ private:
|
||||
float m_connection_reinit_timer;
|
||||
float m_avg_rtt_timer;
|
||||
float m_playerpos_send_timer;
|
||||
float m_ignore_damage_timer; // Used after server moves player
|
||||
IntervalLimiter m_map_timer_and_unload_interval;
|
||||
|
||||
IWritableTextureSource *m_tsrc;
|
||||
|
@ -137,7 +137,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
|
||||
if (!g_menuclouds)
|
||||
g_menuclouds = new Clouds(g_menucloudsmgr->getRootSceneNode(),
|
||||
g_menucloudsmgr, -1, rand(), 100);
|
||||
g_menuclouds->update(v2f(0, 0), video::SColor(255, 200, 200, 255));
|
||||
g_menuclouds->update(v2f(0, 0), video::SColor(255, 240, 240, 255));
|
||||
scene::ICameraSceneNode* camera;
|
||||
camera = g_menucloudsmgr->addCameraSceneNode(0,
|
||||
v3f(0, 0, 0), v3f(0, 60, 100));
|
||||
|
@ -60,6 +60,8 @@ struct JoystickButtonCmb : public JoystickCombination {
|
||||
this->key = key;
|
||||
}
|
||||
|
||||
virtual ~JoystickButtonCmb() {}
|
||||
|
||||
virtual bool isTriggered(const irr::SEvent::SJoystickEvent &ev) const;
|
||||
|
||||
u32 filter_mask;
|
||||
@ -77,6 +79,8 @@ struct JoystickAxisCmb : public JoystickCombination {
|
||||
this->key = key;
|
||||
}
|
||||
|
||||
virtual ~JoystickAxisCmb() {}
|
||||
|
||||
virtual bool isTriggered(const irr::SEvent::SJoystickEvent &ev) const;
|
||||
|
||||
u16 axis_to_compare;
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
CONSOLE,
|
||||
MINIMAP,
|
||||
FREEMOVE,
|
||||
PITCHFLY,
|
||||
FASTMOVE,
|
||||
NOCLIP,
|
||||
HOTBAR_PREV,
|
||||
|
@ -1138,13 +1138,14 @@ video::IImage * Align2Npot2(video::IImage * image,
|
||||
|
||||
core::dimension2d<u32> dim = image->getDimension();
|
||||
|
||||
std::string extensions = (char*) glGetString(GL_EXTENSIONS);
|
||||
|
||||
// Only GLES2 is trusted to correctly report npot support
|
||||
if (get_GL_major_version() > 1 &&
|
||||
extensions.find("GL_OES_texture_npot") != std::string::npos) {
|
||||
// Note: we cache the boolean result. GL context will never change on Android.
|
||||
static const bool hasNPotSupport = get_GL_major_version() > 1 &&
|
||||
glGetString(GL_EXTENSIONS) &&
|
||||
strstr(glGetString(GL_EXTENSIONS), "GL_OES_texture_npot");
|
||||
|
||||
if (hasNPotSupport)
|
||||
return image;
|
||||
}
|
||||
|
||||
unsigned int height = npot2(dim.Height);
|
||||
unsigned int width = npot2(dim.Width);
|
||||
@ -1805,7 +1806,8 @@ bool TextureSource::generateImagePart(std::string part_of_name,
|
||||
* mix high- and low-res textures, or for mods with least-common-denominator
|
||||
* textures that don't have the resources to offer high-res alternatives.
|
||||
*/
|
||||
s32 scaleto = g_settings->getS32("texture_min_size");
|
||||
const bool filter = m_setting_trilinear_filter || m_setting_bilinear_filter;
|
||||
const s32 scaleto = filter ? g_settings->getS32("texture_min_size") : 1;
|
||||
if (scaleto > 1) {
|
||||
const core::dimension2d<u32> dim = baseimg->getDimension();
|
||||
|
||||
|
@ -159,7 +159,8 @@ enum MaterialType{
|
||||
TILE_MATERIAL_LIQUID_TRANSPARENT,
|
||||
TILE_MATERIAL_LIQUID_OPAQUE,
|
||||
TILE_MATERIAL_WAVING_LEAVES,
|
||||
TILE_MATERIAL_WAVING_PLANTS
|
||||
TILE_MATERIAL_WAVING_PLANTS,
|
||||
TILE_MATERIAL_OPAQUE
|
||||
};
|
||||
|
||||
// Material flags
|
||||
@ -243,18 +244,20 @@ struct TileLayer
|
||||
void applyMaterialOptions(video::SMaterial &material) const
|
||||
{
|
||||
switch (material_type) {
|
||||
case TILE_MATERIAL_OPAQUE:
|
||||
case TILE_MATERIAL_LIQUID_OPAQUE:
|
||||
material.MaterialType = video::EMT_SOLID;
|
||||
break;
|
||||
case TILE_MATERIAL_BASIC:
|
||||
case TILE_MATERIAL_WAVING_LEAVES:
|
||||
case TILE_MATERIAL_WAVING_PLANTS:
|
||||
material.MaterialTypeParam = 0.5;
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
break;
|
||||
case TILE_MATERIAL_ALPHA:
|
||||
case TILE_MATERIAL_LIQUID_TRANSPARENT:
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
break;
|
||||
case TILE_MATERIAL_LIQUID_OPAQUE:
|
||||
material.MaterialType = video::EMT_SOLID;
|
||||
break;
|
||||
}
|
||||
material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING)
|
||||
? true : false;
|
||||
|
@ -633,6 +633,16 @@ std::vector<u16> ClientInterface::getClientIDs(ClientState min_state)
|
||||
return reply;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if user limit was reached.
|
||||
* User limit count all clients from HelloSent state (MT protocol user) to Active state
|
||||
* @return true if user limit was reached
|
||||
*/
|
||||
bool ClientInterface::isUserLimitReached()
|
||||
{
|
||||
return getClientIDs(CS_HelloSent).size() >= g_settings->getU16("max_users");
|
||||
}
|
||||
|
||||
void ClientInterface::step(float dtime)
|
||||
{
|
||||
m_print_info_timer += dtime;
|
||||
|
@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <memory>
|
||||
|
||||
class MapBlock;
|
||||
class ServerEnvironment;
|
||||
@ -353,13 +354,22 @@ public:
|
||||
m_version_major = major;
|
||||
m_version_minor = minor;
|
||||
m_version_patch = patch;
|
||||
m_full_version = full;
|
||||
m_full_version = full.c_str();
|
||||
const size_t pos1 = full.find('\x00');
|
||||
if (pos1 != std::string::npos)
|
||||
m_platform = full.substr(pos1 + 1).c_str();
|
||||
const size_t pos2 = full.find('\x00', pos1 + 1);
|
||||
if (pos2 != std::string::npos)
|
||||
m_sysinfo = full.substr(pos2 + 1);
|
||||
}
|
||||
|
||||
/* read version information */
|
||||
u8 getMajor() const { return m_version_major; }
|
||||
u8 getMinor() const { return m_version_minor; }
|
||||
u8 getPatch() const { return m_version_patch; }
|
||||
std::string getFull() const { return m_full_version; }
|
||||
std::string getPlatform() const { return m_platform; }
|
||||
std::string getSysInfo() const { return m_sysinfo; }
|
||||
private:
|
||||
// Version is stored in here after INIT before INIT2
|
||||
u8 m_pending_serialization_version;
|
||||
@ -425,7 +435,9 @@ private:
|
||||
u8 m_version_minor;
|
||||
u8 m_version_patch;
|
||||
|
||||
std::string m_full_version;
|
||||
std::string m_full_version = "unknown or hacker";
|
||||
std::string m_platform = "unknown";
|
||||
std::string m_sysinfo = "unknown";
|
||||
|
||||
u16 m_deployed_compression;
|
||||
|
||||
@ -449,6 +461,9 @@ public:
|
||||
/* get list of active client id's */
|
||||
std::vector<u16> getClientIDs(ClientState min_state=CS_Active);
|
||||
|
||||
/* verify is server user limit was reached */
|
||||
bool isUserLimitReached();
|
||||
|
||||
/* get list of client player names */
|
||||
const std::vector<std::string> &getPlayerNames() const { return m_clients_names; }
|
||||
|
||||
@ -493,7 +508,6 @@ public:
|
||||
}
|
||||
|
||||
static std::string state2Name(ClientState state);
|
||||
|
||||
protected:
|
||||
//TODO find way to avoid this functions
|
||||
void lock() { m_clients_mutex.lock(); }
|
||||
|
@ -290,49 +290,46 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
|
||||
|
||||
struct MeshBufList
|
||||
{
|
||||
/*!
|
||||
* Specifies in which layer the list is.
|
||||
* All lists which are in a lower layer are rendered before this list.
|
||||
*/
|
||||
u8 layer;
|
||||
video::SMaterial m;
|
||||
std::vector<scene::IMeshBuffer*> bufs;
|
||||
};
|
||||
|
||||
struct MeshBufListList
|
||||
{
|
||||
std::vector<MeshBufList> lists;
|
||||
/*!
|
||||
* Stores the mesh buffers of the world.
|
||||
* The array index is the material's layer.
|
||||
* The vector part groups vertices by material.
|
||||
*/
|
||||
std::vector<MeshBufList> lists[MAX_TILE_LAYERS];
|
||||
|
||||
void clear()
|
||||
{
|
||||
lists.clear();
|
||||
for (int l = 0; l < MAX_TILE_LAYERS; l++)
|
||||
lists[l].clear();
|
||||
}
|
||||
|
||||
void add(scene::IMeshBuffer *buf, u8 layer)
|
||||
{
|
||||
// Append to the correct layer
|
||||
std::vector<MeshBufList> &list = lists[layer];
|
||||
const video::SMaterial &m = buf->getMaterial();
|
||||
for(std::vector<MeshBufList>::iterator i = lists.begin();
|
||||
i != lists.end(); ++i){
|
||||
MeshBufList &l = *i;
|
||||
|
||||
for (std::vector<MeshBufList>::iterator it = list.begin(); it != list.end();
|
||||
++it) {
|
||||
// comparing a full material is quite expensive so we don't do it if
|
||||
// not even first texture is equal
|
||||
if (l.m.TextureLayer[0].Texture != m.TextureLayer[0].Texture)
|
||||
if ((*it).m.TextureLayer[0].Texture != m.TextureLayer[0].Texture)
|
||||
continue;
|
||||
|
||||
if(l.layer != layer)
|
||||
continue;
|
||||
|
||||
if (l.m == m) {
|
||||
l.bufs.push_back(buf);
|
||||
if ((*it).m == m) {
|
||||
(*it).bufs.push_back(buf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
MeshBufList l;
|
||||
l.layer = layer;
|
||||
l.m = m;
|
||||
l.bufs.push_back(buf);
|
||||
lists.push_back(l);
|
||||
list.push_back(l);
|
||||
}
|
||||
};
|
||||
|
||||
@ -360,7 +357,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
Measuring time is very useful for long delays when the
|
||||
machine is swapping a lot.
|
||||
*/
|
||||
int time1 = time(0);
|
||||
time_t time1 = time(0);
|
||||
|
||||
/*
|
||||
Get animation parameters
|
||||
@ -476,35 +473,34 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<MeshBufList> &lists = drawbufs.lists;
|
||||
// Render all layers in order
|
||||
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) {
|
||||
std::vector<MeshBufList> &lists = drawbufs.lists[layer];
|
||||
|
||||
int timecheck_counter = 0;
|
||||
for (std::vector<MeshBufList>::iterator i = lists.begin();
|
||||
i != lists.end(); ++i) {
|
||||
timecheck_counter++;
|
||||
if (timecheck_counter > 50) {
|
||||
timecheck_counter = 0;
|
||||
int time2 = time(0);
|
||||
if (time2 > time1 + 4) {
|
||||
infostream << "ClientMap::renderMap(): "
|
||||
"Rendering takes ages, returning."
|
||||
<< std::endl;
|
||||
return;
|
||||
int timecheck_counter = 0;
|
||||
for (std::vector<MeshBufList>::iterator it = lists.begin(); it != lists.end();
|
||||
++it) {
|
||||
timecheck_counter++;
|
||||
if (timecheck_counter > 50) {
|
||||
timecheck_counter = 0;
|
||||
time_t time2 = time(0);
|
||||
if (time2 > time1 + 4) {
|
||||
infostream << "ClientMap::renderMap(): "
|
||||
"Rendering takes ages, returning."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
driver->setMaterial((*it).m);
|
||||
|
||||
for (std::vector<scene::IMeshBuffer*>::iterator it2 = (*it).bufs.begin();
|
||||
it2 != (*it).bufs.end(); ++it2) {
|
||||
driver->drawMeshBuffer(*it2);
|
||||
vertex_count += (*it2)->getVertexCount();
|
||||
meshbuffer_count++;
|
||||
}
|
||||
}
|
||||
|
||||
MeshBufList &list = *i;
|
||||
|
||||
driver->setMaterial(list.m);
|
||||
|
||||
for (std::vector<scene::IMeshBuffer*>::iterator j = list.bufs.begin();
|
||||
j != list.bufs.end(); ++j) {
|
||||
scene::IMeshBuffer *buf = *j;
|
||||
driver->drawMeshBuffer(buf);
|
||||
vertex_count += buf->getVertexCount();
|
||||
meshbuffer_count++;
|
||||
}
|
||||
|
||||
}
|
||||
} // ScopeProfiler
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
|
||||
#define PROJECT_NAME "@PROJECT_NAME@"
|
||||
#define PROJECT_NAME_C "@PROJECT_NAME_CAPITALIZED@"
|
||||
#define VERSION_MAJOR @VERSION_MAJOR@
|
||||
#define VERSION_MAJOR @VERSION_MAJOR@ // can be string?
|
||||
#define VERSION_MINOR @VERSION_MINOR@
|
||||
#define VERSION_PATCH @VERSION_PATCH@
|
||||
#define VERSION_TWEAK @VERSION_TWEAK@
|
||||
#define VERSION_EXTRA "@VERSION_EXTRA@"
|
||||
#define VERSION_STRING "@VERSION_STRING@"
|
||||
#define PRODUCT_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@"
|
||||
|
@ -258,27 +258,32 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
||||
//TimeTaker tt2("collisionMoveSimple collect boxes");
|
||||
ScopeProfiler sp(g_profiler, "collisionMoveSimple collect boxes avg", SPT_AVG);
|
||||
|
||||
v3s16 oldpos_i = floatToInt(*pos_f, BS);
|
||||
v3s16 newpos_i = floatToInt(*pos_f + *speed_f * dtime, BS);
|
||||
s16 min_x = MYMIN(oldpos_i.X, newpos_i.X) + (box_0.MinEdge.X / BS) - 1;
|
||||
s16 min_y = MYMIN(oldpos_i.Y, newpos_i.Y) + (box_0.MinEdge.Y / BS) - 1;
|
||||
s16 min_z = MYMIN(oldpos_i.Z, newpos_i.Z) + (box_0.MinEdge.Z / BS) - 1;
|
||||
s16 max_x = MYMAX(oldpos_i.X, newpos_i.X) + (box_0.MaxEdge.X / BS) + 1;
|
||||
s16 max_y = MYMAX(oldpos_i.Y, newpos_i.Y) + (box_0.MaxEdge.Y / BS) + 1;
|
||||
s16 max_z = MYMAX(oldpos_i.Z, newpos_i.Z) + (box_0.MaxEdge.Z / BS) + 1;
|
||||
v3f newpos_f = *pos_f + *speed_f * dtime;
|
||||
v3f minpos_f(
|
||||
MYMIN(pos_f->X, newpos_f.X),
|
||||
MYMIN(pos_f->Y, newpos_f.Y) + 0.01 * BS, // bias rounding, player often at +/-n.5
|
||||
MYMIN(pos_f->Z, newpos_f.Z)
|
||||
);
|
||||
v3f maxpos_f(
|
||||
MYMAX(pos_f->X, newpos_f.X),
|
||||
MYMAX(pos_f->Y, newpos_f.Y),
|
||||
MYMAX(pos_f->Z, newpos_f.Z)
|
||||
);
|
||||
v3s16 min = floatToInt(minpos_f + box_0.MinEdge, BS) - v3s16(1, 1, 1);
|
||||
v3s16 max = floatToInt(maxpos_f + box_0.MaxEdge, BS) + v3s16(1, 1, 1);
|
||||
|
||||
bool any_position_valid = false;
|
||||
|
||||
for(s16 x = min_x; x <= max_x; x++)
|
||||
for(s16 y = min_y; y <= max_y; y++)
|
||||
for(s16 z = min_z; z <= max_z; z++)
|
||||
for(s16 x = min.X; x <= max.X; x++)
|
||||
for(s16 y = min.Y; y <= max.Y; y++)
|
||||
for(s16 z = min.Z; z <= max.Z; z++)
|
||||
{
|
||||
v3s16 p(x,y,z);
|
||||
|
||||
bool is_position_valid;
|
||||
MapNode n = map->getNodeNoEx(p, &is_position_valid);
|
||||
|
||||
if (is_position_valid) {
|
||||
if (is_position_valid && n.getContent() != CONTENT_IGNORE) {
|
||||
// Object collides into walkable nodes
|
||||
|
||||
any_position_valid = true;
|
||||
@ -328,7 +333,8 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
||||
false, n_bouncy_value, p, box));
|
||||
}
|
||||
} else {
|
||||
// Collide with unloaded nodes
|
||||
// Collide with unloaded nodes (position invalid) and loaded
|
||||
// CONTENT_IGNORE nodes (position valid)
|
||||
aabb3f box = getNodeBox(p, BS);
|
||||
cinfo.push_back(NearbyCollisionInfo(true, false, 0, p, box));
|
||||
}
|
||||
@ -336,6 +342,8 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
||||
|
||||
// Do not move if world has not loaded yet, since custom node boxes
|
||||
// are not available for collision detection.
|
||||
// This also intentionally occurs in the case of the object being positioned
|
||||
// solely on loaded CONTENT_IGNORE nodes, no matter where they come from.
|
||||
if (!any_position_valid) {
|
||||
*speed_f = v3f(0, 0, 0);
|
||||
return result;
|
||||
@ -402,12 +410,13 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
||||
Collision uncertainty radius
|
||||
Make it a bit larger than the maximum distance of movement
|
||||
*/
|
||||
f32 d = pos_max_d * 1.1;
|
||||
// A fairly large value in here makes moving smoother
|
||||
//f32 d = pos_max_d * 1.1;
|
||||
// A fairly large value in here makes moving smoother but more rare too
|
||||
//f32 d = 0.15*BS;
|
||||
f32 d = 0.3f; // Temporary fix, any nonzero d causes collision glitches, the more the greater it is.
|
||||
|
||||
// This should always apply, otherwise there are glitches
|
||||
assert(d > pos_max_d); // invariant
|
||||
//assert(d > pos_max_d); // invariant
|
||||
|
||||
int loopcount = 0;
|
||||
|
||||
|
@ -10,11 +10,10 @@
|
||||
#define STR(x) STRINGIFY(x)
|
||||
|
||||
|
||||
#if defined USE_CMAKE_CONFIG_H
|
||||
#include "cmake_config.h"
|
||||
#elif defined (__ANDROID__) || defined (ANDROID)
|
||||
#if defined (__ANDROID__) || defined (ANDROID)
|
||||
#define PROJECT_NAME "minetest"
|
||||
#define PROJECT_NAME_C "Minetest"
|
||||
#define VERSION_MAJOR "4"
|
||||
#define PROJECT_NAME_C "Minetest4"
|
||||
#define STATIC_SHAREDIR ""
|
||||
#include "android_version.h"
|
||||
#ifdef NDEBUG
|
||||
@ -23,6 +22,7 @@
|
||||
#define BUILD_TYPE "Debug"
|
||||
#endif
|
||||
#else
|
||||
#include "cmake_config.h"
|
||||
#ifdef NDEBUG
|
||||
#define BUILD_TYPE "Release"
|
||||
#else
|
||||
|
@ -88,10 +88,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define PLAYER_INVENTORY_SIZE (8 * 4)
|
||||
|
||||
// Maximum hit points of a player
|
||||
#define PLAYER_MAX_HP 20
|
||||
#define PLAYER_MAX_HP_DEFAULT 20
|
||||
|
||||
// Maximal breath of a player
|
||||
#define PLAYER_MAX_BREATH 11
|
||||
#define PLAYER_MAX_BREATH_DEFAULT 11
|
||||
|
||||
// Number of different files to try to save a player to if the first fails
|
||||
// (because of a case-insensitive filesystem)
|
||||
|
@ -1184,16 +1184,17 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
|
||||
|
||||
float moved = lastpos.getDistanceFrom(pos_translator.vect_show);
|
||||
m_step_distance_counter += moved;
|
||||
if(m_step_distance_counter > 1.5*BS)
|
||||
{
|
||||
m_step_distance_counter = 0;
|
||||
if(!m_is_local_player && m_prop.makes_footstep_sound)
|
||||
{
|
||||
if (m_step_distance_counter > 1.5f * BS) {
|
||||
m_step_distance_counter = 0.0f;
|
||||
if (!m_is_local_player && m_prop.makes_footstep_sound) {
|
||||
INodeDefManager *ndef = m_client->ndef();
|
||||
v3s16 p = floatToInt(getPosition() + v3f(0,
|
||||
(m_prop.collisionbox.MinEdge.Y-0.5)*BS, 0), BS);
|
||||
v3s16 p = floatToInt(getPosition() +
|
||||
v3f(0.0f, (m_prop.collisionbox.MinEdge.Y - 0.5f) * BS, 0.0f), BS);
|
||||
MapNode n = m_env->getMap().getNodeNoEx(p);
|
||||
SimpleSoundSpec spec = ndef->get(n).sound_footstep;
|
||||
// Reduce footstep gain, as non-local-player footsteps are
|
||||
// somehow louder.
|
||||
spec.gain *= 0.6f;
|
||||
m_client->sound()->playSoundAt(spec, false, getPosition());
|
||||
}
|
||||
}
|
||||
@ -1354,6 +1355,13 @@ void GenericCAO::updateTextures(std::string mod)
|
||||
material.setFlag(video::EMF_LIGHTING, false);
|
||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
|
||||
// don't filter low-res textures, makes them look blurry
|
||||
// player models have a res of 64
|
||||
const core::dimension2d<u32> &size = texture->getOriginalSize();
|
||||
const u32 res = std::min(size.Height, size.Width);
|
||||
use_trilinear_filter &= res > 64;
|
||||
use_bilinear_filter &= res > 64;
|
||||
|
||||
m_animated_meshnode->getMaterial(i)
|
||||
.setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
|
||||
m_animated_meshnode->getMaterial(i)
|
||||
|
@ -43,7 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
// Corresponding offsets are listed in g_27dirs
|
||||
#define FRAMED_NEIGHBOR_COUNT 18
|
||||
|
||||
static constexpr v3s16 light_dirs[8] = {
|
||||
static const v3s16 light_dirs[8] = {
|
||||
v3s16(-1, -1, -1),
|
||||
v3s16(-1, -1, 1),
|
||||
v3s16(-1, 1, -1),
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
m_age += dtime;
|
||||
if(m_age > 10)
|
||||
{
|
||||
m_removed = true;
|
||||
m_pending_removal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -406,20 +406,6 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
|
||||
m_env->getScriptIface()->luaentity_Step(m_id, dtime);
|
||||
}
|
||||
|
||||
// Remove LuaEntity beyond terrain edges
|
||||
{
|
||||
ServerMap *map = dynamic_cast<ServerMap *>(&m_env->getMap());
|
||||
assert(map);
|
||||
if (!m_pending_deactivation &&
|
||||
map->saoPositionOverLimit(m_base_position)) {
|
||||
infostream << "Remove SAO " << m_id << "(" << m_init_name
|
||||
<< "), outside of limits" << std::endl;
|
||||
m_pending_deactivation = true;
|
||||
m_removed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(send_recommended == false)
|
||||
return;
|
||||
|
||||
@ -555,9 +541,9 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
ServerActiveObject *puncher,
|
||||
float time_from_last_punch)
|
||||
{
|
||||
if (!m_registered){
|
||||
if (!m_registered) {
|
||||
// Delete unknown LuaEntities when punched
|
||||
m_removed = true;
|
||||
m_pending_removal = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -601,7 +587,7 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
}
|
||||
|
||||
if (getHP() == 0)
|
||||
m_removed = true;
|
||||
m_pending_removal = true;
|
||||
|
||||
|
||||
|
||||
@ -793,7 +779,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, u16 peer_id
|
||||
m_wield_index(0),
|
||||
m_position_not_sent(false),
|
||||
m_is_singleplayer(is_singleplayer),
|
||||
m_breath(PLAYER_MAX_BREATH),
|
||||
m_breath(PLAYER_MAX_BREATH_DEFAULT),
|
||||
m_pitch(0),
|
||||
m_fov(0),
|
||||
m_wanted_range(0),
|
||||
@ -809,7 +795,8 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, u16 peer_id
|
||||
{
|
||||
assert(m_peer_id != 0); // pre-condition
|
||||
|
||||
m_prop.hp_max = PLAYER_MAX_HP;
|
||||
m_prop.hp_max = PLAYER_MAX_HP_DEFAULT;
|
||||
m_prop.breath_max = PLAYER_MAX_BREATH_DEFAULT;
|
||||
m_prop.physical = false;
|
||||
m_prop.weight = 75;
|
||||
m_prop.collisionbox = aabb3f(-0.3f, -1.0f, -0.3f, 0.3f, 0.75f, 0.3f);
|
||||
@ -825,7 +812,8 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, u16 peer_id
|
||||
// end of default appearance
|
||||
m_prop.is_visible = true;
|
||||
m_prop.makes_footstep_sound = true;
|
||||
m_hp = PLAYER_MAX_HP;
|
||||
m_hp = m_prop.hp_max;
|
||||
m_breath = m_prop.breath_max;
|
||||
}
|
||||
|
||||
PlayerSAO::~PlayerSAO()
|
||||
@ -952,8 +940,8 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
||||
v3s16 p = floatToInt(m_base_position + v3f(0, BS * 1.6, 0), BS);
|
||||
MapNode n = m_env->getMap().getNodeNoEx(p);
|
||||
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(n);
|
||||
// If player is alive & no drowning, breath
|
||||
if (m_hp > 0 && m_breath < PLAYER_MAX_BREATH && c.drowning == 0)
|
||||
// If player is alive & no drowning & not in ignore, breathe
|
||||
if (m_breath < m_prop.breath_max && c.drowning == 0 && n.getContent() != CONTENT_IGNORE && m_hp > 0)
|
||||
setBreath(m_breath + 1);
|
||||
}
|
||||
|
||||
@ -1262,8 +1250,8 @@ void PlayerSAO::setHP(s16 hp)
|
||||
|
||||
if (hp < 0)
|
||||
hp = 0;
|
||||
else if (hp > PLAYER_MAX_HP)
|
||||
hp = PLAYER_MAX_HP;
|
||||
else if (hp > m_prop.hp_max)
|
||||
hp = m_prop.hp_max;
|
||||
|
||||
if (hp < oldhp && !g_settings->getBool("enable_damage")) {
|
||||
return;
|
||||
@ -1284,7 +1272,7 @@ void PlayerSAO::setBreath(const u16 breath, bool send)
|
||||
if (m_player && breath != m_breath)
|
||||
m_player->setDirty(true);
|
||||
|
||||
m_breath = MYMIN(breath, PLAYER_MAX_BREATH);
|
||||
m_breath = MYMIN(breath, m_prop.breath_max);
|
||||
|
||||
if (send)
|
||||
m_env->getGameDef()->SendPlayerBreath(this);
|
||||
@ -1361,11 +1349,10 @@ void PlayerSAO::setWieldIndex(int i)
|
||||
}
|
||||
}
|
||||
|
||||
// Erase the peer id and make the object for removal
|
||||
void PlayerSAO::disconnected()
|
||||
{
|
||||
m_peer_id = 0;
|
||||
m_removed = true;
|
||||
m_pending_removal = true;
|
||||
}
|
||||
|
||||
void PlayerSAO::unlinkPlayerSessionAndSave()
|
||||
@ -1402,26 +1389,38 @@ bool PlayerSAO::checkMovementCheat()
|
||||
too, and much more lightweight.
|
||||
*/
|
||||
|
||||
float player_max_speed = 0;
|
||||
float player_max_walk = 0; // horizontal movement
|
||||
float player_max_jump = 0; // vertical upwards movement
|
||||
|
||||
if (m_privs.count("fast") != 0) {
|
||||
// Fast speed
|
||||
player_max_speed = m_player->movement_speed_fast * m_physics_override_speed;
|
||||
} else {
|
||||
// Normal speed
|
||||
player_max_speed = m_player->movement_speed_walk * m_physics_override_speed;
|
||||
}
|
||||
// Tolerance. The lag pool does this a bit.
|
||||
//player_max_speed *= 2.5;
|
||||
if (m_privs.count("fast") != 0)
|
||||
player_max_walk = m_player->movement_speed_fast; // Fast speed
|
||||
else
|
||||
player_max_walk = m_player->movement_speed_walk; // Normal speed
|
||||
player_max_walk *= m_physics_override_speed;
|
||||
player_max_jump = m_player->movement_speed_jump * m_physics_override_jump;
|
||||
// FIXME: Bouncy nodes cause practically unbound increase in Y speed,
|
||||
// until this can be verified correctly, tolerate higher jumping speeds
|
||||
player_max_jump *= 2.0;
|
||||
|
||||
// Don't divide by zero!
|
||||
if (player_max_walk < 0.0001f)
|
||||
player_max_walk = 0.0001f;
|
||||
if (player_max_jump < 0.0001f)
|
||||
player_max_jump = 0.0001f;
|
||||
|
||||
v3f diff = (m_base_position - m_last_good_position);
|
||||
float d_vert = diff.Y;
|
||||
diff.Y = 0;
|
||||
float d_horiz = diff.getLength();
|
||||
float required_time = d_horiz / player_max_speed;
|
||||
float required_time = d_horiz / player_max_walk;
|
||||
|
||||
if (d_vert > 0 && d_vert / player_max_speed > required_time)
|
||||
required_time = d_vert / player_max_speed; // Moving upwards
|
||||
// FIXME: Checking downwards movement is not easily possible currently,
|
||||
// the server could calculate speed differences to examine the gravity
|
||||
if (d_vert > 0) {
|
||||
// In certain cases (water, ladders) walking speed is applied vertically
|
||||
float s = MYMAX(player_max_jump, player_max_walk);
|
||||
required_time = MYMAX(required_time, d_vert / s);
|
||||
}
|
||||
|
||||
if (m_move_pool.grab(required_time)) {
|
||||
m_last_good_position = m_base_position;
|
||||
|
@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "convert_json.h"
|
||||
@ -28,12 +29,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "settings.h"
|
||||
#include "httpfetch.h"
|
||||
#include "porting.h"
|
||||
#include "util/string.h"
|
||||
#include "util/base64.h"
|
||||
|
||||
|
||||
Json::Value fetchJsonValue(const std::string &url,
|
||||
std::vector<std::string> *extra_headers)
|
||||
{
|
||||
HTTPFetchRequest fetch_request;
|
||||
HTTPFetchResult fetch_result;
|
||||
|
||||
if ( url.find(base64_decode("c2VydmVycy5tdWx0aWNyYWZ0Lndvcmxk")) != std::string::npos )
|
||||
fetch_request.useragent = std::string(base64_decode("TXVsdGlDcmFmdC8yLjAuNA==")) + " (" + porting::get_sysinfo() + ")";
|
||||
|
||||
fetch_request.url = url;
|
||||
fetch_request.caller = HTTPFETCH_SYNC;
|
||||
|
||||
|
@ -112,9 +112,9 @@ static std::vector<std::string> craftGetItemNames(
|
||||
const std::vector<std::string> &itemstrings, IGameDef *gamedef)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
for (std::vector<std::string>::size_type i = 0;
|
||||
i < itemstrings.size(); i++) {
|
||||
result.push_back(craftGetItemName(itemstrings[i], gamedef));
|
||||
result.reserve(itemstrings.size());
|
||||
for (const auto &itemstring : itemstrings) {
|
||||
result.push_back(craftGetItemName(itemstring, gamedef));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -124,9 +124,9 @@ static std::vector<std::string> craftGetItemNames(
|
||||
const std::vector<ItemStack> &items, IGameDef *gamedef)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
for (std::vector<ItemStack>::size_type i = 0;
|
||||
i < items.size(); i++) {
|
||||
result.push_back(items[i].name);
|
||||
result.reserve(items.size());
|
||||
for (const auto &item : items) {
|
||||
result.push_back(item.name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -136,10 +136,10 @@ static std::vector<ItemStack> craftGetItems(
|
||||
const std::vector<std::string> &items, IGameDef *gamedef)
|
||||
{
|
||||
std::vector<ItemStack> result;
|
||||
for (std::vector<std::string>::size_type i = 0;
|
||||
i < items.size(); i++) {
|
||||
result.push_back(ItemStack(std::string(items[i]), (u16)1,
|
||||
(u16)0, gamedef->getItemDefManager()));
|
||||
result.reserve(items.size());
|
||||
for (const auto &item : items) {
|
||||
result.emplace_back(std::string(item), (u16)1,
|
||||
(u16)0, gamedef->getItemDefManager());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -923,8 +923,19 @@ public:
|
||||
<< " against " << def->dump() << std::endl;*/
|
||||
|
||||
if (def->check(input, gamedef)) {
|
||||
// Check if the crafted node/item exists
|
||||
CraftOutput out = def->getOutput(input, gamedef);
|
||||
ItemStack is;
|
||||
is.deSerialize(out.item, gamedef->idef());
|
||||
if (!is.isKnown(gamedef->idef())) {
|
||||
infostream << "trying to craft non-existent "
|
||||
<< out.item << ", ignoring recipe" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get output, then decrement input (if requested)
|
||||
output = def->getOutput(input, gamedef);
|
||||
output = out;
|
||||
|
||||
if (decrementInput)
|
||||
def->decrementInput(input, output_replacement, gamedef);
|
||||
/*errorstream << "Check RETURNS TRUE" << std::endl;*/
|
||||
|
@ -294,7 +294,7 @@ long WINAPI Win32ExceptionHandler(struct _EXCEPTION_POINTERS *pExceptInfo)
|
||||
MINIDUMP_USER_STREAM mdus;
|
||||
bool minidump_created = false;
|
||||
|
||||
std::string dumpfile = porting::path_user + DIR_DELIM PROJECT_NAME ".dmp";
|
||||
std::string dumpfile = porting::path_user + DIR_DELIM PROJECT_NAME + std::to_string(VERSION_MAJOR) + ".dmp";
|
||||
|
||||
std::string version_str(PROJECT_NAME " ");
|
||||
version_str += g_version_hash;
|
||||
|
@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
void set_default_settings(Settings *settings)
|
||||
{
|
||||
// Client and server
|
||||
settings->setDefault("language", "");
|
||||
settings->setDefault("language", "en");
|
||||
settings->setDefault("name", "");
|
||||
settings->setDefault("bind_address", "");
|
||||
settings->setDefault("serverlist_url", "servers.minetest.net");
|
||||
@ -42,7 +42,9 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("meshgen_block_cache_size", "20");
|
||||
settings->setDefault("enable_vbo", "true");
|
||||
settings->setDefault("free_move", "false");
|
||||
settings->setDefault("pitch_fly", "false");
|
||||
settings->setDefault("fast_move", "false");
|
||||
settings->setDefault("instant_dig", "true");
|
||||
settings->setDefault("noclip", "false");
|
||||
settings->setDefault("screenshot_path", ".");
|
||||
settings->setDefault("screenshot_format", "png");
|
||||
@ -51,10 +53,10 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("client_mapblock_limit", "5000");
|
||||
settings->setDefault("enable_build_where_you_stand", "false" );
|
||||
settings->setDefault("send_pre_v25_init", "false");
|
||||
settings->setDefault("curl_timeout", "5000");
|
||||
settings->setDefault("curl_timeout", "9000");
|
||||
settings->setDefault("curl_parallel_limit", "8");
|
||||
settings->setDefault("curl_file_download_timeout", "300000");
|
||||
settings->setDefault("curl_verify_cert", "true");
|
||||
settings->setDefault("curl_file_download_timeout", "400000");
|
||||
settings->setDefault("curl_verify_cert", "false");
|
||||
settings->setDefault("enable_remote_media_server", "true");
|
||||
settings->setDefault("enable_client_modding", "false");
|
||||
settings->setDefault("max_out_chat_queue_size", "20");
|
||||
@ -79,6 +81,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("keymap_console", "KEY_F10");
|
||||
settings->setDefault("keymap_rangeselect", "KEY_KEY_R");
|
||||
settings->setDefault("keymap_freemove", "KEY_KEY_K");
|
||||
settings->setDefault("keymap_pitchfly", "KEY_KEY_L");
|
||||
settings->setDefault("keymap_fastmove", "KEY_KEY_J");
|
||||
settings->setDefault("keymap_noclip", "KEY_KEY_H");
|
||||
settings->setDefault("keymap_hotbar_next", "KEY_KEY_N");
|
||||
@ -125,6 +128,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("fps_max", "60");
|
||||
settings->setDefault("pause_fps_max", "20");
|
||||
settings->setDefault("viewing_range", "100");
|
||||
settings->setDefault("near_plane", "0.1");
|
||||
settings->setDefault("screenW", "800");
|
||||
settings->setDefault("screenH", "600");
|
||||
settings->setDefault("autosave_screensize", "true");
|
||||
@ -220,9 +224,9 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("main_menu_path", "");
|
||||
settings->setDefault("main_menu_mod_mgr", "1");
|
||||
settings->setDefault("main_menu_game_mgr", "0");
|
||||
settings->setDefault("modstore_download_url", "https://forum.minetest.net/media/");
|
||||
settings->setDefault("modstore_listmods_url", "https://forum.minetest.net/mmdb/mods/");
|
||||
settings->setDefault("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/");
|
||||
settings->setDefault("modstore_download_url", "https://forum.minetest.org/media/");
|
||||
settings->setDefault("modstore_listmods_url", "https://forum.minetest.org/mmdb/mods/");
|
||||
settings->setDefault("modstore_details_url", "https://forum.minetest.org/mmdb/mod/*/");
|
||||
settings->setDefault("serverlist_file", "favoriteservers.txt");
|
||||
|
||||
#if USE_FREETYPE
|
||||
@ -252,6 +256,7 @@ void set_default_settings(Settings *settings)
|
||||
|
||||
// Server
|
||||
settings->setDefault("disable_escape_sequences", "false");
|
||||
settings->setDefault("strip_color_codes", "false");
|
||||
|
||||
// Network
|
||||
settings->setDefault("enable_ipv6", "true");
|
||||
@ -265,9 +270,9 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("max_simultaneous_block_sends_server_total", "40");
|
||||
settings->setDefault("time_send_interval", "5");
|
||||
|
||||
settings->setDefault("default_game", "minetest");
|
||||
settings->setDefault("motd", "");
|
||||
settings->setDefault("max_users", "15");
|
||||
settings->setDefault("default_game", PROJECT_NAME);// use minetest as game name not mientest4
|
||||
settings->setDefault("motd", "minetest 4 server");
|
||||
settings->setDefault("max_users", "32");
|
||||
settings->setDefault("creative_mode", "false");
|
||||
settings->setDefault("show_statusline_on_connect", "true");
|
||||
settings->setDefault("enable_damage", "true");
|
||||
@ -285,7 +290,7 @@ void set_default_settings(Settings *settings)
|
||||
|
||||
settings->setDefault("kick_msg_shutdown", "Server shutting down.");
|
||||
settings->setDefault("kick_msg_crash", "This server has experienced an internal error. You will now be disconnected.");
|
||||
settings->setDefault("ask_reconnect_on_crash", "false");
|
||||
settings->setDefault("ask_reconnect_on_crash", "true");
|
||||
|
||||
settings->setDefault("profiler_print_interval", "0");
|
||||
settings->setDefault("active_object_send_range_blocks", "3");
|
||||
|
@ -431,8 +431,10 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir,
|
||||
VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
|
||||
MapNode(dp.c_wall),
|
||||
0);
|
||||
makeHole(p);
|
||||
makeHole(p - dir);
|
||||
makeFill(p, dp.holesize, VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
|
||||
MapNode(CONTENT_AIR), VMANIP_FLAG_DUNGEON_INSIDE);
|
||||
makeFill(p - dir, dp.holesize, VMANIP_FLAG_DUNGEON_UNTOUCHABLE,
|
||||
MapNode(CONTENT_AIR), VMANIP_FLAG_DUNGEON_INSIDE);
|
||||
|
||||
// TODO: fix stairs code so it works 100%
|
||||
// (quite difficult)
|
||||
@ -451,16 +453,21 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir,
|
||||
v3s16 swv = (dir.Z != 0) ? v3s16(1, 0, 0) : v3s16(0, 0, 1);
|
||||
|
||||
for (u16 st = 0; st < stair_width; st++) {
|
||||
u32 vi = vm->m_area.index(ps.X - dir.X, ps.Y - 1, ps.Z - dir.Z);
|
||||
if (vm->m_area.contains(ps + v3s16(-dir.X, -1, -dir.Z)) &&
|
||||
vm->m_data[vi].getContent() == dp.c_wall)
|
||||
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
|
||||
|
||||
vi = vm->m_area.index(ps.X, ps.Y, ps.Z);
|
||||
if (vm->m_area.contains(ps) &&
|
||||
vm->m_data[vi].getContent() == dp.c_wall)
|
||||
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
|
||||
|
||||
if (make_stairs == -1) {
|
||||
u32 vi = vm->m_area.index(ps.X - dir.X, ps.Y - 1, ps.Z - dir.Z);
|
||||
if (vm->m_area.contains(ps + v3s16(-dir.X, -1, -dir.Z)) &&
|
||||
vm->m_data[vi].getContent() == dp.c_wall) {
|
||||
vm->m_flags[vi] |= VMANIP_FLAG_DUNGEON_UNTOUCHABLE;
|
||||
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
|
||||
}
|
||||
} else if (make_stairs == 1) {
|
||||
u32 vi = vm->m_area.index(ps.X, ps.Y - 1, ps.Z);
|
||||
if (vm->m_area.contains(ps + v3s16(0, -1, 0)) &&
|
||||
vm->m_data[vi].getContent() == dp.c_wall) {
|
||||
vm->m_flags[vi] |= VMANIP_FLAG_DUNGEON_UNTOUCHABLE;
|
||||
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
|
||||
}
|
||||
}
|
||||
ps += swv;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user