add 'mob_smooth_rotate' setting

This commit is contained in:
TenPlus1 2021-06-01 14:17:25 +01:00
parent 49325c9c8d
commit f131806008
3 changed files with 9 additions and 3 deletions

View File

@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = { mobs = {
mod = "redo", mod = "redo",
version = "20210527", version = "20210601",
intllib = S, intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {} 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 active_limit = tonumber(settings:get("mob_active_limit") or 0)
local mob_chance_multiplier = tonumber(settings:get("mob_chance_multiplier") or 1) local mob_chance_multiplier = tonumber(settings:get("mob_chance_multiplier") or 1)
local peaceful_player_enabled = settings:get_bool("enable_peaceful_player") 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 local active_mobs = 0
-- Peaceful mode message so players will know there are no monsters -- Peaceful mode message so players will know there are no monsters
if peaceful_only then if peaceful_only then
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
@ -339,10 +339,12 @@ function mob_class:set_yaw(yaw, delay)
yaw = 0 yaw = 0
end end
delay = delay or 0 delay = mob_smooth_rotate and (delay or 0) or 0
if delay == 0 then if delay == 0 then
self.object:set_yaw(yaw) self.object:set_yaw(yaw)
return yaw return yaw
end end

View File

@ -722,6 +722,7 @@ External Settings for "minetest.conf"
'mob_area_spawn' When true will check surrounding area the size of the 'mob_area_spawn' When true will check surrounding area the size of the
mob for obstructions before spawning, otherwise it mob for obstructions before spawning, otherwise it
defaults to checking the height of the mob only. 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 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 to their minetest.conf file with a new value, the lower the value the more each

View File

@ -39,3 +39,6 @@ mob_area_spawn (Mob Area Spawn) bool false
# Enable peaceful player attack prevention # Enable peaceful player attack prevention
enable_peaceful_player (Mobs do not attack peaceful player without reason) bool false 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