From 81dd3d75c0383071cd84f40d599d71d8aec78d1c Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 17 Jul 2020 20:58:52 +0100 Subject: [PATCH] add randomly_turn setting to mob definition --- api.lua | 7 ++++--- api.txt | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index 39466b1..1f379f7 100644 --- a/api.lua +++ b/api.lua @@ -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, diff --git a/api.txt b/api.txt index e96d07b..6a9bfd0 100644 --- a/api.txt +++ b/api.txt @@ -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,