if mob standing in solid block then jump to escape

master
TenPlus1 2019-08-23 08:25:06 +01:00
parent 2ca012e30b
commit d6bd538a35
1 changed files with 12 additions and 1 deletions

13
api.lua
View File

@ -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