The function dynamic_add_media() was changed in incompatible ways in
several minor versions of Minetest, breaking the display of handheld
maps in Minetest 5.5.0. This patch makes handheld maps display there.
The function was blocking with one argument in Minetest 5.3. It was also
blocking in Minetest 5.4, but took an additional argument for a function
to execute once the media had been received. Calling dynamic_add_media()
with a single argument had been deprecated; a function that did nothing
was provided in mcl_maps to satisfy the changed argument requirements.
In Minetest 5.5, dynamic_add_media() was changed to non-blocking. This
introduced a race condition in mcl_maps, where a client often tried to
display a map before it had received the map texture from the server.
Opening an issue on the Minetest issue tracker led to it being closed in
about 20 minutes: <https://github.com/minetest/minetest/issues/11997>
Before this patch, mcl_maps used mod storage to store a map id counter.
This made it possible to set map ids sequentially. However, mod storage
is not included in world downloads – which means that a world based on a
world download would start counting at zero and overwrite existing maps.
This patch changes map ids to be a combination of the Unix timestamp and
a random value. This makes it possible to have almost sequential map ids
without the need to store a map id counter.
Map textures are stored as files in a world directory and in item meta.
For a typical forest landscape, this adds up to 10kb to map item meta.
The main purpose of this is to allow maps to work in world downloads:
Maps are automatically restored when no textures are found on disk.
As a side effect, players will probably lag a bit if they fill their
inventory with many (shulkers full of) maps, but enchanted items or
books can be used for the same purpose already, so this is not new.
Saving PNGs can lead to a few kb of savings here, but would hinder
enhancements to mcl_maps that are based on updating the stored map,
as reading and writing TGA images is stupidly easy compared to PNG.
(Really, any bitmap format is about the same size zlib compressed.)
Note that any hypothetical future version of mcl_maps that changes the
storage format (e.g. to compressed PNM) or sends PNG maps to clients has
to include a TGA parser, to avoid breaking existing maps in user worlds.
Before this patch, when placing a fire above a node that would turn it
into eternal fire (e.g. Netherrack or Magma) the spawn_fire() function
would call itself infinitely via the on_construct() handler of eternal
fire – because the latter called spawn_fire() itself.
On an x86 machine, this caused a memory leak, hanging Minetest. On an
x86_64 machine though, Minetest crashed immediately, showing an error
message about a stack overflow.
Even the mitigated timers seem to have lead to slow
memory leaks. Once Minetest has used up all the RAM,
it will free some, then quickly use memory up again,
then repeat it ad nauseum, requiring 100% CPU. On a
PC with 2GB of RAM this could be reliably triggered
by having a fire burn a forest for 20 to 30 minutes.
This patch removes fire node timers completely and
instead extinguishes fire using an ABM.
This patch initializes the random number generator used in mcl_fire with
the current Unix timestamp. It also corrects two biases in fire spread
that were caused by nodes being iterated over in a predictable way.
Before this patch, wearing a pumpkin would make body armor render as a
corrupted item held in the player's left hand instead of on their body.
Some parts of their armor would also get rendered on the player's feet.
(cherry picked from commit 12192d1a8d)
Before this patch, growing a gourd (e.g. melon, pumpkin) would always
convert a node west of the node below the stem to dirt if belonged to
the group “dirtifies_below_solid”. This happened because of a loop in
which the variables floorpos and floor were re-used without setting a
new value … therefore, both floorpos and floor were always containing
the last values set in a previous loop instead of the correct values.
This patch fixes the problem by setting both variables in both loops.
The minetest world is already so small that you can reach world
border from spawn in about 2 hours. I think the regen and fire
resistance are good enough to make them special.