1
0
mirror of https://github.com/minetest/minetest.git synced 2025-07-03 00:20:21 +02:00

493 Commits

Author SHA1 Message Date
9f7501d20a Handle writing to unloaded blocks in MMVManip::blitBackAll()
This could happen before and would just silently discard the data,
but now that Lua can create VManips without loading from map beforehand
we definitely need to handle this case.
2025-05-30 13:03:21 +02:00
6274a8dec4 Refactor MMVManip to get rid of m_loaded_blocks 2025-05-30 13:03:21 +02:00
41651c7317 Add C++-side unit tests for MMVManip 2025-05-30 13:03:21 +02:00
7892541383 Various random code cleanups 2025-03-04 19:53:01 +01:00
9dd09d1056 Prevent VoxelManipulator size overflow 2025-01-12 14:49:25 +01:00
4f800dd2b4 Change VoxelArea volume to be u32 2024-12-10 22:00:28 +01:00
d849d51c2d Replace licensing text in headers (LGPLv2.1) (#15321) 2024-10-28 15:57:39 +01:00
6d5103900f Some refactoring and fixes to VoxelArea and VoxelManip
In particular this validates the edges of VoxelArea and fixes
all the nonsense tests uncovered by it.
2024-10-12 22:37:17 +02:00
bc4ab8b99e General code refactoring/improvements in server, treegen and connection 2024-03-20 16:37:32 +01:00
dfba79f8ff Split servermap.cpp/h off from map.cpp/h 2024-03-20 16:37:32 +01:00
ef0009aea7 Sort out server destruction order
fixes #14421
2024-03-17 15:55:24 +01:00
0d4b489545 Detect air-only blocks instead of day/night differences (#14264)
* Detect air-only blocks instead day/night differences

* Write !is_air into the former day-night-diff bit on disk, so that old server can still read maps written by new servers

* Only set is_air bit when reading from disk
2024-02-22 21:47:42 -08:00
6ca214fefc Introduce std::string_view into wider use (#14368) 2024-02-17 15:35:33 +01:00
9da1354f3a Fix missing limit check for block y pos (#14320) 2024-01-30 21:51:51 +01:00
2ea8d9ca11 Fix out of range enum casts in deSerialize functions (#14090) 2024-01-17 20:05:46 +01:00
59abf1bb42 Allow active blocks to be generated (#14185) 2024-01-13 10:27:41 -08:00
bd42cc2c77 Ensure deterministic client occlusion culling and minor improvements (#14212)
* Ensure deterministic client occlusion culling
* Increase culling optimize distance slightly
* More accurate culling when sampling
2024-01-06 18:43:46 -08:00
22a1653702 Perform server occlusion check before a block is loaded or generated (#14148) 2023-12-29 21:53:27 +01:00
ca1a723890 Allow cheaper culling checks at a distance (#14073)
* Allow cheaper culling checks at a distance
* Pick a random ray, so that far missing block will eventually be shown
2023-12-16 15:04:21 -08:00
f5b35a074f Get rid of parent pointer in MapBlock 2023-12-16 12:51:42 +01:00
2ec3325381 Check if liquid can flow into empty node before picking it as source (#14057) 2023-12-08 21:13:18 +01:00
3b74cc4a41 Replace PP with direct printing 2023-06-26 22:51:32 +02:00
8f25f487fe Instrument touchMapBlocks and block loading/deserialization. (#13314) 2023-06-19 16:59:08 -07:00
1780d1bbde Use unique_ptrs for MapSector::m_blocks 2023-06-05 20:43:33 +02:00
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
DS
ed632f3854 Safely handle block deletion (#13315)
Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2023-03-24 12:34:44 +01:00
69fc206109 8x block meshes (#13133)
Reduce the number of drawcalls by generating a mesh per 8 blocks (2x2x2). Only blocks with even coordinates (lowest bit set to 0) will get a mesh.

Note: This also removes the old 'loops' algorithm for building the draw list, because it produces visual artifacts and cannot be made compatible with the approach of having a mesh for every 8th block without hurting performance.

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
Co-authored-by: Lars <larsh@apache.org>
Co-authored-by: sfan5 <sfan5@live.de>
2023-01-31 17:30:59 +01:00
d13b12b791 Store MapEditEvent blocks in a vector (#13071) 2022-12-24 12:21:59 -05:00
d1b80b462e Fix typos and en_US/en_GB inconsistency in various files (#12902) 2022-11-09 11:57:19 -05:00
322c8cf270 Reduce exposure of various internals (#12885)
* refactoring(StaticObjectList): don't expose m_active and m_stored anymore

This prevents our old crap code where anyone can access to StaticObjectList. use proper modifiers. It also permits to do a short cleanup on MapBlock using a helper

* refactoring(MapBlock): reduce a bit exposed m_active_blocks variable

* refactoring: MapBlock::m_node_timers is now private

We already had various helpers to perform this privatization, just use it. Also factorize the MapBlock stepping code for timers using already existing code and importing them from ServerEnvironment to MapBlock.

It's currently done pretty straight forward without any inheritance as MapBlock is just used everywhere, maybe in a future we'll have ServerMapBlock over MapBlock. Currently for a simple function let's just use proper objects and add a comment warning

* refactoring(Server): fix duplicated function for add/remove node

* refactoring(guiFormSpecMenu): add removeAll function to prevent duplicated code

* refactoring(ShadowRenderer) + perf: code quality  + increase performance

* All callers are already using the point and we should never test a function with nullptr node, it's a bug. Removed workaround which was hacky and fix the bug
* Drop clientmap lookup from shadowrendered, just use directly its
  pointer and forbid to push it in the generic list
* Reduce memory pressure on the renderShadowObject by preventing
  deallocating and reallocating multiple vectors on each node

* refactoring(MapBlock): reduce exposure of MapBlock::m_static_objects

It's not complete as some parts of the code are pretty nested, but it's better than before :)

* fix: better working on new functions & drop unwanted 2 lines

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2022-11-03 17:35:31 +01:00
dafdb3edb4 Check for falling float nodes in liquid transform (#12862) 2022-10-18 18:03:05 -04:00
8f996e4a7c Remove unused MapBlock functionality 2022-10-09 13:43:48 -04:00
9676364c1f Optimize lighting calculation (#12797) 2022-10-09 10:50:26 -04:00
f916398a54 Add lighting test and benchmark (#12802) 2022-09-26 06:49:08 -04:00
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
051181fa6e Enforce limits of settings that could cause buggy behaviour (#12450)
Enforces the setting value bounds that are currently only limited by the GUI (settingtypes.txt).
2022-07-09 22:32:08 +02:00
e16a470d59 Use unordered_map instead of map for MapSectors 2022-05-23 22:50:49 +02:00
f5a8593b11 Add more Prometheus metrics (#12274) 2022-05-09 21:20:58 +02:00
e7659883cc Async environment for mods to do concurrent tasks (#11131) 2022-05-02 20:56:06 +02:00
0b5b2b2633 Disentangle map implementations (#12148)
Fixes violation of Liskov substitution principle
Fixes #12144
2022-04-07 21:58:04 +02:00
11aab4198b Optimize swapping nodes with equivalent lighting 2022-03-29 18:06:44 +02:00
a9bccb964f Raise max mapgen limit constant to align with mapblock size 2022-01-30 13:49:26 +01:00
ecc6f4ba25 Remove a few unused functions reported by callcatcher (#11658) 2021-10-12 20:12:20 +02:00
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
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
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
4c76239818 Remove dead code (#10845) 2021-01-22 15:09:26 +00:00
e638056523 Allow configuring block disk and net compression. Change default disk level. 2020-12-15 10:15:25 -08:00
f1d72d212a Avoid generating the same chunk more than once with multiple emerge threads. 2020-11-26 20:31:20 -08:00
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