From 10595463449df42ef81684f7561773e9245f3a6a Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 4 Jun 2020 18:46:16 +0000 Subject: [PATCH] Add a setting to disable the random fire chance. (#18) --- init.lua | 6 ++++-- settingtypes.txt | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 settingtypes.txt diff --git a/init.lua b/init.lua index e254d22..5556c1b 100644 --- a/init.lua +++ b/init.lua @@ -22,6 +22,8 @@ lightning.auto = true -- range of the skybox highlight and sound effect lightning.effect_range = 500 +local random_fire = minetest.settings:get_bool("lightning_random_fire") ~= false + local rng = PcgRandom(32321123312123) -- table with playername as key and previous skybox as value @@ -167,7 +169,7 @@ lightning.strike = function(pos) return end -- very rarely, potentially cause a fire - if fire and rng:next(1,1000) == 1 then + if fire and random_fire and rng:next(1,1000) == 1 then minetest.set_node(pos2, {name = "fire:basic_flame"}) else minetest.set_node(pos2, {name = "lightning:dying_flame"}) @@ -232,4 +234,4 @@ minetest.after(5, function() minetest.after(rng:next(lightning.interval_low, lightning.interval_high), lightning.strike) end -end) \ No newline at end of file +end) diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..76152b9 --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,4 @@ +# When fire is enabled, this setting specifies whether the lightnings +# have a small chance to start a fire. +# Value 'false' will disable fire caused by lightnings. +lightning_random_fire (Enable random fire) bool true