Commit Graph

1213 Commits

Author SHA1 Message Date
x2048 0f25fa7af6
Add API to control shadow intensity from the game/mod (#11944)
* Also Disable shadows when sun/moon is hidden. Fixes #11972.
2022-03-26 16:58:26 +01:00
Lars Müller b9e886726c
Readd basic_debug as a HUD flag (#12020) 2022-03-05 22:16:17 +01:00
Zughy 44fc888bd6
Allow get_sky to return a table (#11963) 2022-03-05 22:15:41 +01:00
SmallJoker f7311e0d97
Lua API documentation: Various fixes (#12059)
Change 1: Clarify when on_step collision information is provided
Change 2: Document PostgreSQL and Redis settings
Change 3: Overall AreaStore documentation improvements including consistent parameter naming based on community suggestions
2022-02-23 21:21:37 +01:00
sfan5 ba6fbc417e Remove awful Mingw32 workarounds
Instead a warning is triggered if an affected compiler is detected.
closes #12022
2022-02-08 19:31:24 +01:00
sfan5 afb061c374
Fix broken server startup if curl is disabled (#12046) 2022-02-04 20:29:28 +01:00
Lars Müller 1ee37148a8
Fix types of get_mapgen_setting_noiseparams (#12025) 2022-02-04 20:28:43 +01:00
rubenwardy 128f6359e9
Use virtual paths to specify exact mod to enable (#11784) 2022-01-30 22:40:53 +00:00
Lars Müller fe0b2d02bf
Define control(bits) as "unset" for entities (#11995) 2022-01-27 22:22:58 +01:00
Zughy 37d80784dd
Allow resetting celestial vault elements by leaving its arguments empty (#11922) 2022-01-22 12:42:49 +01:00
sfan5 9a12e4499e Minor improvements to Lua sandbox 2022-01-15 17:45:08 +01:00
sfan5 4c8c649779
Mainmenu game-related changes (#11887)
fixes:
* Switching between games does not immediately hide creative mode / damage buttons if so specified
* World creation menu has a game selection list even though the menu already provides a gamebar
* Showing gameid in world list is unnecessary
* Choice of mapgen parameters in menu persists between games (and was half-broken)
2022-01-09 21:15:35 +01:00
sfan5 5eb45e1ea0
Restore pass-through of direction keys (#11924)
This moves relevant code into the PlayerControl class and gets rid of separate keyPressed variable.
2022-01-09 18:46:36 +01:00
Jude Melton-Houghton bf22569019
Use a database for mod storage (#11763) 2022-01-07 20:28:49 +02:00
Wuzzy b81948a14c
Fix damage wraparound if very high damage (#11872) 2022-01-06 21:16:35 +01:00
sfan5 b2409b14d0 Refactor trusted mod checking code 2021-12-18 20:37:13 +01:00
sfan5 f405459548 Remove setlocal and setupvalue from `debug` table whitelist
It's likely that these could be used trick mods into revealing the insecure
environment even if they do everything right (which is already hard enough).
2021-12-18 20:37:13 +01:00
sfan5 8c99f2232b Don't let HTTP API pass through untrusted function
This has been a problem since the first day, oops.
2021-12-18 20:37:13 +01:00
sfan5 8472141b79
Restructure devtest's unittests and run them in CI (#11859) 2021-12-18 20:36:43 +01:00
Corey Powell 413be76c63
Implemented disconnect_player (#10492)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2021-11-26 19:19:40 +00:00
sfan5 87ab97da2a
Fix find_nodes_in_area misbehaving with out-of-map coordinates (#11770)
This ensures that no overflows (side-effects) happen within the find_nodes_in_area function by limiting coordinates like done in the map generation code.
2021-11-26 19:32:41 +01:00
Lejo b9051386ae
Add Lua bitop library (#9847) 2021-11-26 19:31:05 +01:00
Elijah Duffy cbf658f83d
Lua API: Add `rmdir`, `cpdir` and `mvdir` (#9638)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2021-11-10 19:10:20 +01:00
Wuzzy 6910c8d920
Fix number of tool uses being off by 1..32767 (#11110) 2021-10-31 22:33:33 +00:00
sfan5 660e63dbae
Fix item duplication if player dies during interact callback (alternative) (#11662) 2021-10-25 20:30:27 +02:00
SmallJoker ecc6f4ba25
Remove a few unused functions reported by callcatcher (#11658) 2021-10-12 20:12:20 +02:00
sfan5 6de8d77e17 Move instead of copy during content install if possible 2021-10-07 00:20:01 +02:00
sfan5 2b5075f0e2 Move archive extraction in content store to async job 2021-10-07 00:20:01 +02:00
sfan5 2d5b7b5fb4 Make fs::extractZipFile thread-safe 2021-10-07 00:20:01 +02:00
emixa-d 9fab5d594c
Add "MINETEST_MOD_PATH" environment variable (#11515)
This adds an environment variable MINETEST_MOD_PATH.
When it exists, Minetest will look there for mods in addition to ~/.minetest/mods/.
2021-10-07 00:19:41 +02:00
Wuzzy bc71622d21
Fix crash when calling remove/kick/ban_player on start (#11672) 2021-10-05 21:53:47 +02:00
Jude Melton-Houghton 5aa95fef10
Make MetaDataRef:get return nil instead of nothing (#11666) 2021-10-05 15:38:33 +03:00
Wuzzy 4fca601e0c
Add get_server_max_lag() (#11671) 2021-10-05 15:35:55 +03:00
Wuzzy 21113ad410
Split liquid_viscosity to liquid_viscosity and move_resistance (#10810) 2021-10-01 16:21:24 +02:00
sfan5 e0529da5c8 Fix trivial typos 2021-09-19 13:54:20 +02:00
sfan5 75bf9b75ca
Make sure relevant std::stringstreams are set to binary 2021-09-11 21:06:57 +02:00
sfan5 766e885a1b
Clean up/improve some scriptapi error handling code 2021-09-10 23:16:46 +02:00
sfan5 bbfae0cc67
Dynamic_Add_Media v2 (#11550) 2021-09-09 16:51:35 +02:00
sfan5 6a1424f2b1
Async-related script cleanups 2021-08-28 12:15:12 +02:00
savilli 3f1adb49ae
Remove redundant on_dieplayer calls 2021-08-28 12:14:16 +02:00
NeroBurner 1d69a23ba4
Joystick sensitivity for player movement (#11262)
This commit deprecates the forward, backward, left, and right binary
inputs currently used for player movement in the PlayerControl struct.
In their place, it adds the movement_speed and movement_direction
values, which represents the player movement is a polar coordinate
system.

movement_speed is a scalar from 0.0 to 1.0. movement_direction is
an angle from 0 to +-Pi:

	       FWD
	        0
	        _
	 LFT   / \   RGT
	-Pi/2 |   | +Pi/2
	       \_/
	       +-Pi
	       BCK

Boolean movement bits will still be set for server telegrams and
Lua script invocations to provide full backward compatibility.
When generating these values from an analog input, a direction is
considered active when it is 22.5 degrees away from either
orthogonal axis.

Co-authored-by: Markus Koch <markus@notsyncing.net>
Co-authored-by: sfan5 <sfan5@live.de>
2021-08-27 20:24:24 +02:00
SmallJoker 0c1e9603db
HUD: Reject and warn on invalid stat types (#11548)
This comes into play on older servers which do not know the "stat" type.
Warnings are only logged once to avoid spam within globalstep callbacks
2021-08-21 20:04:04 +02:00
sfan5 e7b05beb7d
Validate staticdata and object property length limits (#11511)
Some games provide users with enough freedom to create items
with metadata longer than 64KB, preventing this from causing
issues is on them but we'll still do the minimum not to abort
the server if this happens.
2021-08-19 20:14:22 +02:00
hecks 80d12dbedb
Add a simple PNG image encoder with Lua API (#11485)
* Add a simple PNG image encoder with Lua API
Add ColorSpec to RGBA converter
Make a safety wrapper for the encoder
Create devtest examples

Co-authored-by: hecktest <>
Co-authored-by: sfan5 <sfan5@live.de>
2021-07-29 05:10:10 +02:00
sfan5 6e8aebf432
Add bold, italic and monospace font styling for HUD text elements (#11478)
Co-authored-by: Elias Fleckenstein <eliasfleckenstein@web.de>
2021-07-27 19:11:46 +02:00
hecks 1d25d1f7ad
Refactor video driver name retrieval (#11413)
Co-authored-by: hecktest <>
2021-07-11 09:50:34 +02:00
Warr1024 52128ae11e
Add API for mods to hook liquid transformation events (#11405)
Add API for mods to hook liquid transformation events

Without this API, there is no reliable way for mods to be
notified when liquid transform modifies nodes and mods are
forced to poll for changes.  This allows mods to detect
changes to flowing liquid nodes and liquid renewal using
event-driven logic.
2021-07-09 09:08:40 -04:00
SmallJoker 062fd2190e
Auth API: Error when accessed prior to ServerEnv init (#11398) 2021-06-30 20:42:26 +02:00
SmallJoker f2fd443262
Inventory: Make addList() consistent (#11382)
Fixes list clearing for inv:set_list() using same size, since 2db6b07.
addList() now clears the list in all cases. Use setSize() to resize without clearing.
2021-06-30 20:39:38 +02:00
SmallJoker 2db6b07de1
Inventory: show error on invalid list names (#11368) 2021-06-20 17:21:50 +02:00
sfence b10091be9b
Add min_y and max_y checks for Active Block Modifiers (ABM) (#11333)
This check can be used by ABM to reduce CPU usage.
2021-06-20 17:21:35 +02:00
sfan5 edf098db63 Drop --videomodes, fullscreen_bpp and high_precision_fpu settings
These have been pointless for a while.
2021-06-16 17:41:34 +02:00
DS 8f085e02a1
Add metatables to lua vectors (#11039)
Add backwards-compatible metatable functions for vectors.
2021-06-04 21:22:33 +02:00
SmallJoker c9144ae5e2
Add core.compare_block_status function (#11247)
Makes it possible to check the status of the mapblock in a future-extensible way.
2021-05-30 20:24:12 +02:00
sfan5 a0047d6edc script: Replace calls to depreated luaL_openlib 2021-05-30 11:40:14 +02:00
sfan5 b56a028d6b Fix curl_timeout being ignored for Lua HTTP fetches 2021-05-17 17:12:30 +02:00
Loic Blot 225d4541ff fix: extractZipFile is not part of Client but more generic.
This solve a crash from mainmenu while extracting the zip
2021-05-06 16:01:52 +02:00
Loic Blot de85bc9227 fix: some code tidy about includes & irr namespaces 2021-05-03 19:49:19 +02:00
Loic Blot 48d5abd5be refacto: remove get_gui_env & draw_load_screen from RenderingEngine singleton 2021-05-03 19:49:19 +02:00
Loic Blot ccdd886e27 refacto: Hud: make driver, client, player, inventory, tsrc private & drop unused guienv
also fix c_content.h, on client it includes the src/client/hud.h instead of src/hud.h, which leads to wrong file dependency on the lua stack
2021-05-03 19:49:19 +02:00
Loic Blot 258101a910 refacto: RenderingEngine is now better hidden
* No more access to the singleton instance from everywhere (RenderingEngine::get_instance dropped)
* RenderingEngine::get_timer_time is now non static
* RenderingEngine::draw_menu_scene is now non static
* RenderingEngine::draw_scene is now non static
* RenderingEngine::{initialize,finalize} are now non static
* RenderingEngine::run is now non static
* RenderingEngine::getWindowSize now have a static helper. It was mandatory to hide the global get_instance access
2021-05-03 19:49:19 +02:00
Loic Blot e34d28af9f refacto: rendering engine singleton removal step 1 (filesystem)
Make the RenderingEngine filesystem member non accessible from everywhere

This permits also to determine that some lua code has directly a logic to extract zip file. Move this logic inside client, it's not the lua stack role to perform a such complex operation

Found also another irrlicht <1.8 compat code to remove
2021-05-03 19:49:19 +02:00
Vincent Robinson 074e6a67de
Add `minetest.colorspec_to_colorstring` (#10425) 2021-04-23 21:37:24 +02:00
sfan5 623f0a8613 Isolate library tables between sandbox and insecure env 2021-04-18 16:06:42 +02:00
sfan5 0abc1e98ed
Fix server favorites not saving when client/serverlist/ doesn't exist already (#11152) 2021-04-09 22:36:10 +02:00
SmallJoker f4118a4fde
Consistent title bar + render information in mainmenu (#10764) 2021-03-30 21:49:15 +02:00
Vitaliy 3b78a22371
Degrotate support for mesh nodes (#7840) 2021-03-30 00:25:11 +02:00
sfan5 2da1eee394
Fix broken `BiomeGen` abstraction (#11107) 2021-03-23 15:43:26 +01:00
SmallJoker 05719913ac
Schematic: Properly deal with before/after node resolving and document (#11011)
This fixes an out-of-bounds index access when the node resolver was already applied to the schematic (i.e. biome decoration).
Also improves the handling of the two cases: prior node resolving (m_nodenames), and after node resolving (manual lookup)
2021-03-20 13:02:15 +01:00
sfan5 bf8fb2672e
Use place_param2 client-side for item appearance & prediction (#11024) 2021-03-09 00:56:53 +01:00
sfan5 ac8ac19169
Protect mg_name and mg_flags from being set by Lua (#11010) 2021-03-04 20:38:28 +01:00
SmallJoker 3a2f55bc19 Settings: Push groups in to_table as well 2021-03-01 12:14:41 +01:00
rubenwardy f85e9ab925
Add nametag background setting and object property (#10937) 2021-02-17 19:51:28 +00:00
rubenwardy a8f6befd39
Fix short_description fallback order (#10943) 2021-02-17 18:53:44 +00:00
rubenwardy 3a8c37181a
Use consistent temp folder path (#10892) 2021-02-07 15:27:24 +00:00
rubenwardy fbb9ef3818
Reduce ore noise_parms error to deprecation warning (#10921)
Fixes #10914
2021-02-06 13:46:45 +01:00
sfan5 c834d2ab25 Drop wide/narrow conversion functions
The only valid usecase for these is interfacing with OS APIs
that want a locale/OS-specific multibyte encoding.
But they weren't used for that anywhere, instead UTF-8 is pretty
much assumed when it comes to that.
Since these are only a potential source of bugs and do not fulfil
their purpose at all, drop them entirely.
2021-02-02 20:46:08 +01:00
sfan5 40ad976753 Revise dynamic_add_media API to better accomodate future changes 2021-02-01 23:00:13 +01:00
sfan5 a01a02f7a1 Preserve immortal group for players when damage is disabled 2021-01-31 20:38:12 +01:00
sfan5 112a6adb10
Cache client IP in RemoteClient so it can always be retrieved (#10887)
specifically: after the peer has already disappeared
2021-01-31 20:36:47 +01:00
rubenwardy 6e0e0324a4
Fix minetest.dig_node returning true when node isn't diggable (#10890) 2021-01-31 18:49:51 +00:00
sfan5 83229921e5 Rework use_texture_alpha to provide three opaque/clip/blend modes
The change that turns nodeboxes and meshes opaque when possible is kept,
as is the compatibility code that warns modders to adjust their nodedefs.
2021-01-29 17:34:41 +01:00
sfan5 edd8c3c664 Drop never documented 'alpha' property from nodedef
Includes minimal support code for practical reasons.
We'll need it for a slightly different purpose next commit.
2021-01-29 17:34:41 +01:00
SmallJoker 2760371d8e Settings: Purge getDefault, clean FontEngine 2021-01-29 17:32:35 +01:00
SmallJoker 37a05ec8d6 Settings: Proper priority hierarchy
Remove old defaults system
Introduce priority-based fallback list
Use new functions for map_meta special functions
Change groups to use end tags

Unittest changes:
 * Adapt unittest to the new code
 * Compare Settings objects
2021-01-29 17:32:35 +01:00
rubenwardy 4c76239818
Remove dead code (#10845) 2021-01-22 15:09:26 +00:00
rubenwardy 67aa75d444
Use JSON for favorites, move server list code to Lua (#10085)
Co-authored-by: sfan5 <sfan5@live.de>
2021-01-22 15:08:57 +00:00
rubenwardy 4fcd000e20
MgOre: Fix invalid field polymorphism (#10846) 2021-01-21 19:08:06 +00:00
Zughy 45ccfe26fb
Removed some obsolete code (#10562)
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2021-01-21 18:17:09 +00:00
Zughy ea5d6312c1
ObjectRef: fix some v3f checks (#10602) 2021-01-21 18:37:38 +01:00
JDiaz 08ee9794fb
Implement on_rightclickplayer callback (#10775)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2021-01-11 18:03:31 +01:00
rubenwardy edd0836011
ContentDB: Add overwrite dialog when content is already installed (#10768) 2021-01-04 15:18:31 +00:00
hecks dd5a732fa9
Add on_deactivate callback for luaentities (#10723) 2021-01-02 15:14:29 +01:00
Elias Fleckenstein 9250b5205a
Add minetest.get_objects_in_area (#10668) 2020-12-29 16:50:09 +01:00
Lars Mueller 8f72d4b294 Fix minetest.is_nan 2020-12-24 22:07:04 +01:00
sfan5 74762470b2 Fix some minor code issues all over the place 2020-12-24 13:44:54 +01:00
rubenwardy 2c3593b51e Fix unsafe cast in l_object 2020-12-23 22:24:58 +00:00
rubenwardy 664f5ce960
Add open user data button to main menu (#10579) 2020-12-19 13:27:15 +00:00
SmallJoker fca4db4184
ObjectRef: Re-add legacy code for set_physics_override (#10585)
These arguments are used at least by MTG beds and homedecor_common. A deprecation warning is shown to safely remove it in a future release.
2020-11-10 21:02:53 +01:00
Zughy 72b93ec0d7
Fix ObjectRef errors due to lua_isnil() (#10564)
Treat 'none' values as 'nil'
2020-11-04 21:43:18 +01:00
SmallJoker 9c9344ceb3 Fix incorrect deprecation hints
"good" and "bad" were swapped in the process, resulting in wrong deprecation messages
2020-11-01 12:52:14 +01:00
rubenwardy 89dd05fdf3
Fix segfault in deprecation logging due to tail call, log by default (#10174) 2020-10-31 18:19:23 +00:00
luk3yx 61a196378f
Fix CSMs on arm64 (#10553) 2020-10-25 18:01:39 +01:00
Zughy 33b2c5f5b1
Clean up l_object.cpp (#10512)
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2020-10-22 16:18:01 +01:00
sfan5 660115c1ab
Decouple entity minimap markers from nametags replacing with show_on_minimap property (#10443) 2020-10-19 20:38:15 +02:00
Zughy 7499ebe46a
Fix float argument check in minetest.set_timeofday() (#10483)
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2020-10-13 20:28:53 +01:00
Zughy 2341a4aff1
Add ObjectRef:get_children() (#10480)
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2020-10-13 20:27:52 +01:00
JosiahWI 11f3deb9c4
Pass ContentFeatures as reference to read_content_features (#10464) 2020-10-13 16:36:01 +01:00
Zughy 272b72361a
Add missing type check to InvRef:set_lists() (#10476) 2020-10-11 13:36:13 +02:00
DS f3ae45b2b2
Add a short_description to be used by mods (#8980) 2020-10-09 19:11:21 +01:00
HybridDog 2f4037752b
Add minetest.get_artificial_light and minetest.get_natural_light (#5680)
Add more detailed light detection functions, a function to get the artificial light (torches) and a function to get the sunlight as seen by the player (you can specify timeofday).

Co-authored-by: rubenwardy <rw@rubenwardy.com>
2020-10-06 20:49:46 +02:00
SmallJoker f46509d5e2
Remove unused functions reported by cppcheck (#10463)
Run unused functions reported by cppcheck

This change removes a few (but not all) unused functions.
Some unused helper functions were not removed due to their complexity and potential of future use.
2020-10-05 09:07:33 +02:00
Pierre-Yves Rollo 81c66d6efb Minimap as HUD element with API control
Features:
 * Define Minimap available modes (surface/radar, scale) from Lua, using player:set_minimap_modes()
 * New HUD elements for displaying minimap with custom size and placing
 * New minimap mode for displaying a texture instead of the map
2020-10-04 15:24:34 +02:00
Jordan Snelling 3068853e8a
Add First Person Attachments (#10360)
Fixes some other third person camera specific attachments.
Implements a single new flag for entities to be forced visible in first person mode.
Old mods do not need to be updated to use the new flag and are fully backwards compatible.
2020-10-04 15:10:34 +02:00
rubenwardy 3250b37e32
Deprecate get_player_velocity and add_player_velocity (#10173) 2020-10-04 00:33:45 +01:00
rubenwardy 9ec75d7765
Clean up server-side translations, remove global variable (#10075) 2020-09-16 14:51:11 +01:00
karamel59 d052593c7a
Lua API: Register missing get_texture_mod function (#10338) 2020-08-27 21:47:38 +02:00
ANAND 291a6b70d6 Allow binding dig, place actions to keys; remove LMB/RMB hardcoding
Co-authored-by: Sam Caulfield <sam@samcaulfield.com>
2020-08-15 12:19:20 +03:00
Lars Müller 1c38027c3a
Fix precision not working in hud_change (#10186) 2020-08-12 11:51:50 +02:00
Lejo 715a123a33
Add PUT and DELETE request + specific method value to HTTP API (#9909) 2020-07-29 23:16:21 +02:00
Hugues Ross 3ce03d1c2a
Sanitize world directory names on create. Keep original name separate (#9432)
Blacklisted characters are replaced by '_' in the path. The display name is stored in world.mt, and duplicate file names are resolved by adding an incrementing suffix (_1, _2, _3, etc).
2020-07-28 19:16:57 +02:00
Lars Müller 82731d0d3d
Revert "Auto delete MetaData when = 0 (#8770)" (#10183)
This reverts commit 808eb4c571.
2020-07-16 19:11:24 +02:00
sfan5 4b4513a67d
Implement grouped mode for find_nodes_in_area (#9888)
plus general improvements to find_node_* functions
2020-07-14 22:36:53 +02:00
sfan5 70df3d54f3 Quick workaround for crashing destructor on Mingw32
closes #10137
2020-07-09 22:01:46 +02:00
rubenwardy 4cb18d4874
Fix HTTP API not being available in async mainmenu (#10086) 2020-06-22 14:40:04 +01:00
rubenwardy 0f1f8e4a0f
Add warning when disabling secure.enable_security (#9943) 2020-06-20 13:21:38 +01:00
Danila Shutov 3a6dfda358
Make shading of CAOs optional (#10033) 2020-06-16 20:48:31 +01:00
Lars Müller e7e065f553
Exposing the zoom key to Lua API (#9903)
Co-authored-by: Raul Ferriz <raul.ferriz@gmail.com>
2020-06-13 22:46:20 +02:00
sfan5 2424dfe007
Server pushing media at runtime (#9961) 2020-06-13 19:03:26 +02:00
Paul Ouellette b16f841756
LuaItemStack: Add __tostring metamethod (#8785)
* LuaItemStack: Add __tostring metamethod

* Clean up LuaItemStack::checkobject
2020-06-09 19:37:25 +02:00
Paul Ouellette 09f9e465e7 Fix Lua panic when error() message is not a string 2020-06-07 18:14:40 +02:00
rubenwardy 60bab8b2d7
Add HTTP API to main menu (#9998) 2020-06-06 17:17:08 +01:00
SmallJoker 42a9b45c21
Lua API: Log incorrect parameter types as error (#9954)
Incorrect parameter types are logged as errors, taking coercion into account.
This is a workaround to ensure mod compatibility.
Duplicate warnings are ignored per server instance.
2020-06-01 19:02:15 +02:00
sfan5 471e567657 Value copy / allocation optimizations mostly in server, SAO and serialize code 2020-05-27 21:58:40 +02:00
sfan5 9d6e7e48d6 Implement spawning particles with node texture appearance 2020-05-23 22:52:21 +02:00
sorcerykid 15ba75e4cf Add on_authplayer callback and 'last_login' to on_joinplayer (#9574)
Replace on_auth_fail callback with more versatile on_authplayer
    Better clarify account login process in Lua API documentation
    Change initial timestamp for newly registered accounts to -1
2020-05-23 13:25:29 +02:00
Awkor 037422fdba
Modernize include guards and add missing ones (#9898) 2020-05-23 13:23:05 +02:00
Lejo1 e79bc40c0a Check for valid base64 before decoding (#9904) 2020-05-22 14:26:22 +02:00
sfan5 1357ea1da2
Cleanup of particle & particlespawner structures and code (#9893) 2020-05-22 13:23:25 +02:00
Paramat 42fcfb75e8
Allow more than 255 biomes, document new maximum (#9855)
Change biomemap data type from u8 to u16.
New technical (not practical) maximum is 65535 biomes.
2020-05-20 22:16:14 +01:00
sfan5 732c8008f4 CSM: Fix crashing minetest.get_item_def()
fixes #9884
2020-05-20 20:15:09 +02:00
Wuzzy c94d37827d
Rework functionality of leveled nodes (#9852)
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2020-05-19 21:08:37 +02:00
rubenwardy a9c3a42323
Add core.open_url() to main menu API (#8592) 2020-05-17 19:09:10 +01:00
sfan5 36d35f2fe3
CSM: Bugfixes to camera:get_pos() and camera:get_fov()
closes #9857
2020-05-14 21:16:45 +02:00
Lars Müller 9ba24f89f5
Damage texture modifier (#9833)
Adds a new object property "damage_texture_modifier"
2020-05-11 21:41:36 +02:00
Wuzzy 6e1372bd89
Add support for statbar “off state” icons (#9462)
This adds support for optional “off state” icons for statbars. “off state icons” can be used to denote the lack of something, like missing hearts or bubbles.

Add "off state" textures to the builtin statbars.

Co-authored-by: SmallJoker <mk939@ymail.com>
2020-05-11 21:40:45 +02:00
Loïc Blot 454dbf83a9
Server class code cleanups (#9769)
* Server::overrideDayNightRatio doesn't require to return bool
There is no sense to sending null player, the caller should send a valid object

* Server::init: make private & cleanup
This function is always called before start() and loads some variables which can be loaded in constructor directly.
Make it private and call it directly in start

* Split Server inventory responsibility to a dedicated object

This splits permit to found various historical issues:
* duplicate lookups on player connection
* sending inventory to non related player when a player connects
* non friendly lookups on detached inventories ownership

This reduce the detached inventory complexity and also increased the
lookup performance in a quite interesting way for servers with thousands
of inventories.
2020-05-07 22:38:41 +02:00
sfan5 b6b80f55c8 Expose collided objects in moveresult
closes #9787
2020-05-06 14:03:52 +02:00
sfan5 c28fbd06a8 Fix remaining issues with mapgen scriptapi 2020-05-05 19:26:59 +02:00
sfan5 3c65d1acec Give the Mapgen on each EmergeThread its own Biome/Ore/Deco/SchemManager copy 2020-05-05 19:26:59 +02:00
SmallJoker cad5b987ad Sky API: Rename *_tint to fog_*_tint for consistency 2020-05-05 08:37:04 +02:00
SmallJoker 1b6f40c356 Rename moveresult speed to velocity 2020-05-05 08:37:04 +02:00
Lejo 808eb4c571
Auto delete MetaData when = 0 (#8770)
* Auto delete MetaData when = 0
2020-05-02 12:57:04 +02:00
ANAND e0ea87f1f3
set_fov: Add support for time-based transitions (#9705) 2020-05-02 12:52:11 +02:00
sfan5 ac368af4fe
Allow connection info to be missing from minetest.get_player_information() (#9739)
fixes #9352
This reverts commit 23c907befe.
2020-05-01 21:44:28 +02:00
Lejo 74d9b6010f
Give the online lua mainmenu also the client_list and mods (#8691) 2020-05-01 16:47:17 +02:00
sfan5 3475759d1a Expose collision information to LuaEntity on_step 2020-04-27 20:45:46 +02:00
Loïc Blot 91c4f7f0ea
Forbid object:attach(obj, ...) (#9762)
Fixes #9761
2020-04-27 11:27:27 +02:00
SmallJoker be71e70a91
Script: Enforce type checks if not nil (#9748)
* Script: Enforce type checks if not nil
2020-04-27 07:02:39 +02:00
sfan5 8a03097450 script: Put getGuiEngine() inside a client-only #ifdef 2020-04-27 06:58:34 +02:00
sfan5 f6f6dd140f script: Fix add_entity returning unusable ref if object deleted in on_activate 2020-04-27 06:58:34 +02:00
EvidenceB Kidscode cee3c5e73d
Add server side translations capability (#9733)
* Add server side translations capability
2020-04-25 07:20:00 +02:00
HybridDog 4361bfcb4d
Fix configuration caching in log_deprecated (#9697)
* Fix configuration caching in log_deprecated

The configured variable was never set to true.
I've set the variables to thread_local because the configuration should be reloaded after reentering the world from mainmenu.
2020-04-22 00:07:12 +02:00
sfan5 338195ff25
Fix alias handling of get_content_id (#9712)
fixes #9632
2020-04-19 19:07:54 +02:00
sfan5 87829cd744
script: Move SAO usability check so that it covers all functions (#9698)
see also 91eef646a5
2020-04-18 17:21:58 +02:00
Loïc Blot e8ac5a31cf
Optimize get_objects_inside_radius calls (#9671)
* Optimize getObjectsInsideRadius calls

our previous implementation calls the ActiveObjectMgr to return ids and then lookup those ids in the same map and test each object
Instead now we call the global map to return the pointers directly and we ask filtering when building the list using lamba.

This drop double looping over ranges of active objects (and then filtered one) and drop x lookups on the map regarding the first call results
2020-04-16 08:25:48 +02:00
sfan5 8ae8c1600a
Fix parsing JSON with large integers (#9674) 2020-04-15 08:01:28 +02:00
sfan5 2d5bd3bf79
scriptapi: Some small optimizations to value pushing (#9669) 2020-04-14 20:44:18 +02:00
Lars Müller af2e6a6a10
Improve waypoints and add image variant (#9480) 2020-04-11 22:09:46 +01:00
Hugues Ross f780bae05c
Formspecs: Add state-selection to style elements (#9378) 2020-04-11 21:39:30 +01:00
sfan5 ba3587e776 Fix broken config check in 659245a 2020-04-11 21:29:57 +02:00
Loïc Blot 5cc06e4748
Reduce ServerEnvironment propagation (#9642)
ServerEnvironment is a huge class with many accessors. In various places it's not needed

Remove it to reduce the ServerEnvironment view.

Idea here is to reduce size of some of our objects to transport lightweight managers and permit easier testing

Pathfinder is now tied to a generic map, not a ServerMap, it can be
ported to client
2020-04-11 19:59:43 +02:00
Loic Blot 5146086a64 Drop content_sao.{cpp,h}
Move LuaEntitySAO to a new dedicated file
Drop TestSAO (useless object)
Drop the old static startup initialized SAO factory, which was pretty useless.
This factory was using a std::map for 2 elements, now just use a simple condition owned by ServerEnvironment, which will be lightweight, that will also drop a one time useful test on each LuaEntitySAO creation. This should reduce server load on massive SAO creation
2020-04-11 16:07:17 +02:00
Loic Blot 894a34aef4 Move PlayerSAO to dedicated files 2020-04-11 16:07:17 +02:00
Loic Blot 6d43736172 Move serveractiveobject & unitsao
Move serverobject.{cpp,h} to server/serveractiveobject.{cpp,h}
Move UnitSAO class to dedicated files
2020-04-11 16:07:17 +02:00
sfan5 1292bdbbce Various features and fixes 2020-04-11 13:12:51 +02:00
sfan5 5f3a17eb65 Implement minetest.sound_fade() 2020-04-11 13:12:51 +02:00
sfan5 054c5dfaa3 scriptapi: Sort out ServerEnvironment / Environment distinction properly
The API implementation is shared between CSM and SSM.
Functions should retrieve a plain env when they do not
need any server-specific functions.
2020-04-11 13:12:51 +02:00
sfan5 f105bc8dc2 A few initialization cleanups 2020-04-11 13:12:51 +02:00
sfan5 659245acc7
Work around LuaJIT issues on aarch64 (#9614)
- Move the text segment below the 47-bit limit, needed for script_exception_wrapper which must be lightuserdata
- Replace CUSTOM_RIDX_SCRIPTAPI with full userdata
2020-04-08 20:14:08 +02:00
sfan5 de73f989eb
Overall improvements to log messages (#9598)
Hide some unnecessarily verbose ones behind --trace or disable them entirely.
Remove duplicate ones. Improve their contents in some places.
2020-04-08 20:13:23 +02:00
LNJ 307d7376cf
Fix 'the the' typos in comments (#9554) 2020-04-04 15:52:41 +02:00
HybridDog fd4daefb29
minetest.get_content_id: error if the node does not exist (#9458)
If a mod creator makes a typing mistake, this function now causes an error instead of returning the id of "ignore".
2020-03-11 16:25:14 +01:00
sfan5 7a7bfdca7c
minetest,get_connected_players: Return empty table at load time (#9493) 2020-03-10 20:32:04 +01:00
Jordan Snelling b9a0626d88
Fix star visilibity and documentation (since 946c03c6)
Fix memory leak (unused allocation)
Fix star rendering
Rename sky color struct
Fix stars on android
Remove extraneous .data() from android star draw
2020-03-08 16:13:36 +01:00
Jordach 946c03c69b set_sky improvements, set_sun, set_moon and set_stars 2020-03-05 20:12:19 +01:00
Wuzzy 580e7e8eb9 Fix pathfinder bugs: returning nil frequently, broken A*, jump through solid nodes (#9339)
* Fix pathfinder fail when startpos is over air
* Note down pathfinder restrictions
* Implement real A* search
* Pathfinder: Implement buildPath non-recursively
* Update find_path documentation
* Pathfinder: Check if jump path is unobstructed
* Pathfinder: Fix drop check first checking upwards
* Pathfinder: Return nil if source or dest are solid
* Pathfinder: Use priority queue for open list
2020-03-05 12:09:44 +01:00
sfan5 6d8e2d2483 Fix core.get_player_by_name() returning unusable ObjectRef
Followup to the previous commit.
2020-03-03 21:21:41 +01:00
sfan5 1761d7d0f8 Fix core.get_connected_players() returning unusable ObjectRefs
This bug is only exposed by 91eef646a5
independent of the move of get_connected_players from Lua to C++.
Previously, there would be a small time window where the SAO had
its peer ID set to PEER_ID_INEXISTENT but the RemotePlayer was
still linked to the SAO, resulting in an ObjectRef that crashed
on certain function calls (#9387).
2020-03-03 21:21:41 +01:00
sfan5 e2fc93022b Fix potential problem with core.get_connected_players() 2020-02-25 16:08:47 +01:00
sfan5 0b8d3f99a5 Move core.get_connected_players() implementation to C++
Keeping the ObjectRefs around in a table isn't ideal and this allows
removing the somewhat nonsensical is_player_connected() added in 86ef7147.
2020-02-23 22:24:12 +01:00
sfan5 c657fb343f Refactor Script API's log_deprecated 2020-02-23 22:24:12 +01:00
sfan5 4da057cc49 Script API: Document ObjectRef handling in a comment 2020-02-23 22:24:12 +01:00
sfan5 91eef646a5 Script API: Check that SAOs are still usable before attempting to use them 2020-02-11 19:21:12 +01:00
sfan5 ace3c76112 Improve core.sound_play with ephemeral sounds and player exclusion 2020-02-01 20:31:41 +01:00
SmallJoker cde2a7f6f2
Settings: Add get_flags API for mapgen flags (mg_flags, mgv6_spflags, ...) (#9284)
Unified flags handling in C++ and Lua Settings API
     -> Reading only, for now. Writing can be implemented later, if needed.
API function to read the currently active flags
     -> was impossible from Lua

Co-authored-by: Wuzzy <wuzzy2@mail.ru>
2020-01-25 16:56:54 +01:00
Wuzzy e05b7dbb3c Remove unused weight property from objects (#9320) 2020-01-22 10:19:27 +01:00
Montandalar 44458896d9 Use appropriate LC_ locale macro for Windows (#9230)
* Wrap LC_ macro in ifdef

Windows does not have LC_MESSAGES in locale.h, so use LC_ALL on that platform
2019-12-24 19:13:22 +01:00
SmallJoker aa8df112ff Attachments: Fix interpolation from (0,0,0) after detach
GenericCAO::getPosition() did not take the camera offset into account
LocalPlayer attachment cleanup: Use sane getParent() function
Make that getPosition() (GenericCAO and LocalPlayer) always return the absolute position
2019-12-07 15:12:26 +01:00
Pierre-Yves Rollo cf7fda0083 Add z-index management to HUD 2019-12-06 20:31:26 +00:00
sfan5 c44318a253 [CSM] Fix and improve minetest.get_language()
Previously this method would accidentally reset the locale
and break everything.
2019-11-11 14:06:48 +01:00
sfan5 2c4cf508a9 [CSM] Implement minetest.get_csm_restrictions()
fixes #8068
2019-11-11 14:06:48 +01:00
sfan5 682b9de824 Fix camera:get_offset() in CSM 2019-11-11 14:06:48 +01:00
sfan5 b57dc70769 [CSM] Expose more env functions 2019-11-11 14:06:48 +01:00
sfan5 b0260b5ec8 Refactor CSM restriction code a bit
This also fixes find_node_near restrictions being ineffective.
2019-11-11 14:06:48 +01:00
sfan5 4d668f32a6 Call on_secondary_use when object is right-clicked 2019-11-10 13:12:31 +01:00
sfan5 485b669840 [CSM] Remove non-functional minetest.get_day_count() 2019-11-09 16:08:38 +01:00
sfan5 b1f2a69382 Introduce get_modpath() for CSM 2019-11-09 16:08:38 +01:00
sfan5 82a2e02323 Load client mods into memory before execution.
Preperation for server-sent CSM which will eventually need this.
2019-11-09 16:08:38 +01:00
sfan5 5ab546f99b Refactor loading of Lua code with mod security 2019-11-09 16:08:38 +01:00
random-geek f2e62298a5 Change some usages of "deprecated" to "obsolete" (#9062)
"Deprecated" means that something is still in use, but is unsupported and needs to be removed.
"Obsolete" means it is already out of use.
2019-10-29 19:23:12 +01:00
Paul Ouellette 904b05b0d3 Allow calling ItemStack with no arguments (#8783) 2019-10-23 19:48:19 +02:00
SmallJoker 26b39f1eae
Fix some reference counters (memleak) (#8981)
Fix some reference counters (memleak)
Map::dispatchEvent: Allocation safety using references
2019-09-24 19:05:28 +02:00
sfan5 70f9e1aafa
Punchwear (improved) (#8959) 2019-09-22 22:12:21 +02:00
SmallJoker fec30e37ac
Fix AreaStore's IDs persistence (#8888)
Improve documentation
Read old formats
Fix free ID function. Return first gap in map
2019-09-21 17:54:52 +02:00
SmallJoker 5fa614d97e
Wieldhand: Specify which ItemStack to use (#8961)
Makes 'get_wield_item' to return the "main" ItemStack
2019-09-21 11:44:24 +02:00
Anand S 47da640d77 Add support for per-player FOV overrides and multipliers 2019-09-19 20:14:16 +02:00
SmallJoker 9acd36bf99 Formspecs: Introduce formspec_version to mods 2019-09-14 19:43:08 +02:00
SmallJoker b0baa698a4 CSM: Fix itemstack:get_meta() 'metadata' indexing error 2019-09-14 19:42:30 +02:00
SmallJoker 23677be951 Load CSM environment after the restrictions are known
Safety-guards for CSM callbacks to abort on a bad implementation
Only run callbacks when the mods are loaded (and with it: builtin)

Duplication checks inside constructors
2019-09-14 19:42:25 +02:00
SmallJoker 0b4f424f41
Inventory: Send dirty lists where appropriate (#8742)
This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time.

Raises protocol version to 38 to ensure correct backwards-compatible code.
2019-08-24 19:07:38 +02:00
Paul Ouellette 008b80fe1c Add ItemStack:get_description() to get tooltip (#8847) 2019-08-24 18:38:02 +02:00
upsilon b2065756cf Add function `minetest.read_schematic` 2019-08-14 13:15:41 +02:00
rubenwardy 91114b562f Add support for set_formspec_prepend in main menu (#8611) 2019-08-12 19:16:35 +02:00
Paul Ouellette 120155f312 Fix some issues with minetest.clear_craft (#8712)
* Fix some issues with minetest.clear_craft

- Fix memory leak
- Fix crafts with an output count not being cleared when clearing by
  input.
- Fix recipe list being reversed when clearing by input.

* Add CraftInput::empty()
2019-08-10 23:28:00 +02:00
Jozef Behran 86d7f84b89 Merge pull request #8776 from osjc/FixGetNode
Finish getNode cleanup
2019-08-10 19:45:44 +02:00
sfan5 cf64054390 Implement adding velocity to player from Lua
The intended usecase is knockback, but there's potential for more.
2019-08-10 19:44:27 +02:00
ANAND d1c27c7e80 Allow customizing chat message format (#8529) 2019-08-08 17:04:46 +01:00
SmallJoker e462a9a5ef
Unify wield item handling (#8677)
This moves the wield item functions to Player and the tool utils for range calculation
Also 'local_inventory' was removed due to redundancy in Client
2019-08-07 19:16:31 +02:00
Beha 4d7f296717 Do not add group values of zero to group lists. (#8751)
This fixes an issue where when the engine looked up groups (for example,
in ABM node names), NodeDefManager's m_group_to_items would contain nodes
with a group value of zero, resulting in nodes with flammable = 0 being
burned by a fire mod with a group:flammable checking ABM.

It brings consistency to the behaviour described in the api
documentation, where zero and nil groups should be the same.
2019-08-07 10:48:04 +02:00
Beha b8aaef704d Move the clamping of hp/breath when their maximums change to read_object_properties(). (#8689)
This prevents set_properties() calls that have nothing to do with hp_max or breath_max overriding the saved hp before another mod has the chance to set a player's intended hp_max (such as in on_joinplayer).
2019-07-30 17:29:45 +02:00
SmallJoker 8efa1de835 Check for 'action' field in ABMs & LBMs 2019-07-27 21:13:47 +02:00
y ecd20de64d Removed debug.upvaluejoin to prevent leak of insecure environment 2019-07-24 11:43:09 +02:00
SmallJoker cb00632e23
HTTP API: Allow binary downloads and headers (#8573)
Add minetest.features.httpfetch_binary_data
2019-06-06 19:13:29 +02:00
SmallJoker a2848c9cde Fix forgotten PlayerSAO cast in a90f2ef 2019-05-21 21:37:47 +02:00
ANAND ツ a90f2efb12 Check for out-of-bounds breath when setting breath_max (#8493) 2019-05-21 19:37:58 +02:00
SmallJoker cfef466d4e l_mapgen.cpp: Fix LINT broken since b1b40fe 2019-05-21 19:16:01 +02:00
Paramat b1b40fef16
Allow multiple cave liquids in a biome definition (#8481)
This allows games to specify biome cave liquids and avoid the old
hardcoded behaviour, but preserves the ability to have multiple
cave liquids in one biome, such as lava and water.

When multiple cave liquids are defined by the biome definition,
make each entire cave use a randomly chosen liquid, instead of
every small cave segment using a randomly chosen liquid.

Plus an optimisation:
Don't place nodes if cave liquid is defined as 'air'
2019-05-18 21:13:14 +01:00
ANAND ︻气デ═一 06a749c386 Move HTTP request logging to infostream (#8526) 2019-05-12 17:55:14 +01:00
sofar b839a6dd54 Force send a mapblock to a player (#8140)
* Force send a mapblock to a player.

Send a single mapblock to a specific remote player.

This is badly needed for mods and games where players are teleported
into terrain which may be not generated, loaded, or modified
significantly since the last player visit.

In all these cases, the player currently ends up in void, air, or
inside blocks which not only looks bad, but has the effect that the
player might end up falling and then the server needs to correct for
the player position again later, which is a hack.

The best solution is to send at least the single mapblock that the
player will be teleported to. I've tested this with ITB which does this
all the time, and I can see it functioning as expected (it even shows
a half loaded entry hallway, as the further blocks aren't loaded yet).

The parameter is a blockpos (table of x, y, z), not a regular pos.

The function may return false if the call failed. This is most likely
due to the target position not being generated or emerged yet, or
another internal failure, such as the player not being initialized.

* Always send mapblock on teleport or respawn.

This avoids the need for mods to send a mapblock on teleport or
respawn, since any call to `player:set_pos()` will pass this code.
2019-04-28 00:42:13 +01:00
Paul Ouellette 22ad820aa4 Add node field to PlayerHPChangeReason table (#8368) 2019-04-11 20:45:39 +01:00
ANAND 3deaa7cf57 Add deprecation warnings for ObjectRef:get/set_attribute (#8443) 2019-04-07 12:00:57 +02:00
rubenwardy 1e3e4fb649 HPChange Reason: Fix push after free, and type being overwritten (#8359)
* HPChange Reason: Fix push after free, and type being overwritten

Fixes #8227 and #8344
2019-03-12 08:56:56 +01:00
HybridDog 431d8a9b83 Abort when trying to set a not registered node (#7011)
I removed the MapNode constructor which takes a nodename and gives the node's id or CONTENT_IGNORE
The code which used this constructor (two places) now handles the situation of not registered nodes correctly:
* minetest.set_node and similar functions make minetest crash when a not registered node is passed
* reverting a node with rollback aborts if the node is not registered
2019-03-07 08:31:25 +01:00
rubenwardy 5d2624ab82 Hide uninstall package button on unmodifiable paths (#8255) 2019-03-05 08:12:58 +01:00
Loïc Blot 170dd409cb
Fix particle spawners not visible since CSM spawner implementation (#8289)
* Drop the ID mapper, use a big u64 instead. This will permit to resync server ids properly with the manager code
* Modernize some code parts (std::unordered_map, auto)
* generate id on client part on U32_MAX + 1 ids, lower are for server ids
2019-03-01 20:16:11 +01:00
Loïc Blot 111f1dc9c5 Revert "Revert CSM particles commit to fix particle spawner bug for 5.0.0 (#8288)"
This reverts commit 01cd63bd3b.
2019-02-26 08:53:53 +01:00
Paramat 01cd63bd3b
Revert CSM particles commit to fix particle spawner bug for 5.0.0 (#8288)
Reverts 5dab742645
"[CSM] Add functions to create particles and particlespawners."
2019-02-26 04:26:25 +00:00
rubenwardy a8311ad57f Fix extract zip writing lowercase files (#8221) 2019-02-14 20:03:45 +00:00
SmallJoker ffb17f1c9a Consistent HP and damage types (#8167)
Remove deprecated HUDs and chat message handling.
Remove unused m_damage variable (compat break).
HP: s32 for setter/calculations, u16 for getter.
2019-02-10 23:03:26 +00:00