Commit Graph

250 Commits

Author SHA1 Message Date
sfan5 c24a04d246 Optimize pushing collision data for entity on_step
Since this is fixed overhead for every entity, this is important to optimize.
This optimizes one very common case.

before:
  push_collision_move_result [us] _____________ 64512x   3.562

after:
  push_collision_move_result [us] _____________ 72636x   0.831
2024-05-03 16:28:29 +02:00
sfence 72cb4e9bea
Allow `nil` puncher in `object:punch` (#14319) 2024-04-28 17:55:04 +02:00
sfan5 df4c9e2903 Revert "Clean up some getServer() unsafety"
Turned out to not be a good idea.
This reverts commit 58eccc7a2a.
2024-04-28 00:24:22 +02:00
sfan5 58eccc7a2a Clean up some getServer() unsafety 2024-04-23 19:03:35 +02:00
rubenwardy b487341c32
Deprecate writing to mod directories (#14486) 2024-03-27 18:32:05 +00:00
rubenwardy 6c4a110679
Add world-independent storage directory for mods (#12315)
Fixes #4821
2024-03-24 17:18:58 +00:00
SmallJoker 61a5733692 Unittest: Add inventory callback tests 2024-03-16 20:14:05 +01:00
David Heidelberg 34286d77c7
Allow toggling touchscreen mode at runtime (#14075)
Signed-off-by: David Heidelberg <david@ixit.cz>
Co-authored-by: Gregor Parzefall <gregor.parzefall@posteo.de>
2024-02-22 15:44:49 +00:00
sfan5 ce97210eb1 Refactor how script api reads current mod name
This is to prevent future mistakes and make it clearer whether
the mod name can be trusted depending on how it is retrieved.
2024-02-15 11:06:21 +01:00
sfan5 3cac17d23e
Lua on each mapgen thread (#13092) 2024-02-13 22:47:30 +01:00
sfan5 1ba26d67bd Remove excessive includes from porting.h 2024-01-14 13:17:53 +01:00
sfan5 961652c2e9 Address some clang-tidy warnings 2023-12-25 10:07:28 +01:00
sfan5 c3114132d3
Improve readability and infos in verbose log (#13828) 2023-09-22 18:41:10 +02:00
rubenwardy c6a0ead72d
Add warning for initial properties directly inside definition (#9650) 2023-08-13 00:19:03 +01:00
numzero 3b74cc4a41 Replace PP with direct printing 2023-06-26 22:51:32 +02:00
sfan5 659828b142 Rename ModApiEnvMod and ModApiItemMod
The 'mod' could have meant module in the past but no other classes do this.
2023-06-23 09:05:26 +02:00
sfan5 524d446757 Minor script api fixes/cleanups 2023-06-23 09:05:26 +02:00
Desour e700182f44 Replace Optional with std::optional 2023-06-15 10:38:44 +02:00
Gregor Parzefall a857c46e6e
Make the settings GUI more usable on Android (#13543) 2023-06-05 12:01:54 +02:00
Thresher 00c647e4cc
Convert spaces to tabs (#13506)
* Convert spaces to tabs

* Desour reviews 1-3 fix

* Desour fixes

* Undo alignment changes
2023-05-26 15:13:57 +02:00
Desour 8b73743baa Reduce number of recursively included headers
This should improve compilation speed.

Things changed:
* Prefer forward-declarations in headers.
* Move header-includes out of headers if possible.
* Move some functions definitions out of headers.
* Put some member variables into unique_ptrs (see Client).
2023-04-27 18:50:33 +02:00
Riley Adams 73391013f7
Add node pos to node damage HP change reason (#13196) 2023-04-10 23:04:52 +01:00
DS 2180dc14ef
Fix safeLoadFile() skipping 2 chars too much from the shebang (#13310) 2023-03-27 20:01:05 +02:00
Jude Melton-Houghton 5c248c2d7d Add callback on_mapblocks_changed 2022-12-24 08:24:59 -05:00
Jude Melton-Houghton 0fc97a1483
Use a Lua error handler that calls tostring (#11913) 2022-12-15 07:37:49 -05:00
Jude Melton-Houghton d0a118f5b1
Add `minetest.get_game_info` and allow reading `game.conf` (#12989)
Co-authored-by: sfan5 <sfan5@live.de>
2022-11-28 07:21:43 -05:00
Jude Melton-Houghton dafdb3edb4
Check for falling `float` nodes in liquid transform (#12862) 2022-10-18 18:03:05 -04:00
Jude Melton-Houghton b38ffdec27
Implement vector and node conversion in Lua (#12609)
Co-authored-by: sfan5 <sfan5@live.de>
2022-10-18 18:01:44 -04:00
Jude Melton-Houghton 03428d9825
Modify PUC Lua to wrap C++ exceptions (#12445) 2022-09-26 07:23:48 -04:00
Jude Melton-Houghton 6f5a68b7f7
Allow getmetatable in CSM (#12776) 2022-09-18 17:32:18 +02:00
Wuzzy 1d04903c19
Add paramtype2s for 4 horizontal rotations and 64 colors (#11431)
4dir is like facedir, but only for 4 horizontal directions: NESW. It is identical in behavior to facedir otherwise. The reason why game makers would want to use this over facedir is 1) simplicity and 2) you get 6 free bits.
It can be used for things like chests and furnaces and you don't need or want them to "flip them on the side" (like you could with facedir).

color4dir is like colorfacedir, but you get 64 colors instead of only 8.
2022-09-16 13:18:55 +02:00
Herman Semenov 038da00e79
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-06 11:21:09 +01:00
AFCMS 6ec6acc539
Add `minetest.settings` to CSM API and allow CSMs to provide `settingtypes.txt` (#12131)
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2022-08-02 11:58:08 +02:00
sfan5 e9e721b937 Fix entity related bugs
* Make minetest.add_entity() binary-safe
* Fix on_death pushing dummy ObjectRef instead of nil
2022-06-15 17:20:07 +02:00
Lars Müller e7d4ec6834
on_deactivate: distinguish removal and unloading (#11931)
Sometimes you need to be able to do removal-related cleanup, such as removing files from disk, or entries from a database. staticdata obviously isn't suitable for large data. The data shouldn't be removed if the entity is unloaded, only if it is removed.
2022-06-11 20:01:14 +02:00
stefan bb671c3089 Remove debug.get/setmetatable from security whitelist
fixes #12216
2022-05-29 14:00:19 +02:00
sfan5 e7659883cc Async environment for mods to do concurrent tasks (#11131) 2022-05-02 20:56:06 +02:00
ShadowNinja 7993909fab Spacing fixes 2022-04-08 14:55:21 +01:00
Jude Melton-Houghton 06d197cdd0
Store vector metatable in registry 2022-03-29 18:07:00 +02:00
DS 8d387433b1
Fix the documentation of InvRef:get_lists() and clean up code (#12150) 2022-03-29 18:06:16 +02:00
sfan5 9a12e4499e Minor improvements to Lua sandbox 2022-01-15 17:45:08 +01: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 8472141b79
Restructure devtest's unittests and run them in CI (#11859) 2021-12-18 20:36:43 +01:00
Lejo b9051386ae
Add Lua bitop library (#9847) 2021-11-26 19:31:05 +01:00
sfan5 660e63dbae
Fix item duplication if player dies during interact callback (alternative) (#11662) 2021-10-25 20:30:27 +02: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 766e885a1b
Clean up/improve some scriptapi error handling code 2021-09-10 23:16:46 +02:00