mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-02-11 08:10:20 +01:00
tweak do_jump
This commit is contained in:
parent
c62b013825
commit
9f472fb690
15
api.lua
15
api.lua
@ -1060,8 +1060,10 @@ function mob_class:do_jump()
|
|||||||
if self.state == "stand" or self.order == "stand" or vel.y ~= 0
|
if self.state == "stand" or self.order == "stand" or vel.y ~= 0
|
||||||
or self.fly or self.child then return false end
|
or self.fly or self.child then return false end
|
||||||
|
|
||||||
-- we can only jump if standing on solid node
|
-- we can only jump if standing on solid node that allows it
|
||||||
if minetest.registered_nodes[self.standing_on].walkable == false then
|
local ndef = minetest.registered_nodes[self.standing_on]
|
||||||
|
|
||||||
|
if ndef.walkable == false or (ndef.groups and ndef.groups.disable_jump == 1) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1071,12 +1073,13 @@ function mob_class:do_jump()
|
|||||||
-- if mob can leap then remove blockages and let them try
|
-- if mob can leap then remove blockages and let them try
|
||||||
if self.can_leap then blocked = false ; self.facing_fence = false end
|
if self.can_leap then blocked = false ; self.facing_fence = false end
|
||||||
|
|
||||||
|
-- what node are we looking at?
|
||||||
|
ndef = minetest.registered_nodes[self.looking_at]
|
||||||
|
|
||||||
-- jump if possible
|
-- jump if possible
|
||||||
if self.jump and self.jump_height > 0
|
if self.jump and self.jump_height > 0
|
||||||
and (self.walk_chance == 0 or minetest.registered_items[self.looking_at].walkable)
|
and (self.walk_chance == 0 or (ndef.walkable and ndef.drawtype == "normal"))
|
||||||
and not blocked and not self.facing_fence
|
and not blocked and not self.facing_fence then
|
||||||
and self.standing_in ~= mobs.node_snow
|
|
||||||
and not self.standing_in:find("carpet") then
|
|
||||||
|
|
||||||
vel.y = self.jump_height
|
vel.y = self.jump_height
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user