fix mergeconflicts
commit
f70ddf9998
|
@ -0,0 +1,28 @@
|
|||
BasedOnStyle: LLVM
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Custom
|
||||
Standard: Cpp03
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: false
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AccessModifierOffset: -8
|
||||
ColumnLimit: 90
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
SortIncludes: false
|
||||
IncludeCategories:
|
||||
- Regex: '^".*'
|
||||
Priority: 2
|
||||
- Regex: '^<.*'
|
||||
Priority: 1
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
ContinuationIndentWidth: 16
|
|
@ -43,6 +43,8 @@ gtags.files
|
|||
!/mods/minetest/mods_here.txt
|
||||
/worlds
|
||||
/world/
|
||||
/clientmods/mods.conf
|
||||
/client/mod_storage/
|
||||
|
||||
## Configuration/log files
|
||||
minetest.conf
|
||||
|
@ -75,12 +77,15 @@ locale/
|
|||
*.ninja
|
||||
.ninja*
|
||||
*.gch
|
||||
cmake-build-debug/
|
||||
cmake-build-release/
|
||||
|
||||
## Android build files
|
||||
build/android/src/main/assets
|
||||
build/android/build
|
||||
build/android/deps
|
||||
build/android/libs
|
||||
build/android/jni/lib
|
||||
build/android/jni/src
|
||||
build/android/src/main/jniLibs
|
||||
build/android/obj
|
||||
|
|
|
@ -0,0 +1,223 @@
|
|||
---
|
||||
# Github repository is cloned every day on Gitlab.com
|
||||
# https://gitlab.com/minetest/minetest
|
||||
# Pipelines URL: https://gitlab.com/minetest/minetest/pipelines
|
||||
|
||||
stages:
|
||||
- build
|
||||
- package
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git"
|
||||
|
||||
.build_template: &build_definition
|
||||
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
|
||||
- make install
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 1h
|
||||
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
|
||||
##
|
||||
|
||||
# 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
|
||||
|
||||
# Stretch
|
||||
|
||||
build:debian-9:
|
||||
<<: *build_definition
|
||||
image: debian:9
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
package:debian-9:
|
||||
image: debian:9
|
||||
dependencies:
|
||||
- build:debian-9
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:debian-9:
|
||||
image: debian:9
|
||||
dependencies:
|
||||
- package:debian-9
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
|
||||
##
|
||||
## Ubuntu
|
||||
##
|
||||
|
||||
# Trusty
|
||||
|
||||
build:ubuntu-14.04:
|
||||
<<: *build_definition
|
||||
image: ubuntu:trusty
|
||||
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-14.04:
|
||||
image: ubuntu:trusty
|
||||
dependencies:
|
||||
- build:ubuntu-14.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:ubuntu-14.04:
|
||||
image: ubuntu:trusty
|
||||
dependencies:
|
||||
- package:ubuntu-14.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1
|
||||
<<: *debpkg_install
|
||||
|
||||
# Xenial
|
||||
|
||||
build:ubuntu-16.04:
|
||||
<<: *build_definition
|
||||
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:
|
||||
image: ubuntu:xenial
|
||||
dependencies:
|
||||
- build:ubuntu-16.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:ubuntu-16.04:
|
||||
image: ubuntu:xenial
|
||||
dependencies:
|
||||
- package:ubuntu-16.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
|
||||
# Yakkety
|
||||
|
||||
build:ubuntu-16.10:
|
||||
<<: *build_definition
|
||||
image: ubuntu:yakkety
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
package:ubuntu-16.10:
|
||||
image: ubuntu:yakkety
|
||||
dependencies:
|
||||
- build:ubuntu-16.10
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:ubuntu-16.10:
|
||||
image: ubuntu:yakkety
|
||||
dependencies:
|
||||
- package:ubuntu-16.10
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
|
||||
# Zesty
|
||||
|
||||
build:ubuntu-17.04:
|
||||
<<: *build_definition
|
||||
image: ubuntu:zesty
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
package:ubuntu-17.04:
|
||||
image: ubuntu:zesty
|
||||
dependencies:
|
||||
- build:ubuntu-17.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_template
|
||||
|
||||
deploy:ubuntu-17.04:
|
||||
image: ubuntu:zesty
|
||||
dependencies:
|
||||
- package:ubuntu-17.04
|
||||
variables:
|
||||
LEVELDB_PKG: libleveldb1v5
|
||||
<<: *debpkg_install
|
||||
|
||||
##
|
||||
## Fedora
|
||||
##
|
||||
|
||||
build:fedora-24:
|
||||
<<: *build_definition
|
||||
image: fedora:24
|
||||
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
|
|
@ -26,6 +26,10 @@ matrix:
|
|||
compiler: clang
|
||||
os: linux
|
||||
dist: trusty
|
||||
- env: COMPILER=none LINT=1
|
||||
compiler: clang
|
||||
os: linux
|
||||
dist: trusty
|
||||
- env: PLATFORM=Unix COMPILER=g++-6
|
||||
compiler: gcc
|
||||
os: linux
|
||||
|
|
|
@ -26,6 +26,11 @@ elseif(DEVELOPMENT_BUILD)
|
|||
set(VERSION_STRING "${VERSION_STRING}-dev")
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
# Append "-debug" to version string
|
||||
set(VERSION_STRING "${VERSION_STRING}-debug")
|
||||
endif()
|
||||
|
||||
message(STATUS "*** Will build version ${VERSION_STRING} ***")
|
||||
|
||||
|
||||
|
@ -49,7 +54,6 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
||||
endif()
|
||||
|
||||
|
||||
# Included stuff
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
|
@ -152,6 +156,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)
|
||||
|
||||
if(BUILD_CLIENT)
|
||||
|
@ -186,6 +191,10 @@ if(APPLE)
|
|||
install(FILES "misc/Info.plist" DESTINATION "${BUNDLE_PATH}/Contents")
|
||||
endif()
|
||||
|
||||
# Library pack
|
||||
find_package(GMP REQUIRED)
|
||||
find_package(Json REQUIRED)
|
||||
find_package(Lua REQUIRED)
|
||||
|
||||
# Subdirectories
|
||||
# Be sure to add all relevant definitions above this
|
||||
|
|
|
@ -25,7 +25,6 @@ If you are planning to start some significant coding, you would benefit from ask
|
|||
- Have a title which begins with a capital letter
|
||||
- Be descriptive. (e.g. no `Update init.lua` or `Fix a problem`)
|
||||
- Have a first line with less than *80 characters* and have a second line that is *empty*
|
||||
- Do **not** [sign your commits](https://git-scm.com/book/uz/v2/Git-Tools-Signing-Your-Work), as Minetest offers automatically built ppas over launchpad and it [would break](https://bugs.launchpad.net/bzr-git/+bug/1084403) if there were signed commits in master
|
||||
|
||||
4. Once you are happy with your changes, submit a pull request.
|
||||
- Open the [pull-request form](https://github.com/minetest/minetest/pull/new/master)
|
||||
|
|
|
@ -216,7 +216,7 @@ IRRLICHT_LIBRARY - Path to libIrrlicht.a/libIrrlicht.so/libIrrlic
|
|||
LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h
|
||||
LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a
|
||||
LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll
|
||||
POSTGRESQL_INCLUDE_DIR - Only when building with PostgreSQL; directory that contains libpq-fe.h
|
||||
PostgreSQL_INCLUDE_DIR - Only when building with PostgreSQL; directory that contains libpq-fe.h
|
||||
POSTGRESQL_LIBRARY - Only when building with PostgreSQL; path to libpq.a/libpq.so
|
||||
REDIS_INCLUDE_DIR - Only when building with Redis; directory that contains hiredis.h
|
||||
REDIS_LIBRARY - Only when building with Redis; path to libhiredis.a/libhiredis.so
|
||||
|
|
|
@ -35,7 +35,7 @@ TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
|
|||
TARGET_ARCH = armv7
|
||||
CROSS_PREFIX = arm-linux-androideabi-
|
||||
COMPILER_VERSION = 4.9
|
||||
HAVE_LEVELDB = 1
|
||||
HAVE_LEVELDB = 0
|
||||
|
||||
################################################################################
|
||||
# toolchain config for little endian mips
|
||||
|
@ -59,7 +59,7 @@ HAVE_LEVELDB = 1
|
|||
#CROSS_PREFIX = i686-linux-android-
|
||||
#TARGET_ARCH = x86
|
||||
#COMPILER_VERSION = 4.9
|
||||
#HAVE_LEVELDB = 1
|
||||
#HAVE_LEVELDB = 0
|
||||
|
||||
################################################################################
|
||||
ASSETS_TIMESTAMP = deps/assets_timestamp
|
||||
|
@ -84,14 +84,14 @@ OGG_TIMESTAMP = $(OGG_DIR)timestamp
|
|||
OGG_TIMESTAMP_INT = $(ANDR_ROOT)/deps/ogg_timestamp
|
||||
OGG_URL_GIT = https://github.com/vincentjames501/libvorbis-libogg-android
|
||||
|
||||
IRRLICHT_REVISION = 5122
|
||||
IRRLICHT_REVISION = 5145
|
||||
IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht/
|
||||
IRRLICHT_LIB = $(IRRLICHT_DIR)lib/Android/libIrrlicht.a
|
||||
IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp
|
||||
IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_timestamp
|
||||
IRRLICHT_URL_SVN = https://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@$(IRRLICHT_REVISION)
|
||||
|
||||
OPENSSL_VERSION = 1.0.2j
|
||||
OPENSSL_VERSION = 1.0.2k
|
||||
OPENSSL_BASEDIR = openssl-$(OPENSSL_VERSION)
|
||||
OPENSSL_DIR = $(ANDR_ROOT)/deps/$(OPENSSL_BASEDIR)/
|
||||
OPENSSL_LIB = $(OPENSSL_DIR)/libssl.so.1.0.0
|
||||
|
@ -99,7 +99,7 @@ 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.52.0
|
||||
CURL_VERSION = 7.54.0
|
||||
CURL_DIR = $(ANDR_ROOT)/deps/curl-$(CURL_VERSION)
|
||||
CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a
|
||||
CURL_TIMESTAMP = $(CURL_DIR)/timestamp
|
||||
|
@ -126,8 +126,8 @@ 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-3150200
|
||||
SQLITE3_URL = https://www.sqlite.org/2016/$(SQLITE3_FOLDER).zip
|
||||
SQLITE3_FOLDER = sqlite-amalgamation-3180000
|
||||
SQLITE3_URL = https://www.sqlite.org/2017/$(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:]]*//')
|
||||
|
@ -352,7 +352,7 @@ leveldb_download :
|
|||
fi
|
||||
|
||||
leveldb : $(LEVELDB_LIB)
|
||||
|
||||
ifeq ($(HAVE_LEVELDB),1)
|
||||
$(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${LEVELDB_TIMESTAMP_INT} ] ; then \
|
||||
|
@ -384,6 +384,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
|||
else \
|
||||
echo "nothing to be done for leveldb"; \
|
||||
fi
|
||||
endif
|
||||
|
||||
clean_leveldb :
|
||||
$(RM) -rf deps/leveldb
|
||||
|
@ -679,8 +680,7 @@ deps/${SQLITE3_FOLDER}/sqlite3.c :
|
|||
wget ${SQLITE3_URL}; \
|
||||
unzip ${SQLITE3_FOLDER}.zip; \
|
||||
ln -s ${SQLITE3_FOLDER} sqlite; \
|
||||
cd ${SQLITE3_FOLDER}; \
|
||||
patch sqlite3.c < ${ANDR_ROOT}/patches/sqlite3-readonly-fix.patch
|
||||
cd ${SQLITE3_FOLDER};
|
||||
|
||||
clean_sqlite3:
|
||||
cd deps && $(RM) -rf ${SQLITE3_FOLDER} && $(RM) -f ${SQLITE3_FOLDER}.zip && \
|
||||
|
@ -795,7 +795,10 @@ install_release:
|
|||
|
||||
prep_srcdir :
|
||||
@if [ ! -e ${ANDR_ROOT}/jni/src ]; then \
|
||||
ln -s ${PROJ_ROOT}/src ${ANDR_ROOT}/jni/src; \
|
||||
ln -s ${PROJ_ROOT}/src ${ANDR_ROOT}/jni/src; \
|
||||
fi; \
|
||||
if [ ! -e ${ANDR_ROOT}/jni/lib ]; then \
|
||||
ln -s ${PROJ_ROOT}/lib ${ANDR_ROOT}/jni/lib; \
|
||||
fi
|
||||
|
||||
clean_apk :
|
||||
|
|
|
@ -98,8 +98,8 @@ endif
|
|||
LOCAL_C_INCLUDES := \
|
||||
jni/src \
|
||||
jni/src/script \
|
||||
jni/src/lua/src \
|
||||
jni/src/jsoncpp \
|
||||
jni/lib/lua/src \
|
||||
jni/lib/jsoncpp \
|
||||
jni/src/cguittfont \
|
||||
deps/irrlicht/include \
|
||||
deps/libiconv/include \
|
||||
|
@ -134,6 +134,7 @@ LOCAL_SRC_FILES := \
|
|||
jni/src/convert_json.cpp \
|
||||
jni/src/craftdef.cpp \
|
||||
jni/src/database-dummy.cpp \
|
||||
jni/src/database-files.cpp \
|
||||
jni/src/database-sqlite3.cpp \
|
||||
jni/src/database.cpp \
|
||||
jni/src/debug.cpp \
|
||||
|
@ -142,6 +143,7 @@ LOCAL_SRC_FILES := \
|
|||
jni/src/dungeongen.cpp \
|
||||
jni/src/emerge.cpp \
|
||||
jni/src/environment.cpp \
|
||||
jni/src/face_position_cache.cpp \
|
||||
jni/src/filecache.cpp \
|
||||
jni/src/filesys.cpp \
|
||||
jni/src/fontengine.cpp \
|
||||
|
@ -185,6 +187,7 @@ LOCAL_SRC_FILES := \
|
|||
jni/src/mapnode.cpp \
|
||||
jni/src/mapsector.cpp \
|
||||
jni/src/mesh.cpp \
|
||||
jni/src/mesh_generator_thread.cpp \
|
||||
jni/src/metadata.cpp \
|
||||
jni/src/mg_biome.cpp \
|
||||
jni/src/mg_decoration.cpp \
|
||||
|
@ -267,6 +270,7 @@ LOCAL_SRC_FILES := \
|
|||
jni/src/settings.cpp \
|
||||
jni/src/wieldmesh.cpp \
|
||||
jni/src/client/clientlauncher.cpp \
|
||||
jni/src/client/inputhandler.cpp \
|
||||
jni/src/client/tile.cpp \
|
||||
jni/src/client/joystick_controller.cpp \
|
||||
jni/src/irrlicht_changes/static_text.cpp
|
||||
|
@ -290,6 +294,7 @@ LOCAL_SRC_FILES += \
|
|||
jni/src/script/common/c_types.cpp \
|
||||
jni/src/script/cpp_api/s_async.cpp \
|
||||
jni/src/script/cpp_api/s_base.cpp \
|
||||
jni/src/script/cpp_api/s_client.cpp \
|
||||
jni/src/script/cpp_api/s_entity.cpp \
|
||||
jni/src/script/cpp_api/s_env.cpp \
|
||||
jni/src/script/cpp_api/s_inventory.cpp \
|
||||
|
@ -302,14 +307,18 @@ LOCAL_SRC_FILES += \
|
|||
jni/src/script/cpp_api/s_server.cpp \
|
||||
jni/src/script/lua_api/l_areastore.cpp \
|
||||
jni/src/script/lua_api/l_base.cpp \
|
||||
jni/src/script/lua_api/l_camera.cpp \
|
||||
jni/src/script/lua_api/l_client.cpp \
|
||||
jni/src/script/lua_api/l_craft.cpp \
|
||||
jni/src/script/lua_api/l_env.cpp \
|
||||
jni/src/script/lua_api/l_inventory.cpp \
|
||||
jni/src/script/lua_api/l_item.cpp \
|
||||
jni/src/script/lua_api/l_itemstackmeta.cpp\
|
||||
jni/src/script/lua_api/l_localplayer.cpp \
|
||||
jni/src/script/lua_api/l_mainmenu.cpp \
|
||||
jni/src/script/lua_api/l_mapgen.cpp \
|
||||
jni/src/script/lua_api/l_metadata.cpp \
|
||||
jni/src/script/lua_api/l_minimap.cpp \
|
||||
jni/src/script/lua_api/l_nodemeta.cpp \
|
||||
jni/src/script/lua_api/l_nodetimer.cpp \
|
||||
jni/src/script/lua_api/l_noise.cpp \
|
||||
|
@ -318,11 +327,13 @@ LOCAL_SRC_FILES += \
|
|||
jni/src/script/lua_api/l_rollback.cpp \
|
||||
jni/src/script/lua_api/l_server.cpp \
|
||||
jni/src/script/lua_api/l_settings.cpp \
|
||||
jni/src/script/lua_api/l_sound.cpp \
|
||||
jni/src/script/lua_api/l_http.cpp \
|
||||
jni/src/script/lua_api/l_storage.cpp \
|
||||
jni/src/script/lua_api/l_util.cpp \
|
||||
jni/src/script/lua_api/l_vmanip.cpp \
|
||||
jni/src/script/scripting_game.cpp \
|
||||
jni/src/script/scripting_client.cpp \
|
||||
jni/src/script/scripting_server.cpp \
|
||||
jni/src/script/scripting_mainmenu.cpp
|
||||
|
||||
#freetype2 support
|
||||
|
@ -330,36 +341,36 @@ LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
|
|||
|
||||
# Lua
|
||||
LOCAL_SRC_FILES += \
|
||||
jni/src/lua/src/lapi.c \
|
||||
jni/src/lua/src/lauxlib.c \
|
||||
jni/src/lua/src/lbaselib.c \
|
||||
jni/src/lua/src/lcode.c \
|
||||
jni/src/lua/src/ldblib.c \
|
||||
jni/src/lua/src/ldebug.c \
|
||||
jni/src/lua/src/ldo.c \
|
||||
jni/src/lua/src/ldump.c \
|
||||
jni/src/lua/src/lfunc.c \
|
||||
jni/src/lua/src/lgc.c \
|
||||
jni/src/lua/src/linit.c \
|
||||
jni/src/lua/src/liolib.c \
|
||||
jni/src/lua/src/llex.c \
|
||||
jni/src/lua/src/lmathlib.c \
|
||||
jni/src/lua/src/lmem.c \
|
||||
jni/src/lua/src/loadlib.c \
|
||||
jni/src/lua/src/lobject.c \
|
||||
jni/src/lua/src/lopcodes.c \
|
||||
jni/src/lua/src/loslib.c \
|
||||
jni/src/lua/src/lparser.c \
|
||||
jni/src/lua/src/lstate.c \
|
||||
jni/src/lua/src/lstring.c \
|
||||
jni/src/lua/src/lstrlib.c \
|
||||
jni/src/lua/src/ltable.c \
|
||||
jni/src/lua/src/ltablib.c \
|
||||
jni/src/lua/src/ltm.c \
|
||||
jni/src/lua/src/lundump.c \
|
||||
jni/src/lua/src/lvm.c \
|
||||
jni/src/lua/src/lzio.c \
|
||||
jni/src/lua/src/print.c
|
||||
jni/lib/lua/src/lapi.c \
|
||||
jni/lib/lua/src/lauxlib.c \
|
||||
jni/lib/lua/src/lbaselib.c \
|
||||
jni/lib/lua/src/lcode.c \
|
||||
jni/lib/lua/src/ldblib.c \
|
||||
jni/lib/lua/src/ldebug.c \
|
||||
jni/lib/lua/src/ldo.c \
|
||||
jni/lib/lua/src/ldump.c \
|
||||
jni/lib/lua/src/lfunc.c \
|
||||
jni/lib/lua/src/lgc.c \
|
||||
jni/lib/lua/src/linit.c \
|
||||
jni/lib/lua/src/liolib.c \
|
||||
jni/lib/lua/src/llex.c \
|
||||
jni/lib/lua/src/lmathlib.c \
|
||||
jni/lib/lua/src/lmem.c \
|
||||
jni/lib/lua/src/loadlib.c \
|
||||
jni/lib/lua/src/lobject.c \
|
||||
jni/lib/lua/src/lopcodes.c \
|
||||
jni/lib/lua/src/loslib.c \
|
||||
jni/lib/lua/src/lparser.c \
|
||||
jni/lib/lua/src/lstate.c \
|
||||
jni/lib/lua/src/lstring.c \
|
||||
jni/lib/lua/src/lstrlib.c \
|
||||
jni/lib/lua/src/ltable.c \
|
||||
jni/lib/lua/src/ltablib.c \
|
||||
jni/lib/lua/src/ltm.c \
|
||||
jni/lib/lua/src/lundump.c \
|
||||
jni/lib/lua/src/lvm.c \
|
||||
jni/lib/lua/src/lzio.c \
|
||||
jni/lib/lua/src/print.c
|
||||
|
||||
# SQLite3
|
||||
LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
|
||||
|
@ -372,7 +383,7 @@ LOCAL_SRC_FILES += \
|
|||
jni/src/threading/thread.cpp
|
||||
|
||||
# JSONCPP
|
||||
LOCAL_SRC_FILES += jni/src/jsoncpp/json/jsoncpp.cpp
|
||||
LOCAL_SRC_FILES += jni/lib/jsoncpp/jsoncpp.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis gmp
|
||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
--- sqlite3.c 2016-11-29 02:29:24.000000000 +0000
|
||||
+++ sqlite3.c 2016-12-08 22:54:54.206465377 +0000
|
||||
@@ -30445,7 +30445,14 @@
|
||||
#if OS_VXWORKS
|
||||
struct vxworksFileId *pId; /* Unique file ID for vxworks. */
|
||||
#else
|
||||
- ino_t ino; /* Inode number */
|
||||
+ #ifdef ANDROID
|
||||
+ // Bionic's struct stat has a 64 bit st_ino on both 32 and
|
||||
+ // 64 bit architectures. ino_t remains 32 bits wide on 32 bit
|
||||
+ // architectures and can lead to inode truncation.
|
||||
+ unsigned long long ino; /* Inode number */
|
||||
+ #else
|
||||
+ ino_t ino; /* Inode number */
|
||||
+ #endif
|
||||
#endif
|
||||
};
|
|
@ -0,0 +1,65 @@
|
|||
-- Minetest: builtin/client/chatcommands.lua
|
||||
|
||||
|
||||
core.register_on_sending_chat_messages(function(message)
|
||||
if message:sub(1,2) == ".." then
|
||||
return false
|
||||
end
|
||||
|
||||
local first_char = message:sub(1,1)
|
||||
if first_char == "/" or first_char == "." then
|
||||
core.display_chat_message(core.gettext("issued command: ") .. message)
|
||||
end
|
||||
|
||||
if first_char ~= "." then
|
||||
return false
|
||||
end
|
||||
|
||||
local cmd, param = string.match(message, "^%.([^ ]+) *(.*)")
|
||||
param = param or ""
|
||||
|
||||
if not cmd then
|
||||
core.display_chat_message(core.gettext("-!- Empty command"))
|
||||
return true
|
||||
end
|
||||
|
||||
local cmd_def = core.registered_chatcommands[cmd]
|
||||
if cmd_def then
|
||||
core.set_last_run_mod(cmd_def.mod_origin)
|
||||
local _, message = cmd_def.func(param)
|
||||
if message then
|
||||
core.display_chat_message(message)
|
||||
end
|
||||
else
|
||||
core.display_chat_message(core.gettext("-!- Invalid command: ") .. cmd)
|
||||
end
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
core.register_chatcommand("list_players", {
|
||||
description = core.gettext("List online players"),
|
||||
func = function(param)
|
||||
local players = table.concat(core.get_player_names(), ", ")
|
||||
core.display_chat_message(core.gettext("Online players: ") .. players)
|
||||
end
|
||||
})
|
||||
|
||||
core.register_chatcommand("disconnect", {
|
||||
description = core.gettext("Exit to main menu"),
|
||||
func = function(param)
|
||||
core.disconnect()
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("clear_chat_queue", {
|
||||
description = core.gettext("Clear the out chat queue"),
|
||||
func = function(param)
|
||||
core.clear_out_chat_queue()
|
||||
return true, core.gettext("The out chat queue is now empty")
|
||||
end,
|
||||
})
|
||||
|
||||
function core.run_server_chatcommand(cmd, param)
|
||||
core.send_chat_message("/" .. cmd .. " " .. param)
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
-- Minetest: builtin/client/init.lua
|
||||
local scriptpath = core.get_builtin_path()..DIR_DELIM
|
||||
local clientpath = scriptpath.."client"..DIR_DELIM
|
||||
local commonpath = scriptpath.."common"..DIR_DELIM
|
||||
|
||||
dofile(clientpath .. "register.lua")
|
||||
dofile(commonpath .. "after.lua")
|
||||
dofile(commonpath .. "chatcommands.lua")
|
||||
dofile(clientpath .. "chatcommands.lua")
|
||||
dofile(commonpath .. "vector.lua")
|
||||
|
||||
core.register_on_death(function()
|
||||
core.display_chat_message("You died.")
|
||||
local formspec = "size[11,5.5]bgcolor[#320000b4;true]" ..
|
||||
"label[4.85,1.35;" .. fgettext("You died.") .. "]button_exit[4,3;3,0.5;btn_respawn;".. fgettext("Respawn") .."]"
|
||||
core.show_formspec("bultin:death", formspec)
|
||||
end)
|
||||
|
||||
core.register_on_formspec_input(function(formname, fields)
|
||||
if formname == "bultin:death" then
|
||||
core.send_respawn()
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,73 @@
|
|||
|
||||
core.callback_origins = {}
|
||||
|
||||
local getinfo = debug.getinfo
|
||||
debug.getinfo = nil
|
||||
|
||||
function core.run_callbacks(callbacks, mode, ...)
|
||||
assert(type(callbacks) == "table")
|
||||
local cb_len = #callbacks
|
||||
if cb_len == 0 then
|
||||
if mode == 2 or mode == 3 then
|
||||
return true
|
||||
elseif mode == 4 or mode == 5 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
local ret
|
||||
for i = 1, cb_len do
|
||||
local cb_ret = callbacks[i](...)
|
||||
|
||||
if mode == 0 and i == 1 or mode == 1 and i == cb_len then
|
||||
ret = cb_ret
|
||||
elseif mode == 2 then
|
||||
if not cb_ret or i == 1 then
|
||||
ret = cb_ret
|
||||
end
|
||||
elseif mode == 3 then
|
||||
if cb_ret then
|
||||
return cb_ret
|
||||
end
|
||||
ret = cb_ret
|
||||
elseif mode == 4 then
|
||||
if (cb_ret and not ret) or i == 1 then
|
||||
ret = cb_ret
|
||||
end
|
||||
elseif mode == 5 and cb_ret then
|
||||
return cb_ret
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
--
|
||||
-- Callback registration
|
||||
--
|
||||
|
||||
local function make_registration()
|
||||
local t = {}
|
||||
local registerfunc = function(func)
|
||||
t[#t + 1] = func
|
||||
core.callback_origins[func] = {
|
||||
mod = core.get_current_modname() or "??",
|
||||
name = getinfo(1, "n").name or "??"
|
||||
}
|
||||
--local origin = core.callback_origins[func]
|
||||
--print(origin.name .. ": " .. origin.mod .. " registering cbk " .. tostring(func))
|
||||
end
|
||||
return t, registerfunc
|
||||
end
|
||||
|
||||
core.registered_globalsteps, core.register_globalstep = make_registration()
|
||||
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
|
||||
core.registered_on_connect, core.register_on_connect = make_registration()
|
||||
core.registered_on_receiving_chat_messages, core.register_on_receiving_chat_messages = make_registration()
|
||||
core.registered_on_sending_chat_messages, core.register_on_sending_chat_messages = make_registration()
|
||||
core.registered_on_death, core.register_on_death = make_registration()
|
||||
core.registered_on_hp_modification, core.register_on_hp_modification = make_registration()
|
||||
core.registered_on_damage_taken, core.register_on_damage_taken = make_registration()
|
||||
core.registered_on_formspec_input, core.register_on_formspec_input = make_registration()
|
||||
core.registered_on_dignode, core.register_on_dignode = make_registration()
|
||||
core.registered_on_punchnode, core.register_on_punchnode = make_registration()
|
||||
core.registered_on_placenode, core.register_on_placenode = make_registration()
|
||||
core.registered_on_item_use, core.register_on_item_use = make_registration()
|
|
@ -0,0 +1,33 @@
|
|||
local jobs = {}
|
||||
local time = 0.0
|
||||
|
||||
core.register_globalstep(function(dtime)
|
||||
time = time + dtime
|
||||
|
||||
if #jobs < 1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- Iterate backwards so that we miss any new timers added by
|
||||
-- a timer callback, and so that we don't skip the next timer
|
||||
-- in the list if we remove one.
|
||||
for i = #jobs, 1, -1 do
|
||||
local job = jobs[i]
|
||||
if time >= job.expire then
|
||||
core.set_last_run_mod(job.mod_origin)
|
||||
job.func(unpack(job.arg))
|
||||
table.remove(jobs, i)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function core.after(after, func, ...)
|
||||
assert(tonumber(after) and type(func) == "function",
|
||||
"Invalid core.after invocation")
|
||||
jobs[#jobs + 1] = {
|
||||
func = func,
|
||||
expire = time + after,
|
||||
arg = {...},
|
||||
mod_origin = core.get_last_run_mod()
|
||||
}
|
||||
end
|
|
@ -0,0 +1,112 @@
|
|||
-- Minetest: builtin/common/chatcommands.lua
|
||||
|
||||
core.registered_chatcommands = {}
|
||||
|
||||
function core.register_chatcommand(cmd, def)
|
||||
def = def or {}
|
||||
def.params = def.params or ""
|
||||
def.description = def.description or ""
|
||||
def.privs = def.privs or {}
|
||||
def.mod_origin = core.get_current_modname() or "??"
|
||||
core.registered_chatcommands[cmd] = def
|
||||
end
|
||||
|
||||
function core.unregister_chatcommand(name)
|
||||
if core.registered_chatcommands[name] then
|
||||
core.registered_chatcommands[name] = nil
|
||||
else
|
||||
core.log("warning", "Not unregistering chatcommand " ..name..
|
||||
" because it doesn't exist.")
|
||||
end
|
||||
end
|
||||
|
||||
function core.override_chatcommand(name, redefinition)
|
||||
local chatcommand = core.registered_chatcommands[name]
|
||||
assert(chatcommand, "Attempt to override non-existent chatcommand "..name)
|
||||
for k, v in pairs(redefinition) do
|
||||
rawset(chatcommand, k, v)
|
||||
end
|
||||
core.registered_chatcommands[name] = chatcommand
|
||||
end
|
||||
|
||||
local cmd_marker = "/"
|
||||
|
||||
local function gettext(...)
|
||||
return ...
|
||||
end
|
||||
|
||||
local function gettext_replace(text, replace)
|
||||
return text:gsub("$1", replace)
|
||||
end
|
||||
|
||||
|
||||
if INIT == "client" then
|
||||
cmd_marker = "."
|
||||
gettext = core.gettext
|
||||
gettext_replace = fgettext_ne
|
||||
end
|
||||
|
||||
local function do_help_cmd(name, param)
|
||||
local function format_help_line(cmd, def)
|
||||
local msg = core.colorize("#00ffff", cmd_marker .. cmd)
|
||||
if def.params and def.params ~= "" then
|
||||
msg = msg .. " " .. def.params
|
||||
end
|
||||
if def.description and def.description ~= "" then
|
||||
msg = msg .. ": " .. def.description
|
||||
end
|
||||
return msg
|
||||
end
|
||||
if param == "" then
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(core.registered_chatcommands) do
|
||||
if INIT == "client" or core.check_player_privs(name, def.privs) then
|
||||
cmds[#cmds + 1] = cmd
|
||||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, gettext("Available commands: ") .. table.concat(cmds, " ") .. "\n"
|
||||
.. gettext_replace("Use '$1help <cmd>' to get more information,"
|
||||
.. " or '$1help all' to list everything.", cmd_marker)
|
||||
elseif param == "all" then
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(core.registered_chatcommands) do
|
||||
if INIT == "client" or core.check_player_privs(name, def.privs) then
|
||||
cmds[#cmds + 1] = format_help_line(cmd, def)
|
||||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, gettext("Available commands:").."\n"..table.concat(cmds, "\n")
|
||||
elseif INIT == "game" and param == "privs" then
|
||||
local privs = {}
|
||||
for priv, def in pairs(core.registered_privileges) do
|
||||
privs[#privs + 1] = priv .. ": " .. def.description
|
||||
end
|
||||
table.sort(privs)
|
||||
return true, "Available privileges:\n"..table.concat(privs, "\n")
|
||||
else
|
||||
local cmd = param
|
||||
local def = core.registered_chatcommands[cmd]
|
||||
if not def then
|
||||
return false, gettext("Command not available: ")..cmd
|
||||
else
|
||||
return true, format_help_line(cmd, def)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if INIT == "client" then
|
||||
core.register_chatcommand("help", {
|
||||
params = gettext("[all/<cmd>]"),
|
||||
description = gettext("Get help for commands"),
|
||||
func = function(param)
|
||||
return do_help_cmd(nil, param)
|
||||
end,
|
||||
})
|
||||
else
|
||||
core.register_chatcommand("help", {
|
||||
params = "[all/privs/<cmd>]",
|
||||
description = "Get help for commands or list privileges",
|
||||
func = do_help_cmd,
|
||||
})
|
||||
end
|
|
@ -289,6 +289,9 @@ function sort_mod_list(self)
|
|||
table.sort(self.m_processed_list, function(a, b)
|
||||
-- Show game mods at bottom
|
||||
if a.typ ~= b.typ then
|
||||
if b.typ == "game" then
|
||||
return a.typ ~= "game_mod"
|
||||
end
|
||||
return b.typ == "game_mod"
|
||||
end
|
||||
-- If in same or no modpack, sort by name
|
||||
|
|
|
@ -197,16 +197,17 @@ assert(table.indexof({"foo", "bar"}, "foo") == 1)
|
|||
assert(table.indexof({"foo", "bar"}, "baz") == -1)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function file_exists(filename)
|
||||
local f = io.open(filename, "r")
|
||||
if f == nil then
|
||||
return false
|
||||
else
|
||||
f:close()
|
||||
return true
|
||||
if INIT ~= "client" then
|
||||
function file_exists(filename)
|
||||
local f = io.open(filename, "r")
|
||||
if f == nil then
|
||||
return false
|
||||
else
|
||||
f:close()
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function string:trim()
|
||||
return (self:gsub("^%s*(.-)%s*$", "%1"))
|
||||
|
@ -307,7 +308,7 @@ function core.formspec_escape(text)
|
|||
end
|
||||
|
||||
|
||||
function core.splittext(text,charlimit)
|
||||
function core.wrap_text(text, charlimit)
|
||||
local retval = {}
|
||||
|
||||
local current_idx = 1
|
||||
|
@ -462,7 +463,7 @@ if INIT == "game" then
|
|||
|
||||
core.rotate_node = function(itemstack, placer, pointed_thing)
|
||||
core.rotate_and_place(itemstack, placer, pointed_thing,
|
||||
core.setting_getbool("creative_mode"),
|
||||
core.settings:get_bool("creative_mode"),
|
||||
{invert_wall = placer:get_player_control().sneak})
|
||||
return itemstack
|
||||
end
|
||||
|
@ -606,7 +607,9 @@ if INIT == "mainmenu" then
|
|||
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
if INIT == "client" or INIT == "mainmenu" then
|
||||
function fgettext_ne(text, ...)
|
||||
text = core.gettext(text)
|
||||
local arg = {n=select('#', ...), ...}
|
||||
|
@ -637,3 +640,86 @@ if INIT == "mainmenu" then
|
|||
end
|
||||
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
|
||||
|
||||
end
|
||||
|
||||
function core.strip_foreground_colors(str)
|
||||
return (str:gsub(ESCAPE_CHAR .. "%(c@[^)]+%)", ""))
|
||||
end
|
||||
|
||||
function core.strip_background_colors(str)
|
||||
return (str:gsub(ESCAPE_CHAR .. "%(b@[^)]+%)", ""))
|
||||
end
|
||||
|
||||
function core.strip_colors(str)
|
||||
return (str:gsub(ESCAPE_CHAR .. "%([bc]@[^)]+%)", ""))
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Returns the exact coordinate of a pointed surface
|
||||
--------------------------------------------------------------------------------
|
||||
function core.pointed_thing_to_face_pos(placer, pointed_thing)
|
||||
local eye_offset_first = placer:get_eye_offset()
|
||||
local node_pos = pointed_thing.under
|
||||
local camera_pos = placer:get_pos()
|
||||
local pos_off = vector.multiply(
|
||||
vector.subtract(pointed_thing.above, node_pos), 0.5)
|
||||
local look_dir = placer:get_look_dir()
|
||||
local offset, nc
|
||||
local oc = {}
|
||||
|
||||
for c, v in pairs(pos_off) do
|
||||
if nc or v == 0 then
|
||||
oc[#oc + 1] = c
|
||||
else
|
||||
offset = v
|
||||
nc = c
|
||||
end
|
||||
end
|
||||
|
||||
local fine_pos = {[nc] = node_pos[nc] + offset}
|
||||
camera_pos.y = camera_pos.y + 1.625 + eye_offset_first.y / 10
|
||||
local f = (node_pos[nc] + offset - camera_pos[nc]) / look_dir[nc]
|
||||
|
||||
for i = 1, #oc do
|
||||
fine_pos[oc[i]] = camera_pos[oc[i]] + look_dir[oc[i]] * f
|
||||
end
|
||||
return fine_pos
|
||||
end
|
||||
|
|
|
@ -186,6 +186,10 @@ local safe_env = {
|
|||
}
|
||||
|
||||
function core.deserialize(str, safe)
|
||||
if type(str) ~= "string" then
|
||||
return nil, "Cannot deserialize type '"..type(str)
|
||||
.."'. Argument must be a string."
|
||||
end
|
||||
if str:byte(1) == 0x1B then
|
||||
return nil, "Bytecode prohibited"
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
-- This ignores mod namespaces (variables with the same name as the current mod).
|
||||
local WARN_INIT = false
|
||||
|
||||
local getinfo = debug.getinfo
|
||||
|
||||
function core.global_exists(name)
|
||||
if type(name) ~= "string" then
|
||||
|
@ -18,7 +19,7 @@ local declared = {}
|
|||
local warned = {}
|
||||
|
||||
function meta:__newindex(name, value)
|
||||
local info = debug.getinfo(2, "Sl")
|
||||
local info = getinfo(2, "Sl")
|
||||
local desc = ("%s:%d"):format(info.short_src, info.currentline)
|
||||
if not declared[name] then
|
||||
local warn_key = ("%s\0%d\0%s"):format(info.source,
|
||||
|
@ -42,7 +43,7 @@ end
|
|||
|
||||
|
||||
function meta:__index(name)
|
||||
local info = debug.getinfo(2, "Sl")
|
||||
local info = getinfo(2, "Sl")
|
||||
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
|
||||
if not declared[name] and not warned[warn_key] and info.what ~= "C" then
|
||||
core.log("warning", ("Undeclared global variable %q accessed at %s:%s")
|
||||
|
|
|
@ -167,7 +167,7 @@ local function switch_to_tab(self, index)
|
|||
self.current_tab = self.tablist[index].name
|
||||
|
||||
if (self.autosave_tab) then
|
||||
core.setting_set(self.name .. "_LAST",self.current_tab)
|
||||
core.settings:set(self.name .. "_LAST",self.current_tab)
|
||||
end
|
||||
|
||||
-- call for tab to enter
|
||||
|
|
|
@ -106,7 +106,7 @@ core.builtin_auth_handler = {
|
|||
end
|
||||
end
|
||||
-- For the admin, give everything
|
||||
elseif name == core.setting_get("name") then
|
||||
elseif name == core.settings:get("name") then
|
||||
for priv, def in pairs(core.registered_privileges) do
|
||||
privileges[priv] = true
|
||||
end
|
||||
|
@ -125,7 +125,7 @@ core.builtin_auth_handler = {
|
|||
core.log('info', "Built-in authentication handler adding player '"..name.."'")
|
||||
core.auth_table[name] = {
|
||||
password = password,
|
||||
privileges = core.string_to_privs(core.setting_get("default_privs")),
|
||||
privileges = core.string_to_privs(core.settings:get("default_privs")),
|
||||
last_login = os.time(),
|
||||
}
|
||||
save_auth_file()
|
||||
|
@ -148,7 +148,7 @@ core.builtin_auth_handler = {
|
|||
if not core.auth_table[name] then
|
||||
core.builtin_auth_handler.create_auth(name,
|
||||
core.get_password_hash(name,
|
||||
core.setting_get("default_password")))
|
||||
core.settings:get("default_password")))
|
||||
end
|
||||
core.auth_table[name].privileges = privileges
|
||||
core.notify_authentication_modified(name)
|
||||
|
|
|
@ -1,58 +1,28 @@
|
|||
-- Minetest: builtin/chatcommands.lua
|
||||
-- Minetest: builtin/game/chatcommands.lua
|
||||
|
||||
--
|
||||
-- Chat command handler
|
||||
--
|
||||
|
||||
core.registered_chatcommands = {}
|
||||
core.chatcommands = core.registered_chatcommands -- BACKWARDS COMPATIBILITY
|
||||
function core.register_chatcommand(cmd, def)
|
||||
def = def or {}
|
||||
def.params = def.params or ""
|
||||
def.description = def.description or ""
|
||||
def.privs = def.privs or {}
|
||||
def.mod_origin = core.get_current_modname() or "??"
|
||||
core.registered_chatcommands[cmd] = def
|
||||
end
|
||||
|
||||
function core.unregister_chatcommand(name)
|
||||
if core.registered_chatcommands[name] then
|
||||
core.registered_chatcommands[name] = nil
|
||||
else
|
||||
core.log("warning", "Not unregistering chatcommand " ..name..
|
||||
" because it doesn't exist.")
|
||||
end
|
||||
end
|
||||
|
||||
function core.override_chatcommand(name, redefinition)
|
||||
local chatcommand = core.registered_chatcommands[name]
|
||||
assert(chatcommand, "Attempt to override non-existent chatcommand "..name)
|
||||
for k, v in pairs(redefinition) do
|
||||
rawset(chatcommand, k, v)
|
||||
end
|
||||
core.registered_chatcommands[name] = chatcommand
|
||||
end
|
||||
|
||||
--[[ https://github.com/minetest/minetest/issues/4976
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
if message:sub(1,1) == "/" then
|
||||
return false
|
||||
else
|
||||
minetest.chat_send_all("" ..core.colorize("#A3B5CB", "<"..name.."> ") .. core.colorize("#66BEF5", message))
|
||||
return ""
|
||||
end
|
||||
return ""
|
||||
end)
|
||||
]]
|
||||
|
||||
core.register_on_chat_message(function(name, message)
|
||||
local cmd, param = string.match(message, "^/([^ ]+) *(.*)")
|
||||
if not param then
|
||||
param = ""
|
||||
if message:sub(1,1) ~= "/" then
|
||||
return
|
||||
end
|
||||
|
||||
local cmd, param = string.match(message, "^/([^ ]+) *(.*)")
|
||||
if not cmd then
|
||||
core.chat_send_player(name, "-!- Empty command")
|
||||
return true
|
||||
end
|
||||
|
||||
param = param or ""
|
||||
|
||||
local cmd_def = core.registered_chatcommands[cmd]
|
||||
if not cmd_def then
|
||||
return false
|
||||
core.chat_send_player(name, "-!- Invalid command: " .. cmd)
|
||||
return true
|
||||
end
|
||||
local has_privs, missing_privs = core.check_player_privs(name, cmd_def.privs)
|
||||
if has_privs then
|
||||
|
@ -69,7 +39,7 @@ core.register_on_chat_message(function(name, message)
|
|||
return true -- Handled chat message
|
||||
end)
|
||||
|
||||
if core.setting_getbool("profiler.load") then
|
||||
if core.settings:get_bool("profiler.load") then
|
||||
-- Run after register_chatcommand and its register_on_chat_message
|
||||
-- Before any chattcommands that should be profiled
|
||||
profiler.init_chatcommand()
|
||||
|
@ -112,7 +82,7 @@ core.register_chatcommand("me", {
|
|||
core.register_chatcommand("admin", {
|
||||
description = "Show the name of the server owner",
|
||||
func = function(name)
|
||||
local admin = minetest.setting_get("name")
|
||||
local admin = minetest.settings:get("name")
|
||||
if admin then
|
||||
return true, core.colorize("#F6A10A", "# Illuna: The administrator of this server is "..admin..".")
|
||||
else
|
||||
|
@ -121,61 +91,6 @@ core.register_chatcommand("admin", {
|
|||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("help", {
|
||||
privs = {},
|
||||
params = "[all/privs/<cmd>]",
|
||||
description = "Get help for commands or list privileges",
|
||||
func = function(name, param)
|
||||
local function format_help_line(cmd, def)
|
||||
local msg = core.colorize("#A3B5CB", "/")..core.colorize("#A3B5CB", cmd)
|
||||
if def.params and def.params ~= "" then
|
||||
msg = msg .. " " .. def.params
|
||||
end
|
||||
if def.description and def.description ~= "" then
|
||||
msg = msg .. ": " .. def.description
|
||||
end
|
||||
return msg
|
||||
end
|
||||
if param == "" then
|
||||
local msg = ""
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(core.registered_chatcommands) do
|
||||
if core.check_player_privs(name, def.privs) then
|
||||
cmds[#cmds + 1] = cmd
|
||||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Available commands: ") .. core.colorize("#66BEF5", table.concat(cmds, " ") .. "\n")
|
||||
.. core.colorize("#F6A10A", "# Illuna: Use '/help <cmd>' to get more information,"
|
||||
.. " or '/help all' to list everything.")
|
||||
elseif param == "all" then
|
||||
local cmds = {}
|
||||
for cmd, def in pairs(core.registered_chatcommands) do
|
||||
if core.check_player_privs(name, def.privs) then
|
||||
cmds[#cmds + 1] = format_help_line(cmd, def)
|
||||
end
|
||||
end
|
||||
table.sort(cmds)
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Available commands:\n")..table.concat(cmds, "\n")
|
||||
elseif param == "privs" then
|
||||
local privs = {}
|
||||
for priv, def in pairs(core.registered_privileges) do
|
||||
privs[#privs + 1] = priv .. ": " .. def.description
|
||||
end
|
||||
table.sort(privs)
|
||||
return true, core.colorize("#F6A10A", "# Illuna: Available privileges:\n")..table.concat(privs, "\n")
|
||||
else
|
||||
local cmd = param
|
||||
local def = core.registered_chatcommands[cmd]
|
||||
if not def then
|
||||
return false, core.colorize("#F35400", "# Illuna: Sorry, this command is not available: "..cmd)
|
||||
else
|
||||
return true, format_help_line(cmd, def)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("privs", {
|
||||
params = "<name>",
|
||||
description = "Print privileges of player",
|
||||
|
@ -203,7 +118,7 @@ local function handle_grant_command(caller, grantname, grantprivstr)
|
|||
local privs = core.get_player_privs(grantname)
|
||||
local privs_unknown = ""
|
||||
local basic_privs =
|
||||
core.string_to_privs(core.setting_get("basic_privs") or "interact,shout")
|
||||
core.string_to_privs(core.settings:get("basic_privs") or "interact,shout")
|
||||
for priv, _ in pairs(grantprivs) do
|
||||
if not basic_privs[priv] and not caller_privs.privs then
|
||||
return false, core.colorize("#F35400", "# Illuna: Your privileges are insufficient.")
|
||||
|
@ -269,7 +184,7 @@ core.register_chatcommand("revoke", {
|
|||
local revoke_privs = core.string_to_privs(revoke_priv_str)
|
||||
local privs = core.get_player_privs(revoke_name)
|
||||
local basic_privs =
|
||||
core.string_to_privs(core.setting_get("basic_privs") or "interact,shout")
|
||||
core.string_to_privs(core.settings:get("basic_privs") or "interact,shout")
|
||||
for priv, _ in pairs(revoke_privs) do
|
||||
if not basic_privs[priv] and
|
||||
not core.check_player_privs(name, {privs=true}) then
|
||||
|
@ -363,6 +278,31 @@ core.register_chatcommand("auth_reload", {
|
|||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("remove_player", {
|
||||
params = "<name>",
|
||||
description = "Remove player data",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local toname = param
|
||||
if toname == "" then
|
||||
return false, "Name field required"
|
||||
end
|
||||
|
||||
local rc = core.remove_player(toname)
|
||||
|
||||
if rc == 0 then
|
||||
core.log("action", name .. " removed player data of " .. toname .. ".")
|
||||
return true, "Player \"" .. toname .. "\" removed."
|
||||
elseif rc == 1 then
|
||||
return true, "No such player \"" .. toname .. "\" to remove."
|
||||
elseif rc == 2 then
|
||||
return true, "Player \"" .. toname .. "\" is connected, cannot remove."
|
||||
end
|
||||
|
||||
return false, "Unhandled remove_player return code " .. rc .. ""
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("teleport", {
|
||||
params = "<X>,<Y>,<Z> | <to_name> | <name> <X>,<Y>,<Z> | <name> <to_name>",
|
||||
description = "Teleport to player or position",
|
||||
|
@ -396,7 +336,7 @@ core.register_chatcommand("teleport", {
|
|||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
if p.x and p.y and p.z then
|
||||
local lm = tonumber(minetest.setting_get("map_generation_limit") or 31000)
|
||||
local lm = 31000
|
||||
if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm or p.z < -lm or p.z > lm then
|
||||
return false, core.colorize("#F35400", "# Illuna: Aww... cannot teleport out of map bounds!")
|
||||
end
|
||||
|
@ -478,20 +418,20 @@ core.register_chatcommand("set", {
|
|||
func = function(name, param)
|
||||
local arg, setname, setvalue = string.match(param, "(-[n]) ([^ ]+) (.+)")
|
||||
if arg and arg == "-n" and setname and setvalue then
|
||||
core.setting_set(setname, setvalue)
|
||||
core.settings:set(setname, setvalue)
|
||||
return true, setname .. " = " .. setvalue
|
||||
end
|
||||
local setname, setvalue = string.match(param, "([^ ]+) (.+)")
|
||||
if setname and setvalue then
|
||||
if not core.setting_get(setname) then
|
||||
if not core.settings:get(setname) then
|
||||
return false, core.colorize("#F35400", "# Illuna: Failed. Use '/set -n <name> <value>' to create a new setting.")
|
||||
end
|
||||
core.setting_set(setname, setvalue)
|
||||
core.settings:set(setname, setvalue)
|
||||
return true, setname .. " = " .. setvalue
|
||||
end
|
||||
local setname = string.match(param, "([^ ]+)")
|
||||
if setname then
|
||||
local setvalue = core.setting_get(setname)
|
||||
local setvalue = core.settings:get(setname)
|
||||
if not setvalue then
|
||||
setvalue = "<not set>"
|
||||
end
|
||||
|
@ -571,6 +511,25 @@ core.register_chatcommand("deleteblocks", {
|
|||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("fixlight", {
|
||||
params = "(here [radius]) | (<pos1> <pos2>)",
|
||||
description = "Resets lighting in the area between pos1 and pos2",
|
||||
privs = {server = true},
|
||||
func = function(name, param)
|
||||
local p1, p2 = parse_range_str(name, param)
|
||||
if p1 == false then
|
||||
return false, p2
|
||||
end
|
||||
|
||||
if core.fix_light(p1, p2) then
|
||||
return true, "Successfully reset light in the area ranging from " ..
|
||||
core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1)
|
||||
else
|
||||
return false, "Failed to load one or more blocks in area"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("mods", {
|
||||
params = "",
|
||||
description = "List mods installed on the server",
|
||||
|
@ -707,7 +666,7 @@ core.register_chatcommand("rollback_check", {
|
|||
.. " seconds = 86400 = 24h, limit = 5",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.setting_getbool("enable_rollback_recording") then
|
||||
if not core.settings:get_bool("enable_rollback_recording") then
|
||||
return false, "Rollback functions are disabled."
|
||||
end
|
||||
local range, seconds, limit =
|
||||
|
@ -758,7 +717,7 @@ core.register_chatcommand("rollback", {
|
|||
description = "Revert actions of a player. Default for <seconds> is 60",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.setting_getbool("enable_rollback_recording") then
|
||||
if not core.settings:get_bool("enable_rollback_recording") then
|
||||
return false, core.colorize("#F35400", "# Illuna: Rollback functions are disabled.")
|
||||
end
|
||||
local target_name, seconds = string.match(param, ":([^ ]+) *(%d*)")
|
||||
|
@ -847,14 +806,20 @@ core.register_chatcommand("days", {
|
|||
|
||||
core.register_chatcommand("shutdown", {
|
||||
description = "Shutdown server",
|
||||
params = "[reconnect] [message]",
|
||||
params = "[delay_in_seconds(0..inf) or -1 for cancel] [reconnect] [message]",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
core.log("action", name .. " shuts down server")
|
||||
core.chat_send_all("*** Server shutting down (operator request).")
|
||||
local reconnect, message = param:match("([^ ]+)(.*)")
|
||||
local delay, reconnect, message = param:match("([^ ][-]?[0-9]+)([^ ]+)(.*)")
|
||||
message = message or ""
|
||||
core.request_shutdown(message:trim(), core.is_yes(reconnect))
|
||||
|
||||
if delay ~= "" then
|
||||
delay = tonumber(param) or 0
|
||||
else
|
||||
delay = 0
|
||||
core.log("action", name .. " shuts down server")
|
||||
core.chat_send_all("*** Server shutting down (operator request).")
|
||||
end
|
||||
core.request_shutdown(message:trim(), core.is_yes(reconnect), delay)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -972,3 +937,31 @@ core.register_chatcommand("last-login", {
|
|||
return false, core.colorize("#F35400", "# Illuna: Last login time is unknown")
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("clearinv", {
|
||||
params = "[name]",
|
||||
description = "Clear the inventory of yourself or another player",
|
||||
func = function(name, param)
|
||||
local player
|
||||
if param and param ~= "" and param ~= name then
|
||||
if not core.check_player_privs(name, {server=true}) then
|
||||
return false, "You don't have permission"
|
||||
.. " to run this command (missing privilege: server)"
|
||||
end
|
||||
player = core.get_player_by_name(param)
|
||||
core.chat_send_player(param, name.." cleared your inventory.")
|
||||
else
|
||||
player = core.get_player_by_name(name)
|
||||
end
|
||||
|
||||
if player then
|
||||
player:get_inventory():set_list("main", {})
|
||||
player:get_inventory():set_list("craft", {})
|
||||
player:get_inventory():set_list("craftpreview", {})
|
||||
core.log("action", name.." clears "..player:get_player_name().."'s inventory")
|
||||
return true, "Cleared "..player:get_player_name().."'s inventory."
|
||||
else
|
||||
return false, "Player must be online to clear inventory!"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -49,3 +49,24 @@ setmetatable(core.env, {
|
|||
function core.rollback_get_last_node_actor(pos, range, seconds)
|
||||
return core.rollback_get_node_actions(pos, range, seconds, 1)[1]
|
||||
end
|
||||
|
||||
--
|
||||
-- core.setting_*
|
||||
--
|
||||
|
||||
local settings = core.settings
|
||||
|
||||
local function setting_proxy(name)
|
||||
return function(...)
|
||||
core.log("deprecated", "WARNING: minetest.setting_* "..
|
||||
"functions are deprecated. "..
|
||||
"Use methods on the minetest.settings object.")
|
||||
return settings[name](settings, ...)
|
||||
end
|
||||
end
|
||||
|
||||
core.setting_set = setting_proxy("set")
|
||||
core.setting_get = setting_proxy("get")
|
||||
core.setting_setbool = setting_proxy("set_bool")
|
||||
core.setting_getbool = setting_proxy("get_bool")
|
||||
core.setting_save = setting_proxy("write")
|
||||
|
|
|
@ -18,9 +18,11 @@ core.register_entity(":__builtin:falling_node", {
|
|||
},
|
||||
|
||||
node = {},
|
||||
meta = {},
|
||||
|
||||
set_node = function(self, node)
|
||||
set_node = function(self, node, meta)
|
||||
self.node = node
|
||||
self.meta = meta or {}
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
textures = {node.name},
|
||||
|
@ -28,15 +30,21 @@ core.register_entity(":__builtin:falling_node", {
|
|||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
return core.serialize(self.node)
|
||||
local ds = {
|
||||
node = self.node,
|
||||
meta = self.meta,
|
||||
}
|
||||
return core.serialize(ds)
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
|
||||
local node = core.deserialize(staticdata)
|
||||
if node then
|
||||
self:set_node(node)
|
||||
local ds = core.deserialize(staticdata)
|
||||
if ds and ds.node then
|
||||
self:set_node(ds.node, ds.meta)
|
||||
elseif ds then
|
||||
self:set_node(ds)
|
||||
elseif staticdata ~= "" then
|
||||
self:set_node({name = staticdata})
|
||||
end
|
||||
|
@ -98,6 +106,10 @@ core.register_entity(":__builtin:falling_node", {
|
|||
-- Create node and remove entity
|
||||
if core.registered_nodes[self.node.name] then
|
||||
core.add_node(np, self.node)
|
||||
if self.meta then
|
||||
local meta = core.get_meta(np)
|
||||
meta:from_table(self.meta)
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
core.check_for_falling(np)
|
||||
|
@ -111,10 +123,10 @@ core.register_entity(":__builtin:falling_node", {
|
|||
end
|
||||
})
|
||||
|
||||
local function spawn_falling_node(p, node)
|
||||
local function spawn_falling_node(p, node, meta)
|
||||
local obj = core.add_entity(p, "__builtin:falling_node")
|
||||
if obj then
|
||||
obj:get_luaentity():set_node(node)
|
||||
obj:get_luaentity():set_node(node, meta)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -189,8 +201,13 @@ function core.check_single_for_falling(p)
|
|||
|
||||
(not d_bottom.walkable or d_bottom.buildable_to) then
|
||||
n.level = core.get_node_level(p)
|
||||
local meta = core.get_meta(p)
|
||||
local metatable = {}
|
||||
if meta ~= nil then
|
||||
metatable = meta:to_table()
|
||||
end
|
||||
core.remove_node(p)
|
||||
spawn_falling_node(p, n)
|
||||
spawn_falling_node(p, n, metatable)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ function core.forceload_block(pos, transient)
|
|||
elseif other_table[hash] ~= nil then
|
||||
relevant_table[hash] = 1
|
||||
else
|
||||
if total_forceloaded >= (tonumber(core.setting_get("max_forceloaded_blocks")) or 16) then
|
||||
if total_forceloaded >= (tonumber(core.settings:get("max_forceloaded_blocks")) or 16) then
|
||||
return false
|
||||
end
|
||||
total_forceloaded = total_forceloaded+1
|
||||
|
|
|
@ -13,15 +13,17 @@ dofile(gamepath.."constants.lua")
|
|||
assert(loadfile(gamepath.."item.lua"))(builtin_shared)
|
||||
dofile(gamepath.."register.lua")
|
||||
|
||||
if core.setting_getbool("profiler.load") then
|
||||
if core.settings:get_bool("profiler.load") then
|
||||
profiler = dofile(scriptpath.."profiler"..DIR_DELIM.."init.lua")
|
||||
end
|
||||
|
||||
dofile(commonpath .. "after.lua")
|
||||
dofile(gamepath.."item_entity.lua")
|
||||
dofile(gamepath.."deprecated.lua")
|
||||
dofile(gamepath.."misc.lua")
|
||||
dofile(gamepath.."privileges.lua")
|
||||
dofile(gamepath.."auth.lua")
|
||||
dofile(commonpath .. "chatcommands.lua")
|
||||
dofile(gamepath.."chatcommands.lua")
|
||||
dofile(gamepath.."static_spawn.lua")
|
||||
dofile(gamepath.."detached_inventory.lua")
|
||||
|
|
|
@ -483,7 +483,7 @@ function core.node_dig(pos, node, digger)
|
|||
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||
else
|
||||
-- Wear out tool
|
||||
if not core.setting_getbool("creative_mode") then
|
||||
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})
|
||||
|
@ -496,7 +496,7 @@ function core.node_dig(pos, node, digger)
|
|||
core.handle_node_drops(pos, drops, digger)
|
||||
|
||||
local oldmetadata = nil
|
||||
if def.after_dig_node then
|
||||
if def and def.after_dig_node then
|
||||
oldmetadata = core.get_meta(pos):to_table()
|
||||
end
|
||||
|
||||
|
@ -504,7 +504,7 @@ function core.node_dig(pos, node, digger)
|
|||
core.remove_node(pos)
|
||||
|
||||
-- Run callback
|
||||
if def.after_dig_node then
|
||||
if def and def.after_dig_node then
|
||||
-- Copy pos and node because callback can modify them
|
||||
local pos_copy = {x=pos.x, y=pos.y, z=pos.z}
|
||||
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||
|
|
|
@ -14,7 +14,7 @@ end
|
|||
-- If item_entity_ttl is not set, enity will have default life time
|
||||
-- Setting it to -1 disables the feature
|
||||
|
||||
local time_to_live = tonumber(core.setting_get("item_entity_ttl"))
|
||||
local time_to_live = tonumber(core.settings:get("item_entity_ttl"))
|
||||
if not time_to_live then
|
||||
time_to_live = 900
|
||||
end
|
||||
|
@ -53,6 +53,8 @@ core.register_entity(":__builtin:item", {
|
|||
if itemtable then
|
||||
itemname = stack:to_table().name
|
||||
end
|
||||
-- Backwards compatibility: old clients use the texture
|
||||
-- to get the type of the item
|
||||
local item_texture = nil
|
||||
local item_type = ""
|
||||
if core.registered_items[itemname] then
|
||||
|
@ -66,6 +68,7 @@ core.register_entity(":__builtin:item", {
|
|||
visual_size = {x = s, y = s},
|
||||
collisionbox = {-c, -c, -c, c, c, c},
|
||||
automatic_rotate = math.pi * 0.5,
|
||||
wield_item = itemstring,
|
||||
}
|
||||
self.object:set_properties(prop)
|
||||
end,
|
||||
|
@ -101,31 +104,39 @@ core.register_entity(":__builtin:item", {
|
|||
self:set_item(self.itemstring)
|
||||
end,
|
||||
|
||||
-- moves items from this stack to an other stack
|
||||
try_merge_with = function(self, own_stack, object, obj)
|
||||
-- other item's stack
|
||||
local stack = ItemStack(obj.itemstring)
|
||||
if own_stack:get_name() == stack:get_name() and stack:get_free_space() > 0 then
|
||||
-- only merge if items are the same
|
||||
if own_stack:get_name() == stack:get_name() and
|
||||
own_stack:get_meta() == stack:get_meta() and
|
||||
own_stack:get_wear() == stack:get_wear() and
|
||||
stack:get_free_space() > 0 then
|
||||
local overflow = false
|
||||
local count = stack:get_count() + own_stack:get_count()
|
||||
local max_count = stack:get_stack_max()
|
||||
if count > max_count then
|
||||
overflow = true
|
||||
stack:set_count(max_count)
|
||||
count = count - max_count
|
||||
own_stack:set_count(count)
|
||||
else
|
||||
self.itemstring = ''
|
||||
stack:set_count(count)
|
||||
end
|
||||
local pos = object:getpos()
|
||||
pos.y = pos.y + (count - stack:get_count()) / max_count * 0.15
|
||||
object:moveto(pos, false)
|
||||
local s, c
|
||||
local max_count = stack:get_stack_max()
|
||||
local name = stack:get_name()
|
||||
if not overflow then
|
||||
obj.itemstring = name .. " " .. count
|
||||
obj.itemstring = stack:to_string()
|
||||
s = 0.2 + 0.1 * (count / max_count)
|
||||
c = s
|
||||
object:set_properties({
|
||||
visual_size = {x = s, y = s},
|
||||
collisionbox = {-c, -c, -c, c, c, c}
|
||||
collisionbox = {-c, -c, -c, c, c, c},
|
||||
wield_item = obj.itemstring
|
||||
})
|
||||
self.object:remove()
|
||||
-- merging succeeded
|
||||
|
@ -133,18 +144,20 @@ core.register_entity(":__builtin:item", {
|
|||
else
|
||||
s = 0.4
|
||||
c = 0.3
|
||||
obj.itemstring = stack:to_string()
|
||||
object:set_properties({
|
||||
visual_size = {x = s, y = s},
|
||||
collisionbox = {-c, -c, -c, c, c, c}
|
||||
collisionbox = {-c, -c, -c, c, c, c},
|
||||
wield_item = obj.itemstring
|
||||
})
|
||||
obj.itemstring = name .. " " .. max_count
|
||||
s = 0.2 + 0.1 * (count / max_count)
|
||||
c = s
|
||||
self.itemstring = own_stack:to_string()
|
||||
self.object:set_properties({
|
||||
visual_size = {x = s, y = s},
|
||||
collisionbox = {-c, -c, -c, c, c, c}
|
||||
collisionbox = {-c, -c, -c, c, c, c},
|
||||
wield_item = self.itemstring
|
||||
})
|
||||
self.itemstring = name .. " " .. count
|
||||
end
|
||||
end
|
||||
-- merging didn't succeed
|
||||
|
|
|
@ -4,50 +4,6 @@
|
|||
-- Misc. API functions
|
||||
--
|
||||
|
||||
local jobs = {}
|
||||
local time = 0.0
|
||||
local last = core.get_us_time() / 1000000
|
||||
|
||||
core.register_globalstep(function(dtime)
|
||||
local new = core.get_us_time() / 1000000
|
||||
if new > last then
|
||||
time = time + (new - last)
|
||||
else
|
||||
-- Overflow, we may lose a little bit of time here but
|
||||
-- only 1 tick max, potentially running timers slightly
|
||||
-- too early.
|
||||
time = time + new
|
||||
end
|
||||
last = new
|
||||
|
||||
if #jobs < 1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- Iterate backwards so that we miss any new timers added by
|
||||
-- a timer callback, and so that we don't skip the next timer
|
||||
-- in the list if we remove one.
|
||||
for i = #jobs, 1, -1 do
|
||||
local job = jobs[i]
|
||||
if time >= job.expire then
|
||||
core.set_last_run_mod(job.mod_origin)
|
||||
job.func(unpack(job.arg))
|
||||
table.remove(jobs, i)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function core.after(after, func, ...)
|
||||
assert(tonumber(after) and type(func) == "function",
|
||||
"Invalid core.after invocation")
|
||||
jobs[#jobs + 1] = {
|
||||
func = func,
|
||||
expire = time + after,
|
||||
arg = {...},
|
||||
mod_origin = core.get_last_run_mod()
|
||||
}
|
||||
end
|
||||
|
||||
function core.check_player_privs(name, ...)
|
||||
local arg_type = type(name)
|
||||
if (arg_type == "userdata" or arg_type == "table") and
|
||||
|
@ -165,7 +121,7 @@ function core.get_node_group(name, group)
|
|||
end
|
||||
|
||||
function core.setting_get_pos(name)
|
||||
local value = core.setting_get(name)
|
||||
local value = core.settings:get(name)
|
||||
if not value then
|
||||
return nil
|
||||
end
|
||||
|
@ -213,37 +169,12 @@ function core.http_add_fetch(httpenv)
|
|||
|
||||
return httpenv
|
||||
end
|
||||
--[[
|
||||
if minetest.setting_getbool("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]]
|
||||
local ESCAPE_CHAR = string.char(0x1b)
|
||||
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)
|
||||
return core.get_color_escape_sequence(color) .. message .. core.get_color_escape_sequence("#ffffff")
|
||||
end
|
||||
|
||||
--end
|
||||
|
||||
function core.close_formspec(player_name, formname)
|
||||
return minetest.show_formspec(player_name, formname, "")
|
||||
end
|
||||
|
||||
function core.cancel_shutdown_requests()
|
||||
core.request_shutdown("", false, -1)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-- cache setting
|
||||
local enable_damage = core.setting_getbool("enable_damage") == true
|
||||
local enable_damage = core.settings:get_bool("enable_damage")
|
||||
|
||||
local health_bar_definition =
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
-- Minetest: builtin/static_spawn.lua
|
||||
|
||||
local function warn_invalid_static_spawnpoint()
|
||||
if core.setting_get("static_spawnpoint") and
|
||||
if core.settings:get("static_spawnpoint") and
|
||||
not core.setting_get_pos("static_spawnpoint") then
|
||||
core.log("error", "The static_spawnpoint setting is invalid: \""..
|
||||
core.setting_get("static_spawnpoint").."\"")
|
||||
core.settings:get("static_spawnpoint").."\"")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ minetest = core
|
|||
-- Load other files
|
||||
local scriptdir = core.get_builtin_path() .. DIR_DELIM
|
||||
local gamepath = scriptdir .. "game" .. DIR_DELIM
|
||||
local clientpath = scriptdir .. "client" .. DIR_DELIM
|
||||
local commonpath = scriptdir .. "common" .. DIR_DELIM
|
||||
local asyncpath = scriptdir .. "async" .. DIR_DELIM
|
||||
|
||||
|
@ -37,7 +38,7 @@ dofile(commonpath .. "misc_helpers.lua")
|
|||
if INIT == "game" then
|
||||
dofile(gamepath .. "init.lua")
|
||||
elseif INIT == "mainmenu" then
|
||||
local mm_script = core.setting_get("main_menu_script")
|
||||
local mm_script = core.settings:get("main_menu_script")
|
||||
if mm_script and mm_script ~= "" then
|
||||
dofile(mm_script)
|
||||
else
|
||||
|
@ -45,6 +46,9 @@ elseif INIT == "mainmenu" then
|
|||
end
|
||||
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)))
|
||||
end
|
||||
|
|
|
@ -43,10 +43,10 @@ end
|
|||
local function configure_selected_world_params(idx)
|
||||
local worldconfig = modmgr.get_worldconfig(menudata.worldlist:get_list()[idx].path)
|
||||
if worldconfig.creative_mode then
|
||||
core.setting_set("creative_mode", worldconfig.creative_mode)
|
||||
core.settings:set("creative_mode", worldconfig.creative_mode)
|
||||
end
|
||||
if worldconfig.enable_damage then
|
||||
core.setting_set("enable_damage", worldconfig.enable_damage)
|
||||
core.settings:set("enable_damage", worldconfig.enable_damage)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -164,8 +164,8 @@ end
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
os.tempfolder = function()
|
||||
if core.setting_get("TMPFolder") then
|
||||
return core.setting_get("TMPFolder") .. DIR_DELIM .. "MT_" .. math.random(0,10000)
|
||||
if core.settings:get("TMPFolder") then
|
||||
return core.settings:get("TMPFolder") .. DIR_DELIM .. "MT_" .. math.random(0,10000)
|
||||
end
|
||||
|
||||
local filetocheck = os.tmpname()
|
||||
|
@ -206,7 +206,7 @@ function menu_handle_key_up_down(fields, textlist, settingname)
|
|||
oldidx < menudata.worldlist:size() then
|
||||
newidx = oldidx + 1
|
||||
end
|
||||
core.setting_set(settingname, menudata.worldlist:get_raw_index(newidx))
|
||||
core.settings:set(settingname, menudata.worldlist:get_raw_index(newidx))
|
||||
configure_selected_world_params(newidx)
|
||||
return true
|
||||
end
|
||||
|
@ -250,7 +250,7 @@ end
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
function text2textlist(xpos, ypos, width, height, tl_name, textlen, text, transparency)
|
||||
local textlines = core.splittext(text, textlen)
|
||||
local textlines = core.wrap_text(text, textlen)
|
||||
local retval = "textlist[" .. xpos .. "," .. ypos .. ";" .. width ..
|
||||
"," .. height .. ";" .. tl_name .. ";"
|
||||
|
||||
|
@ -328,9 +328,9 @@ function menu_worldmt_legacy(selected)
|
|||
for _, mode_name in pairs(modes_names) do
|
||||
local mode_val = menu_worldmt(selected, mode_name)
|
||||
if mode_val then
|
||||
core.setting_set(mode_name, mode_val)
|
||||
core.settings:set(mode_name, mode_val)
|
||||
else
|
||||
menu_worldmt(selected, mode_name, core.setting_get(mode_name))
|
||||
menu_worldmt(selected, mode_name, core.settings:get(mode_name))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ local function get_formspec(data)
|
|||
"button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" ..
|
||||
"button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]"
|
||||
|
||||
if mod and mod.name ~= "" and mod.typ ~= "game_mod" then
|
||||
if mod and mod.name ~= "" and not mod.is_game_content then
|
||||
if mod.is_modpack then
|
||||
local rawlist = data.list:get_raw_list()
|
||||
|
||||
|
@ -97,7 +97,7 @@ end
|
|||
local function enable_mod(this, toset)
|
||||
local mod = this.data.list:get_list()[this.data.selected_mod]
|
||||
|
||||
if mod.typ == "game_mod" then
|
||||
if mod.is_game_content then
|
||||
-- game mods can't be enabled or disabled
|
||||
elseif not mod.is_modpack then
|
||||
if toset == nil then
|
||||
|
@ -123,7 +123,7 @@ local function handle_buttons(this, fields)
|
|||
if fields["world_config_modlist"] ~= nil then
|
||||
local event = core.explode_table_event(fields["world_config_modlist"])
|
||||
this.data.selected_mod = event.row
|
||||
core.setting_set("world_config_selected_mod", event.row)
|
||||
core.settings:set("world_config_selected_mod", event.row)
|
||||
|
||||
if event.type == "DCL" then
|
||||
enable_mod(this)
|
||||
|
@ -162,7 +162,7 @@ local function handle_buttons(this, fields)
|
|||
local i,mod
|
||||
for i,mod in ipairs(rawlist) do
|
||||
if not mod.is_modpack and
|
||||
mod.typ ~= "game_mod" then
|
||||
not mod.is_game_content then
|
||||
if modname_valid(mod.name) then
|
||||
worldfile:set("load_mod_"..mod.name, tostring(mod.enabled))
|
||||
else
|
||||
|
@ -198,7 +198,8 @@ local function handle_buttons(this, fields)
|
|||
local list = this.data.list:get_raw_list()
|
||||
|
||||
for i = 1, #list do
|
||||
if list[i].typ ~= "game_mod" and not list[i].is_modpack then
|
||||
if not list[i].is_game_content
|
||||
and not list[i].is_modpack then
|
||||
list[i].enabled = true
|
||||
end
|
||||
end
|
||||
|
@ -210,7 +211,8 @@ local function handle_buttons(this, fields)
|
|||
local list = this.data.list:get_raw_list()
|
||||
|
||||
for i = 1, #list do
|
||||
if list[i].typ ~= "game_mod" and not list[i].is_modpack then
|
||||
if not list[i].is_game_content
|
||||
and not list[i].is_modpack then
|
||||
list[i].enabled = false
|
||||
end
|
||||
end
|
||||
|
@ -227,7 +229,7 @@ function create_configure_world_dlg(worldidx)
|
|||
handle_buttons,
|
||||
nil)
|
||||
|
||||
dlg.data.selected_mod = tonumber(core.setting_get("world_config_selected_mod"))
|
||||
dlg.data.selected_mod = tonumber(core.settings:get("world_config_selected_mod"))
|
||||
if dlg.data.selected_mod == nil then
|
||||
dlg.data.selected_mod = 0
|
||||
end
|
||||
|
@ -252,16 +254,16 @@ function create_configure_world_dlg(worldidx)
|
|||
return true
|
||||
end
|
||||
end,
|
||||
function(element,criteria)
|
||||
function(element, criteria)
|
||||
if criteria.hide_game and
|
||||
element.typ == "game_mod" then
|
||||
return false
|
||||
element.is_game_content then
|
||||
return false
|
||||
end
|
||||
|
||||
if criteria.hide_modpackcontents and
|
||||
element.modpack ~= nil then
|
||||
return false
|
||||
end
|
||||
element.modpack ~= nil then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end, --filter
|
||||
{ worldpath= dlg.data.worldspec.path,
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
local function create_world_formspec(dialogdata)
|
||||
local mapgens = core.get_mapgen_names()
|
||||
|
||||
local current_seed = core.setting_get("fixed_map_seed") or ""
|
||||
local current_mg = core.setting_get("mg_name")
|
||||
local current_seed = core.settings:get("fixed_map_seed") or ""
|
||||
local current_mg = core.settings:get("mg_name")
|
||||
|
||||
local mglist = ""
|
||||
local selindex = 1
|
||||
|
@ -33,7 +33,7 @@ local function create_world_formspec(dialogdata)
|
|||
end
|
||||
mglist = mglist:sub(1, -2)
|
||||
|
||||
local gameid = core.setting_get("menu_last_game")
|
||||
local gameid = core.settings:get("menu_last_game")
|
||||
|
||||
local game, gameidx = nil , 0
|
||||
if gameid ~= nil then
|
||||
|
@ -90,10 +90,10 @@ local function create_world_buttonhandler(this, fields)
|
|||
|
||||
local message = nil
|
||||
|
||||
core.setting_set("fixed_map_seed", fields["te_seed"])
|
||||
core.settings:set("fixed_map_seed", fields["te_seed"])
|
||||
|
||||
if not menudata.worldlist:uid_exists_raw(worldname) then
|
||||
core.setting_set("mg_name",fields["dd_mapgen"])
|
||||
core.settings:set("mg_name",fields["dd_mapgen"])
|
||||
message = core.create_world(worldname,gameindex)
|
||||
else
|
||||
message = fgettext("A world named \"$1\" already exists", worldname)
|
||||
|
@ -102,13 +102,13 @@ local function create_world_buttonhandler(this, fields)
|
|||
if message ~= nil then
|
||||
gamedata.errormessage = message
|
||||
else
|
||||
core.setting_set("menu_last_game",gamemgr.games[gameindex].id)
|
||||
core.settings:set("menu_last_game",gamemgr.games[gameindex].id)
|
||||
if this.data.update_worldlist_filter then
|
||||
menudata.worldlist:set_filtercriteria(gamemgr.games[gameindex].id)
|
||||
mm_texture.update("singleplayer", gamemgr.games[gameindex].id)
|
||||
end
|
||||
menudata.worldlist:refresh()
|
||||
core.setting_set("mainmenu_last_selected_world",
|
||||
core.settings:set("mainmenu_last_selected_world",
|
||||
menudata.worldlist:raw_index_by_uid(worldname))
|
||||
end
|
||||
else
|
||||
|
|
|
@ -423,7 +423,7 @@ local settings = full_settings
|
|||
local selected_setting = 1
|
||||
|
||||
local function get_current_value(setting)
|
||||
local value = core.setting_get(setting.name)
|
||||
local value = core.settings:get(setting.name)
|
||||
if value == nil then
|
||||
value = setting.default
|
||||
end
|
||||
|
@ -539,11 +539,11 @@ local function handle_change_setting_buttons(this, fields)
|
|||
if setting.type == "bool" then
|
||||
local new_value = fields["dd_setting_value"]
|
||||
-- Note: new_value is the actual (translated) value shown in the dropdown
|
||||
core.setting_setbool(setting.name, new_value == fgettext("Enabled"))
|
||||
core.settings:set_bool(setting.name, new_value == fgettext("Enabled"))
|
||||
|
||||
elseif setting.type == "enum" then
|
||||
local new_value = fields["dd_setting_value"]
|
||||
core.setting_set(setting.name, new_value)
|
||||
core.settings:set(setting.name, new_value)
|
||||
|
||||
elseif setting.type == "int" then
|
||||
local new_value = tonumber(fields["te_setting_value"])
|
||||
|
@ -565,7 +565,7 @@ local function handle_change_setting_buttons(this, fields)
|
|||
core.update_formspec(this:get_formspec())
|
||||
return true
|
||||
end
|
||||
core.setting_set(setting.name, new_value)
|
||||
core.settings:set(setting.name, new_value)
|
||||
|
||||
elseif setting.type == "float" then
|
||||
local new_value = tonumber(fields["te_setting_value"])
|
||||
|
@ -575,7 +575,7 @@ local function handle_change_setting_buttons(this, fields)
|
|||
core.update_formspec(this:get_formspec())
|
||||
return true
|
||||
end
|
||||
core.setting_set(setting.name, new_value)
|
||||
core.settings:set(setting.name, new_value)
|
||||
|
||||
elseif setting.type == "flags" then
|
||||
local new_value = fields["te_setting_value"]
|
||||
|
@ -589,13 +589,13 @@ local function handle_change_setting_buttons(this, fields)
|
|||
return true
|
||||
end
|
||||
end
|
||||
core.setting_set(setting.name, new_value)
|
||||
core.settings:set(setting.name, new_value)
|
||||
|
||||
else
|
||||
local new_value = fields["te_setting_value"]
|
||||
core.setting_set(setting.name, new_value)
|
||||
core.settings:set(setting.name, new_value)
|
||||
end
|
||||
core.setting_save()
|
||||
core.settings:write()
|
||||
this:delete()
|
||||
return true
|
||||
end
|
||||
|
@ -629,7 +629,7 @@ local function create_settings_formspec(tabview, name, tabdata)
|
|||
local current_level = 0
|
||||
for _, entry in ipairs(settings) do
|
||||
local name
|
||||
if not core.setting_getbool("main_menu_technical_settings") and entry.readable_name then
|
||||
if not core.settings:get_bool("main_menu_technical_settings") and entry.readable_name then
|
||||
name = fgettext_ne(entry.readable_name)
|
||||
else
|
||||
name = entry.name
|
||||
|
@ -666,7 +666,7 @@ local function create_settings_formspec(tabview, name, tabdata)
|
|||
"button[10,6;2,1;btn_edit;" .. fgettext("Edit") .. "]" ..
|
||||
"button[7,6;3,1;btn_restore;" .. fgettext("Restore Default") .. "]" ..
|
||||
"checkbox[0,5.3;cb_tech_settings;" .. fgettext("Show technical names") .. ";"
|
||||
.. dump(core.setting_getbool("main_menu_technical_settings")) .. "]"
|
||||
.. dump(core.settings:get_bool("main_menu_technical_settings")) .. "]"
|
||||
|
||||
return formspec
|
||||
end
|
||||
|
@ -680,8 +680,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||
local setting = settings[selected_setting]
|
||||
if setting and setting.type == "bool" then
|
||||
local current_value = get_current_value(setting)
|
||||
core.setting_setbool(setting.name, not core.is_yes(current_value))
|
||||
core.setting_save()
|
||||
core.settings:set_bool(setting.name, not core.is_yes(current_value))
|
||||
core.settings:write()
|
||||
return true
|
||||
else
|
||||
list_enter = true
|
||||
|
@ -736,8 +736,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||
if fields["btn_restore"] then
|
||||
local setting = settings[selected_setting]
|
||||
if setting and setting.type ~= "category" then
|
||||
core.setting_set(setting.name, setting.default)
|
||||
core.setting_save()
|
||||
core.settings:set(setting.name, setting.default)
|
||||
core.settings:write()
|
||||
core.update_formspec(this:get_formspec())
|
||||
end
|
||||
return true
|
||||
|
@ -749,8 +749,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||
end
|
||||
|
||||
if fields["cb_tech_settings"] then
|
||||
core.setting_set("main_menu_technical_settings", fields["cb_tech_settings"])
|
||||
core.setting_save()
|
||||
core.settings:set("main_menu_technical_settings", fields["cb_tech_settings"])
|
||||
core.settings:write()
|
||||
core.update_formspec(this:get_formspec())
|
||||
return true
|
||||
end
|
||||
|
@ -769,10 +769,4 @@ end
|
|||
|
||||
-- Generate minetest.conf.example and settings_translation_file.cpp
|
||||
|
||||
-- *** Please note ***
|
||||
-- There is text in minetest.conf.example that will not be generated from
|
||||
-- settingtypes.txt but must be preserved:
|
||||
-- The documentation of mapgen noise parameter formats (title plus 16 lines)
|
||||
-- Noise parameter 'mgv5_np_ground' in group format (13 lines)
|
||||
|
||||
--assert(loadfile(core.get_builtin_path()..DIR_DELIM.."mainmenu"..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
|
||||
|
|
|
@ -56,9 +56,8 @@ tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
|
|||
if PLATFORM == "Android" then
|
||||
tabs.simple_main = dofile(menupath .. DIR_DELIM .. "tab_simple_main.lua")
|
||||
else
|
||||
tabs.singleplayer = dofile(menupath .. DIR_DELIM .. "tab_singleplayer.lua")
|
||||
tabs.multiplayer = dofile(menupath .. DIR_DELIM .. "tab_multiplayer.lua")
|
||||
tabs.server = dofile(menupath .. DIR_DELIM .. "tab_server.lua")
|
||||
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
|
||||
tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
|
||||
tabs.texturepacks = dofile(menupath .. DIR_DELIM .. "tab_texturepacks.lua")
|
||||
end
|
||||
|
||||
|
@ -119,9 +118,9 @@ local function init_globals()
|
|||
menudata.worldlist:add_sort_mechanism("alphabetic", sort_worlds_alphabetic)
|
||||
menudata.worldlist:set_sortmode("alphabetic")
|
||||
|
||||
if not core.setting_get("menu_last_game") then
|
||||
local default_game = core.setting_get("default_game") or "minetest"
|
||||
core.setting_set("menu_last_game", default_game)
|
||||
if not core.settings:get("menu_last_game") then
|
||||
local default_game = core.settings:get("default_game") or "minetest"
|
||||
core.settings:set("menu_last_game", default_game)
|
||||
end
|
||||
|
||||
mm_texture.init()
|
||||
|
@ -135,9 +134,8 @@ local function init_globals()
|
|||
tv_main:add(tabs.settings)
|
||||
else
|
||||
tv_main:set_autosave_tab(true)
|
||||
tv_main:add(tabs.singleplayer)
|
||||
tv_main:add(tabs.multiplayer)
|
||||
tv_main:add(tabs.server)
|
||||
tv_main:add(tabs.local_game)
|
||||
tv_main:add(tabs.play_online)
|
||||
tv_main:add(tabs.settings)
|
||||
tv_main:add(tabs.texturepacks)
|
||||
end
|
||||
|
@ -149,7 +147,7 @@ local function init_globals()
|
|||
tv_main:set_fixed_size(false)
|
||||
|
||||
if PLATFORM ~= "Android" then
|
||||
tv_main:set_tab(core.setting_get("maintab_LAST"))
|
||||
tv_main:set_tab(core.settings:get("maintab_LAST"))
|
||||
end
|
||||
ui.set_default("maintab")
|
||||
tv_main:show()
|
||||
|
@ -167,4 +165,3 @@ local function init_globals()
|
|||
end
|
||||
|
||||
init_globals()
|
||||
|
||||
|
|
|
@ -238,15 +238,7 @@ function modmgr.render_modlist(render_list)
|
|||
local list = render_list:get_list()
|
||||
local last_modpack = nil
|
||||
local retval = {}
|
||||
local in_game_mods = false
|
||||
for i, v in ipairs(list) do
|
||||
if v.typ == "game_mod" and not in_game_mods then
|
||||
in_game_mods = true
|
||||
retval[#retval + 1] = mt_color_blue
|
||||
retval[#retval + 1] = "0"
|
||||
retval[#retval + 1] = fgettext("Subgame Mods")
|
||||
end
|
||||
|
||||
local color = ""
|
||||
if v.is_modpack then
|
||||
local rawlist = render_list:get_raw_list()
|
||||
|
@ -260,7 +252,7 @@ function modmgr.render_modlist(render_list)
|
|||
break
|
||||
end
|
||||
end
|
||||
elseif v.typ == "game_mod" then
|
||||
elseif v.is_game_content then
|
||||
color = mt_color_blue
|
||||
elseif v.enabled then
|
||||
color = mt_color_green
|
||||
|
@ -421,8 +413,18 @@ function modmgr.preparemodlist(data)
|
|||
local gamespec = gamemgr.find_by_gameid(data.gameid)
|
||||
gamemgr.get_game_mods(gamespec, game_mods)
|
||||
|
||||
if #game_mods > 0 then
|
||||
-- Add title
|
||||
retval[#retval + 1] = {
|
||||
typ = "game",
|
||||
is_game_content = true,
|
||||
name = fgettext("Subgame Mods")
|
||||
}
|
||||
end
|
||||
|
||||
for i=1,#game_mods,1 do
|
||||
game_mods[i].typ = "game_mod"
|
||||
game_mods[i].is_game_content = true
|
||||
retval[#retval + 1] = game_mods[i]
|
||||
end
|
||||
|
||||
|
|
|
@ -233,14 +233,14 @@ function modstore.handle_buttons(parent, fields, name, data)
|
|||
|
||||
if not core.handle_async(
|
||||
function(param)
|
||||
local fullurl = core.setting_get("modstore_download_url") ..
|
||||
local fullurl = core.settings:get("modstore_download_url") ..
|
||||
param.moddetails.download_url
|
||||
|
||||
if param.version ~= nil then
|
||||
local found = false
|
||||
for i=1,#param.moddetails.versions, 1 do
|
||||
if param.moddetails.versions[i].date:sub(1,10) == param.version then
|
||||
fullurl = core.setting_get("modstore_download_url") ..
|
||||
fullurl = core.settings:get("modstore_download_url") ..
|
||||
param.moddetails.versions[i].download_url
|
||||
found = true
|
||||
end
|
||||
|
@ -400,7 +400,7 @@ function modstore.getscreenshot(ypos,listentry)
|
|||
listentry.texturename = "in progress"
|
||||
|
||||
--prepare url and filename
|
||||
local fullurl = core.setting_get("modstore_download_url") ..
|
||||
local fullurl = core.settings:get("modstore_download_url") ..
|
||||
listentry.details.screenshot_url
|
||||
local filename = os.tempfolder() .. "_MID_" .. listentry.id
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
local core_developers = {
|
||||
"Perttu Ahola (celeron55) <celeron55@gmail.com>",
|
||||
"Ryan Kwolek (kwolekr) <kwolekr@minetest.net>",
|
||||
"PilzAdam <pilzadam@minetest.net>",
|
||||
"sfan5 <sfan5@live.de>",
|
||||
"kahrl <kahrl@gmx.net>",
|
||||
"sapier",
|
||||
|
@ -54,6 +53,7 @@ local previous_core_developers = {
|
|||
"Lisa Milne (darkrose) <lisa@ltmnet.com>",
|
||||
"proller",
|
||||
"Ilya Zhuravlev (xyz) <xyz@minetest.net>",
|
||||
"PilzAdam <pilzadam@minetest.net>",
|
||||
}
|
||||
|
||||
local previous_contributors = {
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
local function current_game()
|
||||
local last_game_id = core.setting_get("menu_last_game")
|
||||
local last_game_id = core.settings:get("menu_last_game")
|
||||
local game, index = gamemgr.find_by_gameid(last_game_id)
|
||||
|
||||
|
||||
return game
|
||||
end
|
||||
|
||||
|
@ -36,10 +36,10 @@ local function singleplayer_refresh_gamebar()
|
|||
if ("game_btnbar_" .. gamemgr.games[j].id == key) then
|
||||
mm_texture.update("singleplayer", gamemgr.games[j])
|
||||
core.set_topleft_text(gamemgr.games[j].name)
|
||||
core.setting_set("menu_last_game",gamemgr.games[j].id)
|
||||
core.settings:set("menu_last_game",gamemgr.games[j].id)
|
||||
menudata.worldlist:set_filtercriteria(gamemgr.games[j].id)
|
||||
local index = filterlist.get_current_index(menudata.worldlist,
|
||||
tonumber(core.setting_get("mainmenu_last_selected_world")))
|
||||
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
||||
if not index or index < 1 then
|
||||
local selected = core.get_textlist_index("sp_worlds")
|
||||
if selected ~= nil and selected < #menudata.worldlist:get_list() then
|
||||
|
@ -61,20 +61,20 @@ local function singleplayer_refresh_gamebar()
|
|||
|
||||
for i=1,#gamemgr.games,1 do
|
||||
local btn_name = "game_btnbar_" .. gamemgr.games[i].id
|
||||
|
||||
|
||||
local image = nil
|
||||
local text = nil
|
||||
local tooltip = core.formspec_escape(gamemgr.games[i].name)
|
||||
|
||||
|
||||
if gamemgr.games[i].menuicon_path ~= nil and
|
||||
gamemgr.games[i].menuicon_path ~= "" then
|
||||
image = core.formspec_escape(gamemgr.games[i].menuicon_path)
|
||||
else
|
||||
|
||||
|
||||
local part1 = gamemgr.games[i].id:sub(1,5)
|
||||
local part2 = gamemgr.games[i].id:sub(6,10)
|
||||
local part3 = gamemgr.games[i].id:sub(11)
|
||||
|
||||
|
||||
text = part1 .. "\n" .. part2
|
||||
if part3 ~= nil and
|
||||
part3 ~= "" then
|
||||
|
@ -89,28 +89,57 @@ local function get_formspec(tabview, name, tabdata)
|
|||
local retval = ""
|
||||
|
||||
local index = filterlist.get_current_index(menudata.worldlist,
|
||||
tonumber(core.setting_get("mainmenu_last_selected_world"))
|
||||
tonumber(core.settings:get("mainmenu_last_selected_world"))
|
||||
)
|
||||
|
||||
retval = retval ..
|
||||
"button[4,4.15;2.6,0.5;world_delete;".. fgettext("Delete") .. "]" ..
|
||||
"button[6.5,4.15;2.8,0.5;world_create;".. fgettext("New") .. "]" ..
|
||||
"button[9.2,4.15;2.55,0.5;world_configure;".. fgettext("Configure") .. "]" ..
|
||||
"button[8.5,5;3.25,0.5;play;".. fgettext("Play") .. "]" ..
|
||||
"label[4,-0.25;".. fgettext("Select World:") .. "]"..
|
||||
"checkbox[0.25,0.25;cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
||||
dump(core.setting_getbool("creative_mode")) .. "]"..
|
||||
dump(core.settings:get_bool("creative_mode")) .. "]"..
|
||||
"checkbox[0.25,0.7;cb_enable_damage;".. fgettext("Enable Damage") .. ";" ..
|
||||
dump(core.setting_getbool("enable_damage")) .. "]"..
|
||||
dump(core.settings:get_bool("enable_damage")) .. "]"..
|
||||
"checkbox[0.25,1.15;cb_server;".. fgettext("Host Server") ..";" ..
|
||||
dump(core.settings:get_bool("enable_server")) .. "]" ..
|
||||
"textlist[4,0.25;7.5,3.7;sp_worlds;" ..
|
||||
menu_render_worldlist() ..
|
||||
";" .. index .. "]"
|
||||
|
||||
if core.settings:get_bool("enable_server") then
|
||||
retval = retval ..
|
||||
"button[8.5,5;3.25,0.5;play;".. fgettext("Host Game") .. "]" ..
|
||||
"checkbox[0.25,1.6;cb_server_announce;" .. fgettext("Announce Server") .. ";" ..
|
||||
dump(core.settings:get_bool("server_announce")) .. "]" ..
|
||||
"label[0.25,2.2;" .. fgettext("Name/Password") .. "]" ..
|
||||
"field[0.55,3.2;3.5,0.5;te_playername;;" ..
|
||||
core.formspec_escape(core.settings:get("name")) .. "]" ..
|
||||
"pwdfield[0.55,4;3.5,0.5;te_passwd;]"
|
||||
|
||||
local bind_addr = core.settings:get("bind_address")
|
||||
if bind_addr ~= nil and bind_addr ~= "" then
|
||||
retval = retval ..
|
||||
"field[0.55,5.2;2.25,0.5;te_serveraddr;" .. fgettext("Bind Address") .. ";" ..
|
||||
core.formspec_escape(core.settings:get("bind_address")) .. "]" ..
|
||||
"field[2.8,5.2;1.25,0.5;te_serverport;" .. fgettext("Port") .. ";" ..
|
||||
core.formspec_escape(core.settings:get("port")) .. "]"
|
||||
else
|
||||
retval = retval ..
|
||||
"field[0.55,5.2;3.5,0.5;te_serverport;" .. fgettext("Server Port") .. ";" ..
|
||||
core.formspec_escape(core.settings:get("port")) .. "]"
|
||||
end
|
||||
else
|
||||
retval = retval ..
|
||||
"button[8.5,5;3.25,0.5;play;".. fgettext("Play Game") .. "]"
|
||||
end
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
local function main_button_handler(this, fields, name, tabdata)
|
||||
|
||||
assert(name == "singleplayer")
|
||||
assert(name == "local")
|
||||
|
||||
local world_doubleclick = false
|
||||
|
||||
|
@ -125,7 +154,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||
end
|
||||
|
||||
if event.type == "CHG" and selected ~= nil then
|
||||
core.setting_set("mainmenu_last_selected_world",
|
||||
core.settings:set("mainmenu_last_selected_world",
|
||||
menudata.worldlist:get_raw_index(selected))
|
||||
return true
|
||||
end
|
||||
|
@ -136,7 +165,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||
end
|
||||
|
||||
if fields["cb_creative_mode"] then
|
||||
core.setting_set("creative_mode", fields["cb_creative_mode"])
|
||||
core.settings:set("creative_mode", fields["cb_creative_mode"])
|
||||
local selected = core.get_textlist_index("sp_worlds")
|
||||
menu_worldmt(selected, "creative_mode", fields["cb_creative_mode"])
|
||||
|
||||
|
@ -144,27 +173,65 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||
end
|
||||
|
||||
if fields["cb_enable_damage"] then
|
||||
core.setting_set("enable_damage", fields["cb_enable_damage"])
|
||||
core.settings:set("enable_damage", fields["cb_enable_damage"])
|
||||
local selected = core.get_textlist_index("sp_worlds")
|
||||
menu_worldmt(selected, "enable_damage", fields["cb_enable_damage"])
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["play"] ~= nil or
|
||||
world_doubleclick or
|
||||
fields["key_enter"] then
|
||||
if fields["cb_server"] then
|
||||
core.settings:set("enable_server", fields["cb_server"])
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["cb_server_announce"] then
|
||||
core.settings:set("server_announce", fields["cb_server_announce"])
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
menu_worldmt(selected, "server_announce", fields["cb_server_announce"])
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["play"] ~= nil or world_doubleclick or fields["key_enter"] then
|
||||
local selected = core.get_textlist_index("sp_worlds")
|
||||
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
||||
|
||||
if selected ~= nil and gamedata.selected_world ~= 0 then
|
||||
gamedata.singleplayer = true
|
||||
core.start()
|
||||
|
||||
if core.settings:get_bool("enable_server") then
|
||||
if selected ~= nil and gamedata.selected_world ~= 0 then
|
||||
gamedata.playername = fields["te_playername"]
|
||||
gamedata.password = fields["te_passwd"]
|
||||
gamedata.port = fields["te_serverport"]
|
||||
gamedata.address = ""
|
||||
|
||||
core.settings:set("port",gamedata.port)
|
||||
if fields["te_serveraddr"] ~= nil then
|
||||
core.settings:set("bind_address",fields["te_serveraddr"])
|
||||
end
|
||||
|
||||
--update last game
|
||||
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
|
||||
if world then
|
||||
local game, index = gamemgr.find_by_gameid(world.gameid)
|
||||
core.settings:set("menu_last_game", game.id)
|
||||
end
|
||||
|
||||
core.start()
|
||||
else
|
||||
gamedata.errormessage =
|
||||
fgettext("No world created or selected!")
|
||||
end
|
||||
else
|
||||
gamedata.errormessage =
|
||||
fgettext("No world created or selected!")
|
||||
if selected ~= nil and gamedata.selected_world ~= 0 then
|
||||
gamedata.singleplayer = true
|
||||
core.start()
|
||||
else
|
||||
gamedata.errormessage =
|
||||
fgettext("No world created or selected!")
|
||||
end
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["world_create"] ~= nil then
|
||||
|
@ -192,7 +259,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||
mm_texture.update("singleplayer",current_game())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -202,7 +269,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||
local configdialog =
|
||||
create_configure_world_dlg(
|
||||
menudata.worldlist:get_raw_index(selected))
|
||||
|
||||
|
||||
if (configdialog ~= nil) then
|
||||
configdialog:set_parent(this)
|
||||
this:hide()
|
||||
|
@ -210,22 +277,22 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||
mm_texture.update("singleplayer",current_game())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local function on_change(type, old_tab, new_tab)
|
||||
local buttonbar = ui.find_by_name("game_button_bar")
|
||||
|
||||
|
||||
if ( buttonbar == nil ) then
|
||||
singleplayer_refresh_gamebar()
|
||||
buttonbar = ui.find_by_name("game_button_bar")
|
||||
end
|
||||
|
||||
|
||||
if (type == "ENTER") then
|
||||
local game = current_game()
|
||||
|
||||
|
||||
if game then
|
||||
menudata.worldlist:set_filtercriteria(game.id)
|
||||
core.set_topleft_text(game.name)
|
||||
|
@ -242,8 +309,8 @@ end
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
return {
|
||||
name = "singleplayer",
|
||||
caption = fgettext("Singleplayer"),
|
||||
name = "local",
|
||||
caption = fgettext("Local Game"),
|
||||
cbf_formspec = get_formspec,
|
||||
cbf_button_handler = main_button_handler,
|
||||
on_change = on_change
|
|
@ -75,7 +75,7 @@ local function get_formspec(tabview, name, tabdata)
|
|||
if error == nil then
|
||||
local descriptiontext = descriptionfile:read("*all")
|
||||
|
||||
descriptionlines = core.splittext(descriptiontext,42)
|
||||
descriptionlines = core.wrap_text(descriptiontext, 42)
|
||||
descriptionfile:close()
|
||||
else
|
||||
descriptionlines = {}
|
||||
|
|
|
@ -39,14 +39,14 @@ local function get_formspec(tabview, name, tabdata)
|
|||
-- Address / Port
|
||||
"label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" ..
|
||||
"field[8,0.65;3.25,0.5;te_address;;" ..
|
||||
core.formspec_escape(core.setting_get("address")) .. "]" ..
|
||||
core.formspec_escape(core.settings:get("address")) .. "]" ..
|
||||
"field[11.1,0.65;1.4,0.5;te_port;;" ..
|
||||
core.formspec_escape(core.setting_get("remote_port")) .. "]" ..
|
||||
core.formspec_escape(core.settings:get("remote_port")) .. "]" ..
|
||||
|
||||
-- Name / Password
|
||||
"label[7.75,0.95;" .. fgettext("Name / Password") .. "]" ..
|
||||
"field[8,1.85;2.9,0.5;te_name;;" ..
|
||||
core.formspec_escape(core.setting_get("name")) .. "]" ..
|
||||
core.formspec_escape(core.settings:get("name")) .. "]" ..
|
||||
"pwdfield[10.73,1.85;1.77,0.5;te_pwd;]" ..
|
||||
|
||||
-- Description Background
|
||||
|
@ -135,7 +135,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
|
||||
if fields.te_name then
|
||||
gamedata.playername = fields.te_name
|
||||
core.setting_set("name", fields.te_name)
|
||||
core.settings:set("name", fields.te_name)
|
||||
end
|
||||
|
||||
if fields.favourites then
|
||||
|
@ -163,8 +163,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
gamedata.serverdescription = fav.description
|
||||
|
||||
if gamedata.address and gamedata.port then
|
||||
core.setting_set("address", gamedata.address)
|
||||
core.setting_set("remote_port", gamedata.port)
|
||||
core.settings:set("address", gamedata.address)
|
||||
core.settings:set("remote_port", gamedata.port)
|
||||
core.start()
|
||||
end
|
||||
end
|
||||
|
@ -187,8 +187,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
end
|
||||
|
||||
if address and port then
|
||||
core.setting_set("address", address)
|
||||
core.setting_set("remote_port", port)
|
||||
core.settings:set("address", address)
|
||||
core.settings:set("remote_port", port)
|
||||
end
|
||||
tabdata.fav_selected = event.row
|
||||
end
|
||||
|
@ -219,8 +219,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
local port = fav.port
|
||||
gamedata.serverdescription = fav.description
|
||||
if address and port then
|
||||
core.setting_set("address", address)
|
||||
core.setting_set("remote_port", port)
|
||||
core.settings:set("address", address)
|
||||
core.settings:set("remote_port", port)
|
||||
end
|
||||
|
||||
tabdata.fav_selected = fav_idx
|
||||
|
@ -235,8 +235,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
asyncOnlineFavourites()
|
||||
tabdata.fav_selected = nil
|
||||
|
||||
core.setting_set("address", "")
|
||||
core.setting_set("remote_port", "30000")
|
||||
core.settings:set("address", "")
|
||||
core.settings:set("remote_port", "30000")
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -293,13 +293,14 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
end)
|
||||
menudata.search_result = search_result
|
||||
local first_server = search_result[1]
|
||||
core.setting_set("address", first_server.address)
|
||||
core.setting_set("remote_port", first_server.port)
|
||||
core.settings:set("address", first_server.address)
|
||||
core.settings:set("remote_port", first_server.port)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if (fields.btn_mp_connect or fields.key_enter) and fields.te_address and fields.te_port then
|
||||
if (fields.btn_mp_connect or fields.key_enter)
|
||||
and fields.te_address ~= "" and fields.te_port then
|
||||
gamedata.playername = fields.te_name
|
||||
gamedata.password = fields.te_pwd
|
||||
gamedata.address = fields.te_address
|
||||
|
@ -325,8 +326,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
gamedata.serverdescription = ""
|
||||
end
|
||||
|
||||
core.setting_set("address", fields.te_address)
|
||||
core.setting_set("remote_port", fields.te_port)
|
||||
core.settings:set("address", fields.te_address)
|
||||
core.settings:set("remote_port", fields.te_port)
|
||||
|
||||
core.start()
|
||||
return true
|
||||
|
@ -341,8 +342,8 @@ end
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
return {
|
||||
name = "multiplayer",
|
||||
caption = fgettext("Client"),
|
||||
name = "online",
|
||||
caption = fgettext("Play Online"),
|
||||
cbf_formspec = get_formspec,
|
||||
cbf_button_handler = main_button_handler,
|
||||
on_change = on_change
|
|
@ -1,195 +0,0 @@
|
|||
--Minetest
|
||||
--Copyright (C) 2014 sapier
|
||||
--
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 2.1 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function get_formspec(tabview, name, tabdata)
|
||||
|
||||
local index = menudata.worldlist:get_current_index(
|
||||
tonumber(core.setting_get("mainmenu_last_selected_world"))
|
||||
)
|
||||
|
||||
local retval =
|
||||
"button[4,4.15;2.6,0.5;world_delete;" .. fgettext("Delete") .. "]" ..
|
||||
"button[6.5,4.15;2.8,0.5;world_create;" .. fgettext("New") .. "]" ..
|
||||
"button[9.2,4.15;2.55,0.5;world_configure;" .. fgettext("Configure") .. "]" ..
|
||||
"button[8.5,5;3.25,0.5;start_server;" .. fgettext("Start Game") .. "]" ..
|
||||
"label[4,-0.25;" .. fgettext("Select World:") .. "]" ..
|
||||
"checkbox[0.25,0.25;cb_creative_mode;" .. fgettext("Creative Mode") .. ";" ..
|
||||
dump(core.setting_getbool("creative_mode")) .. "]" ..
|
||||
"checkbox[0.25,0.7;cb_enable_damage;" .. fgettext("Enable Damage") .. ";" ..
|
||||
dump(core.setting_getbool("enable_damage")) .. "]" ..
|
||||
"checkbox[0.25,1.15;cb_server_announce;" .. fgettext("Public") .. ";" ..
|
||||
dump(core.setting_getbool("server_announce")) .. "]" ..
|
||||
"label[0.25,2.2;" .. fgettext("Name/Password") .. "]" ..
|
||||
"field[0.55,3.2;3.5,0.5;te_playername;;" ..
|
||||
core.formspec_escape(core.setting_get("name")) .. "]" ..
|
||||
"pwdfield[0.55,4;3.5,0.5;te_passwd;]"
|
||||
|
||||
local bind_addr = core.setting_get("bind_address")
|
||||
if bind_addr ~= nil and bind_addr ~= "" then
|
||||
retval = retval ..
|
||||
"field[0.55,5.2;2.25,0.5;te_serveraddr;" .. fgettext("Bind Address") .. ";" ..
|
||||
core.formspec_escape(core.setting_get("bind_address")) .. "]" ..
|
||||
"field[2.8,5.2;1.25,0.5;te_serverport;" .. fgettext("Port") .. ";" ..
|
||||
core.formspec_escape(core.setting_get("port")) .. "]"
|
||||
else
|
||||
retval = retval ..
|
||||
"field[0.55,5.2;3.5,0.5;te_serverport;" .. fgettext("Server Port") .. ";" ..
|
||||
core.formspec_escape(core.setting_get("port")) .. "]"
|
||||
end
|
||||
|
||||
retval = retval ..
|
||||
"textlist[4,0.25;7.5,3.7;srv_worlds;" ..
|
||||
menu_render_worldlist() ..
|
||||
";" .. index .. "]"
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function main_button_handler(this, fields, name, tabdata)
|
||||
|
||||
local world_doubleclick = false
|
||||
|
||||
if fields["srv_worlds"] ~= nil then
|
||||
local event = core.explode_textlist_event(fields["srv_worlds"])
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
|
||||
menu_worldmt_legacy(selected)
|
||||
|
||||
if event.type == "DCL" then
|
||||
world_doubleclick = true
|
||||
end
|
||||
if event.type == "CHG" then
|
||||
core.setting_set("mainmenu_last_selected_world",
|
||||
menudata.worldlist:get_raw_index(core.get_textlist_index("srv_worlds")))
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if menu_handle_key_up_down(fields,"srv_worlds","mainmenu_last_selected_world") then
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["cb_creative_mode"] then
|
||||
core.setting_set("creative_mode", fields["cb_creative_mode"])
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
menu_worldmt(selected, "creative_mode", fields["cb_creative_mode"])
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["cb_enable_damage"] then
|
||||
core.setting_set("enable_damage", fields["cb_enable_damage"])
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
menu_worldmt(selected, "enable_damage", fields["cb_enable_damage"])
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["cb_server_announce"] then
|
||||
core.setting_set("server_announce", fields["cb_server_announce"])
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
menu_worldmt(selected, "server_announce", fields["cb_server_announce"])
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["start_server"] ~= nil or
|
||||
world_doubleclick or
|
||||
fields["key_enter"] then
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
||||
if selected ~= nil and gamedata.selected_world ~= 0 then
|
||||
gamedata.playername = fields["te_playername"]
|
||||
gamedata.password = fields["te_passwd"]
|
||||
gamedata.port = fields["te_serverport"]
|
||||
gamedata.address = ""
|
||||
|
||||
core.setting_set("port",gamedata.port)
|
||||
if fields["te_serveraddr"] ~= nil then
|
||||
core.setting_set("bind_address",fields["te_serveraddr"])
|
||||
end
|
||||
|
||||
--update last game
|
||||
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
|
||||
if world then
|
||||
local game, index = gamemgr.find_by_gameid(world.gameid)
|
||||
core.setting_set("menu_last_game", game.id)
|
||||
end
|
||||
|
||||
core.start()
|
||||
else
|
||||
gamedata.errormessage =
|
||||
fgettext("No world created or selected!")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["world_create"] ~= nil then
|
||||
local create_world_dlg = create_create_world_dlg(true)
|
||||
create_world_dlg:set_parent(this)
|
||||
create_world_dlg:show()
|
||||
this:hide()
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["world_delete"] ~= nil then
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
if selected ~= nil and
|
||||
selected <= menudata.worldlist:size() then
|
||||
local world = menudata.worldlist:get_list()[selected]
|
||||
if world ~= nil and
|
||||
world.name ~= nil and
|
||||
world.name ~= "" then
|
||||
local index = menudata.worldlist:get_raw_index(selected)
|
||||
local delete_world_dlg = create_delete_world_dlg(world.name,index)
|
||||
delete_world_dlg:set_parent(this)
|
||||
delete_world_dlg:show()
|
||||
this:hide()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if fields["world_configure"] ~= nil then
|
||||
local selected = core.get_textlist_index("srv_worlds")
|
||||
if selected ~= nil then
|
||||
local configdialog =
|
||||
create_configure_world_dlg(
|
||||
menudata.worldlist:get_raw_index(selected))
|
||||
|
||||
if (configdialog ~= nil) then
|
||||
configdialog:set_parent(this)
|
||||
configdialog:show()
|
||||
this:hide()
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
return {
|
||||
name = "server",
|
||||
caption = fgettext("Server"),
|
||||
cbf_formspec = get_formspec,
|
||||
cbf_button_handler = main_button_handler,
|
||||
on_change = nil
|
||||
}
|
|
@ -25,7 +25,8 @@ local labels = {
|
|||
},
|
||||
node_highlighting = {
|
||||
fgettext("Node Outlining"),
|
||||
fgettext("Node Highlighting")
|
||||
fgettext("Node Highlighting"),
|
||||
fgettext("None")
|
||||
},
|
||||
filters = {
|
||||
fgettext("No Filter"),
|
||||
|
@ -52,7 +53,7 @@ local dd_options = {
|
|||
},
|
||||
node_highlighting = {
|
||||
table.concat(labels.node_highlighting, ","),
|
||||
{"box", "halo"}
|
||||
{"box", "halo", "none"}
|
||||
},
|
||||
filters = {
|
||||
table.concat(labels.filters, ","),
|
||||
|
@ -70,39 +71,39 @@ local dd_options = {
|
|||
|
||||
local getSettingIndex = {
|
||||
Leaves = function()
|
||||
local style = core.setting_get("leaves_style")
|
||||
local style = core.settings:get("leaves_style")
|
||||
for idx, name in pairs(dd_options.leaves[2]) do
|
||||
if style == name then return idx end
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
NodeHighlighting = function()
|
||||
local style = core.setting_get("node_highlighting")
|
||||
local style = core.settings:get("node_highlighting")
|
||||
for idx, name in pairs(dd_options.node_highlighting[2]) do
|
||||
if style == name then return idx end
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
Filter = function()
|
||||
if core.setting_get(dd_options.filters[2][3]) == "true" then
|
||||
if core.settings:get(dd_options.filters[2][3]) == "true" then
|
||||
return 3
|
||||
elseif core.setting_get(dd_options.filters[2][3]) == "false" and
|
||||
core.setting_get(dd_options.filters[2][2]) == "true" then
|
||||
elseif core.settings:get(dd_options.filters[2][3]) == "false" and
|
||||
core.settings:get(dd_options.filters[2][2]) == "true" then
|
||||
return 2
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
Mipmap = function()
|
||||
if core.setting_get(dd_options.mipmap[2][3]) == "true" then
|
||||
if core.settings:get(dd_options.mipmap[2][3]) == "true" then
|
||||
return 3
|
||||
elseif core.setting_get(dd_options.mipmap[2][3]) == "false" and
|
||||
core.setting_get(dd_options.mipmap[2][2]) == "true" then
|
||||
elseif core.settings:get(dd_options.mipmap[2][3]) == "false" and
|
||||
core.settings:get(dd_options.mipmap[2][2]) == "true" then
|
||||
return 2
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
Antialiasing = function()
|
||||
local antialiasing_setting = core.setting_get("fsaa")
|
||||
local antialiasing_setting = core.settings:get("fsaa")
|
||||
for i = 1, #dd_options.antialiasing[2] do
|
||||
if antialiasing_setting == dd_options.antialiasing[2][i] then
|
||||
return i
|
||||
|
@ -177,20 +178,20 @@ local function formspec(tabview, name, tabdata)
|
|||
local tab_string =
|
||||
"box[0,0;3.5,4.5;#999999]" ..
|
||||
"checkbox[0.25,0;cb_smooth_lighting;" .. fgettext("Smooth Lighting") .. ";"
|
||||
.. dump(core.setting_getbool("smooth_lighting")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("smooth_lighting")) .. "]" ..
|
||||
"checkbox[0.25,0.5;cb_particles;" .. fgettext("Particles") .. ";"
|
||||
.. dump(core.setting_getbool("enable_particles")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("enable_particles")) .. "]" ..
|
||||
"checkbox[0.25,1;cb_3d_clouds;" .. fgettext("3D Clouds") .. ";"
|
||||
.. dump(core.setting_getbool("enable_3d_clouds")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("enable_3d_clouds")) .. "]" ..
|
||||
"checkbox[0.25,1.5;cb_opaque_water;" .. fgettext("Opaque Water") .. ";"
|
||||
.. dump(core.setting_getbool("opaque_water")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("opaque_water")) .. "]" ..
|
||||
"checkbox[0.25,2.0;cb_connected_glass;" .. fgettext("Connected Glass") .. ";"
|
||||
.. dump(core.setting_getbool("connected_glass")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("connected_glass")) .. "]" ..
|
||||
"dropdown[0.25,2.8;3.3;dd_node_highlighting;" .. dd_options.node_highlighting[1] .. ";"
|
||||
.. getSettingIndex.NodeHighlighting() .. "]" ..
|
||||
"dropdown[0.25,3.6;3.3;dd_leaves_style;" .. dd_options.leaves[1] .. ";"
|
||||
.. getSettingIndex.Leaves() .. "]" ..
|
||||
"box[3.75,0;3.75,3.45;#999999]" ..
|
||||
"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] .. ";"
|
||||
.. getSettingIndex.Filter() .. "]" ..
|
||||
|
@ -199,9 +200,12 @@ local function formspec(tabview, name, tabdata)
|
|||
"label[3.85,2.15;" .. fgettext("Antialiasing:") .. "]" ..
|
||||
"dropdown[3.85,2.6;3.85;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") .. ";"
|
||||
.. dump(core.settings:get_bool("autosave_screensize")) .. "]" ..
|
||||
"box[7.75,0;4,4.4;#999999]" ..
|
||||
"checkbox[8,0;cb_shaders;" .. fgettext("Shaders") .. ";"
|
||||
.. dump(core.setting_getbool("enable_shaders")) .. "]"
|
||||
.. dump(core.settings:get_bool("enable_shaders")) .. "]"
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
tab_string = tab_string ..
|
||||
|
@ -218,29 +222,29 @@ local function formspec(tabview, name, tabdata)
|
|||
.. fgettext("Advanced Settings") .. "]"
|
||||
|
||||
|
||||
if core.setting_get("touchscreen_threshold") ~= nil then
|
||||
if core.settings:get("touchscreen_threshold") ~= nil then
|
||||
tab_string = tab_string ..
|
||||
"label[4.3,4.1;" .. fgettext("Touchthreshold (px)") .. "]" ..
|
||||
"dropdown[3.85,4.55;3.85;dd_touchthreshold;0,10,20,30,40,50;" ..
|
||||
((tonumber(core.setting_get("touchscreen_threshold")) / 10) + 1) .. "]"
|
||||
((tonumber(core.settings:get("touchscreen_threshold")) / 10) + 1) .. "]"
|
||||
end
|
||||
|
||||
if core.setting_getbool("enable_shaders") then
|
||||
if core.settings:get_bool("enable_shaders") then
|
||||
tab_string = tab_string ..
|
||||
"checkbox[8,0.5;cb_bumpmapping;" .. fgettext("Bump Mapping") .. ";"
|
||||
.. dump(core.setting_getbool("enable_bumpmapping")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("enable_bumpmapping")) .. "]" ..
|
||||
"checkbox[8,1;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";"
|
||||
.. dump(core.setting_getbool("tone_mapping")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("tone_mapping")) .. "]" ..
|
||||
"checkbox[8,1.5;cb_generate_normalmaps;" .. fgettext("Normal Mapping") .. ";"
|
||||
.. dump(core.setting_getbool("generate_normalmaps")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("generate_normalmaps")) .. "]" ..
|
||||
"checkbox[8,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
|
||||
.. dump(core.setting_getbool("enable_parallax_occlusion")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("enable_parallax_occlusion")) .. "]" ..
|
||||
"checkbox[8,2.5;cb_waving_water;" .. fgettext("Waving Water") .. ";"
|
||||
.. dump(core.setting_getbool("enable_waving_water")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("enable_waving_water")) .. "]" ..
|
||||
"checkbox[8,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
|
||||
.. dump(core.setting_getbool("enable_waving_leaves")) .. "]" ..
|
||||
.. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
|
||||
"checkbox[8,3.5;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
|
||||
.. dump(core.setting_getbool("enable_waving_plants")) .. "]"
|
||||
.. dump(core.settings:get_bool("enable_waving_plants")) .. "]"
|
||||
else
|
||||
tab_string = tab_string ..
|
||||
"tablecolumns[color;text]" ..
|
||||
|
@ -271,60 +275,64 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||
return true
|
||||
end
|
||||
if fields["cb_smooth_lighting"] then
|
||||
core.setting_set("smooth_lighting", fields["cb_smooth_lighting"])
|
||||
core.settings:set("smooth_lighting", fields["cb_smooth_lighting"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_particles"] then
|
||||
core.setting_set("enable_particles", fields["cb_particles"])
|
||||
core.settings:set("enable_particles", fields["cb_particles"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_3d_clouds"] then
|
||||
core.setting_set("enable_3d_clouds", fields["cb_3d_clouds"])
|
||||
core.settings:set("enable_3d_clouds", fields["cb_3d_clouds"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_opaque_water"] then
|
||||
core.setting_set("opaque_water", fields["cb_opaque_water"])
|
||||
core.settings:set("opaque_water", fields["cb_opaque_water"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_connected_glass"] then
|
||||
core.setting_set("connected_glass", fields["cb_connected_glass"])
|
||||
core.settings:set("connected_glass", fields["cb_connected_glass"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_autosave_screensize"] then
|
||||
core.settings:set("autosave_screensize", fields["cb_autosave_screensize"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_shaders"] then
|
||||
if (core.setting_get("video_driver") == "direct3d8" or
|
||||
core.setting_get("video_driver") == "direct3d9") then
|
||||
core.setting_set("enable_shaders", "false")
|
||||
if (core.settings:get("video_driver") == "direct3d8" or
|
||||
core.settings:get("video_driver") == "direct3d9") then
|
||||
core.settings:set("enable_shaders", "false")
|
||||
gamedata.errormessage = fgettext("To enable shaders the OpenGL driver needs to be used.")
|
||||
else
|
||||
core.setting_set("enable_shaders", fields["cb_shaders"])
|
||||
core.settings:set("enable_shaders", fields["cb_shaders"])
|
||||
end
|
||||
return true
|
||||
end
|
||||
if fields["cb_bumpmapping"] then
|
||||
core.setting_set("enable_bumpmapping", fields["cb_bumpmapping"])
|
||||
core.settings:set("enable_bumpmapping", fields["cb_bumpmapping"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_tonemapping"] then
|
||||
core.setting_set("tone_mapping", fields["cb_tonemapping"])
|
||||
core.settings:set("tone_mapping", fields["cb_tonemapping"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_generate_normalmaps"] then
|
||||
core.setting_set("generate_normalmaps", fields["cb_generate_normalmaps"])
|
||||
core.settings:set("generate_normalmaps", fields["cb_generate_normalmaps"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_parallax"] then
|
||||
core.setting_set("enable_parallax_occlusion", fields["cb_parallax"])
|
||||
core.settings:set("enable_parallax_occlusion", fields["cb_parallax"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_waving_water"] then
|
||||
core.setting_set("enable_waving_water", fields["cb_waving_water"])
|
||||
core.settings:set("enable_waving_water", fields["cb_waving_water"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_waving_leaves"] then
|
||||
core.setting_set("enable_waving_leaves", fields["cb_waving_leaves"])
|
||||
core.settings:set("enable_waving_leaves", fields["cb_waving_leaves"])
|
||||
end
|
||||
if fields["cb_waving_plants"] then
|
||||
core.setting_set("enable_waving_plants", fields["cb_waving_plants"])
|
||||
core.settings:set("enable_waving_plants", fields["cb_waving_plants"])
|
||||
return true
|
||||
end
|
||||
if fields["btn_change_keys"] then
|
||||
|
@ -332,7 +340,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||
return true
|
||||
end
|
||||
if fields["cb_touchscreen_target"] then
|
||||
core.setting_set("touchtarget", fields["cb_touchscreen_target"])
|
||||
core.settings:set("touchtarget", fields["cb_touchscreen_target"])
|
||||
return true
|
||||
end
|
||||
if fields["btn_reset_singleplayer"] then
|
||||
|
@ -345,49 +353,49 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||
|
||||
for i = 1, #labels.leaves do
|
||||
if fields["dd_leaves_style"] == labels.leaves[i] then
|
||||
core.setting_set("leaves_style", dd_options.leaves[2][i])
|
||||
core.settings:set("leaves_style", dd_options.leaves[2][i])
|
||||
ddhandled = true
|
||||
end
|
||||
end
|
||||
for i = 1, #labels.node_highlighting do
|
||||
if fields["dd_node_highlighting"] == labels.node_highlighting[i] then
|
||||
core.setting_set("node_highlighting", dd_options.node_highlighting[2][i])
|
||||
core.settings:set("node_highlighting", dd_options.node_highlighting[2][i])
|
||||
ddhandled = true
|
||||
end
|
||||
end
|
||||
if fields["dd_filters"] == labels.filters[1] then
|
||||
core.setting_set("bilinear_filter", "false")
|
||||
core.setting_set("trilinear_filter", "false")
|
||||
core.settings:set("bilinear_filter", "false")
|
||||
core.settings:set("trilinear_filter", "false")
|
||||
ddhandled = true
|
||||
elseif fields["dd_filters"] == labels.filters[2] then
|
||||
core.setting_set("bilinear_filter", "true")
|
||||
core.setting_set("trilinear_filter", "false")
|
||||
core.settings:set("bilinear_filter", "true")
|
||||
core.settings:set("trilinear_filter", "false")
|
||||
ddhandled = true
|
||||
elseif fields["dd_filters"] == labels.filters[3] then
|
||||
core.setting_set("bilinear_filter", "false")
|
||||
core.setting_set("trilinear_filter", "true")
|
||||
core.settings:set("bilinear_filter", "false")
|
||||
core.settings:set("trilinear_filter", "true")
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_mipmap"] == labels.mipmap[1] then
|
||||
core.setting_set("mip_map", "false")
|
||||
core.setting_set("anisotropic_filter", "false")
|
||||
core.settings:set("mip_map", "false")
|
||||
core.settings:set("anisotropic_filter", "false")
|
||||
ddhandled = true
|
||||
elseif fields["dd_mipmap"] == labels.mipmap[2] then
|
||||
core.setting_set("mip_map", "true")
|
||||
core.setting_set("anisotropic_filter", "false")
|
||||
core.settings:set("mip_map", "true")
|
||||
core.settings:set("anisotropic_filter", "false")
|
||||
ddhandled = true
|
||||
elseif fields["dd_mipmap"] == labels.mipmap[3] then
|
||||
core.setting_set("mip_map", "true")
|
||||
core.setting_set("anisotropic_filter", "true")
|
||||
core.settings:set("mip_map", "true")
|
||||
core.settings:set("anisotropic_filter", "true")
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_antialiasing"] then
|
||||
core.setting_set("fsaa",
|
||||
core.settings:set("fsaa",
|
||||
antialiasing_fname_to_name(fields["dd_antialiasing"]))
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_touchthreshold"] then
|
||||
core.setting_set("touchscreen_threshold", fields["dd_touchthreshold"])
|
||||
core.settings:set("touchscreen_threshold", fields["dd_touchthreshold"])
|
||||
ddhandled = true
|
||||
end
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ local function get_formspec(tabview, name, tabdata)
|
|||
local retval =
|
||||
"label[9.5,0;".. fgettext("Name / Password") .. "]" ..
|
||||
"field[0.25,3.35;5.5,0.5;te_address;;" ..
|
||||
core.formspec_escape(core.setting_get("address")) .."]" ..
|
||||
core.formspec_escape(core.settings:get("address")) .."]" ..
|
||||
"field[5.75,3.35;2.25,0.5;te_port;;" ..
|
||||
core.formspec_escape(core.setting_get("remote_port")) .."]" ..
|
||||
core.formspec_escape(core.settings:get("remote_port")) .."]" ..
|
||||
"button[10,2.6;2,1.5;btn_mp_connect;".. fgettext("Connect") .. "]" ..
|
||||
"field[9.8,1;2.6,0.5;te_name;;" ..
|
||||
core.formspec_escape(core.setting_get("name")) .."]" ..
|
||||
core.formspec_escape(core.settings:get("name")) .."]" ..
|
||||
"pwdfield[9.8,2;2.6,0.5;te_pwd;]"
|
||||
|
||||
|
||||
|
@ -89,9 +89,9 @@ local function get_formspec(tabview, name, tabdata)
|
|||
-- checkboxes
|
||||
retval = retval ..
|
||||
"checkbox[8.0,3.9;cb_creative;".. fgettext("Creative Mode") .. ";" ..
|
||||
dump(core.setting_getbool("creative_mode")) .. "]"..
|
||||
dump(core.settings:get_bool("creative_mode")) .. "]"..
|
||||
"checkbox[8.0,4.4;cb_damage;".. fgettext("Enable Damage") .. ";" ..
|
||||
dump(core.setting_getbool("enable_damage")) .. "]"
|
||||
dump(core.settings:get_bool("enable_damage")) .. "]"
|
||||
-- buttons
|
||||
retval = retval ..
|
||||
"button[0,3.7;8,1.5;btn_start_singleplayer;" .. fgettext("Start Singleplayer") .. "]" ..
|
||||
|
@ -128,8 +128,8 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
end
|
||||
|
||||
if address and port then
|
||||
core.setting_set("address", address)
|
||||
core.setting_set("remote_port", port)
|
||||
core.settings:set("address", address)
|
||||
core.settings:set("remote_port", port)
|
||||
end
|
||||
tabdata.fav_selected = event.row
|
||||
end
|
||||
|
@ -145,18 +145,18 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
asyncOnlineFavourites()
|
||||
tabdata.fav_selected = nil
|
||||
|
||||
core.setting_set("address", "")
|
||||
core.setting_set("remote_port", "30000")
|
||||
core.settings:set("address", "")
|
||||
core.settings:set("remote_port", "30000")
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.cb_creative then
|
||||
core.setting_set("creative_mode", fields.cb_creative)
|
||||
core.settings:set("creative_mode", fields.cb_creative)
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.cb_damage then
|
||||
core.setting_set("enable_damage", fields.cb_damage)
|
||||
core.settings:set("enable_damage", fields.cb_damage)
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -186,12 +186,12 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
|
||||
gamedata.selected_world = 0
|
||||
|
||||
core.setting_set("address", fields.te_address)
|
||||
core.setting_set("remote_port", fields.te_port)
|
||||
|
||||
core.start()
|
||||
return true
|
||||
end
|
||||
core.settings:set("address", fields.te_address)
|
||||
core.settings:set("remote_port", fields.te_port)
|
||||
|
||||
core.start()
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.btn_config_sp_world then
|
||||
local configdialog = create_configure_world_dlg(1)
|
||||
|
|
|
@ -54,9 +54,9 @@ local function get_formspec(tabview, name, tabdata)
|
|||
local retval = "label[4,-0.25;" .. fgettext("Select texture pack:") .. "]" ..
|
||||
"textlist[4,0.25;7.5,5.0;TPs;"
|
||||
|
||||
local current_texture_path = core.setting_get("texture_path")
|
||||
local current_texture_path = core.settings:get("texture_path")
|
||||
local list = filter_texture_pack_list(core.get_dir_list(core.get_texturepath(), true))
|
||||
local index = tonumber(core.setting_get("mainmenu_last_selected_TP"))
|
||||
local index = tonumber(core.settings:get("mainmenu_last_selected_TP"))
|
||||
|
||||
if not index then index = 1 end
|
||||
|
||||
|
@ -106,7 +106,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
local event = core.explode_textlist_event(fields["TPs"])
|
||||
if event.type == "CHG" or event.type == "DCL" then
|
||||
local index = core.get_textlist_index("TPs")
|
||||
core.setting_set("mainmenu_last_selected_TP", index)
|
||||
core.settings:set("mainmenu_last_selected_TP", index)
|
||||
local list = filter_texture_pack_list(core.get_dir_list(core.get_texturepath(), true))
|
||||
local current_index = core.get_textlist_index("TPs")
|
||||
if current_index and #list >= current_index then
|
||||
|
@ -114,7 +114,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
if list[current_index] == fgettext("None") then
|
||||
new_path = ""
|
||||
end
|
||||
core.setting_set("texture_path", new_path)
|
||||
core.settings:set("texture_path", new_path)
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
|
|
@ -24,7 +24,7 @@ function mm_texture.init()
|
|||
DIR_DELIM .. "pack" .. DIR_DELIM
|
||||
mm_texture.basetexturedir = mm_texture.defaulttexturedir
|
||||
|
||||
mm_texture.texturepack = core.setting_get("texture_path")
|
||||
mm_texture.texturepack = core.settings:get("texture_path")
|
||||
|
||||
mm_texture.gameid = nil
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ function mm_texture.reset()
|
|||
mm_texture.set_generic("header")
|
||||
|
||||
if not have_bg then
|
||||
if core.setting_getbool("menu_clouds") then
|
||||
if core.settings:get_bool("menu_clouds") then
|
||||
core.set_clouds(true)
|
||||
else
|
||||
mm_texture.set_dirt_bg()
|
||||
|
@ -88,7 +88,7 @@ function mm_texture.update_game(gamedetails)
|
|||
|
||||
if not have_bg then
|
||||
|
||||
if core.setting_getbool("menu_clouds") then
|
||||
if core.settings:get_bool("menu_clouds") then
|
||||
core.set_clouds(true)
|
||||
else
|
||||
mm_texture.set_dirt_bg()
|
||||
|
|
|
@ -15,10 +15,18 @@
|
|||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
local function get_bool_default(name, default)
|
||||
local val = core.settings:get_bool(name)
|
||||
if val == nil then
|
||||
return default
|
||||
end
|
||||
return val
|
||||
end
|
||||
|
||||
local profiler_path = core.get_builtin_path()..DIR_DELIM.."profiler"..DIR_DELIM
|
||||
local profiler = {}
|
||||
local sampler = assert(loadfile(profiler_path .. "sampling.lua"))(profiler)
|
||||
local instrumentation = assert(loadfile(profiler_path .. "instrumentation.lua"))(profiler, sampler)
|
||||
local instrumentation = assert(loadfile(profiler_path .. "instrumentation.lua"))(profiler, sampler, get_bool_default)
|
||||
local reporter = dofile(profiler_path .. "reporter.lua")
|
||||
profiler.instrument = instrumentation.instrument
|
||||
|
||||
|
@ -27,7 +35,7 @@ profiler.instrument = instrumentation.instrument
|
|||
-- Is called later, after `core.register_chatcommand` was set up.
|
||||
--
|
||||
function profiler.init_chatcommand()
|
||||
local instrument_profiler = core.setting_getbool("instrument.profiler") or false
|
||||
local instrument_profiler = get_bool_default("instrument.profiler", false)
|
||||
if instrument_profiler then
|
||||
instrumentation.init_chatcommand()
|
||||
end
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
local format, pairs, type = string.format, pairs, type
|
||||
local core, get_current_modname = core, core.get_current_modname
|
||||
local profiler, sampler = ...
|
||||
local instrument_builtin = core.setting_getbool("instrument.builtin") or false
|
||||
local profiler, sampler, get_bool_default = ...
|
||||
|
||||
local instrument_builtin = get_bool_default("instrument.builtin", false)
|
||||
|
||||
local register_functions = {
|
||||
register_globalstep = 0,
|
||||
|
@ -137,7 +138,7 @@ local function instrument_register(func, func_name)
|
|||
end
|
||||
|
||||
local function init_chatcommand()
|
||||
if core.setting_getbool("instrument.chatcommand") or true then
|
||||
if get_bool_default("instrument.chatcommand", true) then
|
||||
local orig_register_chatcommand = core.register_chatcommand
|
||||
core.register_chatcommand = function(cmd, def)
|
||||
def.func = instrument {
|
||||
|
@ -153,8 +154,7 @@ end
|
|||
-- Start instrumenting selected functions
|
||||
--
|
||||
local function init()
|
||||
local is_set = core.setting_getbool
|
||||
if is_set("instrument.entity") or true then
|
||||
if get_bool_default("instrument.entity", true) then
|
||||
-- Explicitly declare entity api-methods.
|
||||
-- Simple iteration would ignore lookup via __index.
|
||||
local entity_instrumentation = {
|
||||
|
@ -180,7 +180,7 @@ local function init()
|
|||
end
|
||||
end
|
||||
|
||||
if is_set("instrument.abm") or true then
|
||||
if get_bool_default("instrument.abm", true) then
|
||||
-- Wrap register_abm() to automatically instrument abms.
|
||||
local orig_register_abm = core.register_abm
|
||||
core.register_abm = function(spec)
|
||||
|
@ -193,7 +193,7 @@ local function init()
|
|||
end
|
||||
end
|
||||
|
||||
if is_set("instrument.lbm") or true then
|
||||
if get_bool_default("instrument.lbm", true) then
|
||||
-- Wrap register_lbm() to automatically instrument lbms.
|
||||
local orig_register_lbm = core.register_lbm
|
||||
core.register_lbm = function(spec)
|
||||
|
@ -206,13 +206,13 @@ local function init()
|
|||
end
|
||||
end
|
||||
|
||||
if is_set("instrument.global_callback") or true then
|
||||
if get_bool_default("instrument.global_callback", true) then
|
||||
for func_name, _ in pairs(register_functions) do
|
||||
core[func_name] = instrument_register(core[func_name], func_name)
|
||||
end
|
||||
end
|
||||
|
||||
if is_set("instrument.profiler") or false then
|
||||
if get_bool_default("instrument.profiler", false) then
|
||||
-- Measure overhead of instrumentation, but keep it down for functions
|
||||
-- So keep the `return` for better optimization.
|
||||
profiler.empty_instrument = instrument {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
local DIR_DELIM, LINE_DELIM = DIR_DELIM, "\n"
|
||||
local table, unpack, string, pairs, io, os = table, unpack, string, pairs, io, os
|
||||
local rep, sprintf, tonumber = string.rep, string.format, tonumber
|
||||
local core, setting_get = core, core.setting_get
|
||||
local core, settings = core, core.settings
|
||||
local reporter = {}
|
||||
|
||||
---
|
||||
|
@ -229,7 +229,7 @@ end
|
|||
|
||||
local worldpath = core.get_worldpath()
|
||||
local function get_save_path(format, filter)
|
||||
local report_path = setting_get("profiler.report_path") or ""
|
||||
local report_path = settings:get("profiler.report_path") or ""
|
||||
if report_path ~= "" then
|
||||
core.mkdir(sprintf("%s%s%s", worldpath, DIR_DELIM, report_path))
|
||||
end
|
||||
|
@ -249,7 +249,7 @@ end
|
|||
--
|
||||
function reporter.save(profile, format, filter)
|
||||
if not format or format == "" then
|
||||
format = setting_get("profiler.default_report_format") or "txt"
|
||||
format = settings:get("profiler.default_report_format") or "txt"
|
||||
end
|
||||
if filter == "" then
|
||||
filter = nil
|
||||
|
|
|
@ -185,7 +185,7 @@ end
|
|||
function sampler.init()
|
||||
sampler.reset()
|
||||
|
||||
if core.setting_getbool("instrument.profiler") then
|
||||
if core.settings:get_bool("instrument.profiler") then
|
||||
core.register_globalstep(function()
|
||||
if logged_time == 0 then
|
||||
return
|
||||
|
|
|
@ -107,6 +107,12 @@ continuous_forward (Continuous forward) bool false
|
|||
# Enable Joysticks
|
||||
enable_joysticks (Enable Joysticks) bool false
|
||||
|
||||
# The identifier of the joystick to use
|
||||
joystick_id (Joystick ID) int 0
|
||||
|
||||
# The type of joystick
|
||||
joystick_type (Joystick Type) enum auto auto,generic,xbox
|
||||
|
||||
# The time in seconds it takes between repeated events
|
||||
# when holding down a joystick button combination.
|
||||
repeat_joystick_button_time (Joystick button repetition interval) float 0.17
|
||||
|
@ -156,6 +162,10 @@ keymap_chat (Chat key) key KEY_KEY_T
|
|||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_cmd (Command key) key /
|
||||
|
||||
# Key for opening the chat window to type local commands.
|
||||
# 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
|
||||
|
@ -176,6 +186,26 @@ keymap_fastmove (Fast key) key KEY_KEY_J
|
|||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_noclip (Noclip key) key KEY_KEY_H
|
||||
|
||||
# Key for selecting the next item in the hotbar.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_hotbar_next (Hotbar next key) key KEY_KEY_N
|
||||
|
||||
# Key for selecting the previous item in the hotbar.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_hotbar_previous (Hotbar previous key) key KEY_KEY_B
|
||||
|
||||
# Key for muting the game.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_mute (Mute key) key KEY_KEY_M
|
||||
|
||||
# Key for increasing the volume.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_increase_volume (Inc. volume key) key
|
||||
|
||||
# Key for decreasing the volume.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_decrease_volume (Dec. volume key) key
|
||||
|
||||
# Key for toggling autorun.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_autorun (Autorun key) key
|
||||
|
@ -196,6 +226,10 @@ keymap_screenshot (Screenshot) key KEY_F12
|
|||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_drop (Drop item key) key KEY_KEY_Q
|
||||
|
||||
# Key to use view zoom when possible.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_zoom (View zoom key) key KEY_KEY_Z
|
||||
|
||||
# Key for toggling the display of the HUD.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_toggle_hud (HUD toggle key) key KEY_F1
|
||||
|
@ -204,6 +238,10 @@ keymap_toggle_hud (HUD toggle key) key KEY_F1
|
|||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_toggle_chat (Chat toggle key) key KEY_F2
|
||||
|
||||
# Key for toggling the display of the large chat console.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_console (Large chat console key) key KEY_F10
|
||||
|
||||
# Key for toggling the display of the fog.
|
||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||
keymap_toggle_force_fog_off (Fog toggle key) key KEY_F3
|
||||
|
@ -264,12 +302,19 @@ show_entity_selectionbox (Show entity selection boxes) bool true
|
|||
# when connecting to the server.
|
||||
enable_remote_media_server (Connect to external media server) bool true
|
||||
|
||||
# Enable Lua modding support on client.
|
||||
# This support is experimental and API can change.
|
||||
enable_client_modding (Client modding) bool false
|
||||
|
||||
# URL to the server list displayed in the Multiplayer Tab.
|
||||
serverlist_url (Serverlist URL) string servers.minetest.net
|
||||
|
||||
# File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab.
|
||||
serverlist_file (Serverlist file) string favoriteservers.txt
|
||||
|
||||
# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited
|
||||
max_out_chat_queue_size (Maximum size of the out chat queue) int 20
|
||||
|
||||
[*Graphics]
|
||||
|
||||
[**In-Game]
|
||||
|
@ -302,7 +347,10 @@ enable_clouds (Clouds) bool true
|
|||
enable_3d_clouds (3D clouds) bool true
|
||||
|
||||
# Method used to highlight selected object.
|
||||
node_highlighting (Node highlighting) enum box box,halo
|
||||
node_highlighting (Node highlighting) enum box box,halo,none
|
||||
|
||||
# Adds particles when digging a node.
|
||||
enable_particles (Digging particles) bool true
|
||||
|
||||
[***Filtering]
|
||||
|
||||
|
@ -337,12 +385,20 @@ texture_min_size (Minimum texture size for filters) int 64
|
|||
# when set to higher number than 0.
|
||||
fsaa (FSAA) enum 0 0,1,2,4,8,16
|
||||
|
||||
# Undersampling is similar to using lower screen resolution, but it applies
|
||||
# to the game world only, keeping the GUI intact.
|
||||
# It should give significant performance boost at the cost of less detailed image.
|
||||
undersampling (Undersampling) enum 0 0,2,3,4
|
||||
|
||||
[***Shaders]
|
||||
|
||||
# Shaders allow advanced visual effects and may increase performance on some video cards.
|
||||
# Thy only work with the OpenGL video backend.
|
||||
# This only works with the OpenGL video backend.
|
||||
enable_shaders (Shaders) bool true
|
||||
|
||||
# Path to shader directory. If no path is defined, default location will be used.
|
||||
shader_path (Shader path) path
|
||||
|
||||
[****Tone Mapping]
|
||||
|
||||
# Enables filmic tone mapping
|
||||
|
@ -377,7 +433,7 @@ enable_parallax_occlusion (Parallax occlusion) bool false
|
|||
parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1
|
||||
|
||||
# Strength of parallax.
|
||||
3d_parallax_strength (Parallax occlusion strength) float 0.025
|
||||
3d_paralax_strength (Parallax occlusion strength) float 0.025
|
||||
|
||||
# Number of parallax occlusion iterations.
|
||||
parallax_occlusion_iterations (Parallax occlusion iterations) int 4
|
||||
|
@ -426,6 +482,9 @@ screenW (Screen width) int 800
|
|||
# Height component of the initial window size.
|
||||
screenH (Screen height) int 600
|
||||
|
||||
# Save window size automatically when modified.
|
||||
autosave_screensize (Autosave Screen Size) bool true
|
||||
|
||||
# Fullscreen mode.
|
||||
fullscreen (Full screen) bool false
|
||||
|
||||
|
@ -459,13 +518,13 @@ cloud_height (Cloud height) int 120
|
|||
# Values larger than 26 will start to produce sharp cutoffs at cloud area corners.
|
||||
cloud_radius (Cloud radius) int 12
|
||||
|
||||
# Multiplier for view bobbing.
|
||||
# Enable view bobbing and amount of view bobbing.
|
||||
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
|
||||
view_bobbing_amount (View bobbing) float 1.0
|
||||
view_bobbing_amount (View bobbing factor) float 1.0
|
||||
|
||||
# Multiplier for fall bobbing.
|
||||
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
|
||||
fall_bobbing_amount (Fall bobbing) float 0.0
|
||||
fall_bobbing_amount (Fall bobbing factor) float 0.0
|
||||
|
||||
# 3D support.
|
||||
# Currently supported:
|
||||
|
@ -505,9 +564,21 @@ desynchronize_mapblock_texture_animation (Desynchronize block animation) bool tr
|
|||
# Useful if there's something to be displayed right or left of hotbar.
|
||||
hud_hotbar_max_width (Maximum hotbar width) float 1.0
|
||||
|
||||
# Modifies the size of the hudbar elements.
|
||||
hud_scaling (HUD scale factor) float 1.0
|
||||
|
||||
# Enables caching of facedir rotated meshes.
|
||||
enable_mesh_cache (Mesh cache) bool false
|
||||
|
||||
# Delay between mesh updates on the client in ms. Increasing this will slow
|
||||
# down the rate of mesh updates, thus reducing jitter on slower clients.
|
||||
mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50
|
||||
|
||||
# Size of the MapBlock cache of the mesh generator. Increasing this will
|
||||
# increase the cache hit %, reducing the data being copied from the main
|
||||
# thread, thus reducing jitter.
|
||||
meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size MB) int 20 0 1000
|
||||
|
||||
# Enables minimap.
|
||||
enable_minimap (Minimap) bool true
|
||||
|
||||
|
@ -531,9 +602,16 @@ ambient_occlusion_gamma (Ambient occlusion gamma) float 2.2 0.25 4.0
|
|||
# Enables animation of inventory items.
|
||||
inventory_items_animations (Inventory items animations) bool false
|
||||
|
||||
# Android systems only: Tries to create inventory textures from meshes
|
||||
# when no supported render was found.
|
||||
inventory_image_hack (Inventory image hack) bool false
|
||||
|
||||
# Fraction of the visible distance at which fog starts to be rendered
|
||||
fog_start (Fog Start) float 0.4 0.0 0.99
|
||||
|
||||
# Makes all liquids opaque
|
||||
opaque_water (Opaque liquids) bool false
|
||||
|
||||
[**Menus]
|
||||
|
||||
# Use a cloud animation for the main menu background.
|
||||
|
@ -600,6 +678,10 @@ screenshot_quality (Screenshot quality) int 0 0 100
|
|||
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.
|
||||
screen_dpi (DPI) int 72
|
||||
|
||||
# Windows systems only: Start Minetest with the command line window in the background.
|
||||
# Contains the same information as the file debug.txt (default name).
|
||||
enable_console (Enable console window) bool false
|
||||
|
||||
[*Sound]
|
||||
|
||||
enable_sound (Sound) bool true
|
||||
|
@ -712,6 +794,9 @@ show_statusline_on_connect (Status message on connection) bool true
|
|||
# Enable players getting damage and dying.
|
||||
enable_damage (Damage) bool false
|
||||
|
||||
# Enable creative mode for new created maps.
|
||||
creative_mode (Creative) bool false
|
||||
|
||||
# A chosen map seed for a new map, leave empty for random.
|
||||
# Will be overridden when creating a new world in the main menu.
|
||||
fixed_map_seed (Fixed map seed) string
|
||||
|
@ -864,6 +949,12 @@ liquid_update (Liquid update tick) float 1.0
|
|||
# Stated in mapblocks (16 nodes)
|
||||
block_send_optimize_distance (block send optimize distance) int 4 2
|
||||
|
||||
# If enabled the server will perform map block occlusion culling based on
|
||||
# on the eye position of the player. This can reduce the number of blocks
|
||||
# sent to the client 50-80%. The client will not longer receive most invisible
|
||||
# so that the utility of noclip mode is reduced.
|
||||
server_side_occlusion_culling (Server side occlusion culling) bool true
|
||||
|
||||
[*Mapgen]
|
||||
|
||||
# Name of map generator to be used when creating a new world.
|
||||
|
@ -876,13 +967,10 @@ water_level (Water level) int 1
|
|||
# From how far blocks are generated for clients, stated in mapblocks (16 nodes).
|
||||
max_block_generate_distance (Max block generate distance) int 6
|
||||
|
||||
# Where the map generator stops.
|
||||
# Please note:
|
||||
# - Limited to 31000 (setting above has no effect)
|
||||
# - The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks).
|
||||
# - Those groups have an offset of -32, -32 nodes from the origin.
|
||||
# - Only groups which are within the map_generation_limit are generated
|
||||
map_generation_limit (Map generation limit) int 31000 0 31000
|
||||
# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0).
|
||||
# Only mapchunks completely within the mapgen limit are generated.
|
||||
# Value is stored per-world.
|
||||
mapgen_limit (Map generation limit) int 31000 0 31000
|
||||
|
||||
# Global map generation attributes.
|
||||
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
|
||||
|
@ -915,23 +1003,63 @@ emergequeue_limit_generate (Limit of emerge queues to generate) int 32
|
|||
# at the cost of slightly buggy caves.
|
||||
num_emerge_threads (Number of emerge threads) int 1
|
||||
|
||||
# Noise parameters for biome API temperature, humidity and biome blend.
|
||||
mg_biome_np_heat (Mapgen biome heat noise parameters) noise_params 50, 50, (1000, 1000, 1000), 5349, 3, 0.5, 2.0
|
||||
mg_biome_np_heat_blend (Mapgen heat blend noise parameters) noise_params 0, 1.5, (8, 8, 8), 13, 2, 1.0, 2.0
|
||||
mg_biome_np_humidity (Mapgen biome humidity noise parameters) noise_params 50, 50, (1000, 1000, 1000), 842, 3, 0.5, 2.0
|
||||
mg_biome_np_humidity_blend (Mapgen biome humidity blend noise parameters) noise_params 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0
|
||||
[***Biome API temperature and humidity noise parameters]
|
||||
|
||||
# Temperature variation for biomes.
|
||||
mg_biome_np_heat (Heat noise) noise_params 50, 50, (1000, 1000, 1000), 5349, 3, 0.5, 2.0
|
||||
|
||||
# Small-scale temperature variation for blending biomes on borders.
|
||||
mg_biome_np_heat_blend (Heat blend noise) noise_params 0, 1.5, (8, 8, 8), 13, 2, 1.0, 2.0
|
||||
|
||||
# Humidity variation for biomes.
|
||||
mg_biome_np_humidity (Humidity noise) noise_params 50, 50, (1000, 1000, 1000), 842, 3, 0.5, 2.0
|
||||
|
||||
# Small-scale humidity variation for blending biomes on borders.
|
||||
mg_biome_np_humidity_blend (Humidity blend noise) noise_params 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0
|
||||
|
||||
[***Mapgen v5]
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
mgv5_cave_width (Mapgen v5 cave width) float 0.125
|
||||
# Map generation attributes specific to Mapgen v5.
|
||||
# Flags that are not specified in the flag string are not modified from the default.
|
||||
# Flags starting with 'no' are used to explicitly disable them.
|
||||
mgv5_spflags (Mapgen v5 specific flags) flags caverns caverns,nocaverns
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
mgv5_cave_width (Cave width) float 0.125
|
||||
|
||||
# Y-level of cavern upper limit.
|
||||
mgv5_cavern_limit (Cavern limit) int -256
|
||||
|
||||
# Y-distance over which caverns expand to full size.
|
||||
mgv5_cavern_taper (Cavern taper) int 256
|
||||
|
||||
# Defines full size of caverns, smaller values create larger caverns.
|
||||
mgv5_cavern_threshold (Cavern threshold) float 0.7
|
||||
|
||||
# Variation of biome filler depth.
|
||||
mgv5_np_filler_depth (Filler depth noise) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0
|
||||
|
||||
# Variation of terrain vertical scale.
|
||||
# When noise is < -0.55 terrain is near-flat.
|
||||
mgv5_np_factor (Factor noise) noise_params 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0
|
||||
|
||||
# Y-level of average terrain surface.
|
||||
mgv5_np_height (Height noise) noise_params 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0
|
||||
|
||||
# First of 2 3D noises that together define tunnels.
|
||||
mgv5_np_cave1 (Cave1 noise) noise_params 0, 12, (50, 50, 50), 52534, 4, 0.5, 2.0
|
||||
|
||||
# Second of 2 3D noises that together define tunnels.
|
||||
mgv5_np_cave2 (Cave2 noise) noise_params 0, 12, (50, 50, 50), 10325, 4, 0.5, 2.0
|
||||
|
||||
# 3D noise defining giant caverns.
|
||||
mgv5_np_cavern (Cavern noise) noise_params 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0
|
||||
|
||||
mgv5_np_filler_depth (Mapgen v5 filler depth noise parameters) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0
|
||||
mgv5_np_factor (Mapgen v5 factor noise parameters) noise_params 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0
|
||||
mgv5_np_height (Mapgen v5 height noise parameters) noise_params 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0
|
||||
mgv5_np_cave1 (Mapgen v5 cave1 noise parameters) noise_params 0, 12, (50, 50, 50), 52534, 4, 0.5, 2.0
|
||||
mgv5_np_cave2 (Mapgen v5 cave2 noise parameters) noise_params 0, 12, (50, 50, 50), 10325, 4, 0.5, 2.0
|
||||
# TODO
|
||||
# Noise parameters in group format, unsupported by advanced settings
|
||||
# menu but settable in minetest.conf.
|
||||
# See documentation of noise parameter formats in minetest.conf.example.
|
||||
# 3D noise defining terrain.
|
||||
#mgv5_np_ground = {
|
||||
# offset = 0
|
||||
# scale = 40
|
||||
|
@ -946,27 +1074,52 @@ mgv5_np_cave2 (Mapgen v5 cave2 noise parameters) noise_params 0, 12, (50, 50, 50
|
|||
[***Mapgen v6]
|
||||
|
||||
# Map generation attributes specific to Mapgen v6.
|
||||
# When snowbiomes are enabled jungles are automatically enabled, the 'jungles' flag is ignored.
|
||||
# The 'snowbiomes' flag enables the new 5 biome system.
|
||||
# When the new biome system is enabled jungles are automatically enabled and
|
||||
# the 'jungles' flag is ignored.
|
||||
# Flags that are not specified in the flag string are not modified from the default.
|
||||
# Flags starting with 'no' are used to explicitly disable them.
|
||||
mgv6_spflags (Mapgen v6 flags) flags jungles,biomeblend,mudflow,snowbiomes,trees jungles,biomeblend,mudflow,snowbiomes,flat,trees,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat,notrees
|
||||
mgv6_spflags (Mapgen v6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,trees jungles,biomeblend,mudflow,snowbiomes,flat,trees,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat,notrees
|
||||
|
||||
# Controls size of deserts and beaches in Mapgen v6.
|
||||
# When snowbiomes are enabled 'mgv6_freq_desert' is ignored.
|
||||
mgv6_freq_desert (Mapgen v6 desert frequency) float 0.45
|
||||
mgv6_freq_beach (Mapgen v6 beach frequency) float 0.15
|
||||
# Deserts occur when np_biome exceeds this value.
|
||||
# When the new biome system is enabled, this is ignored.
|
||||
mgv6_freq_desert (Desert noise threshold) float 0.45
|
||||
|
||||
mgv6_np_terrain_base (Mapgen v6 terrain base noise parameters) noise_params -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0
|
||||
mgv6_np_terrain_higher (Mapgen v6 terrain altitude noise parameters) noise_params 20, 16, (500, 500, 500), 85039, 5, 0.6, 2.0
|
||||
mgv6_np_steepness (Mapgen v6 steepness noise parameters) noise_params 0.85, 0.5, (125, 125, 125), -932, 5, 0.7, 2.0
|
||||
mgv6_np_height_select (Mapgen v6 height select noise parameters) noise_params 0.5, 1, (250, 250, 250), 4213, 5, 0.69, 2.0
|
||||
mgv6_np_mud (Mapgen v6 mud noise parameters) noise_params 4, 2, (200, 200, 200), 91013, 3, 0.55, 2.0
|
||||
mgv6_np_beach (Mapgen v6 beach noise parameters) noise_params 0, 1, (250, 250, 250), 59420, 3, 0.50, 2.0
|
||||
mgv6_np_biome (Mapgen v6 biome noise parameters) noise_params 0, 1, (500, 500, 500), 9130, 3, 0.50, 2.0
|
||||
mgv6_np_cave (Mapgen v6 cave noise parameters) noise_params 6, 6, (250, 250, 250), 34329, 3, 0.50, 2.0
|
||||
mgv6_np_humidity (Mapgen v6 humidity noise parameters) noise_params 0.5, 0.5, (500, 500, 500), 72384, 3, 0.50, 2.0
|
||||
mgv6_np_trees (Mapgen v6 trees noise parameters) noise_params 0, 1, (125, 125, 125), 2, 4, 0.66, 2.0
|
||||
mgv6_np_apple_trees (Mapgen v6 apple trees noise parameters) noise_params 0, 1, (100, 100, 100), 342902, 3, 0.45, 2.0
|
||||
# Sandy beaches occur when np_beach exceeds this value.
|
||||
mgv6_freq_beach (Beach noise threshold) float 0.15
|
||||
|
||||
# Y-level of lower terrain and lakebeds.
|
||||
mgv6_np_terrain_base (Terrain base noise) noise_params -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0
|
||||
|
||||
# Y-level of higher (cliff-top) terrain.
|
||||
mgv6_np_terrain_higher (Terrain higher noise) noise_params 20, 16, (500, 500, 500), 85039, 5, 0.6, 2.0
|
||||
|
||||
# Varies steepness of cliffs.
|
||||
mgv6_np_steepness (Steepness noise) noise_params 0.85, 0.5, (125, 125, 125), -932, 5, 0.7, 2.0
|
||||
|
||||
# Defines areas of 'terrain_higher' (cliff-top terrain).
|
||||
mgv6_np_height_select (Height select noise) noise_params 0.5, 1, (250, 250, 250), 4213, 5, 0.69, 2.0
|
||||
|
||||
# Varies depth of biome surface nodes.
|
||||
mgv6_np_mud (Mud noise) noise_params 4, 2, (200, 200, 200), 91013, 3, 0.55, 2.0
|
||||
|
||||
# Defines areas with sandy beaches.
|
||||
mgv6_np_beach (Beach noise) noise_params 0, 1, (250, 250, 250), 59420, 3, 0.50, 2.0
|
||||
|
||||
# Temperature variation for biomes.
|
||||
mgv6_np_biome (Biome noise) noise_params 0, 1, (500, 500, 500), 9130, 3, 0.50, 2.0
|
||||
|
||||
# Variation of number of caves.
|
||||
mgv6_np_cave (Cave noise) noise_params 6, 6, (250, 250, 250), 34329, 3, 0.50, 2.0
|
||||
|
||||
# Humidity variation for biomes.
|
||||
mgv6_np_humidity (Humidity noise) noise_params 0.5, 0.5, (500, 500, 500), 72384, 3, 0.50, 2.0
|
||||
|
||||
# Defines tree areas and tree density.
|
||||
mgv6_np_trees (Trees noise) noise_params 0, 1, (125, 125, 125), 2, 4, 0.66, 2.0
|
||||
|
||||
# Defines areas where trees have apples.
|
||||
mgv6_np_apple_trees (Apple trees noise) noise_params 0, 1, (100, 100, 100), 342902, 3, 0.45, 2.0
|
||||
|
||||
[***Mapgen v7]
|
||||
|
||||
|
@ -975,37 +1128,77 @@ mgv6_np_apple_trees (Mapgen v6 apple trees noise parameters) noise_params 0, 1,
|
|||
# Floatlands are currently experimental and subject to change.
|
||||
# Flags that are not specified in the flag string are not modified from the default.
|
||||
# Flags starting with 'no' are used to explicitly disable them.
|
||||
mgv7_spflags (Mapgen v7 flags) flags mountains,ridges mountains,ridges,floatlands,nomountains,noridges,nofloatlands
|
||||
mgv7_spflags (Mapgen v7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
mgv7_cave_width (Mapgen v7 cave width) float 0.09
|
||||
mgv7_cave_width (Cave width) float 0.09
|
||||
|
||||
# Controls the density of floatland mountain terrain.
|
||||
# Is an offset added to the 'np_mountain' noise value.
|
||||
mgv7_float_mount_density (Mapgen v7 floatland mountain density) float 0.6
|
||||
mgv7_float_mount_density (Floatland mountain density) float 0.6
|
||||
|
||||
# Typical maximum height, above and below midpoint, of floatland mountain terrain.
|
||||
mgv7_float_mount_height (Mapgen v7 floatland mountain height) float 128.0
|
||||
mgv7_float_mount_height (Floatland mountain height) float 128.0
|
||||
|
||||
# Y-level of floatland midpoint and lake surface.
|
||||
mgv7_floatland_level (Mapgen v7 floatland level) int 1280
|
||||
mgv7_floatland_level (Floatland level) int 1280
|
||||
|
||||
# Y-level to which floatland shadows extend.
|
||||
mgv7_shadow_limit (Mapgen v7 shadow limit) int 1024
|
||||
mgv7_shadow_limit (Shadow limit) int 1024
|
||||
|
||||
mgv7_np_terrain_base (Mapgen v7 terrain base noise parameters) noise_params 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0
|
||||
mgv7_np_terrain_alt (Mapgen v7 terrain altitude noise parameters) noise_params 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0
|
||||
mgv7_np_terrain_persist (Mapgen v7 terrain persistation noise parameters) noise_params 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0
|
||||
mgv7_np_height_select (Mapgen v7 height select noise parameters) noise_params -8, 16, (500, 500, 500), 4213, 6, 0.7, 2.0
|
||||
mgv7_np_filler_depth (Mapgen v7 filler depth noise parameters) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
||||
mgv7_np_mount_height (Mapgen v7 mount height noise parameters) noise_params 256, 112, (1000, 1000, 1000), 72449, 3, 0.6, 2.0
|
||||
mgv7_np_ridge_uwater (Mapgen v7 river course noise parameters) noise_params 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0
|
||||
mgv7_np_floatland_base (Mapgen v7 floatland base terrain noise parameters) noise_params -0.6, 1.5, (600, 600, 600), 114, 5, 0.6, 2.0
|
||||
mgv7_np_float_base_height (Mapgen v7 floatland base terrain height noise parameters) noise_params 48, 24, (300, 300, 300), 907, 4, 0.7, 2.0
|
||||
mgv7_np_mountain (Mapgen v7 mountain noise parameters) noise_params -0.6, 1, (250, 350, 250), 5333, 5, 0.63, 2.0
|
||||
mgv7_np_ridge (Mapgen v7 river channel wall noise parameters) noise_params 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0
|
||||
mgv7_np_cave1 (Mapgen v7 cave1 noise parameters) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
|
||||
mgv7_np_cave2 (Mapgen v7 cave2 noise parameters) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
# Y-level of cavern upper limit.
|
||||
mgv7_cavern_limit (Cavern limit) int -256
|
||||
|
||||
# Y-distance over which caverns expand to full size.
|
||||
mgv7_cavern_taper (Cavern taper) int 256
|
||||
|
||||
# Defines full size of caverns, smaller values create larger caverns.
|
||||
mgv7_cavern_threshold (Cavern threshold) float 0.7
|
||||
|
||||
# Y-level of higher (cliff-top) terrain.
|
||||
mgv7_np_terrain_base (Terrain base noise) noise_params 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0
|
||||
|
||||
# Y-level of lower terrain and lakebeds.
|
||||
mgv7_np_terrain_alt (Terrain alt noise) noise_params 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0
|
||||
|
||||
# Varies roughness of terrain.
|
||||
# Defines the 'persistence' value for terrain_base and terrain_alt noises.
|
||||
mgv7_np_terrain_persist (Terrain persistence noise) noise_params 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0
|
||||
|
||||
# Defines areas of higher (cliff-top) terrain and affects steepness of cliffs.
|
||||
mgv7_np_height_select (Height select noise) noise_params -8, 16, (500, 500, 500), 4213, 6, 0.7, 2.0
|
||||
|
||||
# Variation of biome filler depth.
|
||||
mgv7_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
||||
|
||||
# Variation of maximum mountain height (in nodes).
|
||||
mgv7_np_mount_height (Mountain height noise) noise_params 256, 112, (1000, 1000, 1000), 72449, 3, 0.6, 2.0
|
||||
|
||||
# Defines large-scale river channel structure.
|
||||
mgv7_np_ridge_uwater (Ridge underwater noise) noise_params 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0
|
||||
|
||||
# Defines areas of floatland smooth terrain.
|
||||
# Smooth floatlands occur when noise > 0.
|
||||
mgv7_np_floatland_base (Floatland base noise) noise_params -0.6, 1.5, (600, 600, 600), 114, 5, 0.6, 2.0
|
||||
|
||||
# Variation of hill height and lake depth on floatland smooth terrain.
|
||||
mgv7_np_float_base_height (Floatland base height noise) noise_params 48, 24, (300, 300, 300), 907, 4, 0.7, 2.0
|
||||
|
||||
# 3D noise defining mountain structure and height.
|
||||
# Also defines structure of floatland mountain terrain.
|
||||
mgv7_np_mountain (Mountain noise) noise_params -0.6, 1, (250, 350, 250), 5333, 5, 0.63, 2.0
|
||||
|
||||
# 3D noise defining structure of river canyon walls.
|
||||
mgv7_np_ridge (Ridge noise) noise_params 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0
|
||||
|
||||
# 3D noise defining giant caverns.
|
||||
mgv7_np_cavern (Cavern noise) noise_params 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0
|
||||
|
||||
# First of 2 3D noises that together define tunnels.
|
||||
mgv7_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
|
||||
|
||||
# Second of 2 3D noises that together define tunnels.
|
||||
mgv7_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
|
||||
[***Mapgen flat]
|
||||
|
||||
|
@ -1013,46 +1206,49 @@ mgv7_np_cave2 (Mapgen v7 cave2 noise parameters) noise_params 0, 12, (67, 67, 67
|
|||
# Occasional lakes and hills can be added to the flat world.
|
||||
# Flags that are not specified in the flag string are not modified from the default.
|
||||
# Flags starting with 'no' are used to explicitly disable them.
|
||||
mgflat_spflags (Mapgen flat flags) flags lakes,hills,,nolakes,nohills
|
||||
mgflat_spflags (Mapgen flat specific flags) flags nolakes,nohills lakes,hills,nolakes,nohills
|
||||
|
||||
# Y of flat ground.
|
||||
mgflat_ground_level (Mapgen flat ground level) int 8
|
||||
mgflat_ground_level (Ground level) int 8
|
||||
|
||||
# Y of upper limit of large pseudorandom caves.
|
||||
mgflat_large_cave_depth (Mapgen flat large cave depth) int -33
|
||||
mgflat_large_cave_depth (Large cave depth) int -33
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
mgflat_cave_width (Mapgen flat cave width) float 0.09
|
||||
mgflat_cave_width (Cave width) float 0.09
|
||||
|
||||
# Terrain noise threshold for lakes.
|
||||
# Controls proportion of world area covered by lakes.
|
||||
# Adjust towards 0.0 for a larger proportion.
|
||||
mgflat_lake_threshold (Mapgen flat lake threshold) float -0.45
|
||||
mgflat_lake_threshold (Lake threshold) float -0.45
|
||||
|
||||
# Controls steepness/depth of lake depressions.
|
||||
mgflat_lake_steepness (Mapgen flat lake steepness) float 48.0
|
||||
mgflat_lake_steepness (Lake steepness) float 48.0
|
||||
|
||||
# Terrain noise threshold for hills.
|
||||
# Controls proportion of world area covered by hills.
|
||||
# Adjust towards 0.0 for a larger proportion.
|
||||
mgflat_hill_threshold (Mapgen flat hill threshold) float 0.45
|
||||
mgflat_hill_threshold (Hill threshold) float 0.45
|
||||
|
||||
# Controls steepness/height of hills.
|
||||
mgflat_hill_steepness (Mapgen flat hill steepness) float 64.0
|
||||
mgflat_hill_steepness (Hill steepness) float 64.0
|
||||
|
||||
# Determines terrain shape.
|
||||
# The 3 numbers in brackets control the scale of the
|
||||
# terrain, the 3 numbers should be identical.
|
||||
mgflat_np_terrain (Mapgen flat terrain noise parameters) noise_params 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0
|
||||
# Defines location and terrain of optional hills and lakes.
|
||||
mgflat_np_terrain (Terrain noise) noise_params 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0
|
||||
|
||||
mgflat_np_filler_depth (Mapgen flat filler depth noise parameters) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
||||
mgflat_np_cave1 (Mapgen flat cave1 noise parameters) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
|
||||
mgflat_np_cave2 (Mapgen flat cave2 noise parameters) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
# Variation of biome filler depth.
|
||||
mgflat_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
||||
|
||||
# First of 2 3D noises that together define tunnels.
|
||||
mgflat_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
|
||||
|
||||
# Second of 2 3D noises that together define tunnels.
|
||||
mgflat_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
|
||||
[***Mapgen fractal]
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
mgfractal_cave_width (Mapgen fractal cave width) float 0.09
|
||||
mgfractal_cave_width (Cave width) float 0.09
|
||||
|
||||
# Choice of 18 fractals from 9 formulas.
|
||||
# 1 = 4D "Roundy" mandelbrot set.
|
||||
|
@ -1073,48 +1269,55 @@ mgfractal_cave_width (Mapgen fractal cave width) float 0.09
|
|||
# 16 = 3D "Cosine Mandelbulb" julia set.
|
||||
# 17 = 4D "Mandelbulb" mandelbrot set.
|
||||
# 18 = 4D "Mandelbulb" julia set.
|
||||
mgfractal_fractal (Mapgen fractal fractal) int 1 1 18
|
||||
mgfractal_fractal (Fractal type) int 1 1 18
|
||||
|
||||
# Iterations of the recursive function.
|
||||
# Controls the amount of fine detail.
|
||||
mgfractal_iterations (Mapgen fractal iterations) int 11
|
||||
mgfractal_iterations (Iterations) int 11
|
||||
|
||||
# Approximate (X,Y,Z) scale of fractal in nodes.
|
||||
mgfractal_scale (Mapgen fractal scale) v3f (4096.0, 1024.0, 4096.0)
|
||||
mgfractal_scale (Scale) v3f (4096.0, 1024.0, 4096.0)
|
||||
|
||||
# (X,Y,Z) offset of fractal from world centre in units of 'scale'.
|
||||
# Used to move a suitable spawn area of low land close to (0, 0).
|
||||
# The default is suitable for mandelbrot sets, it needs to be edited for julia sets.
|
||||
# Range roughly -2 to 2. Multiply by 'scale' for offset in nodes.
|
||||
mgfractal_offset (Mapgen fractal offset) v3f (1.79, 0.0, 0.0)
|
||||
mgfractal_offset (Offset) v3f (1.79, 0.0, 0.0)
|
||||
|
||||
# W co-ordinate of the generated 3D slice of a 4D fractal.
|
||||
# Determines which 3D slice of the 4D shape is generated.
|
||||
# Has no effect on 3D fractals.
|
||||
# Range roughly -2 to 2.
|
||||
mgfractal_slice_w (Mapgen fractal slice w) float 0.0
|
||||
mgfractal_slice_w (Slice w) float 0.0
|
||||
|
||||
# Julia set only: X component of hypercomplex constant determining julia shape.
|
||||
# Range roughly -2 to 2.
|
||||
mgfractal_julia_x (Mapgen fractal julia x) float 0.33
|
||||
mgfractal_julia_x (Julia x) float 0.33
|
||||
|
||||
# Julia set only: Y component of hypercomplex constant determining julia shape.
|
||||
# Range roughly -2 to 2.
|
||||
mgfractal_julia_y (Mapgen fractal julia y) float 0.33
|
||||
mgfractal_julia_y (Julia y) float 0.33
|
||||
|
||||
# Julia set only: Z component of hypercomplex constant determining julia shape.
|
||||
# Range roughly -2 to 2.
|
||||
mgfractal_julia_z (Mapgen fractal julia z) float 0.33
|
||||
mgfractal_julia_z (Julia z) float 0.33
|
||||
|
||||
# Julia set only: W component of hypercomplex constant determining julia shape.
|
||||
# Has no effect on 3D fractals.
|
||||
# Range roughly -2 to 2.
|
||||
mgfractal_julia_w (Mapgen fractal julia w) float 0.33
|
||||
mgfractal_julia_w (Julia w) float 0.33
|
||||
|
||||
mgfractal_np_seabed (Mapgen fractal seabed noise parameters) noise_params -14, 9, (600, 600, 600), 41900, 5, 0.6, 2.0
|
||||
mgfractal_np_filler_depth (Mapgen fractal filler depth noise parameters) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
||||
mgfractal_np_cave1 (Mapgen fractal cave1 noise parameters) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
|
||||
mgfractal_np_cave2 (Mapgen fractal cave2 noise parameters) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
# Y-level of seabed.
|
||||
mgfractal_np_seabed (Seabed noise) noise_params -14, 9, (600, 600, 600), 41900, 5, 0.6, 2.0
|
||||
|
||||
# Variation of biome filler depth.
|
||||
mgfractal_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
||||
|
||||
# First of 2 3D noises that together define tunnels.
|
||||
mgfractal_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
|
||||
|
||||
# Second of 2 3D noises that together define tunnels.
|
||||
mgfractal_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
|
||||
# Mapgen Valleys parameters
|
||||
[***Mapgen Valleys]
|
||||
|
@ -1215,7 +1418,6 @@ profiler.load (Load the game profiler) bool false
|
|||
profiler.default_report_format (Default report format) enum txt txt,csv,lua,json,json_pretty
|
||||
|
||||
# The file path relative to your worldpath in which profiles will be saved to.
|
||||
#
|
||||
profiler.report_path (Report path) string ""
|
||||
|
||||
[***Instrumentation]
|
||||
|
|
|
@ -1,176 +0,0 @@
|
|||
uniform sampler2D baseTexture;
|
||||
uniform sampler2D normalTexture;
|
||||
uniform sampler2D textureFlags;
|
||||
|
||||
uniform vec4 skyBgColor;
|
||||
uniform float fogDistance;
|
||||
uniform vec3 eyePosition;
|
||||
|
||||
varying vec3 vPosition;
|
||||
varying vec3 worldPosition;
|
||||
|
||||
varying vec3 eyeVec;
|
||||
varying vec3 tsEyeVec;
|
||||
varying vec3 lightVec;
|
||||
varying vec3 tsLightVec;
|
||||
|
||||
bool normalTexturePresent = false;
|
||||
bool texTileableHorizontal = false;
|
||||
bool texTileableVertical = false;
|
||||
bool texSeamless = false;
|
||||
|
||||
const float e = 2.718281828459;
|
||||
const float BS = 10.0;
|
||||
const float fogStart = FOG_START;
|
||||
const float fogShadingParameter = 1 / ( 1 - fogStart);
|
||||
|
||||
#ifdef ENABLE_TONE_MAPPING
|
||||
|
||||
/* Hable's UC2 Tone mapping parameters
|
||||
A = 0.22;
|
||||
B = 0.30;
|
||||
C = 0.10;
|
||||
D = 0.20;
|
||||
E = 0.01;
|
||||
F = 0.30;
|
||||
W = 11.2;
|
||||
equation used: ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F
|
||||
*/
|
||||
|
||||
vec3 uncharted2Tonemap(vec3 x)
|
||||
{
|
||||
return ((x * (0.22 * x + 0.03) + 0.002) / (x * (0.22 * x + 0.3) + 0.06)) - 0.03334;
|
||||
}
|
||||
|
||||
vec4 applyToneMapping(vec4 color)
|
||||
{
|
||||
color = vec4(pow(color.rgb, vec3(2.2)), color.a);
|
||||
const float gamma = 1.6;
|
||||
const float exposureBias = 5.5;
|
||||
color.rgb = uncharted2Tonemap(exposureBias * color.rgb);
|
||||
// Precalculated white_scale from
|
||||
//vec3 whiteScale = 1.0 / uncharted2Tonemap(vec3(W));
|
||||
vec3 whiteScale = vec3(1.036015346);
|
||||
color.rgb *= whiteScale;
|
||||
return vec4(pow(color.rgb, vec3(1.0 / gamma)), color.a);
|
||||
}
|
||||
#endif
|
||||
|
||||
void get_texture_flags()
|
||||
{
|
||||
vec4 flags = texture2D(textureFlags, vec2(0.0, 0.0));
|
||||
if (flags.r > 0.5) {
|
||||
normalTexturePresent = true;
|
||||
}
|
||||
if (flags.g > 0.5) {
|
||||
texTileableHorizontal = true;
|
||||
}
|
||||
if (flags.b > 0.5) {
|
||||
texTileableVertical = true;
|
||||
}
|
||||
if (texTileableHorizontal && texTileableVertical) {
|
||||
texSeamless = true;
|
||||
}
|
||||
}
|
||||
|
||||
float intensity(vec3 color)
|
||||
{
|
||||
return (color.r + color.g + color.b) / 3.0;
|
||||
}
|
||||
|
||||
float get_rgb_height(vec2 uv)
|
||||
{
|
||||
return intensity(texture2D(baseTexture,uv).rgb);
|
||||
}
|
||||
|
||||
vec4 get_normal_map(vec2 uv)
|
||||
{
|
||||
vec4 bump = texture2D(normalTexture, uv).rgba;
|
||||
bump.xyz = normalize(bump.xyz * 2.0 -1.0);
|
||||
bump.y = -bump.y;
|
||||
return bump;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color;
|
||||
vec4 bump;
|
||||
vec2 uv = gl_TexCoord[0].st;
|
||||
bool use_normalmap = false;
|
||||
get_texture_flags();
|
||||
|
||||
#ifdef ENABLE_PARALLAX_OCCLUSION
|
||||
if (normalTexturePresent) {
|
||||
vec3 tsEye = normalize(tsEyeVec);
|
||||
float height = PARALLAX_OCCLUSION_SCALE * texture2D(normalTexture, uv).a - PARALLAX_OCCLUSION_BIAS;
|
||||
uv = uv + texture2D(normalTexture, uv).z * height * vec2(tsEye.x,-tsEye.y);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_NORMALMAPS
|
||||
if (normalTexturePresent) {
|
||||
bump = get_normal_map(uv);
|
||||
use_normalmap = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GENERATE_NORMALMAPS == 1
|
||||
if (use_normalmap == false) {
|
||||
float tl = get_rgb_height (vec2(uv.x-SAMPLE_STEP,uv.y+SAMPLE_STEP));
|
||||
float t = get_rgb_height (vec2(uv.x-SAMPLE_STEP,uv.y-SAMPLE_STEP));
|
||||
float tr = get_rgb_height (vec2(uv.x+SAMPLE_STEP,uv.y+SAMPLE_STEP));
|
||||
float r = get_rgb_height (vec2(uv.x+SAMPLE_STEP,uv.y));
|
||||
float br = get_rgb_height (vec2(uv.x+SAMPLE_STEP,uv.y-SAMPLE_STEP));
|
||||
float b = get_rgb_height (vec2(uv.x,uv.y-SAMPLE_STEP));
|
||||
float bl = get_rgb_height (vec2(uv.x-SAMPLE_STEP,uv.y-SAMPLE_STEP));
|
||||
float l = get_rgb_height (vec2(uv.x-SAMPLE_STEP,uv.y));
|
||||
float dX = (tr + 2.0 * r + br) - (tl + 2.0 * l + bl);
|
||||
float dY = (bl + 2.0 * b + br) - (tl + 2.0 * t + tr);
|
||||
bump = vec4 (normalize(vec3 (dX, -dY, NORMALMAPS_STRENGTH)),1.0);
|
||||
use_normalmap = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
vec4 base = texture2D(baseTexture, uv).rgba;
|
||||
|
||||
#ifdef ENABLE_BUMPMAPPING
|
||||
if (use_normalmap) {
|
||||
vec3 L = normalize(lightVec);
|
||||
vec3 E = normalize(eyeVec);
|
||||
float specular = pow(clamp(dot(reflect(L, bump.xyz), E), 0.0, 1.0),0.5);
|
||||
float diffuse = dot(E,bump.xyz);
|
||||
/* Mathematic optimization
|
||||
* Original: color = 0.05*base.rgb + diffuse*base.rgb + 0.2*specular*base.rgb;
|
||||
* This optimization save 2 multiplications (orig: 4 multiplications + 3 additions
|
||||
* end: 2 multiplications + 3 additions)
|
||||
*/
|
||||
color = (0.05 + diffuse + 0.2 * specular) * base.rgb;
|
||||
} else {
|
||||
color = base.rgb;
|
||||
}
|
||||
#else
|
||||
color = base.rgb;
|
||||
#endif
|
||||
|
||||
vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0);
|
||||
|
||||
#ifdef ENABLE_TONE_MAPPING
|
||||
col = applyToneMapping(col);
|
||||
#endif
|
||||
|
||||
// Due to a bug in some (older ?) graphics stacks (possibly in the glsl compiler ?),
|
||||
// the fog will only be rendered correctly if the last operation before the
|
||||
// clamp() is an addition. Else, the clamp() seems to be ignored.
|
||||
// E.g. the following won't work:
|
||||
// float clarity = clamp(fogShadingParameter
|
||||
// * (fogDistance - length(eyeVec)) / fogDistance), 0.0, 1.0);
|
||||
// As additions usually come for free following a multiplication, the new formula
|
||||
// should be more efficient as well.
|
||||
// Note: clarity = (1 - fogginess)
|
||||
float clarity = clamp(fogShadingParameter
|
||||
- fogShadingParameter * length(eyeVec) / fogDistance, 0.0, 1.0);
|
||||
col = mix(skyBgColor, col, clarity);
|
||||
col = vec4(col.rgb, base.a);
|
||||
|
||||
gl_FragColor = col;
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
uniform mat4 mWorldViewProj;
|
||||
uniform mat4 mWorld;
|
||||
|
||||
// Color of the light emitted by the sun.
|
||||
uniform vec3 dayLight;
|
||||
uniform vec3 eyePosition;
|
||||
uniform float animationTimer;
|
||||
|
||||
varying vec3 vPosition;
|
||||
varying vec3 worldPosition;
|
||||
|
||||
varying vec3 eyeVec;
|
||||
varying vec3 lightVec;
|
||||
varying vec3 tsEyeVec;
|
||||
varying vec3 tsLightVec;
|
||||
|
||||
// Color of the light emitted by the light sources.
|
||||
const vec3 artificialLight = vec3(1.04, 1.04, 1.04);
|
||||
const float e = 2.718281828459;
|
||||
const float BS = 10.0;
|
||||
|
||||
float smoothCurve(float x)
|
||||
{
|
||||
return x * x * (3.0 - 2.0 * x);
|
||||
}
|
||||
float triangleWave(float x)
|
||||
{
|
||||
return abs(fract( x + 0.5 ) * 2.0 - 1.0);
|
||||
}
|
||||
float smoothTriangleWave(float x)
|
||||
{
|
||||
return smoothCurve(triangleWave( x )) * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
||||
#if (MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER
|
||||
vec4 pos = gl_Vertex;
|
||||
pos.y -= 2.0;
|
||||
|
||||
float posYbuf = (pos.z / WATER_WAVE_LENGTH + animationTimer * WATER_WAVE_SPEED * WATER_WAVE_LENGTH);
|
||||
|
||||
pos.y -= sin(posYbuf) * WATER_WAVE_HEIGHT + sin(posYbuf / 7.0) * WATER_WAVE_HEIGHT;
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_LEAVES && ENABLE_WAVING_LEAVES
|
||||
vec4 pos = gl_Vertex;
|
||||
vec4 pos2 = mWorld * gl_Vertex;
|
||||
/*
|
||||
* Mathematic optimization: pos2.x * A + pos2.z * A (2 multiplications + 1 addition)
|
||||
* replaced with: (pos2.x + pos2.z) * A (1 addition + 1 multiplication)
|
||||
* And bufferize calcul to a float
|
||||
*/
|
||||
float pos2XpZ = pos2.x + pos2.z;
|
||||
pos.x += (smoothTriangleWave(animationTimer*10.0 + pos2XpZ * 0.01) * 2.0 - 1.0) * 0.4;
|
||||
pos.y += (smoothTriangleWave(animationTimer*15.0 + pos2XpZ * -0.01) * 2.0 - 1.0) * 0.2;
|
||||
pos.z += (smoothTriangleWave(animationTimer*10.0 + pos2XpZ * -0.01) * 2.0 - 1.0) * 0.4;
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_PLANTS && ENABLE_WAVING_PLANTS
|
||||
vec4 pos = gl_Vertex;
|
||||
vec4 pos2 = mWorld * gl_Vertex;
|
||||
if (gl_TexCoord[0].y < 0.05) {
|
||||
/*
|
||||
* Mathematic optimization: pos2.x * A + pos2.z * A (2 multiplications + 1 addition)
|
||||
* replaced with: (pos2.x + pos2.z) * A (1 addition + 1 multiplication)
|
||||
* And bufferize calcul to a float
|
||||
*/
|
||||
float pos2XpZ = pos2.x + pos2.z;
|
||||
pos.x += (smoothTriangleWave(animationTimer * 20.0 + pos2XpZ * 0.1) * 2.0 - 1.0) * 0.8;
|
||||
pos.y -= (smoothTriangleWave(animationTimer * 10.0 + pos2XpZ * -0.5) * 2.0 - 1.0) * 0.4;
|
||||
}
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#else
|
||||
gl_Position = mWorldViewProj * gl_Vertex;
|
||||
#endif
|
||||
|
||||
vPosition = gl_Position.xyz;
|
||||
worldPosition = (mWorld * gl_Vertex).xyz;
|
||||
vec3 sunPosition = vec3 (0.0, eyePosition.y * BS + 900.0, 0.0);
|
||||
|
||||
vec3 normal, tangent, binormal;
|
||||
normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
if (gl_Normal.x > 0.5) {
|
||||
// 1.0, 0.0, 0.0
|
||||
tangent = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, -1.0));
|
||||
binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));
|
||||
} else if (gl_Normal.x < -0.5) {
|
||||
// -1.0, 0.0, 0.0
|
||||
tangent = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));
|
||||
binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));
|
||||
} else if (gl_Normal.y > 0.5) {
|
||||
// 0.0, 1.0, 0.0
|
||||
tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));
|
||||
binormal = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));
|
||||
} else if (gl_Normal.y < -0.5) {
|
||||
// 0.0, -1.0, 0.0
|
||||
tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));
|
||||
binormal = normalize(gl_NormalMatrix * vec3( 0.0, 0.0, 1.0));
|
||||
} else if (gl_Normal.z > 0.5) {
|
||||
// 0.0, 0.0, 1.0
|
||||
tangent = normalize(gl_NormalMatrix * vec3( 1.0, 0.0, 0.0));
|
||||
binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));
|
||||
} else if (gl_Normal.z < -0.5) {
|
||||
// 0.0, 0.0, -1.0
|
||||
tangent = normalize(gl_NormalMatrix * vec3(-1.0, 0.0, 0.0));
|
||||
binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));
|
||||
}
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
|
||||
lightVec = sunPosition - worldPosition;
|
||||
tsLightVec = lightVec * tbnMatrix;
|
||||
eyeVec = (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
tsEyeVec = eyeVec * tbnMatrix;
|
||||
|
||||
// Calculate color.
|
||||
// Red, green and blue components are pre-multiplied with
|
||||
// the brightness, so now we have to multiply these
|
||||
// colors with the color of the incoming light.
|
||||
// The pre-baked colors are halved to prevent overflow.
|
||||
vec4 color;
|
||||
// The alpha gives the ratio of sunlight in the incoming light.
|
||||
float nightRatio = 1 - gl_Color.a;
|
||||
color.rgb = gl_Color.rgb * (gl_Color.a * dayLight.rgb +
|
||||
nightRatio * artificialLight.rgb) * 2;
|
||||
color.a = 1;
|
||||
|
||||
// Emphase blue a bit in darker places
|
||||
// See C++ implementation in mapblock_mesh.cpp finalColorBlend()
|
||||
float brightness = (color.r + color.g + color.b) / 3;
|
||||
color.b += max(0.0, 0.021 - abs(0.2 * brightness - 0.021) +
|
||||
0.07 * brightness);
|
||||
|
||||
gl_FrontColor = gl_BackColor = clamp(color, 0.0, 1.0);
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
local modname = core.get_current_modname() or "??"
|
||||
local modstorage = core.get_mod_storage()
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_shutdown(function()
|
||||
print("[PREVIEW] shutdown client")
|
||||
end)
|
||||
|
||||
core.register_on_connect(function()
|
||||
print("[PREVIEW] Player connection completed")
|
||||
local server_info = core.get_server_info()
|
||||
print("Server version: " .. server_info.protocol_version)
|
||||
print("Server ip: " .. server_info.ip)
|
||||
print("Server address: " .. server_info.address)
|
||||
print("Server port: " .. server_info.port)
|
||||
end)
|
||||
|
||||
core.register_on_placenode(function(pointed_thing, node)
|
||||
print("The local player place a node!")
|
||||
print("pointed_thing :" .. dump(pointed_thing))
|
||||
print("node placed :" .. dump(node))
|
||||
return false
|
||||
end)
|
||||
|
||||
core.register_on_item_use(function(itemstack, pointed_thing)
|
||||
print("The local player used an item!")
|
||||
print("pointed_thing :" .. dump(pointed_thing))
|
||||
print("item = " .. itemstack:get_name())
|
||||
return false
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_receiving_chat_messages(function(message)
|
||||
print("[PREVIEW] Received message " .. message)
|
||||
return false
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_sending_chat_messages(function(message)
|
||||
print("[PREVIEW] Sending message " .. message)
|
||||
return false
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_hp_modification(function(hp)
|
||||
print("[PREVIEW] HP modified " .. hp)
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_damage_taken(function(hp)
|
||||
print("[PREVIEW] Damage taken " .. hp)
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_globalstep(function(dtime)
|
||||
-- print("[PREVIEW] globalstep " .. dtime)
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_chatcommand("dump", {
|
||||
func = function(param)
|
||||
return true, dump(_G)
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("colorize_test", {
|
||||
func = function(param)
|
||||
return true, core.colorize("red", param)
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("test_node", {
|
||||
func = function(param)
|
||||
core.display_chat_message(dump(core.get_node({x=0, y=0, z=0})))
|
||||
core.display_chat_message(dump(core.get_node_or_nil({x=0, y=0, z=0})))
|
||||
end,
|
||||
})
|
||||
|
||||
local function preview_minimap()
|
||||
local minimap = core.ui.minimap
|
||||
if not minimap then
|
||||
print("[PREVIEW] Minimap is disabled. Skipping.")
|
||||
return
|
||||
end
|
||||
minimap:set_mode(4)
|
||||
minimap:show()
|
||||
minimap:set_pos({x=5, y=50, z=5})
|
||||
minimap:set_shape(math.random(0, 1))
|
||||
|
||||
print("[PREVIEW] Minimap: mode => " .. dump(minimap:get_mode()) ..
|
||||
" position => " .. dump(minimap:get_pos()) ..
|
||||
" angle => " .. dump(minimap:get_angle()))
|
||||
end
|
||||
|
||||
core.after(2, function()
|
||||
print("[PREVIEW] loaded " .. modname .. " mod")
|
||||
modstorage:set_string("current_mod", modname)
|
||||
print(modstorage:get_string("current_mod"))
|
||||
preview_minimap()
|
||||
end)
|
||||
|
||||
core.after(5, function()
|
||||
if core.ui.minimap then
|
||||
core.ui.minimap:show()
|
||||
end
|
||||
|
||||
print("[PREVIEW] Day count: " .. core.get_day_count() ..
|
||||
" time of day " .. core.get_timeofday())
|
||||
|
||||
print("[PREVIEW] Node level: " .. core.get_node_level({x=0, y=20, z=0}) ..
|
||||
" max level " .. core.get_node_max_level({x=0, y=20, z=0}))
|
||||
|
||||
print("[PREVIEW] Find node near: " .. dump(core.find_node_near({x=0, y=20, z=0}, 10,
|
||||
{"group:tree", "default:dirt", "default:stone"})))
|
||||
end)
|
||||
|
||||
core.register_on_dignode(function(pos, node)
|
||||
print("The local player dug a node!")
|
||||
print("pos:" .. dump(pos))
|
||||
print("node:" .. dump(node))
|
||||
return false
|
||||
end)
|
||||
|
||||
core.register_on_punchnode(function(pos, node)
|
||||
print("The local player punched a node!")
|
||||
local itemstack = core.get_wielded_item()
|
||||
--[[
|
||||
-- getters
|
||||
print(dump(itemstack:is_empty()))
|
||||
print(dump(itemstack:get_name()))
|
||||
print(dump(itemstack:get_count()))
|
||||
print(dump(itemstack:get_wear()))
|
||||
print(dump(itemstack:get_meta()))
|
||||
print(dump(itemstack:get_metadata()
|
||||
print(dump(itemstack:is_known()))
|
||||
--print(dump(itemstack:get_definition()))
|
||||
print(dump(itemstack:get_tool_capabilities()))
|
||||
print(dump(itemstack:to_string()))
|
||||
print(dump(itemstack:to_table()))
|
||||
-- setters
|
||||
print(dump(itemstack:set_name("default:dirt")))
|
||||
print(dump(itemstack:set_count("95")))
|
||||
print(dump(itemstack:set_wear(934)))
|
||||
print(dump(itemstack:get_meta()))
|
||||
print(dump(itemstack:get_metadata()))
|
||||
--]]
|
||||
print(dump(itemstack:to_table()))
|
||||
print("pos:" .. dump(pos))
|
||||
print("node:" .. dump(node))
|
||||
return false
|
||||
end)
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
option(ENABLE_SYSTEM_GMP "Use GMP from system" TRUE)
|
||||
mark_as_advanced(GMP_LIBRARY GMP_INCLUDE_DIR)
|
||||
set(USE_SYSTEM_GMP FALSE)
|
||||
|
@ -19,9 +18,9 @@ endif()
|
|||
|
||||
if(NOT USE_SYSTEM_GMP)
|
||||
message(STATUS "Using bundled mini-gmp library.")
|
||||
set(GMP_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/gmp)
|
||||
set(GMP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/gmp)
|
||||
set(GMP_LIBRARY gmp)
|
||||
add_subdirectory(gmp)
|
||||
add_subdirectory(lib/gmp)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
|
|
@ -20,8 +20,7 @@ endif()
|
|||
|
||||
if(NOT JSONCPP_FOUND)
|
||||
message(STATUS "Using bundled JSONCPP library.")
|
||||
set(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/jsoncpp)
|
||||
set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jsoncpp)
|
||||
set(JSON_LIBRARY jsoncpp)
|
||||
add_subdirectory(jsoncpp/json)
|
||||
add_subdirectory(lib/jsoncpp)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# Look for Lua library to use
|
||||
# This selects LuaJIT by default
|
||||
|
||||
option(ENABLE_LUAJIT "Enable LuaJIT support" TRUE)
|
||||
set(USE_LUAJIT FALSE)
|
||||
option(REQUIRE_LUAJIT "Require LuaJIT support" FALSE)
|
||||
if(REQUIRE_LUAJIT)
|
||||
set(ENABLE_LUAJIT TRUE)
|
||||
endif()
|
||||
if(ENABLE_LUAJIT)
|
||||
find_package(LuaJIT)
|
||||
if(LUAJIT_FOUND)
|
||||
set(USE_LUAJIT TRUE)
|
||||
message (STATUS "Using LuaJIT provided by system.")
|
||||
elseif(REQUIRE_LUAJIT)
|
||||
message(FATAL_ERROR "LuaJIT not found whereas REQUIRE_LUAJIT=\"TRUE\" is used.\n"
|
||||
"To continue, either install LuaJIT or do not use REQUIRE_LUAJIT=\"TRUE\".")
|
||||
endif()
|
||||
else()
|
||||
message (STATUS "LuaJIT detection disabled! (ENABLE_LUAJIT=0)")
|
||||
endif()
|
||||
|
||||
if(NOT USE_LUAJIT)
|
||||
message(STATUS "LuaJIT not found, using bundled Lua.")
|
||||
set(LUA_LIBRARY lua)
|
||||
set(LUA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/src)
|
||||
add_subdirectory(lib/lua)
|
||||
endif()
|
File diff suppressed because it is too large
Load Diff
255
doc/lua_api.txt
255
doc/lua_api.txt
|
@ -172,8 +172,8 @@ The main Lua script. Running this script should register everything it
|
|||
wants to register. Subsequent execution depends on minetest calling the
|
||||
registered callbacks.
|
||||
|
||||
`minetest.setting_get(name)` and `minetest.setting_getbool(name)` can be used
|
||||
to read custom or existing settings at load time, if necessary.
|
||||
`minetest.settings` can be used to read custom or existing settings at load
|
||||
time, if necessary. (See `Settings`)
|
||||
|
||||
### `models`
|
||||
Models for entities or meshnodes.
|
||||
|
@ -456,11 +456,13 @@ Examples of sound parameter tables:
|
|||
-- Play locationless on all clients
|
||||
{
|
||||
gain = 1.0, -- default
|
||||
fade = 0.0, -- default, change to a value > 0 to fade the sound in
|
||||
}
|
||||
-- Play locationless to one player
|
||||
{
|
||||
to_player = name,
|
||||
gain = 1.0, -- default
|
||||
fade = 0.0, -- default, change to a value > 0 to fade the sound in
|
||||
}
|
||||
-- Play locationless to one player, looped
|
||||
{
|
||||
|
@ -658,6 +660,10 @@ node definition:
|
|||
The first five bits of `param2` tells which color
|
||||
is picked from the palette.
|
||||
The palette should have 32 pixels.
|
||||
paramtype2 == "glasslikeliquidlevel"
|
||||
^ Only valid for "glasslike_framed" or "glasslike_framed_optional" drawtypes.
|
||||
param2 defines 64 levels of internal liquid.
|
||||
Liquid texture is defined using `special_tiles = {"modname_tilename.png"},`
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -1226,10 +1232,9 @@ Another example: Make red wool from white wool and red dye:
|
|||
from destroyed nodes.
|
||||
* `0` is something that is directly accessible at the start of gameplay
|
||||
* There is no upper limit
|
||||
* `dig_immediate`: (player can always pick up node without tool wear)
|
||||
* `2`: node is removed without tool wear after 0.5 seconds or so
|
||||
(rail, sign)
|
||||
* `3`: node is removed without tool wear immediately (torch)
|
||||
* `dig_immediate`: (player can always pick up node without reducing tool wear)
|
||||
* `2`: the node always gets the digging time 0.5 seconds (rail, sign)
|
||||
* `3`: the node always gets the digging time 0 seconds (torch)
|
||||
* `disable_jump`: Player (and possibly other things) cannot jump from node
|
||||
* `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)`
|
||||
* `bouncy`: value is bounce speed in percent
|
||||
|
@ -1330,6 +1335,10 @@ result in the tool to be able to dig nodes that have a rating of `2` or `3`
|
|||
for this group, and unable to dig the rating `1`, which is the toughest.
|
||||
Unless there is a matching group that enables digging otherwise.
|
||||
|
||||
If the result digging time is 0, a delay of 0.15 seconds is added between
|
||||
digging nodes; If the player releases LMB after digging, this delay is set to 0,
|
||||
i.e. players can more quickly click the nodes away instead of holding LMB.
|
||||
|
||||
#### Damage groups
|
||||
List of damage for groups of entities. See "Entity damage mechanism".
|
||||
|
||||
|
@ -1476,6 +1485,9 @@ Item metadata only contains a key-value store.
|
|||
Some of the values in the key-value store are handled specially:
|
||||
|
||||
* `description`: Set the itemstack's description. Defaults to idef.description
|
||||
* `color`: A `ColorString`, which sets the stack's color.
|
||||
* `palette_index`: If the item has a palette, this is used to get the
|
||||
current color from the palette.
|
||||
|
||||
Example stuff:
|
||||
|
||||
|
@ -1574,7 +1586,7 @@ examples.
|
|||
* Sets default background color of tooltips
|
||||
* Sets default font color of tooltips
|
||||
|
||||
#### `tooltip[<gui_element_name>;<tooltip_text>;<bgcolor>,<fontcolor>]`
|
||||
#### `tooltip[<gui_element_name>;<tooltip_text>;<bgcolor>;<fontcolor>]`
|
||||
* Adds tooltip for an element
|
||||
* `<bgcolor>` tooltip background color as `ColorString` (optional)
|
||||
* `<fontcolor>` tooltip font color as `ColorString` (optional)
|
||||
|
@ -1860,18 +1872,24 @@ Escape sequences
|
|||
Most text can contain escape sequences, that can for example color the text.
|
||||
There are a few exceptions: tab headers, dropdowns and vertical labels can't.
|
||||
The following functions provide escape sequences:
|
||||
* `core.get_color_escape_sequence(color)`:
|
||||
* `minetest.get_color_escape_sequence(color)`:
|
||||
* `color` is a ColorString
|
||||
* The escape sequence sets the text color to `color`
|
||||
* `core.colorize(color, message)`:
|
||||
* `minetest.colorize(color, message)`:
|
||||
* Equivalent to:
|
||||
`core.get_color_escape_sequence(color) ..
|
||||
`minetest.get_color_escape_sequence(color) ..
|
||||
message ..
|
||||
core.get_color_escape_sequence("#ffffff")`
|
||||
minetest.get_color_escape_sequence("#ffffff")`
|
||||
* `color.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)`
|
||||
* Removes foreground colors added by `get_color_escape_sequence`.
|
||||
* `color.strip_background_colors(str)`
|
||||
* Removes background colors added by `get_background_escape_sequence`.
|
||||
* `color.strip_colors(str)`
|
||||
* Removes all color escape sequences.
|
||||
|
||||
Spatial Vectors
|
||||
---------------
|
||||
|
@ -1907,14 +1925,16 @@ Helper functions
|
|||
* `math.sign(x, tolerance)`
|
||||
* Get the sign of a number.
|
||||
Optional: Also returns `0` when the absolute value is within the tolerance (default: `0`)
|
||||
* `string.split(str, separator=",", include_empty=false, max_splits=-1,
|
||||
* sep_is_pattern=false)`
|
||||
* `string.split(str, separator=",", include_empty=false, max_splits=-1, sep_is_pattern=false)`
|
||||
* If `max_splits` is negative, do not limit splits.
|
||||
* `sep_is_pattern` specifies if separator is a plain string or a pattern (regex).
|
||||
* e.g. `string:split("a,b", ",") == {"a","b"}`
|
||||
* `string:trim()`
|
||||
* e.g. `string.trim("\n \t\tfoo bar\t ") == "foo bar"`
|
||||
* `minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))`: returns `"(X,Y,Z)"`
|
||||
* `minetest.wrap_text(str, limit)`: returns a string
|
||||
* Adds new lines to the string to keep it within the specified character limit
|
||||
* limit: Maximal amount of characters in one line
|
||||
* `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.
|
||||
* `minetest.string_to_pos(string)`: returns a position
|
||||
|
@ -1929,6 +1949,8 @@ Helper functions
|
|||
* returns time with microsecond precision. May not return wall time.
|
||||
* `table.copy(table)`: returns a table
|
||||
* returns a deep copy of `table`
|
||||
* `minetest.pointed_thing_to_face_pos(placer, pointed_thing)`: returns a position
|
||||
* returns the exact position on the surface of a pointed node
|
||||
|
||||
`minetest` namespace reference
|
||||
------------------------------
|
||||
|
@ -1943,13 +1965,31 @@ Helper functions
|
|||
* `minetest.get_worldpath()`: returns e.g. `"/home/user/.minetest/world"`
|
||||
* Useful for storing custom data
|
||||
* `minetest.is_singleplayer()`
|
||||
* `minetest.features`
|
||||
* Table containing API feature flags: `{foo=true, bar=true}`
|
||||
* `minetest.features`: Table containing API feature flags
|
||||
{
|
||||
glasslike_framed = true,
|
||||
nodebox_as_selectionbox = true,
|
||||
chat_send_player_param3 = true,
|
||||
get_all_craft_recipes_works = true,
|
||||
use_texture_alpha = true,
|
||||
-- ^ The transparency channel of textures can be used optionally
|
||||
no_legacy_abms = true,
|
||||
-- ^ Tree and grass ABMs are no longer done from C++
|
||||
texture_names_parens = true,
|
||||
-- ^ Texture grouping is possible using parentheses
|
||||
area_store_custom_ids = true,
|
||||
-- ^ Unique Area ID for AreaStore:insert_area
|
||||
add_entity_with_staticdata = true,
|
||||
-- ^ add_entity supports passing initial staticdata to on_activate
|
||||
no_chat_message_prediction = true,
|
||||
-- ^ Chat messages are no longer predicted
|
||||
}
|
||||
* `minetest.has_feature(arg)`: returns `boolean, missing_features`
|
||||
* `arg`: string or table in format `{foo=true, bar=true}`
|
||||
* `missing_features`: `{foo=true, bar=true}`
|
||||
* `minetest.get_player_information(player_name)`: returns a table containing
|
||||
information about player. Example return value:
|
||||
* `minetest.get_player_information(player_name)`:
|
||||
* Returns a table containing information about a player
|
||||
Example return value:
|
||||
{
|
||||
address = "127.0.0.1", -- IP address of client
|
||||
ip_version = 4, -- IPv4 / IPv6
|
||||
|
@ -1960,11 +2000,11 @@ 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
|
||||
--prot_vers = 23, -- protocol version used by client
|
||||
--major = 0, -- major version number
|
||||
--minor = 4, -- minor version number
|
||||
--patch = 10, -- patch version number
|
||||
|
@ -1989,7 +2029,7 @@ Helper functions
|
|||
reliable or verifyable. Compatible forks will have a different name and
|
||||
version entirely. To check for the presence of engine features, test
|
||||
whether the functions exported by the wanted features exist. For example:
|
||||
`if core.nodeupdate then ... end`.
|
||||
`if minetest.nodeupdate then ... end`.
|
||||
|
||||
### Logging
|
||||
* `minetest.debug(...)`
|
||||
|
@ -2140,16 +2180,10 @@ Call these functions only at load time!
|
|||
* See `minetest.builtin_auth_handler` in `builtin.lua` for reference
|
||||
|
||||
### Setting-related
|
||||
* `minetest.setting_set(name, value)`
|
||||
* Setting names can't contain whitespace or any of `="{}#`.
|
||||
* Setting values can't contain the sequence `\n"""`.
|
||||
* Setting names starting with "secure." can't be set.
|
||||
* `minetest.setting_get(name)`: returns string or `nil`
|
||||
* `minetest.setting_setbool(name, value)`
|
||||
* See documentation on `setting_set` for restrictions.
|
||||
* `minetest.setting_getbool(name)`: returns boolean or `nil`
|
||||
* `minetest.setting_get_pos(name)`: returns position or nil
|
||||
* `minetest.setting_save()`, returns `nil`, save all settings to config file
|
||||
* `minetest.settings`: Settings object containing all of the settings from the
|
||||
main config file (`minetest.conf`).
|
||||
* `minetest.setting_get_pos(name)`: Loads a setting from the main settings and
|
||||
parses it as a position (in the format `(1,2,3)`). Returns a position or nil.
|
||||
|
||||
### Authentication
|
||||
* `minetest.notify_authentication_modified(name)`
|
||||
|
@ -2243,9 +2277,11 @@ and `minetest.auth_reload` call the authetification handler.
|
|||
* `minetest.get_gametime()`: returns the time, in seconds, since the world was created
|
||||
* `minetest.get_day_count()`: returns number days elapsed since world was created,
|
||||
* accounting for time changes.
|
||||
* `minetest.find_node_near(pos, radius, nodenames)`: returns pos or `nil`
|
||||
* `minetest.find_node_near(pos, radius, nodenames, [search_center])`: returns pos or `nil`
|
||||
* `radius`: using a maximum metric
|
||||
* `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
|
||||
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
|
||||
|
@ -2326,8 +2362,8 @@ and `minetest.auth_reload` call the authetification handler.
|
|||
* `function EmergeAreaCallback(blockpos, action, calls_remaining, param)`
|
||||
* - `blockpos` is the *block* coordinates of the block that had been emerged
|
||||
* - `action` could be one of the following constant values:
|
||||
* `core.EMERGE_CANCELLED`, `core.EMERGE_ERRORED`, `core.EMERGE_FROM_MEMORY`,
|
||||
* `core.EMERGE_FROM_DISK`, `core.EMERGE_GENERATED`
|
||||
* `minetest.EMERGE_CANCELLED`, `minetest.EMERGE_ERRORED`, `minetest.EMERGE_FROM_MEMORY`,
|
||||
* `minetest.EMERGE_FROM_DISK`, `minetest.EMERGE_GENERATED`
|
||||
* - `calls_remaining` is the number of callbacks to be expected after this one
|
||||
* - `param` is the user-defined parameter passed to emerge_area (or nil if the
|
||||
* parameter was absent)
|
||||
|
@ -2366,11 +2402,27 @@ and `minetest.auth_reload` call the authetification handler.
|
|||
* increase level of leveled node by level, default `level` equals `1`
|
||||
* if `totallevel > maxlevel`, returns rest (`total-max`)
|
||||
* can be negative for decreasing
|
||||
* `core.check_single_for_falling(pos)`
|
||||
* `minetest.fix_light(pos1, pos2)`: returns `true`/`false`
|
||||
* resets the light in a cuboid-shaped part of
|
||||
the map and removes lighting bugs.
|
||||
* Loads the area if it is not loaded.
|
||||
* `pos1` is the corner of the cuboid with the least coordinates
|
||||
(in node coordinates), inclusive.
|
||||
* `pos2` is the opposite corner of the cuboid, inclusive.
|
||||
* The actual updated cuboid might be larger than the specified one,
|
||||
because only whole map blocks can be updated.
|
||||
The actual updated area consists of those map blocks that intersect
|
||||
with the given cuboid.
|
||||
* However, the neighborhood of the updated area might change
|
||||
as well, as light can spread out of the cuboid, also light
|
||||
might be removed.
|
||||
* returns `false` if the area is not fully generated,
|
||||
`true` otherwise
|
||||
* `minetest.check_single_for_falling(pos)`
|
||||
* causes an unsupported `group:falling_node` node to fall and causes an
|
||||
unattached `group:attached_node` node to fall.
|
||||
* does not spread these updates to neighbours.
|
||||
* `core.check_for_falling(pos)`
|
||||
* `minetest.check_for_falling(pos)`
|
||||
* causes an unsupported `group:falling_node` node to fall and causes an
|
||||
unattached `group:attached_node` node to fall.
|
||||
* spread these updates to neighbours and can cause a cascade
|
||||
|
@ -2536,6 +2588,11 @@ These functions return the leftover itemstack.
|
|||
* `spec` is a `SimpleSoundSpec`
|
||||
* `parameters` is a sound parameter table
|
||||
* `minetest.sound_stop(handle)`
|
||||
* `minetest.sound_fade(handle, step, gain)`
|
||||
* `handle` is a handle returned by minetest.sound_play
|
||||
* `step` determines how fast a sound will fade.
|
||||
Negative step will lower the sound volume, positive step will increase the sound volume
|
||||
* `gain` the target gain for the fade.
|
||||
|
||||
### Timing
|
||||
* `minetest.after(time, func, ...)`
|
||||
|
@ -2543,10 +2600,16 @@ These functions return the leftover itemstack.
|
|||
* Optional: Variable number of arguments that are passed to `func`
|
||||
|
||||
### Server
|
||||
* `minetest.request_shutdown([message],[reconnect])`: request for server shutdown. Will display `message` to clients,
|
||||
and `reconnect` == true displays a reconnect button.
|
||||
* `minetest.request_shutdown([message],[reconnect],[delay])`: request for server shutdown. Will display `message` to clients,
|
||||
`reconnect` == true displays a reconnect button,
|
||||
`delay` adds an optional delay (in seconds) before shutdown
|
||||
negative delay cancels the current active shutdown
|
||||
zero delay triggers an immediate shutdown.
|
||||
* `minetest.cancel_shutdown_requests()`: cancel current delayed shutdown
|
||||
* `minetest.get_server_status()`: returns server status string
|
||||
* `minetest.get_server_uptime()`: returns the server uptime in seconds
|
||||
* `minetest.remove_player(name)`: remove player from database (if he is not connected).
|
||||
* Returns a code (0: successful, 1: no such player, 2: player is connected)
|
||||
|
||||
### Bans
|
||||
* `minetest.get_ban_list()`: returns the ban list (same as `minetest.get_ban_description("")`)
|
||||
|
@ -2679,7 +2742,7 @@ These functions return the leftover itemstack.
|
|||
* `minetest.write_json(data[, styled])`: returns a string or `nil` and an error message
|
||||
* Convert a Lua table into a JSON string
|
||||
* styled: Outputs in a human-readable format if this is set, defaults to false
|
||||
* Unserializable things like functions and userdata are saved as null.
|
||||
* Unserializable things like functions and userdata will cause an error.
|
||||
* **Warning**: JSON is more strict than the Lua table format.
|
||||
1. You can only use strings and positive integers of at least one as keys.
|
||||
2. You can not mix string and integer keys.
|
||||
|
@ -2825,6 +2888,8 @@ See `StorageRef`, `NodeMetaRef` and `ItemStackMetaRef`.
|
|||
* Any non-table value will clear the metadata
|
||||
* See "Node Metadata" for an example
|
||||
* returns `true` on success
|
||||
* `equals(other)`
|
||||
* returns `true` if this metadata has the same key-value pairs as `other`
|
||||
|
||||
### `NodeMetaRef`
|
||||
Node metadata: reference extra data and functionality stored in a node.
|
||||
|
@ -2833,6 +2898,10 @@ Can be obtained via `minetest.get_meta(pos)`.
|
|||
#### Methods
|
||||
* All methods in MetaDataRef
|
||||
* `get_inventory()`: returns `InvRef`
|
||||
* `mark_as_private(name or {name1, name2, ...})`: Mark specific vars as private
|
||||
This will prevent them from being sent to the client. Note that the "private"
|
||||
status will only be remembered if an associated key-value pair exists, meaning
|
||||
it's best to call this when initializing all other meta (e.g. on_construct).
|
||||
|
||||
### `ItemStackMetaRef`
|
||||
ItemStack metadata: reference extra data and functionality stored in a stack.
|
||||
|
@ -2966,7 +3035,9 @@ This is basically a reference to a C++ `ServerActiveObject`
|
|||
* `0`: player is drowning,
|
||||
* `1`-`10`: remaining number of bubbles
|
||||
* `11`: bubbles bar is not shown
|
||||
* `set_attribute(attribute, value)`: sets an extra attribute with value on player
|
||||
* `set_attribute(attribute, value)`:
|
||||
* Sets an extra attribute with value on player.
|
||||
* If value is nil, remove attribute from player.
|
||||
* `get_attribute(attribute)`: returns value for extra attribute. Returns nil if no attribute found.
|
||||
* `set_inventory_formspec(formspec)`
|
||||
* Redefine player's inventory form
|
||||
|
@ -2982,7 +3053,11 @@ This is basically a reference to a C++ `ServerActiveObject`
|
|||
* `jump`: multiplier to default jump value (default: `1`)
|
||||
* `gravity`: multiplier to default gravity value (default: `1`)
|
||||
* `sneak`: whether player can sneak (default: `true`)
|
||||
* `sneak_glitch`: whether player can use the sneak glitch (default: `true`)
|
||||
* `sneak_glitch`: whether player can use the new move code replications
|
||||
of the old sneak side-effects: sneak ladders and 2 node sneak jump
|
||||
(default: `false`)
|
||||
* `new_move`: use new move/sneak code. When `false` the exact old code
|
||||
is used for the specific old sneak behaviour (default: `true`)
|
||||
* `get_physics_override()`: returns the table given to set_physics_override
|
||||
* `hud_add(hud definition)`: add a HUD element described by HUD def, returns ID
|
||||
number on success
|
||||
|
@ -3007,13 +3082,24 @@ This is basically a reference to a C++ `ServerActiveObject`
|
|||
* `hud_set_hotbar_selected_image(texturename)`
|
||||
* sets image for selected item of hotbar
|
||||
* `hud_get_hotbar_selected_image`: returns texturename
|
||||
* `set_sky(bgcolor, type, {texture names})`
|
||||
* `set_sky(bgcolor, type, {texture names}, clouds)`
|
||||
* `bgcolor`: ColorSpec, defaults to white
|
||||
* Available types:
|
||||
* `type`: Available types:
|
||||
* `"regular"`: Uses 0 textures, `bgcolor` ignored
|
||||
* `"skybox"`: Uses 6 textures, `bgcolor` used
|
||||
* `"plain"`: Uses 0 textures, `bgcolor` used
|
||||
* `get_sky()`: returns bgcolor, type and a table with the textures
|
||||
* `clouds`: Boolean for whether clouds appear in front of `"skybox"` or
|
||||
`"plain"` custom skyboxes (default: `true`)
|
||||
* `get_sky()`: returns bgcolor, type, table of textures, clouds
|
||||
* `set_clouds(parameters)`: set cloud parameters
|
||||
* `parameters` is a table with the following optional fields:
|
||||
* `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`)
|
||||
* `color`: basic cloud color, with alpha channel (default `#fff0f0e5`)
|
||||
* `ambient`: cloud color lower bound, use for a "glow at night" effect (default `#000000`)
|
||||
* `height`: cloud height, i.e. y of cloud base (default per conf, usually `120`)
|
||||
* `thickness`: cloud thickness in nodes (default `16`)
|
||||
* `speed`: 2D cloud speed + direction in nodes per second (default `{x=0, y=-2}`)
|
||||
* `get_clouds()`: returns a table with the current cloud parameters as in `set_clouds`
|
||||
* `override_day_night_ratio(ratio or nil)`
|
||||
* `0`...`1`: Overrides day-night ratio, controlling sunlight to a specific amount
|
||||
* `nil`: Disables override, defaulting to sunlight based on day-night cycle
|
||||
|
@ -3325,9 +3411,9 @@ Note that the node being queried needs to have already been been registered.
|
|||
|
||||
The following builtin node types have their Content IDs defined as constants:
|
||||
```
|
||||
core.CONTENT_UNKNOWN (ID for "unknown" nodes)
|
||||
core.CONTENT_AIR (ID for "air" nodes)
|
||||
core.CONTENT_IGNORE (ID for "ignore" nodes)
|
||||
minetest.CONTENT_UNKNOWN (ID for "unknown" nodes)
|
||||
minetest.CONTENT_AIR (ID for "air" nodes)
|
||||
minetest.CONTENT_IGNORE (ID for "ignore" nodes)
|
||||
```
|
||||
|
||||
##### Mapgen VoxelManip objects
|
||||
|
@ -3379,8 +3465,14 @@ will place the schematic inside of the VoxelManip.
|
|||
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object containing
|
||||
the region formed by `p1` and `p2`.
|
||||
* returns actual emerged `pmin`, actual emerged `pmax`
|
||||
* `write_to_map()`: Writes the data loaded from the `VoxelManip` back to the map.
|
||||
* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to the map.
|
||||
* **important**: data must be set using `VoxelManip:set_data()` before calling this
|
||||
* if `light` is true, then lighting is automatically recalculated.
|
||||
The default value is true.
|
||||
If `light` is false, no light calculations happen, and you should correct
|
||||
all modified blocks with `minetest.fix_light()` as soon as possible.
|
||||
Keep in mind that modifying the map where light is incorrect can cause
|
||||
more lighting bugs.
|
||||
* `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in
|
||||
the `VoxelManip` at that position
|
||||
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position
|
||||
|
@ -3447,10 +3539,15 @@ It can be created via `Settings(filename)`.
|
|||
* `get(key)`: returns a value
|
||||
* `get_bool(key)`: returns a boolean
|
||||
* `set(key, value)`
|
||||
* Setting names can't contain whitespace or any of `="{}#`.
|
||||
* Setting values can't contain the sequence `\n"""`.
|
||||
* Setting names starting with "secure." can't be set on the main settings object (`minetest.settings`).
|
||||
* `set_bool(key, value)`
|
||||
* See documentation for set() above.
|
||||
* `remove(key)`: returns a boolean (`true` for success)
|
||||
* `get_names()`: returns `{key1,...}`
|
||||
* `write()`: returns a boolean (`true` for success)
|
||||
* write changes to file
|
||||
* Writes changes to file.
|
||||
* `to_table()`: returns `{[key1]=value1,...}`
|
||||
|
||||
Mapgen objects
|
||||
|
@ -3612,24 +3709,26 @@ Definition tables
|
|||
{
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collide_with_objects = true, -- collide with other objects if physical=true
|
||||
collide_with_objects = true, -- collide with other objects if physical = true
|
||||
weight = 5,
|
||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
||||
visual = "cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem",
|
||||
visual_size = {x=1, y=1},
|
||||
collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
|
||||
visual = "cube" / "sprite" / "upright_sprite" / "mesh" / "wielditem",
|
||||
visual_size = {x = 1, y = 1},
|
||||
mesh = "model",
|
||||
textures = {}, -- number of required textures depends on visual
|
||||
colors = {}, -- number of required colors depends on visual
|
||||
spritediv = {x=1, y=1},
|
||||
initial_sprite_basepos = {x=0, y=0},
|
||||
spritediv = {x = 1, y = 1},
|
||||
initial_sprite_basepos = {x = 0, y = 0},
|
||||
is_visible = true,
|
||||
makes_footstep_sound = false,
|
||||
automatic_rotate = false,
|
||||
stepheight = 0,
|
||||
automatic_face_movement_dir = 0.0,
|
||||
-- ^ automatically set yaw to movement direction; offset in degrees; false to disable
|
||||
-- ^ Automatically set yaw to movement direction, offset in degrees,
|
||||
-- 'false' to disable.
|
||||
automatic_face_movement_max_rotation_per_sec = -1,
|
||||
-- ^ limit automatic rotation to this value in degrees per second. values < 0 no limit
|
||||
-- ^ Limit automatic rotation to this value in degrees per second,
|
||||
-- value < 0 no limit.
|
||||
backface_culling = true, -- false to disable backface_culling for model
|
||||
nametag = "", -- by default empty, for players their name is shown if empty
|
||||
nametag_color = <color>, -- sets color of nametag as ColorSpec
|
||||
|
@ -3705,6 +3804,19 @@ Definition tables
|
|||
{hard = 1, metal = 1, spikes = 1}
|
||||
inventory_image = "default_tool_steelaxe.png",
|
||||
wield_image = "",
|
||||
palette = "",
|
||||
--[[
|
||||
^ An image file containing the palette of a node.
|
||||
^ You can set the currently used color as the
|
||||
^ "palette_index" field of the item stack metadata.
|
||||
^ The palette is always stretched to fit indices
|
||||
^ between 0 and 255, to ensure compatibility with
|
||||
^ "colorfacedir" and "colorwallmounted" nodes.
|
||||
]]
|
||||
color = "0xFFFFFFFF",
|
||||
--[[
|
||||
^ The color of the item. The palette overrides this.
|
||||
]]
|
||||
wield_scale = {x = 1, y = 1, z = 1},
|
||||
stack_max = 99,
|
||||
range = 4.0,
|
||||
|
@ -3823,13 +3935,20 @@ Definition tables
|
|||
|
||||
drawtype = "normal", -- See "Node drawtypes"
|
||||
visual_scale = 1.0, --[[
|
||||
^ Supported for drawtypes "plantlike", "signlike", "torchlike", "mesh".
|
||||
^ For plantlike, the image will start at the bottom of the node; for the
|
||||
^ other drawtypes, the image will be centered on the node.
|
||||
^ Supported for drawtypes "plantlike", "signlike", "torchlike",
|
||||
^ "firelike", "mesh".
|
||||
^ For plantlike and firelike, the image will start at the bottom of the
|
||||
^ node, for the other drawtypes the image will be centered on the node.
|
||||
^ Note that positioning for "torchlike" may still change. ]]
|
||||
tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[
|
||||
^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images)
|
||||
^ List can be shortened to needed length ]]
|
||||
overlay_tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[
|
||||
^ Same as `tiles`, but these textures are drawn on top of the
|
||||
^ base tiles. You can use this to colorize only specific parts of
|
||||
^ your texture. If the texture name is an empty string, that
|
||||
^ overlay is not drawn. Since such tiles are drawn twice, it
|
||||
^ is not recommended to use overlays on very common nodes.
|
||||
special_tiles = {tile definition 1, Tile definition 2}, --[[
|
||||
^ Special textures of node; used rarely (old field name: special_materials)
|
||||
^ List can be shortened to needed length ]]
|
||||
|
@ -3857,7 +3976,9 @@ Definition tables
|
|||
diggable = true, -- If false, can never be dug
|
||||
climbable = false, -- If true, can be climbed on (ladder)
|
||||
buildable_to = false, -- If true, placed nodes can replace this node
|
||||
floodable = false, -- If true, liquids flow into and replace this node
|
||||
floodable = false, --[[
|
||||
^ If true, liquids flow into and replace this node.
|
||||
^ Warning: making a liquid node 'floodable' does not work and may cause problems. ]]
|
||||
liquidtype = "none", -- "none"/"source"/"flowing"
|
||||
liquid_alternative_flowing = "", -- Flowing version of source liquid
|
||||
liquid_alternative_source = "", -- Source version of flowing liquid
|
||||
|
@ -3886,6 +4007,12 @@ Definition tables
|
|||
^ If drawtype "nodebox" is used and selection_box is nil, then node_box is used. ]]
|
||||
legacy_facedir_simple = false, -- Support maps made in and before January 2012
|
||||
legacy_wallmounted = false, -- Support maps made in and before January 2012
|
||||
waving = 0, --[[ valid for mesh, nodebox, plantlike, allfaces_optional nodes
|
||||
^ 1 - wave node like plants (top of node moves, bottom is fixed)
|
||||
^ 2 - wave node like leaves (whole node moves side-to-side synchronously)
|
||||
^ caveats: not all models will properly wave
|
||||
^ plantlike drawtype nodes can only wave like plants
|
||||
^ allfaces_optional drawtype nodes can only wave like leaves --]]
|
||||
sounds = {
|
||||
footstep = <SimpleSoundSpec>,
|
||||
dig = <SimpleSoundSpec>, -- "__group" = group-based sound (default)
|
||||
|
@ -3918,6 +4045,14 @@ Definition tables
|
|||
^ Node destructor; called after removing node
|
||||
^ Not called for bulk node placement (i.e. schematics and VoxelManip)
|
||||
^ default: nil ]]
|
||||
on_flood = func(pos, oldnode, newnode), --[[
|
||||
^ Called when a liquid (newnode) is about to flood oldnode, if
|
||||
^ it has `floodable = true` in the nodedef. Not called for bulk
|
||||
^ node placement (i.e. schematics and VoxelManip) or air nodes. If
|
||||
^ return true the node is not flooded, but on_flood callback will
|
||||
^ most likely be called over and over again every liquid update
|
||||
^ interval. Default: nil.
|
||||
^ Warning: making a liquid node 'floodable' does not work and may cause problems. ]]
|
||||
|
||||
after_place_node = func(pos, placer, itemstack, pointed_thing) --[[
|
||||
^ Called after constructing node when node was placed using
|
||||
|
|
|
@ -76,6 +76,9 @@ by texture packs. All existing fallback textures can be found in the directory
|
|||
* `player.png`: front texture of the 2D upright sprite player
|
||||
* `player_back.png`: back texture of the 2D upright sprite player
|
||||
|
||||
* `progress_bar.png`: foreground texture of the loading screen's progress bar
|
||||
* `progress_bar_bg.png`: background texture of the loading screen's progress bar
|
||||
|
||||
* `moon.png`: texture of the moon. Default texture is generated by Minetest
|
||||
* `moon_tonemap.png`: tonemap to be used when `moon.png` was found
|
||||
* `sun.png`: texture of the sun. Default texture is generated by Minetest
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
=============================
|
||||
Minetest World Format 22...25
|
||||
Minetest World Format 22...27
|
||||
=============================
|
||||
|
||||
This applies to a world format carrying the block serialization version
|
||||
22...25, used at least in
|
||||
22...27, used at least in
|
||||
- 0.4.dev-20120322 ... 0.4.dev-20120606 (22...23)
|
||||
- 0.4.0 (23)
|
||||
- 24 was never released as stable and existed for ~2 days
|
||||
- 27 was added in 0.4.15-dev
|
||||
|
||||
The block serialization version does not fully specify every aspect of this
|
||||
format; if compliance with this format is to be checked, it needs to be
|
||||
|
@ -262,15 +263,36 @@ u8 flags
|
|||
- 0x02: day_night_differs: Whether the lighting of the block is different
|
||||
on day and night. Only blocks that have this bit set are updated when
|
||||
day transforms to night.
|
||||
- 0x04: lighting_expired: If true, lighting is invalid and should be
|
||||
updated. If you can't calculate lighting in your generator properly,
|
||||
you could try setting this 1 to everything and setting the uppermost
|
||||
block in every sector as is_underground=0. I am quite sure it doesn't
|
||||
work properly, though.
|
||||
- 0x04: lighting_expired: Not used in version 27 and above. If true,
|
||||
lighting is invalid and should be updated. If you can't calculate
|
||||
lighting in your generator properly, you could try setting this 1 to
|
||||
everything and setting the uppermost block in every sector as
|
||||
is_underground=0. I am quite sure it doesn't work properly, though.
|
||||
- 0x08: generated: True if the block has been generated. If false, block
|
||||
is mostly filled with CONTENT_IGNORE and is likely to contain eg. parts
|
||||
of trees of neighboring blocks.
|
||||
|
||||
u16 lighting_complete
|
||||
- Added in version 27.
|
||||
- This contains 12 flags, each of them corresponds to a direction.
|
||||
- Indicates if the light is correct at the sides of a map block.
|
||||
Lighting may not be correct if the light changed, but a neighbor
|
||||
block was not loaded at that time.
|
||||
If these flags are false, Minetest will automatically recompute light
|
||||
when both this block and its required neighbor are loaded.
|
||||
- The bit order is:
|
||||
nothing, nothing, nothing, nothing,
|
||||
night X-, night Y-, night Z-, night Z+, night Y+, night X+,
|
||||
day X-, day Y-, day Z-, day Z+, day Y+, day X+.
|
||||
Where 'day' is for the day light bank, 'night' is for the night
|
||||
light bank.
|
||||
The 'nothing' bits should be always set, as they will be used
|
||||
to indicate if direct sunlight spreading is finished.
|
||||
- Example: if the block at (0, 0, 0) has
|
||||
lighting_complete = 0b1111111111111110,
|
||||
then Minetest will correct lighting in the day light bank when
|
||||
the block at (1, 0, 0) is also loaded.
|
||||
|
||||
u8 content_width
|
||||
- Number of bytes in the content (param0) fields of nodes
|
||||
if map format version <= 23:
|
||||
|
|
|
@ -18,6 +18,8 @@ dofile(minetest.get_modpath("default").."/mapgen.lua")
|
|||
minetest.register_on_joinplayer(function(player)
|
||||
local cb = function(player)
|
||||
minetest.chat_send_player(player:get_player_name(), "This is the [minimal] \"Minimal Development Test\" game. Use [minetest_game] for the real thing.")
|
||||
player:set_attribute("test_attribute", "test_me")
|
||||
player:set_attribute("remove_this", nil)
|
||||
end
|
||||
minetest.after(2.0, cb, player)
|
||||
end)
|
||||
|
@ -1226,6 +1228,8 @@ minetest.register_node("default:chest_locked", {
|
|||
meta:set_string("owner", "")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
-- this is not really the intended usage but works for testing purposes:
|
||||
meta:mark_as_private("owner")
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
@ -1387,13 +1391,13 @@ minetest.register_abm({
|
|||
|
||||
local srclist = inv:get_list("src")
|
||||
local cooked = nil
|
||||
|
||||
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
|
||||
|
||||
local was_active = false
|
||||
|
||||
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
was_active = true
|
||||
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
|
||||
|
@ -1413,7 +1417,7 @@ minetest.register_abm({
|
|||
meta:set_string("src_time", 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
|
@ -1438,7 +1442,7 @@ minetest.register_abm({
|
|||
local cooked = nil
|
||||
local fuellist = inv:get_list("fuel")
|
||||
local srclist = inv:get_list("src")
|
||||
|
||||
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
|
@ -1464,7 +1468,7 @@ minetest.register_abm({
|
|||
|
||||
meta:set_string("fuel_totaltime", fuel.time)
|
||||
meta:set_string("fuel_time", 0)
|
||||
|
||||
|
||||
local stack = inv:get_stack("fuel", 1)
|
||||
stack:take_item()
|
||||
inv:set_stack("fuel", 1, stack)
|
||||
|
@ -1571,7 +1575,7 @@ function default.grow_tree(data, a, pos, is_apple_tree, seed)
|
|||
y = y+th-1 -- (x, y, z) is now last piece of trunk
|
||||
local leaves_a = VoxelArea:new{MinEdge={x=-2, y=-1, z=-2}, MaxEdge={x=2, y=2, z=2}}
|
||||
local leaves_buffer = {}
|
||||
|
||||
|
||||
-- Force leaves near the trunk
|
||||
local d = 1
|
||||
for xi = -d, d do
|
||||
|
@ -1581,14 +1585,14 @@ function default.grow_tree(data, a, pos, is_apple_tree, seed)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Add leaves randomly
|
||||
for iii = 1, 8 do
|
||||
local d = 1
|
||||
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
|
||||
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
|
||||
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
|
||||
|
||||
|
||||
for xi = 0, d do
|
||||
for yi = 0, d do
|
||||
for zi = 0, d do
|
||||
|
@ -1597,7 +1601,7 @@ function default.grow_tree(data, a, pos, is_apple_tree, seed)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Add the leaves
|
||||
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
|
||||
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
--
|
||||
-- exception handler test module
|
||||
--
|
||||
--
|
||||
-- To avoid this from crashing the module will startup in inactive mode.
|
||||
-- to make specific errors happen you need to cause them by following
|
||||
-- chat command:
|
||||
--
|
||||
-- exceptiontest <location> <errortype>
|
||||
--
|
||||
-- location has to be one of:
|
||||
-- * mapgen: cause in next on_generate call
|
||||
-- * entity_step: spawn a entity and make it do error in on_step
|
||||
-- * globalstep: do error in next globalstep
|
||||
-- * immediate: cause right in chat handler
|
||||
--
|
||||
-- errortypes defined are:
|
||||
-- * segv: make sigsegv happen
|
||||
-- * zerodivision: cause a division by zero to happen
|
||||
-- * exception: throw an exception
|
||||
|
||||
if core.cause_error == nil or
|
||||
type(core.cause_error) ~= "function" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
core.log("action", "WARNING: loading exception handler test module!")
|
||||
|
||||
local exceptiondata = {
|
||||
tocause = "none",
|
||||
mapgen = false,
|
||||
entity_step = false,
|
||||
globalstep = false,
|
||||
}
|
||||
|
||||
local exception_entity =
|
||||
{
|
||||
on_step = function(self, dtime)
|
||||
if exceptiondata.entity_step then
|
||||
core.cause_error(exceptiondata.tocause)
|
||||
end
|
||||
end,
|
||||
}
|
||||
local exception_entity_name = "errorhandler_test:error_entity"
|
||||
|
||||
local function exception_chat_handler(playername, param)
|
||||
local parameters = param:split(" ")
|
||||
|
||||
if #parameters ~= 2 then
|
||||
core.chat_send_player(playername, "Invalid argument count for exceptiontest")
|
||||
end
|
||||
|
||||
core.log("error", "Causing error at:" .. parameters[1])
|
||||
|
||||
if parameters[1] == "mapgen" then
|
||||
exceptiondata.tocause = parameters[2]
|
||||
exceptiondata.mapgen = true
|
||||
elseif parameters[1] == "entity_step" then
|
||||
--spawn entity at player location
|
||||
local player = core.get_player_by_name(playername)
|
||||
|
||||
if player:is_player() then
|
||||
local pos = player:getpos()
|
||||
|
||||
core.add_entity(pos, exception_entity_name)
|
||||
end
|
||||
|
||||
exceptiondata.tocause = parameters[2]
|
||||
exceptiondata.entity_step = true
|
||||
|
||||
elseif parameters[1] == "globalstep" then
|
||||
exceptiondata.tocause = parameters[2]
|
||||
exceptiondata.globalstep = true
|
||||
|
||||
elseif parameters[1] == "immediate" then
|
||||
core.cause_error(parameters[2])
|
||||
|
||||
else
|
||||
core.chat_send_player(playername, "Invalid error location: " .. dump(parameters[1]))
|
||||
end
|
||||
end
|
||||
|
||||
core.register_chatcommand("exceptiontest",
|
||||
{
|
||||
params = "<location> <errortype>",
|
||||
description = "cause a given error to happen.\n" ..
|
||||
" location=(mapgen,entity_step,globalstep,immediate)\n" ..
|
||||
" errortype=(segv,zerodivision,exception)",
|
||||
func = exception_chat_handler,
|
||||
privs = { server=true }
|
||||
})
|
||||
|
||||
core.register_globalstep(function(dtime)
|
||||
if exceptiondata.globalstep then
|
||||
core.cause_error(exceptiondata.tocause)
|
||||
end
|
||||
end)
|
||||
|
||||
core.register_on_generated(function(minp, maxp, blockseed)
|
||||
if exceptiondata.mapgen then
|
||||
core.cause_error(exceptiondata.tocause)
|
||||
end
|
||||
end)
|
||||
|
||||
core.register_entity(exception_entity_name, exception_entity)
|
|
@ -502,10 +502,16 @@ minetest.register_craftitem("experimental:tester_tool_1", {
|
|||
on_use = function(itemstack, user, pointed_thing)
|
||||
--print(dump(pointed_thing))
|
||||
if pointed_thing.type == "node" then
|
||||
if minetest.get_node(pointed_thing.under).name == "experimental:tester_node_1" then
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if node.name == "experimental:tester_node_1" or node.name == "default:chest" then
|
||||
local p = pointed_thing.under
|
||||
minetest.log("action", "Tester tool used at "..minetest.pos_to_string(p))
|
||||
minetest.dig_node(p)
|
||||
if node.name == "experimental:tester_node_1" then
|
||||
minetest.dig_node(p)
|
||||
else
|
||||
minetest.get_meta(p):mark_as_private({"infotext", "formspec"})
|
||||
minetest.chat_send_player(user:get_player_name(), "Verify that chest is unusable now.")
|
||||
end
|
||||
else
|
||||
local p = pointed_thing.above
|
||||
minetest.log("action", "Tester tool used at "..minetest.pos_to_string(p))
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue