forked from Mineclonia/Mineclonia
Merge pull request 'ENTITIES/mcl_burning: Fix burning animation packetspam' (#149) from fix-burning-animation-packetspam into master
Reviewed-on: Mineclonia/Mineclonia#149 Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
This commit is contained in:
commit
249cfb8118
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue