fixed jump glitch
This commit is contained in:
parent
b586e2c27a
commit
ea4677ffd2
23
api.lua
23
api.lua
@ -1,4 +1,4 @@
|
|||||||
-- Mobs Api (6th May 2015)
|
-- Mobs Api (11th May 2015)
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
|
|
||||||
@ -83,9 +83,9 @@ function mobs:register_mob(name, def)
|
|||||||
|
|
||||||
do_attack = function(self, player, dist)
|
do_attack = function(self, player, dist)
|
||||||
if self.state ~= "attack" then
|
if self.state ~= "attack" then
|
||||||
if math.random(0,100) < 90 and self.sounds.war_cry then
|
if math.random(0,100) < 90 and self.sounds.war_cry then
|
||||||
minetest.sound_play(self.sounds.war_cry,{object = self.object})
|
minetest.sound_play(self.sounds.war_cry,{object = self.object})
|
||||||
end
|
end
|
||||||
self.state = "attack"
|
self.state = "attack"
|
||||||
self.attack.player = player
|
self.attack.player = player
|
||||||
self.attack.dist = dist
|
self.attack.dist = dist
|
||||||
@ -186,13 +186,13 @@ function mobs:register_mob(name, def)
|
|||||||
|
|
||||||
-- check for mob drop/replace (used for chicken egg and sheep eating grass/wheat)
|
-- check for mob drop/replace (used for chicken egg and sheep eating grass/wheat)
|
||||||
if self.replace_rate
|
if self.replace_rate
|
||||||
and math.random(1,self.replace_rate) == 1
|
and self.child == false
|
||||||
and self.child == false then
|
and math.random(1,self.replace_rate) == 1 then
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
pos.y = pos.y + self.replace_offset
|
pos.y = pos.y + self.replace_offset
|
||||||
if #minetest.find_nodes_in_area(pos,pos,self.replace_what) > 0
|
if self.replace_what
|
||||||
and self.object:getvelocity().y == 0
|
and self.object:getvelocity().y == 0
|
||||||
and self.replace_what then
|
and #minetest.find_nodes_in_area(pos, pos, self.replace_what) > 0 then
|
||||||
--and self.state == "stand" then
|
--and self.state == "stand" then
|
||||||
minetest.set_node(pos, {name = self.replace_with})
|
minetest.set_node(pos, {name = self.replace_with})
|
||||||
end
|
end
|
||||||
@ -260,8 +260,8 @@ function mobs:register_mob(name, def)
|
|||||||
|
|
||||||
if self.light_damage and self.light_damage ~= 0
|
if self.light_damage and self.light_damage ~= 0
|
||||||
and pos.y > 0
|
and pos.y > 0
|
||||||
and (minetest.get_node_light(pos) or 0) > 10 -- direct sunlight (was 4)
|
and tod > 0.2 and tod < 0.8
|
||||||
and tod > 0.2 and tod < 0.8 then
|
and (minetest.get_node_light(pos) or 0) > 10 then
|
||||||
self.object:set_hp(self.object:get_hp()-self.light_damage)
|
self.object:set_hp(self.object:get_hp()-self.light_damage)
|
||||||
effect(pos, 5, "tnt_smoke.png")
|
effect(pos, 5, "tnt_smoke.png")
|
||||||
end
|
end
|
||||||
@ -292,7 +292,8 @@ function mobs:register_mob(name, def)
|
|||||||
if not nod or not minetest.registered_nodes[nod.name]
|
if not nod or not minetest.registered_nodes[nod.name]
|
||||||
or minetest.registered_nodes[nod.name].walkable == false then return end
|
or minetest.registered_nodes[nod.name].walkable == false then return end
|
||||||
if self.direction then
|
if self.direction then
|
||||||
local nod = minetest.get_node_or_nil({x=pos.x + self.direction.x,y=pos.y+1,z=pos.z + self.direction.z})
|
pos = self.object:getpos()
|
||||||
|
local nod = minetest.get_node_or_nil({x=pos.x + self.direction.x,y=pos.y,z=pos.z + self.direction.z})
|
||||||
if nod and nod.name and (nod.name ~= "air" or self.walk_chance == 0) then
|
if nod and nod.name and (nod.name ~= "air" or self.walk_chance == 0) then
|
||||||
local def = minetest.registered_items[nod.name]
|
local def = minetest.registered_items[nod.name]
|
||||||
if (def and def.walkable and not nod.name:find("fence")) or self.walk_chance == 0 then
|
if (def and def.walkable and not nod.name:find("fence")) or self.walk_chance == 0 then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user