1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-11-13 05:50:17 +01:00

add randomly_turn setting to mob definition

This commit is contained in:
tenplus1 2020-07-17 20:58:52 +01:00
parent 804f8b9a0c
commit 81dd3d75c0
2 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20200701",
version = "20200717",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -2136,7 +2136,7 @@ function mob_class:do_states(dtime)
if self.state == "stand" then
if random(4) == 1 then
if self.randomly_turn and random(4) == 1 then
local lp
local s = self.object:get_pos()
@ -2224,7 +2224,7 @@ function mob_class:do_states(dtime)
yaw = self:set_yaw(yaw, 8)
-- otherwise randomly turn
elseif random(100) <= 30 then
elseif self.randomly_turn and random(100) <= 30 then
yaw = yaw + random(-0.5, 0.5)
@ -3564,6 +3564,7 @@ minetest.register_entity(name, setmetatable({
owner_loyal = def.owner_loyal,
pushable = def.pushable,
stay_near = def.stay_near,
randomly_turn = def.randomly_turn ~= false,
on_spawn = def.on_spawn,

View File

@ -38,6 +38,8 @@ functions needed for the mob to work properly which contains the following:
'stand_chance' has a 0-100 chance value your mob will stand from walking.
'walk_chance' has a 0-100 chance value your mob will walk from standing,
set to 0 for jumping mobs only.
'randomly_turn' if set to false then mob will not turn to face player or
randomly turn while walking or standing.
'jump' when true allows your mob to jump updwards.
'jump_height' holds the height your mob can jump, 0 to disable jumping.
'stepheight' height of a block that your mob can easily walk up onto,