From 0b7097cb28869d36a251c7ded32cfa7c6c0b03f8 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 21 Sep 2021 20:45:08 +0200 Subject: [PATCH] add a burning animation fps setting --- mods/ENTITIES/mcl_burning/api.lua | 2 +- mods/ENTITIES/mcl_burning/init.lua | 3 ++- settingtypes.txt | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index bf721414..402835d7 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -285,7 +285,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