Various minor improvements

This commit is contained in:
ElCeejo 2021-08-23 02:46:14 -07:00
parent 72d66f7f64
commit 85c1493c85
8 changed files with 20 additions and 21 deletions

View file

@ -497,7 +497,7 @@ function animalia.go_to_pos_lite(self, tpos, speed_factor)
if mobkit.is_queue_empty_low(self) then
local _, pos2 = mob_core.get_next_waypoint(self, tpos)
if pos2 then
mob_core.lq_dumbwalk(self, tpos, speed_factor)
mob_core.lq_dumbwalk(self, pos2, speed_factor)
return true
else
local box = hitbox(self)
@ -592,10 +592,7 @@ local function is_under_solid(pos)
end
local function vec_center(vec)
for _, v in pairs(vec) do
v = floor(v + 0.5)
end
return vec
return {x = floor(vec.x + 0.5), y = floor(vec.y + 0.5), z = floor(vec.z + 0.5)}
end
local function do_step(self, moveresult)
@ -607,10 +604,11 @@ local function do_step(self, moveresult)
local step_pos = data.node_pos
local halfway = vector.add(pos, vector.multiply(vector.direction(pos, step_pos), 0.5))
if step_pos.y + 0.5 > pos.y
and is_movable({x = halfway.x, y = data.node_pos.y + 1, z = halfway.z}, width, self.height)
and not is_under_solid(data.node_pos)
and walkable({x = pos.x, y = pos.y - 1, z = pos.z})
and not vector.equals(vec_center(pos), vec_center(data.node_pos)) then
and (walkable({x = pos.x, y = pos.y - 1, z = pos.z})
or self.isinliquid)
and not vector.equals(vec_center(pos), step_pos)
and not is_under_solid(step_pos)
and is_movable({x = halfway.x, y = step_pos.y + 1, z = halfway.z}, width, self.height) then
local vel_yaw = self.object:get_yaw()
local dir_yaw = minetest.dir_to_yaw(vector.direction(pos, data.node_pos))
if diff(vel_yaw, dir_yaw) < width * 2 then
@ -1101,13 +1099,14 @@ function animalia.hq_sporadic_flee(self, prty)
if self.animation["run"] then
anim = "run"
end
mob_core.lq_dumbwalk(self, random_goal, 1, anim)
animalia.go_to_pos_lite(self, random_goal, 1)
else
animalia.lq_idle(self, 0.1)
end
end
timer = timer - self.dtime
if timer <= 0 then
animalia.lq_idle(self, 0.1, "stand")
return true
end
end

View file

@ -165,14 +165,14 @@ minetest.register_craftitem("animalia:poultry_raw", {
description = "Raw Poultry",
inventory_image = "animalia_poultry_raw.png",
on_use = minetest.item_eat(1),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craftitem("animalia:poultry_cooked", {
description = "Cooked Poultry",
inventory_image = "animalia_poultry_cooked.png",
on_use = minetest.item_eat(6),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craft({
@ -274,14 +274,14 @@ minetest.register_craftitem("animalia:chicken_egg", {
description = "Chicken Egg",
inventory_image = "animalia_egg.png",
on_use = mobs_shoot_egg,
groups = {flammable = 2},
groups = {food_egg = 1, flammable = 2},
})
minetest.register_craftitem("animalia:chicken_egg_fried", {
description = "Fried Chicken Egg",
inventory_image = "animalia_egg_fried.png",
on_use = minetest.item_eat(4),
groups = {flammable = 2},
groups = {food_egg = 1, flammable = 2},
})
minetest.register_craft({

View file

@ -227,14 +227,14 @@ minetest.register_craftitem("animalia:beef_raw", {
description = "Raw Beef",
inventory_image = "animalia_beef_raw.png",
on_use = minetest.item_eat(1),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craftitem("animalia:beef_cooked", {
description = "Steak",
inventory_image = "animalia_beef_cooked.png",
on_use = minetest.item_eat(8),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craft({

View file

@ -67,7 +67,7 @@ local function horse_logic(self)
local player = mobkit.get_nearby_player(self)
local pos = self.object:get_pos()
mob_core.random_sound(self, 14)
mob_core.random_sound(self, 24)
mob_core.growth(self)
if self.breaking then

View file

@ -145,14 +145,14 @@ minetest.register_craftitem("animalia:porkchop_raw", {
description = "Raw Porkchop",
inventory_image = "animalia_porkchop_raw.png",
on_use = minetest.item_eat(1),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craftitem("animalia:porkchop_cooked", {
description = "Cooked Porkchop",
inventory_image = "animalia_porkchop_cooked.png",
on_use = minetest.item_eat(7),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craft({

View file

@ -265,14 +265,14 @@ minetest.register_craftitem("animalia:mutton_raw", {
description = "Raw Mutton",
inventory_image = "animalia_mutton_raw.png",
on_use = minetest.item_eat(1),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craftitem("animalia:mutton_cooked", {
description = "Cooked Mutton",
inventory_image = "animalia_mutton_cooked.png",
on_use = minetest.item_eat(6),
groups = {flammable = 2, meat = 1},
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craft({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB