Commit Graph

5925 Commits

Author SHA1 Message Date
Nils Dagsson Moskopp f0a925aa20
Display location of item frame in item frame map 2022-02-20 10:12:45 +01:00
Nils Dagsson Moskopp 16a68af119
Store mcl_maps textures in map item meta
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.
2022-02-20 10:12:44 +01:00
Nils Dagsson Moskopp 82a5708144
Display large player dot on maps for nearby player 2022-02-20 10:12:43 +01:00
Nils Dagsson Moskopp e24a38d864
Increase contrast of player marker on maps 2022-02-20 10:12:43 +01:00
Nils Dagsson Moskopp 62ee1267de
Add diagonal player marker to maps 2022-02-20 10:12:43 +01:00
Nils Dagsson Moskopp 9566ea58e3
Fix TGA file writing on Windows
Before this patch, the tga_encoder mod would write corrupted TGA files
on Windows: Bytes that looked like newlines were replaced by a carriage
return and a newline.
2022-02-20 10:12:42 +01:00
Nils Dagsson Moskopp c6436d7176
Reduce TGA filesize by 25% by using 16-bit colors 2022-02-20 10:12:41 +01:00
Nils Dagsson Moskopp ff249500a6
Speed up TGA encoding by creating fewer strings 2022-02-20 10:12:41 +01:00
Nils Dagsson Moskopp e20e264d8c
Use RLE compression in tga_encoder 2022-02-20 10:12:40 +01:00
Lizzy Fleckenstein 2110fccd9d
Add updated tga_encoder 2022-02-20 10:12:40 +01:00
AFCMS c5a5eaa96e
Update French translation of mcl_maps 2022-02-20 10:12:39 +01:00
Marcin Serwin ad2ce5c719
Update polish translation of mcl_maps 2022-02-20 10:12:39 +01:00
Marcin Serwin 5ef4a81683
Add polish translation of mcl_maps 2022-02-20 10:12:38 +01:00
AFCMS 8015cbc10c
Localize functions in mcl_maps 2022-02-20 10:12:38 +01:00
Lizzy Fleckenstein b6540c0d80
Add moving marker for the player 2022-02-20 10:12:37 +01:00
Lizzy Fleckenstein ea272c40a0
Add craft predict for map copying 2022-02-20 10:12:37 +01:00
Lizzy Fleckenstein ec23f89033
Fix tt snippet to update wield filled maps as well 2022-02-20 10:12:36 +01:00
Lizzy Fleckenstein 9e4d630987
Prevent placing of wielded maps 2022-02-20 10:12:35 +01:00
Lizzy Fleckenstein 8f077ff55b
Copy stack before accessing it in add_item 2022-02-20 10:12:35 +01:00
Lizzy Fleckenstein 697a37c266
Make it look like the player is holding the map in their hand 2022-02-20 10:12:34 +01:00
Lizzy Fleckenstein f3f2560b32
Make maps show their image when in itemframes 2022-02-20 10:12:34 +01:00
Lizzy Fleckenstein ad6ebad06f
Show empty map in creative inv, but don't show filled map there 2022-02-20 10:12:33 +01:00
Lizzy Fleckenstein d0b78d38f5
Implement copying maps 2022-02-20 10:12:33 +01:00
Lizzy Fleckenstein 8bee9270ef
Stack filled maps that have the same metadata 2022-02-20 10:12:33 +01:00
Lizzy Fleckenstein 7914ce72e4
Add API to create filled map 2022-02-20 10:12:32 +01:00
Lizzy Fleckenstein 1478b7ebea
Add Real Maps 2022-02-20 10:12:27 +01:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 18e299d923 Merge pull request 'ITEMS/mcl_fire: Fix fire spread to not freeze the game' (#234) from fix-fire into master
Reviewed-on: Mineclonia/Mineclonia#234
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2022-02-12 03:39:40 +00:00
cora f5ba6f5649
Fix memory leak & C stack overflow
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.
2022-02-11 17:44:11 +01:00
cora 4647710945
Extinguish fire without nearby “fuel” faster
This patch adjusts how often the ABM runs that removes fire nodes with
no adjacent nodes that can burn up. This makes fire linger less in air.
2022-02-11 17:44:10 +01:00
cora 5d09ec311c
Extinguish fire using an ABM instead of timers
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.
2022-02-11 17:44:09 +01:00
cora ef7370550f
Make fire spread direction truly random
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.
2022-02-11 17:41:42 +01:00
cora 6c2fb98160
Fix nodes with “flammable = -1” not catching fire 2022-02-07 04:51:27 +01:00
cora 052c9fcbcf
Fix diagonal fire-spread
In Minecraft fire spread logic, “adjacent” does not mean “diagonal”.
2022-02-07 04:51:06 +01:00
cora db8fbdc5dd
Fix beds burning away and dropping 2022-02-07 03:39:52 +01:00
cora 1b89c15193
Fix double nodes not being properly removed 2022-02-07 03:39:51 +01:00
cora 02fa2c9e07
Fix nodes that should not burn up burning up
Nodes with the group “flammable = -1” (e.g. crafting tables) must be
able to catch fire, but must not burn up. This patch adds checks for
this group.
2022-02-07 03:39:51 +01:00
cora c12076e74d
Reimplement basic Minecraft-like fire spread 2022-02-07 03:39:45 +01:00
cora 4deca628dc
Make fire actually remove nodes 2022-02-07 03:22:15 +01:00
cora df4ea94dbc
Add node timer back in so fires burn out 2022-02-07 03:22:02 +01:00
cora 8e8ccddb68
Replace MineClone2 fire with Minetest Game ABMs
ABMs have better performance than the laggy timer-based implementation.
2022-02-07 03:18:54 +01:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 11469886e0 Merge pull request 'MAPGEN/mcl_structures: Add (theoretically) fireproof test structure' (#258) from add-fireproof-structure into master
Reviewed-on: Mineclonia/Mineclonia#258
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-02-07 01:24:58 +00:00
Nils Dagsson Moskopp 96822be63d
Add (theoretically) fireproof test structure
This patch adds a new test structure to the “/spawnstruct” command which
can be spawned with this command: /spawnstruct test_structure_fireproof

The structure can be used to verify that eternal fire can be spawned by
the structure placement code. It can also be used to debug fire spread,
as according to Minecraft fire spread rules, it should be fireproof.

See <https://minecraft.fandom.com/wiki/Fire#Spread> for those rules.
2022-02-06 01:19:23 +01:00
cora 6abdbbbd13 Merge pull request 'ENTITIES/mcl_boats: Fix mob-in-boat crash in Minetest 5.5-dev' (#249) from fix-boat-crash-in-minetest-5.5-dev into master
Reviewed-on: Mineclonia/Mineclonia#249
Reviewed-by: cora <cora@noreply.git.minetest.land>
2022-01-27 00:50:08 +00:00
Nils Dagsson Moskopp f89c52dff6
Fix mob-in-boat crash in Minetest 5.5-dev
In Minetest 5.4.1, calling get_player_control() on a mob returned the
empty string. Minetest commit 5eb45e1ea03c6104f007efec6dd9c351f310193d
changed this, so now calling get_player_control() on a mob returns nil.

As mcl_boats defines boats that can have a player or a mob as a driver,
code like the following crashes with a changed get_player_control() API:

local ctrl = driver:get_player_control()
if ctrl.sneak then
    detach_object(driver, true)
end

Furthermore, once a world has crashed, joining it near a mob that is the
driver of a boat with such control code immediately crashes again.

When I reported this bug to Minetest, several Minetest core developers
stated that they disliked the old API and proposed other return values
for calling a mob's get_player_control() function – all different from
the empty string. Since I have some doubts that this bug will be fixed
in Minetest 5.5.0, boat code must take into account a nil return value.

Minetest issue: https://github.com/minetest/minetest/issues/11989
2022-01-26 18:25:08 +01:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. b1b96e3fac Merge pull request 'ITEMS/mcl_armor: Fix armor rendering when wearing pumpkin' (#244) from fix-pumpkin-armor-rendering-2 into master
Reviewed-on: Mineclonia/Mineclonia#244
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-01-23 19:59:13 +00:00
epCode 6bfb97842f
Fix armor rendering when wearing pumpkin
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)
2022-01-23 20:11:55 +01:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 3b92d060f4 Merge pull request 'HUD/mcl_inventory: Fix creative mode inventory search crash' (#237) from fix-creative-inventory-crash into master
Reviewed-on: Mineclonia/Mineclonia#237
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-01-22 16:49:19 +00:00
Nils Dagsson Moskopp f975055464
Fix creative mode inventory search crash
Before this patch it was possible for any user to to crash Minetest in
creative mode. This was possible because queries in the search field
were interpreted as search patterns for string.find().

A search for a single square bracket would reliably crash the server.
Also, a search for 6000 times the string “a?” would hang the server.

The solution to both bugs is to not interpret the query as a pattern.
2022-01-21 23:31:25 +01:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 23f1c51912 Merge pull request 'ITEMS/mcl_farming: Convert correct floor node to dirt as gourd grows' (#231) from fix-gourd-farmland-dirtification into master
Reviewed-on: Mineclonia/Mineclonia#231
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-01-15 22:07:24 +00:00
Nils Dagsson Moskopp 4d02af8c94
Convert correct floor node to dirt as gourd grows
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.
2022-01-13 07:29:57 +01:00