From f1318060081a953c254dc4e202f174e5c2cc1024 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Tue, 1 Jun 2021 14:17:25 +0100 Subject: [PATCH] add 'mob_smooth_rotate' setting --- api.lua | 8 +++++--- api.txt | 1 + settingtypes.txt | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index e0d757d..64617fe 100644 --- a/api.lua +++ b/api.lua @@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20210527", + version = "20210601", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -66,9 +66,9 @@ local mob_nospawn_range = tonumber(settings:get("mob_nospawn_range") or 12) local active_limit = tonumber(settings:get("mob_active_limit") or 0) local mob_chance_multiplier = tonumber(settings:get("mob_chance_multiplier") or 1) local peaceful_player_enabled = settings:get_bool("enable_peaceful_player") +local mob_smooth_rotate = settings:get_bool("mob_smooth_rotate") ~= false local active_mobs = 0 - -- Peaceful mode message so players will know there are no monsters if peaceful_only then minetest.register_on_joinplayer(function(player) @@ -339,10 +339,12 @@ function mob_class:set_yaw(yaw, delay) yaw = 0 end - delay = delay or 0 + delay = mob_smooth_rotate and (delay or 0) or 0 if delay == 0 then + self.object:set_yaw(yaw) + return yaw end diff --git a/api.txt b/api.txt index 5d4e81f..25e27a9 100644 --- a/api.txt +++ b/api.txt @@ -722,6 +722,7 @@ External Settings for "minetest.conf" 'mob_area_spawn' When true will check surrounding area the size of the mob for obstructions before spawning, otherwise it defaults to checking the height of the mob only. + 'mob_smooth_rotate' Enables smooth rotation when mobs turn by default. Players can override the spawn chance for each mob registered by adding a line to their minetest.conf file with a new value, the lower the value the more each diff --git a/settingtypes.txt b/settingtypes.txt index 9a9100c..f97203e 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -39,3 +39,6 @@ mob_area_spawn (Mob Area Spawn) bool false # Enable peaceful player attack prevention enable_peaceful_player (Mobs do not attack peaceful player without reason) bool false + +# Enable mobs smooth rotation +mob_smooth_rotate (Smooth rotation for mobs) bool true