Updated Libri, Fixed Horse riding visuals

This commit is contained in:
ElCeejo 2022-08-27 20:15:57 -07:00
parent 8a34dce37c
commit e4af546bdc
45 changed files with 1370 additions and 1282 deletions

View file

@ -24,7 +24,7 @@ local vec_dist = vector.distance
local vec_add = vector.add
local function vec_raise(v, n)
return {x = v.x, y = v.y + n, z = v.z}
return {x = v.x, y = v.y + n, z = v.z}
end
---------------
@ -32,52 +32,52 @@ end
---------------
local function get_roost(pos, range)
local walkable = minetest.find_nodes_in_area(
{x = pos.x + range, y = pos.y + range, z = pos.z + range},
{x = pos.x - range, y = pos.y, z = pos.z - range},
animalia.walkable_nodes
)
if #walkable < 1 then return end
local roosts = {}
for i = 1, #walkable do
local i_pos = walkable[i]
local n_pos = {
x = i_pos.x,
y = i_pos.y - 1,
z = i_pos.z
}
if creatura.get_node_def(n_pos).name == "air"
local walkable = minetest.find_nodes_in_area(
{x = pos.x + range, y = pos.y + range, z = pos.z + range},
{x = pos.x - range, y = pos.y, z = pos.z - range},
animalia.walkable_nodes
)
if #walkable < 1 then return end
local roosts = {}
for i = 1, #walkable do
local i_pos = walkable[i]
local n_pos = {
x = i_pos.x,
y = i_pos.y - 1,
z = i_pos.z
}
if creatura.get_node_def(n_pos).name == "air"
and minetest.line_of_sight(pos, n_pos) then
table.insert(roosts, n_pos)
end
end
return roosts[random(#roosts)]
table.insert(roosts, n_pos)
end
end
return roosts[random(#roosts)]
end
local function is_node_walkable(name)
local def = minetest.registered_nodes[name]
return def and def.walkable
local def = minetest.registered_nodes[name]
return def and def.walkable
end
creatura.register_mob("animalia:bat", {
-- Stats
max_health = 5,
armor_groups = {fleshy = 200},
damage = 0,
speed = 4,
-- Stats
max_health = 5,
armor_groups = {fleshy = 200},
damage = 0,
speed = 4,
tracking_range = 16,
despawn_after = 2500,
despawn_after = 2500,
-- Entity Physics
stepheight = 1.1,
max_fall = 100,
turn_rate = 12,
-- Visuals
mesh = "animalia_bat.b3d",
hitbox = {
-- Visuals
mesh = "animalia_bat.b3d",
hitbox = {
width = 0.15,
height = 0.3
},
visual_size = {x = 7, y = 7},
visual_size = {x = 7, y = 7},
textures = {
"animalia_bat_1.png",
"animalia_bat_2.png",
@ -86,27 +86,26 @@ creatura.register_mob("animalia:bat", {
animations = {
stand = {range = {x = 1, y = 40}, speed = 10, frame_blend = 0.3, loop = true},
walk = {range = {x = 50, y = 90}, speed = 30, frame_blend = 0.3, loop = true},
fly = {range = {x = 100, y = 140}, speed = 80, frame_blend = 0.3, loop = true},
cling = {range = {x = 150, y = 150}, speed = 1, frame_blend = 0, loop = false}
fly = {range = {x = 100, y = 140}, speed = 80, frame_blend = 0.3, loop = true},
cling = {range = {x = 150, y = 150}, speed = 1, frame_blend = 0, loop = false}
},
-- Misc
-- Misc
sounds = {
random = {
name = "animalia_bat",
gain = 0.5,
distance = 16,
name = "animalia_bat",
gain = 0.5,
distance = 16,
variations = 2
},
},
},
},
catch_with_net = true,
catch_with_lasso = false,
follow = {
follow = {
"butterflies:butterfly_red",
"butterflies:butterfly_white",
"butterflies:butterfly_violet"
},
-- Function
step_delay = 0.25,
-- Function
roost_action = animalia.action_cling,
utility_stack = {
{
@ -165,7 +164,7 @@ creatura.register_mob("animalia:bat", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
self.home_position = self:recall("home_position") or nil
@ -177,8 +176,8 @@ creatura.register_mob("animalia:bat", {
self.home_position = self:memorize("home_position", roost)
end
end
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
--animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60)
@ -245,12 +244,12 @@ creatura.register_mob("animalia:bat", {
end
end
end
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, false) then
animalia.add_trust(self, clicker, 1)
@ -259,7 +258,6 @@ creatura.register_mob("animalia:bat", {
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "bat", form = "pg_bat;Bats"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -48,7 +48,7 @@ creatura.register_mob("animalia:bird", {
fly = {range = {x = 120, y = 140}, speed = 80, frame_blend = 0.3, loop = true}
},
-- Misc
step_delay = 0.25,
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = false,
sounds = {
@ -212,7 +212,6 @@ creatura.register_mob("animalia:bird", {
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "bird", form = "pg_bird;Birds"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -18,18 +18,18 @@ if minetest.registered_items["ethereal:fish_raw"] then
end
creatura.register_mob("animalia:cat", {
-- Stats
max_health = 10,
armor_groups = {fleshy = 200},
damage = 1,
speed = 5,
-- Stats
max_health = 10,
armor_groups = {fleshy = 200},
damage = 1,
speed = 5,
tracking_range = 24,
turn_rate = 9,
despawn_after = 2000,
despawn_after = 2000,
-- Entity Physics
stepheight = 1.1,
-- Visuals
mesh = "animalia_cat.b3d",
-- Visuals
mesh = "animalia_cat.b3d",
hitbox = {
width = 0.2,
height = 0.4
@ -56,41 +56,41 @@ creatura.register_mob("animalia:cat", {
sit = {range = {x = 81, y = 99}, speed = 10, frame_blend = 0.3, loop = true},
smack = {range = {x = 101, y = 119}, speed = 40, frame_blend = 0.1, loop = true},
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
random = {
name = "animalia_cat_idle",
gain = 0.25,
distance = 8
},
random = {
name = "animalia_cat_idle",
gain = 0.25,
distance = 8
},
purr = {
name = "animalia_cat_purr",
gain = 0.6,
distance = 8
},
hurt = {
name = "animalia_cat_hurt",
gain = 0.25,
distance = 8
},
death = {
name = "animalia_cat_hurt",
gain = 0.25,
distance = 8
}
name = "animalia_cat_purr",
gain = 0.6,
distance = 8
},
hurt = {
name = "animalia_cat_hurt",
gain = 0.25,
distance = 8
},
death = {
name = "animalia_cat_hurt",
gain = 0.25,
distance = 8
}
},
follow = follow,
follow = follow,
head_data = {
offset = {x = 0, y = 0.18, z = 0},
pitch_correction = -20,
pivot_h = 0.65,
pivot_v = 0.65
},
-- Function
activate_func = function(self)
-- Function
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
self.interact_sound_cooldown = 0
@ -104,7 +104,7 @@ creatura.register_mob("animalia:cat", {
table.insert(animalia.pets[self.owner], self.object)
end
end
end,
end,
utility_stack = {
{
utility = "animalia:wander_skittish",
@ -203,22 +203,23 @@ creatura.register_mob("animalia:cat", {
end
}
},
step_func = function(self)
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
animalia.random_sound(self)
if self:timer(1) then
if self.interact_sound_cooldown > 0 then
self.interact_sound_cooldown = self.interact_sound_cooldown - 1
end
end
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
local item_name = clicker:get_wielded_item():get_name()
if item_name == "animalia:net" then return end
@ -252,7 +253,6 @@ creatura.register_mob("animalia:cat", {
self:play_sound("purr")
end
end
animalia.add_libri_page(self, clicker, {name = "cat", form = "pg_cat;Cats"})
if not self.owner
or clicker:get_player_name() ~= self.owner then
return

View file

@ -5,33 +5,33 @@
local follows = {}
minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_items) do
if name:match(":seed_")
for name in pairs(minetest.registered_items) do
if name:match(":seed_")
or name:match("_seed") then
table.insert(follows, name)
end
end
end
end
end)
creatura.register_mob("animalia:chicken", {
-- Stats
max_health = 5,
armor_groups = {fleshy = 150},
damage = 0,
speed = 4,
-- Stats
max_health = 5,
armor_groups = {fleshy = 150},
damage = 0,
speed = 4,
tracking_range = 4,
despawn_after = 1500,
despawn_after = 1500,
-- Entity Physics
stepheight = 1.1,
max_fall = 8,
turn_rate = 7,
-- Visuals
mesh = "animalia_chicken.b3d",
-- Visuals
mesh = "animalia_chicken.b3d",
hitbox = {
width = 0.15,
height = 0.3
},
visual_size = {x = 7, y = 7},
visual_size = {x = 7, y = 7},
female_textures = {
"animalia_chicken_1.png",
"animalia_chicken_2.png",
@ -43,45 +43,48 @@ creatura.register_mob("animalia:chicken", {
"animalia_rooster_3.png"
},
child_textures = {"animalia_chicken_child.png"},
animations = {
animations = {
stand = {range = {x = 1, y = 39}, speed = 20, frame_blend = 0.3, loop = true},
walk = {range = {x = 41, y = 59}, speed = 30, frame_blend = 0.3, loop = true},
run = {range = {x = 41, y = 59}, speed = 45, frame_blend = 0.3, loop = true},
eat = {range = {x = 61, y = 89}, speed = 45, frame_blend = 0.3, loop = true},
fall = {range = {x = 91, y = 99}, speed = 70, frame_blend = 0.3, loop = true}
fall = {range = {x = 91, y = 99}, speed = 70, frame_blend = 0.3, loop = true}
},
-- Misc
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
random = {
name = "animalia_chicken_idle",
gain = 0.5,
distance = 8
},
hurt = {
name = "animalia_chicken_hurt",
gain = 0.5,
distance = 8
},
death = {
name = "animalia_chicken_death",
gain = 0.5,
distance = 8
}
},
drops = {
{name = "animalia:poultry_raw", min = 1, max = 3, chance = 1},
sounds = {
random = {
name = "animalia_chicken_idle",
gain = 0.5,
distance = 8
},
hurt = {
name = "animalia_chicken_hurt",
gain = 0.5,
distance = 8
},
death = {
name = "animalia_chicken_death",
gain = 0.5,
distance = 8
}
},
drops = {
{name = "animalia:poultry_raw", min = 1, max = 3, chance = 1},
{name = "animalia:feather", min = 1, max = 3, chance = 2}
},
follow = follows,
},
follow = follows,
head_data = {
offset = {x = 0, y = 0.45, z = 0},
pitch_correction = 40,
pivot_h = 0.25,
pivot_v = 0.55
},
-- Function
move_chance = 2,
idle_time = 1,
-- Function
add_child = function(self)
local pos = self.object:get_pos()
if not pos then return end
@ -158,28 +161,31 @@ creatura.register_mob("animalia:chicken", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
animalia.random_sound(self)
if self.fall_start then
self:set_gravity(-4.9)
self:animate("fall")
end
if self:timer(60) then
animalia.random_drop_item(self, "animalia:chicken_egg", 3)
if (self.growth_scale or 1) < 0.8
and self.gender == "female"
and self:timer(60) then
animalia.random_drop_item(self, "animalia:chicken_egg", 10)
end
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
return
@ -187,7 +193,6 @@ creatura.register_mob("animalia:chicken", {
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "chicken", form = "pg_chicken;Chickens"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -7,33 +7,34 @@ local random = math.random
local follows = {}
minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0)
and not tonumber(name:sub(-1))
and not name:find("seed") then
table.insert(follows, name)
end
end
end
end
end)
creatura.register_mob("animalia:cow", {
-- Stats
max_health = 20,
armor_groups = {fleshy = 150},
damage = 0,
speed = 3,
-- Stats
max_health = 20,
armor_groups = {fleshy = 150},
damage = 0,
speed = 3,
tracking_range = 16,
despawn_after = 1500,
despawn_after = 1500,
-- Entity Physics
stepheight = 1.1,
turn_rate = 6,
-- Visuals
mesh = "animalia_cow.b3d",
-- Visuals
mesh = "animalia_cow.b3d",
hitbox = {
width = 0.65,
height = 1.5
},
visual_size = {x = 10, y = 10},
visual_size = {x = 10, y = 10},
female_textures = {
"animalia_cow_1.png^animalia_cow_udder.png",
"animalia_cow_2.png^animalia_cow_udder.png",
@ -57,33 +58,32 @@ creatura.register_mob("animalia:cow", {
walk = {range = {x = 61, y = 79}, speed = 20, frame_blend = 0.3, loop = true},
run = {range = {x = 61, y = 79}, speed = 30, frame_blend = 0.3, loop = true},
},
-- Misc
-- Misc
step_delay = 0.25,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
random = {
name = "animalia_cow_random",
gain = 0.4,
distance = 8,
variations = 3
},
hurt = {
name = "animalia_cow_hurt",
gain = 0.4,
distance = 8
},
death = {
name = "animalia_cow_death",
gain = 0.4,
distance = 8
}
},
drops = {
{name = "animalia:beef_raw", min = 1, max = 3, chance = 1},
random = {
name = "animalia_cow_random",
gain = 0.4,
distance = 8
},
hurt = {
name = "animalia_cow_hurt",
gain = 0.4,
distance = 8
},
death = {
name = "animalia_cow_death",
gain = 0.4,
distance = 8
}
},
drops = {
{name = "animalia:beef_raw", min = 1, max = 3, chance = 1},
{name = "animalia:leather", min = 1, max = 3, chance = 2}
},
follow = follows,
},
follow = follows,
consumable_nodes = {
["default:dirt_with_grass"] = "default:dirt",
["default:dry_dirt_with_dry_grass"] = "default:dry_dirt"
@ -94,7 +94,7 @@ creatura.register_mob("animalia:cow", {
pivot_h = 0.75,
pivot_v = 1
},
-- Function
-- Function
utility_stack = {
{
utility = "animalia:wander",
@ -160,22 +160,23 @@ creatura.register_mob("animalia:cow", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
self.collected = self:recall("collected") or false
end,
step_func = function(self)
self.collected = self:recall("collected") or false
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
end,
death_func = function(self)
animalia.random_sound(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
return
@ -213,7 +214,6 @@ creatura.register_mob("animalia:cow", {
self.collected = self:memorize("collected", true)
return
end
animalia.add_libri_page(self, clicker, {name = "cow", form = "pg_cow;Cows"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -9,26 +9,26 @@ local vec_dist = vector.distance
local vec_sub = vector.subtract
creatura.register_mob("animalia:frog", {
-- Stats
max_health = 5,
armor_groups = {fleshy = 200},
damage = 0,
speed = 4,
-- Stats
max_health = 5,
armor_groups = {fleshy = 200},
damage = 0,
speed = 4,
tracking_range = 16,
despawn_after = 2500,
despawn_after = 2500,
-- Entity Physics
stepheight = 1.1,
max_fall = 0,
turn_rate = 10,
bouyancy_multiplier = 0,
hydrodynamics_multiplier = 0.3,
-- Visuals
mesh = "animalia_frog.b3d",
hitbox = {
-- Visuals
mesh = "animalia_frog.b3d",
hitbox = {
width = 0.15,
height = 0.3
},
visual_size = {x = 7, y = 7},
visual_size = {x = 7, y = 7},
textures = {
"animalia_frog_1.png",
"animalia_frog_2.png"
@ -43,20 +43,19 @@ creatura.register_mob("animalia:frog", {
walk = {range = {x = 50, y = 80}, speed = 50, frame_blend = 0.3, loop = true},
run = {range = {x = 50, y = 80}, speed = 60, frame_blend = 0.3, loop = true}
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
random = {
name = "animalia_frog",
gain = 0.5,
distance = 32,
name = "animalia_frog",
gain = 0.5,
distance = 32,
variations = 3
}
},
follow = {
}
},
follow = {
"butterflies:butterfly_red",
"butterflies:butterfly_white",
"butterflies:butterfly_violet"
@ -67,7 +66,7 @@ creatura.register_mob("animalia:frog", {
pivot_h = 0.3,
pivot_v = 0.3
},
-- Function
-- Function
utility_stack = {
{
utility = "animalia:wander",
@ -159,7 +158,7 @@ creatura.register_mob("animalia:frog", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
self.trust = self:recall("trust") or {}
@ -168,13 +167,13 @@ creatura.register_mob("animalia:frog", {
local anim = {range = {x = frame, y = frame}, speed = 1, frame_blend = 0.3, loop = false}
self.animations["tongue_" .. i] = anim
end
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.2, 0.2)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
if self:timer(random(5, 10)) then
if self:timer(random(5, 15)) then
self:play_sound("random")
end
local props = self.object:get_properties()
@ -184,12 +183,12 @@ creatura.register_mob("animalia:frog", {
mesh = "animalia_tadpole.b3d"
})
end
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
animalia.add_trust(self, clicker, 1)
@ -198,7 +197,6 @@ creatura.register_mob("animalia:frog", {
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "frog", form = "pg_frog;Frogs"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -7,13 +7,13 @@ local random = math.random
local follows = {}
minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0)
and not name:find("seed") then
table.insert(follows, name)
end
end
end
end
end)
local patterns = {
@ -72,24 +72,24 @@ local function set_pattern(self)
end
creatura.register_mob("animalia:horse", {
-- Stats
max_health = 40,
armor_groups = {fleshy = 100},
damage = 0,
speed = 10,
-- Stats
max_health = 40,
armor_groups = {fleshy = 100},
damage = 0,
speed = 10,
tracking_range = 24,
despawn_after = 2000,
despawn_after = 2000,
-- Entity Physics
stepheight = 1.1,
turn_rate = 6,
turn_rate = 8,
boid_seperation = 1.5,
-- Visuals
mesh = "animalia_horse.b3d",
-- Visuals
mesh = "animalia_horse.b3d",
hitbox = {
width = 0.65,
height = 1.95
},
visual_size = {x = 10, y = 10},
visual_size = {x = 10, y = 10},
textures = {
"animalia_horse_1.png",
"animalia_horse_2.png",
@ -107,33 +107,33 @@ creatura.register_mob("animalia:horse", {
rear_constant = {range = {x = 121, y = 140}, speed = 20, frame_blend = 0.3, loop = false},
eat = {range = {x = 141, y = 160}, speed = 20, frame_blend = 0.3, loop = false}
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
alter_child_pitch = true,
random = {
sounds = {
alter_child_pitch = true,
random = {
name = "animalia_horse_idle",
gain = 1.0,
distance = 8,
variations = 3,
},
hurt = {
name = "animalia_horse_hurt",
gain = 1.0,
distance = 8
},
death = {
name = "animalia_horse_death",
gain = 1.0,
distance = 8
}
},
drops = {
hurt = {
name = "animalia_horse_hurt",
gain = 1.0,
distance = 8
},
death = {
name = "animalia_horse_death",
gain = 1.0,
distance = 8
}
},
drops = {
{name = "animalia:leather", min = 1, max = 4, chance = 2}
},
follow = follows,
},
follow = follows,
consumable_nodes = {
["default:dirt_with_grass"] = "default:dirt",
["default:dry_dirt_with_dry_grass"] = "default:dry_dirt"
@ -145,7 +145,30 @@ creatura.register_mob("animalia:horse", {
pivot_h = 1,
pivot_v = 1.5
},
-- Function
-- Function
add_child = function(self, mate)
local pos = self.object:get_pos()
if not pos then return end
local obj = minetest.add_entity(pos, self.name)
local ent = obj and obj:get_luaentity()
if not ent then return end
ent.growth_scale = 0.7
local tex_no = self.texture_no
local mate_ent = mate and mate:get_luaentity()
if not mate_ent then return end
if random(2) < 2 then
tex_no = mate_ent.texture_no
end
ent:memorize("texture_no", tex_no)
ent:memorize("speed", random(mate_ent.speed, self.speed))
ent:memorize("jump_power", random(mate_ent.jump_power, self.jump_power))
ent:memorize("max_health", random(mate_ent.max_health, self.max_health))
ent.speed = ent:recall("speed")
ent.jump_power = ent:recall("jump_power")
ent.max_health = ent:recall("max_health")
animalia.initialize_api(ent)
animalia.protect_from_despawn(ent)
end,
wander_action = animalia.action_move_flock,
utility_stack = {
{
@ -235,7 +258,7 @@ creatura.register_mob("animalia:horse", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
set_pattern(self)
@ -262,18 +285,19 @@ creatura.register_mob("animalia:horse", {
{name = "animalia:saddle", chance = 1, min = 1, max = 1}
}
end
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
end,
death_func = function(self)
animalia.random_sound(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
return
@ -284,7 +308,7 @@ creatura.register_mob("animalia:horse", {
local tool = clicker:get_wielded_item()
local tool_name = clicker:get_wielded_item():get_name()
if self.owner
and self.owner == clicker:get_player_name() then
and self.owner == clicker:get_player_name() then
if self.saddled
and tool_name == "" then
animalia.mount(self, clicker, {rot = {x = -75, y = 180, z = 0}, pos = {x = 0, y = 0.6, z = 0.5}})
@ -302,11 +326,10 @@ creatura.register_mob("animalia:horse", {
tool:take_item()
clicker:set_wielded_item(tool)
end
elseif not self.owner
elseif not self.owner
and tool_name == "" then
animalia.mount(self, clicker, {rot = {x = -60, y = 180, z = 0}, pos = {x = 0, y = 1.1, z = 0.5}})
animalia.mount(self, clicker, {rot = {x = -75, y = 180, z = 0}, pos = {x = 0, y = 0.6, z = 0.5}})
end
animalia.add_libri_page(self, clicker, {name = "horse", form = "pg_horse;Horses"})
end,
on_punch = function(self, puncher, ...)
if self.rider and puncher == self.rider then return end

View file

@ -5,13 +5,13 @@
local follows = {}
minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_items) do
if name:match(":carrot")
for name in pairs(minetest.registered_items) do
if name:match(":carrot")
and (minetest.get_item_group(name, "food") > 0
or minetest.get_item_group(name, "food_carrot") > 0) then
table.insert(follows, name)
end
end
end
end
end)
local destroyable_crops = {}
@ -26,18 +26,18 @@ minetest.register_on_mods_loaded(function()
end)
creatura.register_mob("animalia:pig", {
-- Stats
max_health = 10,
armor_groups = {fleshy = 100},
damage = 0,
speed = 3,
-- Stats
max_health = 10,
armor_groups = {fleshy = 100},
damage = 0,
speed = 3,
tracking_range = 16,
despawn_after = 1500,
despawn_after = 1500,
-- Entity Physics
stepheight = 1.1,
turn_rate = 6,
-- Visuals
mesh = "animalia_pig.b3d",
-- Visuals
mesh = "animalia_pig.b3d",
hitbox = {
width = 0.35,
height = 0.7
@ -63,34 +63,34 @@ creatura.register_mob("animalia:pig", {
walk = {range = {x = 1, y = 20}, speed = 30, frame_blend = 0.3, loop = true},
run = {range = {x = 1, y = 20}, speed = 45, frame_blend = 0.3, loop = true},
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
consumable_nodes = destroyable_crops,
birth_count = 2,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
random = {
name = "animalia_pig_idle",
gain = 1.0,
distance = 8
},
hurt = {
name = "animalia_pig_hurt",
random = {
name = "animalia_pig_idle",
gain = 1.0,
distance = 8
},
death = {
name = "animalia_pig_death",
distance = 8
},
hurt = {
name = "animalia_pig_hurt",
gain = 1.0,
distance = 8
}
},
drops = {
{name = "animalia:porkchop_raw", min = 1, max = 3, chance = 1}
},
follow = follows,
-- Function
distance = 8
},
death = {
name = "animalia_pig_death",
gain = 1.0,
distance = 8
}
},
drops = {
{name = "animalia:porkchop_raw", min = 1, max = 3, chance = 1}
},
follow = follows,
-- Function
utility_stack = {
[1] = {
utility = "animalia:wander",
@ -144,20 +144,21 @@ creatura.register_mob("animalia:pig", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
end,
death_func = function(self)
animalia.random_sound(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
return
@ -165,7 +166,6 @@ creatura.register_mob("animalia:pig", {
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "pig", form = "pg_pig;Pigs"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -5,36 +5,36 @@
local follows = {}
minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0)
and not name:find("seed") then
table.insert(follows, name)
end
end
end
end
end)
local random = math.random
creatura.register_mob("animalia:reindeer", {
-- Stats
max_health = 20,
armor_groups = {fleshy = 125},
damage = 0,
speed = 3,
-- Stats
max_health = 20,
armor_groups = {fleshy = 125},
damage = 0,
speed = 3,
boid_seperation = 1,
tracking_range = 16,
despawn_after = 1500,
despawn_after = 1500,
-- Entity Physics
stepheight = 1.1,
turn_rate = 4,
-- Visuals
mesh = "animalia_reindeer.b3d",
-- Visuals
mesh = "animalia_reindeer.b3d",
hitbox = {
width = 0.45,
height = 0.9
},
visual_size = {x = 10, y = 10},
visual_size = {x = 10, y = 10},
textures = {"animalia_reindeer.png"},
child_textures = {"animalia_reindeer_calf.png"},
animations = {
@ -42,15 +42,15 @@ creatura.register_mob("animalia:reindeer", {
walk = {range = {x = 70, y = 110}, speed = 40, frame_blend = 0.3, loop = true},
run = {range = {x = 70, y = 110}, speed = 50, frame_blend = 0.3, loop = true},
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
drops = {
{name = "animalia:venison_raw", min = 1, max = 3, chance = 1},
drops = {
{name = "animalia:venison_raw", min = 1, max = 3, chance = 1},
{name = "animalia:leather", min = 1, max = 3, chance = 2}
},
follow = follows,
},
follow = follows,
consumable_nodes = {
{
name = "default:dirt_with_grass",
@ -67,7 +67,9 @@ creatura.register_mob("animalia:reindeer", {
pivot_h = 1,
pivot_v = 1
},
-- Function
move_chance = 2,
idle_time = 1,
-- Function
utility_stack = {
{
utility = "animalia:wander_group",
@ -133,21 +135,21 @@ creatura.register_mob("animalia:reindeer", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
return
@ -155,7 +157,6 @@ creatura.register_mob("animalia:reindeer", {
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "reindeer", form = "pg_reindeer;Reindeer"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -7,13 +7,13 @@ local random = math.random
local follows = {}
minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
for name in pairs(minetest.registered_items) do
if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0)
and not name:find("seed") then
table.insert(follows, name)
end
end
end
end
end)
local wool_block = "wool:white"
@ -43,17 +43,17 @@ local palette = {
}
creatura.register_mob("animalia:sheep", {
-- Stats
max_health = 15,
armor_groups = {fleshy = 125},
damage = 0,
speed = 3,
-- Stats
max_health = 15,
armor_groups = {fleshy = 125},
damage = 0,
speed = 3,
tracking_range = 16,
despawn_after = 1500,
despawn_after = 1500,
-- Entity Physics
stepheight = 1.1,
-- Visuals
mesh = "animalia_sheep.b3d",
-- Visuals
mesh = "animalia_sheep.b3d",
hitbox = {
width = 0.4,
height = 0.8
@ -70,32 +70,32 @@ creatura.register_mob("animalia:sheep", {
walk = {range = {x = 70, y = 110}, speed = 40, frame_blend = 0.3, loop = true},
run = {range = {x = 70, y = 110}, speed = 50, frame_blend = 0.3, loop = true},
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
random = {
name = "animalia_sheep_idle",
gain = 1.0,
distance = 8
},
hurt = {
name = "animalia_sheep_hurt",
random = {
name = "animalia_sheep_idle",
gain = 1.0,
distance = 8
},
death = {
name = "animalia_sheep_death",
distance = 8
},
hurt = {
name = "animalia_sheep_hurt",
gain = 1.0,
distance = 8
}
},
drops = {
{name = "animalia:mutton_raw", min = 1, max = 3, chance = 1},
distance = 8
},
death = {
name = "animalia_sheep_death",
gain = 1.0,
distance = 8
}
},
drops = {
{name = "animalia:mutton_raw", min = 1, max = 3, chance = 1},
{name = wool_block, min = 1, max = 3, chance = 2}
},
follow = follows,
},
follow = follows,
consumable_nodes = {
["default:dirt_with_grass"] = "default:dirt",
["default:dry_dirt_with_dry_grass"] = "default:dry_dirt"
@ -106,7 +106,7 @@ creatura.register_mob("animalia:sheep", {
pivot_h = 0.75,
pivot_v = 0.85
},
-- Function
-- Function
utility_stack = {
{
utility = "animalia:wander_group",
@ -174,8 +174,8 @@ creatura.register_mob("animalia:sheep", {
end
}
},
activate_func = function(self)
self.collected = self:recall("collected") or false
activate_func = function(self)
self.collected = self:recall("collected") or false
self.dye_color = self:recall("dye_color") or "white"
self.dye_hex = self:recall("dye_hex") or ""
if self.dye_color ~= "white"
@ -189,22 +189,23 @@ creatura.register_mob("animalia:sheep", {
textures = {"animalia_sheep.png"},
})
end
self.attention_span = 8
self._path = {}
self.attention_span = 8
self._path = {}
animalia.initialize_api(self)
animalia.initialize_lasso(self)
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
end,
death_func = function(self)
animalia.random_sound(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
return
@ -265,7 +266,6 @@ creatura.register_mob("animalia:sheep", {
end
end
end
animalia.add_libri_page(self, clicker, {name = "sheep", form = "pg_sheep;Sheep"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -3,41 +3,41 @@
----------
creatura.register_mob("animalia:tropical_fish", {
-- Stats
max_health = 5,
armor_groups = {fleshy = 150},
damage = 0,
speed = 2,
-- Stats
max_health = 5,
armor_groups = {fleshy = 150},
damage = 0,
speed = 2,
tracking_range = 6,
despawn_after = 2500,
despawn_after = 2500,
-- Entity Physics
stepheight = 0.1,
max_fall = 0,
turn_rate = 8,
boid_seperation = 0.3,
bouyancy_multiplier = 0,
-- Visuals
mesh = "animalia_clownfish.b3d",
-- Visuals
mesh = "animalia_clownfish.b3d",
hitbox = {
width = 0.15,
height = 0.3
},
visual_size = {x = 7, y = 7},
visual_size = {x = 7, y = 7},
textures = {
"animalia_clownfish.png",
"animalia_blue_tang.png",
"animalia_angelfish.png"
},
animations = {
animations = {
swim = {range = {x = 1, y = 20}, speed = 20, frame_blend = 0.3, loop = true},
flop = {range = {x = 30, y = 40}, speed = 20, frame_blend = 0.3, loop = true},
},
-- Misc
-- Misc
step_delay = 0.25,
catch_with_net = true,
catch_with_lasso = false,
makes_footstep_sound = false,
-- Function
-- Function
utility_stack = {
{
utility = "animalia:aquatic_wander_school",
@ -58,7 +58,7 @@ creatura.register_mob("animalia:tropical_fish", {
end
},
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
if self.texture_no == 3 then
@ -66,22 +66,21 @@ creatura.register_mob("animalia:tropical_fish", {
mesh = "animalia_angelfish.b3d",
})
end
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "tropical_fish", form = "pg_tropical_fish;Tropical Fish"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -5,74 +5,76 @@
local follows = {}
minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_items) do
if name:match(":seed_")
for name in pairs(minetest.registered_items) do
if name:match(":seed_")
or name:match("_seed") then
table.insert(follows, name)
end
end
end
end
end)
creatura.register_mob("animalia:turkey", {
-- Stats
max_health = 10,
armor_groups = {fleshy = 150},
damage = 0,
speed = 4,
-- Stats
max_health = 10,
armor_groups = {fleshy = 150},
damage = 0,
speed = 4,
tracking_range = 16,
despawn_after = 1500,
despawn_after = 1500,
-- Entity Physics
stepheight = 1.1,
max_fall = 8,
-- Visuals
mesh = "animalia_turkey.b3d",
-- Visuals
mesh = "animalia_turkey.b3d",
hitbox = {
width = 0.3,
height = 0.6
},
visual_size = {x = 7, y = 7},
visual_size = {x = 7, y = 7},
female_textures = {"animalia_turkey_hen.png"},
male_textures = {"animalia_turkey_tom.png"},
child_textures = {"animalia_turkey_chick.png"},
animations = {
animations = {
stand = {range = {x = 0, y = 0}, speed = 1, frame_blend = 0.3, loop = true},
walk = {range = {x = 10, y = 30}, speed = 30, frame_blend = 0.3, loop = true},
run = {range = {x = 40, y = 60}, speed = 45, frame_blend = 0.3, loop = true},
fall = {range = {x = 70, y = 90}, speed = 30, frame_blend = 0.3, loop = true},
fall = {range = {x = 70, y = 90}, speed = 30, frame_blend = 0.3, loop = true},
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
sounds = {
random = {
name = "animalia_turkey_idle",
gain = 1.0,
distance = 8
},
hurt = {
name = "animalia_turkey_hurt",
gain = 1.0,
distance = 8
},
death = {
name = "animalia_turkey_death",
gain = 1.0,
distance = 8
}
},
drops = {
{name = "animalia:poultry_raw", min = 2, max = 4, chance = 1},
sounds = {
random = {
name = "animalia_turkey_idle",
gain = 1.0,
distance = 8
},
hurt = {
name = "animalia_turkey_hurt",
gain = 1.0,
distance = 8
},
death = {
name = "animalia_turkey_death",
gain = 1.0,
distance = 8
}
},
drops = {
{name = "animalia:poultry_raw", min = 2, max = 4, chance = 1},
{name = "animalia:feather", min = 2, max = 4, chance = 2}
},
follow = follows,
},
follow = follows,
head_data = {
offset = {x = 0, y = 0.15, z = 0},
pitch_correction = 45,
pivot_h = 0.45,
pivot_v = 0.65
},
-- Function
move_chance = 2,
idle_time = 1,
-- Function
add_child = function(self)
local pos = self.object:get_pos()
if not pos then return end
@ -147,28 +149,31 @@ creatura.register_mob("animalia:turkey", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
animalia.random_sound(self)
if self.fall_start then
self:set_gravity(-4.9)
self:animate("fall")
end
if self:timer(60) then
animalia.random_drop_item(self, "animalia:chicken_egg", 3)
if (self.growth_scale or 1) < 0.8
and self.gender == "female"
and self:timer(60) then
animalia.random_drop_item(self, "animalia:turkey_egg", 10)
end
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then
return
@ -176,7 +181,6 @@ creatura.register_mob("animalia:turkey", {
if animalia.set_nametag(self, clicker) then
return
end
animalia.add_libri_page(self, clicker, {name = "turkey", form = "pg_turkey;Turkeys"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)

View file

@ -35,32 +35,32 @@ if minetest.registered_items["bonemeal:bone"] then
end
local function is_value_in_table(tbl, val)
for _, v in pairs(tbl) do
if v == val then
return true
end
end
return false
for _, v in pairs(tbl) do
if v == val then
return true
end
end
return false
end
creatura.register_mob("animalia:wolf", {
-- Stats
max_health = 15,
armor_groups = {fleshy = 100},
damage = 4,
speed = 5,
-- Stats
max_health = 15,
armor_groups = {fleshy = 100},
damage = 4,
speed = 5,
tracking_range = 24,
despawn_after = 2000,
despawn_after = 2000,
-- Entity Physics
stepheight = 1.1,
max_fall = 3,
-- Visuals
mesh = "animalia_wolf.b3d",
-- Visuals
mesh = "animalia_wolf.b3d",
hitbox = {
width = 0.35,
height = 0.7
},
visual_size = {x = 9, y = 9},
visual_size = {x = 9, y = 9},
textures = {
"animalia_wolf_1.png",
"animalia_wolf_2.png",
@ -73,19 +73,19 @@ creatura.register_mob("animalia:wolf", {
run = {range = {x = 41, y = 59}, speed = 45, frame_blend = 0.3, loop = true},
sit = {range = {x = 61, y = 79}, speed = 20, frame_blend = 0.3, loop = true},
},
-- Misc
step_delay = 0.25,
-- Misc
makes_footstep_sound = true,
catch_with_net = true,
catch_with_lasso = true,
assist_owner = true,
follow = follow,
follow = follow,
head_data = {
offset = {x = 0, y = 0.33, z = 0},
pitch_correction = -67,
pivot_h = 0.65,
pivot_v = 0.65
},
-- Function
-- Function
utility_stack = {
{
utility = "animalia:wander_skittish",
@ -155,7 +155,7 @@ creatura.register_mob("animalia:wolf", {
end
}
},
activate_func = function(self)
activate_func = function(self)
animalia.initialize_api(self)
animalia.initialize_lasso(self)
self.order = self:recall("order") or "wander"
@ -167,18 +167,18 @@ creatura.register_mob("animalia:wolf", {
table.insert(animalia.pets[self.owner], self.object)
end
end
end,
step_func = function(self)
end,
step_func = function(self)
animalia.step_timers(self)
animalia.head_tracking(self, 0.5, 0.75)
animalia.do_growth(self, 60)
animalia.update_lasso_effects(self)
end,
death_func = function(self)
end,
death_func = function(self)
if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self)
end
end,
end,
on_rightclick = function(self, clicker)
if not clicker:is_player() then return end
local name = clicker:get_player_name()
@ -211,7 +211,6 @@ creatura.register_mob("animalia:wolf", {
end
self:memorize("order", self.order)
end
animalia.add_libri_page(self, clicker, {name = "wolf", form = "pg_wolf;Wolves"})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)