This commit is contained in:
root 2021-10-29 13:57:02 +02:00
parent c0ae3551fe
commit 059389f036
3 changed files with 10 additions and 26 deletions

View file

@ -134,13 +134,14 @@ local get_ambience = function(player, tod, name)
-- get foot and head level nodes at player position
local pos = player:get_pos() ; if not pos then return end
local prop = player:get_properties()
local eyeh = prop.eye_height or 1.47 -- eye level with fallback
pos.y = pos.y + prop.eye_height -- eye level
pos.y = pos.y + eyeh
local nod_head = pplus and name and playerplus[name]
and playerplus[name].nod_head or minetest.get_node(pos).name
pos.y = (pos.y - prop.eye_height) + 0.2 -- foot level
pos.y = (pos.y - eyeh) + 0.2 -- foot level
local nod_feet = pplus and name and playerplus[name]
and playerplus[name].nod_feet or minetest.get_node(pos).name

View file

@ -146,7 +146,7 @@ mobs:register_arrow("mobs_animal:egg_entity", {
hit_node = function(self, pos, node)
if math.random(1, 10) > 1 then
if math.random(10) > 1 then
return
end
@ -160,28 +160,10 @@ mobs:register_arrow("mobs_animal:egg_entity", {
return
end
local mob = minetest.add_entity(pos, "mobs_animal:chicken")
local ent2 = mob:get_luaentity()
local staticdata = minetest.serialize(
{child = true, tamed = true, owner = self.playername})
mob:set_properties({
textures = ent2.child_texture[1],
visual_size = {
x = ent2.base_size.x / 2,
y = ent2.base_size.y / 2
},
collisionbox = {
ent2.base_colbox[1] / 2,
ent2.base_colbox[2] / 2,
ent2.base_colbox[3] / 2,
ent2.base_colbox[4] / 2,
ent2.base_colbox[5] / 2,
ent2.base_colbox[6] / 2
},
})
ent2.child = true
ent2.tamed = true
ent2.owner = self.playername
minetest.add_entity(pos, "mobs_animal:chicken", staticdata)
end
})
@ -215,13 +197,13 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
ent.switch = 1 -- needed so that egg doesn't despawn straight away
ent._is_arrow = true -- tell advanced mob protection this is an arrow
obj:setvelocity({
obj:set_velocity({
x = dir.x * egg_VELOCITY,
y = dir.y * egg_VELOCITY,
z = dir.z * egg_VELOCITY
})
obj:setacceleration({
obj:set_acceleration({
x = dir.x * -3,
y = -egg_GRAVITY,
z = dir.z * -3
@ -229,6 +211,7 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
-- pass player name to egg for chick ownership
local ent2 = obj:get_luaentity()
ent2.playername = player:get_player_name()
item:take_item()

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B