Commit Graph

378 Commits

Author SHA1 Message Date
Jeffrey Clark 5d7a1c1020 lua 5.3 compatiblity 2015-12-08 15:50:20 -06:00
est31 51e8c2b277 Fix threshold type
Fix the type of the threshold value for mapgen.
The commit

a78dd7f2b6 "Fix spelling of noise_threshold"

has changed it to be read as int, but it can have non-integral values too.

Thanks to @kwolekr for pointing this out.
2015-12-07 09:57:45 +01:00
paramat 49073ba2c3 Mapgen: Add propagate_shadow bool to calcLighting
To terminate unwanted shadows from floatlands or realms above
Also add to LuaVoxelManip calc_lighting for use in mapgen mods
Remove the 2 argument calcLighting, mapgens now use the 5
argument form to specify the volumes for propagateSunlight and
spreadLight
In mgsinglenode replace calcLighting with setLighting and
clean-up use of tabs and spaces
2015-12-07 03:18:24 +00:00
Jun Zhang a78dd7f2b6 Fix spelling of noise_threshold 2015-12-06 11:38:03 +01:00
Alex Ford 97908cc656 Add on_secondary_use when right clicking an item in the air 2015-12-02 02:18:44 +00:00
est31 ad5ac39d8d Add LuaSecureRandom 2015-11-08 15:57:15 -05:00
BlockMen 2a12579fab Add support for audio feedback if placing node failed 2015-11-07 13:23:38 +01:00
est31 5e507c9829 Add server side ncurses terminal
This adds a chat console the server owner can use for administration
or to talk with players.
It runs in its own thread, which makes the user interface immune to
the server's lag, behaving just like a client, except timeout.
As it uses the same console code as the f10 console, things like nick
completion or a scroll buffer basically come for free.
The terminal itself is written in a general way so that adding a
client version later on is just about implementing an interface.

Fatal errors are printed after the console exists and the ncurses
terminal buffer gets cleaned up with endwin(), so that the error still
remains visible.

The server owner can chose their username their entered text will
have in chat and where players can send PMs to.
Once the username is secured with a password to prevent anybody to
take over the server, the owner can execute admin tasks over the
console.

This change includes a contribution by @kahrl who has improved ncurses
library detection.
2015-11-06 08:51:14 +01:00
kwolekr 1384108f8c Schematics: Add core.place_schematic_on_vmanip API
Fix memory leak in minetest.place_schematic
Slightly refactor Schematic code
2015-11-05 01:18:32 -05:00
kwolekr c2b5da735e Add callback parameter for core.emerge_area() 2015-11-02 18:43:09 -05:00
kwolekr 52e5b513ed Fix Lua scripting synchronization
For several years now, the lua script lock has been completely broken.
This commit fixes the main issue (creation of a temporary rather than
scoped object), and fixes a subsequent deadlock issue caused by
nested script API calls by adding support for recursive mutexes.
2015-11-01 11:32:05 -05:00
ShadowNinja 9269a0ecc7 Fix server crashing on Lua errors
Previously, the server called FATAL_ERROR when a Lua error occured.
This caused a (mostly useless) core dump.
The server now simply throws an exception, which is caught and printed before
exiting with a non-zero return value.
This also fixes a number of instances where errors were logged multiple times.
2015-10-31 13:28:58 -04:00
kwolekr bc0318d2fc SAPI: Fix seed parameter truncation for LuaPseudoRandom constructor
Also fix a potential seed truncation issue on platforms where the
range of ptrdiff_t (the underlying type of lua_Integer) is too small.
2015-10-26 04:04:52 -04:00
kwolekr 306b067091 SAPI: Move core.get_us_time() to Util module 2015-10-26 03:46:36 -04:00
est31 5f342aa015 Remove some abort() calls
abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
2015-10-26 04:45:00 +01:00
kwolekr d69ef6acd3 SAPI: Throw runtime error instead of if l_get_mapgen_object called in incorrect thread 2015-10-25 23:15:57 -04:00
kwolekr 54f1267c2c SAPI: Mark all Lua API functions requiring envlock 2015-10-25 23:06:48 -04:00
est31 3936a5e3f7 Correct comment in l_util.cpp
Remove outdated loglevel list from a l_util.cpp comment,
and rather point to the updated code.
2015-10-26 00:32:48 +01:00
BlockMen 50ba7e114d Add option to disable backface culling for models
- Disabled by default (except players)
- Fixes #2984
2015-10-25 12:06:08 +01:00
paramat 3b9f99e0d6 ABMs: Make catch-up behaviour optional
Default is true for backwards compatibility
Update lua_api.txt
2015-10-18 16:42:59 +01:00
est31 6b0cae5a9d Remove wstrgettext
Everywhere where wstrgettext was used, its output was converted back
to utf8. As wstrgettext internally converts the return value
from utf8 to wstring, it has been a waste. Remove the function, and
use strgettext instead.
2015-10-18 02:29:06 +02:00
est31 836486a98e Fix crash regression when invsize formspec gets used
The invsize formspec element is outdated. Even though,
it is still supported, only a deprecation warning is shown,
introduced by commit [1]. The lua context passed to the
log_deprecated method added by commit [1] is NULL for the
invsize deprecation warning, as its run on the client and not
the server.

Commit [1] has removed checks for NULL inside the log_deprecated
method, resulting in a crash when a formspec with an invsize
element is parsed. This commit puts the check back.

Fixes #3260.

Referenced commits:

[1]: b5acec0a3c "Add proper lua api deprecated handling"

[2]: 7b8d372947 "Use warningstream for deprecated field messages and refactor log_deprecated"
2015-10-17 01:29:05 +02:00
ShadowNinja 7b8d372947 Use warningstream for deprecated field messages and refactor log_deprecated 2015-10-15 01:14:38 -04:00
ShadowNinja 6f2d785d0f Rename macros with two leading underscores
These names are reserved for the compiler/library implementations.
2015-10-14 02:39:37 -04:00
ShadowNinja 2139d7d45f Refactor logging
- Add warning log level
- Change debug_log_level setting to enumeration string
- Map Irrlicht log events to MT log events
- Encapsulate log_* functions and global variables into a class, Logger
- Unify dstream with standard logging mechanism
- Unify core.debug() with standard core.log() script API
2015-10-14 01:03:54 -04:00
est31 b0523adc5f Add new ContentParamType2 "CPT2_DEGROTATE"
This might break some mods, but it is important for all uses of the param2 to
be documented.

This doesn't need a serialisation version or network protocol version change,
as old clients will still work on new servers, and it is bearable to have
new clients getting non rotated plants on old servers.
2015-10-04 23:59:41 +02:00
kwolekr 5130dbce7b Allow setting chunksize in core.set_mapgen_params 2015-10-04 17:26:08 -04:00
kwolekr 9f25aba6c2 Hide mapgens from main menu not intended for end users 2015-10-04 17:11:41 -04:00
kwolekr 0850d3bb93 Add emerge completion callback mechanism
Major refactor of emerge.cpp and Map::init/finishBlockMake
2015-10-04 16:27:50 -04:00
kwolekr f0cd5da687 Define and use limit constants for Irrlicht fixed-width types 2015-10-04 04:00:16 -04:00
Duane Robertson a5bdfb6b3c Add get_biome_id(biome_name) callback
It returns the index used in mg->biomemap for a given biome name.
The biomemap is useless without this unless you re-register all existing biomes,
which could cause problems for anyone else trying to use biomemap.
With this, you can quickly create a lookup table of ids and names.
2015-10-02 22:49:31 +02:00
kwolekr f062bbd7a1 Add /emergeblocks command and core.emerge_area() Lua API 2015-09-23 15:56:24 -04:00
est31 452df1c723 Various style cleanups + unused code removal
-> Don't pass pointer to whole IGameDef to NodeMetadata constructors
	and deserializers, but only to IItemDefManager, which is needed
-> Remove the unused content_mapnode_get_new_name() method
-> Fix style for MapBlock::deSerialize and MapBlock::deSerialize_pre22,
	improving accuracy of error messages a bit
-> Fix style at other serialisation methods too
-> Improve accuracy of some comments
2015-09-19 20:57:29 +02:00
kwolekr dcbb95338a Ore: Add puff ore type 2015-09-17 03:04:50 -04:00
kwolekr beba969413 Ore: Add ore sheet column height range selection
Modders are now able to select the range of ore column height,
and the midpoint at which they 'grow' starting from.
This commit adds three new parameters for the 'sheet' ore type:
column_height_min, column_height_max, and column_midpoint_factor.
clust_size is now deprecated for this ore type.
2015-09-13 00:11:50 -04:00
est31 2035bfc3a6 Areastore: fix "attempt to index a number value"
Before, calling get_areas_in_area for an areastore with both
include_borders and include_data would result in a lua error,
if there was at least one area as result:
attempt to index a number value in function 'get_areas_in_area'
2015-09-03 06:17:02 +02:00
est31 9c44aace4f l_mainmenu.h: remove unused l_get_dirlist function
The commit
8f9af57314 "Add core.get_dir_list" by @ShadowNinja
has removed the implementation of the l_get_dirlist function and all its usages
from the l_mainmenu.cpp file, but hasn't removed it from the header file.

The reason why this hasn't been detected earlier is that C++ has this interesting
feature to still make it possible to create instances of classes whose never used
private methods are declared but not defined.
2015-08-30 01:17:03 +02:00
Kahrl 3304e1e517 Push error handler afresh each time lua_pcall is used
Fixes "double fault" / "error in error handling" messages
(issue #1423) and instead shows a complete backtrace.
2015-08-27 01:56:06 +02:00
Kahrl 8658c8d9b5 Use numeric indices and raw table access with LUA_REGISTRYINDEX 2015-08-27 01:56:06 +02:00
ShadowNinja e4bff8be94 Clean up threading
* Rename everything.
    * Strip J prefix.
    * Change UpperCamelCase functions to lowerCamelCase.
  * Remove global (!) semaphore count mutex on OSX.
  * Remove semaphore count getter (unused, unsafe, depended on internal
    API functions on Windows, and used a hack on OSX).
  * Add `Atomic<type>`.
  * Make `Thread` handle thread names.
  * Add support for C++11 multi-threading.
  * Combine pthread and win32 sources.
  * Remove `ThreadStarted` (unused, unneeded).
  * Move some includes from the headers to the sources.
  * Move all of `Event` into its header (allows inlining with no new includes).
  * Make `Event` use `Semaphore` (except on Windows).
  * Move some porting functions into `Thread`.
  * Integrate logging with `Thread`.
  * Add threading test.
2015-08-23 22:04:06 -04:00
kwolekr c2d23ff9cc SAPI: Disable unlockable time profiling 2015-08-18 01:26:11 -04:00
kwolekr bcf38a2ad1 SEnv: Remove static_exists from ActiveObjects in deleted blocks 2015-08-16 15:55:07 -04:00
kwolekr be9024a397 minimap: Add ability to disable from server 2015-08-13 15:05:48 -04:00
kwolekr 2b04ab874d SAPI: Track last executed mod and include in error messages 2015-08-12 23:56:12 -04:00
kwolekr 18cfd89a86 Display Lua memory usage at the time of Out-of-Memory error
Also misc. minor cleanups
2015-08-10 01:38:09 -04:00
kwolekr bcf47bc67c Improve Script CPP API diagnostics 2015-08-05 21:13:03 -04:00
RealBadAngel 3295f3c401 Fix tiling issues for PLANTLIKE and FIRELIKE with FSAA 2015-08-05 22:52:32 +02:00
paramat cf77e0333d Biome API: Make fallback biome stone and water, disable filler 2015-08-03 02:34:32 +01:00
est31 c30a2d6854 Add AreaStore data structure 2015-07-27 06:42:56 +02:00
SmallJoker 454a290370 Fix MSVC number conversion warning 2015-07-25 17:38:04 +02:00