From d6bd538a3511bd2a1c16d41708b9e10b2027f2fd Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Fri, 23 Aug 2019 08:25:06 +0100 Subject: [PATCH] if mob standing in solid block then jump to escape --- api.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index 6f837b2..45432df 100644 --- a/api.lua +++ b/api.lua @@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20190813", + version = "20190823", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {}, } @@ -3128,6 +3128,17 @@ function mob_class:on_step(dtime) x = pos.x, y = pos.y + y_level + 0.25, z = pos.z}, "air").name -- print ("standing in " .. self.standing_in) + -- if standing inside solid block then jump to escape + if minetest.registered_nodes[self.standing_in].walkable and + minetest.registered_nodes[self.standing_in].drawtype == "normal" then + + self.object:set_velocity({ + x = 0, + y = self.jump_height, + z = 0 + }) + end + -- check for mob expiration (0.25 instead of dtime since were in a timer) self:mob_expire(pos, 0.25) end