Compare commits
18 Commits
stable-5.2
...
stable-5.2
Author | SHA1 | Date |
---|---|---|
Герхард PICCORO Lenz McKAY | 700c0933fb | |
sfan5 | df93c4be44 | |
Герхард PICCORO Lenz McKAY | 546d3ca2b9 | |
mckaygerhard | 47a24b10f5 | |
mckaygerhard | ee6581fc61 | |
mckaygerhard | 524d372e77 | |
Wuzzy | 40a73c64ed | |
DS | 902b203d23 | |
sfan5 | 00a4053ec9 | |
rubenwardy | 9ffa6c1c5e | |
Danila Shutov | 2dfaa82f3a | |
Wren Turkal | 02565c6c6b | |
Wuzzy | d3b7cb2246 | |
Paramat | 40dfe371a7 | |
rubenwardy | f8cbcd884c | |
SmallJoker | aabbcef6ca | |
sfan5 | 876500b1f4 | |
mckaygerhard | 6fb6a249f2 |
|
@ -39,11 +39,24 @@ local function create_world_formspec(dialogdata)
|
|||
local gamepath = game_by_gameidx.path
|
||||
local gameconfig = Settings(gamepath.."/game.conf")
|
||||
|
||||
local allowed_mapgens = (gameconfig:get("allowed_mapgens") or ""):split()
|
||||
for key, value in pairs(allowed_mapgens) do
|
||||
allowed_mapgens[key] = value:trim()
|
||||
end
|
||||
|
||||
local disallowed_mapgens = (gameconfig:get("disallowed_mapgens") or ""):split()
|
||||
for key, value in pairs(disallowed_mapgens) do
|
||||
disallowed_mapgens[key] = value:trim()
|
||||
end
|
||||
|
||||
if #allowed_mapgens > 0 then
|
||||
for i = #mapgens, 1, -1 do
|
||||
if table.indexof(allowed_mapgens, mapgens[i]) == -1 then
|
||||
table.remove(mapgens, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if disallowed_mapgens then
|
||||
for i = #mapgens, 1, -1 do
|
||||
if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then
|
||||
|
|
|
@ -42,10 +42,10 @@
|
|||
# Flags are always separated by comma without spaces.
|
||||
# - default possible_flags
|
||||
# * noise_params_2d:
|
||||
# Format is <offset>, <scale>, (<spreadX>, <spreadY>, <spreadZ>), <seed>, <octaves>, <persistance>, <lacunarity>[, <default flags>]
|
||||
# Format is <offset>, <scale>, (<spreadX>, <spreadY>, <spreadZ>), <seed>, <octaves>, <persistence>, <lacunarity>[, <default flags>]
|
||||
# - default
|
||||
# * noise_params_3d:
|
||||
# Format is <offset>, <scale>, (<spreadX>, <spreadY>, <spreadZ>), <seed>, <octaves>, <persistance>, <lacunarity>[, <default flags>]
|
||||
# Format is <offset>, <scale>, (<spreadX>, <spreadY>, <spreadZ>), <seed>, <octaves>, <persistence>, <lacunarity>[, <default flags>]
|
||||
# - default
|
||||
# * v3f:
|
||||
# Format is (<X>, <Y>, <Z>)
|
||||
|
@ -561,9 +561,6 @@ enable_parallax_occlusion (Parallax occlusion) bool false
|
|||
# 1 = relief mapping (slower, more accurate).
|
||||
parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1
|
||||
|
||||
# Strength of parallax.
|
||||
3d_paralax_strength (Parallax occlusion strength) float 0.025
|
||||
|
||||
# Number of parallax occlusion iterations.
|
||||
parallax_occlusion_iterations (Parallax occlusion iterations) int 4
|
||||
|
||||
|
@ -713,6 +710,9 @@ fall_bobbing_amount (Fall bobbing factor) float 0.03
|
|||
# Note that the interlaced mode requires shaders to be enabled.
|
||||
3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,crossview,pageflip
|
||||
|
||||
# Strength of 3D mode parallax.
|
||||
3d_paralax_strength (3D mode parallax strength) float 0.025
|
||||
|
||||
# In-game chat console height, between 0.1 (10%) and 1.0 (100%).
|
||||
console_height (Console height) float 0.6 0.1 1.0
|
||||
|
||||
|
@ -1149,7 +1149,7 @@ active_object_send_range_blocks (Active object send range) int 4
|
|||
# active block stuff, stated in mapblocks (16 nodes).
|
||||
# In active blocks objects are loaded and ABMs run.
|
||||
# This is also the minimum range in which active objects (mobs) are maintained.
|
||||
# This should be configured together with active_object_range.
|
||||
# This should be configured together with active_object_send_range_blocks.
|
||||
active_block_range (Active block range) int 3
|
||||
|
||||
# From how far blocks are sent to clients, stated in mapblocks (16 nodes).
|
||||
|
@ -1372,7 +1372,7 @@ name (Player name) string
|
|||
|
||||
# Set the language. Leave empty to use the system language.
|
||||
# A restart is required after changing this.
|
||||
language (Language) enum ,ar,ca,cs,da,de,dv,el,eo,es,et,eu,fil,fr,hu,id,it,ja,ja_KS,jbo,kk,kn,lo,lt,ms,my,nb,nl,nn,pl,pt,pt_BR,ro,ru,sl,sr_Cyrl,sv,sw,th,tr,uk,vi
|
||||
language (Language) enum ,ar,ca,cs,da,de,dv,el,en,eo,es,et,eu,fil,fr,hu,id,it,ja,ja_KS,jbo,kk,kn,lo,lt,ms,my,nb,nl,nn,pl,pt,pt_BR,ro,ru,sl,sr_Cyrl,sv,sw,th,tr,uk,vi
|
||||
|
||||
# Level of logging to be written to debug.txt:
|
||||
# - <nothing> (no logging)
|
||||
|
|
|
@ -25,6 +25,38 @@ const float BS = 10.0;
|
|||
const float fogStart = FOG_START;
|
||||
const float fogShadingParameter = 1 / ( 1 - fogStart);
|
||||
|
||||
#ifdef ENABLE_TONE_MAPPING
|
||||
|
||||
/* Hable's UC2 Tone mapping parameters
|
||||
A = 0.22;
|
||||
B = 0.30;
|
||||
C = 0.10;
|
||||
D = 0.20;
|
||||
E = 0.01;
|
||||
F = 0.30;
|
||||
W = 11.2;
|
||||
equation used: ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F
|
||||
*/
|
||||
|
||||
vec3 uncharted2Tonemap(vec3 x)
|
||||
{
|
||||
return ((x * (0.22 * x + 0.03) + 0.002) / (x * (0.22 * x + 0.3) + 0.06)) - 0.03333;
|
||||
}
|
||||
|
||||
vec4 applyToneMapping(vec4 color)
|
||||
{
|
||||
color = vec4(pow(color.rgb, vec3(2.2)), color.a);
|
||||
const float gamma = 1.6;
|
||||
const float exposureBias = 5.5;
|
||||
color.rgb = uncharted2Tonemap(exposureBias * color.rgb);
|
||||
// Precalculated white_scale from
|
||||
//vec3 whiteScale = 1.0 / uncharted2Tonemap(vec3(W));
|
||||
vec3 whiteScale = vec3(1.036015346);
|
||||
color.rgb *= whiteScale;
|
||||
return vec4(pow(color.rgb, vec3(1.0 / gamma)), color.a);
|
||||
}
|
||||
#endif
|
||||
|
||||
void get_texture_flags()
|
||||
{
|
||||
vec4 flags = texture2D(textureFlags, vec2(0.0, 0.0));
|
||||
|
@ -114,6 +146,11 @@ void main(void)
|
|||
vec4 col = vec4(color.rgb, base.a);
|
||||
|
||||
col.rgb *= emissiveColor.rgb * vIDiff;
|
||||
|
||||
#ifdef ENABLE_TONE_MAPPING
|
||||
col = applyToneMapping(col);
|
||||
#endif
|
||||
|
||||
// Due to a bug in some (older ?) graphics stacks (possibly in the glsl compiler ?),
|
||||
// the fog will only be rendered correctly if the last operation before the
|
||||
// clamp() is an addition. Else, the clamp() seems to be ignored.
|
||||
|
|
|
@ -6,51 +6,11 @@
|
|||
#
|
||||
# This module is similar to FindLua51.cmake except that it finds LuaJit instead.
|
||||
|
||||
FIND_PATH(LUA_INCLUDE_DIR luajit.h
|
||||
HINTS
|
||||
$ENV{LUA_DIR}
|
||||
PATH_SUFFIXES include/luajit-2.1 include/luajit-2.0 include/luajit-5_1-2.1 include/luajit-5_1-2.0 include luajit
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
# Test if running on vcpkg toolchain
|
||||
if(DEFINED VCPKG_TARGET_TRIPLET AND DEFINED VCPKG_APPLOCAL_DEPS)
|
||||
# On vcpkg luajit is 'lua51' and normal lua is 'lua'
|
||||
FIND_LIBRARY(LUA_LIBRARY
|
||||
NAMES lua51
|
||||
HINTS
|
||||
$ENV{LUA_DIR}
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
else()
|
||||
FIND_LIBRARY(LUA_LIBRARY
|
||||
NAMES luajit-5.1
|
||||
HINTS
|
||||
$ENV{LUA_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h")
|
||||
FILE(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT .+\"")
|
||||
|
||||
STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
|
||||
UNSET(lua_version_str)
|
||||
ENDIF()
|
||||
find_package (PkgConfig REQUIRED)
|
||||
pkg_check_modules (LuaJIT QUIET REQUIRED luajit)
|
||||
set (LUA_LIBRARY ${LuaJIT_LIBRARIES})
|
||||
set (LUA_INCLUDE_DIR ${LuaJIT_INCLUDE_DIRS})
|
||||
set (LUA_VERSION_STRING ${LuaJIT_VERSION})
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
|
||||
|
|
|
@ -64,9 +64,17 @@ The game directory can contain the following files:
|
|||
* `game.conf`, with the following keys:
|
||||
* `name`: Required, human readable name e.g. `name = Minetest`
|
||||
* `description`: Short description to be shown in the content tab
|
||||
* `allowed_mapgens = <comma-separated mapgens>`
|
||||
e.g. `allowed_mapgens = v5,v6,flat`
|
||||
Mapgens not in this list are removed from the list of mapgens for
|
||||
the game.
|
||||
If not specified, all mapgens are allowed.
|
||||
* `disallowed_mapgens = <comma-separated mapgens>`
|
||||
e.g. `disallowed_mapgens = v5,v6,flat`
|
||||
These mapgens are removed from the list of mapgens for the game.
|
||||
When both `allowed_mapgens` and `disallowed_mapgens` are
|
||||
specified, `allowed_mapgens` is applied before
|
||||
`disallowed_mapgens`.
|
||||
* `minetest.conf`:
|
||||
Used to set default settings when running this game.
|
||||
* `settingtypes.txt`:
|
||||
|
@ -1010,22 +1018,24 @@ The function of `param2` is determined by `paramtype2` in node definition.
|
|||
* Values range 0 - 179. The value stored in `param2` is multiplied by two to
|
||||
get the actual rotation in degrees of the node.
|
||||
* `paramtype2 = "meshoptions"`
|
||||
* Only valid for "plantlike" drawtype. The value of `param2` becomes a
|
||||
bitfield which can be used to change how the client draws plantlike nodes.
|
||||
* Bits 0, 1 and 2 form a mesh selector.
|
||||
Currently the following meshes are choosable:
|
||||
* Only valid for "plantlike" drawtype. `param2` encodes the shape and
|
||||
optional modifiers of the "plant". `param2` is a bitfield.
|
||||
* Bits 0 to 2 select the shape.
|
||||
Use only one of the values below:
|
||||
* 0 = a "x" shaped plant (ordinary plant)
|
||||
* 1 = a "+" shaped plant (just rotated 45 degrees)
|
||||
* 2 = a "*" shaped plant with 3 faces instead of 2
|
||||
* 3 = a "#" shaped plant with 4 faces instead of 2
|
||||
* 4 = a "#" shaped plant with 4 faces that lean outwards
|
||||
* 5-7 are unused and reserved for future meshes.
|
||||
* Bits 3 through 7 are optional flags that can be combined and give these
|
||||
effects:
|
||||
* bit 3 (0x08) - Makes the plant slightly vary placement horizontally
|
||||
* bit 4 (0x10) - Makes the plant mesh 1.4x larger
|
||||
* bit 5 (0x20) - Moves each face randomly a small bit down (1/8 max)
|
||||
* bits 6-7 are reserved for future use.
|
||||
* Bits 3 to 7 are used to enable any number of optional modifiers.
|
||||
Just add the corresponding value(s) below to `param2`:
|
||||
* 8 - Makes the plant slightly vary placement horizontally
|
||||
* 16 - Makes the plant mesh 1.4x larger
|
||||
* 32 - Moves each face randomly a small bit down (1/8 max)
|
||||
* values 64 and 128 (bits 6-7) are reserved for future use.
|
||||
* Example: `param2 = 0` selects a normal "x" shaped plant
|
||||
* Example: `param2 = 17` selects a "+" shaped plant, 1.4x larger (1+16)
|
||||
* `paramtype2 = "color"`
|
||||
* `param2` tells which color is picked from the palette.
|
||||
The palette should have 256 pixels.
|
||||
|
@ -2332,8 +2342,8 @@ Elements
|
|||
* `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
|
||||
* `transparent` (optional): if true, tabs are semi-transparent
|
||||
* `draw_border` (optional): if true, draw a thin line at tab base
|
||||
|
||||
### `tabheader[<X>,<Y>;<H>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]`
|
||||
|
||||
|
@ -4073,14 +4083,13 @@ Utilities
|
|||
connection_uptime = 200, -- seconds since client connected
|
||||
protocol_version = 32, -- protocol version used by client
|
||||
formspec_version = 2, -- supported formspec version
|
||||
-- following information is available on debug build only!!!
|
||||
-- DO NOT USE IN MODS
|
||||
--ser_vers = 26, -- serialization version used by client
|
||||
--major = 0, -- major version number
|
||||
--minor = 4, -- minor version number
|
||||
--patch = 10, -- patch version number
|
||||
--vers_string = "0.4.9-git", -- full version string
|
||||
--state = "Active" -- current client state
|
||||
-- following information is available on minenux only build. dont assume in mods
|
||||
serialization_version = 26, -- serialization version used by client
|
||||
major = 5, -- major version number
|
||||
minor = 2, -- minor version number
|
||||
patch = 1, -- patch version number
|
||||
vers_string = "5.2.1", -- full version string
|
||||
state = "Active" -- current client state
|
||||
}
|
||||
|
||||
* `minetest.mkdir(path)`: returns success.
|
||||
|
@ -5403,8 +5412,8 @@ Misc.
|
|||
insecure functions if the calling mod has been listed as trusted in the
|
||||
`secure.trusted_mods` setting or security is disabled, otherwise returns
|
||||
`nil`.
|
||||
* Only works at init time and must be called from the mod's main scope (not
|
||||
from a function).
|
||||
* Only works at init time and must be called from the mod's main scope
|
||||
(ie: the init.lua of the mod, not from another Lua file or within a function).
|
||||
* **DO NOT ALLOW ANY OTHER MODS TO ACCESS THE RETURNED ENVIRONMENT, STORE
|
||||
IT IN A LOCAL VARIABLE!**
|
||||
|
||||
|
@ -5992,7 +6001,7 @@ object you are working with still exists.
|
|||
* `sky_color`: A table containing the following values, alpha is ignored:
|
||||
* `day_sky`: ColorSpec, for the top half of the `"regular"`
|
||||
sky during the day. (default: `#8cbafa`)
|
||||
* `day_horizon`: ColorSpec, for the bottom half of the
|
||||
* `day_horizon`: ColorSpec, for the bottom half of the
|
||||
`"regular"` sky during the day. (default: `#9bc1f0`)
|
||||
* `dawn_sky`: ColorSpec, for the top half of the `"regular"`
|
||||
sky during dawn/sunset. (default: `#b4bafa`)
|
||||
|
@ -6010,7 +6019,7 @@ object you are working with still exists.
|
|||
sky during the night. (default: `#4090ff`)
|
||||
The resulting sky color will be a dark version of the ColorSpec.
|
||||
Warning: The darkening of the ColorSpec is subject to change.
|
||||
* `indoors`: ColorSpec, for when you're either indoors or
|
||||
* `indoors`: ColorSpec, for when you're either indoors or
|
||||
underground. Only applies to the `"regular"` sky.
|
||||
(default: `#646464`)
|
||||
* `fog_sun_tint`: ColorSpec, changes the fog tinting for the sun
|
||||
|
@ -6054,7 +6063,7 @@ object you are working with still exists.
|
|||
* `parameters` is a table with the following optional fields:
|
||||
* `visible`: Boolean for whether the stars are visible.
|
||||
(default: `true`)
|
||||
* `count`: Integer number to set the number of stars in
|
||||
* `count`: Integer number to set the number of stars in
|
||||
the skybox. Only applies to `"skybox"` and `"regular"` sky types.
|
||||
(default: `1000`)
|
||||
* `star_color`: ColorSpec, sets the colors of the stars,
|
||||
|
@ -7020,6 +7029,7 @@ Used by `minetest.register_node`.
|
|||
-- node is deleted from the world or the drops are added. This is
|
||||
-- generally the result of either the node being dug or an attached node
|
||||
-- becoming detached.
|
||||
-- oldmeta is the NodeMetaRef of the oldnode before deletion.
|
||||
-- drops is a table of ItemStacks, so any metadata to be preserved can
|
||||
-- be added directly to one or more of the dropped items. See
|
||||
-- "ItemStackMetaRef".
|
||||
|
@ -7044,10 +7054,14 @@ Used by `minetest.register_node`.
|
|||
|
||||
on_punch = function(pos, node, puncher, pointed_thing),
|
||||
-- default: minetest.node_punch
|
||||
-- Called when puncher (an ObjectRef) punches the node at pos.
|
||||
-- By default calls minetest.register_on_punchnode callbacks.
|
||||
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing),
|
||||
-- default: nil
|
||||
-- Called when clicker (an ObjectRef) "rightclicks"
|
||||
-- ("rightclick" here stands for the placement key) while pointing at
|
||||
-- the node at pos with 'node' being the node table.
|
||||
-- itemstack will hold clicker's wielded item.
|
||||
-- Shall return the leftover itemstack.
|
||||
-- Note: pointed_thing can be nil, if a mod calls this function.
|
||||
|
|
|
@ -70,6 +70,14 @@ if(ENABLE_GETTEXT)
|
|||
endif()
|
||||
set(USE_GETTEXT TRUE)
|
||||
message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}")
|
||||
# On some platforms, such as Linux with GNU libc, the gettext
|
||||
# functions are present in the C standard library and libintl
|
||||
# is not required. For other libc (uClibc-ng or musl or older debians)
|
||||
# libintl may be required.
|
||||
find_package(Intl)
|
||||
if(NOT Intl_LIBRARIES STREQUAL "")
|
||||
message(STATUS "GetText Intl : ${Intl_LIBRARIES}")
|
||||
endif()
|
||||
endif(GETTEXT_FOUND)
|
||||
else()
|
||||
mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
|
||||
|
@ -559,6 +567,7 @@ if(BUILD_CLIENT)
|
|||
if(USE_GETTEXT)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
${Intl_LIBRARIES}
|
||||
${GETTEXT_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
|
@ -613,7 +622,7 @@ if(BUILD_SERVER)
|
|||
set_target_properties(${PROJECT_NAME}server PROPERTIES
|
||||
COMPILE_DEFINITIONS "SERVER")
|
||||
if (USE_GETTEXT)
|
||||
target_link_libraries(${PROJECT_NAME}server ${GETTEXT_LIBRARY})
|
||||
target_link_libraries(${PROJECT_NAME}server ${Intl_LIBRARIES} ${GETTEXT_LIBRARY})
|
||||
endif()
|
||||
if (USE_CURSES)
|
||||
target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES})
|
||||
|
@ -661,7 +670,7 @@ endif()
|
|||
|
||||
# Set some optimizations and tweaks
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
if(MSVC)
|
||||
# Visual Studio
|
||||
|
@ -695,13 +704,28 @@ else()
|
|||
else()
|
||||
set(RELEASE_WARNING_FLAGS "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wsign-compare")
|
||||
endif()
|
||||
|
||||
if(APPLE AND USE_LUAJIT)
|
||||
# required per http://luajit.org/install.html
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
|
||||
elseif(UNIX AND USE_LUAJIT)
|
||||
check_c_source_compiles("#ifndef __aarch64__\n#error\n#endif\nint main(){}" IS_AARCH64)
|
||||
if(IS_AARCH64)
|
||||
# Move text segment below LuaJIT's 47-bit limit (see issue #9367)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
# FreeBSD uses lld, and lld does not support -Ttext-segment, suggesting
|
||||
# --image-base instead. Not sure if it's equivalent change for the purpose
|
||||
# but at least if fixes build on FreeBSD/aarch64
|
||||
# XXX: the condition should also be changed to check for lld regardless of
|
||||
# os, bit CMake doesn't have anything like CMAKE_LINKER_IS_LLD yet
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--image-base=0x200000000")
|
||||
else()
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Ttext-segment=0x200000000")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
|
|
|
@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include "content_mapblock.h"
|
||||
#include "util/numeric.h"
|
||||
#include "util/directiontables.h"
|
||||
|
|
|
@ -890,7 +890,7 @@ static void updateFastFaceRow(
|
|||
v3s16 p_corrected;
|
||||
v3s16 face_dir_corrected;
|
||||
u16 lights[4] = {0, 0, 0, 0};
|
||||
u8 waving;
|
||||
u8 waving = 0;
|
||||
TileSpec tile;
|
||||
getTileInfo(data, p, face_dir,
|
||||
makes_face, p_corrected, face_dir_corrected,
|
||||
|
|
|
@ -415,12 +415,13 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||
Collision uncertainty radius
|
||||
Make it a bit larger than the maximum distance of movement
|
||||
*/
|
||||
f32 d = pos_max_d * 1.1f;
|
||||
// A fairly large value in here makes moving smoother
|
||||
//f32 d = pos_max_d * 1.1;
|
||||
// A fairly large value in here makes moving smoother but more rare too
|
||||
//f32 d = 0.15*BS;
|
||||
f32 d = 0.3f; // Temporary fix, any nonzero d causes collision glitches, the more the greater it is.
|
||||
|
||||
// This should always apply, otherwise there are glitches
|
||||
assert(d > pos_max_d); // invariant
|
||||
//assert(d > pos_max_d); // invariant
|
||||
|
||||
int loopcount = 0;
|
||||
|
||||
|
|
|
@ -629,6 +629,13 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer
|
|||
// Lava falls back to water as both are suitable as cave liquids.
|
||||
if (c_lava_source == CONTENT_IGNORE)
|
||||
c_lava_source = c_water_source;
|
||||
|
||||
if (c_stone == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen: Mapgen alias 'mapgen_stone' is invalid!" << std::endl;
|
||||
if (c_water_source == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen: Mapgen alias 'mapgen_water_source' is invalid!" << std::endl;
|
||||
if (c_river_water_source == CONTENT_IGNORE)
|
||||
warningstream << "Mapgen: Mapgen alias 'mapgen_river_water_source' is invalid!" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -132,6 +132,21 @@ MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
|
|||
c_stair_cobble = c_cobble;
|
||||
if (c_stair_desert_stone == CONTENT_IGNORE)
|
||||
c_stair_desert_stone = c_desert_stone;
|
||||
|
||||
if (c_stone == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen v6: Mapgen alias 'mapgen_stone' is invalid!" << std::endl;
|
||||
if (c_dirt == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen v6: Mapgen alias 'mapgen_dirt' is invalid!" << std::endl;
|
||||
if (c_dirt_with_grass == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen v6: Mapgen alias 'mapgen_dirt_with_grass' is invalid!" << std::endl;
|
||||
if (c_sand == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen v6: Mapgen alias 'mapgen_sand' is invalid!" << std::endl;
|
||||
if (c_water_source == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen v6: Mapgen alias 'mapgen_water_source' is invalid!" << std::endl;
|
||||
if (c_lava_source == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen v6: Mapgen alias 'mapgen_lava_source' is invalid!" << std::endl;
|
||||
if (c_cobble == CONTENT_IGNORE)
|
||||
errorstream << "Mapgen v6: Mapgen alias 'mapgen_cobble' is invalid!" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,12 @@ void make_tree(MMVManip &vmanip, v3s16 p0, bool is_apple_tree,
|
|||
MapNode treenode(ndef->getId("mapgen_tree"));
|
||||
MapNode leavesnode(ndef->getId("mapgen_leaves"));
|
||||
MapNode applenode(ndef->getId("mapgen_apple"));
|
||||
if (treenode == CONTENT_IGNORE)
|
||||
errorstream << "Treegen: Mapgen alias 'mapgen_tree' is invalid!" << std::endl;
|
||||
if (leavesnode == CONTENT_IGNORE)
|
||||
errorstream << "Treegen: Mapgen alias 'mapgen_leaves' is invalid!" << std::endl;
|
||||
if (applenode == CONTENT_IGNORE)
|
||||
errorstream << "Treegen: Mapgen alias 'mapgen_apple' is invalid!" << std::endl;
|
||||
|
||||
PseudoRandom pr(seed);
|
||||
s16 trunk_h = pr.range(4, 5);
|
||||
|
@ -145,6 +151,9 @@ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0,
|
|||
const NodeDefManager *ndef, TreeDef tree_definition)
|
||||
{
|
||||
MapNode dirtnode(ndef->getId("mapgen_dirt"));
|
||||
if (dirtnode == CONTENT_IGNORE)
|
||||
errorstream << "Treegen (make_ltree): Mapgen alias 'mapgen_dirt' is invalid!" << std::endl;
|
||||
|
||||
s32 seed;
|
||||
if (tree_definition.explicit_seed)
|
||||
seed = tree_definition.seed + 14002;
|
||||
|
@ -662,6 +671,10 @@ void make_jungletree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef,
|
|||
c_tree = ndef->getId("mapgen_tree");
|
||||
if (c_leaves == CONTENT_IGNORE)
|
||||
c_leaves = ndef->getId("mapgen_leaves");
|
||||
if (c_tree == CONTENT_IGNORE)
|
||||
errorstream << "Treegen: Mapgen alias 'mapgen_jungletree' is invalid!" << std::endl;
|
||||
if (c_leaves == CONTENT_IGNORE)
|
||||
errorstream << "Treegen: Mapgen alias 'mapgen_jungleleaves' is invalid!" << std::endl;
|
||||
|
||||
MapNode treenode(c_tree);
|
||||
MapNode leavesnode(c_leaves);
|
||||
|
@ -765,6 +778,10 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef,
|
|||
c_leaves = ndef->getId("mapgen_leaves");
|
||||
if (c_snow == CONTENT_IGNORE)
|
||||
c_snow = CONTENT_AIR;
|
||||
if (c_tree == CONTENT_IGNORE)
|
||||
errorstream << "Treegen: Mapgen alias 'mapgen_pine_tree' is invalid!" << std::endl;
|
||||
if (c_leaves == CONTENT_IGNORE)
|
||||
errorstream << "Treegen: Mapgen alias 'mapgen_pine_needles' is invalid!" << std::endl;
|
||||
|
||||
MapNode treenode(c_tree);
|
||||
MapNode leavesnode(c_leaves);
|
||||
|
|
|
@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
extern char **environ;
|
||||
#elif defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
|
|
@ -42,11 +42,13 @@ extern "C" {
|
|||
#define CHECK_POS_COORD(name) CHECK_TYPE(-1, "position coordinate '" name "'", LUA_TNUMBER)
|
||||
#define CHECK_FLOAT_RANGE(value, name) \
|
||||
if (value < F1000_MIN || value > F1000_MAX) { \
|
||||
std::ostringstream error_text; \
|
||||
error_text << "Invalid float vector dimension range '" name "' " << \
|
||||
warningstream << "Invalid float vector dimension range '" name "' " << \
|
||||
"(expected " << F1000_MIN << " < " name " < " << F1000_MAX << \
|
||||
" got " << value << ")." << std::endl; \
|
||||
throw LuaError(error_text.str()); \
|
||||
" got " << value << "). restarted to max / min" << std::endl; \
|
||||
if (value < F1000_MIN) \
|
||||
value = F1000_MIN; \
|
||||
else \
|
||||
value = F1000_MAX; \
|
||||
}
|
||||
#define CHECK_POS_TAB(index) CHECK_TYPE(index, "position", LUA_TTABLE)
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ extern "C" {
|
|||
#include <lauxlib.h>
|
||||
}
|
||||
|
||||
#include "config.h"
|
||||
#include "common/c_types.h"
|
||||
|
||||
|
||||
|
@ -54,6 +55,15 @@ extern "C" {
|
|||
#define CUSTOM_RIDX_CURRENT_MOD_NAME (CUSTOM_RIDX_BASE + 2)
|
||||
#define CUSTOM_RIDX_BACKTRACE (CUSTOM_RIDX_BASE + 3)
|
||||
|
||||
// Determine if CUSTOM_RIDX_SCRIPTAPI will hold a light or full userdata
|
||||
#if defined(__aarch64__) && USE_LUAJIT
|
||||
/* LuaJIT has a 47-bit limit for lightuserdata on this platform and we cannot
|
||||
* assume that the ScriptApi class was allocated at a fitting address. */
|
||||
#define INDIRECT_SCRIPTAPI_RIDX 1
|
||||
#else
|
||||
#define INDIRECT_SCRIPTAPI_RIDX 0
|
||||
#endif
|
||||
|
||||
// Pushes the error handler onto the stack and returns its index
|
||||
#define PUSH_ERROR_HANDLER(L) \
|
||||
(lua_rawgeti((L), LUA_REGISTRYINDEX, CUSTOM_RIDX_BACKTRACE), lua_gettop((L)))
|
||||
|
|
|
@ -90,7 +90,11 @@ ScriptApiBase::ScriptApiBase(ScriptingType type):
|
|||
luaL_openlibs(m_luastack);
|
||||
|
||||
// Make the ScriptApiBase* accessible to ModApiBase
|
||||
#if INDIRECT_SCRIPTAPI_RIDX
|
||||
*(void **)(lua_newuserdata(m_luastack, sizeof(void *))) = this;
|
||||
#else
|
||||
lua_pushlightuserdata(m_luastack, this);
|
||||
#endif
|
||||
lua_rawseti(m_luastack, LUA_REGISTRYINDEX, CUSTOM_RIDX_SCRIPTAPI);
|
||||
|
||||
// Add and save an error handler
|
||||
|
|
|
@ -499,7 +499,12 @@ bool ScriptApiSecurity::checkPath(lua_State *L, const char *path,
|
|||
|
||||
// Get server from registry
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_SCRIPTAPI);
|
||||
ScriptApiBase *script = (ScriptApiBase *) lua_touserdata(L, -1);
|
||||
ScriptApiBase *script;
|
||||
#if INDIRECT_SCRIPTAPI_RIDX
|
||||
script = (ScriptApiBase *) *(void**)(lua_touserdata(L, -1));
|
||||
#else
|
||||
script = (ScriptApiBase *) lua_touserdata(L, -1);
|
||||
#endif
|
||||
lua_pop(L, 1);
|
||||
const IGameDef *gamedef = script->getGameDef();
|
||||
if (!gamedef)
|
||||
|
|
|
@ -30,7 +30,12 @@ ScriptApiBase *ModApiBase::getScriptApiBase(lua_State *L)
|
|||
{
|
||||
// Get server from registry
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_SCRIPTAPI);
|
||||
ScriptApiBase *sapi_ptr = (ScriptApiBase*) lua_touserdata(L, -1);
|
||||
ScriptApiBase *sapi_ptr;
|
||||
#if INDIRECT_SCRIPTAPI_RIDX
|
||||
sapi_ptr = (ScriptApiBase*) *(void**)(lua_touserdata(L, -1));
|
||||
#else
|
||||
sapi_ptr = (ScriptApiBase*) lua_touserdata(L, -1);
|
||||
#endif
|
||||
lua_pop(L, 1);
|
||||
return sapi_ptr;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,6 @@ int ModApiServer::l_get_player_information(lua_State *L)
|
|||
lua_pushnumber(L, player->formspec_version);
|
||||
lua_settable(L, table);
|
||||
|
||||
#ifndef NDEBUG
|
||||
lua_pushstring(L,"serialization_version");
|
||||
lua_pushnumber(L, ser_vers);
|
||||
lua_settable(L, table);
|
||||
|
@ -261,7 +260,6 @@ int ModApiServer::l_get_player_information(lua_State *L)
|
|||
lua_pushstring(L,"state");
|
||||
lua_pushstring(L,ClientInterface::state2Name(state).c_str());
|
||||
lua_settable(L, table);
|
||||
#endif
|
||||
|
||||
#undef ERET
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue