forked from mtcontrib/mobs_redo
spawn egg checks for existing right_click functions
This commit is contained in:
parent
52a2355954
commit
4e231429d9
10
api.lua
10
api.lua
@ -1893,8 +1893,9 @@ local do_states = function(self, dtime)
|
|||||||
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
||||||
|
|
||||||
local obj = minetest.add_entity(p, self.arrow)
|
local obj = minetest.add_entity(p, self.arrow)
|
||||||
if obj then
|
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
|
|
||||||
|
if ent then
|
||||||
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
||||||
local v = ent.velocity or 1 -- or set to default
|
local v = ent.velocity or 1 -- or set to default
|
||||||
ent.switch = 1
|
ent.switch = 1
|
||||||
@ -2990,6 +2991,13 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
|||||||
|
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
|
|
||||||
|
-- am I clicking on something with existing on_rightclick function?
|
||||||
|
local under = minetest.get_node(pointed_thing.under)
|
||||||
|
local def = minetest.registered_nodes[under.name]
|
||||||
|
if def and def.on_rightclick then
|
||||||
|
return def.on_rightclick(pointed_thing.under, under, placer, itemstack)
|
||||||
|
end
|
||||||
|
|
||||||
if pos
|
if pos
|
||||||
and within_limits(pos, 0)
|
and within_limits(pos, 0)
|
||||||
and not minetest.is_protected(pos, placer:get_player_name()) then
|
and not minetest.is_protected(pos, placer:get_player_name()) then
|
||||||
|
Loading…
Reference in New Issue
Block a user