Skip to content

Commit

Permalink
add 'mob_smooth_rotate' setting
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 committed Jun 1, 2021
1 parent 49325c9 commit f131806
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f131806

Please sign in to comment.