Commit Graph

849 Commits

Author SHA1 Message Date
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