mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-11 18:30:21 +01:00
if mob standing in solid block then jump to escape
This commit is contained in:
parent
2ca012e30b
commit
d6bd538a35
13
api.lua
13
api.lua
@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20190813",
|
version = "20190823",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
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
|
x = pos.x, y = pos.y + y_level + 0.25, z = pos.z}, "air").name
|
||||||
-- print ("standing in " .. self.standing_in)
|
-- 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)
|
-- check for mob expiration (0.25 instead of dtime since were in a timer)
|
||||||
self:mob_expire(pos, 0.25)
|
self:mob_expire(pos, 0.25)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user