diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index bf721414..0d8e3d15 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -155,6 +155,16 @@ function mcl_burning.set_on_fire(obj, burn_time, reason) }) + 1 end + local already_burning = mcl_burning.is_burning(obj) + + + mcl_burning.set(obj, "float", "burn_time", burn_time) + mcl_burning.set(obj, "string", "reason", reason) + + if already_burning then + return + end + local hud_id if obj:is_player() then hud_id = mcl_burning.get(obj, "int", "hud_id") @@ -168,8 +178,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason) }) + 1 end end - mcl_burning.set(obj, "float", "burn_time", burn_time) - mcl_burning.set(obj, "string", "reason", reason) + mcl_burning.set(obj, "int", "hud_id", hud_id) mcl_burning.set(obj, "int", "sound_id", sound_id) @@ -285,7 +294,7 @@ function mcl_burning.fire_entity_step(self, dtime) end local animation_timer = self.animation_timer + dtime - if animation_timer >= 0.015 then + if animation_timer >= ( 1 / mcl_burning.animation_fps ) then animation_timer = 0 local animation_frame = self.animation_frame + 1 if animation_frame > mcl_burning.animation_frames - 1 then diff --git a/mods/ENTITIES/mcl_burning/init.lua b/mods/ENTITIES/mcl_burning/init.lua index 61ed1283..a1e3fe5c 100644 --- a/mods/ENTITIES/mcl_burning/init.lua +++ b/mods/ENTITIES/mcl_burning/init.lua @@ -2,7 +2,8 @@ local S = minetest.get_translator("mcl_burning") local modpath = minetest.get_modpath("mcl_burning") mcl_burning = { - animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8 + animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8, + animation_fps = tonumber(minetest.settings:get("fire_animation_fps")) or 30 } dofile(modpath .. "/api.lua") diff --git a/settingtypes.txt b/settingtypes.txt index 96e7d5f5..3f90c986 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -91,6 +91,11 @@ flame_sound (Flame sound) bool true # Form: Image height / Image width fire_animation_frames (Fire Animation Frames) int 8 +# How long to wait between frames of the fire animation in frames per second. +# A higher number means it looks better but also results in a lot of additional network traffic. A low single digit value is recommended for multiplayer. +#(default: 30) +fire_animation_fps (Fire Animation FPS) int 30 0 60 + # Whether to animate chests when open / close animated_chests (Animated chests) bool true