add fire dampener

master
Tai Kedzierski 2019-01-06 17:05:40 +00:00
parent 33ce65d19b
commit e6d600374c
4 changed files with 46 additions and 2 deletions

37
fire_dampener.lua Normal file
View File

@ -0,0 +1,37 @@
local enable_smoke = minetest.settings:get_bool("nssm_server.fire_smoke") ~= false
local function add_particles(pos, multiplier)
multiplier = multiplier or 1
minetest.add_particlespawner({
amount = 100*multiplier,
time = 1,
minpos = {x=pos.x-2, y=pos.y-1, z=pos.z-2},
maxpos = {x=pos.x+2, y=pos.y+4, z=pos.z+2},
minvel = {x=0, y=0, z=0},
maxvel = {x=1, y=2, z=1},
minacc = {x=-0.5,y=0.6,z=-0.5},
maxacc = {x=0.5,y=0.7,z=0.5},
minexptime = 2,
maxexptime = 3,
minsize = 3,
maxsize = 5,
collisiondetection = false,
vertical = true,
texture = "default_item_smoke.png",
})
end
minetest.register_abm({
label = "Dampen flame",
nodenames = {"fire:basic_flame"},
interval = 3,
chance = 6,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos, {name = "air"})
if enable_smoke then
add_particles(pos, 0.1)
end
end,
})

View File

@ -2,3 +2,4 @@ local modpath = minetest.get_modpath("nssm_server")
-- Server
dofile(modpath.."/mob_inhibitor.lua")
dofile(modpath.."/fire_dampener.lua")

View File

@ -10,10 +10,10 @@ Optionally, other nodes can benefit from the inhibition effect.
nssm_server = {}
local inhibition_radius = tonumber(minetest.settings:get("nssm.inhibition_radius")) or 8
local inhibition_radius = tonumber(minetest.settings:get("nssm_server.inhibition_radius")) or 8
-- Recommended ---> protector:protect,protector:protect2,cityblock:cityblock
local inhibition_nodes = minetest.settings:get("nssm.inhibition_nodes") or ""
local inhibition_nodes = minetest.settings:get("nssm_server.inhibition_nodes") or ""
inhibition_nodes = inhibition_nodes:split(",")

6
settingtypes.txt Normal file
View File

@ -0,0 +1,6 @@
# Smoke particles when fire is extenguished.
# On servers, might add lag
nssm_server.fire_smoke (Enable smoke around extinguishing fire) bool true
nssm_server.inhibition_radius (Radius of effect for mob inhibition nodes) int 8
nssm_server.inhibition_nodes (Itemstrings list of node that should inhibit mobs) string