1
0
Fork 0
MineClone2/mods/ENTITIES/mcl_burning/init.lua

49 lines
1.2 KiB
Lua
Raw Normal View History

2020-12-29 22:08:38 +01:00
local S = minetest.get_translator("mcl_burning")
2021-01-01 19:25:47 +01:00
local modpath = minetest.get_modpath("mcl_burning")
mcl_burning = {
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8
}
dofile(modpath .. "/engine.lua")
minetest.register_entity("mcl_burning:fire", {
initial_properties = {
physical = false,
collisionbox = {0, 0, 0, 0, 0, 0},
visual = "cube",
pointable = false,
glow = -1,
},
animation_frame = 0,
animation_timer = 0,
on_step = mcl_burning.fire_entity_step,
})
2020-12-24 17:48:40 +01:00
minetest.register_globalstep(function(dtime)
for _, player in ipairs(minetest.get_connected_players()) do
2020-12-29 22:08:38 +01:00
mcl_burning.tick(player, dtime)
2020-12-24 17:48:40 +01:00
end
end)
minetest.register_on_respawnplayer(function(player)
2020-12-29 22:08:38 +01:00
mcl_burning.extinguish(player)
2020-12-24 17:48:40 +01:00
end)
2021-01-01 19:25:47 +01:00
minetest.register_on_leaveplayer(function(player)
mcl_burning.set(player, "int", "hud_id")
end)
2020-12-24 17:48:40 +01:00
minetest.register_chatcommand("burn", {
func = function(name, param)
local player = minetest.get_player_by_name(name)
2020-12-29 22:08:38 +01:00
local sparam = param:split(" ")
local burn_time = tonumber(sparam[1]) or 5
2021-01-01 19:25:47 +01:00
local damage = tonumber(sparam[2]) or 0
2020-12-24 17:48:40 +01:00
if player then
2020-12-29 22:08:38 +01:00
mcl_burning.set_on_fire(player, burn_time, damage)
2020-12-24 17:48:40 +01:00
end
end
})