Commit Graph

5900 Commits

Author SHA1 Message Date
cora 76b6815a7a Fix malformed client ready packet crashing server 2022-02-15 02:16:05 +01:00
erlehmann 18e299d923 Merge pull request 'ITEMS/mcl_fire: Fix fire spread to not freeze the game' (#234) from fix-fire into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/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
erlehmann 11469886e0 Merge pull request 'MAPGEN/mcl_structures: Add (theoretically) fireproof test structure' (#258) from add-fireproof-structure into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/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: https://git.minetest.land/Mineclonia/Mineclonia/pulls/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
erlehmann b1b96e3fac Merge pull request 'ITEMS/mcl_armor: Fix armor rendering when wearing pumpkin' (#244) from fix-pumpkin-armor-rendering-2 into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/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
erlehmann 3b92d060f4 Merge pull request 'HUD/mcl_inventory: Fix creative mode inventory search crash' (#237) from fix-creative-inventory-crash into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/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
erlehmann 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: https://git.minetest.land/Mineclonia/Mineclonia/pulls/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
Li0n_2 7ede0ca79a Merge pull request 'Fix shearsy wool typo in GROUPS.md' (#229) from JosiahWI/Mineclonia:fix-groups-typo into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/229
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-01-12 21:19:10 +00:00
JosiahWI e2e7e15b39
fix one character typo in GROUPS.md 2022-01-12 11:09:07 -06:00
cora 93a0879b40 Merge pull request 'MISC/mcl_selftests: Do not crash if minetest.find_nodes_in_area() lies' (#214) from fix-selftest-crash into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/214
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-12-20 22:42:59 +00:00
Nils Dagsson Moskopp 0b5fa14041 Do not crash if minetest.find_nodes_in_area() lies 2021-12-20 21:38:24 +01:00
cora 4f33f626f5 Merge pull request 'ITEMS/mcl_chests: Reskin chests as presents on December 24th to 26th' (#212) from add-christmas-chests into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/212
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-12-20 16:34:54 +00:00
Nils Dagsson Moskopp df7bd78af5
Add noise to christmas chest textures 2021-12-12 15:40:29 +01:00
Nils Dagsson Moskopp fe3e837e1b
Reskin chests as presents on December 24th to 26th 2021-12-11 18:17:53 +01:00
erlehmann 6f811b3cee Merge pull request 'ITEMS/mcl_chests: Spawn small chest entities only if animated chests are enabled' (#207) from fix-animchest-setting into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/207
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-12-11 14:27:24 +00:00
Elias Fleckenstein dfa56f229f
Spawn small chest entities only if animated chests are enabled 2021-12-10 22:15:53 +01:00
erlehmann ee77f33ea8 Merge pull request 'PLAYER/mcl_playerplus: send player object props only if changed' (#147) from fix-active-object-message-spam into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/147
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-12-09 09:31:09 +00:00
cora 5deaabdb47
Fix player bone positions and properties setting
The comparison and setting logic in the previous patch that set player
bone positions and properties conditionally incorrectly did not update
some values (like player eye level position) when they changed. This
patch fixes it and adds asserts to ensure the code works as intended.
2021-12-09 04:53:45 +01:00
cora d77f31eab8
Only set/send player properties if necessary
Before this patch, Mineclonia set (and therefore sent) player bone
positions and player properties in every globalstep. This results in
about 30 TOCLIENT_ACTIVE_OBJECT_MESSAGE per second per player. This
patch adds conditional functions to set bone positions and properties.
The functions set values only when they have changed, reducing traffic.
2021-12-09 04:26:22 +01:00
cora 10670d5c10 Merge pull request 'HUD/mcl_death_messages: Fix crash when skeleton kills player using bow' (#202) from fix-skelly-crash-2 into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/202
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-12-06 18:42:20 +00:00
Nils Dagsson Moskopp 609105e091
Add test cases for get_tool_name() 2021-12-06 04:11:55 +01:00
cora f9e3c4fd6d
Fix crash when skeleton kills player using bow
Commit 5252952555 used string.gsub() to
strip newlines from tools in death messages. The second return value of
string.gsub() (the number of substitutions) was erroneously returned too
by get_tool_name(). This bug caused a crash whenever a skeleton killed a
player using its bow.
2021-12-06 03:48:39 +01:00
cora d70c05e92c Merge pull request 'ITEMS/mcl_chests: Fix access to ender chest inventory without an ender chest' (#193) from EliasFleckenstein03/Mineclonia:enderchest-fix into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/193
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-12-04 13:25:26 +00:00
Elias Fleckenstein cacddd3fb4
Fix access to ender inventory without an ender chest 2021-12-03 21:23:10 +01:00
cora dd347c50c5 Merge pull request 'ITEMS/mcl_chests: Add debug command to show ender chest inventory formspec.' (#194) from add-enderchest-command into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/194
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-12-03 10:53:51 +00:00
Nils Dagsson Moskopp 54b36c42a9
Add debug command to show ender chest inventory formspec. 2021-12-02 19:44:22 +01:00
cora 5252952555 strip newlines from tools in death messages
Players naming their tools with newlines can mess up chat with death
messages. This commit strips out newlines (\r and \n ) in the tool
name for death messages.
2021-12-01 13:25:57 +00:00
Li0n_2 c08f9850f6 Merge pull request 'Add packed ice crafting recipe' (#180) from add-packed-ice-crafting-recipe into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/180
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2021-11-27 23:43:28 +00:00
Nils Dagsson Moskopp f8b5066c61
Add packed ice crafting recipe 2021-11-24 06:06:26 +01:00
erlehmann 4b9094ddc2 Merge pull request 'ITEMS/mcl_core: remove swiftness from egapps' (#177) from fix-egapp-speed into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/177
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-11-20 01:21:11 +00:00
cora 5087e8194a remove swiftness from egapps
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.
2021-11-20 02:14:16 +01:00
cora 71befcff10 Merge pull request 'ENTITIES/mcl_mobs: Give mobs sunburn at correct light level' (#175) from fix-mobs-burning-in-sunlight into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/175
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-11-19 20:27:55 +00:00