mirror of
https://github.com/ElCeejo/animalia.git
synced 2025-09-06 21:25:48 -04:00
Fixes and Bird Eggs
This commit is contained in:
parent
e4b8396be9
commit
21ad5faf7d
10 changed files with 54 additions and 26 deletions
13
api/api.lua
13
api/api.lua
|
@ -455,7 +455,7 @@ function animalia.add_trust(self, player, amount)
|
|||
self:memorize("trust", self.trust)
|
||||
end
|
||||
|
||||
function animalia.feed(self, clicker, breed, tame)
|
||||
function animalia.feed(self, clicker, tame, breed)
|
||||
local yaw = self.object:get_yaw()
|
||||
local pos = self.object:get_pos()
|
||||
if not pos then return end
|
||||
|
@ -507,10 +507,13 @@ function animalia.feed(self, clicker, breed, tame)
|
|||
texture = "creatura_particle_green.png"
|
||||
})
|
||||
end
|
||||
if breed
|
||||
and self.owner
|
||||
and self.owner == name then
|
||||
-- TODO: Breeding
|
||||
if breed then
|
||||
if self.breeding then return false end
|
||||
if self.breeding_cooldown <= 0 then
|
||||
self.breeding = true
|
||||
self.breeding_cooldown = 60
|
||||
animalia.particle_spawner(pos, "heart.png", "float", minp, maxp)
|
||||
end
|
||||
end
|
||||
self._despawn = self:memorize("_despawn", false)
|
||||
self.despawn_after = self:memorize("despawn_after", false)
|
||||
|
|
|
@ -496,7 +496,7 @@ function animalia.action_move_boid(self, pos2, timeout, method, speed_factor, an
|
|||
local safe = true
|
||||
local max_fall = (_self.max_fall or 0) > 0 and _self.max_fall
|
||||
if max_fall then
|
||||
safe = _self:is_pos_safe(goal)
|
||||
safe = _self:is_pos_safe(pos2)
|
||||
end
|
||||
-- Boid calculation
|
||||
local boid_dir, boids = move_data.boid_dir or creatura.get_boid_dir(self)
|
||||
|
@ -743,22 +743,25 @@ creatura.register_utility("animalia:wander_group", function(self)
|
|||
local idle_duration = self.idle_time or 3
|
||||
local center = self.object:get_pos()
|
||||
if not center then return end
|
||||
local group_tick = 500
|
||||
local cntr_timer = 30
|
||||
local move = self.wander_action or animalia.action_move_boid
|
||||
local function func(_self)
|
||||
group_tick = group_tick - 1
|
||||
if group_tick <= 0 then
|
||||
local pos = _self.object:get_pos()
|
||||
if not pos then return end
|
||||
local pos = _self.object:get_pos()
|
||||
if not pos then return end
|
||||
cntr_timer = cntr_timer - _self.dtime
|
||||
if cntr_timer <= 0 then
|
||||
local grp_pos = get_group_positions(_self)
|
||||
center = animalia.get_average_pos(grp_pos) or pos
|
||||
group_tick = 500
|
||||
cntr_timer = 30
|
||||
end
|
||||
if not _self:get_action() then
|
||||
local pos2 = _self:get_wander_pos(2, 3)
|
||||
if random(move_chance) < 2
|
||||
and vec_dist(pos2, center) < _self.tracking_range * 0.5 then
|
||||
move(_self, pos2, 2, "creatura:obstacle_avoidance", 0.5, "walk", true)
|
||||
if random(move_chance) < 2 then
|
||||
local move_dir
|
||||
if vec_dist(pos, center) > _self.tracking_range * 0.25 then
|
||||
move_dir = vec_dir(pos, center)
|
||||
end
|
||||
local pos2 = _self:get_wander_pos(2, 3, move_dir)
|
||||
move(_self, pos2, 2)
|
||||
else
|
||||
creatura.action_idle(_self, random(idle_duration))
|
||||
end
|
||||
|
|
|
@ -37,6 +37,8 @@ minetest.register_entity("animalia:lasso_entity", {
|
|||
if type(parent) == "string" then
|
||||
parent = minetest.get_player_by_name(parent)
|
||||
local tgt_pos = parent:get_pos()
|
||||
tgt_pos.y = tgt_pos.y + 1
|
||||
point_to.y = point_to.y + pointed_ent.height * 0.5
|
||||
local dist = vec_dist(pos, tgt_pos)
|
||||
if dist > 0.5 then
|
||||
self.object:set_pos(tgt_pos)
|
||||
|
|
|
@ -168,10 +168,11 @@ creatura.register_abm_spawn("animalia:bird", {
|
|||
min_light = 0,
|
||||
min_height = 1,
|
||||
max_height = 1024,
|
||||
min_group = 12,
|
||||
max_group = 16,
|
||||
min_group = 6,
|
||||
max_group = 12,
|
||||
spawn_cap = 12,
|
||||
nodes = {"group:leaves"}
|
||||
nodes = {"group:leaves"},
|
||||
neighbors = {"group:leaves"}
|
||||
})
|
||||
|
||||
creatura.register_on_spawn("animalia:bird", function(self, pos)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue