3 local fire_animation_timer = 0
4 local fire_animation_tile = 0
5 --receive the server states
6 minetest.register_on_modchannel_message(function(channel_name, sender, message)
7 if channel_name == name..":fire_state" then
8 on_fire = tonumber(message)
12 minetest.register_globalstep(function(dtime)
15 minetest.localplayer:hud_remove(fire_id)
18 elseif on_fire == 1 then
19 if fire_id == nil then
20 fire_id = minetest.localplayer:hud_add({
21 hud_elem_type = "image", -- see HUD element types, default "text"
22 position = {x=0.5, y=0.5},
23 name = "", -- default ""
24 scale = {x=-100, y=-100}, -- default {x=0,y=0}
25 text = "fire.png^[opacity:180^[verticalframe:8:"..fire_animation_tile,
28 fire_animation_timer = fire_animation_timer + dtime
29 if fire_animation_timer >= 0.05 then
30 fire_animation_timer = 0
31 fire_animation_tile = fire_animation_tile + 1
32 if fire_animation_tile > 7 then
33 fire_animation_tile = 0
35 minetest.localplayer:hud_change(fire_id, "text", "fire.png^[opacity:180^[verticalframe:8:"..fire_animation_tile)