2020-12-30 00:08:38 +03:00
|
|
|
local S = minetest.get_translator("mcl_burning")
|
2021-01-01 21:25:47 +03:00
|
|
|
local modpath = minetest.get_modpath("mcl_burning")
|
|
|
|
|
|
|
|
mcl_burning = {
|
|
|
|
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8
|
|
|
|
}
|
|
|
|
|
2021-02-22 12:55:14 +03:00
|
|
|
dofile(modpath .. "/api.lua")
|
2021-01-01 21:25:47 +03:00
|
|
|
|
|
|
|
minetest.register_entity("mcl_burning:fire", {
|
|
|
|
initial_properties = {
|
|
|
|
physical = false,
|
|
|
|
collisionbox = {0, 0, 0, 0, 0, 0},
|
|
|
|
visual = "cube",
|
|
|
|
pointable = false,
|
|
|
|
glow = -1,
|
|
|
|
},
|
2021-04-16 20:50:56 +03:00
|
|
|
|
2021-01-01 21:25:47 +03:00
|
|
|
animation_frame = 0,
|
|
|
|
animation_timer = 0,
|
|
|
|
on_step = mcl_burning.fire_entity_step,
|
|
|
|
})
|
2020-12-24 19:48:40 +03:00
|
|
|
|
|
|
|
minetest.register_globalstep(function(dtime)
|
2021-03-16 19:35:46 +03:00
|
|
|
for _, player in pairs(minetest.get_connected_players()) do
|
2021-04-23 14:46:20 +03:00
|
|
|
mcl_burning.tick(player, dtime)
|
2020-12-24 19:48:40 +03:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_respawnplayer(function(player)
|
2020-12-30 00:08:38 +03:00
|
|
|
mcl_burning.extinguish(player)
|
2020-12-24 19:48:40 +03:00
|
|
|
end)
|
|
|
|
|
2021-01-01 21:25:47 +03:00
|
|
|
minetest.register_on_leaveplayer(function(player)
|
|
|
|
mcl_burning.set(player, "int", "hud_id")
|
2021-02-22 12:55:14 +03:00
|
|
|
end)
|