Commit Graph

66 Commits

Author SHA1 Message Date
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 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
Elias Fleckenstein 071ba77bb0 mcl_burning fully working 2021-01-01 19:25:47 +01:00
kay27 8eed6eaf4e Slightly optimize fire ignition by lava and make it more MC-like 2020-12-15 00:27:20 +04:00
kay27 15cb94b9b3 Close minor issues with fishing rod timing and permanent_flame alias, https://git.minetest.land/Wuzzy/MineClone2/issues/834 & https://git.minetest.land/Wuzzy/MineClone2/issues/836 2020-09-20 03:38:31 +04:00
Wuzzy ce0b31123b Increase smoke anim duration for fire smoke 2020-08-19 20:44:12 +02:00
Wuzzy c2afc82754 Disable some demanding particles by default
Fire smoke, lava droplets
2020-08-19 20:39:05 +02:00
Wuzzy 101391cbcc Fire nodes spawn smoke particles 2020-08-19 19:32:23 +02:00
Wuzzy 13963d00e5 Fix missing definition of age_next in mcl_fire 2020-08-05 18:04:37 +02:00
Wuzzy 728db50baf Fire doesn't destroy flammable=-1 nodes 2020-05-09 18:55:50 +02:00
Wuzzy 621946546b Ignite TNT by fire 2020-05-09 18:52:03 +02:00
Wuzzy ffcad31871 Update falling nodes when fire replaces a block 2020-05-09 17:53:32 +02:00
Wuzzy bfb1e3e447 Add age to of fire to greatly limit fire spread 2020-05-09 17:44:23 +02:00
Wuzzy 0929ce4f20 Remove fire below air 2020-04-22 01:31:30 +02:00
Wuzzy a1ea41e760 Lava: Don't ignite 2 blocks above if 1 layer above is blocked 2020-04-08 03:17:34 +02:00
Wuzzy c5e4ec5e27 Use ephemeral sounds 2020-04-07 00:55:45 +02:00
Wuzzy b56ead7a23 Don't allow to set fire on fire 2020-03-24 19:53:08 +01:00
Wuzzy 101c9b7322 Use minetest.LIGHT_MAX 2019-12-14 18:57:17 +01:00
Wuzzy ed336829b4 Fade out rain and fire sounds 2019-09-05 00:07:32 +02:00
Wuzzy ab81dfb4b4 Stop fire spread if enable_fire=false 2019-04-09 15:25:27 +02:00
Wuzzy 661e10e992 Fix crash when dying cuz fire, lava or magmablock 2019-03-15 07:10:18 +01:00
Wuzzy 86e5eb748f More fire fixes 2019-03-15 04:36:17 +01:00
Wuzzy f5c1e19781 Add help for disabled fire and translate 2019-03-15 04:25:54 +01:00
Wuzzy 049c632276 Generalize node damage death message 2019-03-08 21:59:16 +01:00
Wuzzy a29626881f New translation system, part 7: Items, part 3 2019-03-08 00:00:09 +01:00
Wuzzy aa3739528b Fix weird arguments given to is_protected 2019-02-11 21:27:17 +01:00
Wuzzy a918696509 Revert "Update fire help"
This reverts commit 954125f6e2.
2019-02-01 22:17:42 +01:00
Wuzzy 954125f6e2 Update fire help 2019-02-01 08:42:23 +01:00
Wuzzy 0586c0ea18 Destroy items in fire 2019-02-01 08:31:17 +01:00
Wuzzy e789801662 Replace getpos() with get_pos() 2019-02-01 06:33:07 +01:00
Wuzzy 16bb9b8901 Localize various unneeded global variables 2018-01-26 22:37:42 +01:00
Wuzzy b0c87f74fe Move world-related functions to mcl_worlds 2017-11-24 03:10:02 +01:00
Wuzzy b4f1d2c521 Move eternal fire ignition code to the actual node 2017-11-11 19:52:11 +01:00
Wuzzy 70198eb50b Allow to light Nether portal with any fire 2017-09-19 15:45:23 +02:00
Wuzzy d55f83346e Fire on bedrock in the End is now eternal 2017-09-08 15:28:38 +02:00
Wuzzy 16c1181a47 Destroy fire by flooding 2017-08-21 16:37:21 +02:00
Wuzzy 02f46da152 Fix some bugs WRT eternal fire spawning 2017-08-17 04:56:14 +02:00
Wuzzy 817c52f92f Fix bugs in flint and ssteel and ender eye 2017-08-17 04:12:34 +02:00
Wuzzy e5a34367c9 Use new Minetest settings API syntax for most mods 2017-08-09 16:17:00 +02:00
Wuzzy 69c8c36e35 Destroy a syntax failur in mcl_fire 2017-07-26 22:26:34 +02:00