Commit Graph

423 Commits

Author SHA1 Message Date
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
est31
fa1096ec49 Fix minetest.get_(all)_craft_recipe(s) regression
Since 03e0dd33a8 the calls didn't return an output count
for the recipes.
2015-07-25 17:33:41 +02:00
Loic Blot
4e6971e593 Cleanup server addparticle(spawner) by merge two identical functions. 2015-07-25 12:24:28 +02:00
est31
3b50b2766a Optional reconnect functionality
Enable the server to request the client to reconnect.

This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting.
2015-07-23 07:38:13 +02:00
Elia Argentieri
5ebb4237e2 Added get_player_velocity() method. Fixes #1176 2015-07-20 05:40:44 +02:00
TeTpaAka
e47f390e0d Refactor particle code to remove the while loops
Replaces while loops with proper getfield calls
2015-07-18 14:54:07 +02:00
TeTpaAka
dd2e08e117 Make acc and vel deprecated in add_particle and search for acceleration and velocity instead
The doc and the actual behaviour differed.
2015-07-18 07:57:20 +02:00
TeTpaAka
8d03301138 Fix invisible player when the attached entity is removed 2015-07-18 07:41:43 +02:00
RealBadAngel
655fc6010f Fix relief mapping issues 2015-07-16 15:36:48 +02:00
kwolekr
1a1774a105 Fix damage flash when damage disabled 2015-07-10 15:58:57 -04:00
est31
b0784ba871 Use UTF-8 instead of narrow
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places.
Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
2015-07-08 10:12:44 +02:00
kwolekr
7b171ea2be Fix code style from recent commits and add misc. optimizations 2015-07-02 23:14:30 -04:00
rubenwardy
0d65ee878c Add Lua errors to error dialog 2015-06-29 04:47:35 +02:00
TeTpaAka
17ba584fe2 Fix bug when craft input isn't replaced 2015-06-22 19:30:35 +02:00
MirceaKitsune
660fa516bf Fix some issues with animations, and allow non-looped animations to be defined 2015-06-22 01:53:38 +02:00
paramat
70da8a940b Mapgen objects: Enable heatmap and humidmap for all biome api mapgens 2015-06-20 04:16:17 +01:00
Ilya Zhuravlev
b6387b4e0f Use utf-8 in formspecs 2015-06-13 19:49:55 +02:00
TeTpaAka
aa13baa30a Add minetest.register_on_player_hpchange 2015-06-13 19:40:31 +02:00
TeTpaAka
e50aa4ed06 Add return list of individual counts to find_node_in_area 2015-06-13 19:39:18 +02:00
est31
502e40a649 dofile error reporting for syntax errors
According to doc, dofile() raises an error when parsing failed due to syntax errors.
Fixes #2775
2015-06-12 20:23:31 +02:00
est31
ba3ff5ef39 Fix uninitialized variable error
If you run minetest with valgrind, you'll quickly notice uninitialized jump
depend error messages that point to s_base.cpp:131. This commit fixes those.
2015-06-02 13:55:02 +02:00
kwolekr
522acf920f Make get_biome_list() error message more helpful 2015-05-28 20:04:50 -04:00
TeTpaAka
c0335f7d13 Add some missing getter functions to the lua API
ObjectRef:
get_properties
get_armor_groups
get_animation
get_attach
get_bone_position

Players:
get_physics_override
hud_get_hotbar_itemcount
hud_get_hotbar_image
hud_get_hotbar_selected_image
get_sky
get_day_night_ratio
get_local_animation
get_eye_offset

Global:
minetest.get_gen_notify
minetest.get_noiseparams
2015-05-28 16:46:35 +02:00
SmallJoker
39869aaa25 Fix Windows build, clean up included headers
Also fix a startup error caused by s_security.cpp
2015-05-22 20:37:59 +02:00
kwolekr
da34a2b33e Replace instances of std::map<std::string, std::string> with StringMap
Also, clean up surrounding code style
Replace by-value parameter passing with const refs when possible
Fix post-increment of iterators
2015-05-19 16:10:49 -04:00
kwolekr
20aa78cffb Fix null dereference when loading schematic from definition without a NodeDefManager 2015-05-17 22:32:35 -04:00
kwolekr
46684beec1 Record MapBlock modification reasons as flags instead of strings
This improves performance of MapBlock::raiseModified by a factor of 6.
Also, clean up mapblock.h a bit and inline small functions.
2015-05-17 22:14:26 -04:00
kwolekr
4c9a8a91c4 SAPI/Noise: Add PerlinNoiseMap:getMapSlice() function
This adds the ability to grab 'slices' of noise calculated by PerlinNoiseMap.
Retrieving smaller slices of noise from the computation result as needed
optimizes memory usage while maintaining a reasonable amount of CPU overhead.
2015-05-17 04:04:17 -04:00
kwolekr
3ffb5f5761 Add optional buffer param for bulk data array writes in Lua 2015-05-17 00:07:45 -04:00
ShadowNinja
c00b6812b1 Fix current mod name change missed during rebase 2015-05-16 21:12:03 -04:00
kwolekr
fb36c471d7 SAPI: Accept either ARGB8 table or ColorString to specify colors 2015-05-16 20:15:03 -04:00
ShadowNinja
8f9af57314 Add core.get_dir_list 2015-05-16 18:33:22 -04:00
ShadowNinja
6c06330daf Add core.request_insecure_environment() 2015-05-16 18:33:19 -04:00
ShadowNinja
05ab9973f9 Add core.mkdir 2015-05-16 18:32:37 -04:00
ShadowNinja
3a8c788880 Add mod security
Due to compatibility concerns, this is temporarily disabled.
2015-05-16 18:32:31 -04:00
TeTpaAka
19cbb6b37b Add push_ARGB8 to script/common/c_converter 2015-05-15 16:21:56 -04:00
TeTpaAka
18c2f16c13 Generalize core.get/set_nametag_color into core.get/set_nametag_attributes 2015-05-15 16:21:01 -04:00
Brandon
c5b4e54174 Add minetest.register_on_punchplayer 2015-05-15 11:09:55 +02:00
TeTpaAka
86a963caca Add get and set functions for the nametag color 2015-05-15 11:03:27 +02:00
est31
b70e67df8c Fix compiler warning about sign comparison 2015-05-13 00:04:30 +02:00
est31
b4c3ff6eab is_player() is no player-only function 2015-05-12 05:52:49 +02:00
est31
82e35edff5 Make early protocol auth mechanism generic, and add SRP
Adds everything needed for SRP (and everything works too),
but still deactivated, as protocol v25 init packets aren't final yet.
Can be activated by changing the LATEST_PROTOCOL_VERSION header to 25
inside networkprotocol.h.
2015-05-11 18:40:27 +02:00
kwolekr
2b99d904f6 Schematics: Add per-node force placement option 2015-05-09 18:44:00 -04:00
kwolekr
2dba29ebf2 Tests: Add schematic unittests
Improve schematic file-saving interface
Add ability to create temporary test files
2015-05-08 00:55:42 -04:00
kwolekr
0e64fc45b9 Fix missing Y component assignment in check_v3f 2015-05-08 00:03:41 -04:00
Kevin Ott
e17c6ba2cd Remove duplicate lua_getfield() in c_converter.cpp
Fixes #2678
2015-05-07 09:57:34 +02:00
kwolekr
b246812455 Schematics: Add indent-with-space option for schematic Lua table serialization 2015-05-07 02:54:35 -04:00
kwolekr
656575b59d NodeResolver: Remove NodeResolveMethod
This simplifies NodeResolver logic and makes some interfaces cleaner.
2015-05-07 02:36:01 -04:00
ShadowNinja
3a8e7341ec Fix error messages for type-checking Lua reading functions 2015-05-06 15:33:36 -04:00
kwolekr
b785577f03 Add core.find_nodes_with_meta() script API 2015-05-05 16:21:59 -04:00
kwolekr
46a2c1f167 Ore: Add biomes parameter 2015-04-20 20:25:33 -04:00
kwolekr
3d4244cc75 Add 'persistence' alias for Lua noiseparams and validate more vector parameters 2015-04-19 21:42:40 -04:00
paramat
a615da6b12 Biome API: Add biome-specific river water 2015-04-19 06:09:57 +01:00
kwolekr
e0889c6c03 Schematics: Fix core.schematic_create() 2015-04-17 18:39:37 -04:00
kwolekr
3576f4fab7 Switch to check_v3s16 in l_mapgen.cpp and l_vmanip.cpp for type safety 2015-04-17 01:03:13 -04:00
est31
f0a1379e5a Refactor around translatePassword
Change types for passed password from wstring to string, which removes converting
back and forth in most cases. Move the narrow_to_wide conversion, where its neccessary,
closer to irrlicht. Remove trailing spaces in guiPasswordChange.cpp. Make parameters for
translatePassword passed as const reference.
2015-04-17 06:10:30 +02:00