Commit Graph

826 Commits

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