mirror of
https://github.com/ElCeejo/animalia.git
synced 2025-04-30 13:31:39 -04:00
Various minor improvements
This commit is contained in:
parent
72d66f7f64
commit
85c1493c85
8 changed files with 20 additions and 21 deletions
19
api/api.lua
19
api/api.lua
|
@ -497,7 +497,7 @@ function animalia.go_to_pos_lite(self, tpos, speed_factor)
|
||||||
if mobkit.is_queue_empty_low(self) then
|
if mobkit.is_queue_empty_low(self) then
|
||||||
local _, pos2 = mob_core.get_next_waypoint(self, tpos)
|
local _, pos2 = mob_core.get_next_waypoint(self, tpos)
|
||||||
if pos2 then
|
if pos2 then
|
||||||
mob_core.lq_dumbwalk(self, tpos, speed_factor)
|
mob_core.lq_dumbwalk(self, pos2, speed_factor)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
local box = hitbox(self)
|
local box = hitbox(self)
|
||||||
|
@ -592,10 +592,7 @@ local function is_under_solid(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function vec_center(vec)
|
local function vec_center(vec)
|
||||||
for _, v in pairs(vec) do
|
return {x = floor(vec.x + 0.5), y = floor(vec.y + 0.5), z = floor(vec.z + 0.5)}
|
||||||
v = floor(v + 0.5)
|
|
||||||
end
|
|
||||||
return vec
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function do_step(self, moveresult)
|
local function do_step(self, moveresult)
|
||||||
|
@ -607,10 +604,11 @@ local function do_step(self, moveresult)
|
||||||
local step_pos = data.node_pos
|
local step_pos = data.node_pos
|
||||||
local halfway = vector.add(pos, vector.multiply(vector.direction(pos, step_pos), 0.5))
|
local halfway = vector.add(pos, vector.multiply(vector.direction(pos, step_pos), 0.5))
|
||||||
if step_pos.y + 0.5 > pos.y
|
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 (walkable({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||||
and not is_under_solid(data.node_pos)
|
or self.isinliquid)
|
||||||
and walkable({x = pos.x, y = pos.y - 1, z = pos.z})
|
and not vector.equals(vec_center(pos), step_pos)
|
||||||
and not vector.equals(vec_center(pos), vec_center(data.node_pos)) then
|
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 vel_yaw = self.object:get_yaw()
|
||||||
local dir_yaw = minetest.dir_to_yaw(vector.direction(pos, data.node_pos))
|
local dir_yaw = minetest.dir_to_yaw(vector.direction(pos, data.node_pos))
|
||||||
if diff(vel_yaw, dir_yaw) < width * 2 then
|
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
|
if self.animation["run"] then
|
||||||
anim = "run"
|
anim = "run"
|
||||||
end
|
end
|
||||||
mob_core.lq_dumbwalk(self, random_goal, 1, anim)
|
animalia.go_to_pos_lite(self, random_goal, 1)
|
||||||
else
|
else
|
||||||
animalia.lq_idle(self, 0.1)
|
animalia.lq_idle(self, 0.1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
timer = timer - self.dtime
|
timer = timer - self.dtime
|
||||||
if timer <= 0 then
|
if timer <= 0 then
|
||||||
|
animalia.lq_idle(self, 0.1, "stand")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -165,14 +165,14 @@ minetest.register_craftitem("animalia:poultry_raw", {
|
||||||
description = "Raw Poultry",
|
description = "Raw Poultry",
|
||||||
inventory_image = "animalia_poultry_raw.png",
|
inventory_image = "animalia_poultry_raw.png",
|
||||||
on_use = minetest.item_eat(1),
|
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", {
|
minetest.register_craftitem("animalia:poultry_cooked", {
|
||||||
description = "Cooked Poultry",
|
description = "Cooked Poultry",
|
||||||
inventory_image = "animalia_poultry_cooked.png",
|
inventory_image = "animalia_poultry_cooked.png",
|
||||||
on_use = minetest.item_eat(6),
|
on_use = minetest.item_eat(6),
|
||||||
groups = {flammable = 2, meat = 1},
|
groups = {flammable = 2, meat = 1, food_meat = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -274,14 +274,14 @@ minetest.register_craftitem("animalia:chicken_egg", {
|
||||||
description = "Chicken Egg",
|
description = "Chicken Egg",
|
||||||
inventory_image = "animalia_egg.png",
|
inventory_image = "animalia_egg.png",
|
||||||
on_use = mobs_shoot_egg,
|
on_use = mobs_shoot_egg,
|
||||||
groups = {flammable = 2},
|
groups = {food_egg = 1, flammable = 2},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("animalia:chicken_egg_fried", {
|
minetest.register_craftitem("animalia:chicken_egg_fried", {
|
||||||
description = "Fried Chicken Egg",
|
description = "Fried Chicken Egg",
|
||||||
inventory_image = "animalia_egg_fried.png",
|
inventory_image = "animalia_egg_fried.png",
|
||||||
on_use = minetest.item_eat(4),
|
on_use = minetest.item_eat(4),
|
||||||
groups = {flammable = 2},
|
groups = {food_egg = 1, flammable = 2},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
|
|
@ -227,14 +227,14 @@ minetest.register_craftitem("animalia:beef_raw", {
|
||||||
description = "Raw Beef",
|
description = "Raw Beef",
|
||||||
inventory_image = "animalia_beef_raw.png",
|
inventory_image = "animalia_beef_raw.png",
|
||||||
on_use = minetest.item_eat(1),
|
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", {
|
minetest.register_craftitem("animalia:beef_cooked", {
|
||||||
description = "Steak",
|
description = "Steak",
|
||||||
inventory_image = "animalia_beef_cooked.png",
|
inventory_image = "animalia_beef_cooked.png",
|
||||||
on_use = minetest.item_eat(8),
|
on_use = minetest.item_eat(8),
|
||||||
groups = {flammable = 2, meat = 1},
|
groups = {flammable = 2, meat = 1, food_meat = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
|
|
@ -67,7 +67,7 @@ local function horse_logic(self)
|
||||||
local player = mobkit.get_nearby_player(self)
|
local player = mobkit.get_nearby_player(self)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
mob_core.random_sound(self, 14)
|
mob_core.random_sound(self, 24)
|
||||||
mob_core.growth(self)
|
mob_core.growth(self)
|
||||||
|
|
||||||
if self.breaking then
|
if self.breaking then
|
||||||
|
|
|
@ -145,14 +145,14 @@ minetest.register_craftitem("animalia:porkchop_raw", {
|
||||||
description = "Raw Porkchop",
|
description = "Raw Porkchop",
|
||||||
inventory_image = "animalia_porkchop_raw.png",
|
inventory_image = "animalia_porkchop_raw.png",
|
||||||
on_use = minetest.item_eat(1),
|
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", {
|
minetest.register_craftitem("animalia:porkchop_cooked", {
|
||||||
description = "Cooked Porkchop",
|
description = "Cooked Porkchop",
|
||||||
inventory_image = "animalia_porkchop_cooked.png",
|
inventory_image = "animalia_porkchop_cooked.png",
|
||||||
on_use = minetest.item_eat(7),
|
on_use = minetest.item_eat(7),
|
||||||
groups = {flammable = 2, meat = 1},
|
groups = {flammable = 2, meat = 1, food_meat = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
|
|
@ -265,14 +265,14 @@ minetest.register_craftitem("animalia:mutton_raw", {
|
||||||
description = "Raw Mutton",
|
description = "Raw Mutton",
|
||||||
inventory_image = "animalia_mutton_raw.png",
|
inventory_image = "animalia_mutton_raw.png",
|
||||||
on_use = minetest.item_eat(1),
|
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", {
|
minetest.register_craftitem("animalia:mutton_cooked", {
|
||||||
description = "Cooked Mutton",
|
description = "Cooked Mutton",
|
||||||
inventory_image = "animalia_mutton_cooked.png",
|
inventory_image = "animalia_mutton_cooked.png",
|
||||||
on_use = minetest.item_eat(6),
|
on_use = minetest.item_eat(6),
|
||||||
groups = {flammable = 2, meat = 1},
|
groups = {flammable = 2, meat = 1, food_meat = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
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 |
Loading…
Add table
Reference in a new issue