Commit Graph

393 Commits

Author SHA1 Message Date
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
kwolekr
821d0025da Biomes: Remove referenced biomes from Decorations on clear 2015-04-16 23:38:05 -04:00
kwolekr
479f38973e Schematics: Refactor NodeResolver and add NodeResolveMethod
NodeResolver name lists now belong to the NodeResolver object instead of
the associated NodeDefManager.  In addition to minimizing unnecessary
abstraction and overhead, this move permits NodeResolvers to look up nodes
that they had previously set pending for resolution.  So far, this
functionality has been used in the case of schematics for
serialization/deserialization.
2015-04-16 16:27:05 -04:00
Loic Blot
0c634a9719 Use std::vector instead of std::set for Environment::getObjectsInsideRadius
We are only iterating sequentially, we don't need a set here
Also use a vector reference instead of a copy
2015-04-16 18:37:29 +02:00
kwolekr
b2a89c04b2 Schematics: Reorganize (de)serialization and add Lua serialization API 2015-04-13 03:10:52 -04:00
est31
0a413265cb Document for api functions that rely on current_modname, that it doesn't work when not loading mods 2015-04-08 23:05:26 +02:00
kwolekr
0df736173e Schematics: Prepend mod path to relative schematic filepaths 2015-04-08 00:28:56 -04:00
Craig Robbins
9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
kwolekr
337e79c656 ObjDefManager, Mapgen SAPI: Huge refactoring
- General code cleanup
 - Unified object creation and loading
 - Specifying objects in APIs is now orthogonal (i.e. anything can take an ID,
   name string, or the raw table definition (and automatically registers if present
2015-03-31 23:27:58 -04:00
kwolekr
ed10005d38 GenElementManager: Pass opaque handles to Lua and rename to ObjDefManager
Add core.clear_registered_schematics() and refactor schematics somewhat
2015-03-31 01:11:51 -04:00
Craig Robbins
34101015b2 Fix typo 2015-03-29 22:08:14 +10:00
Craig Robbins
2430b2e998 Add Lua function get_video_modes() for main menu
Also updates and uses porting::getSupportedVideoModes()
2015-03-28 13:26:03 +10:00
ShadowNinja
93fcab952b Clean up and tweak build system
* Combine client and server man pages.
  * Update unit test options and available databases in man page.
  * Add `--worldname` to man page.
  * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
  * Disable server build by default on all operating systems.
  * Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
  * Enable LevelDB, Redis, and FreeType detection by default.
  * Remove the `VERSION_PATCH_ORIG` hack.
  * Add option to search for and use system JSONCPP.
  * Remove broken LuaJIT version detection.
  * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
  * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
  * Clean up style of CMake files.
2015-03-27 15:00:48 -04:00
paramat
d1681872bf lua_api/l_mapgen: generate_ores/decorations: make p1, p2 optional 2015-03-24 18:07:29 +00:00
kwolekr
732d7b9a7c Add core.register_schematic() and cache schematics on use 2015-03-23 22:23:38 -04:00
est31
5b5c498011 Fix minetest.get_craft_recipe function
Previously, calling it resulted in a crash.
2015-03-23 13:40:20 +10:00
Loic Blot
008d7e0467 Revert "Add a Lua call to do damages / heals" ok @ShadowNinja
This reverts commit 467fc0ddc9.
2015-03-22 18:01:56 +01:00
kwolekr
3993093f51 Add support for the PCG32 PRNG algo (and associated script APIs) 2015-03-22 00:48:08 -04:00
gregorycu
03e0dd33a8 Optimize minetest.get_(all)_craft_recipe(s)
Signed off by: ShadowNinja, kwolekr
2015-03-20 21:41:18 -04:00
kwolekr
26153bab7d Revert "Fix issue #2441: crash on respawn, since a conversion std::list to std::vector on Environment.cpp"
This reverts parts of commit 9749d9fee6, which breaks node resolver
list clearing
2015-03-20 18:41:26 -04:00
est31
538036d004 Fix game minetest.conf default settings
This was a regression introduced by f6e4c5d9cf .
2015-03-18 13:03:02 -04:00
Loic Blot
467fc0ddc9 Add a Lua call to do damages / heals 2015-03-18 14:52:35 +01:00
Loic Blot
74d34da6cb Prepare Protocol v25 init & authentication.
* TOSERVER_INIT and TOCLIENT_INIT renamed to _LEGACY
* TOSERVER_PASSWORD merged from dev-0.5, can use protocol v24 and v25
* TOCLIENT_ACCESS_DENIED merged from dev-0.5, can use protocol v24 and v25, with normalized strings an a custom id for custom errors
* new TOSERVER_INIT packet only send MT version, supported compressions, protocols and serialization, this permit to rework everything later without break the _INIT packet
* new TOSERVER_AUTH packet which auth the client
* new TOCLIENT_HELLO packet which send server serialization version atm
* new TOCLIENT_AUTH_ACCEPTED which is send when TOCLIENT_AUTH was okay. After this packet, the client load datas from servers, like after TOCLIENT_INIT_LEGACY packet
2015-03-13 20:23:03 +01:00
paramat
b2b6bbf3e8 lua_api/l_mapgen: Fix overlapping areas of minetest.generate_ores/decorations 2015-03-11 03:36:39 +00:00
ShadowNinja
d75a0a7394 Don't use luaL_checkstring to read node names, it's only for arguments
This caused confusing error messages like "argument #4 to set_node is not a string."
2015-03-07 20:04:01 -05:00
Craig Robbins
ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
Loic Blot
40c2c18a3f l_get_modnames: Compare using std::sort instead of a custom function which does same work 2015-03-05 20:12:54 +01:00
Loic Blot
9749d9fee6 Fix issue #2441: crash on respawn, since a conversion std::list to std::vector on Environment.cpp
* Also change some std::list to std::vector for ClientMap::renderMap
* Remove disabled code in ClientMap::renderMap, disabled since a long time
2015-03-05 15:36:20 +01:00
Loic Blot
365e4ae0fa Performance improvement: Use std::list instead of std::vector for request_media, Server::getModNames, Environment::m_simple_objects.
* Also remove unused Server::m_modspaths
2015-03-05 10:44:48 +01:00
Loic Blot
7e088fdfe3 We always know playerSAO when calling SendInventory. Using it instead of searching it via peer_id 2015-03-04 15:28:33 +01:00
Loic Blot
1b2f64473e Send Inventory packet on event, don't check it at each AsyncRunStep.
* Call UpdateCrafting into SendInventory because this functions is only called before SendInventory
* Use Player* instead of peer_id for UpdateCrafting because SendInventory already has the Player* pointer, then don't loop for searching Player* per peer_id
* m_env_mutex don't need to be used with this modification because it's already locked before the calls
2015-03-04 11:29:39 +01:00