Merge remote-tracking branch 'minetest/master'
|
@ -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
|
|
@ -75,12 +75,15 @@ locale/
|
||||||
*.ninja
|
*.ninja
|
||||||
.ninja*
|
.ninja*
|
||||||
*.gch
|
*.gch
|
||||||
|
cmake-build-debug/
|
||||||
|
cmake-build-release/
|
||||||
|
|
||||||
## Android build files
|
## Android build files
|
||||||
build/android/src/main/assets
|
build/android/src/main/assets
|
||||||
build/android/build
|
build/android/build
|
||||||
build/android/deps
|
build/android/deps
|
||||||
build/android/libs
|
build/android/libs
|
||||||
|
build/android/jni/lib
|
||||||
build/android/jni/src
|
build/android/jni/src
|
||||||
build/android/src/main/jniLibs
|
build/android/src/main/jniLibs
|
||||||
build/android/obj
|
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: 14 day
|
||||||
|
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
|
|
@ -22,6 +22,14 @@ matrix:
|
||||||
- env: PLATFORM=Unix COMPILER=clang
|
- env: PLATFORM=Unix COMPILER=clang
|
||||||
compiler: clang
|
compiler: clang
|
||||||
os: linux
|
os: linux
|
||||||
|
- env: PLATFORM=Unix COMPILER=clang VALGRIND=1
|
||||||
|
compiler: clang
|
||||||
|
os: linux
|
||||||
|
dist: trusty
|
||||||
|
- env: COMPILER=none LINT=1
|
||||||
|
compiler: clang
|
||||||
|
os: linux
|
||||||
|
dist: trusty
|
||||||
- env: PLATFORM=Unix COMPILER=g++-6
|
- env: PLATFORM=Unix COMPILER=g++-6
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
os: linux
|
os: linux
|
||||||
|
|
|
@ -49,7 +49,6 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Included stuff
|
# Included stuff
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
|
@ -82,7 +81,7 @@ elseif(UNIX) # Linux, BSD etc
|
||||||
set(EXAMPLE_CONF_DIR ".")
|
set(EXAMPLE_CONF_DIR ".")
|
||||||
set(MANDIR "unix/man")
|
set(MANDIR "unix/man")
|
||||||
set(XDG_APPS_DIR "unix/applications")
|
set(XDG_APPS_DIR "unix/applications")
|
||||||
set(APPDATADIR "unix/appdata")
|
set(APPDATADIR "unix/metainfo")
|
||||||
set(ICONDIR "unix/icons")
|
set(ICONDIR "unix/icons")
|
||||||
set(LOCALEDIR "locale")
|
set(LOCALEDIR "locale")
|
||||||
else()
|
else()
|
||||||
|
@ -92,7 +91,7 @@ elseif(UNIX) # Linux, BSD etc
|
||||||
set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
|
set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
|
||||||
set(EXAMPLE_CONF_DIR ${DOCDIR})
|
set(EXAMPLE_CONF_DIR ${DOCDIR})
|
||||||
set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
|
set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
|
||||||
set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/appdata")
|
set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo")
|
||||||
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
|
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
|
||||||
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/{$PROJECT_NAME}/locale")
|
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/{$PROJECT_NAME}/locale")
|
||||||
endif()
|
endif()
|
||||||
|
@ -152,6 +151,7 @@ endif()
|
||||||
|
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}")
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}")
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client" DESTINATION "${SHAREDIR}")
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client" DESTINATION "${SHAREDIR}")
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}")
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games" DESTINATION "${SHAREDIR}" PATTERN ".git*" EXCLUDE)
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games" DESTINATION "${SHAREDIR}" PATTERN ".git*" EXCLUDE)
|
||||||
|
|
||||||
if(BUILD_CLIENT)
|
if(BUILD_CLIENT)
|
||||||
|
@ -173,8 +173,8 @@ install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(FILES "doc/minetest.6" "doc/minetestserver.6" DESTINATION "${MANDIR}/man6")
|
install(FILES "doc/minetest.6" "doc/minetestserver.6" DESTINATION "${MANDIR}/man6")
|
||||||
install(FILES "misc/minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
|
install(FILES "misc/net.minetest.minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
|
||||||
install(FILES "misc/minetest.appdata.xml" DESTINATION "${APPDATADIR}")
|
install(FILES "misc/net.minetest.minetest.appdata.xml" DESTINATION "${APPDATADIR}")
|
||||||
install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
|
install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
|
||||||
install(FILES "misc/minetest-xorg-icon-128.png"
|
install(FILES "misc/minetest-xorg-icon-128.png"
|
||||||
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
|
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
|
||||||
|
@ -186,6 +186,10 @@ if(APPLE)
|
||||||
install(FILES "misc/Info.plist" DESTINATION "${BUNDLE_PATH}/Contents")
|
install(FILES "misc/Info.plist" DESTINATION "${BUNDLE_PATH}/Contents")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Library pack
|
||||||
|
find_package(GMP REQUIRED)
|
||||||
|
find_package(Json REQUIRED)
|
||||||
|
find_package(Lua REQUIRED)
|
||||||
|
|
||||||
# Subdirectories
|
# Subdirectories
|
||||||
# Be sure to add all relevant definitions above this
|
# Be sure to add all relevant definitions above this
|
||||||
|
|
27
README.txt
|
@ -45,7 +45,7 @@ Default controls
|
||||||
- 0-9: Select item
|
- 0-9: Select item
|
||||||
- Z: Zoom (needs zoom privilege)
|
- Z: Zoom (needs zoom privilege)
|
||||||
- T: Chat
|
- T: Chat
|
||||||
- /: Commad
|
- /: Command
|
||||||
|
|
||||||
- Esc: Pause menu/abort/exit (pauses only singleplayer game)
|
- Esc: Pause menu/abort/exit (pauses only singleplayer game)
|
||||||
- R: Enable/disable full range view
|
- R: Enable/disable full range view
|
||||||
|
@ -87,7 +87,7 @@ $bin = /usr/bin
|
||||||
$share = /usr/share/minetest
|
$share = /usr/share/minetest
|
||||||
$user = ~/.minetest
|
$user = ~/.minetest
|
||||||
|
|
||||||
OS X:
|
macOS:
|
||||||
$bin = Contents/MacOS
|
$bin = Contents/MacOS
|
||||||
$share = Contents/Resources
|
$share = Contents/Resources
|
||||||
$user = Contents/User OR ~/Library/Application Support/minetest
|
$user = Contents/User OR ~/Library/Application Support/minetest
|
||||||
|
@ -104,6 +104,8 @@ Configuration file:
|
||||||
- It is created by Minetest when it is ran the first time.
|
- It is created by Minetest when it is ran the first time.
|
||||||
- A specific file can be specified on the command line:
|
- A specific file can be specified on the command line:
|
||||||
--config <path-to-file>
|
--config <path-to-file>
|
||||||
|
- A run-in-place build will look for the configuration file in
|
||||||
|
$location_of_exe/../minetest.conf and also $location_of_exe/../../minetest.conf
|
||||||
|
|
||||||
Command-line options:
|
Command-line options:
|
||||||
---------------------
|
---------------------
|
||||||
|
@ -119,7 +121,7 @@ For Fedora users:
|
||||||
$ sudo dnf 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
|
$ sudo dnf 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
|
||||||
|
|
||||||
You can install git for easily keeping your copy up to date.
|
You can install git for easily keeping your copy up to date.
|
||||||
If you dont want git, read below on how to get the source without git.
|
If you don’t want git, read below on how to get the source without git.
|
||||||
This is an example for installing git on Debian/Ubuntu:
|
This is an example for installing git on Debian/Ubuntu:
|
||||||
$ sudo apt-get install git
|
$ sudo apt-get install git
|
||||||
|
|
||||||
|
@ -494,7 +496,7 @@ Lua is licensed under the terms of the MIT license reproduced below.
|
||||||
This means that Lua is free software and can be used for both academic
|
This means that Lua is free software and can be used for both academic
|
||||||
and commercial purposes at absolutely no cost.
|
and commercial purposes at absolutely no cost.
|
||||||
|
|
||||||
For details and rationale, see http://www.lua.org/license.html .
|
For details and rationale, see https://www.lua.org/license.html .
|
||||||
|
|
||||||
Copyright (C) 1994-2008 Lua.org, PUC-Rio.
|
Copyright (C) 1994-2008 Lua.org, PUC-Rio.
|
||||||
|
|
||||||
|
@ -519,25 +521,18 @@ THE SOFTWARE.
|
||||||
Fonts
|
Fonts
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
DejaVu Sans Mono:
|
|
||||||
|
|
||||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
|
||||||
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
|
||||||
|
|
||||||
Bitstream Vera Fonts Copyright:
|
Bitstream Vera Fonts Copyright:
|
||||||
|
|
||||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
||||||
a trademark of Bitstream, Inc.
|
a trademark of Bitstream, Inc.
|
||||||
|
|
||||||
Arev Fonts Copyright:
|
Arimo - Apache License, version 2.0
|
||||||
|
Digitized data copyright (c) 2010-2012 Google Corporation.
|
||||||
|
|
||||||
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
Cousine - Apache License, version 2.0
|
||||||
|
Digitized data copyright (c) 2010-2012 Google Corporation.
|
||||||
|
|
||||||
Liberation Fonts Copyright:
|
DroidSansFallBackFull:
|
||||||
|
|
||||||
Copyright (c) 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
|
|
||||||
|
|
||||||
DroidSansFallback:
|
|
||||||
|
|
||||||
Copyright (C) 2008 The Android Open Source Project
|
Copyright (C) 2008 The Android Open Source Project
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
|
||||||
TARGET_ARCH = armv7
|
TARGET_ARCH = armv7
|
||||||
CROSS_PREFIX = arm-linux-androideabi-
|
CROSS_PREFIX = arm-linux-androideabi-
|
||||||
COMPILER_VERSION = 4.9
|
COMPILER_VERSION = 4.9
|
||||||
HAVE_LEVELDB = 1
|
HAVE_LEVELDB = 0
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# toolchain config for little endian mips
|
# toolchain config for little endian mips
|
||||||
|
@ -59,7 +59,7 @@ HAVE_LEVELDB = 1
|
||||||
#CROSS_PREFIX = i686-linux-android-
|
#CROSS_PREFIX = i686-linux-android-
|
||||||
#TARGET_ARCH = x86
|
#TARGET_ARCH = x86
|
||||||
#COMPILER_VERSION = 4.9
|
#COMPILER_VERSION = 4.9
|
||||||
#HAVE_LEVELDB = 1
|
#HAVE_LEVELDB = 0
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
ASSETS_TIMESTAMP = deps/assets_timestamp
|
ASSETS_TIMESTAMP = deps/assets_timestamp
|
||||||
|
@ -352,7 +352,7 @@ leveldb_download :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
leveldb : $(LEVELDB_LIB)
|
leveldb : $(LEVELDB_LIB)
|
||||||
|
ifeq ($(HAVE_LEVELDB),1)
|
||||||
$(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
$(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||||
@REFRESH=0; \
|
@REFRESH=0; \
|
||||||
if [ ! -e ${LEVELDB_TIMESTAMP_INT} ] ; then \
|
if [ ! -e ${LEVELDB_TIMESTAMP_INT} ] ; then \
|
||||||
|
@ -384,6 +384,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||||
else \
|
else \
|
||||||
echo "nothing to be done for leveldb"; \
|
echo "nothing to be done for leveldb"; \
|
||||||
fi
|
fi
|
||||||
|
endif
|
||||||
|
|
||||||
clean_leveldb :
|
clean_leveldb :
|
||||||
$(RM) -rf deps/leveldb
|
$(RM) -rf deps/leveldb
|
||||||
|
@ -796,6 +797,9 @@ install_release:
|
||||||
prep_srcdir :
|
prep_srcdir :
|
||||||
@if [ ! -e ${ANDR_ROOT}/jni/src ]; then \
|
@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
|
fi
|
||||||
|
|
||||||
clean_apk :
|
clean_apk :
|
||||||
|
|
|
@ -98,8 +98,8 @@ endif
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
jni/src \
|
jni/src \
|
||||||
jni/src/script \
|
jni/src/script \
|
||||||
jni/src/lua/src \
|
jni/lib/lua/src \
|
||||||
jni/src/jsoncpp \
|
jni/lib/jsoncpp \
|
||||||
jni/src/cguittfont \
|
jni/src/cguittfont \
|
||||||
deps/irrlicht/include \
|
deps/irrlicht/include \
|
||||||
deps/libiconv/include \
|
deps/libiconv/include \
|
||||||
|
@ -185,6 +185,7 @@ LOCAL_SRC_FILES := \
|
||||||
jni/src/mapnode.cpp \
|
jni/src/mapnode.cpp \
|
||||||
jni/src/mapsector.cpp \
|
jni/src/mapsector.cpp \
|
||||||
jni/src/mesh.cpp \
|
jni/src/mesh.cpp \
|
||||||
|
jni/src/mesh_generator_thread.cpp \
|
||||||
jni/src/metadata.cpp \
|
jni/src/metadata.cpp \
|
||||||
jni/src/mg_biome.cpp \
|
jni/src/mg_biome.cpp \
|
||||||
jni/src/mg_decoration.cpp \
|
jni/src/mg_decoration.cpp \
|
||||||
|
@ -290,6 +291,7 @@ LOCAL_SRC_FILES += \
|
||||||
jni/src/script/common/c_types.cpp \
|
jni/src/script/common/c_types.cpp \
|
||||||
jni/src/script/cpp_api/s_async.cpp \
|
jni/src/script/cpp_api/s_async.cpp \
|
||||||
jni/src/script/cpp_api/s_base.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_entity.cpp \
|
||||||
jni/src/script/cpp_api/s_env.cpp \
|
jni/src/script/cpp_api/s_env.cpp \
|
||||||
jni/src/script/cpp_api/s_inventory.cpp \
|
jni/src/script/cpp_api/s_inventory.cpp \
|
||||||
|
@ -302,14 +304,17 @@ LOCAL_SRC_FILES += \
|
||||||
jni/src/script/cpp_api/s_server.cpp \
|
jni/src/script/cpp_api/s_server.cpp \
|
||||||
jni/src/script/lua_api/l_areastore.cpp \
|
jni/src/script/lua_api/l_areastore.cpp \
|
||||||
jni/src/script/lua_api/l_base.cpp \
|
jni/src/script/lua_api/l_base.cpp \
|
||||||
|
jni/src/script/lua_api/l_client.cpp \
|
||||||
jni/src/script/lua_api/l_craft.cpp \
|
jni/src/script/lua_api/l_craft.cpp \
|
||||||
jni/src/script/lua_api/l_env.cpp \
|
jni/src/script/lua_api/l_env.cpp \
|
||||||
jni/src/script/lua_api/l_inventory.cpp \
|
jni/src/script/lua_api/l_inventory.cpp \
|
||||||
jni/src/script/lua_api/l_item.cpp \
|
jni/src/script/lua_api/l_item.cpp \
|
||||||
jni/src/script/lua_api/l_itemstackmeta.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_mainmenu.cpp \
|
||||||
jni/src/script/lua_api/l_mapgen.cpp \
|
jni/src/script/lua_api/l_mapgen.cpp \
|
||||||
jni/src/script/lua_api/l_metadata.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_nodemeta.cpp \
|
||||||
jni/src/script/lua_api/l_nodetimer.cpp \
|
jni/src/script/lua_api/l_nodetimer.cpp \
|
||||||
jni/src/script/lua_api/l_noise.cpp \
|
jni/src/script/lua_api/l_noise.cpp \
|
||||||
|
@ -318,11 +323,13 @@ LOCAL_SRC_FILES += \
|
||||||
jni/src/script/lua_api/l_rollback.cpp \
|
jni/src/script/lua_api/l_rollback.cpp \
|
||||||
jni/src/script/lua_api/l_server.cpp \
|
jni/src/script/lua_api/l_server.cpp \
|
||||||
jni/src/script/lua_api/l_settings.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_http.cpp \
|
||||||
jni/src/script/lua_api/l_storage.cpp \
|
jni/src/script/lua_api/l_storage.cpp \
|
||||||
jni/src/script/lua_api/l_util.cpp \
|
jni/src/script/lua_api/l_util.cpp \
|
||||||
jni/src/script/lua_api/l_vmanip.cpp \
|
jni/src/script/lua_api/l_vmanip.cpp \
|
||||||
jni/src/script/scripting_game.cpp \
|
jni/src/script/clientscripting.cpp \
|
||||||
|
jni/src/script/serverscripting.cpp \
|
||||||
jni/src/script/scripting_mainmenu.cpp
|
jni/src/script/scripting_mainmenu.cpp
|
||||||
|
|
||||||
#freetype2 support
|
#freetype2 support
|
||||||
|
@ -330,36 +337,36 @@ LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
|
||||||
|
|
||||||
# Lua
|
# Lua
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
jni/src/lua/src/lapi.c \
|
jni/lib/lua/src/lapi.c \
|
||||||
jni/src/lua/src/lauxlib.c \
|
jni/lib/lua/src/lauxlib.c \
|
||||||
jni/src/lua/src/lbaselib.c \
|
jni/lib/lua/src/lbaselib.c \
|
||||||
jni/src/lua/src/lcode.c \
|
jni/lib/lua/src/lcode.c \
|
||||||
jni/src/lua/src/ldblib.c \
|
jni/lib/lua/src/ldblib.c \
|
||||||
jni/src/lua/src/ldebug.c \
|
jni/lib/lua/src/ldebug.c \
|
||||||
jni/src/lua/src/ldo.c \
|
jni/lib/lua/src/ldo.c \
|
||||||
jni/src/lua/src/ldump.c \
|
jni/lib/lua/src/ldump.c \
|
||||||
jni/src/lua/src/lfunc.c \
|
jni/lib/lua/src/lfunc.c \
|
||||||
jni/src/lua/src/lgc.c \
|
jni/lib/lua/src/lgc.c \
|
||||||
jni/src/lua/src/linit.c \
|
jni/lib/lua/src/linit.c \
|
||||||
jni/src/lua/src/liolib.c \
|
jni/lib/lua/src/liolib.c \
|
||||||
jni/src/lua/src/llex.c \
|
jni/lib/lua/src/llex.c \
|
||||||
jni/src/lua/src/lmathlib.c \
|
jni/lib/lua/src/lmathlib.c \
|
||||||
jni/src/lua/src/lmem.c \
|
jni/lib/lua/src/lmem.c \
|
||||||
jni/src/lua/src/loadlib.c \
|
jni/lib/lua/src/loadlib.c \
|
||||||
jni/src/lua/src/lobject.c \
|
jni/lib/lua/src/lobject.c \
|
||||||
jni/src/lua/src/lopcodes.c \
|
jni/lib/lua/src/lopcodes.c \
|
||||||
jni/src/lua/src/loslib.c \
|
jni/lib/lua/src/loslib.c \
|
||||||
jni/src/lua/src/lparser.c \
|
jni/lib/lua/src/lparser.c \
|
||||||
jni/src/lua/src/lstate.c \
|
jni/lib/lua/src/lstate.c \
|
||||||
jni/src/lua/src/lstring.c \
|
jni/lib/lua/src/lstring.c \
|
||||||
jni/src/lua/src/lstrlib.c \
|
jni/lib/lua/src/lstrlib.c \
|
||||||
jni/src/lua/src/ltable.c \
|
jni/lib/lua/src/ltable.c \
|
||||||
jni/src/lua/src/ltablib.c \
|
jni/lib/lua/src/ltablib.c \
|
||||||
jni/src/lua/src/ltm.c \
|
jni/lib/lua/src/ltm.c \
|
||||||
jni/src/lua/src/lundump.c \
|
jni/lib/lua/src/lundump.c \
|
||||||
jni/src/lua/src/lvm.c \
|
jni/lib/lua/src/lvm.c \
|
||||||
jni/src/lua/src/lzio.c \
|
jni/lib/lua/src/lzio.c \
|
||||||
jni/src/lua/src/print.c
|
jni/lib/lua/src/print.c
|
||||||
|
|
||||||
# SQLite3
|
# SQLite3
|
||||||
LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
|
LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
|
||||||
|
@ -372,7 +379,7 @@ LOCAL_SRC_FILES += \
|
||||||
jni/src/threading/thread.cpp
|
jni/src/threading/thread.cpp
|
||||||
|
|
||||||
# JSONCPP
|
# 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_SHARED_LIBRARIES := iconv openal ogg vorbis gmp
|
||||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
|
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
-- 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,
|
||||||
|
})
|
|
@ -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,71 @@
|
||||||
|
|
||||||
|
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()
|
|
@ -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
|
|
@ -197,6 +197,7 @@ assert(table.indexof({"foo", "bar"}, "foo") == 1)
|
||||||
assert(table.indexof({"foo", "bar"}, "baz") == -1)
|
assert(table.indexof({"foo", "bar"}, "baz") == -1)
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
if INIT ~= "client" then
|
||||||
function file_exists(filename)
|
function file_exists(filename)
|
||||||
local f = io.open(filename, "r")
|
local f = io.open(filename, "r")
|
||||||
if f == nil then
|
if f == nil then
|
||||||
|
@ -206,7 +207,7 @@ function file_exists(filename)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function string:trim()
|
function string:trim()
|
||||||
return (self:gsub("^%s*(.-)%s*$", "%1"))
|
return (self:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
|
@ -606,7 +607,9 @@ if INIT == "mainmenu" then
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if INIT == "client" or INIT == "mainmenu" then
|
||||||
function fgettext_ne(text, ...)
|
function fgettext_ne(text, ...)
|
||||||
text = core.gettext(text)
|
text = core.gettext(text)
|
||||||
local arg = {n=select('#', ...), ...}
|
local arg = {n=select('#', ...), ...}
|
||||||
|
@ -637,3 +640,86 @@ if INIT == "mainmenu" then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ESCAPE_CHAR = string.char(0x1b)
|
||||||
|
|
||||||
|
-- Client-sided mods don't have access to getbool
|
||||||
|
if core.setting_getbool and core.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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
-- This ignores mod namespaces (variables with the same name as the current mod).
|
-- This ignores mod namespaces (variables with the same name as the current mod).
|
||||||
local WARN_INIT = false
|
local WARN_INIT = false
|
||||||
|
|
||||||
|
local getinfo = debug.getinfo
|
||||||
|
|
||||||
function core.global_exists(name)
|
function core.global_exists(name)
|
||||||
if type(name) ~= "string" then
|
if type(name) ~= "string" then
|
||||||
|
@ -18,7 +19,7 @@ local declared = {}
|
||||||
local warned = {}
|
local warned = {}
|
||||||
|
|
||||||
function meta:__newindex(name, value)
|
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)
|
local desc = ("%s:%d"):format(info.short_src, info.currentline)
|
||||||
if not declared[name] then
|
if not declared[name] then
|
||||||
local warn_key = ("%s\0%d\0%s"):format(info.source,
|
local warn_key = ("%s\0%d\0%s"):format(info.source,
|
||||||
|
@ -42,7 +43,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function meta:__index(name)
|
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)
|
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
|
||||||
if not declared[name] and not warned[warn_key] and info.what ~= "C" then
|
if not declared[name] and not warned[warn_key] and info.what ~= "C" then
|
||||||
core.log("warning", ("Undeclared global variable %q accessed at %s:%s")
|
core.log("warning", ("Undeclared global variable %q accessed at %s:%s")
|
||||||
|
|
|
@ -1,46 +1,28 @@
|
||||||
-- Minetest: builtin/chatcommands.lua
|
-- Minetest: builtin/game/chatcommands.lua
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Chat command handler
|
-- Chat command handler
|
||||||
--
|
--
|
||||||
|
|
||||||
core.registered_chatcommands = {}
|
|
||||||
core.chatcommands = core.registered_chatcommands -- BACKWARDS COMPATIBILITY
|
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
|
|
||||||
|
|
||||||
core.register_on_chat_message(function(name, message)
|
core.register_on_chat_message(function(name, message)
|
||||||
local cmd, param = string.match(message, "^/([^ ]+) *(.*)")
|
if message:sub(1,1) ~= "/" then
|
||||||
if not param then
|
return
|
||||||
param = ""
|
|
||||||
end
|
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]
|
local cmd_def = core.registered_chatcommands[cmd]
|
||||||
if not cmd_def then
|
if not cmd_def then
|
||||||
return false
|
core.chat_send_player(name, "-!- Invalid command: " .. cmd)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
local has_privs, missing_privs = core.check_player_privs(name, cmd_def.privs)
|
local has_privs, missing_privs = core.check_player_privs(name, cmd_def.privs)
|
||||||
if has_privs then
|
if has_privs then
|
||||||
|
@ -109,61 +91,6 @@ core.register_chatcommand("admin", {
|
||||||
end,
|
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("#00ffff", "/"..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, "Available commands: " .. table.concat(cmds, " ") .. "\n"
|
|
||||||
.. "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, "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, "Available privileges:\n"..table.concat(privs, "\n")
|
|
||||||
else
|
|
||||||
local cmd = param
|
|
||||||
local def = core.registered_chatcommands[cmd]
|
|
||||||
if not def then
|
|
||||||
return false, "Command not available: "..cmd
|
|
||||||
else
|
|
||||||
return true, format_help_line(cmd, def)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
core.register_chatcommand("privs", {
|
core.register_chatcommand("privs", {
|
||||||
params = "<name>",
|
params = "<name>",
|
||||||
description = "Print privileges of player",
|
description = "Print privileges of player",
|
||||||
|
@ -385,7 +312,7 @@ core.register_chatcommand("teleport", {
|
||||||
p.y = tonumber(p.y)
|
p.y = tonumber(p.y)
|
||||||
p.z = tonumber(p.z)
|
p.z = tonumber(p.z)
|
||||||
if p.x and p.y and p.z then
|
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
|
if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm or p.z < -lm or p.z > lm then
|
||||||
return false, "Cannot teleport out of map bounds!"
|
return false, "Cannot teleport out of map bounds!"
|
||||||
end
|
end
|
||||||
|
@ -560,6 +487,25 @@ core.register_chatcommand("deleteblocks", {
|
||||||
end,
|
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", {
|
core.register_chatcommand("mods", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "List mods installed on the server",
|
description = "List mods installed on the server",
|
||||||
|
@ -836,11 +782,20 @@ core.register_chatcommand("days", {
|
||||||
|
|
||||||
core.register_chatcommand("shutdown", {
|
core.register_chatcommand("shutdown", {
|
||||||
description = "Shutdown server",
|
description = "Shutdown server",
|
||||||
|
params = "[delay_in_seconds(0..inf) or -1 for cancel] [reconnect] [message]",
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
local delay, reconnect, message = param:match("([^ ][-]?[0-9]+)([^ ]+)(.*)")
|
||||||
|
message = message or ""
|
||||||
|
|
||||||
|
if delay ~= "" then
|
||||||
|
delay = tonumber(param) or 0
|
||||||
|
else
|
||||||
|
delay = 0
|
||||||
core.log("action", name .. " shuts down server")
|
core.log("action", name .. " shuts down server")
|
||||||
core.request_shutdown()
|
|
||||||
core.chat_send_all("*** Server shutting down (operator request).")
|
core.chat_send_all("*** Server shutting down (operator request).")
|
||||||
|
end
|
||||||
|
core.request_shutdown(message:trim(), core.is_yes(reconnect), delay)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,11 @@ core.register_entity(":__builtin:falling_node", {
|
||||||
},
|
},
|
||||||
|
|
||||||
node = {},
|
node = {},
|
||||||
|
meta = {},
|
||||||
|
|
||||||
set_node = function(self, node)
|
set_node = function(self, node, meta)
|
||||||
self.node = node
|
self.node = node
|
||||||
|
self.meta = meta or {}
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
is_visible = true,
|
is_visible = true,
|
||||||
textures = {node.name},
|
textures = {node.name},
|
||||||
|
@ -28,15 +30,21 @@ core.register_entity(":__builtin:falling_node", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
return core.serialize(self.node)
|
local ds = {
|
||||||
|
node = self.node,
|
||||||
|
meta = self.meta,
|
||||||
|
}
|
||||||
|
return core.serialize(ds)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.object:set_armor_groups({immortal = 1})
|
self.object:set_armor_groups({immortal = 1})
|
||||||
|
|
||||||
local node = core.deserialize(staticdata)
|
local ds = core.deserialize(staticdata)
|
||||||
if node then
|
if ds and ds.node then
|
||||||
self:set_node(node)
|
self:set_node(ds.node, ds.meta)
|
||||||
|
elseif ds then
|
||||||
|
self:set_node(ds)
|
||||||
elseif staticdata ~= "" then
|
elseif staticdata ~= "" then
|
||||||
self:set_node({name = staticdata})
|
self:set_node({name = staticdata})
|
||||||
end
|
end
|
||||||
|
@ -98,6 +106,10 @@ core.register_entity(":__builtin:falling_node", {
|
||||||
-- Create node and remove entity
|
-- Create node and remove entity
|
||||||
if core.registered_nodes[self.node.name] then
|
if core.registered_nodes[self.node.name] then
|
||||||
core.add_node(np, self.node)
|
core.add_node(np, self.node)
|
||||||
|
if self.meta then
|
||||||
|
local meta = core.get_meta(np)
|
||||||
|
meta:from_table(self.meta)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
core.check_for_falling(np)
|
core.check_for_falling(np)
|
||||||
|
@ -111,13 +123,27 @@ core.register_entity(":__builtin:falling_node", {
|
||||||
end
|
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")
|
local obj = core.add_entity(p, "__builtin:falling_node")
|
||||||
if obj then
|
if obj then
|
||||||
obj:get_luaentity():set_node(node)
|
obj:get_luaentity():set_node(node, meta)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function core.spawn_falling_node(pos)
|
||||||
|
local node = core.get_node(pos)
|
||||||
|
if node.name == "air" or node.name == "ignore" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local obj = core.add_entity(pos, "__builtin:falling_node")
|
||||||
|
if obj then
|
||||||
|
obj:get_luaentity():set_node(node)
|
||||||
|
core.remove_node(pos)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local function drop_attached_node(p)
|
local function drop_attached_node(p)
|
||||||
local nn = core.get_node(p).name
|
local nn = core.get_node(p).name
|
||||||
core.remove_node(p)
|
core.remove_node(p)
|
||||||
|
@ -134,7 +160,8 @@ end
|
||||||
function builtin_shared.check_attached_node(p, n)
|
function builtin_shared.check_attached_node(p, n)
|
||||||
local def = core.registered_nodes[n.name]
|
local def = core.registered_nodes[n.name]
|
||||||
local d = {x = 0, y = 0, z = 0}
|
local d = {x = 0, y = 0, z = 0}
|
||||||
if def.paramtype2 == "wallmounted" then
|
if def.paramtype2 == "wallmounted" or
|
||||||
|
def.paramtype2 == "colorwallmounted" then
|
||||||
-- The fallback vector here is in case 'wallmounted to dir' is nil due
|
-- The fallback vector here is in case 'wallmounted to dir' is nil due
|
||||||
-- to voxelmanip placing a wallmounted node without resetting a
|
-- to voxelmanip placing a wallmounted node without resetting a
|
||||||
-- pre-existing param2 value that is out-of-range for wallmounted.
|
-- pre-existing param2 value that is out-of-range for wallmounted.
|
||||||
|
@ -174,8 +201,13 @@ function core.check_single_for_falling(p)
|
||||||
|
|
||||||
(not d_bottom.walkable or d_bottom.buildable_to) then
|
(not d_bottom.walkable or d_bottom.buildable_to) then
|
||||||
n.level = core.get_node_level(p)
|
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)
|
core.remove_node(p)
|
||||||
spawn_falling_node(p, n)
|
spawn_falling_node(p, n, metatable)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,11 +17,13 @@ if core.setting_getbool("profiler.load") then
|
||||||
profiler = dofile(scriptpath.."profiler"..DIR_DELIM.."init.lua")
|
profiler = dofile(scriptpath.."profiler"..DIR_DELIM.."init.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dofile(commonpath .. "after.lua")
|
||||||
dofile(gamepath.."item_entity.lua")
|
dofile(gamepath.."item_entity.lua")
|
||||||
dofile(gamepath.."deprecated.lua")
|
dofile(gamepath.."deprecated.lua")
|
||||||
dofile(gamepath.."misc.lua")
|
dofile(gamepath.."misc.lua")
|
||||||
dofile(gamepath.."privileges.lua")
|
dofile(gamepath.."privileges.lua")
|
||||||
dofile(gamepath.."auth.lua")
|
dofile(gamepath.."auth.lua")
|
||||||
|
dofile(commonpath .. "chatcommands.lua")
|
||||||
dofile(gamepath.."chatcommands.lua")
|
dofile(gamepath.."chatcommands.lua")
|
||||||
dofile(gamepath.."static_spawn.lua")
|
dofile(gamepath.."static_spawn.lua")
|
||||||
dofile(gamepath.."detached_inventory.lua")
|
dofile(gamepath.."detached_inventory.lua")
|
||||||
|
|
|
@ -156,7 +156,8 @@ function core.yaw_to_dir(yaw)
|
||||||
end
|
end
|
||||||
|
|
||||||
function core.get_node_drops(nodename, toolname)
|
function core.get_node_drops(nodename, toolname)
|
||||||
local drop = ItemStack({name=nodename}):get_definition().drop
|
local def = core.registered_nodes[nodename]
|
||||||
|
local drop = def and def.drop
|
||||||
if drop == nil then
|
if drop == nil then
|
||||||
-- default drop
|
-- default drop
|
||||||
return {nodename}
|
return {nodename}
|
||||||
|
@ -205,7 +206,6 @@ function core.get_node_drops(nodename, toolname)
|
||||||
end
|
end
|
||||||
|
|
||||||
function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
local item = itemstack:peek_item()
|
|
||||||
local def = itemstack:get_definition()
|
local def = itemstack:get_definition()
|
||||||
if def.type ~= "node" or pointed_thing.type ~= "node" then
|
if def.type ~= "node" or pointed_thing.type ~= "node" then
|
||||||
return itemstack, false
|
return itemstack, false
|
||||||
|
@ -215,20 +215,21 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
local oldnode_under = core.get_node_or_nil(under)
|
local oldnode_under = core.get_node_or_nil(under)
|
||||||
local above = pointed_thing.above
|
local above = pointed_thing.above
|
||||||
local oldnode_above = core.get_node_or_nil(above)
|
local oldnode_above = core.get_node_or_nil(above)
|
||||||
|
local playername = placer:get_player_name()
|
||||||
|
|
||||||
if not oldnode_under or not oldnode_above then
|
if not oldnode_under or not oldnode_above then
|
||||||
core.log("info", placer:get_player_name() .. " tried to place"
|
core.log("info", playername .. " tried to place"
|
||||||
.. " node in unloaded position " .. core.pos_to_string(above))
|
.. " node in unloaded position " .. core.pos_to_string(above))
|
||||||
return itemstack, false
|
return itemstack, false
|
||||||
end
|
end
|
||||||
|
|
||||||
local olddef_under = ItemStack({name=oldnode_under.name}):get_definition()
|
local olddef_under = core.registered_nodes[oldnode_under.name]
|
||||||
olddef_under = olddef_under or core.nodedef_default
|
olddef_under = olddef_under or core.nodedef_default
|
||||||
local olddef_above = ItemStack({name=oldnode_above.name}):get_definition()
|
local olddef_above = core.registered_nodes[oldnode_above.name]
|
||||||
olddef_above = olddef_above or core.nodedef_default
|
olddef_above = olddef_above or core.nodedef_default
|
||||||
|
|
||||||
if not olddef_above.buildable_to and not olddef_under.buildable_to then
|
if not olddef_above.buildable_to and not olddef_under.buildable_to then
|
||||||
core.log("info", placer:get_player_name() .. " tried to place"
|
core.log("info", playername .. " tried to place"
|
||||||
.. " node in invalid position " .. core.pos_to_string(above)
|
.. " node in invalid position " .. core.pos_to_string(above)
|
||||||
.. ", replacing " .. oldnode_above.name)
|
.. ", replacing " .. oldnode_above.name)
|
||||||
return itemstack, false
|
return itemstack, false
|
||||||
|
@ -243,17 +244,17 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
place_to = {x = under.x, y = under.y, z = under.z}
|
place_to = {x = under.x, y = under.y, z = under.z}
|
||||||
end
|
end
|
||||||
|
|
||||||
if core.is_protected(place_to, placer:get_player_name()) and
|
if core.is_protected(place_to, playername) and
|
||||||
not minetest.check_player_privs(placer, "protection_bypass") then
|
not minetest.check_player_privs(placer, "protection_bypass") then
|
||||||
core.log("action", placer:get_player_name()
|
core.log("action", playername
|
||||||
.. " tried to place " .. def.name
|
.. " tried to place " .. def.name
|
||||||
.. " at protected position "
|
.. " at protected position "
|
||||||
.. core.pos_to_string(place_to))
|
.. core.pos_to_string(place_to))
|
||||||
core.record_protection_violation(place_to, placer:get_player_name())
|
core.record_protection_violation(place_to, playername)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
core.log("action", placer:get_player_name() .. " places node "
|
core.log("action", playername .. " places node "
|
||||||
.. def.name .. " at " .. core.pos_to_string(place_to))
|
.. def.name .. " at " .. core.pos_to_string(place_to))
|
||||||
|
|
||||||
local oldnode = core.get_node(place_to)
|
local oldnode = core.get_node(place_to)
|
||||||
|
@ -262,7 +263,8 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
-- Calculate direction for wall mounted stuff like torches and signs
|
-- Calculate direction for wall mounted stuff like torches and signs
|
||||||
if def.place_param2 ~= nil then
|
if def.place_param2 ~= nil then
|
||||||
newnode.param2 = def.place_param2
|
newnode.param2 = def.place_param2
|
||||||
elseif def.paramtype2 == 'wallmounted' and not param2 then
|
elseif (def.paramtype2 == "wallmounted" or
|
||||||
|
def.paramtype2 == "colorwallmounted") and not param2 then
|
||||||
local dir = {
|
local dir = {
|
||||||
x = under.x - above.x,
|
x = under.x - above.x,
|
||||||
y = under.y - above.y,
|
y = under.y - above.y,
|
||||||
|
@ -270,7 +272,8 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
}
|
}
|
||||||
newnode.param2 = core.dir_to_wallmounted(dir)
|
newnode.param2 = core.dir_to_wallmounted(dir)
|
||||||
-- Calculate the direction for furnaces and chests and stuff
|
-- Calculate the direction for furnaces and chests and stuff
|
||||||
elseif def.paramtype2 == 'facedir' and not param2 then
|
elseif (def.paramtype2 == "facedir" or
|
||||||
|
def.paramtype2 == "colorfacedir") and not param2 then
|
||||||
local placer_pos = placer:getpos()
|
local placer_pos = placer:getpos()
|
||||||
if placer_pos then
|
if placer_pos then
|
||||||
local dir = {
|
local dir = {
|
||||||
|
@ -308,7 +311,6 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Run script hook
|
-- Run script hook
|
||||||
local _, callback
|
|
||||||
for _, callback in ipairs(core.registered_on_placenodes) do
|
for _, callback in ipairs(core.registered_on_placenodes) do
|
||||||
-- Deepcopy pos, node and pointed_thing because callback can modify them
|
-- Deepcopy pos, node and pointed_thing because callback can modify them
|
||||||
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
|
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
|
||||||
|
@ -449,8 +451,9 @@ function core.handle_node_drops(pos, drops, digger)
|
||||||
end
|
end
|
||||||
|
|
||||||
function core.node_dig(pos, node, digger)
|
function core.node_dig(pos, node, digger)
|
||||||
local def = ItemStack({name=node.name}):get_definition()
|
local def = core.registered_nodes[node.name]
|
||||||
if not def.diggable or (def.can_dig and not def.can_dig(pos,digger)) then
|
if def and (not def.diggable or
|
||||||
|
(def.can_dig and not def.can_dig(pos, digger))) then
|
||||||
core.log("info", digger:get_player_name() .. " tried to dig "
|
core.log("info", digger:get_player_name() .. " tried to dig "
|
||||||
.. node.name .. " which is not diggable "
|
.. node.name .. " which is not diggable "
|
||||||
.. core.pos_to_string(pos))
|
.. core.pos_to_string(pos))
|
||||||
|
@ -475,7 +478,7 @@ function core.node_dig(pos, node, digger)
|
||||||
|
|
||||||
local wdef = wielded:get_definition()
|
local wdef = wielded:get_definition()
|
||||||
local tp = wielded:get_tool_capabilities()
|
local tp = wielded:get_tool_capabilities()
|
||||||
local dp = core.get_dig_params(def.groups, tp)
|
local dp = core.get_dig_params(def and def.groups, tp)
|
||||||
if wdef and wdef.after_use then
|
if wdef and wdef.after_use then
|
||||||
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||||
else
|
else
|
||||||
|
@ -493,7 +496,7 @@ function core.node_dig(pos, node, digger)
|
||||||
core.handle_node_drops(pos, drops, digger)
|
core.handle_node_drops(pos, drops, digger)
|
||||||
|
|
||||||
local oldmetadata = nil
|
local oldmetadata = nil
|
||||||
if def.after_dig_node then
|
if def and def.after_dig_node then
|
||||||
oldmetadata = core.get_meta(pos):to_table()
|
oldmetadata = core.get_meta(pos):to_table()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -501,7 +504,7 @@ function core.node_dig(pos, node, digger)
|
||||||
core.remove_node(pos)
|
core.remove_node(pos)
|
||||||
|
|
||||||
-- Run callback
|
-- 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
|
-- Copy pos and node because callback can modify them
|
||||||
local pos_copy = {x=pos.x, y=pos.y, z=pos.z}
|
local pos_copy = {x=pos.x, y=pos.y, z=pos.z}
|
||||||
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||||
|
|
|
@ -53,6 +53,8 @@ core.register_entity(":__builtin:item", {
|
||||||
if itemtable then
|
if itemtable then
|
||||||
itemname = stack:to_table().name
|
itemname = stack:to_table().name
|
||||||
end
|
end
|
||||||
|
-- Backwards compatibility: old clients use the texture
|
||||||
|
-- to get the type of the item
|
||||||
local item_texture = nil
|
local item_texture = nil
|
||||||
local item_type = ""
|
local item_type = ""
|
||||||
if core.registered_items[itemname] then
|
if core.registered_items[itemname] then
|
||||||
|
@ -66,6 +68,7 @@ core.register_entity(":__builtin:item", {
|
||||||
visual_size = {x = s, y = s},
|
visual_size = {x = s, y = s},
|
||||||
collisionbox = {-c, -c, -c, c, c, c},
|
collisionbox = {-c, -c, -c, c, c, c},
|
||||||
automatic_rotate = math.pi * 0.5,
|
automatic_rotate = math.pi * 0.5,
|
||||||
|
wield_item = itemstring,
|
||||||
}
|
}
|
||||||
self.object:set_properties(prop)
|
self.object:set_properties(prop)
|
||||||
end,
|
end,
|
||||||
|
@ -101,31 +104,39 @@ core.register_entity(":__builtin:item", {
|
||||||
self:set_item(self.itemstring)
|
self:set_item(self.itemstring)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
-- moves items from this stack to an other stack
|
||||||
try_merge_with = function(self, own_stack, object, obj)
|
try_merge_with = function(self, own_stack, object, obj)
|
||||||
|
-- other item's stack
|
||||||
local stack = ItemStack(obj.itemstring)
|
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 overflow = false
|
||||||
local count = stack:get_count() + own_stack:get_count()
|
local count = stack:get_count() + own_stack:get_count()
|
||||||
local max_count = stack:get_stack_max()
|
local max_count = stack:get_stack_max()
|
||||||
if count > max_count then
|
if count > max_count then
|
||||||
overflow = true
|
overflow = true
|
||||||
|
stack:set_count(max_count)
|
||||||
count = count - max_count
|
count = count - max_count
|
||||||
|
own_stack:set_count(count)
|
||||||
else
|
else
|
||||||
self.itemstring = ''
|
self.itemstring = ''
|
||||||
|
stack:set_count(count)
|
||||||
end
|
end
|
||||||
local pos = object:getpos()
|
local pos = object:getpos()
|
||||||
pos.y = pos.y + (count - stack:get_count()) / max_count * 0.15
|
pos.y = pos.y + (count - stack:get_count()) / max_count * 0.15
|
||||||
object:moveto(pos, false)
|
object:moveto(pos, false)
|
||||||
local s, c
|
local s, c
|
||||||
local max_count = stack:get_stack_max()
|
|
||||||
local name = stack:get_name()
|
|
||||||
if not overflow then
|
if not overflow then
|
||||||
obj.itemstring = name .. " " .. count
|
obj.itemstring = stack:to_string()
|
||||||
s = 0.2 + 0.1 * (count / max_count)
|
s = 0.2 + 0.1 * (count / max_count)
|
||||||
c = s
|
c = s
|
||||||
object:set_properties({
|
object:set_properties({
|
||||||
visual_size = {x = s, y = s},
|
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()
|
self.object:remove()
|
||||||
-- merging succeeded
|
-- merging succeeded
|
||||||
|
@ -133,18 +144,20 @@ core.register_entity(":__builtin:item", {
|
||||||
else
|
else
|
||||||
s = 0.4
|
s = 0.4
|
||||||
c = 0.3
|
c = 0.3
|
||||||
|
obj.itemstring = stack:to_string()
|
||||||
object:set_properties({
|
object:set_properties({
|
||||||
visual_size = {x = s, y = s},
|
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)
|
s = 0.2 + 0.1 * (count / max_count)
|
||||||
c = s
|
c = s
|
||||||
|
self.itemstring = own_stack:to_string()
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
visual_size = {x = s, y = s},
|
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
|
||||||
end
|
end
|
||||||
-- merging didn't succeed
|
-- merging didn't succeed
|
||||||
|
|
|
@ -4,50 +4,6 @@
|
||||||
-- Misc. API functions
|
-- 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, ...)
|
function core.check_player_privs(name, ...)
|
||||||
local arg_type = type(name)
|
local arg_type = type(name)
|
||||||
if (arg_type == "userdata" or arg_type == "table") and
|
if (arg_type == "userdata" or arg_type == "table") and
|
||||||
|
@ -214,37 +170,11 @@ function core.http_add_fetch(httpenv)
|
||||||
return httpenv
|
return httpenv
|
||||||
end
|
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)
|
function core.close_formspec(player_name, formname)
|
||||||
return minetest.show_formspec(player_name, formname, "")
|
return minetest.show_formspec(player_name, formname, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function core.cancel_shutdown_requests()
|
||||||
|
core.request_shutdown("", false, -1)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
-- cache setting
|
||||||
|
local enable_damage = core.setting_getbool("enable_damage") == true
|
||||||
|
|
||||||
local health_bar_definition =
|
local health_bar_definition =
|
||||||
{
|
{
|
||||||
|
@ -42,8 +44,7 @@ local function initialize_builtin_statbars(player)
|
||||||
player:hud_set_flags(player:hud_get_flags())
|
player:hud_set_flags(player:hud_get_flags())
|
||||||
end
|
end
|
||||||
|
|
||||||
if player:hud_get_flags().healthbar and
|
if player:hud_get_flags().healthbar and enable_damage then
|
||||||
core.is_yes(core.setting_get("enable_damage")) then
|
|
||||||
if hud_ids[name].id_healthbar == nil then
|
if hud_ids[name].id_healthbar == nil then
|
||||||
health_bar_definition.number = player:get_hp()
|
health_bar_definition.number = player:get_hp()
|
||||||
hud_ids[name].id_healthbar = player:hud_add(health_bar_definition)
|
hud_ids[name].id_healthbar = player:hud_add(health_bar_definition)
|
||||||
|
@ -56,8 +57,7 @@ local function initialize_builtin_statbars(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (player:get_breath() < 11) then
|
if (player:get_breath() < 11) then
|
||||||
if player:hud_get_flags().breathbar and
|
if player:hud_get_flags().breathbar and enable_damage then
|
||||||
core.is_yes(core.setting_get("enable_damage")) then
|
|
||||||
if hud_ids[name].id_breathbar == nil then
|
if hud_ids[name].id_breathbar == nil then
|
||||||
hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition)
|
hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition)
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,6 +27,7 @@ minetest = core
|
||||||
-- Load other files
|
-- Load other files
|
||||||
local scriptdir = core.get_builtin_path() .. DIR_DELIM
|
local scriptdir = core.get_builtin_path() .. DIR_DELIM
|
||||||
local gamepath = scriptdir .. "game" .. DIR_DELIM
|
local gamepath = scriptdir .. "game" .. DIR_DELIM
|
||||||
|
local clientpath = scriptdir .. "client" .. DIR_DELIM
|
||||||
local commonpath = scriptdir .. "common" .. DIR_DELIM
|
local commonpath = scriptdir .. "common" .. DIR_DELIM
|
||||||
local asyncpath = scriptdir .. "async" .. DIR_DELIM
|
local asyncpath = scriptdir .. "async" .. DIR_DELIM
|
||||||
|
|
||||||
|
@ -45,6 +46,9 @@ elseif INIT == "mainmenu" then
|
||||||
end
|
end
|
||||||
elseif INIT == "async" then
|
elseif INIT == "async" then
|
||||||
dofile(asyncpath .. "init.lua")
|
dofile(asyncpath .. "init.lua")
|
||||||
|
elseif INIT == "client" then
|
||||||
|
os.setlocale = nil
|
||||||
|
dofile(clientpath .. "init.lua")
|
||||||
else
|
else
|
||||||
error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))
|
error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,7 +54,8 @@ end
|
||||||
function image_column(tooltip, flagname)
|
function image_column(tooltip, flagname)
|
||||||
return "image,tooltip=" .. core.formspec_escape(tooltip) .. "," ..
|
return "image,tooltip=" .. core.formspec_escape(tooltip) .. "," ..
|
||||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
||||||
"1=" .. core.formspec_escape(defaulttexturedir .. "server_flags_" .. flagname .. ".png") .. "," ..
|
"1=" .. core.formspec_escape(defaulttexturedir ..
|
||||||
|
(flagname and "server_flags_" .. flagname .. ".png" or "blank.png")) .. "," ..
|
||||||
"2=" .. core.formspec_escape(defaulttexturedir .. "server_ping_4.png") .. "," ..
|
"2=" .. core.formspec_escape(defaulttexturedir .. "server_ping_4.png") .. "," ..
|
||||||
"3=" .. core.formspec_escape(defaulttexturedir .. "server_ping_3.png") .. "," ..
|
"3=" .. core.formspec_escape(defaulttexturedir .. "server_ping_3.png") .. "," ..
|
||||||
"4=" .. core.formspec_escape(defaulttexturedir .. "server_ping_2.png") .. "," ..
|
"4=" .. core.formspec_escape(defaulttexturedir .. "server_ping_2.png") .. "," ..
|
||||||
|
|
|
@ -769,10 +769,4 @@ end
|
||||||
|
|
||||||
-- Generate minetest.conf.example and settings_translation_file.cpp
|
-- 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))
|
--assert(loadfile(core.get_builtin_path()..DIR_DELIM.."mainmenu"..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
|
||||||
|
|
|
@ -69,7 +69,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
--favourites
|
--favourites
|
||||||
retval = retval .. "tablecolumns[" ..
|
retval = retval .. "tablecolumns[" ..
|
||||||
image_column(fgettext("Favorite"), "favorite") .. ";" ..
|
image_column(fgettext("Favorite"), "favorite") .. ";" ..
|
||||||
image_column(fgettext("Ping"), "") .. ",padding=0.25;" ..
|
image_column(fgettext("Ping")) .. ",padding=0.25;" ..
|
||||||
"color,span=3;" ..
|
"color,span=3;" ..
|
||||||
"text,align=right;" .. -- clients
|
"text,align=right;" .. -- clients
|
||||||
"text,align=center,padding=0.25;" .. -- "/"
|
"text,align=center,padding=0.25;" .. -- "/"
|
||||||
|
|
|
@ -107,6 +107,12 @@ continuous_forward (Continuous forward) bool false
|
||||||
# Enable Joysticks
|
# Enable Joysticks
|
||||||
enable_joysticks (Enable Joysticks) bool false
|
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
|
# The time in seconds it takes between repeated events
|
||||||
# when holding down a joystick button combination.
|
# when holding down a joystick button combination.
|
||||||
repeat_joystick_button_time (Joystick button repetition interval) float 0.17
|
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
|
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||||
keymap_cmd (Command key) key /
|
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.
|
# Key for opening the chat console.
|
||||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||||
keyman_console (Console key) key KEY_F10
|
keyman_console (Console key) key KEY_F10
|
||||||
|
@ -196,6 +206,10 @@ keymap_screenshot (Screenshot) key KEY_F12
|
||||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||||
keymap_drop (Drop item key) key KEY_KEY_Q
|
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.
|
# Key for toggling the display of the HUD.
|
||||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||||
keymap_toggle_hud (HUD toggle key) key KEY_F1
|
keymap_toggle_hud (HUD toggle key) key KEY_F1
|
||||||
|
@ -204,6 +218,10 @@ keymap_toggle_hud (HUD toggle key) key KEY_F1
|
||||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||||
keymap_toggle_chat (Chat toggle key) key KEY_F2
|
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.
|
# Key for toggling the display of the fog.
|
||||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||||
keymap_toggle_force_fog_off (Fog toggle key) key KEY_F3
|
keymap_toggle_force_fog_off (Fog toggle key) key KEY_F3
|
||||||
|
@ -264,6 +282,10 @@ show_entity_selectionbox (Show entity selection boxes) bool true
|
||||||
# when connecting to the server.
|
# when connecting to the server.
|
||||||
enable_remote_media_server (Connect to external media server) bool true
|
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.
|
# URL to the server list displayed in the Multiplayer Tab.
|
||||||
serverlist_url (Serverlist URL) string servers.minetest.net
|
serverlist_url (Serverlist URL) string servers.minetest.net
|
||||||
|
|
||||||
|
@ -304,6 +326,9 @@ enable_3d_clouds (3D clouds) bool true
|
||||||
# Method used to highlight selected object.
|
# Method used to highlight selected object.
|
||||||
node_highlighting (Node highlighting) enum box box,halo
|
node_highlighting (Node highlighting) enum box box,halo
|
||||||
|
|
||||||
|
# Adds particles when digging a node.
|
||||||
|
enable_particles (Digging particles) bool true
|
||||||
|
|
||||||
[***Filtering]
|
[***Filtering]
|
||||||
|
|
||||||
# Use mip mapping to scale textures. May slightly increase performance.
|
# Use mip mapping to scale textures. May slightly increase performance.
|
||||||
|
@ -337,12 +362,20 @@ texture_min_size (Minimum texture size for filters) int 64
|
||||||
# when set to higher number than 0.
|
# when set to higher number than 0.
|
||||||
fsaa (FSAA) enum 0 0,1,2,4,8,16
|
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]
|
||||||
|
|
||||||
# Shaders allow advanced visual effects and may increase performance on some video cards.
|
# 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
|
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]
|
[****Tone Mapping]
|
||||||
|
|
||||||
# Enables filmic tone mapping
|
# Enables filmic tone mapping
|
||||||
|
@ -377,7 +410,7 @@ enable_parallax_occlusion (Parallax occlusion) bool false
|
||||||
parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1
|
parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1
|
||||||
|
|
||||||
# Strength of parallax.
|
# 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.
|
# Number of parallax occlusion iterations.
|
||||||
parallax_occlusion_iterations (Parallax occlusion iterations) int 4
|
parallax_occlusion_iterations (Parallax occlusion iterations) int 4
|
||||||
|
@ -459,13 +492,16 @@ cloud_height (Cloud height) int 120
|
||||||
# Values larger than 26 will start to produce sharp cutoffs at cloud area corners.
|
# Values larger than 26 will start to produce sharp cutoffs at cloud area corners.
|
||||||
cloud_radius (Cloud radius) int 12
|
cloud_radius (Cloud radius) int 12
|
||||||
|
|
||||||
|
# Enables view bobbing when walking.
|
||||||
|
view_bobbing (Enable view bobbing) bool true
|
||||||
|
|
||||||
# Multiplier for view bobbing.
|
# Multiplier for view bobbing.
|
||||||
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
|
# 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.
|
# Multiplier for fall bobbing.
|
||||||
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
|
# 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.
|
# 3D support.
|
||||||
# Currently supported:
|
# Currently supported:
|
||||||
|
@ -505,9 +541,21 @@ desynchronize_mapblock_texture_animation (Desynchronize block animation) bool tr
|
||||||
# Useful if there's something to be displayed right or left of hotbar.
|
# Useful if there's something to be displayed right or left of hotbar.
|
||||||
hud_hotbar_max_width (Maximum hotbar width) float 1.0
|
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.
|
# Enables caching of facedir rotated meshes.
|
||||||
enable_mesh_cache (Mesh cache) bool false
|
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.
|
# Enables minimap.
|
||||||
enable_minimap (Minimap) bool true
|
enable_minimap (Minimap) bool true
|
||||||
|
|
||||||
|
@ -531,9 +579,16 @@ ambient_occlusion_gamma (Ambient occlusion gamma) float 2.2 0.25 4.0
|
||||||
# Enables animation of inventory items.
|
# Enables animation of inventory items.
|
||||||
inventory_items_animations (Inventory items animations) bool false
|
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
|
# Fraction of the visible distance at which fog starts to be rendered
|
||||||
fog_start (Fog Start) float 0.4 0.0 0.99
|
fog_start (Fog Start) float 0.4 0.0 0.99
|
||||||
|
|
||||||
|
# Makes all liquids opaque
|
||||||
|
opaque_water (Opaque liquids) bool false
|
||||||
|
|
||||||
[**Menus]
|
[**Menus]
|
||||||
|
|
||||||
# Use a cloud animation for the main menu background.
|
# Use a cloud animation for the main menu background.
|
||||||
|
@ -600,6 +655,10 @@ screenshot_quality (Screenshot quality) int 0 0 100
|
||||||
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.
|
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.
|
||||||
screen_dpi (DPI) int 72
|
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]
|
[*Sound]
|
||||||
|
|
||||||
enable_sound (Sound) bool true
|
enable_sound (Sound) bool true
|
||||||
|
@ -712,6 +771,9 @@ show_statusline_on_connect (Status message on connection) bool true
|
||||||
# Enable players getting damage and dying.
|
# Enable players getting damage and dying.
|
||||||
enable_damage (Damage) bool false
|
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.
|
# A chosen map seed for a new map, leave empty for random.
|
||||||
# Will be overridden when creating a new world in the main menu.
|
# Will be overridden when creating a new world in the main menu.
|
||||||
fixed_map_seed (Fixed map seed) string
|
fixed_map_seed (Fixed map seed) string
|
||||||
|
@ -799,7 +861,7 @@ movement_acceleration_fast (Fast mode acceleration) float 10
|
||||||
movement_speed_walk (Walking speed) float 4
|
movement_speed_walk (Walking speed) float 4
|
||||||
movement_speed_crouch (Crouch speed) float 1.35
|
movement_speed_crouch (Crouch speed) float 1.35
|
||||||
movement_speed_fast (Fast mode speed) float 20
|
movement_speed_fast (Fast mode speed) float 20
|
||||||
movement_speed_climb (Climbing speed) float 2
|
movement_speed_climb (Climbing speed) float 3
|
||||||
movement_speed_jump (Jumping speed) float 6.5
|
movement_speed_jump (Jumping speed) float 6.5
|
||||||
movement_speed_descend (Descending speed) float 6
|
movement_speed_descend (Descending speed) float 6
|
||||||
movement_liquid_fluidity (Liquid fluidity) float 1
|
movement_liquid_fluidity (Liquid fluidity) float 1
|
||||||
|
@ -864,6 +926,12 @@ liquid_update (Liquid update tick) float 1.0
|
||||||
# Stated in mapblocks (16 nodes)
|
# Stated in mapblocks (16 nodes)
|
||||||
block_send_optimize_distance (block send optimize distance) int 4 2
|
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]
|
[*Mapgen]
|
||||||
|
|
||||||
# Name of map generator to be used when creating a new world.
|
# Name of map generator to be used when creating a new world.
|
||||||
|
@ -876,13 +944,10 @@ water_level (Water level) int 1
|
||||||
# From how far blocks are generated for clients, stated in mapblocks (16 nodes).
|
# From how far blocks are generated for clients, stated in mapblocks (16 nodes).
|
||||||
max_block_generate_distance (Max block generate distance) int 6
|
max_block_generate_distance (Max block generate distance) int 6
|
||||||
|
|
||||||
# Where the map generator stops.
|
# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0).
|
||||||
# Please note:
|
# Only mapchunks completely within the mapgen limit are generated.
|
||||||
# - Limited to 31000 (setting above has no effect)
|
# Value is stored per-world.
|
||||||
# - The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks).
|
mapgen_limit (Map generation limit) int 31000 0 31000
|
||||||
# - 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
|
|
||||||
|
|
||||||
# Global map generation attributes.
|
# Global map generation attributes.
|
||||||
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
|
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
|
||||||
|
@ -915,23 +980,63 @@ emergequeue_limit_generate (Limit of emerge queues to generate) int 32
|
||||||
# at the cost of slightly buggy caves.
|
# at the cost of slightly buggy caves.
|
||||||
num_emerge_threads (Number of emerge threads) int 1
|
num_emerge_threads (Number of emerge threads) int 1
|
||||||
|
|
||||||
# Noise parameters for biome API temperature, humidity and biome blend.
|
[***Biome API temperature and humidity noise parameters]
|
||||||
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
|
# Temperature variation for biomes.
|
||||||
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_heat (Heat noise) noise_params 50, 50, (1000, 1000, 1000), 5349, 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
|
|
||||||
|
# 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]
|
[***Mapgen v5]
|
||||||
|
|
||||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
# Map generation attributes specific to Mapgen v5.
|
||||||
mgv5_cave_width (Mapgen v5 cave width) float 0.125
|
# 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
|
# 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 = {
|
#mgv5_np_ground = {
|
||||||
# offset = 0
|
# offset = 0
|
||||||
# scale = 40
|
# scale = 40
|
||||||
|
@ -946,27 +1051,52 @@ mgv5_np_cave2 (Mapgen v5 cave2 noise parameters) noise_params 0, 12, (50, 50, 50
|
||||||
[***Mapgen v6]
|
[***Mapgen v6]
|
||||||
|
|
||||||
# Map generation attributes specific to 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 that are not specified in the flag string are not modified from the default.
|
||||||
# Flags starting with 'no' are used to explicitly disable them.
|
# 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.
|
# Deserts occur when np_biome exceeds this value.
|
||||||
# When snowbiomes are enabled 'mgv6_freq_desert' is ignored.
|
# When the new biome system is enabled, this is ignored.
|
||||||
mgv6_freq_desert (Mapgen v6 desert frequency) float 0.45
|
mgv6_freq_desert (Desert noise threshold) float 0.45
|
||||||
mgv6_freq_beach (Mapgen v6 beach frequency) float 0.15
|
|
||||||
|
|
||||||
mgv6_np_terrain_base (Mapgen v6 terrain base noise parameters) noise_params -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0
|
# Sandy beaches occur when np_beach exceeds this value.
|
||||||
mgv6_np_terrain_higher (Mapgen v6 terrain altitude noise parameters) noise_params 20, 16, (500, 500, 500), 85039, 5, 0.6, 2.0
|
mgv6_freq_beach (Beach noise threshold) float 0.15
|
||||||
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
|
# Y-level of lower terrain and lakebeds.
|
||||||
mgv6_np_mud (Mapgen v6 mud noise parameters) noise_params 4, 2, (200, 200, 200), 91013, 3, 0.55, 2.0
|
mgv6_np_terrain_base (Terrain base noise) noise_params -4, 20, (250, 250, 250), 82341, 5, 0.6, 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
|
# Y-level of higher (cliff-top) terrain.
|
||||||
mgv6_np_cave (Mapgen v6 cave noise parameters) noise_params 6, 6, (250, 250, 250), 34329, 3, 0.50, 2.0
|
mgv6_np_terrain_higher (Terrain higher noise) noise_params 20, 16, (500, 500, 500), 85039, 5, 0.6, 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
|
# Varies steepness of cliffs.
|
||||||
mgv6_np_apple_trees (Mapgen v6 apple trees noise parameters) noise_params 0, 1, (100, 100, 100), 342902, 3, 0.45, 2.0
|
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]
|
[***Mapgen v7]
|
||||||
|
|
||||||
|
@ -975,37 +1105,77 @@ mgv6_np_apple_trees (Mapgen v6 apple trees noise parameters) noise_params 0, 1,
|
||||||
# Floatlands are currently experimental and subject to change.
|
# Floatlands are currently experimental and subject to change.
|
||||||
# Flags that are not specified in the flag string are not modified from the default.
|
# 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.
|
# 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.
|
# 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.
|
# Controls the density of floatland mountain terrain.
|
||||||
# Is an offset added to the 'np_mountain' noise value.
|
# 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.
|
# 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.
|
# 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.
|
# 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
|
# Y-level of cavern upper limit.
|
||||||
mgv7_np_terrain_alt (Mapgen v7 terrain altitude noise parameters) noise_params 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0
|
mgv7_cavern_limit (Cavern limit) int -256
|
||||||
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
|
# Y-distance over which caverns expand to full size.
|
||||||
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_cavern_taper (Cavern taper) int 256
|
||||||
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
|
# Defines full size of caverns, smaller values create larger caverns.
|
||||||
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_cavern_threshold (Cavern threshold) float 0.7
|
||||||
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
|
# Y-level of higher (cliff-top) terrain.
|
||||||
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_terrain_base (Terrain base noise) noise_params 4, 70, (600, 600, 600), 82341, 5, 0.6, 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 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]
|
[***Mapgen flat]
|
||||||
|
|
||||||
|
@ -1013,46 +1183,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.
|
# 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 that are not specified in the flag string are not modified from the default.
|
||||||
# Flags starting with 'no' are used to explicitly disable them.
|
# 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.
|
# 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.
|
# 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.
|
# 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.
|
# Terrain noise threshold for lakes.
|
||||||
# Controls proportion of world area covered by lakes.
|
# Controls proportion of world area covered by lakes.
|
||||||
# Adjust towards 0.0 for a larger proportion.
|
# 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.
|
# 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.
|
# Terrain noise threshold for hills.
|
||||||
# Controls proportion of world area covered by hills.
|
# Controls proportion of world area covered by hills.
|
||||||
# Adjust towards 0.0 for a larger proportion.
|
# 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.
|
# 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.
|
# Defines location and terrain of optional hills and lakes.
|
||||||
# The 3 numbers in brackets control the scale of the
|
mgflat_np_terrain (Terrain noise) noise_params 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0
|
||||||
# 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
|
|
||||||
|
|
||||||
mgflat_np_filler_depth (Mapgen flat filler depth noise parameters) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
# Variation of biome filler depth.
|
||||||
mgflat_np_cave1 (Mapgen flat cave1 noise parameters) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
|
mgflat_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
|
||||||
mgflat_np_cave2 (Mapgen flat cave2 noise parameters) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 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]
|
[***Mapgen fractal]
|
||||||
|
|
||||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
# 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.
|
# Choice of 18 fractals from 9 formulas.
|
||||||
# 1 = 4D "Roundy" mandelbrot set.
|
# 1 = 4D "Roundy" mandelbrot set.
|
||||||
|
@ -1073,48 +1246,55 @@ mgfractal_cave_width (Mapgen fractal cave width) float 0.09
|
||||||
# 16 = 3D "Cosine Mandelbulb" julia set.
|
# 16 = 3D "Cosine Mandelbulb" julia set.
|
||||||
# 17 = 4D "Mandelbulb" mandelbrot set.
|
# 17 = 4D "Mandelbulb" mandelbrot set.
|
||||||
# 18 = 4D "Mandelbulb" julia 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.
|
# Iterations of the recursive function.
|
||||||
# Controls the amount of fine detail.
|
# 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.
|
# 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'.
|
# (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).
|
# 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.
|
# 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.
|
# 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.
|
# W co-ordinate of the generated 3D slice of a 4D fractal.
|
||||||
# Determines which 3D slice of the 4D shape is generated.
|
# Determines which 3D slice of the 4D shape is generated.
|
||||||
# Has no effect on 3D fractals.
|
# Has no effect on 3D fractals.
|
||||||
# Range roughly -2 to 2.
|
# 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.
|
# Julia set only: X component of hypercomplex constant determining julia shape.
|
||||||
# Range roughly -2 to 2.
|
# 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.
|
# Julia set only: Y component of hypercomplex constant determining julia shape.
|
||||||
# Range roughly -2 to 2.
|
# 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.
|
# Julia set only: Z component of hypercomplex constant determining julia shape.
|
||||||
# Range roughly -2 to 2.
|
# 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.
|
# Julia set only: W component of hypercomplex constant determining julia shape.
|
||||||
# Has no effect on 3D fractals.
|
# Has no effect on 3D fractals.
|
||||||
# Range roughly -2 to 2.
|
# 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
|
# Y-level of seabed.
|
||||||
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_seabed (Seabed noise) noise_params -14, 9, (600, 600, 600), 41900, 5, 0.6, 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
|
# 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 parameters
|
||||||
[***Mapgen Valleys]
|
[***Mapgen Valleys]
|
||||||
|
@ -1215,7 +1395,6 @@ profiler.load (Load the game profiler) bool false
|
||||||
profiler.default_report_format (Default report format) enum txt txt,csv,lua,json,json_pretty
|
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.
|
# The file path relative to your worldpath in which profiles will be saved to.
|
||||||
#
|
|
||||||
profiler.report_path (Report path) string ""
|
profiler.report_path (Report path) string ""
|
||||||
|
|
||||||
[***Instrumentation]
|
[***Instrumentation]
|
||||||
|
|
|
@ -0,0 +1,128 @@
|
||||||
|
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")
|
||||||
|
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
|
||||||
|
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"))
|
||||||
|
print("Server version:" .. core.get_protocol_version())
|
||||||
|
preview_minimap()
|
||||||
|
end)
|
||||||
|
|
||||||
|
core.after(5, function()
|
||||||
|
core.ui.minimap:show()
|
||||||
|
|
||||||
|
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)
|
option(ENABLE_SYSTEM_GMP "Use GMP from system" TRUE)
|
||||||
mark_as_advanced(GMP_LIBRARY GMP_INCLUDE_DIR)
|
mark_as_advanced(GMP_LIBRARY GMP_INCLUDE_DIR)
|
||||||
set(USE_SYSTEM_GMP FALSE)
|
set(USE_SYSTEM_GMP FALSE)
|
||||||
|
@ -19,9 +18,9 @@ endif()
|
||||||
|
|
||||||
if(NOT USE_SYSTEM_GMP)
|
if(NOT USE_SYSTEM_GMP)
|
||||||
message(STATUS "Using bundled mini-gmp library.")
|
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)
|
set(GMP_LIBRARY gmp)
|
||||||
add_subdirectory(gmp)
|
add_subdirectory(lib/gmp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
|
@ -20,8 +20,7 @@ endif()
|
||||||
|
|
||||||
if(NOT JSONCPP_FOUND)
|
if(NOT JSONCPP_FOUND)
|
||||||
message(STATUS "Using bundled JSONCPP library.")
|
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)
|
set(JSON_LIBRARY jsoncpp)
|
||||||
add_subdirectory(jsoncpp/json)
|
add_subdirectory(lib/jsoncpp)
|
||||||
endif()
|
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()
|
|
@ -0,0 +1,975 @@
|
||||||
|
Minetest Lua Client Modding API Reference 0.4.15
|
||||||
|
================================================
|
||||||
|
* More information at <http://www.minetest.net/>
|
||||||
|
* Developer Wiki: <http://dev.minetest.net/>
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
**WARNING: The client API is currently unstable, and may break/change without warning.**
|
||||||
|
|
||||||
|
Content and functionality can be added to Minetest 0.4.15-dev+ by using Lua
|
||||||
|
scripting in run-time loaded mods.
|
||||||
|
|
||||||
|
A mod is a self-contained bunch of scripts, textures and other related
|
||||||
|
things that is loaded by and interfaces with Minetest.
|
||||||
|
|
||||||
|
Transfering client-sided mods form the server to the client is planned, but not implemented yet.
|
||||||
|
|
||||||
|
If you see a deficiency in the API, feel free to attempt to add the
|
||||||
|
functionality in the engine and API. You can send such improvements as
|
||||||
|
source code patches on GitHub (https://github.com/minetest/minetest).
|
||||||
|
|
||||||
|
Programming in Lua
|
||||||
|
------------------
|
||||||
|
If you have any difficulty in understanding this, please read
|
||||||
|
[Programming in Lua](http://www.lua.org/pil/).
|
||||||
|
|
||||||
|
Startup
|
||||||
|
-------
|
||||||
|
Mods are loaded during client startup from the mod load paths by running
|
||||||
|
the `init.lua` scripts in a shared environment.
|
||||||
|
|
||||||
|
Paths
|
||||||
|
-----
|
||||||
|
* `RUN_IN_PLACE=1` (Windows release, local build)
|
||||||
|
* `$path_user`:
|
||||||
|
* Linux: `<build directory>`
|
||||||
|
* Windows: `<build directory>`
|
||||||
|
* `$path_share`
|
||||||
|
* Linux: `<build directory>`
|
||||||
|
* Windows: `<build directory>`
|
||||||
|
* `RUN_IN_PLACE=0`: (Linux release)
|
||||||
|
* `$path_share`
|
||||||
|
* Linux: `/usr/share/minetest`
|
||||||
|
* Windows: `<install directory>/minetest-0.4.x`
|
||||||
|
* `$path_user`:
|
||||||
|
* Linux: `$HOME/.minetest`
|
||||||
|
* Windows: `C:/users/<user>/AppData/minetest` (maybe)
|
||||||
|
|
||||||
|
Mod load path
|
||||||
|
-------------
|
||||||
|
Generic:
|
||||||
|
|
||||||
|
* `$path_share/clientmods/`
|
||||||
|
* `$path_user/clientmods/` (User-installed mods)
|
||||||
|
|
||||||
|
In a run-in-place version (e.g. the distributed windows version):
|
||||||
|
|
||||||
|
* `minetest-0.4.x/clientmods/` (User-installed mods)
|
||||||
|
|
||||||
|
On an installed version on Linux:
|
||||||
|
|
||||||
|
* `/usr/share/minetest/clientmods/`
|
||||||
|
* `$HOME/.minetest/clientmods/` (User-installed mods)
|
||||||
|
|
||||||
|
Modpack support
|
||||||
|
----------------
|
||||||
|
**NOTE: Not implemented yet.**
|
||||||
|
|
||||||
|
Mods can be put in a subdirectory, if the parent directory, which otherwise
|
||||||
|
should be a mod, contains a file named `modpack.txt`. This file shall be
|
||||||
|
empty, except for lines starting with `#`, which are comments.
|
||||||
|
|
||||||
|
Mod directory structure
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
clientmods
|
||||||
|
├── modname
|
||||||
|
| ├── depends.txt
|
||||||
|
| ├── init.lua
|
||||||
|
└── another
|
||||||
|
|
||||||
|
### modname
|
||||||
|
The location of this directory.
|
||||||
|
|
||||||
|
### depends.txt
|
||||||
|
List of mods that have to be loaded before loading this mod.
|
||||||
|
|
||||||
|
A single line contains a single modname.
|
||||||
|
|
||||||
|
Optional dependencies can be defined by appending a question mark
|
||||||
|
to a single modname. Their meaning is that if the specified mod
|
||||||
|
is missing, that does not prevent this mod from being loaded.
|
||||||
|
|
||||||
|
### init.lua
|
||||||
|
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.
|
||||||
|
|
||||||
|
### `sounds`
|
||||||
|
Media files (sounds) that will be transferred to the
|
||||||
|
client and will be available for use by the mod.
|
||||||
|
|
||||||
|
Naming convention for registered textual names
|
||||||
|
----------------------------------------------
|
||||||
|
Registered names should generally be in this format:
|
||||||
|
|
||||||
|
"modname:<whatever>" (<whatever> can have characters a-zA-Z0-9_)
|
||||||
|
|
||||||
|
This is to prevent conflicting names from corrupting maps and is
|
||||||
|
enforced by the mod loader.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
In the mod `experimental`, there is the ideal item/node/entity name `tnt`.
|
||||||
|
So the name should be `experimental:tnt`.
|
||||||
|
|
||||||
|
Enforcement can be overridden by prefixing the name with `:`. This can
|
||||||
|
be used for overriding the registrations of some other mod.
|
||||||
|
|
||||||
|
Example: Any mod can redefine `experimental:tnt` by using the name
|
||||||
|
|
||||||
|
:experimental:tnt
|
||||||
|
|
||||||
|
when registering it.
|
||||||
|
(also that mod is required to have `experimental` as a dependency)
|
||||||
|
|
||||||
|
The `:` prefix can also be used for maintaining backwards compatibility.
|
||||||
|
|
||||||
|
Sounds
|
||||||
|
------
|
||||||
|
**NOTE: max_hear_distance and connecting to objects is not implemented.**
|
||||||
|
|
||||||
|
Only Ogg Vorbis files are supported.
|
||||||
|
|
||||||
|
For positional playing of sounds, only single-channel (mono) files are
|
||||||
|
supported. Otherwise OpenAL will play them non-positionally.
|
||||||
|
|
||||||
|
Mods should generally prefix their sounds with `modname_`, e.g. given
|
||||||
|
the mod name "`foomod`", a sound could be called:
|
||||||
|
|
||||||
|
foomod_foosound.ogg
|
||||||
|
|
||||||
|
Sounds are referred to by their name with a dot, a single digit and the
|
||||||
|
file extension stripped out. When a sound is played, the actual sound file
|
||||||
|
is chosen randomly from the matching sounds.
|
||||||
|
|
||||||
|
When playing the sound `foomod_foosound`, the sound is chosen randomly
|
||||||
|
from the available ones of the following files:
|
||||||
|
|
||||||
|
* `foomod_foosound.ogg`
|
||||||
|
* `foomod_foosound.0.ogg`
|
||||||
|
* `foomod_foosound.1.ogg`
|
||||||
|
* (...)
|
||||||
|
* `foomod_foosound.9.ogg`
|
||||||
|
|
||||||
|
Examples of sound parameter tables:
|
||||||
|
|
||||||
|
-- Play locationless
|
||||||
|
{
|
||||||
|
gain = 1.0, -- default
|
||||||
|
}
|
||||||
|
-- Play locationless, looped
|
||||||
|
{
|
||||||
|
gain = 1.0, -- default
|
||||||
|
loop = true,
|
||||||
|
}
|
||||||
|
-- Play in a location
|
||||||
|
{
|
||||||
|
pos = {x = 1, y = 2, z = 3},
|
||||||
|
gain = 1.0, -- default
|
||||||
|
max_hear_distance = 32, -- default, uses an euclidean metric
|
||||||
|
}
|
||||||
|
-- Play connected to an object, looped
|
||||||
|
{
|
||||||
|
object = <an ObjectRef>,
|
||||||
|
gain = 1.0, -- default
|
||||||
|
max_hear_distance = 32, -- default, uses an euclidean metric
|
||||||
|
loop = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
Looped sounds must either be connected to an object or played locationless.
|
||||||
|
|
||||||
|
### SimpleSoundSpec
|
||||||
|
* e.g. `""`
|
||||||
|
* e.g. `"default_place_node"`
|
||||||
|
* e.g. `{}`
|
||||||
|
* e.g. `{name = "default_place_node"}`
|
||||||
|
* e.g. `{name = "default_place_node", gain = 1.0}`
|
||||||
|
|
||||||
|
Representations of simple things
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
### Position/vector
|
||||||
|
|
||||||
|
{x=num, y=num, z=num}
|
||||||
|
|
||||||
|
For helper functions see "Vector helpers".
|
||||||
|
|
||||||
|
### pointed_thing
|
||||||
|
* `{type="nothing"}`
|
||||||
|
* `{type="node", under=pos, above=pos}`
|
||||||
|
* `{type="object", ref=ObjectRef}`
|
||||||
|
|
||||||
|
Flag Specifier Format
|
||||||
|
---------------------
|
||||||
|
Flags using the standardized flag specifier format can be specified in either of
|
||||||
|
two ways, by string or table.
|
||||||
|
|
||||||
|
The string format is a comma-delimited set of flag names; whitespace and
|
||||||
|
unrecognized flag fields are ignored. Specifying a flag in the string sets the
|
||||||
|
flag, and specifying a flag prefixed by the string `"no"` explicitly
|
||||||
|
clears the flag from whatever the default may be.
|
||||||
|
|
||||||
|
In addition to the standard string flag format, the schematic flags field can
|
||||||
|
also be a table of flag names to boolean values representing whether or not the
|
||||||
|
flag is set. Additionally, if a field with the flag name prefixed with `"no"`
|
||||||
|
is present, mapped to a boolean of any value, the specified flag is unset.
|
||||||
|
|
||||||
|
E.g. A flag field of value
|
||||||
|
|
||||||
|
{place_center_x = true, place_center_y=false, place_center_z=true}
|
||||||
|
|
||||||
|
is equivalent to
|
||||||
|
|
||||||
|
{place_center_x = true, noplace_center_y=true, place_center_z=true}
|
||||||
|
|
||||||
|
which is equivalent to
|
||||||
|
|
||||||
|
"place_center_x, noplace_center_y, place_center_z"
|
||||||
|
|
||||||
|
or even
|
||||||
|
|
||||||
|
"place_center_x, place_center_z"
|
||||||
|
|
||||||
|
since, by default, no schematic attributes are set.
|
||||||
|
|
||||||
|
Formspec
|
||||||
|
--------
|
||||||
|
Formspec defines a menu. It is a string, with a somewhat strange format.
|
||||||
|
|
||||||
|
Spaces and newlines can be inserted between the blocks, as is used in the
|
||||||
|
examples.
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
#### Chest
|
||||||
|
|
||||||
|
size[8,9]
|
||||||
|
list[context;main;0,0;8,4;]
|
||||||
|
list[current_player;main;0,5;8,4;]
|
||||||
|
|
||||||
|
#### Furnace
|
||||||
|
|
||||||
|
size[8,9]
|
||||||
|
list[context;fuel;2,3;1,1;]
|
||||||
|
list[context;src;2,1;1,1;]
|
||||||
|
list[context;dst;5,1;2,2;]
|
||||||
|
list[current_player;main;0,5;8,4;]
|
||||||
|
|
||||||
|
#### Minecraft-like player inventory
|
||||||
|
|
||||||
|
size[8,7.5]
|
||||||
|
image[1,0.6;1,2;player.png]
|
||||||
|
list[current_player;main;0,3.5;8,4;]
|
||||||
|
list[current_player;craft;3,0;3,3;]
|
||||||
|
list[current_player;craftpreview;7,1;1,1;]
|
||||||
|
|
||||||
|
### Elements
|
||||||
|
|
||||||
|
#### `size[<W>,<H>,<fixed_size>]`
|
||||||
|
* Define the size of the menu in inventory slots
|
||||||
|
* `fixed_size`: `true`/`false` (optional)
|
||||||
|
* deprecated: `invsize[<W>,<H>;]`
|
||||||
|
|
||||||
|
#### `container[<X>,<Y>]`
|
||||||
|
* Start of a container block, moves all physical elements in the container by (X, Y)
|
||||||
|
* Must have matching container_end
|
||||||
|
* Containers can be nested, in which case the offsets are added
|
||||||
|
(child containers are relative to parent containers)
|
||||||
|
|
||||||
|
#### `container_end[]`
|
||||||
|
* End of a container, following elements are no longer relative to this container
|
||||||
|
|
||||||
|
#### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]`
|
||||||
|
* Show an inventory list
|
||||||
|
|
||||||
|
#### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;<starting item index>]`
|
||||||
|
* Show an inventory list
|
||||||
|
|
||||||
|
#### `listring[<inventory location>;<list name>]`
|
||||||
|
* Allows to create a ring of inventory lists
|
||||||
|
* Shift-clicking on items in one element of the ring
|
||||||
|
will send them to the next inventory list inside the ring
|
||||||
|
* The first occurrence of an element inside the ring will
|
||||||
|
determine the inventory where items will be sent to
|
||||||
|
|
||||||
|
#### `listring[]`
|
||||||
|
* Shorthand for doing `listring[<inventory location>;<list name>]`
|
||||||
|
for the last two inventory lists added by list[...]
|
||||||
|
|
||||||
|
#### `listcolors[<slot_bg_normal>;<slot_bg_hover>]`
|
||||||
|
* Sets background color of slots as `ColorString`
|
||||||
|
* Sets background color of slots on mouse hovering
|
||||||
|
|
||||||
|
#### `listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>]`
|
||||||
|
* Sets background color of slots as `ColorString`
|
||||||
|
* Sets background color of slots on mouse hovering
|
||||||
|
* Sets color of slots border
|
||||||
|
|
||||||
|
#### `listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>;<tooltip_bgcolor>;<tooltip_fontcolor>]`
|
||||||
|
* Sets background color of slots as `ColorString`
|
||||||
|
* Sets background color of slots on mouse hovering
|
||||||
|
* Sets color of slots border
|
||||||
|
* Sets default background color of tooltips
|
||||||
|
* Sets default font color of tooltips
|
||||||
|
|
||||||
|
#### `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)
|
||||||
|
|
||||||
|
#### `image[<X>,<Y>;<W>,<H>;<texture name>]`
|
||||||
|
* Show an image
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
|
||||||
|
#### `item_image[<X>,<Y>;<W>,<H>;<item name>]`
|
||||||
|
* Show an inventory image of registered item/node
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
|
||||||
|
#### `bgcolor[<color>;<fullscreen>]`
|
||||||
|
* Sets background color of formspec as `ColorString`
|
||||||
|
* If `true`, the background color is drawn fullscreen (does not effect the size of the formspec)
|
||||||
|
|
||||||
|
#### `background[<X>,<Y>;<W>,<H>;<texture name>]`
|
||||||
|
* Use a background. Inventory rectangles are not drawn then.
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
* Example for formspec 8x4 in 16x resolution: image shall be sized
|
||||||
|
8 times 16px times 4 times 16px.
|
||||||
|
|
||||||
|
#### `background[<X>,<Y>;<W>,<H>;<texture name>;<auto_clip>]`
|
||||||
|
* Use a background. Inventory rectangles are not drawn then.
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
* Example for formspec 8x4 in 16x resolution:
|
||||||
|
image shall be sized 8 times 16px times 4 times 16px
|
||||||
|
* If `true` the background is clipped to formspec size
|
||||||
|
(`x` and `y` are used as offset values, `w` and `h` are ignored)
|
||||||
|
|
||||||
|
#### `pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>]`
|
||||||
|
* Textual password style field; will be sent to server when a button is clicked
|
||||||
|
* When enter is pressed in field, fields.key_enter_field will be sent with the name
|
||||||
|
of this field.
|
||||||
|
* `x` and `y` position the field relative to the top left of the menu
|
||||||
|
* `w` and `h` are the size of the field
|
||||||
|
* Fields are a set height, but will be vertically centred on `h`
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
* `name` is the name of the field as returned in fields to `on_receive_fields`
|
||||||
|
* `label`, if not blank, will be text printed on the top left above the field
|
||||||
|
* See field_close_on_enter to stop enter closing the formspec
|
||||||
|
|
||||||
|
#### `field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
|
||||||
|
* Textual field; will be sent to server when a button is clicked
|
||||||
|
* When enter is pressed in field, fields.key_enter_field will be sent with the name
|
||||||
|
of this field.
|
||||||
|
* `x` and `y` position the field relative to the top left of the menu
|
||||||
|
* `w` and `h` are the size of the field
|
||||||
|
* Fields are a set height, but will be vertically centred on `h`
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
* `name` is the name of the field as returned in fields to `on_receive_fields`
|
||||||
|
* `label`, if not blank, will be text printed on the top left above the field
|
||||||
|
* `default` is the default value of the field
|
||||||
|
* `default` may contain variable references such as `${text}'` which
|
||||||
|
will fill the value from the metadata value `text`
|
||||||
|
* **Note**: no extra text or more than a single variable is supported ATM.
|
||||||
|
* See field_close_on_enter to stop enter closing the formspec
|
||||||
|
|
||||||
|
#### `field[<name>;<label>;<default>]`
|
||||||
|
* As above, but without position/size units
|
||||||
|
* When enter is pressed in field, fields.key_enter_field will be sent with the name
|
||||||
|
of this field.
|
||||||
|
* Special field for creating simple forms, such as sign text input
|
||||||
|
* Must be used without a `size[]` element
|
||||||
|
* A "Proceed" button will be added automatically
|
||||||
|
* See field_close_on_enter to stop enter closing the formspec
|
||||||
|
|
||||||
|
#### `field_close_on_enter[<name>;<close_on_enter>]`
|
||||||
|
* <name> is the name of the field
|
||||||
|
* if <close_on_enter> is false, pressing enter in the field will submit the form but not close it
|
||||||
|
* defaults to true when not specified (ie: no tag for a field)
|
||||||
|
|
||||||
|
#### `textarea[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
|
||||||
|
* Same as fields above, but with multi-line input
|
||||||
|
|
||||||
|
#### `label[<X>,<Y>;<label>]`
|
||||||
|
* `x` and `y` work as per field
|
||||||
|
* `label` is the text on the label
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
|
||||||
|
#### `vertlabel[<X>,<Y>;<label>]`
|
||||||
|
* Textual label drawn vertically
|
||||||
|
* `x` and `y` work as per field
|
||||||
|
* `label` is the text on the label
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
|
||||||
|
#### `button[<X>,<Y>;<W>,<H>;<name>;<label>]`
|
||||||
|
* Clickable button. When clicked, fields will be sent.
|
||||||
|
* `x`, `y` and `name` work as per field
|
||||||
|
* `w` and `h` are the size of the button
|
||||||
|
* `label` is the text on the button
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
|
||||||
|
#### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
|
||||||
|
* `x`, `y`, `w`, `h`, and `name` work as per button
|
||||||
|
* `texture name` is the filename of an image
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
|
||||||
|
#### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]`
|
||||||
|
* `x`, `y`, `w`, `h`, and `name` work as per button
|
||||||
|
* `texture name` is the filename of an image
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
* `noclip=true` means the image button doesn't need to be within specified formsize
|
||||||
|
* `drawborder`: draw button border or not
|
||||||
|
* `pressed texture name` is the filename of an image on pressed state
|
||||||
|
|
||||||
|
#### `item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]`
|
||||||
|
* `x`, `y`, `w`, `h`, `name` and `label` work as per button
|
||||||
|
* `item name` is the registered name of an item/node,
|
||||||
|
tooltip will be made out of its description
|
||||||
|
to override it use tooltip element
|
||||||
|
* Position and size units are inventory slots
|
||||||
|
|
||||||
|
#### `button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]`
|
||||||
|
* When clicked, fields will be sent and the form will quit.
|
||||||
|
|
||||||
|
#### `image_button_exit[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
|
||||||
|
* When clicked, fields will be sent and the form will quit.
|
||||||
|
|
||||||
|
#### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>]`
|
||||||
|
* Scrollable item list showing arbitrary text elements
|
||||||
|
* `x` and `y` position the itemlist relative to the top left of the menu
|
||||||
|
* `w` and `h` are the size of the itemlist
|
||||||
|
* `name` fieldname sent to server on doubleclick value is current selected element
|
||||||
|
* `listelements` can be prepended by #color in hexadecimal format RRGGBB (only),
|
||||||
|
* if you want a listelement to start with "#" write "##".
|
||||||
|
|
||||||
|
#### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>;<selected idx>;<transparent>]`
|
||||||
|
* Scrollable itemlist showing arbitrary text elements
|
||||||
|
* `x` and `y` position the item list relative to the top left of the menu
|
||||||
|
* `w` and `h` are the size of the item list
|
||||||
|
* `name` fieldname sent to server on doubleclick value is current selected element
|
||||||
|
* `listelements` can be prepended by #RRGGBB (only) in hexadecimal format
|
||||||
|
* if you want a listelement to start with "#" write "##"
|
||||||
|
* Index to be selected within textlist
|
||||||
|
* `true`/`false`: draw transparent background
|
||||||
|
* See also `minetest.explode_textlist_event` (main menu: `engine.explode_textlist_event`)
|
||||||
|
|
||||||
|
#### `tabheader[<X>,<Y>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]`
|
||||||
|
* Show a tab**header** at specific position (ignores formsize)
|
||||||
|
* `x` and `y` position the itemlist relative to the top left of the menu
|
||||||
|
* `name` fieldname data is transferred to Lua
|
||||||
|
* `caption 1`...: name shown on top of tab
|
||||||
|
* `current_tab`: index of selected tab 1...
|
||||||
|
* `transparent` (optional): show transparent
|
||||||
|
* `draw_border` (optional): draw border
|
||||||
|
|
||||||
|
#### `box[<X>,<Y>;<W>,<H>;<color>]`
|
||||||
|
* Simple colored semitransparent box
|
||||||
|
* `x` and `y` position the box relative to the top left of the menu
|
||||||
|
* `w` and `h` are the size of box
|
||||||
|
* `color` is color specified as a `ColorString`
|
||||||
|
|
||||||
|
#### `dropdown[<X>,<Y>;<W>;<name>;<item 1>,<item 2>, ...,<item n>;<selected idx>]`
|
||||||
|
* Show a dropdown field
|
||||||
|
* **Important note**: There are two different operation modes:
|
||||||
|
1. handle directly on change (only changed dropdown is submitted)
|
||||||
|
2. read the value on pressing a button (all dropdown values are available)
|
||||||
|
* `x` and `y` position of dropdown
|
||||||
|
* Width of dropdown
|
||||||
|
* Fieldname data is transferred to Lua
|
||||||
|
* Items to be shown in dropdown
|
||||||
|
* Index of currently selected dropdown item
|
||||||
|
|
||||||
|
#### `checkbox[<X>,<Y>;<name>;<label>;<selected>]`
|
||||||
|
* Show a checkbox
|
||||||
|
* `x` and `y`: position of checkbox
|
||||||
|
* `name` fieldname data is transferred to Lua
|
||||||
|
* `label` to be shown left of checkbox
|
||||||
|
* `selected` (optional): `true`/`false`
|
||||||
|
|
||||||
|
#### `scrollbar[<X>,<Y>;<W>,<H>;<orientation>;<name>;<value>]`
|
||||||
|
* Show a scrollbar
|
||||||
|
* There are two ways to use it:
|
||||||
|
1. handle the changed event (only changed scrollbar is available)
|
||||||
|
2. read the value on pressing a button (all scrollbars are available)
|
||||||
|
* `x` and `y`: position of trackbar
|
||||||
|
* `w` and `h`: width and height
|
||||||
|
* `orientation`: `vertical`/`horizontal`
|
||||||
|
* Fieldname data is transferred to Lua
|
||||||
|
* Value this trackbar is set to (`0`-`1000`)
|
||||||
|
* See also `minetest.explode_scrollbar_event` (main menu: `engine.explode_scrollbar_event`)
|
||||||
|
|
||||||
|
#### `table[<X>,<Y>;<W>,<H>;<name>;<cell 1>,<cell 2>,...,<cell n>;<selected idx>]`
|
||||||
|
* Show scrollable table using options defined by the previous `tableoptions[]`
|
||||||
|
* Displays cells as defined by the previous `tablecolumns[]`
|
||||||
|
* `x` and `y`: position the itemlist relative to the top left of the menu
|
||||||
|
* `w` and `h` are the size of the itemlist
|
||||||
|
* `name`: fieldname sent to server on row select or doubleclick
|
||||||
|
* `cell 1`...`cell n`: cell contents given in row-major order
|
||||||
|
* `selected idx`: index of row to be selected within table (first row = `1`)
|
||||||
|
* See also `minetest.explode_table_event` (main menu: `engine.explode_table_event`)
|
||||||
|
|
||||||
|
#### `tableoptions[<opt 1>;<opt 2>;...]`
|
||||||
|
* Sets options for `table[]`
|
||||||
|
* `color=#RRGGBB`
|
||||||
|
* default text color (`ColorString`), defaults to `#FFFFFF`
|
||||||
|
* `background=#RRGGBB`
|
||||||
|
* table background color (`ColorString`), defaults to `#000000`
|
||||||
|
* `border=<true/false>`
|
||||||
|
* should the table be drawn with a border? (default: `true`)
|
||||||
|
* `highlight=#RRGGBB`
|
||||||
|
* highlight background color (`ColorString`), defaults to `#466432`
|
||||||
|
* `highlight_text=#RRGGBB`
|
||||||
|
* highlight text color (`ColorString`), defaults to `#FFFFFF`
|
||||||
|
* `opendepth=<value>`
|
||||||
|
* all subtrees up to `depth < value` are open (default value = `0`)
|
||||||
|
* only useful when there is a column of type "tree"
|
||||||
|
|
||||||
|
#### `tablecolumns[<type 1>,<opt 1a>,<opt 1b>,...;<type 2>,<opt 2a>,<opt 2b>;...]`
|
||||||
|
* Sets columns for `table[]`
|
||||||
|
* Types: `text`, `image`, `color`, `indent`, `tree`
|
||||||
|
* `text`: show cell contents as text
|
||||||
|
* `image`: cell contents are an image index, use column options to define images
|
||||||
|
* `color`: cell contents are a ColorString and define color of following cell
|
||||||
|
* `indent`: cell contents are a number and define indentation of following cell
|
||||||
|
* `tree`: same as indent, but user can open and close subtrees (treeview-like)
|
||||||
|
* Column options:
|
||||||
|
* `align=<value>`
|
||||||
|
* for `text` and `image`: content alignment within cells.
|
||||||
|
Available values: `left` (default), `center`, `right`, `inline`
|
||||||
|
* `width=<value>`
|
||||||
|
* for `text` and `image`: minimum width in em (default: `0`)
|
||||||
|
* for `indent` and `tree`: indent width in em (default: `1.5`)
|
||||||
|
* `padding=<value>`: padding left of the column, in em (default `0.5`).
|
||||||
|
Exception: defaults to 0 for indent columns
|
||||||
|
* `tooltip=<value>`: tooltip text (default: empty)
|
||||||
|
* `image` column options:
|
||||||
|
* `0=<value>` sets image for image index 0
|
||||||
|
* `1=<value>` sets image for image index 1
|
||||||
|
* `2=<value>` sets image for image index 2
|
||||||
|
* and so on; defined indices need not be contiguous empty or
|
||||||
|
non-numeric cells are treated as `0`.
|
||||||
|
* `color` column options:
|
||||||
|
* `span=<value>`: number of following columns to affect (default: infinite)
|
||||||
|
|
||||||
|
**Note**: do _not_ use a element name starting with `key_`; those names are reserved to
|
||||||
|
pass key press events to formspec!
|
||||||
|
|
||||||
|
Spatial Vectors
|
||||||
|
---------------
|
||||||
|
* `vector.new(a[, b, c])`: returns a vector:
|
||||||
|
* A copy of `a` if `a` is a vector.
|
||||||
|
* `{x = a, y = b, z = c}`, if all `a, b, c` are defined
|
||||||
|
* `vector.direction(p1, p2)`: returns a vector
|
||||||
|
* `vector.distance(p1, p2)`: returns a number
|
||||||
|
* `vector.length(v)`: returns a number
|
||||||
|
* `vector.normalize(v)`: returns a vector
|
||||||
|
* `vector.floor(v)`: returns a vector, each dimension rounded down
|
||||||
|
* `vector.round(v)`: returns a vector, each dimension rounded to nearest int
|
||||||
|
* `vector.apply(v, func)`: returns a vector
|
||||||
|
* `vector.equals(v1, v2)`: returns a boolean
|
||||||
|
|
||||||
|
For the following functions `x` can be either a vector or a number:
|
||||||
|
|
||||||
|
* `vector.add(v, x)`: returns a vector
|
||||||
|
* `vector.subtract(v, x)`: returns a vector
|
||||||
|
* `vector.multiply(v, x)`: returns a scaled vector or Schur product
|
||||||
|
* `vector.divide(v, x)`: returns a scaled vector or Schur quotient
|
||||||
|
|
||||||
|
Helper functions
|
||||||
|
----------------
|
||||||
|
* `dump2(obj, name="_", dumped={})`
|
||||||
|
* Return object serialized as a string, handles reference loops
|
||||||
|
* `dump(obj, dumped={})`
|
||||||
|
* Return object serialized as a string
|
||||||
|
* `math.hypot(x, y)`
|
||||||
|
* Get the hypotenuse of a triangle with legs x and y.
|
||||||
|
Useful for distance calculation.
|
||||||
|
* `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)`
|
||||||
|
* 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.is_yes(arg)`
|
||||||
|
* returns whether `arg` can be interpreted as yes
|
||||||
|
* `minetest.get_us_time()`
|
||||||
|
* returns time with microsecond precision. May not return wall time.
|
||||||
|
* `table.copy(table)`: returns a table
|
||||||
|
* returns a deep copy of `table`
|
||||||
|
|
||||||
|
Minetest namespace reference
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
### Utilities
|
||||||
|
|
||||||
|
* `minetest.get_current_modname()`: returns the currently loading mod's name, when we are loading a mod
|
||||||
|
* `minetest.get_version()`: returns a table containing components of the
|
||||||
|
engine version. Components:
|
||||||
|
* `project`: Name of the project, eg, "Minetest"
|
||||||
|
* `string`: Simple version, eg, "1.2.3-dev"
|
||||||
|
* `hash`: Full git version (only set if available), eg, "1.2.3-dev-01234567-dirty"
|
||||||
|
Use this for informational purposes only. The information in the returned
|
||||||
|
table does not represent the capabilities of the engine, nor is it
|
||||||
|
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 minetest.nodeupdate then ... end`.
|
||||||
|
|
||||||
|
### Logging
|
||||||
|
* `minetest.debug(...)`
|
||||||
|
* Equivalent to `minetest.log(table.concat({...}, "\t"))`
|
||||||
|
* `minetest.log([level,] text)`
|
||||||
|
* `level` is one of `"none"`, `"error"`, `"warning"`, `"action"`,
|
||||||
|
`"info"`, or `"verbose"`. Default is `"none"`.
|
||||||
|
|
||||||
|
### Global callback registration functions
|
||||||
|
Call these functions only at load time!
|
||||||
|
|
||||||
|
* `minetest.register_globalstep(func(dtime))`
|
||||||
|
* Called every client environment step, usually interval of 0.1s
|
||||||
|
* `minetest.register_on_shutdown(func())`
|
||||||
|
* Called before client shutdown
|
||||||
|
* **Warning**: If the client terminates abnormally (i.e. crashes), the registered
|
||||||
|
callbacks **will likely not be run**. Data should be saved at
|
||||||
|
semi-frequent intervals as well as on server shutdown.
|
||||||
|
* `minetest.register_on_connect(func())`
|
||||||
|
* Called at the end of client connection (when player is loaded onto map)
|
||||||
|
* `minetest.register_on_receiving_chat_message(func(name, message))`
|
||||||
|
* Called always when a client receive a message
|
||||||
|
* Return `true` to mark the message as handled, which means that it will not be shown to chat
|
||||||
|
* `minetest.register_on_sending_chat_message(func(name, message))`
|
||||||
|
* Called always when a client send a message from chat
|
||||||
|
* Return `true` to mark the message as handled, which means that it will not be sent to server
|
||||||
|
* `minetest.register_chatcommand(cmd, chatcommand definition)`
|
||||||
|
* Adds definition to minetest.registered_chatcommands
|
||||||
|
* `minetest.register_on_death(func())`
|
||||||
|
* Called when the local player dies
|
||||||
|
* `minetest.register_on_hp_modification(func(hp))`
|
||||||
|
* Called when server modified player's HP
|
||||||
|
* `minetest.register_on_damage_taken(func(hp))`
|
||||||
|
* Called when the local player take damages
|
||||||
|
* `minetest.register_on_formspec_input(func(formname, fields))`
|
||||||
|
* Called when a button is pressed in the local player's inventory form
|
||||||
|
* Newest functions are called first
|
||||||
|
* If function returns `true`, remaining functions are not called
|
||||||
|
* `minetest.register_on_dignode(func(pos, node))`
|
||||||
|
* Called when the local player digs a node
|
||||||
|
* Newest functions are called first
|
||||||
|
* If any function returns true, the node isn't dug
|
||||||
|
* `minetest.register_on_punchnode(func(pos, node))`
|
||||||
|
* Called when the local player punches a node
|
||||||
|
* Newest functions are called first
|
||||||
|
* If any function returns true, the punch is ignored
|
||||||
|
### Sounds
|
||||||
|
* `minetest.sound_play(spec, parameters)`: returns a handle
|
||||||
|
* `spec` is a `SimpleSoundSpec`
|
||||||
|
* `parameters` is a sound parameter table
|
||||||
|
* `minetest.sound_stop(handle)`
|
||||||
|
|
||||||
|
### Timing
|
||||||
|
* `minetest.after(time, func, ...)`
|
||||||
|
* Call the function `func` after `time` seconds, may be fractional
|
||||||
|
* Optional: Variable number of arguments that are passed to `func`
|
||||||
|
|
||||||
|
### Map
|
||||||
|
* `minetest.get_node(pos)`
|
||||||
|
* Returns the node at the given position as table in the format
|
||||||
|
`{name="node_name", param1=0, param2=0}`, returns `{name="ignore", param1=0, param2=0}`
|
||||||
|
for unloaded areas.
|
||||||
|
* `minetest.get_node_or_nil(pos)`
|
||||||
|
* Same as `get_node` but returns `nil` for unloaded areas.
|
||||||
|
* `minetest.get_meta(pos)`
|
||||||
|
* Get a `NodeMetaRef` at that position
|
||||||
|
|
||||||
|
### Player
|
||||||
|
* `minetest.get_wielded_item()`
|
||||||
|
* Returns the itemstack the local player is holding
|
||||||
|
* `minetest.localplayer`
|
||||||
|
* Reference to the LocalPlayer object. See `LocalPlayer` class reference for methods.
|
||||||
|
|
||||||
|
### Client Environment
|
||||||
|
* `minetest.get_player_names()`
|
||||||
|
* Returns list of player names on server
|
||||||
|
* `minetest.disconnect()`
|
||||||
|
* Disconnect from the server and exit to main menu.
|
||||||
|
* Returns `false` if the client is already disconnecting otherwise returns `true`.
|
||||||
|
* `minetest.get_protocol_version()`
|
||||||
|
* Returns the protocol version of the server.
|
||||||
|
* Might not be accurate at start up as the client might not be connected to the server yet, in that case it will return 0.
|
||||||
|
|
||||||
|
### Misc.
|
||||||
|
* `minetest.parse_json(string[, nullvalue])`: returns something
|
||||||
|
* Convert a string containing JSON data into the Lua equivalent
|
||||||
|
* `nullvalue`: returned in place of the JSON null; defaults to `nil`
|
||||||
|
* On success returns a table, a string, a number, a boolean or `nullvalue`
|
||||||
|
* On failure outputs an error message and returns `nil`
|
||||||
|
* Example: `parse_json("[10, {\"a\":false}]")`, returns `{10, {a = false}}`
|
||||||
|
* `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.
|
||||||
|
* **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.
|
||||||
|
This is due to the fact that JSON has two distinct array and object values.
|
||||||
|
* Example: `write_json({10, {a = false}})`, returns `"[10, {\"a\": false}]"`
|
||||||
|
* `minetest.serialize(table)`: returns a string
|
||||||
|
* Convert a table containing tables, strings, numbers, booleans and `nil`s
|
||||||
|
into string form readable by `minetest.deserialize`
|
||||||
|
* Example: `serialize({foo='bar'})`, returns `'return { ["foo"] = "bar" }'`
|
||||||
|
* `minetest.deserialize(string)`: returns a table
|
||||||
|
* Convert a string returned by `minetest.deserialize` into a table
|
||||||
|
* `string` is loaded in an empty sandbox environment.
|
||||||
|
* Will load functions, but they cannot access the global environment.
|
||||||
|
* Example: `deserialize('return { ["foo"] = "bar" }')`, returns `{foo='bar'}`
|
||||||
|
* Example: `deserialize('print("foo")')`, returns `nil` (function call fails)
|
||||||
|
* `error:[string "print("foo")"]:1: attempt to call global 'print' (a nil value)`
|
||||||
|
* `minetest.compress(data, method, ...)`: returns `compressed_data`
|
||||||
|
* Compress a string of data.
|
||||||
|
* `method` is a string identifying the compression method to be used.
|
||||||
|
* Supported compression methods:
|
||||||
|
* Deflate (zlib): `"deflate"`
|
||||||
|
* `...` indicates method-specific arguments. Currently defined arguments are:
|
||||||
|
* Deflate: `level` - Compression level, `0`-`9` or `nil`.
|
||||||
|
* `minetest.decompress(compressed_data, method, ...)`: returns data
|
||||||
|
* Decompress a string of data (using ZLib).
|
||||||
|
* See documentation on `minetest.compress()` for supported compression methods.
|
||||||
|
* currently supported.
|
||||||
|
* `...` indicates method-specific arguments. Currently, no methods use this.
|
||||||
|
* `minetest.encode_base64(string)`: returns string encoded in base64
|
||||||
|
* Encodes a string in base64.
|
||||||
|
* `minetest.decode_base64(string)`: returns string
|
||||||
|
* Decodes a string encoded in base64.
|
||||||
|
* `minetest.gettext(string) : returns string
|
||||||
|
* look up the translation of a string in the gettext message catalog
|
||||||
|
* `fgettext_ne(string, ...)`
|
||||||
|
* call minetest.gettext(string), replace "$1"..."$9" with the given
|
||||||
|
extra arguments and return the result
|
||||||
|
* `fgettext(string, ...)` : returns string
|
||||||
|
* same as fgettext_ne(), but calls minetest.formspec_escape before returning result
|
||||||
|
* `minetest.pointed_thing_to_face_pos(placer, pointed_thing)`: returns a position
|
||||||
|
* returns the exact position on the surface of a pointed node
|
||||||
|
|
||||||
|
### UI
|
||||||
|
* `minetest.ui.minimap`
|
||||||
|
* Reference to the minimap object. See `Minimap` class reference for methods.
|
||||||
|
* `minetest.show_formspec(formname, formspec)` : returns true on success
|
||||||
|
* Shows a formspec to the player
|
||||||
|
* `minetest.display_chat_message(message)` returns true on success
|
||||||
|
* Shows a chat message to the current player.
|
||||||
|
|
||||||
|
Class reference
|
||||||
|
---------------
|
||||||
|
|
||||||
|
### Minimap
|
||||||
|
An interface to manipulate minimap on client UI
|
||||||
|
|
||||||
|
* `show()`: shows the minimap (if not disabled by server)
|
||||||
|
* `hide()`: hides the minimap
|
||||||
|
* `set_pos(pos)`: sets the minimap position on screen
|
||||||
|
* `get_pos()`: returns the minimap current position
|
||||||
|
* `set_angle(deg)`: sets the minimap angle in degrees
|
||||||
|
* `get_angle()`: returns the current minimap angle in degrees
|
||||||
|
* `set_mode(mode)`: sets the minimap mode (0 to 6)
|
||||||
|
* `get_mode()`: returns the current minimap mode
|
||||||
|
* `set_shape(shape)`: Sets the minimap shape. (0 = square, 1 = round)
|
||||||
|
* `get_shape()`: Gets the minimap shape. (0 = square, 1 = round)
|
||||||
|
|
||||||
|
### LocalPlayer
|
||||||
|
An interface to retrieve information about the player. The player is
|
||||||
|
not accessible until the client is fully done loading and therefore
|
||||||
|
not at module init time.
|
||||||
|
|
||||||
|
To get the localplayer handle correctly, use `on_connect()` as follows:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local localplayer
|
||||||
|
minetest.register_on_connect(function()
|
||||||
|
localplayer = minetest.localplayer
|
||||||
|
end)
|
||||||
|
```
|
||||||
|
|
||||||
|
Methods:
|
||||||
|
|
||||||
|
* `get_pos()`
|
||||||
|
* returns current player current position
|
||||||
|
* `get_velocity()`
|
||||||
|
* returns player speed vector
|
||||||
|
* `get_hp()`
|
||||||
|
* returns player HP
|
||||||
|
* `get_name()`
|
||||||
|
* returns player name
|
||||||
|
* `got_teleported()`
|
||||||
|
* returns true if player was teleported
|
||||||
|
* `is_attached()`
|
||||||
|
* returns true if player is attached
|
||||||
|
* `is_touching_ground()`
|
||||||
|
* returns true if player touching ground
|
||||||
|
* `is_in_liquid()`
|
||||||
|
* returns true if player is in a liquid (This oscillates so that the player jumps a bit above the surface)
|
||||||
|
* `is_in_liquid_stable()`
|
||||||
|
* returns true if player is in a stable liquid (This is more stable and defines the maximum speed of the player)
|
||||||
|
* `get_liquid_viscosity()`
|
||||||
|
* returns liquid viscosity (Gets the viscosity of liquid to calculate friction)
|
||||||
|
* `is_climbing()`
|
||||||
|
* returns true if player is climbing
|
||||||
|
* `swimming_vertical()`
|
||||||
|
* returns true if player is swimming in vertical
|
||||||
|
* `get_physics_override()`
|
||||||
|
* returns:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
speed = float,
|
||||||
|
jump = float,
|
||||||
|
gravity = float,
|
||||||
|
sneak = boolean,
|
||||||
|
sneak_glitch = boolean
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* `get_override_pos()`
|
||||||
|
* returns override position
|
||||||
|
* `get_last_pos()`
|
||||||
|
* returns last player position before the current client step
|
||||||
|
* `get_last_velocity()`
|
||||||
|
* returns last player speed
|
||||||
|
* `get_breath()`
|
||||||
|
* returns the player's breath
|
||||||
|
* `get_look_dir()`
|
||||||
|
* returns look direction vector
|
||||||
|
* `get_look_horizontal()`
|
||||||
|
* returns look horizontal angle
|
||||||
|
* `get_look_vertical()`
|
||||||
|
* returns look vertical angle
|
||||||
|
* `get_eye_pos()`
|
||||||
|
* returns the player's eye position
|
||||||
|
* `get_eye_offset()`
|
||||||
|
* returns the player's eye shift vector
|
||||||
|
* `get_movement_acceleration()`
|
||||||
|
* returns acceleration of the player in different environments:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
fast = float,
|
||||||
|
air = float,
|
||||||
|
default = float,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* `get_movement_speed()`
|
||||||
|
* returns player's speed in different environments:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
walk = float,
|
||||||
|
jump = float,
|
||||||
|
crouch = float,
|
||||||
|
fast = float,
|
||||||
|
climb = float,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* `get_movement()`
|
||||||
|
* returns player's movement in different environments:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
liquid_fluidity = float,
|
||||||
|
liquid_sink = float,
|
||||||
|
liquid_fluidity_smooth = float,
|
||||||
|
gravity = float,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* `get_last_look_horizontal()`:
|
||||||
|
* returns last look horizontal angle
|
||||||
|
* `get_last_look_vertical()`:
|
||||||
|
* returns last look vertical angle
|
||||||
|
* `get_key_pressed()`:
|
||||||
|
* returns last key typed by the player
|
||||||
|
|
||||||
|
### Settings
|
||||||
|
An interface to read config files in the format of `minetest.conf`.
|
||||||
|
|
||||||
|
It can be created via `Settings(filename)`.
|
||||||
|
|
||||||
|
#### Methods
|
||||||
|
* `get(key)`: returns a value
|
||||||
|
* `get_bool(key)`: returns a boolean
|
||||||
|
* `set(key, value)`
|
||||||
|
* `remove(key)`: returns a boolean (`true` for success)
|
||||||
|
* `get_names()`: returns `{key1,...}`
|
||||||
|
* `write()`: returns a boolean (`true` for success)
|
||||||
|
* write changes to file
|
||||||
|
* `to_table()`: returns `{[key1]=value1,...}`
|
||||||
|
|
||||||
|
### NodeMetaRef
|
||||||
|
Node metadata: reference extra data and functionality stored in a node.
|
||||||
|
Can be obtained via `minetest.get_meta(pos)`.
|
||||||
|
|
||||||
|
#### Methods
|
||||||
|
* `get_string(name)`
|
||||||
|
* `get_int(name)`
|
||||||
|
* `get_float(name)`
|
||||||
|
* `to_table()`: returns `nil` or a table with keys:
|
||||||
|
* `fields`: key-value storage
|
||||||
|
* `inventory`: `{list1 = {}, ...}}`
|
||||||
|
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
### Chat command definition (`register_chatcommand`)
|
||||||
|
|
||||||
|
{
|
||||||
|
params = "<name> <privilege>", -- Short parameter description
|
||||||
|
description = "Remove privilege from player", -- Full description
|
||||||
|
func = function(param), -- Called when command is run.
|
||||||
|
-- Returns boolean success and text output.
|
||||||
|
}
|
||||||
|
|
||||||
|
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:
|
||||||
|
* `minetest.get_color_escape_sequence(color)`:
|
||||||
|
* `color` is a ColorString
|
||||||
|
* The escape sequence sets the text color to `color`
|
||||||
|
* `minetest.colorize(color, message)`:
|
||||||
|
* Equivalent to:
|
||||||
|
`minetest.get_color_escape_sequence(color) ..
|
||||||
|
message ..
|
||||||
|
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.
|
||||||
|
|
||||||
|
`ColorString`
|
||||||
|
-------------
|
||||||
|
`#RGB` defines a color in hexadecimal format.
|
||||||
|
|
||||||
|
`#RGBA` defines a color in hexadecimal format and alpha channel.
|
||||||
|
|
||||||
|
`#RRGGBB` defines a color in hexadecimal format.
|
||||||
|
|
||||||
|
`#RRGGBBAA` defines a color in hexadecimal format and alpha channel.
|
||||||
|
|
||||||
|
Named colors are also supported and are equivalent to
|
||||||
|
[CSS Color Module Level 4](http://dev.w3.org/csswg/css-color/#named-colors).
|
||||||
|
To specify the value of the alpha channel, append `#AA` to the end of the color name
|
||||||
|
(e.g. `colorname#08`). For named colors the hexadecimal string representing the alpha
|
||||||
|
value must (always) be two hexadecimal digits.
|
145
doc/lua_api.txt
|
@ -660,6 +660,10 @@ node definition:
|
||||||
The first five bits of `param2` tells which color
|
The first five bits of `param2` tells which color
|
||||||
is picked from the palette.
|
is picked from the palette.
|
||||||
The palette should have 32 pixels.
|
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 = {
|
collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -1229,9 +1233,8 @@ Another example: Make red wool from white wool and red dye:
|
||||||
* `0` is something that is directly accessible at the start of gameplay
|
* `0` is something that is directly accessible at the start of gameplay
|
||||||
* There is no upper limit
|
* There is no upper limit
|
||||||
* `dig_immediate`: (player can always pick up node without tool wear)
|
* `dig_immediate`: (player can always pick up node without tool wear)
|
||||||
* `2`: node is removed without tool wear after 0.5 seconds or so
|
* `2`: node is removed without tool wear after 0.5 seconds (rail, sign)
|
||||||
(rail, sign)
|
* `3`: node is removed without tool wear after 0.15 seconds (torch)
|
||||||
* `3`: node is removed without tool wear immediately (torch)
|
|
||||||
* `disable_jump`: Player (and possibly other things) cannot jump from node
|
* `disable_jump`: Player (and possibly other things) cannot jump from node
|
||||||
* `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)`
|
* `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)`
|
||||||
* `bouncy`: value is bounce speed in percent
|
* `bouncy`: value is bounce speed in percent
|
||||||
|
@ -1478,6 +1481,9 @@ Item metadata only contains a key-value store.
|
||||||
Some of the values in the key-value store are handled specially:
|
Some of the values in the key-value store are handled specially:
|
||||||
|
|
||||||
* `description`: Set the itemstack's description. Defaults to idef.description
|
* `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:
|
Example stuff:
|
||||||
|
|
||||||
|
@ -1524,6 +1530,16 @@ examples.
|
||||||
* `fixed_size`: `true`/`false` (optional)
|
* `fixed_size`: `true`/`false` (optional)
|
||||||
* deprecated: `invsize[<W>,<H>;]`
|
* deprecated: `invsize[<W>,<H>;]`
|
||||||
|
|
||||||
|
#### `position[<X>,<Y>]`
|
||||||
|
* Define the position of the formspec
|
||||||
|
* A value between 0.0 and 1.0 represents a position inside the screen
|
||||||
|
* The default value is the center of the screen (0.5, 0.5)
|
||||||
|
|
||||||
|
#### `anchor[<X>,<Y>]`
|
||||||
|
* Define the anchor of the formspec
|
||||||
|
* A value between 0.0 and 1.0 represents an anchor inside the formspec
|
||||||
|
* The default value is the center of the formspec (0.5, 0.5)
|
||||||
|
|
||||||
#### `container[<X>,<Y>]`
|
#### `container[<X>,<Y>]`
|
||||||
* Start of a container block, moves all physical elements in the container by (X, Y)
|
* Start of a container block, moves all physical elements in the container by (X, Y)
|
||||||
* Must have matching container_end
|
* Must have matching container_end
|
||||||
|
@ -1864,6 +1880,12 @@ The following functions provide escape sequences:
|
||||||
* `color` is a ColorString
|
* `color` is a ColorString
|
||||||
* The escape sequence sets the background of the whole text element to
|
* The escape sequence sets the background of the whole text element to
|
||||||
`color`. Only defined for item descriptions and tooltips.
|
`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
|
Spatial Vectors
|
||||||
---------------
|
---------------
|
||||||
|
@ -1916,11 +1938,13 @@ Helper functions
|
||||||
* `minetest.formspec_escape(string)`: returns a string
|
* `minetest.formspec_escape(string)`: returns a string
|
||||||
* escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs
|
* escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs
|
||||||
* `minetest.is_yes(arg)`
|
* `minetest.is_yes(arg)`
|
||||||
* returns whether `arg` can be interpreted as yes
|
* returns true if passed 'y', 'yes', 'true' or a number that isn't zero.
|
||||||
* `minetest.get_us_time()`
|
* `minetest.get_us_time()`
|
||||||
* returns time with microsecond precision. May not return wall time.
|
* returns time with microsecond precision. May not return wall time.
|
||||||
* `table.copy(table)`: returns a table
|
* `table.copy(table)`: returns a table
|
||||||
* returns a deep copy of `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
|
`minetest` namespace reference
|
||||||
------------------------------
|
------------------------------
|
||||||
|
@ -1935,13 +1959,31 @@ Helper functions
|
||||||
* `minetest.get_worldpath()`: returns e.g. `"/home/user/.minetest/world"`
|
* `minetest.get_worldpath()`: returns e.g. `"/home/user/.minetest/world"`
|
||||||
* Useful for storing custom data
|
* Useful for storing custom data
|
||||||
* `minetest.is_singleplayer()`
|
* `minetest.is_singleplayer()`
|
||||||
* `minetest.features`
|
* `minetest.features`: Table containing API feature flags
|
||||||
* Table containing API feature flags: `{foo=true, bar=true}`
|
{
|
||||||
|
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`
|
* `minetest.has_feature(arg)`: returns `boolean, missing_features`
|
||||||
* `arg`: string or table in format `{foo=true, bar=true}`
|
* `arg`: string or table in format `{foo=true, bar=true}`
|
||||||
* `missing_features`: `{foo=true, bar=true}`
|
* `missing_features`: `{foo=true, bar=true}`
|
||||||
* `minetest.get_player_information(player_name)`: returns a table containing
|
* `minetest.get_player_information(player_name)`:
|
||||||
information about player. Example return value:
|
* Returns a table containing information about a player
|
||||||
|
Example return value:
|
||||||
{
|
{
|
||||||
address = "127.0.0.1", -- IP address of client
|
address = "127.0.0.1", -- IP address of client
|
||||||
ip_version = 4, -- IPv4 / IPv6
|
ip_version = 4, -- IPv4 / IPv6
|
||||||
|
@ -2211,6 +2253,9 @@ and `minetest.auth_reload` call the authetification handler.
|
||||||
* Returns `true` if successful, `false` on failure (e.g. protected location)
|
* Returns `true` if successful, `false` on failure (e.g. protected location)
|
||||||
* `minetest.punch_node(pos)`
|
* `minetest.punch_node(pos)`
|
||||||
* Punch node with the same effects that a player would cause
|
* Punch node with the same effects that a player would cause
|
||||||
|
* `minetest.spawn_falling_node(pos)`
|
||||||
|
* Change node into falling node
|
||||||
|
* Returns `true` if successful, `false` on failure
|
||||||
|
|
||||||
* `minetest.find_nodes_with_meta(pos1, pos2)`
|
* `minetest.find_nodes_with_meta(pos1, pos2)`
|
||||||
* Get a table of positions of nodes that have metadata within a region {pos1, pos2}
|
* Get a table of positions of nodes that have metadata within a region {pos1, pos2}
|
||||||
|
@ -2355,6 +2400,22 @@ and `minetest.auth_reload` call the authetification handler.
|
||||||
* increase level of leveled node by level, default `level` equals `1`
|
* increase level of leveled node by level, default `level` equals `1`
|
||||||
* if `totallevel > maxlevel`, returns rest (`total-max`)
|
* if `totallevel > maxlevel`, returns rest (`total-max`)
|
||||||
* can be negative for decreasing
|
* can be negative for decreasing
|
||||||
|
* `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
|
||||||
* `core.check_single_for_falling(pos)`
|
* `core.check_single_for_falling(pos)`
|
||||||
* causes an unsupported `group:falling_node` node to fall and causes an
|
* causes an unsupported `group:falling_node` node to fall and causes an
|
||||||
unattached `group:attached_node` node to fall.
|
unattached `group:attached_node` node to fall.
|
||||||
|
@ -2536,8 +2597,12 @@ These functions return the leftover itemstack.
|
||||||
* Optional: Variable number of arguments that are passed to `func`
|
* Optional: Variable number of arguments that are passed to `func`
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
* `minetest.request_shutdown([message],[reconnect])`: request for server shutdown. Will display `message` to clients,
|
* `minetest.request_shutdown([message],[reconnect],[delay])`: request for server shutdown. Will display `message` to clients,
|
||||||
and `reconnect` == true displays a reconnect button.
|
`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_status()`: returns server status string
|
||||||
* `minetest.get_server_uptime()`: returns the server uptime in seconds
|
* `minetest.get_server_uptime()`: returns the server uptime in seconds
|
||||||
|
|
||||||
|
@ -2672,7 +2737,7 @@ These functions return the leftover itemstack.
|
||||||
* `minetest.write_json(data[, styled])`: returns a string or `nil` and an error message
|
* `minetest.write_json(data[, styled])`: returns a string or `nil` and an error message
|
||||||
* Convert a Lua table into a JSON string
|
* Convert a Lua table into a JSON string
|
||||||
* styled: Outputs in a human-readable format if this is set, defaults to false
|
* 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.
|
* **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.
|
1. You can only use strings and positive integers of at least one as keys.
|
||||||
2. You can not mix string and integer keys.
|
2. You can not mix string and integer keys.
|
||||||
|
@ -2818,6 +2883,8 @@ See `StorageRef`, `NodeMetaRef` and `ItemStackMetaRef`.
|
||||||
* Any non-table value will clear the metadata
|
* Any non-table value will clear the metadata
|
||||||
* See "Node Metadata" for an example
|
* See "Node Metadata" for an example
|
||||||
* returns `true` on success
|
* returns `true` on success
|
||||||
|
* `equals(other)`
|
||||||
|
* returns `true` if this metadata has the same key-value pairs as `other`
|
||||||
|
|
||||||
### `NodeMetaRef`
|
### `NodeMetaRef`
|
||||||
Node metadata: reference extra data and functionality stored in a node.
|
Node metadata: reference extra data and functionality stored in a node.
|
||||||
|
@ -2975,7 +3042,11 @@ This is basically a reference to a C++ `ServerActiveObject`
|
||||||
* `jump`: multiplier to default jump value (default: `1`)
|
* `jump`: multiplier to default jump value (default: `1`)
|
||||||
* `gravity`: multiplier to default gravity value (default: `1`)
|
* `gravity`: multiplier to default gravity value (default: `1`)
|
||||||
* `sneak`: whether player can sneak (default: `true`)
|
* `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
|
* `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
|
* `hud_add(hud definition)`: add a HUD element described by HUD def, returns ID
|
||||||
number on success
|
number on success
|
||||||
|
@ -3275,9 +3346,6 @@ format as produced by get_data() et al. and is *not required* to be a table retr
|
||||||
Once the internal VoxelManip state has been modified to your liking, the changes can be committed back
|
Once the internal VoxelManip state has been modified to your liking, the changes can be committed back
|
||||||
to the map by calling `VoxelManip:write_to_map()`.
|
to the map by calling `VoxelManip:write_to_map()`.
|
||||||
|
|
||||||
Finally, a call to `VoxelManip:update_map()` is required to re-calculate lighting and set the blocks
|
|
||||||
as being modified so that connected clients are sent the updated parts of map.
|
|
||||||
|
|
||||||
|
|
||||||
##### Flat array format
|
##### Flat array format
|
||||||
Let
|
Let
|
||||||
|
@ -3342,8 +3410,6 @@ but with a few differences:
|
||||||
will also update the Mapgen VoxelManip object's internal state active on the current thread.
|
will also update the Mapgen VoxelManip object's internal state active on the current thread.
|
||||||
* After modifying the Mapgen VoxelManip object's internal buffer, it may be necessary to update lighting
|
* After modifying the Mapgen VoxelManip object's internal buffer, it may be necessary to update lighting
|
||||||
information using either: `VoxelManip:calc_lighting()` or `VoxelManip:set_lighting()`.
|
information using either: `VoxelManip:calc_lighting()` or `VoxelManip:set_lighting()`.
|
||||||
* `VoxelManip:update_map()` does not need to be called after `write_to_map()`. The map update is performed
|
|
||||||
automatically after all on_generated callbacks have been run for that generated block.
|
|
||||||
|
|
||||||
##### Other API functions operating on a VoxelManip
|
##### Other API functions operating on a VoxelManip
|
||||||
If any VoxelManip contents were set to a liquid node, `VoxelManip:update_liquids()` must be called
|
If any VoxelManip contents were set to a liquid node, `VoxelManip:update_liquids()` must be called
|
||||||
|
@ -3377,8 +3443,14 @@ will place the schematic inside of the VoxelManip.
|
||||||
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object containing
|
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object containing
|
||||||
the region formed by `p1` and `p2`.
|
the region formed by `p1` and `p2`.
|
||||||
* returns actual emerged `pmin`, actual emerged `pmax`
|
* 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
|
* **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
|
* `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in
|
||||||
the `VoxelManip` at that position
|
the `VoxelManip` at that position
|
||||||
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position
|
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position
|
||||||
|
@ -3386,9 +3458,7 @@ will place the schematic inside of the VoxelManip.
|
||||||
* returns raw node data in the form of an array of node content IDs
|
* returns raw node data in the form of an array of node content IDs
|
||||||
* if the param `buffer` is present, this table will be used to store the result instead
|
* if the param `buffer` is present, this table will be used to store the result instead
|
||||||
* `set_data(data)`: Sets the data contents of the `VoxelManip` object
|
* `set_data(data)`: Sets the data contents of the `VoxelManip` object
|
||||||
* `update_map()`: Update map after writing chunk back to map.
|
* `update_map()`: Does nothing, kept for compatibility.
|
||||||
* To be used only by `VoxelManip` objects created by the mod itself;
|
|
||||||
not a `VoxelManip` that was retrieved from `minetest.get_mapgen_object`
|
|
||||||
* `set_lighting(light, [p1, p2])`: Set the lighting within the `VoxelManip` to a uniform value
|
* `set_lighting(light, [p1, p2])`: Set the lighting within the `VoxelManip` to a uniform value
|
||||||
* `light` is a table, `{day=<0...15>, night=<0...15>}`
|
* `light` is a table, `{day=<0...15>, night=<0...15>}`
|
||||||
* To be used only by a `VoxelManip` object from `minetest.get_mapgen_object`
|
* To be used only by a `VoxelManip` object from `minetest.get_mapgen_object`
|
||||||
|
@ -3705,6 +3775,19 @@ Definition tables
|
||||||
{hard = 1, metal = 1, spikes = 1}
|
{hard = 1, metal = 1, spikes = 1}
|
||||||
inventory_image = "default_tool_steelaxe.png",
|
inventory_image = "default_tool_steelaxe.png",
|
||||||
wield_image = "",
|
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},
|
wield_scale = {x = 1, y = 1, z = 1},
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
range = 4.0,
|
range = 4.0,
|
||||||
|
@ -3823,13 +3906,20 @@ Definition tables
|
||||||
|
|
||||||
drawtype = "normal", -- See "Node drawtypes"
|
drawtype = "normal", -- See "Node drawtypes"
|
||||||
visual_scale = 1.0, --[[
|
visual_scale = 1.0, --[[
|
||||||
^ Supported for drawtypes "plantlike", "signlike", "torchlike", "mesh".
|
^ Supported for drawtypes "plantlike", "signlike", "torchlike",
|
||||||
^ For plantlike, the image will start at the bottom of the node; for the
|
^ "firelike", "mesh".
|
||||||
^ other drawtypes, the image will be centered on the node.
|
^ 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. ]]
|
^ Note that positioning for "torchlike" may still change. ]]
|
||||||
tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[
|
tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[
|
||||||
^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images)
|
^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images)
|
||||||
^ List can be shortened to needed length ]]
|
^ 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_tiles = {tile definition 1, Tile definition 2}, --[[
|
||||||
^ Special textures of node; used rarely (old field name: special_materials)
|
^ Special textures of node; used rarely (old field name: special_materials)
|
||||||
^ List can be shortened to needed length ]]
|
^ List can be shortened to needed length ]]
|
||||||
|
@ -3918,6 +4008,13 @@ Definition tables
|
||||||
^ Node destructor; called after removing node
|
^ Node destructor; called after removing node
|
||||||
^ Not called for bulk node placement (i.e. schematics and VoxelManip)
|
^ Not called for bulk node placement (i.e. schematics and VoxelManip)
|
||||||
^ default: nil ]]
|
^ 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 ]]
|
||||||
|
|
||||||
after_place_node = func(pos, placer, itemstack, pointed_thing) --[[
|
after_place_node = func(pos, placer, itemstack, pointed_thing) --[[
|
||||||
^ Called after constructing node when node was placed using
|
^ 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.png`: front texture of the 2D upright sprite player
|
||||||
* `player_back.png`: back 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.png`: texture of the moon. Default texture is generated by Minetest
|
||||||
* `moon_tonemap.png`: tonemap to be used when `moon.png` was found
|
* `moon_tonemap.png`: tonemap to be used when `moon.png` was found
|
||||||
* `sun.png`: texture of the sun. Default texture is generated by Minetest
|
* `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
|
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.dev-20120322 ... 0.4.dev-20120606 (22...23)
|
||||||
- 0.4.0 (23)
|
- 0.4.0 (23)
|
||||||
- 24 was never released as stable and existed for ~2 days
|
- 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
|
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
|
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
|
- 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
|
on day and night. Only blocks that have this bit set are updated when
|
||||||
day transforms to night.
|
day transforms to night.
|
||||||
- 0x04: lighting_expired: If true, lighting is invalid and should be
|
- 0x04: lighting_expired: Not used in version 27 and above. If true,
|
||||||
updated. If you can't calculate lighting in your generator properly,
|
lighting is invalid and should be updated. If you can't calculate
|
||||||
you could try setting this 1 to everything and setting the uppermost
|
lighting in your generator properly, you could try setting this 1 to
|
||||||
block in every sector as is_underground=0. I am quite sure it doesn't
|
everything and setting the uppermost block in every sector as
|
||||||
work properly, though.
|
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
|
- 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
|
is mostly filled with CONTENT_IGNORE and is likely to contain eg. parts
|
||||||
of trees of neighboring blocks.
|
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
|
u8 content_width
|
||||||
- Number of bytes in the content (param0) fields of nodes
|
- Number of bytes in the content (param0) fields of nodes
|
||||||
if map format version <= 23:
|
if map format version <= 23:
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Arimo - Apache License, version 2.0
|
||||||
|
Arimo-Regular.ttf: Digitized data copyright (c) 2010-2012 Google Corporation.
|
|
@ -0,0 +1,2 @@
|
||||||
|
Cousine - Apache License, version 2.0
|
||||||
|
Cousine-Regular.ttf: Digitized data copyright (c) 2010-2012 Google Corporation.
|
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright (C) 2008 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 201 KiB |
Before Width: | Height: | Size: 241 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 166 KiB |
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |