This commit is contained in:
ElCeejo 2022-08-12 22:17:42 -07:00
parent 78e7b8bb44
commit eccc33cea5
108 changed files with 4818 additions and 5250 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -182,7 +182,7 @@ minetest.register_entity("animalia:lasso_visual", {
is_visible = true, is_visible = true,
makes_footstep_sound = false, makes_footstep_sound = false,
glow = 1, glow = 1,
on_step = function(self, dtime) on_step = function(self)
self.object:set_armor_groups({immortal = 1}) self.object:set_armor_groups({immortal = 1})
if not self.parent if not self.parent
or not self.lasso_origin or not self.lasso_origin
@ -206,7 +206,7 @@ minetest.register_entity("animalia:frog_tongue_visual", {
textures = {"animalia_frog_tongue.png"}, textures = {"animalia_frog_tongue.png"},
is_visible = true, is_visible = true,
makes_footstep_sound = false, makes_footstep_sound = false,
on_step = function(self, dtime) on_step = function(self)
self.object:set_armor_groups({immortal = 1}) self.object:set_armor_groups({immortal = 1})
if not self.parent if not self.parent
or not self.lasso_origin or not self.lasso_origin
@ -319,7 +319,7 @@ minetest.register_entity("animalia:lasso_fence_ent", {
minetest.register_craftitem("animalia:lasso", { minetest.register_craftitem("animalia:lasso", {
description = "Lasso", description = "Lasso",
inventory_image = "animalia_lasso.png", inventory_image = "animalia_lasso.png",
on_secondary_use = function(itemstack, placer, pointed_thing) on_secondary_use = function(_, placer, pointed_thing)
if pointed_thing.type == "object" then if pointed_thing.type == "object" then
if pointed_thing.ref:is_player() then return end if pointed_thing.ref:is_player() then return end
local ent = pointed_thing.ref:get_luaentity() local ent = pointed_thing.ref:get_luaentity()

View file

@ -8,7 +8,8 @@ for i = 1, #animalia.mobs do
minetest.register_entity(":" .. old_mob, { minetest.register_entity(":" .. old_mob, {
on_activate = mob_core.on_activate on_activate = mob_core.on_activate
}) })
minetest.register_alias_force("better_fauna:spawn_" .. new_mob:split(":")[2], "animalia:spawn_" .. new_mob:split(":")[2]) minetest.register_alias_force("better_fauna:spawn_" .. new_mob:split(":")[2],
"animalia:spawn_" .. new_mob:split(":")[2])
end end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
@ -16,8 +17,9 @@ minetest.register_globalstep(function(dtime)
for _, mob in pairs(mobs) do for _, mob in pairs(mobs) do
if mob if mob
and mob.name:match("better_fauna:") then and mob.name:match("better_fauna:") then
local pos = mob.object:get_pos()
if not pos then return end
if mob.name:find("lasso_fence_ent") then if mob.name:find("lasso_fence_ent") then
local pos = mob.object:get_pos()
if pos then if pos then
minetest.add_entity(pos, "animalia:lasso_fence_ent") minetest.add_entity(pos, "animalia:lasso_fence_ent")
end end
@ -33,7 +35,6 @@ minetest.register_globalstep(function(dtime)
local new_name = ent:split(":")[2] local new_name = ent:split(":")[2]
local old_name = mob.name:split(":")[2] local old_name = mob.name:split(":")[2]
if new_name == old_name then if new_name == old_name then
local pos = mob.object:get_pos()
if pos then if pos then
local new_mob = minetest.add_entity(pos, ent) local new_mob = minetest.add_entity(pos, ent)
local mem = nil local mem = nil

View file

@ -18,208 +18,192 @@ local frog_biomes = {}
local pig_biomes = {} local pig_biomes = {}
local wolf_biomes = {}
local function insert_all(tbl, tbl2) local function insert_all(tbl, tbl2)
for i = 1, #tbl2 do for i = 1, #tbl2 do
table.insert(tbl, tbl2[i]) table.insert(tbl, tbl2[i])
end end
end end
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
insert_all(chicken_biomes, animalia.registered_biome_groups["grassland"].biomes) insert_all(chicken_biomes, animalia.registered_biome_groups["grassland"].biomes)
insert_all(chicken_biomes, animalia.registered_biome_groups["tropical"].biomes) insert_all(chicken_biomes, animalia.registered_biome_groups["tropical"].biomes)
insert_all(pig_biomes, animalia.registered_biome_groups["temperate"].biomes) insert_all(pig_biomes, animalia.registered_biome_groups["temperate"].biomes)
insert_all(pig_biomes, animalia.registered_biome_groups["boreal"].biomes) insert_all(pig_biomes, animalia.registered_biome_groups["boreal"].biomes)
insert_all(frog_biomes, animalia.registered_biome_groups["swamp"].biomes) insert_all(frog_biomes, animalia.registered_biome_groups["swamp"].biomes)
insert_all(frog_biomes, animalia.registered_biome_groups["tropical"].biomes) insert_all(frog_biomes, animalia.registered_biome_groups["tropical"].biomes)
end) end)
creatura.register_mob_spawn("animalia:bat", { creatura.register_mob_spawn("animalia:bat", {
chance = 2, chance = 2,
min_radius = 4, min_radius = 4,
max_radius = 16, max_radius = 16,
min_light = 0, min_light = 0,
min_height = -512, min_height = -512,
max_height = 0, max_height = 0,
min_group = 3, min_group = 3,
max_group = 5, max_group = 5,
biomes = animalia.registered_biome_groups["cave"].biomes, biomes = animalia.registered_biome_groups["cave"].biomes,
spawn_in_nodes = true, spawn_in_nodes = true,
nodes = {"air", "ignore"} nodes = {"air", "ignore"}
}) })
creatura.register_mob_spawn("animalia:chicken", { creatura.register_mob_spawn("animalia:chicken", {
chance = 3, chance = 3,
min_group = 3, min_group = 3,
max_group = 5, max_group = 5,
biomes = chicken_biomes biomes = chicken_biomes
}) })
creatura.register_mob_spawn("animalia:cow", { creatura.register_mob_spawn("animalia:cow", {
chance = 3, chance = 3,
min_group = 3, min_group = 3,
max_group = 4, max_group = 4,
biomes = animalia.registered_biome_groups["grassland"].biomes biomes = animalia.registered_biome_groups["grassland"].biomes
}) })
creatura.register_mob_spawn("animalia:frog", { creatura.register_mob_spawn("animalia:frog", {
chance = 2, chance = 2,
min_radius = 4, min_radius = 4,
max_radius = 16, max_radius = 16,
min_light = 0, min_light = 0,
min_height = -32, min_height = -32,
max_height = 8, max_height = 8,
min_group = 2, min_group = 2,
max_group = 6, max_group = 6,
biomes = frog_biomes, biomes = frog_biomes,
spawn_cluster = true, spawn_cluster = true,
spawn_in_nodes = true, spawn_in_nodes = true,
nodes = {"default:water_source"}, nodes = {"default:water_source"},
}) })
creatura.register_mob_spawn("animalia:horse", { creatura.register_mob_spawn("animalia:horse", {
chance = 3, chance = 3,
min_group = 4, min_group = 4,
max_group = 5, max_group = 5,
biomes = animalia.registered_biome_groups["grassland"].biomes biomes = animalia.registered_biome_groups["grassland"].biomes
}) })
creatura.register_mob_spawn("animalia:pig", { creatura.register_mob_spawn("animalia:pig", {
chance = 3, chance = 3,
min_group = 2, min_group = 2,
max_group = 4, max_group = 4,
biomes = pig_biomes biomes = pig_biomes
}) })
creatura.register_mob_spawn("animalia:reindeer", { creatura.register_mob_spawn("animalia:reindeer", {
chance = 4, chance = 4,
min_group = 6, min_group = 6,
max_group = 12, max_group = 12,
biomes = animalia.registered_biome_groups["boreal"].biomes biomes = animalia.registered_biome_groups["boreal"].biomes
}) })
creatura.register_mob_spawn("animalia:sheep", { creatura.register_mob_spawn("animalia:sheep", {
chance = 3, chance = 3,
min_group = 3, min_group = 3,
max_group = 6, max_group = 6,
biomes = animalia.registered_biome_groups["grassland"].biomes biomes = animalia.registered_biome_groups["grassland"].biomes
}) })
creatura.register_mob_spawn("animalia:turkey", { creatura.register_mob_spawn("animalia:turkey", {
chance = 2, chance = 2,
min_group = 3, min_group = 3,
max_group = 4, max_group = 4,
biomes = animalia.registered_biome_groups["boreal"].biomes biomes = animalia.registered_biome_groups["boreal"].biomes
}) })
creatura.register_mob_spawn("animalia:wolf", { creatura.register_mob_spawn("animalia:wolf", {
chance = 3, chance = 3,
min_group = 2, min_group = 2,
max_group = 3, max_group = 3,
biomes = animalia.registered_biome_groups["boreal"].biomes biomes = animalia.registered_biome_groups["boreal"].biomes
}) })
creatura.register_mob_spawn("animalia:bird", { creatura.register_mob_spawn("animalia:bird", {
chance = 1, chance = 1,
min_light = 0, min_light = 0,
min_group = 12, min_group = 12,
max_group = 16, max_group = 16,
biomes = animalia.registered_biome_groups["common"].biomes, biomes = animalia.registered_biome_groups["common"].biomes,
spawn_cluster = true, spawn_cluster = true,
nodes = {"group:leaves"} nodes = {"group:leaves"}
}) })
creatura.register_on_spawn("animalia:bird", function(self, pos) creatura.register_on_spawn("animalia:bird", function(self, pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == "air" then if node.name == "air" then
minetest.set_node(pos, {name = "animalia:nest_song_bird"}) minetest.set_node(pos, {name = "animalia:nest_song_bird"})
self.home_position = self:memorize("home_position", pos) self.home_position = self:memorize("home_position", pos)
self.despawn_after = self:memorize("despawn_after", nil) self.despawn_after = self:memorize("despawn_after", nil)
else else
local nodes = minetest.find_nodes_in_area_under_air({x = pos.x - 3, y = pos.y - 3, z = pos.z - 3}, {x = pos.x + 3, y = pos.y + 7, z = pos.z + 3}, "group:leaves") local nodes = minetest.find_nodes_in_area_under_air(
if nodes[1] then {x = pos.x - 3, y = pos.y - 3, z = pos.z - 3},
pos = nodes[1] {x = pos.x + 3, y = pos.y + 7, z = pos.z + 3},
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "animalia:nest_song_bird"}) "group:leaves"
self.home_position = self:memorize("home_position", nodes[1]) )
self.despawn_after = self:memorize("despawn_after", nil) if nodes[1] then
end pos = nodes[1]
end minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "animalia:nest_song_bird"})
self.home_position = self:memorize("home_position", {x = pos.x, y = pos.y + 1, z = pos.z})
self.despawn_after = self:memorize("despawn_after", nil)
end
end
end) end)
creatura.register_mob_spawn("animalia:tropical_fish", { creatura.register_mob_spawn("animalia:tropical_fish", {
chance = 3, chance = 3,
min_height = -128, min_height = -128,
max_height = 256, max_height = 256,
min_group = 8, min_group = 8,
max_group = 12, max_group = 12,
spawn_cluster = true, spawn_cluster = true,
spawn_in_nodes = true, spawn_in_nodes = true,
nodes = {"default:water_source"} nodes = {"default:water_source"}
}) })
--------------------- ---------------------
-- Mapgen Spawning -- -- Mapgen Spawning --
--------------------- ---------------------
local function vec_raise(v, n) local function is_value_in_table(tbl, val)
return {x = v.x, y = v.y + n, z = v.z} for _, v in pairs(tbl) do
if v == val then
return true
end
end
return false
end end
function is_value_in_table(tbl, val) local function get_biome_name(pos)
for _, v in pairs(tbl) do if not pos then return end
if v == val then return minetest.get_biome_name(minetest.get_biome_data(pos).biome)
return true
end
end
return false
end
function get_biome_name(pos)
if not pos then return end
return minetest.get_biome_name(minetest.get_biome_data(pos).biome)
end
function get_ground_level(pos)
local node = minetest.get_node(pos)
local node_def = minetest.registered_nodes[node.name]
local height = 0
while node_def.walkable
and height < 4 do
height = height + 1
node = minetest.get_node(vec_raise(pos, height))
node_def = minetest.registered_nodes[node.name]
end
return vec_raise(pos, height)
end end
local function dist_to_nearest_player(pos) local function dist_to_nearest_player(pos)
local dist local dist
for _, player in pairs(minetest.get_connected_players()) do for _, player in pairs(minetest.get_connected_players()) do
local player_pos = player:get_pos() local player_pos = player:get_pos()
if player_pos if player_pos
and (not dist and (not dist
or dist > vector.distance(pos, player_pos)) then or dist > vector.distance(pos, player_pos)) then
dist = vector.distance(pos, player_pos) dist = vector.distance(pos, player_pos)
end end
end end
return dist or 100 return dist or 100
end end
local function get_spawnable_mobs(pos) local function get_spawnable_mobs(pos)
local biome = get_biome_name(pos) local biome = get_biome_name(pos)
if not biome then return end if not biome then return end
local spawnable = {} local spawnable = {}
for k, v in pairs(creatura.registered_mob_spawns) do for k, v in pairs(creatura.registered_mob_spawns) do
if (not v.biomes if (not v.biomes
or is_value_in_table(v.biomes, biome)) or is_value_in_table(v.biomes, biome))
and k:match("^animalia:") and k:match("^animalia:")
and not v.spawn_in_nodes then and not v.spawn_in_nodes then
table.insert(spawnable, k) table.insert(spawnable, k)
end end
end end
return spawnable return spawnable
end end
local mapgen_spawning = minetest.settings:get_bool("animalia_mapgen_spawning") or true local mapgen_spawning = minetest.settings:get_bool("animalia_mapgen_spawning") or true
@ -233,129 +217,131 @@ animalia.spawn_queue = {}
local c_air = minetest.get_content_id("air") local c_air = minetest.get_content_id("air")
minetest.register_on_generated(function(minp, maxp) minetest.register_on_generated(function(minp, maxp)
if not mapgen_spawning then return end if not mapgen_spawning then return end
animalia.chunks_since_last_spawn = animalia.chunks_since_last_spawn + 1 animalia.chunks_since_last_spawn = animalia.chunks_since_last_spawn + 1
local max_y = maxp.y local max_y = maxp.y
local min_x = minp.x local min_x = minp.x
local max_x = maxp.x local max_x = maxp.x
local min_z = minp.z local min_z = minp.z
local max_z = maxp.z local max_z = maxp.z
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local data = vm:get_data() local data = vm:get_data()
local spawn_added = false local spawn_added = false
for xcen = min_x + 8, max_x - 7, 8 do for xcen = min_x + 8, max_x - 7, 8 do
if spawn_added then break end if spawn_added then break end
for zcen = min_z + 8, max_z - 7, 8 do for zcen = min_z + 8, max_z - 7, 8 do
local surface = false -- y of above surface node local surface = false -- y of above surface node
for y = max_y, 2, -1 do for y = max_y, 2, -1 do
local vi = area:index(xcen, y, zcen) local vi = area:index(xcen, y, zcen)
local c_node = data[vi] local c_node = data[vi]
if not c_node then break end if not c_node then break end
local c_name = minetest.get_name_from_content_id(c_node) local c_name = minetest.get_name_from_content_id(c_node)
local c_def = minetest.registered_nodes[c_name] local c_def = minetest.registered_nodes[c_name]
if y == max_y and c_node ~= c_air then -- if top node solid if y == max_y and c_node ~= c_air then -- if top node solid
break break
elseif minetest.get_item_group(c_name, "leaves") > 0 then elseif minetest.get_item_group(c_name, "leaves") > 0 then
break break
elseif c_def.walkable then elseif c_def.walkable then
surface = y + 1 surface = y + 1
break break
end end
end end
if animalia.chunks_since_last_spawn > chunk_spawn_add_int if animalia.chunks_since_last_spawn > chunk_spawn_add_int
and surface then and surface then
local center = { local center = {
x = xcen, x = xcen,
y = surface, y = surface,
z = zcen, z = zcen,
} }
local spawnable_mobs = get_spawnable_mobs(center) local spawnable_mobs = get_spawnable_mobs(center)
if spawnable_mobs if spawnable_mobs
and #spawnable_mobs > 0 then and #spawnable_mobs > 0 then
local mob = spawnable_mobs[random(#spawnable_mobs)] local mob = spawnable_mobs[random(#spawnable_mobs)]
local spawn_def = creatura.registered_mob_spawns[mob] local spawn_def = creatura.registered_mob_spawns[mob]
table.insert(animalia.spawn_queue, {pos = center, mob = mob, group = random(spawn_def.min_group, spawn_def.max_group)}) table.insert(animalia.spawn_queue,
table.insert(animalia.spawn_points, center) {pos = center, mob = mob, group = random(spawn_def.min_group, spawn_def.max_group)})
end table.insert(animalia.spawn_points, center)
spawn_added = true end
animalia.chunks_since_last_spawn = 0 spawn_added = true
end animalia.chunks_since_last_spawn = 0
end end
end
end end
end) end)
local respawn_interval = 15 local respawn_interval = 15
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
respawn_interval = respawn_interval - dtime respawn_interval = respawn_interval - dtime
if respawn_interval <= 0 then if respawn_interval <= 0 then
if #animalia.spawn_points > 0 then if #animalia.spawn_points > 0 then
for i = 1, #animalia.spawn_points do for i = 1, #animalia.spawn_points do
local point = animalia.spawn_points[i] local point = animalia.spawn_points[i]
if dist_to_nearest_player(point) < 48 if dist_to_nearest_player(point) < 48
and minetest.get_node_or_nil(point) then and minetest.get_node_or_nil(point) then
local spawnable_mobs = get_spawnable_mobs(point) local spawnable_mobs = get_spawnable_mobs(point)
if spawnable_mobs if spawnable_mobs
and #spawnable_mobs > 0 then and #spawnable_mobs > 0 then
local mob = spawnable_mobs[random(#spawnable_mobs)] local mob = spawnable_mobs[random(#spawnable_mobs)]
local objects = minetest.get_objects_inside_radius(point, 32) local objects = minetest.get_objects_inside_radius(point, 32)
local spawn = true local spawn = true
if #objects > 0 then if #objects > 0 then
for i = 1, #objects do for _, object in ipairs(objects) do
local object = objects[i] local ent = object and object:get_luaentity()
if object:get_luaentity() if ent
and object:get_luaentity().name:find("animalia:") then and ent.name:find("animalia:") then
spawn = false spawn = false
break break
end end
end end
end end
if spawn then if spawn then
local spawn_def = creatura.registered_mob_spawns[mob] local spawn_def = creatura.registered_mob_spawns[mob]
table.insert(animalia.spawn_queue, {pos = point, mob = mob, group = random(spawn_def.min_group, spawn_def.max_group)}) table.insert(animalia.spawn_queue,
end {pos = point, mob = mob, group = random(spawn_def.min_group, spawn_def.max_group)})
end end
end end
end end
end end
respawn_interval = 15 end
end respawn_interval = 15
end
end) end)
local chunk_spawn_queue_int = tonumber(minetest.settings:get("chunk_spawn_queue_int")) or 16 local chunk_spawn_queue_int = tonumber(minetest.settings:get("chunk_spawn_queue_int")) or 16
local function spawn_queued() local function spawn_queued()
if not mapgen_spawning then return end if not mapgen_spawning then return end
local queue = animalia.spawn_queue local queue = animalia.spawn_queue
if #queue > 0 then if #queue > 0 then
for i = #queue, 1, -1 do for i = #queue, 1, -1 do
if queue[i].mob then if queue[i].mob then
local pos = queue[i].pos local pos = queue[i].pos
if queue[i].group > 4 if queue[i].group > 4
or creatura.registered_mob_spawns[queue[i].mob].spawn_cluster then or creatura.registered_mob_spawns[queue[i].mob].spawn_cluster then
pos = get_ground_level(pos) pos = creatura.get_ground_level(pos, 4)
minetest.add_node(pos, {name = "creatura:spawn_node"}) minetest.add_node(pos, {name = "creatura:spawn_node"})
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("mob", queue[i].mob) meta:set_string("mob", queue[i].mob)
meta:set_string("cluster", queue[i].group) meta:set_string("cluster", queue[i].group)
else else
for _ = 1, queue[i].group do for _ = 1, queue[i].group do
pos = { pos = {
x = pos.x + random(-3, 3), x = pos.x + random(-3, 3),
y = pos.y, y = pos.y,
z = pos.z + random(-3, 3) z = pos.z + random(-3, 3)
} }
pos = get_ground_level(pos) pos = creatura.get_ground_level(pos, 4)
minetest.add_node(pos, {name = "creatura:spawn_node"}) minetest.add_node(pos, {name = "creatura:spawn_node"})
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("mob", queue[i].mob) meta:set_string("mob", queue[i].mob)
end end
end end
end end
table.remove(animalia.spawn_queue, i) table.remove(animalia.spawn_queue, i)
end end
end end

View file

@ -4,30 +4,28 @@
local random = math.random local random = math.random
local function vec_raise(v, n)
return {x = v.x, y = v.y + n, z = v.z}
end
local walkable_nodes = {} local walkable_nodes = {}
local color = minetest.colorize
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name in pairs(minetest.registered_nodes) do for name in pairs(minetest.registered_nodes) do
if name ~= "air" and name ~= "ignore" then if name ~= "air" and name ~= "ignore" then
if minetest.registered_nodes[name].walkable then if minetest.registered_nodes[name].walkable then
table.insert(walkable_nodes, name) table.insert(walkable_nodes, name)
end end
end end
end end
end) end)
local function correct_name(str) local function correct_name(str)
if str then if str then
if str:match(":") then str = str:split(":")[2] end if str:match(":") then str = str:split(":")[2] end
return (string.gsub(" " .. str, "%W%l", string.upper):sub(2):gsub("_", " ")) return (string.gsub(" " .. str, "%W%l", string.upper):sub(2):gsub("_", " "))
end end
end end
function register_egg(name, def) local function register_egg(name, def)
minetest.register_entity(def.mob .. "_egg_sprite", { minetest.register_entity(def.mob .. "_egg_sprite", {
hp_max = 1, hp_max = 1,
@ -38,7 +36,7 @@ function register_egg(name, def)
textures = {"animalia_egg.png"}, textures = {"animalia_egg.png"},
initial_sprite_basepos = {x = 0, y = 0}, initial_sprite_basepos = {x = 0, y = 0},
is_visible = true, is_visible = true,
on_step = function(self, dtime) on_step = function(self)
local pos = self.object:get_pos() local pos = self.object:get_pos()
local objects = minetest.get_objects_inside_radius(pos, 1.5) local objects = minetest.get_objects_inside_radius(pos, 1.5)
local cube = minetest.find_nodes_in_area( local cube = minetest.find_nodes_in_area(
@ -77,7 +75,7 @@ function register_egg(name, def)
end end
}) })
local function mobs_shoot_egg(item, player, pointed_thing) local function mobs_shoot_egg(item, player)
local pos = player:get_pos() local pos = player:get_pos()
minetest.sound_play("default_place_node_hard", { minetest.sound_play("default_place_node_hard", {
@ -148,8 +146,8 @@ end
----------- -----------
minetest.register_craftitem("animalia:leather", { minetest.register_craftitem("animalia:leather", {
description = "Leather", description = "Leather",
inventory_image = "animalia_leather.png", inventory_image = "animalia_leather.png",
groups = {flammable = 2, leather = 1}, groups = {flammable = 2, leather = 1},
}) })
@ -241,6 +239,26 @@ minetest.register_craft({
output = "animalia:poultry_cooked", output = "animalia:poultry_cooked",
}) })
minetest.register_craftitem("animalia:venison_raw", {
description = "Raw Venison",
inventory_image = "animalia_venison_raw.png",
on_use = minetest.item_eat(1),
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craftitem("animalia:venison_raw_cooked", {
description = "Venison Steak",
inventory_image = "animalia_venison_cooked.png",
on_use = minetest.item_eat(10),
groups = {flammable = 2, meat = 1, food_meat = 1},
})
minetest.register_craft({
type = "cooking",
recipe = "animalia:venison_raw",
output = "animalia:venison_cooked",
})
register_egg("animalia:chicken_egg", { register_egg("animalia:chicken_egg", {
description = "Chicken Egg", description = "Chicken Egg",
inventory_image = "animalia_egg", inventory_image = "animalia_egg",
@ -259,54 +277,54 @@ minetest.register_craftitem("animalia:bucket_milk", {
groups = {food_milk = 1, flammable = 3}, groups = {food_milk = 1, flammable = 3},
}) })
function grow_crops(pos, nodename) local function grow_crops(pos, nodename)
local checkname = nodename:sub(1, string.len(nodename) - 1) local checkname = nodename:sub(1, string.len(nodename) - 1)
if minetest.registered_nodes[checkname .. "1"] if minetest.registered_nodes[checkname .. "1"]
and minetest.registered_nodes[checkname .. "2"] and minetest.registered_nodes[checkname .. "2"]
and minetest.registered_nodes[checkname .. "2"].drawtype == "plantlike" then -- node is more than likely a plant and minetest.registered_nodes[checkname .. "2"].drawtype == "plantlike" then -- node is more than likely a plant
local stage = tonumber(string.sub(nodename, -1)) or 0 local stage = tonumber(string.sub(nodename, -1)) or 0
local newname = checkname .. (stage + 1) local newname = checkname .. (stage + 1)
if minetest.registered_nodes[newname] then if minetest.registered_nodes[newname] then
local def = minetest.registered_nodes[newname] local def = minetest.registered_nodes[newname]
def = def and def.place_param2 or 0 def = def and def.place_param2 or 0
minetest.set_node(pos, {name = newname, param2 = def}) minetest.set_node(pos, {name = newname, param2 = def})
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 6, amount = 6,
time = 0.1, time = 0.1,
minpos = vector.subtract(pos, 0.5), minpos = vector.subtract(pos, 0.5),
maxpos = vector.add(pos, 0.5), maxpos = vector.add(pos, 0.5),
minvel = { minvel = {
x = -0.5, x = -0.5,
y = 0.5, y = 0.5,
z = -0.5 z = -0.5
}, },
maxvel = { maxvel = {
x = 0.5, x = 0.5,
y = 1, y = 1,
z = 0.5 z = 0.5
}, },
minacc = { minacc = {
x = 0, x = 0,
y = 2, y = 2,
z = 0 z = 0
}, },
maxacc = { maxacc = {
x = 0, x = 0,
y = 4, y = 4,
z = 0 z = 0
}, },
minexptime = 0.5, minexptime = 0.5,
maxexptime = 1, maxexptime = 1,
minsize = 1, minsize = 1,
maxsize = 2, maxsize = 2,
collisiondetection = false, collisiondetection = false,
vertical = false, vertical = false,
use_texture_alpha = true, use_texture_alpha = true,
texture = "creatura_particle_green.png", texture = "creatura_particle_green.png",
glow = 6 glow = 6
}) })
end end
end end
end end
local guano_fert = minetest.settings:get_bool("guano_fertilization") local guano_fert = minetest.settings:get_bool("guano_fertilization")
@ -317,18 +335,22 @@ minetest.register_craftitem("animalia:bucket_guano", {
stack_max = 1, stack_max = 1,
groups = {flammable = 3}, groups = {flammable = 3},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
if pos then if pos then
local under = minetest.get_node(pointed_thing.under) local under = minetest.get_node(pointed_thing.under)
local node = minetest.registered_nodes[under.name] local node = minetest.registered_nodes[under.name]
if node and node.on_rightclick then if node and node.on_rightclick then
return node.on_rightclick(pointed_thing.under, under, placer, return node.on_rightclick(pointed_thing.under, under, placer,
itemstack) itemstack)
end end
if pos if pos
and not minetest.is_protected(pos, placer:get_player_name()) then and not minetest.is_protected(pos, placer:get_player_name()) then
if guano_fert then if guano_fert then
local nodes = minetest.find_nodes_in_area_under_air(vector.subtract(pos, 5), vector.add(pos, 5), {"group:grass", "group:plant", "group:flora"}) local nodes = minetest.find_nodes_in_area_under_air(
vector.subtract(pos, 5),
vector.add(pos, 5),
{"group:grass", "group:plant", "group:flora"}
)
if #nodes > 0 then if #nodes > 0 then
for n = 1, #nodes do for n = 1, #nodes do
grow_crops(nodes[n], minetest.get_node(nodes[n]).name) grow_crops(nodes[n], minetest.get_node(nodes[n]).name)
@ -349,10 +371,10 @@ minetest.register_craftitem("animalia:bucket_guano", {
end end
itemstack:set_name(replace) itemstack:set_name(replace)
end end
end end
end end
return itemstack return itemstack
end end
}) })
minetest.register_node("animalia:nest_song_bird", { minetest.register_node("animalia:nest_song_bird", {
@ -365,13 +387,13 @@ minetest.register_node("animalia:nest_song_bird", {
stack_max = 1, stack_max = 1,
groups = {snappy = 3, flammable = 3}, groups = {snappy = 3, flammable = 3},
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, -0.31, 5 / 16}, fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, -0.31, 5 / 16},
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, -0.31, 5 / 16}, fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, -0.31, 5 / 16},
}, },
drops = "default:stick" drops = "default:stick"
}) })
@ -380,41 +402,42 @@ minetest.register_node("animalia:nest_song_bird", {
----------- -----------
minetest.register_craftitem("animalia:cat_toy", { minetest.register_craftitem("animalia:cat_toy", {
description = "Cat Toy", description = "Cat Toy",
inventory_image = "animalia_cat_toy.png", inventory_image = "animalia_cat_toy.png",
wield_image = "animalia_cat_toy.png^[transformFYR90", wield_image = "animalia_cat_toy.png^[transformFYR90",
stack_max = 1
}) })
local nametag = {} local nametag = {}
local function get_rename_formspec(meta) local function get_rename_formspec(meta)
local tag = meta:get_string("name") or "" local tag = meta:get_string("name") or ""
local form = { local form = {
"size[8,4]", "size[8,4]",
"field[0.5,1;7.5,0;name;" .. minetest.formspec_escape("Enter name:") .. ";" .. tag .. "]", "field[0.5,1;7.5,0;name;" .. minetest.formspec_escape("Enter name:") .. ";" .. tag .. "]",
"button_exit[2.5,3.5;3,1;set_name;" .. minetest.formspec_escape("Set Name") .. "]" "button_exit[2.5,3.5;3,1;set_name;" .. minetest.formspec_escape("Set Name") .. "]"
} }
return table.concat(form, "") return table.concat(form, "")
end end
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "animalia:set_name" and fields.name then if formname == "animalia:set_name" and fields.name then
local name = player:get_player_name() local name = player:get_player_name()
if not nametag[name] then if not nametag[name] then
return return
end end
local itemstack = nametag[name] local itemstack = nametag[name]
if string.len(fields.name) > 64 then if string.len(fields.name) > 64 then
fields.name = string.sub(fields.name, 1, 64) fields.name = string.sub(fields.name, 1, 64)
end end
local meta = itemstack:get_meta() local meta = itemstack:get_meta()
meta:set_string("name", fields.name) meta:set_string("name", fields.name)
meta:set_string("description", fields.name) meta:set_string("description", fields.name)
player:set_wielded_item(itemstack) player:set_wielded_item(itemstack)
if fields.quit or fields.key_enter then if fields.quit or fields.key_enter then
nametag[name] = nil nametag[name] = nil
end end
end end
end) end)
local function nametag_rightclick(itemstack, player, pointed_thing) local function nametag_rightclick(itemstack, player, pointed_thing)
@ -429,15 +452,15 @@ local function nametag_rightclick(itemstack, player, pointed_thing)
end end
minetest.register_craftitem("animalia:nametag", { minetest.register_craftitem("animalia:nametag", {
description = "Nametag", description = "Nametag",
inventory_image = "animalia_nametag.png", inventory_image = "animalia_nametag.png",
on_rightclick = nametag_rightclick, on_rightclick = nametag_rightclick,
on_secondary_use = nametag_rightclick on_secondary_use = nametag_rightclick
}) })
minetest.register_craftitem("animalia:saddle", { minetest.register_craftitem("animalia:saddle", {
description = "Saddle", description = "Saddle",
inventory_image = "animalia_saddle.png", inventory_image = "animalia_saddle.png",
}) })
minetest.register_tool("animalia:shears", { minetest.register_tool("animalia:shears", {
@ -447,77 +470,77 @@ minetest.register_tool("animalia:shears", {
}) })
minetest.register_craftitem("animalia:net", { minetest.register_craftitem("animalia:net", {
description = "Animal Net", description = "Animal Net",
inventory_image = "animalia_net.png", inventory_image = "animalia_net.png",
stack_max = 1, stack_max = 1,
on_secondary_use = function(itemstack, placer, pointed_thing) on_secondary_use = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "object" then if pointed_thing.type == "object" then
if pointed_thing.ref:is_player() then return end if pointed_thing.ref:is_player() then return end
local ent = pointed_thing.ref:get_luaentity() local ent = pointed_thing.ref:get_luaentity()
if not ent.name:match("^animalia:") or not ent.catch_with_net then if not ent.name:match("^animalia:") or not ent.catch_with_net then
return return
end end
local ent_name = correct_name(ent.name) local ent_name = correct_name(ent.name)
local ent_gender = correct_name(ent.gender) local ent_gender = correct_name(ent.gender)
local meta = itemstack:get_meta() local meta = itemstack:get_meta()
if not meta:get_string("mob") or meta:get_string("mob") == "" then if not meta:get_string("mob") or meta:get_string("mob") == "" then
if placer:get_wielded_item():get_count() > 1 then if placer:get_wielded_item():get_count() > 1 then
if placer:get_inventory():room_for_item("main", {name = "animalia:net"}) then if placer:get_inventory():room_for_item("main", {name = "animalia:net"}) then
itemstack:take_item(1) itemstack:take_item(1)
placer:get_inventory():add_item("main", "animalia:net") placer:get_inventory():add_item("main", "animalia:net")
return itemstack return itemstack
else else
return return
end end
end end
meta:set_string("mob", ent.name) meta:set_string("mob", ent.name)
meta:set_string("staticdata", ent:get_staticdata()) meta:set_string("staticdata", ent:get_staticdata())
local desc = "Animal Net \n" .. minetest.colorize("#a9a9a9", ent_name) .. "\n" .. minetest.colorize("#a9a9a9", ent_gender) local desc = "Animal Net \n" .. color("#a9a9a9", ent_name) .. "\n" .. color("#a9a9a9", ent_gender)
if ent.name == "animalia:cat" if ent.name == "animalia:cat"
and ent.trust and ent.trust
and ent.trust[placer:get_player_name()] then and ent.trust[placer:get_player_name()] then
desc = desc .. "\n" .. minetest.colorize("#a9a9a9", ent.trust[placer:get_player_name()]) desc = desc .. "\n" .. color("#a9a9a9", ent.trust[placer:get_player_name()])
end end
meta:set_string("description", desc) meta:set_string("description", desc)
placer:set_wielded_item(itemstack) placer:set_wielded_item(itemstack)
animalia.protect_from_despawn(ent) animalia.protect_from_despawn(ent)
ent.object:remove() ent.object:remove()
return itemstack return itemstack
else else
minetest.chat_send_player(placer:get_player_name(), minetest.chat_send_player(placer:get_player_name(),
"This Net already contains a " .. "This Net already contains a " ..
correct_name( correct_name(
meta:get_string("mob"))) meta:get_string("mob")))
return return
end end
end end
end, end,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
if pos then if pos then
local under = minetest.get_node(pointed_thing.under) local under = minetest.get_node(pointed_thing.under)
local node = minetest.registered_nodes[under.name] local node = minetest.registered_nodes[under.name]
if node and node.on_rightclick then if node and node.on_rightclick then
return node.on_rightclick(pointed_thing.under, under, placer, return node.on_rightclick(pointed_thing.under, under, placer,
itemstack) itemstack)
end end
if pos and not minetest.is_protected(pos, placer:get_player_name()) then if pos and not minetest.is_protected(pos, placer:get_player_name()) then
local mob = itemstack:get_meta():get_string("mob") local mob = itemstack:get_meta():get_string("mob")
local staticdata = itemstack:get_meta():get_string("staticdata") local staticdata = itemstack:get_meta():get_string("staticdata")
if mob ~= "" then if mob ~= "" then
pos.y = pos.y + pos.y = pos.y +
math.abs( math.abs(
minetest.registered_entities[mob] minetest.registered_entities[mob]
.collisionbox[2]) .collisionbox[2])
minetest.add_entity(pos, mob, staticdata) minetest.add_entity(pos, mob, staticdata)
itemstack:get_meta():set_string("mob", nil) itemstack:get_meta():set_string("mob", nil)
itemstack:get_meta():set_string("staticdata", nil) itemstack:get_meta():set_string("staticdata", nil)
itemstack:get_meta():set_string("description", "Animal Net") itemstack:get_meta():set_string("description", "Animal Net")
end end
end end
end end
return itemstack return itemstack
end end
}) })
----------- -----------
@ -538,9 +561,8 @@ minetest.register_node("animalia:guano", {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
}, },
}, },
groups = {crumbly = 3, falling_node = 1}, groups = {crumbly = 3, falling_node = 1, not_in_creative_inventory = 1},
on_punch = function(pos, _, player) on_punch = function(pos, _, player)
local item = player:get_wielded_item()
local item_name = player:get_wielded_item():get_name() local item_name = player:get_wielded_item():get_name()
if item_name:find("bucket") if item_name:find("bucket")
and item_name:find("empty") then and item_name:find("empty") then
@ -560,10 +582,10 @@ animalia.libri_pages = {}
function animalia.show_libri_main_form(player, pages, group) function animalia.show_libri_main_form(player, pages, group)
group = group or 1 group = group or 1
local basic_form = table.concat({ local basic_form = table.concat({
"formspec_version[3]", "formspec_version[3]",
"size[16,10]", "size[16,10]",
"background[-0.7,-0.5;17.5,11.5;animalia_libri_bg.png]" "background[-0.7,-0.5;17.5,11.5;animalia_libri_bg.png]"
}, "") }, "")
if group == 1 then if group == 1 then
if pages[1] then if pages[1] then
@ -620,7 +642,7 @@ function animalia.show_libri_main_form(player, pages, group)
end end
end end
animalia.libri_pages[player:get_player_name()] = pages animalia.libri_pages[player:get_player_name()] = pages
minetest.show_formspec(player:get_player_name(), "animalia:libri_main", basic_form) minetest.show_formspec(player:get_player_name(), "animalia:libri_main", basic_form)
end end
minetest.register_craftitem("animalia:libri_animalia", { minetest.register_craftitem("animalia:libri_animalia", {
@ -631,7 +653,6 @@ minetest.register_craftitem("animalia:libri_animalia", {
if pointed_thing and pointed_thing.type == "object" then return end if pointed_thing and pointed_thing.type == "object" then return end
local meta = itemstack:get_meta() local meta = itemstack:get_meta()
local pages = minetest.deserialize(meta:get_string("pages")) local pages = minetest.deserialize(meta:get_string("pages"))
local desc = meta:get_string("description")
if not pages if not pages
or #pages < 1 then return end or #pages < 1 then return end
animalia.show_libri_main_form(player, pages) animalia.show_libri_main_form(player, pages)
@ -640,7 +661,6 @@ minetest.register_craftitem("animalia:libri_animalia", {
if pointed_thing and pointed_thing.type == "object" then return end if pointed_thing and pointed_thing.type == "object" then return end
local meta = itemstack:get_meta() local meta = itemstack:get_meta()
local pages = minetest.deserialize(meta:get_string("pages")) local pages = minetest.deserialize(meta:get_string("pages"))
local desc = meta:get_string("description")
if not pages if not pages
or #pages < 1 then return end or #pages < 1 then return end
animalia.show_libri_main_form(player, pages) animalia.show_libri_main_form(player, pages)
@ -652,59 +672,59 @@ minetest.register_craftitem("animalia:libri_animalia", {
-------------- --------------
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name, def in pairs(minetest.registered_items) do
if string.find(name, "ingot") if string.find(name, "ingot")
and string.find(name, "steel") then and string.find(name, "steel") then
if not def.groups then if not def.groups then
def.groups = {} def.groups = {}
end end
def.groups["steel_ingot"] = 1 def.groups["steel_ingot"] = 1
minetest.register_item(":" .. name, def) minetest.register_item(":" .. name, def)
elseif string.find(name, "string") then elseif string.find(name, "string") then
if not def.groups then if not def.groups then
def.groups = {} def.groups = {}
end end
def.groups["string"] = 1 def.groups["string"] = 1
minetest.register_item(":" .. name, def) minetest.register_item(":" .. name, def)
end end
end end
end) end)
minetest.register_craft({ minetest.register_craft({
output = "animalia:cat_toy", output = "animalia:cat_toy",
recipe = { recipe = {
{"", "", "group:string"}, {"", "", "group:string"},
{"", "group:stick", "group:string"}, {"", "group:stick", "group:string"},
{"group:stick", "", "group:feather"} {"group:stick", "", "group:feather"}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "animalia:lasso", output = "animalia:lasso",
recipe = { recipe = {
{"", "group:string", "group:string"}, {"", "group:string", "group:string"},
{"", "group:leather", "group:string"}, {"", "group:leather", "group:string"},
{"group:string", "", ""} {"group:string", "", ""}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "animalia:net", output = "animalia:net",
recipe = { recipe = {
{"group:string", "", "group:string"}, {"group:string", "", "group:string"},
{"group:string", "", "group:string"}, {"group:string", "", "group:string"},
{"group:stick", "group:string", ""} {"group:stick", "group:string", ""}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "animalia:saddle", output = "animalia:saddle",
recipe = { recipe = {
{"group:leather", "group:leather", "group:leather"}, {"group:leather", "group:leather", "group:leather"},
{"group:leather", "group:steel_ingot", "group:leather"}, {"group:leather", "group:steel_ingot", "group:leather"},
{"group:string", "", "group:string"} {"group:string", "", "group:string"}
} }
}) })
minetest.register_craft({ minetest.register_craft({
@ -716,33 +736,33 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "animalia:libri_animalia", output = "animalia:libri_animalia",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"animalia:feather", "", ""}, {"animalia:feather", "", ""},
{"group:book", "group:color_green", ""} {"group:book", "group:color_green", ""}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "animalia:libri_animalia", output = "animalia:libri_animalia",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"animalia:feather", "", ""}, {"animalia:feather", "", ""},
{"group:book", "group:unicolor_green", ""} {"group:book", "group:unicolor_green", ""}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "animalia:libri_animalia 2", output = "animalia:libri_animalia 2",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"animalia:libri_animalia", "group:book", ""}, {"animalia:libri_animalia", "group:book", ""},
{"", "", ""} {"", "", ""}
} }
}) })
minetest.register_on_craft(function(itemstack, player, old_craft_grid) minetest.register_on_craft(function(itemstack, _, old_craft_grid)
if itemstack:get_name() == "animalia:libri_animalia" if itemstack:get_name() == "animalia:libri_animalia"
and itemstack:get_count() > 1 then and itemstack:get_count() > 1 then
for _, old_libri in pairs(old_craft_grid) do for _, old_libri in pairs(old_craft_grid) do

107
init.lua
View file

@ -1,16 +1,15 @@
animalia = {} animalia = {}
better_fauna = animalia
animalia.pets = {} animalia.pets = {}
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
animalia.pets[name] = {} animalia.pets[name] = {}
end) end)
minetest.register_on_leaveplayer(function(player) minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
animalia.pets[name] = nil animalia.pets[name] = nil
end) end)
-- Daytime Tracking -- Daytime Tracking
@ -18,9 +17,9 @@ end)
animalia.is_day = true animalia.is_day = true
local function is_day() local function is_day()
local time = (minetest.get_timeofday() or 0) * 24000 local time = (minetest.get_timeofday() or 0) * 24000
animalia.is_day = time < 19500 and time > 4500 animalia.is_day = time < 19500 and time > 4500
minetest.after(10, is_day) minetest.after(10, is_day)
end end
is_day() is_day()
@ -33,61 +32,61 @@ dofile(path.."/api/lasso.lua")
dofile(path.."/craftitems.lua") dofile(path.."/craftitems.lua")
animalia.animals = { animalia.animals = {
"animalia:bat", "animalia:bat",
"animalia:bird", "animalia:bird",
"animalia:cat", "animalia:cat",
"animalia:chicken", "animalia:chicken",
"animalia:cow", "animalia:cow",
"animalia:tropical_fish", "animalia:tropical_fish",
"animalia:frog", "animalia:frog",
"animalia:horse", "animalia:horse",
"animalia:pig", "animalia:pig",
"animalia:reindeer", "animalia:reindeer",
"animalia:sheep", "animalia:sheep",
"animalia:turkey", "animalia:turkey",
"animalia:wolf", "animalia:wolf",
} }
for i = 1, #animalia.animals do for i = 1, #animalia.animals do
local name = string.split(animalia.animals[i], ":")[2] local name = animalia.animals[i]:split(":")[2]
dofile(path.."/mobs/" .. name .. ".lua") dofile(path.."/mobs/" .. name .. ".lua")
end end
if minetest.settings:get_bool("spawn_mobs", true) then if minetest.settings:get_bool("spawn_mobs", true) then
dofile(path.."/api/spawning.lua") dofile(path.."/api/spawning.lua")
end end
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_entities) do for name, def in pairs(minetest.registered_entities) do
if def.logic if def.logic
or def.brainfunc or def.brainfunc
or def.bh_tree or def.bh_tree
or def._cmi_is_mob then or def._cmi_is_mob then
local old_punch = def.on_punch local old_punch = def.on_punch
if not old_punch then if not old_punch then
old_punch = function() end old_punch = function() end
end end
local on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) local on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
old_punch(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) old_punch(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
local pos = self.object:get_pos() local pos = self.object:get_pos()
if not pos then if not pos then
return return
end end
if puncher:is_player() if puncher:is_player()
and animalia.pets[puncher:get_player_name()] then and animalia.pets[puncher:get_player_name()] then
local pets = animalia.pets[puncher:get_player_name()] local pets = animalia.pets[puncher:get_player_name()]
if #pets < 1 then return end if #pets < 1 then return end
for i = 1, #pets do for i = 1, #pets do
local ent = pets[i]:get_luaentity() local ent = pets[i]:get_luaentity()
if ent.assist_owner then if ent.assist_owner then
ent.owner_target = self ent.owner_target = self
end end
end end
end end
end end
def.on_punch = on_punch def.on_punch = on_punch
minetest.register_entity(":" .. name, def) minetest.register_entity(":" .. name, def)
end end
end end
end) end)

View file

@ -2,30 +2,6 @@
-- Bat -- -- Bat --
--------- ---------
local function get_ceiling_positions(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 output = {}
for i = 1, #walkable do
local i_pos = walkable[i]
local under = {
x = i_pos.x,
y = i_pos.y - 1,
z = i_pos.z
}
if minetest.get_node(under).name == "air"
and minetest.registered_nodes[minetest.get_node(i_pos).name].walkable then
table.insert(output, i_pos)
end
end
return output
end
local guano_accumulation = minetest.settings:get_bool("guano_accumulation") local guano_accumulation = minetest.settings:get_bool("guano_accumulation")
-- Math -- -- Math --
@ -51,6 +27,33 @@ 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 end
---------------
-- Utilities --
---------------
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"
and minetest.line_of_sight(pos, n_pos) then
table.insert(roosts, n_pos)
end
end
return roosts[random(#roosts)]
end
local function is_node_walkable(name) local function is_node_walkable(name)
local def = minetest.registered_nodes[name] local def = minetest.registered_nodes[name]
return def and def.walkable return def and def.walkable
@ -84,7 +87,7 @@ creatura.register_mob("animalia:bat", {
stand = {range = {x = 1, y = 40}, speed = 10, frame_blend = 0.3, loop = true}, 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}, 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}, fly = {range = {x = 100, y = 140}, speed = 80, frame_blend = 0.3, loop = true},
latch = {range = {x = 150, y = 150}, speed = 1, frame_blend = 0, loop = false} cling = {range = {x = 150, y = 150}, speed = 1, frame_blend = 0, loop = false}
}, },
-- Misc -- Misc
sounds = { sounds = {
@ -103,80 +106,63 @@ creatura.register_mob("animalia:bat", {
"butterflies:butterfly_violet" "butterflies:butterfly_violet"
}, },
-- Function -- Function
step_delay = 0.25,
roost_action = animalia.action_cling,
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:wander", utility = "animalia:wander",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.is_landed then return 0.1, {self}
return 0.1, {self}
end
return 0
end end
}, },
[2] = { {
utility = "animalia:aerial_swarm", utility = "animalia:aerial_wander",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self:get_utility() == "animalia:return_to_home" local pos = self.object:get_pos()
or self:get_utility() == "animalia:wander" then if not pos then return end
local pos = self.object:get_pos() local player = creatura.get_nearby_player(self)
local player = creatura.get_nearby_player(self) local plyr_pos = player and not player:get_player_control().sneak and player:get_pos()
if player if plyr_pos then
and player:get_pos() local trust = self.trust[player:get_player_name() or ""] or 0
and not player:get_player_control().sneak then local dist = vec_dist(pos, plyr_pos)
local dist = vector.distance(pos, player:get_pos()) self._target = player
self._nearby_player = player self.is_landed = false
self.is_landed = false return (12 - (dist + trust)) * 0.1, {self}
return (12 - dist) * 0.1, {self, 1}
end
end end
if self.in_liquid if self.in_liquid
or not self.is_landed then or not self.is_landed then
return 0.11, {self, 1} return 0.2, {self}
end end
return 0 return 0
end end
}, },
[3] = { {
utility = "animalia:land", utility = "animalia:fly_to_land",
get_score = function(self) get_score = function(self)
if not self.is_landed if self.is_landed
and not self.touching_ground then and not self.touching_ground
return 0.12, {self} and not self.in_liquid
and creatura.sensor_floor(self, 3, true) > 2 then
return 0.3, {self}
end end
return 0 return 0
end end
}, },
[4] = { [4] = {
utility = "animalia:return_to_home", utility = "animalia:fly_to_roost",
get_score = function(self) get_score = function(self)
if not self.home_position then return 0 end local pos = self.object:get_pos()
local player = self._nearby_player if not pos then return end
if player local home = animalia.is_day and self.home_position
and player:get_pos() then if home
local pos = self.object:get_pos() and home.x
local dist = vector.distance(pos, player:get_pos()) and vec_dist(pos, home) < 8 then
if dist < 9 then
return 0
end
end
local time = (minetest.get_timeofday() * 24000) or 0
local is_day = time < 19500 and time > 4500
if is_day then
return 0.6, {self} return 0.6, {self}
end end
return 0 return 0
end end
},
[5] = {
utility = "animalia:find_home",
get_score = function(self)
if self.home_position then return 0 end
local pos = self.object:get_pos()
local range = self.tracking_range
local ceiling = get_ceiling_positions(pos, range / 2)
if not ceiling[1] then return 0 end
return 1, {self}
end
} }
}, },
activate_func = function(self) activate_func = function(self)
@ -184,32 +170,40 @@ creatura.register_mob("animalia:bat", {
animalia.initialize_lasso(self) animalia.initialize_lasso(self)
self.home_position = self:recall("home_position") or nil self.home_position = self:recall("home_position") or nil
self.is_landed = self:recall("is_landed") or false self.is_landed = self:recall("is_landed") or false
self.stamina = self:recall("stamina") or 30 self.trust = self:recall("trust") or {}
if not self.home_position then
local roost = get_roost(self.object:get_pos(), 8)
if roost then
self.home_position = self:memorize("home_position", roost)
end
end
end, end,
step_func = function(self) step_func = function(self)
animalia.step_timers(self) animalia.step_timers(self)
--animalia.head_tracking(self, 0.75, 0.75) --animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60) animalia.do_growth(self, 60)
animalia.update_lasso_effects(self) animalia.update_lasso_effects(self)
if self.stamina > 0 then animalia.rotate_to_pitch(self)
if not self.is_landed then local pos = self.object:get_pos()
self.stamina = self:memorize("stamina", self.stamina - self.dtime) if not pos then return end
else if self:timer(random(10,15)) then
self.stamina = self:memorize("stamina", self.stamina + self.dtime) if random(4) < 2 then
self.is_landed = not self.is_landed
end end
if self.stamina > 25 if not self.home_position
and self.is_landed then or creatura.get_node_def(self.home_position).walkable then
self.is_landed = self:memorize("is_landed", false) local roost = get_roost(pos, 8)
if roost then
self.home_position = self:memorize("home_position", roost)
end
end end
else
self.stamina = self:memorize("stamina", self.stamina + self.dtime)
self.is_landed = self:memorize("is_landed", true)
end end
if self._anim == "fly" then if self._anim == "fly" then
local vel_y = self.object:get_velocity().y local vel_y = vector.normalize(self.object:get_velocity()).y
local rot = self.object:get_rotation() local rot = self.object:get_rotation()
local n_rot = rot.x + (vel_y - rot.x) * 0.2
self.object:set_rotation({ self.object:set_rotation({
x = clamp(vel_y * 0.25, -0.75, 0.75), x = clamp(n_rot, -0.75, 0.75),
y = rot.y, y = rot.y,
z = rot.z z = rot.z
}) })
@ -218,8 +212,7 @@ creatura.register_mob("animalia:bat", {
self:play_sound("random") self:play_sound("random")
if guano_accumulation if guano_accumulation
and random(16) < 2 and random(16) < 2
and self:get_utility() == "animalia:return_to_home" then and self:get_utility() == "animalia:fly_to_roost" then
local pos = self.object:get_pos()
pos = { pos = {
x = floor(pos.x + 0.5), x = floor(pos.x + 0.5),
y = floor(pos.y + 0.5), y = floor(pos.y + 0.5),
@ -229,7 +222,7 @@ creatura.register_mob("animalia:bat", {
return return
end end
local fail_safe = 1 local fail_safe = 1
while not is_node_walkable(minetest.get_node(floor_pos).name) while not is_node_walkable(minetest.get_node(pos).name)
and fail_safe < 16 do and fail_safe < 16 do
pos.y = pos.y - 1 pos.y = pos.y - 1
end end
@ -260,6 +253,7 @@ creatura.register_mob("animalia:bat", {
end, end,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, false) then if animalia.feed(self, clicker, false, false) then
animalia.add_trust(self, clicker, 1)
return return
end end
if animalia.set_nametag(self, clicker) then if animalia.set_nametag(self, clicker) then

View file

@ -5,45 +5,38 @@
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if name:match(":seed_") if name:match(":seed_")
or name:match("_seed") then or name:match("_seed") then
table.insert(follows, name) table.insert(follows, name)
end end
end end
end) end)
local random = math.random local random = math.random
local function clamp(val, min, max) local vec_dist = vector.distance
if val < min then
val = min
elseif max < val then
val = max
end
return val
end
creatura.register_mob("animalia:bird", { creatura.register_mob("animalia:bird", {
-- Stats -- Stats
max_health = 5, max_health = 5,
armor_groups = {fleshy = 200}, armor_groups = {fleshy = 200},
damage = 0, damage = 0,
speed = 4, speed = 4,
tracking_range = 16, tracking_range = 16,
despawn_after = 100, despawn_after = 100,
-- Entity Physics -- Entity Physics
stepheight = 1.1, stepheight = 1.1,
max_fall = 100, max_fall = 0,
turn_rate = 6, turn_rate = 6,
boid_seperation = 0.4, boid_seperation = 0.4,
-- Visuals -- Visuals
mesh = "animalia_bird.b3d", mesh = "animalia_bird.b3d",
hitbox = { hitbox = {
width = 0.15, width = 0.15,
height = 0.3 height = 0.3
}, },
visual_size = {x = 7, y = 7}, visual_size = {x = 7, y = 7},
textures = { textures = {
"animalia_bird_cardinal.png", "animalia_bird_cardinal.png",
"animalia_bird_eastern_blue.png", "animalia_bird_eastern_blue.png",
@ -52,97 +45,89 @@ creatura.register_mob("animalia:bird", {
animations = { animations = {
stand = {range = {x = 1, y = 40}, speed = 10, frame_blend = 0.3, loop = true}, stand = {range = {x = 1, y = 40}, speed = 10, frame_blend = 0.3, loop = true},
walk = {range = {x = 50, y = 70}, speed = 30, frame_blend = 0.3, loop = true}, walk = {range = {x = 50, y = 70}, speed = 30, frame_blend = 0.3, loop = true},
fly = {range = {x = 120, y = 140}, speed = 80, frame_blend = 0.3, loop = true} fly = {range = {x = 120, y = 140}, speed = 80, frame_blend = 0.3, loop = true}
}, },
-- Misc -- Misc
step_delay = 0.25,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = false, catch_with_lasso = false,
sounds = { sounds = {
cardinal = { cardinal = {
name = "animalia_cardinal", name = "animalia_cardinal",
gain = 0.5, gain = 0.5,
distance = 63, distance = 63,
variations = 3 variations = 3
}, },
eastern_blue = { eastern_blue = {
name = "animalia_eastern_blue", name = "animalia_eastern_blue",
gain = 0.5, gain = 0.5,
distance = 63, distance = 63,
variations = 3 variations = 3
}, },
goldfinch = { goldfinch = {
name = "animalia_goldfinch", name = "animalia_goldfinch",
gain = 0.5, gain = 0.5,
distance = 63, distance = 63,
variations = 3 variations = 3
}, },
}, },
follow = follows, follow = follows,
-- Function -- Function
wander_action = animalia.action_move_flock,
utility_stack = { utility_stack = {
{ {
utility = "animalia:boid_wander", utility = "animalia:wander_group",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self, true}
end end
}, },
{ {
utility = "animalia:aerial_flock", utility = "animalia:aerial_wander",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if not self.is_landed then if not self.is_landed
return 0.11, {self, 1} or self.in_liquid then
else return 0.2, {self}
local pos = self.object:get_pos()
if self.in_liquid then
self.stamina = self:memorize("stamina", 30)
self.is_landed = false
return 0.15, {self, 0.5}
end
local player = creatura.get_nearby_player(self)
if player
and player:get_pos() then
local dist = vector.distance(pos, player:get_pos())
self.is_landed = false
return (16 - dist) * 0.1, {self, 0.5}
end
end end
return 0 return 0
end end
}, },
{ {
utility = "animalia:land", utility = "animalia:fly_to_land",
get_score = function(self) get_score = function(self)
if self.is_landed if self.is_landed
and not self.touching_ground and not self.touching_ground
and not self.in_liquid then and not self.in_liquid
return 0.12, {self} and creatura.sensor_floor(self, 3, true) > 2 then
return 0.3, {self}
end end
return 0 return 0
end end
}, },
{ {
utility = "animalia:return_to_nest", utility = "animalia:fly_to_roost",
get_score = function(self) get_score = function(self)
if not self.home_position then local pos = self.object:get_pos()
return 0 if not pos then return end
end local player = creatura.get_nearby_player(self)
local player = self._nearby_player
if player if player
and player:get_pos() then and player:get_pos() then
local pos = self.object:get_pos()
local dist = vector.distance(pos, player:get_pos()) local dist = vector.distance(pos, player:get_pos())
if dist < 3 then if dist < 3 then
return 0 return 0
end end
end end
if not animalia.is_day then local home = not animalia.is_day and self.home_position
if home
and vec_dist(pos, home) < 8 then
return 0.6, {self} return 0.6, {self}
end end
return 0 return 0
end end
} }
}, },
activate_func = function(self) activate_func = function(self)
animalia.initialize_api(self) animalia.initialize_api(self)
animalia.initialize_lasso(self) animalia.initialize_lasso(self)
self._tp2home = self:recall("_tp2home") or nil self._tp2home = self:recall("_tp2home") or nil
@ -152,52 +137,49 @@ creatura.register_mob("animalia:bird", {
self.object:set_pos(self.home_position) self.object:set_pos(self.home_position)
end end
self.is_landed = self:recall("is_landed") or false self.is_landed = self:recall("is_landed") or false
self.stamina = self:recall("stamina") or 40
if not self.home_position then if not self.home_position then
local pos = self.object:get_pos() local pos = self.object:get_pos()
local nests = minetest.find_nodes_in_area_under_air(vector.add(pos, 4), vector.subtract(pos, 4), {"animalia:nest_song_bird"}) local nests = minetest.find_nodes_in_area_under_air(
vector.add(pos, 4),
vector.subtract(pos, 4),
{"animalia:nest_song_bird"}
)
if nests[1] if nests[1]
and minetest.get_natural_light(nests[1]) > 0 then and minetest.get_natural_light(nests[1]) > 0 then
self.home_position = self:memorize("home_position", nests[1]) self.home_position = self:memorize("home_position", nests[1])
end end
end end
end, end,
step_func = function(self) step_func = function(self)
animalia.step_timers(self) animalia.step_timers(self)
animalia.do_growth(self, 60) animalia.do_growth(self, 60)
animalia.update_lasso_effects(self) animalia.update_lasso_effects(self)
if animalia.is_day animalia.rotate_to_pitch(self)
and self:timer(random(10,15)) then if self:timer(random(10,15)) then
if self.texture_no == 1 then if animalia.is_day then
self:play_sound("cardinal") if self.texture_no == 1 then
elseif self.texture_no == 2 then self:play_sound("cardinal")
self:play_sound("eastern_blue") elseif self.texture_no == 2 then
else self:play_sound("eastern_blue")
self:play_sound("goldfinch") else
self:play_sound("goldfinch")
end
end end
end if random(4) < 2 then
if self._anim == "fly" then self.is_landed = not self.is_landed
local vel_y = self.object:get_velocity().y
local rot = self.object:get_rotation()
self.object:set_rotation({
x = clamp(vel_y * 0.25, -0.75, 0.75),
y = rot.y,
z = rot.z
})
end
if self.stamina > 0 then
if not self.is_landed then
self.stamina = self:memorize("stamina", self.stamina - self.dtime)
else
self.stamina = self:memorize("stamina", self.stamina + self.dtime)
end end
if self.stamina > 25 local home = self.home_position
and self.is_landed then if home
self.is_landed = self:memorize("is_landed", false) and creatura.get_node_def(home).name ~= "animalia:nest_song_bird" then
local nodes = minetest.find_nodes_in_area_under_air(
{x = home.x, y = home.y - 12, z = home.z},
{x = home.x, y = home.y + 12, z = home.z},
{"animalia:nest_song_bird"}
)
if nodes[1] then
self.home_position = self:memorize("home_position", nodes[1])
end
end end
else
self.stamina = self:memorize("stamina", self.stamina + self.dtime)
self.is_landed = self:memorize("is_landed", true)
end end
if not self.is_landed if not self.is_landed
or not self.touching_ground then or not self.touching_ground then
@ -205,12 +187,12 @@ creatura.register_mob("animalia:bird", {
else else
self.speed = 1 self.speed = 1
end end
end, end,
death_func = function(self) death_func = function(self)
if self:get_utility() ~= "animalia:die" then if self:get_utility() ~= "animalia:die" then
self:initiate_utility("animalia:die", self) self:initiate_utility("animalia:die", self)
end end
end, end,
deactivate_func = function(self) deactivate_func = function(self)
if self:get_utility() if self:get_utility()
and self:get_utility() == "animalia:return_to_nest" then and self:get_utility() == "animalia:return_to_nest" then
@ -238,3 +220,12 @@ creatura.register_mob("animalia:bird", {
}) })
creatura.register_spawn_egg("animalia:bird", "ae2f2f", "f3ac1c") creatura.register_spawn_egg("animalia:bird", "ae2f2f", "f3ac1c")
minetest.register_abm({
label = "animalia:nest_cleanup",
nodenames = "animalia:nest_song_bird",
interval = 900,
action = function(pos)
minetest.remove_node(pos)
end
})

View file

@ -2,6 +2,10 @@
-- Cat -- -- Cat --
--------- ---------
local random = math.random
local vec_dist = vector.distance
local follow = { local follow = {
"animalia:poultry_raw" "animalia:poultry_raw"
} }
@ -20,6 +24,7 @@ creatura.register_mob("animalia:cat", {
damage = 1, damage = 1,
speed = 5, speed = 5,
tracking_range = 24, tracking_range = 24,
turn_rate = 9,
despawn_after = 2000, despawn_after = 2000,
-- Entity Physics -- Entity Physics
stepheight = 1.1, stepheight = 1.1,
@ -34,16 +39,25 @@ creatura.register_mob("animalia:cat", {
"animalia_cat_1.png", "animalia_cat_1.png",
"animalia_cat_2.png", "animalia_cat_2.png",
"animalia_cat_3.png", "animalia_cat_3.png",
"animalia_cat_4.png" "animalia_cat_4.png",
"animalia_cat_5.png",
"animalia_cat_6.png",
"animalia_cat_7.png",
"animalia_cat_8.png",
"animalia_cat_9.png",
"animalia_cat_ash.png",
"animalia_cat_birch.png",
}, },
animations = { animations = {
stand = {range = {x = 1, y = 39}, speed = 10, frame_blend = 0.3, loop = true}, stand = {range = {x = 1, y = 39}, speed = 10, frame_blend = 0.3, loop = true},
walk = {range = {x = 50, y = 90}, speed = 45, frame_blend = 0.3, loop = true}, walk = {range = {x = 41, y = 59}, speed = 20, frame_blend = 0.3, loop = true},
run = {range = {x = 100, y = 130}, speed = 50, frame_blend = 0.3, loop = true}, run = {range = {x = 42, y = 59}, speed = 30, frame_blend = 0.3, loop = true},
sit = {range = {x = 140, y = 180}, speed = 10, frame_blend = 0.3, loop = true}, play = {range = {x = 61, y = 79}, speed = 30, frame_blend = 0.3, loop = false},
smack = {range = {x = 190, y = 210}, speed = 40, frame_blend = 0.1, loop = true}, 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 -- Misc
step_delay = 0.25,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = true, catch_with_lasso = true,
sounds = { sounds = {
@ -70,7 +84,7 @@ creatura.register_mob("animalia:cat", {
}, },
follow = follow, follow = follow,
head_data = { head_data = {
offset = {x = 0, y = 0.22, z = 0}, offset = {x = 0, y = 0.18, z = 0},
pitch_correction = -20, pitch_correction = -20,
pivot_h = 0.65, pivot_h = 0.65,
pivot_v = 0.65 pivot_v = 0.65
@ -79,7 +93,6 @@ creatura.register_mob("animalia:cat", {
activate_func = function(self) activate_func = function(self)
animalia.initialize_api(self) animalia.initialize_api(self)
animalia.initialize_lasso(self) animalia.initialize_lasso(self)
self._path = {}
self.interact_sound_cooldown = 0 self.interact_sound_cooldown = 0
self.trust_cooldown = self:recall("trust_cooldown") or 0 self.trust_cooldown = self:recall("trust_cooldown") or 0
self.order = self:recall("order") or "wander" self.order = self:recall("order") or "wander"
@ -93,94 +106,94 @@ creatura.register_mob("animalia:cat", {
end end
end, end,
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:skittish_wander", utility = "animalia:wander_skittish",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 0.9, {self} return 0.3, {self}
end end
return 0 return 0
end end
}, },
[3] = { {
utility = "animalia:find_and_break_glass_vessels", utility = "animalia:destroy_nearby_vessel",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return math.random(10) * 0.01, {self} if random(24) < 2 then
end return 0.2, {self}
},
[4] = {
utility = "animalia:walk_ahead_of_player",
get_score = function(self)
local player = creatura.get_nearby_player(self)
if player
and player:get_player_name() then
local trust = 0
if not self.trust[player:get_player_name()] then
self.trust[player:get_player_name()] = 0
self:memorize("trust", self.trust)
else
trust = self.trust[player:get_player_name()]
end
self._nearby_player = player
if trust > 3 then
return math.random(10) * 0.01, {self, player}
else
return 0
end
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:sit", utility = "animalia:bother_player",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.order == "sit" if random(24) > 1 then return 0 end
and self.trust[self.owner] > 7 then local owner = self.owner and minetest.get_player_by_name(self.owner)
return 0.8, {self} local pos = self.object:get_pos()
if not pos then return end
local trust = self.trust[self.owner] or 0
if trust > 3
and owner
and vec_dist(pos, owner:get_pos()) < self.tracking_range then
return 0.2, {self, owner}
end end
return 0 return 0
end end
}, },
[6] = { {
utility = "animalia:stay",
step_delay = 0.25,
get_score = function(self)
local trust = (self.owner and self.trust[self.owner]) or 0
if trust < 5 then return 0 end
local order = self.order or "wander"
if order == "sit" then
return 0.5, {self}
end
return 0
end
},
{
utility = "animalia:play_with_player",
step_delay = 0.25,
get_score = function(self)
if self.trust_cooldown > 0 then return 0 end
local owner = self.owner and minetest.get_player_by_name(self.owner)
if owner
and owner:get_wielded_item():get_name() == "animalia:cat_toy" then
return 0.6, {self, owner}
end
return 0
end
},
{
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.order == "follow" local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
and minetest.get_player_by_name(self.owner) local trust = (self.owner and self.trust[self.owner]) or 0
and self.trust[self.owner] > 7 then local owner = self.owner and self.order == "follow" and trust > 4 and minetest.get_player_by_name(self.owner)
return 1, {self, minetest.get_player_by_name(self.owner)} local force = (lasso and lasso ~= false) or (owner and owner ~= false)
end local player = (force and (owner or lasso)) or creatura.get_nearby_player(self)
local trust = 0
local player = self._nearby_player
if player if player
and player:get_player_name() then and self:follow_wielded_item(player) then
if not self.trust[player:get_player_name()] then return 0.6, {self, player, force}
self.trust[player:get_player_name()] = 0
self:memorize("trust", self.trust)
else
trust = self.trust[player:get_player_name()]
end
else
return 0
end
if player:get_velocity()
and vector.length(player:get_velocity()) < 2
and self:follow_wielded_item(player)
and trust >= 4 then
return 0.6, {self, player}
elseif player:get_wielded_item():get_name() == "animalia:cat_toy" then
return 0.6, {self, player, true}
end end
return 0 return 0
end end
}, },
[7] = { {
utility = "animalia:mammal_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
@ -196,9 +209,6 @@ creatura.register_mob("animalia:cat", {
animalia.do_growth(self, 60) animalia.do_growth(self, 60)
animalia.update_lasso_effects(self) animalia.update_lasso_effects(self)
if self:timer(1) then if self:timer(1) then
if self.trust_cooldown > 0 then
self.trust_cooldown = self:memorize("trust_cooldown", self.trust_cooldown - 1)
end
if self.interact_sound_cooldown > 0 then if self.interact_sound_cooldown > 0 then
self.interact_sound_cooldown = self.interact_sound_cooldown - 1 self.interact_sound_cooldown = self.interact_sound_cooldown - 1
end end
@ -234,20 +244,6 @@ creatura.register_mob("animalia:cat", {
self.trust[clicker:get_player_name()] = 0 self.trust[clicker:get_player_name()] = 0
self:memorize("trust", self.trust) self:memorize("trust", self.trust)
end end
-- Increase trust by playing
if item_name == "animalia:cat_toy"
and self:get_utility() == "animalia:follow_player" then
if trust < 10 then
self.trust[clicker:get_player_name()] = trust + 1
self:memorize("trust", self.trust)
animalia.particle_spawner(pos, "creatura_particle_green.png", "float", minppos, maxppos)
if self.interact_sound_cooldown <= 0 then
self.sounds["purr"].gain = 1
self.interact_sound_cooldown = 3
self:play_sound("purr")
end
end
end
-- Purr to indicate trust level (louder = more trust) -- Purr to indicate trust level (louder = more trust)
if clicker:get_player_control().sneak then if clicker:get_player_control().sneak then
if self.interact_sound_cooldown <= 0 then if self.interact_sound_cooldown <= 0 then
@ -261,7 +257,7 @@ creatura.register_mob("animalia:cat", {
or clicker:get_player_name() ~= self.owner then or clicker:get_player_name() ~= self.owner then
return return
end end
if trust <= 7 then if trust <= 5 then
if self.interact_sound_cooldown <= 0 then if self.interact_sound_cooldown <= 0 then
self.interact_sound_cooldown = 3 self.interact_sound_cooldown = 3
self:play_sound("random") self:play_sound("random")
@ -276,11 +272,19 @@ creatura.register_mob("animalia:cat", {
end end
local order = self.order local order = self.order
if order == "wander" then if order == "wander" then
minetest.chat_send_player(clicker:get_player_name(), "Wolf is following")
self.order = "follow" self.order = "follow"
self:initiate_utility("animalia:follow_player", self, clicker, true)
self:set_utility_score(0.7)
elseif order == "follow" then elseif order == "follow" then
minetest.chat_send_player(clicker:get_player_name(), "Wolf is sitting")
self.order = "sit" self.order = "sit"
self:initiate_utility("animalia:stay", self)
self:set_utility_score(0.5)
else else
minetest.chat_send_player(clicker:get_player_name(), "Wolf is wandering")
self.order = "wander" self.order = "wander"
self:set_utility_score(0)
end end
self:memorize("order", self.order) self:memorize("order", self.order)
end end

View file

@ -5,7 +5,7 @@
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if name:match(":seed_") if name:match(":seed_")
or name:match("_seed") then or name:match("_seed") then
table.insert(follows, name) table.insert(follows, name)
@ -19,7 +19,7 @@ creatura.register_mob("animalia:chicken", {
armor_groups = {fleshy = 150}, armor_groups = {fleshy = 150},
damage = 0, damage = 0,
speed = 4, speed = 4,
tracking_range = 16, tracking_range = 4,
despawn_after = 1500, despawn_after = 1500,
-- Entity Physics -- Entity Physics
stepheight = 1.1, stepheight = 1.1,
@ -42,12 +42,13 @@ creatura.register_mob("animalia:chicken", {
"animalia_rooster_2.png", "animalia_rooster_2.png",
"animalia_rooster_3.png" "animalia_rooster_3.png"
}, },
child_textures = {"animalia_chick.png"}, child_textures = {"animalia_chicken_child.png"},
animations = { animations = {
stand = {range = {x = 0, y = 0}, speed = 1, frame_blend = 0.3, loop = true}, stand = {range = {x = 1, y = 39}, speed = 20, frame_blend = 0.3, loop = true},
walk = {range = {x = 10, y = 30}, speed = 30, frame_blend = 0.3, loop = true}, walk = {range = {x = 41, y = 59}, speed = 30, frame_blend = 0.3, loop = true},
run = {range = {x = 10, y = 30}, speed = 45, frame_blend = 0.3, loop = true}, run = {range = {x = 41, y = 59}, speed = 45, frame_blend = 0.3, loop = true},
fall = {range = {x = 40, y = 60}, speed = 70, 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}
}, },
-- Misc -- Misc
catch_with_net = true, catch_with_net = true,
@ -75,61 +76,86 @@ creatura.register_mob("animalia:chicken", {
}, },
follow = follows, follow = follows,
head_data = { head_data = {
offset = {x = 0, y = 0.15, z = 0}, offset = {x = 0, y = 0.45, z = 0},
pitch_correction = 55, pitch_correction = 40,
pivot_h = 0.25, pivot_h = 0.25,
pivot_v = 0.55 pivot_v = 0.55
}, },
-- Function -- Function
add_child = function(self)
local pos = self.object:get_pos()
if not pos then return end
minetest.add_particlespawner({
amount = 6,
time = 0.25,
minpos = {x = pos.x - 7/16, y = pos.y - 5/16, z = pos.z - 7/16},
maxpos = {x = pos.x + 7/16, y = pos.y - 5/16, z = pos.z + 7/16},
minvel = vector.new(-1, 2, -1),
maxvel = vector.new(1, 5, 1),
minacc = vector.new(0, -9.81, 0),
maxacc = vector.new(0, -9.81, 0),
collisiondetection = true,
texture = "animalia_egg_fragment.png",
})
local object = minetest.add_entity(pos, self.name)
local ent = object:get_luaentity()
ent.growth_scale = 0.7
animalia.initialize_api(ent)
animalia.protect_from_despawn(ent)
end,
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:wander", utility = "animalia:wander_group",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:resist_fall",
get_score = function(self)
if not self.touching_ground then
return 0.11, {self}
end
return 0
end
},
[3] = {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 1, {self} return 0.5, {self}
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.lasso_origin local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
and type(self.lasso_origin) == "userdata" then local force = lasso and lasso ~= false
return 0.8, {self, self.lasso_origin, true} local player = (force and lasso) or creatura.get_nearby_player(self)
end
local player = creatura.get_nearby_player(self)
if player if player
and self:follow_wielded_item(player) then and self:follow_wielded_item(player) then
return 0.8, {self, player} return 0.3, {self, player}
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:bird_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
return 0.9, {self} return 0.4, {self}
end end
return 0 return 0
end end
},
{
utility = "animalia:flee_from_target",
get_score = function(self)
local puncher = self._target
if puncher
and puncher:get_pos() then
return 0.6, {self, puncher}
end
self._target = nil
return 0
end
} }
}, },
activate_func = function(self) activate_func = function(self)
@ -141,6 +167,10 @@ creatura.register_mob("animalia:chicken", {
animalia.head_tracking(self, 0.75, 0.75) animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60) animalia.do_growth(self, 60)
animalia.update_lasso_effects(self) animalia.update_lasso_effects(self)
if self.fall_start then
self:set_gravity(-4.9)
self:animate("fall")
end
end, end,
death_func = function(self) death_func = function(self)
if self:get_utility() ~= "animalia:die" then if self:get_utility() ~= "animalia:die" then
@ -158,8 +188,7 @@ creatura.register_mob("animalia:chicken", {
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) 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) creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
self:initiate_utility("animalia:flee_from_player", self, puncher) self._target = puncher
self:set_utility_score(1)
end end
}) })

View file

@ -2,10 +2,12 @@
-- Cow -- -- Cow --
--------- ---------
local random = math.random
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if (name:match(":wheat") if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0) or minetest.get_item_group(name, "food_wheat") > 0)
and not name:find("seed") then and not name:find("seed") then
@ -51,11 +53,12 @@ creatura.register_mob("animalia:cow", {
"animalia_cow_4.png" "animalia_cow_4.png"
}, },
animations = { animations = {
stand = {range = {x = 1, y = 60}, speed = 10, frame_blend = 0.3, loop = true}, stand = {range = {x = 1, y = 59}, speed = 10, frame_blend = 0.3, loop = true},
walk = {range = {x = 70, y = 110}, speed = 40, frame_blend = 0.3, loop = true}, walk = {range = {x = 61, y = 79}, speed = 20, frame_blend = 0.3, loop = true},
run = {range = {x = 70, y = 110}, speed = 60, 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_net = true,
catch_with_lasso = true, catch_with_lasso = true,
sounds = { sounds = {
@ -82,77 +85,85 @@ creatura.register_mob("animalia:cow", {
}, },
follow = follows, follow = follows,
consumable_nodes = { consumable_nodes = {
{ ["default:dirt_with_grass"] = "default:dirt",
name = "default:dirt_with_grass", ["default:dry_dirt_with_dry_grass"] = "default:dry_dirt"
replacement = "default:dirt"
},
{
name = "default:dry_dirt_with_dry_grass",
replacement = "default:dry_dirt"
}
}, },
head_data = { head_data = {
offset = {x = 0, y = 0.5, z = 0}, offset = {x = 0, y = 0.7, z = 0.0},
pitch_correction = -45, pitch_correction = -65,
pivot_h = 0.75, pivot_h = 0.75,
pivot_v = 1 pivot_v = 1
}, },
-- Function -- Function
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:wander", utility = "animalia:wander",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:eat_from_turf", utility = "animalia:eat_turf",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if math.random(25) < 2 then if random(64) < 2 then
return 0.1, {self} return 0.2, {self}
end end
return 0 return 0
end end
}, },
[3] = { {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 1, {self} return 0.3, {self}
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.lasso_origin local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
and type(self.lasso_origin) == "userdata" then local force = lasso and lasso ~= false
return 0.8, {self, self.lasso_origin, true} local player = (force and lasso) or creatura.get_nearby_player(self)
end
local player = creatura.get_nearby_player(self)
if player if player
and self:follow_wielded_item(player) then and self:follow_wielded_item(player) then
return 0.8, {self, player} return 0.4, {self, player}
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:mammal_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
return 0.9, {self} return 0.5, {self}
end end
return 0 return 0
end end
},
{
utility = "animalia:flee_from_target",
get_score = function(self)
local puncher = self._target
if puncher
and puncher:get_pos() then
return 0.6, {self, puncher}
end
self._target = nil
return 0
end
} }
}, },
activate_func = function(self) activate_func = function(self)
animalia.initialize_api(self) animalia.initialize_api(self)
animalia.initialize_lasso(self) animalia.initialize_lasso(self)
self.gotten = self:recall("gotten") or false self.collected = self:recall("collected") or false
end, end,
step_func = function(self) step_func = function(self)
animalia.step_timers(self) animalia.step_timers(self)
@ -181,7 +192,7 @@ creatura.register_mob("animalia:cow", {
return return
end end
if self.gotten then if self.collected then
minetest.chat_send_player(name, "This Cow has already been milked.") minetest.chat_send_player(name, "This Cow has already been milked.")
return return
end end
@ -199,15 +210,14 @@ creatura.register_mob("animalia:cow", {
minetest.add_item(pos, {name = "animalia:bucket_milk"}) minetest.add_item(pos, {name = "animalia:bucket_milk"})
end end
self.gotten = self:memorize("gotten", true) self.collected = self:memorize("collected", true)
return return
end end
animalia.add_libri_page(self, clicker, {name = "cow", form = "pg_cow;Cows"}) animalia.add_libri_page(self, clicker, {name = "cow", form = "pg_cow;Cows"})
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) 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) creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
self:initiate_utility("animalia:flee_from_player", self, puncher) self._target = puncher
self:set_utility_score(1)
end end
}) })

View file

@ -4,7 +4,9 @@
local random = math.random local random = math.random
local vec_add = vector.add
local vec_dist = vector.distance local vec_dist = vector.distance
local vec_sub = vector.subtract
creatura.register_mob("animalia:frog", { creatura.register_mob("animalia:frog", {
-- Stats -- Stats
@ -16,9 +18,10 @@ creatura.register_mob("animalia:frog", {
despawn_after = 2500, despawn_after = 2500,
-- Entity Physics -- Entity Physics
stepheight = 1.1, stepheight = 1.1,
max_fall = 100, max_fall = 0,
turn_rate = 10, turn_rate = 10,
bouyancy_multiplier = 0, bouyancy_multiplier = 0,
hydrodynamics_multiplier = 0.3,
-- Visuals -- Visuals
mesh = "animalia_frog.b3d", mesh = "animalia_frog.b3d",
hitbox = { hitbox = {
@ -37,9 +40,11 @@ creatura.register_mob("animalia:frog", {
stand = {range = {x = 1, y = 40}, speed = 10, frame_blend = 0.3, loop = true}, stand = {range = {x = 1, y = 40}, speed = 10, frame_blend = 0.3, loop = true},
float = {range = {x = 90, y = 90}, speed = 1, frame_blend = 0.3, loop = true}, float = {range = {x = 90, y = 90}, speed = 1, frame_blend = 0.3, loop = true},
swim = {range = {x = 90, y = 110}, speed = 50, frame_blend = 0.3, loop = true}, swim = {range = {x = 90, y = 110}, speed = 50, frame_blend = 0.3, loop = true},
walk = {range = {x = 50, y = 80}, speed = 50, frame_blend = 0.3, loop = true} 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 -- Misc
step_delay = 0.25,
makes_footstep_sound = true, makes_footstep_sound = true,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = true, catch_with_lasso = true,
@ -64,81 +69,91 @@ creatura.register_mob("animalia:frog", {
}, },
-- Function -- Function
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:wander", utility = "animalia:wander",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:wander_water_surface", utility = "animalia:aquatic_wander",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 0.11, {self} return 0.2, {self}
end end
return 0 return 0
end end
}, },
[3] = { {
utility = "animalia:eat_bug_nodes", utility = "animalia:eat_bug",
get_score = function(self) get_score = function(self)
local pos = self.object:get_pos() local pos = self.object:get_pos()
if math.random(12) * 0.01 then if not pos then return end
local food = minetest.find_nodes_in_area(vector.subtract(pos, 1.5), vector.add(pos, 1.5), self.follow) if random(12) < 2 then
local food = minetest.find_nodes_in_area(vec_sub(pos, 1.5), vec_add(pos, 1.5), self.follow)
if food[1] then if food[1] then
return 0.2, {self} return 0.3, {self, food[1]}
end end
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:flop", utility = "animalia:breed",
get_score = function(self) step_delay = 0.25,
if not self.in_liquid
and self.growth_scale <= 0.6 then
return 1
end
return 0
end
},
[5] = {
utility = "animalia:breed_water_surface",
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) and animalia.get_nearby_mate(self, self.name)
and self.in_liquid then and self.in_liquid then
return 1 return 1, {self}
end end
return 0 return 0
end end
}, },
[6] = { {
utility = "animalia:flee_from_player", utility = "animalia:flop",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then return 0 end if not self.in_liquid
local player = creatura.get_nearby_player(self) and self.growth_scale <= 0.6 then
if player return 1, {self}
and player:get_player_name() then
local trust = self.trust[player:get_player_name()] or 0
self._nearby_player = player -- stored to memory to avoid calling get_nearby_player again
return (10 - (vec_dist(self.object:get_pos(), player:get_pos()) + trust)) * 0.1, {self, player}
end end
return 0 return 0
end end
}, },
[7] = { {
utility = "animalia:flee_to_water", utility = "animalia:flee_from_target",
get_score = function(self) get_score = function(self)
if self.in_liquid then return 0 end if self.in_liquid then return 0 end
local pos = self.object:get_pos() local pos = self.object:get_pos()
local water = minetest.find_nodes_in_area(vector.subtract(pos, 1.5), vector.add(pos, 1.5), {"default:water_source"}) if not pos then return end
local target = self._target or creatura.get_nearby_player(self)
local tgt_pos = target and target:get_pos()
local plyr_name = (target and target:is_player() and target:get_player_name()) or ""
if tgt_pos then
local trust = self.trust[plyr_name] or 0
self._target = target -- stored to memory to avoid calling get_nearby_player again
return (10 - (vec_dist(pos, tgt_pos) + trust)) * 0.1, {self, target}
end
return 0
end
},
{
utility = "animalia:run_to_pos",
get_score = function(self)
if self.in_liquid then return 0 end
local pos = self.object:get_pos()
if not pos then return end
local water = minetest.find_nodes_in_area(vec_sub(pos, 1.5), vec_add(pos, 1.5), {"group:water"})
if not water[1] then return 0 end if not water[1] then return 0 end
local player = self._nearby_player local player = self._target
if player local plyr_name = player and player:is_player() and player:get_player_name()
and player:get_player_name() then if plyr_name then
local trust = self.trust[player:get_player_name()] or 0 local plyr_pos = player and player:get_pos()
return (10 - (vec_dist(self.object:get_pos(), player:get_pos()) + trust)) * 0.1, {self, player} local trust = self.trust[plyr_name] or 0
return (10 - (vec_dist(pos, plyr_pos) + trust)) * 0.1, {self, water[1]}
end end
return 0 return 0
end end
@ -177,14 +192,7 @@ creatura.register_mob("animalia:frog", {
end, end,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if animalia.feed(self, clicker, false, true) then if animalia.feed(self, clicker, false, true) then
local name = clicker:get_player_name() animalia.add_trust(self, clicker, 1)
if self.trust[name] then
self.trust[name] = self.trust[name] + 1
else
self.trust[name] = 1
end
if self.trust[name] > 5 then self.trust[name] = 5 end
self:memorize("trust", self.trust)
return return
end end
if animalia.set_nametag(self, clicker) then if animalia.set_nametag(self, clicker) then

View file

@ -7,7 +7,7 @@ local random = math.random
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if (name:match(":wheat") if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0) or minetest.get_item_group(name, "food_wheat") > 0)
and not name:find("seed") then and not name:find("seed") then
@ -16,42 +16,59 @@ minetest.register_on_mods_loaded(function()
end end
end) end)
local function set_pattern(self) local patterns = {
local types = { "animalia_horse_pattern_1.png",
"spots", "animalia_horse_pattern_2.png",
"patches" "animalia_horse_pattern_3.png"
}
local avlbl_colors = {
[1] = {
"animalia_horse_2.png",
"animalia_horse_3.png",
"animalia_horse_6.png"
},
[2] = {
"animalia_horse_1.png",
"animalia_horse_6.png"
},
[3] = {
"animalia_horse_2.png",
"animalia_horse_1.png"
},
[4] = {
"animalia_horse_2.png",
"animalia_horse_1.png"
},
[5] = {
"animalia_horse_2.png",
"animalia_horse_1.png"
},
[6] = {
"animalia_horse_2.png",
"animalia_horse_1.png"
} }
if self:recall("pattern") }
and not self:recall("pattern"):find("better_fauna") then
local pattern = self:recall("pattern") local function set_pattern(self)
local texture = self.object:get_properties().textures[1] local pattern_no = self:recall("pattern_no")
self.object:set_properties({ if pattern_no and pattern_no < 1 then return end
textures = {texture .. "^" .. pattern} if not pattern_no then
}) if random(3) < 2 then
else pattern_no = self:memorize("pattern_no", random(#patterns))
local type = types[random(#types)] else
local overlay = "(animalia_horse_".. type ..".png)" self:memorize("pattern_no", 0)
if type == "patches" then return
local colors = {
"brown",
"white"
}
if self.texture_no < 1 then
table.insert(colors, "black")
else
table.remove(colors, 1)
end
overlay = "(animalia_horse_".. colors[random(#colors)] .."_patches.png)"
end end
if random(100) > 50 then end
overlay = "transparency.png" local colors = avlbl_colors[self.texture_no]
end local color_no = self:recall("color_no") or self:memorize("color_no", random(#colors))
local texture = self.object:get_properties().textures[1] if not colors[color_no] then return end
self.object:set_properties({ local pattern = "(" .. patterns[pattern_no] .. "^[mask:" .. colors[color_no] .. ")"
textures = {texture .. "^" .. overlay} local texture = self.object:get_properties().textures[1]
}) self.object:set_properties({
self:memorize("pattern", overlay) textures = {texture .. "^" .. pattern}
end })
end end
creatura.register_mob("animalia:horse", { creatura.register_mob("animalia:horse", {
@ -82,14 +99,16 @@ creatura.register_mob("animalia:horse", {
"animalia_horse_6.png" "animalia_horse_6.png"
}, },
animations = { animations = {
stand = {range = {x = 1, y = 60}, speed = 10, frame_blend = 0.3, loop = true}, stand = {range = {x = 1, y = 59}, speed = 10, frame_blend = 0.3, loop = true},
walk = {range = {x = 70, y = 110}, speed = 30, frame_blend = 0.3, loop = true}, walk = {range = {x = 61, y = 79}, speed = 20, frame_blend = 0.3, loop = true},
run = {range = {x = 120, y = 140}, speed = 30, frame_blend = 0.3, loop = true}, run = {range = {x = 81, y = 99}, speed = 30, frame_blend = 0.3, loop = true},
rear = {range = {x = 150, y = 180}, speed = 27, frame_blend = 0.2, loop = false}, punch_aoe = {range = {x = 101, y = 119}, speed = 30, frame_blend = 0.2, loop = false},
rear_constant = {range = {x = 160, y = 170}, speed = 20, frame_blend = 0.3, loop = true}, rear = {range = {x = 121, y = 140}, speed = 20, frame_blend = 0.2, loop = false},
eat = {range = {x = 190, y = 220}, speed = 20, frame_blend = 0.3, loop = false} 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 -- Misc
step_delay = 0.25,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = true, catch_with_lasso = true,
sounds = { sounds = {
@ -116,71 +135,101 @@ creatura.register_mob("animalia:horse", {
}, },
follow = follows, follow = follows,
consumable_nodes = { consumable_nodes = {
{ ["default:dirt_with_grass"] = "default:dirt",
name = "default:dirt_with_grass", ["default:dry_dirt_with_dry_grass"] = "default:dry_dirt"
replacement = "default:dirt"
},
{
name = "default:dry_dirt_with_dry_grass",
replacement = "default:dry_dirt"
}
}, },
head_data = { head_data = {
bone = "Neck.CTRL", bone = "Neck.CTRL",
offset = {x = 0, y = 1.2, z = 0.15}, offset = {x = 0, y = 1.45, z = 0.0},
pitch_correction = 45, pitch_correction = 25,
pivot_h = 1, pivot_h = 1,
pivot_v = 1.5 pivot_v = 1.5
}, },
-- Function -- Function
wander_action = animalia.action_move_flock,
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:boid_wander", utility = "animalia:wander_group",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:eat_from_turf", utility = "animalia:eat_turf",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return math.random(11) * 0.01, {self} if random(64) < 2 then
return 0.2, {self}
end
return 0
end end
}, },
[3] = { {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 0.95, {self} return 0.3, {self}
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.lasso_origin local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
and type(self.lasso_origin) == "userdata" then local force = lasso and lasso ~= false
return 0.8, {self, self.lasso_origin, true} local player = (force and lasso) or creatura.get_nearby_player(self)
if player
and self:follow_wielded_item(player) then
return 0.4, {self, player}
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:horse_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
return 0.9, {self} return 0.5, {self}
end end
return 0 return 0
end end
}, },
[6] = { {
utility = "animalia:mount", utility = "animalia:flee_from_target_defend",
get_score = function(self) get_score = function(self)
if self.rider local puncher = self._puncher
and self.saddled then if puncher
return 1, {self, self.rider} and puncher:get_pos() then
return 0.6, {self, puncher}
end
self._puncher = nil
return 0
end
},
{
utility = "animalia:tame_horse",
get_score = function(self)
local rider = not self.owner and self.rider
if rider
and rider:get_pos() then
return 0.7, {self}
end
return 0
end
},
{
utility = "animalia:mount_horse",
get_score = function(self)
local owner = self.owner and minetest.get_player_by_name(self.owner)
local rider = owner == self.rider and self.rider
if rider
and rider:get_pos() then
return 0.8, {self, rider}
end end
return 0 return 0
end end
@ -219,43 +268,6 @@ creatura.register_mob("animalia:horse", {
animalia.head_tracking(self) animalia.head_tracking(self)
animalia.do_growth(self, 60) animalia.do_growth(self, 60)
animalia.update_lasso_effects(self) animalia.update_lasso_effects(self)
if self.breaking
and self:timer(1) then
local pos = self:get_center_pos()
if not minetest.get_player_by_name(self.breaker) then
self.breaking = nil
self.breaker = nil
else
local yaw = self.object:get_yaw()
local yaw2 = minetest.get_player_by_name(self.breaker):get_look_horizontal()
if math.abs(yaw - yaw2) > 5.8
or math.abs(yaw - yaw2) < 0.5 then
self.breaking_progress = self.breaking_progress + 1
else
self.breaking_progress = self.breaking_progress - 1
end
self:initiate_utility("animalia:horse_breaking", self)
if self.breaking_progress < -5
or minetest.get_player_by_name(self.breaker):get_player_control().sneak then
animalia.mount(self, minetest.get_player_by_name(self.breaker))
creatura.action_idle(self, 0.5, "rear")
self.breaking = nil
self.breaker = nil
self.breaking_progress = nil
elseif self.breaking_progress > 5 then
animalia.mount(self, minetest.get_player_by_name(self.breaker))
self.owner = self:memorize("owner", self.breaker)
animalia.protect_from_despawn(self)
self.breaking = nil
self.breaker = nil
self.breaking_progress = nil
local prt_pos = vector.new(pos.x, pos.y + 2, pos.z)
local minppos = vector.add(prt_pos, 1)
local maxppos = vector.subtract(prt_pos, 1)
animalia.particle_spawner(prt_pos, "creatura_particle_green.png", "float", minppos, maxppos)
end
end
end
end, end,
death_func = function(self) death_func = function(self)
if self:get_utility() ~= "animalia:die" then if self:get_utility() ~= "animalia:die" then
@ -275,7 +287,7 @@ creatura.register_mob("animalia:horse", {
and self.owner == clicker:get_player_name() then and self.owner == clicker:get_player_name() then
if self.saddled if self.saddled
and tool_name == "" then 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}})
self:initiate_utility("animalia:mount", self, clicker) self:initiate_utility("animalia:mount", self, clicker)
elseif tool_name == "animalia:saddle" then elseif tool_name == "animalia:saddle" then
self.saddled = self:memorize("saddled", true) self.saddled = self:memorize("saddled", true)
@ -293,16 +305,14 @@ creatura.register_mob("animalia:horse", {
elseif not self.owner elseif not self.owner
and tool_name == "" then 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 = -60, y = 180, z = 0}, pos = {x = 0, y = 1.1, z = 0.5}})
self.breaking = true
self.breaker = clicker:get_player_name()
self.breaking_progress = 0
end end
animalia.add_libri_page(self, clicker, {name = "horse", form = "pg_horse;Horses"}) animalia.add_libri_page(self, clicker, {name = "horse", form = "pg_horse;Horses"})
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) on_punch = function(self, puncher, ...)
creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) if self.rider and puncher == self.rider then return end
self:initiate_utility("animalia:boid_flee_from_player", self, puncher, true) creatura.basic_punch_func(self, puncher, ...)
self:set_utility_score(1) if self.hp < 0 then return end
self._puncher = puncher
end end
}) })

View file

@ -5,7 +5,7 @@
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if name:match(":carrot") if name:match(":carrot")
and (minetest.get_item_group(name, "food") > 0 and (minetest.get_item_group(name, "food") > 0
or minetest.get_item_group(name, "food_carrot") > 0) then or minetest.get_item_group(name, "food_carrot") > 0) then
@ -64,6 +64,7 @@ creatura.register_mob("animalia:pig", {
run = {range = {x = 1, y = 20}, speed = 45, frame_blend = 0.3, loop = true}, run = {range = {x = 1, y = 20}, speed = 45, frame_blend = 0.3, loop = true},
}, },
-- Misc -- Misc
step_delay = 0.25,
consumable_nodes = destroyable_crops, consumable_nodes = destroyable_crops,
birth_count = 2, birth_count = 2,
catch_with_net = true, catch_with_net = true,
@ -93,24 +94,27 @@ creatura.register_mob("animalia:pig", {
utility_stack = { utility_stack = {
[1] = { [1] = {
utility = "animalia:wander", utility = "animalia:wander",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self, true}
end end
}, },
[2] = { [2] = {
utility = "animalia:eat_from_turf", utility = "animalia:eat_from_turf",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if math.random(25) < 2 then if math.random(25) < 2 then
return 0.1, {self} return 0.2, {self}
end end
return 0 return 0
end end
}, },
[3] = { [3] = {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 1, {self} return 0.3, {self}
end end
return 0 return 0
end end
@ -118,24 +122,23 @@ creatura.register_mob("animalia:pig", {
[4] = { [4] = {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.lasso_origin local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
and type(self.lasso_origin) == "userdata" then local force = lasso and lasso ~= false
return 0.8, {self, self.lasso_origin, true} local player = (force and lasso) or creatura.get_nearby_player(self)
end
local player = creatura.get_nearby_player(self)
if player if player
and self:follow_wielded_item(player) then and self:follow_wielded_item(player) then
return 0.8, {self, player} return 0.4, {self, player}
end end
return 0 return 0
end end
}, },
[5] = { [5] = {
utility = "animalia:mammal_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
return 0.9, {self} return 0.5, {self}
end end
return 0 return 0
end end
@ -166,8 +169,7 @@ creatura.register_mob("animalia:pig", {
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) 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) creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
self:initiate_utility("animalia:flee_from_player", self, puncher) self._target = puncher
self:set_utility_score(1)
end end
}) })

View file

@ -5,7 +5,7 @@
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if (name:match(":wheat") if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0) or minetest.get_item_group(name, "food_wheat") > 0)
and not name:find("seed") then and not name:find("seed") then
@ -43,6 +43,7 @@ creatura.register_mob("animalia:reindeer", {
run = {range = {x = 70, y = 110}, speed = 50, frame_blend = 0.3, loop = true}, run = {range = {x = 70, y = 110}, speed = 50, frame_blend = 0.3, loop = true},
}, },
-- Misc -- Misc
step_delay = 0.25,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = true, catch_with_lasso = true,
drops = { drops = {
@ -68,54 +69,68 @@ creatura.register_mob("animalia:reindeer", {
}, },
-- Function -- Function
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:boid_wander", utility = "animalia:wander_group",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:eat_from_turf", utility = "animalia:eat_turf",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if math.random(25) < 2 then if random(64) < 2 then
return 0.1, {self} return 0.2, {self}
end end
return 0 return 0
end end
}, },
[3] = { {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 1, {self} return 0.3, {self}
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.lasso_origin local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
and type(self.lasso_origin) == "userdata" then local force = lasso and lasso ~= false
return 0.8, {self, self.lasso_origin, true} local player = (force and lasso) or creatura.get_nearby_player(self)
end
local player = creatura.get_nearby_player(self)
if player if player
and self:follow_wielded_item(player) then and self:follow_wielded_item(player) then
return 0.8, {self, player} return 0.4, {self, player}
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:mammal_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
return 0.9, {self} return 0.5, {self}
end end
return 0 return 0
end end
},
{
utility = "animalia:flee_from_target",
get_score = function(self)
local puncher = self._target
if puncher
and puncher:get_pos() then
return 0.6, {self, puncher}
end
self._target = nil
return 0
end
} }
}, },
activate_func = function(self) activate_func = function(self)
@ -144,8 +159,7 @@ creatura.register_mob("animalia:reindeer", {
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) 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) creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
self:initiate_utility("animalia:boid_flee_from_player", self, puncher, true) self._target = puncher
self:set_utility_score(1)
end end
}) })

View file

@ -2,10 +2,12 @@
-- Sheep -- -- Sheep --
----------- -----------
local random = math.random
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if (name:match(":wheat") if (name:match(":wheat")
or minetest.get_item_group(name, "food_wheat") > 0) or minetest.get_item_group(name, "food_wheat") > 0)
and not name:find("seed") then and not name:find("seed") then
@ -69,6 +71,7 @@ creatura.register_mob("animalia:sheep", {
run = {range = {x = 70, y = 110}, speed = 50, frame_blend = 0.3, loop = true}, run = {range = {x = 70, y = 110}, speed = 50, frame_blend = 0.3, loop = true},
}, },
-- Misc -- Misc
step_delay = 0.25,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = true, catch_with_lasso = true,
sounds = { sounds = {
@ -94,14 +97,8 @@ creatura.register_mob("animalia:sheep", {
}, },
follow = follows, follow = follows,
consumable_nodes = { consumable_nodes = {
{ ["default:dirt_with_grass"] = "default:dirt",
name = "default:dirt_with_grass", ["default:dry_dirt_with_dry_grass"] = "default:dry_dirt"
replacement = "default:dirt"
},
{
name = "default:dry_dirt_with_dry_grass",
replacement = "default:dry_dirt"
}
}, },
head_data = { head_data = {
offset = {x = 0, y = 0.41, z = 0}, offset = {x = 0, y = 0.41, z = 0},
@ -111,67 +108,83 @@ creatura.register_mob("animalia:sheep", {
}, },
-- Function -- Function
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:wander", utility = "animalia:wander_group",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:eat_from_turf", utility = "animalia:eat_turf",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if math.random(25) < 2 then if random(64) < 2 then
return 0.1, {self} return 0.2, {self}
end end
return 0 return 0
end end
}, },
[3] = { {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 1, {self} return 0.3, {self}
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.lasso_origin if self.lasso_origin
and type(self.lasso_origin) == "userdata" then and type(self.lasso_origin) == "userdata" then
return 0.8, {self, self.lasso_origin, true} return 0.4, {self, self.lasso_origin, true}
end end
local player = creatura.get_nearby_player(self) local player = creatura.get_nearby_player(self)
if player if player
and self:follow_wielded_item(player) then and self:follow_wielded_item(player) then
return 0.8, {self, player} return 0.4, {self, player}
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:mammal_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
return 0.9, {self} return 0.5, {self}
end end
return 0 return 0
end end
},
{
utility = "animalia:flee_from_target",
get_score = function(self)
local puncher = self._target
if puncher
and puncher:get_pos() then
return 0.6, {self, puncher}
end
self._target = nil
return 0
end
} }
}, },
activate_func = function(self) activate_func = function(self)
self.gotten = self:recall("gotten") or false self.collected = self:recall("collected") or false
self.dye_color = self:recall("dye_color") or "white" self.dye_color = self:recall("dye_color") or "white"
self.dye_hex = self:recall("dye_hex") or "" self.dye_hex = self:recall("dye_hex") or ""
if self.dye_color ~= "white" if self.dye_color ~= "white"
and not self.gotten then and not self.collected then
self.object:set_properties({ self.object:set_properties({
textures = {"animalia_sheep.png^(animalia_sheep_wool.png^[colorize:" .. self.dye_hex .. ")"}, textures = {"animalia_sheep.png^(animalia_sheep_wool.png^[colorize:" .. self.dye_hex .. ")"},
}) })
end end
if self.gotten then if self.collected then
self.object:set_properties({ self.object:set_properties({
textures = {"animalia_sheep.png"}, textures = {"animalia_sheep.png"},
}) })
@ -202,7 +215,7 @@ creatura.register_mob("animalia:sheep", {
local tool = clicker:get_wielded_item() local tool = clicker:get_wielded_item()
local tool_name = tool:get_name() local tool_name = tool:get_name()
if tool_name == "animalia:shears" if tool_name == "animalia:shears"
and not self.gotten and not self.collected
and self.growth_scale > 0.9 then and self.growth_scale > 0.9 then
if not minetest.get_modpath("wool") then if not minetest.get_modpath("wool") then
return return
@ -213,7 +226,7 @@ creatura.register_mob("animalia:sheep", {
ItemStack( "wool:" .. self.dye_color .. " " .. math.random(1, 3) ) ItemStack( "wool:" .. self.dye_color .. " " .. math.random(1, 3) )
) )
self.gotten = self:memorize("gotten", true) self.collected = self:memorize("collected", true)
self.dye_color = self:memorize("dye_color", "white") self.dye_color = self:memorize("dye_color", "white")
self.dye_hex = self:memorize("dye_hex", "#abababc000") self.dye_hex = self:memorize("dye_hex", "#abababc000")
@ -227,9 +240,9 @@ creatura.register_mob("animalia:sheep", {
end end
for _, color in ipairs(palette) do for _, color in ipairs(palette) do
if tool_name:find("dye:") if tool_name:find("dye:")
and not self.gotten and not self.collected
and self.growth_scale > 0.9 then and self.growth_scale > 0.9 then
local dye = string.split(tool_name, ":")[2] local dye = tool_name:split(":")[2]
if color[1] == dye then if color[1] == dye then
self.dye_color = self:memorize("dye_color", color[1]) self.dye_color = self:memorize("dye_color", color[1])
@ -256,8 +269,7 @@ creatura.register_mob("animalia:sheep", {
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) 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) creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
self:initiate_utility("animalia:boid_flee_from_player", self, puncher, true) self._target = puncher
self:set_utility_score(1)
end end
}) })

View file

@ -12,7 +12,7 @@ creatura.register_mob("animalia:tropical_fish", {
despawn_after = 2500, despawn_after = 2500,
-- Entity Physics -- Entity Physics
stepheight = 0.1, stepheight = 0.1,
max_fall = 8, max_fall = 0,
turn_rate = 8, turn_rate = 8,
boid_seperation = 0.3, boid_seperation = 0.3,
bouyancy_multiplier = 0, bouyancy_multiplier = 0,
@ -33,19 +33,22 @@ creatura.register_mob("animalia:tropical_fish", {
flop = {range = {x = 30, y = 40}, 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_net = true,
catch_with_lasso = false, catch_with_lasso = false,
makes_footstep_sound = false, makes_footstep_sound = false,
-- Function -- Function
utility_stack = { utility_stack = {
{ {
utility = "animalia:schooling", utility = "animalia:aquatic_wander_school",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self} return 0.1, {self}
end end
}, },
{ {
utility = "animalia:flop", utility = "animalia:flop",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if not self.in_liquid then if not self.in_liquid then
self:hurt(1) self:hurt(1)

View file

@ -5,7 +5,7 @@
local follows = {} local follows = {}
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_items) do for name in pairs(minetest.registered_items) do
if name:match(":seed_") if name:match(":seed_")
or name:match("_seed") then or name:match("_seed") then
table.insert(follows, name) table.insert(follows, name)
@ -41,6 +41,7 @@ creatura.register_mob("animalia:turkey", {
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 -- Misc
step_delay = 0.25,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = true, catch_with_lasso = true,
sounds = { sounds = {
@ -72,55 +73,78 @@ creatura.register_mob("animalia:turkey", {
pivot_v = 0.65 pivot_v = 0.65
}, },
-- Function -- Function
add_child = function(self)
local pos = self.object:get_pos()
if not pos then return end
minetest.add_particlespawner({
amount = 6,
time = 0.25,
minpos = {x = pos.x - 7/16, y = pos.y - 5/16, z = pos.z - 7/16},
maxpos = {x = pos.x + 7/16, y = pos.y - 5/16, z = pos.z + 7/16},
minvel = vector.new(-1, 2, -1),
maxvel = vector.new(1, 5, 1),
minacc = vector.new(0, -9.81, 0),
maxacc = vector.new(0, -9.81, 0),
collisiondetection = true,
texture = "animalia_egg_fragment.png",
})
local object = minetest.add_entity(pos, self.name)
local ent = object:get_luaentity()
ent.growth_scale = 0.7
animalia.initialize_api(ent)
animalia.protect_from_despawn(ent)
end,
wander_action = creatura.action_move,
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:wander", utility = "animalia:wander_group",
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:resist_fall", utility = "animalia:swim_to_Land",
get_score = function(self)
if not self.touching_ground then
return 0.11, {self}
end
return 0
end
},
[3] = {
utility = "animalia:swim_to_land",
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 1, {self} return 0.5, {self}
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
if self.lasso_origin local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
and type(self.lasso_origin) == "userdata" then local force = lasso and lasso ~= false
return 0.8, {self, self.lasso_origin, true} local player = (force and lasso) or creatura.get_nearby_player(self)
end
local player = creatura.get_nearby_player(self)
if player if player
and self:follow_wielded_item(player) then and self:follow_wielded_item(player) then
return 0.8, {self, player} return 0.3, {self, player}
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:bird_breed", utility = "animalia:breed",
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
return 0.9, {self} return 0.4, {self}
end end
return 0 return 0
end end
},
{
utility = "animalia:flee_from_target",
get_score = function(self)
local puncher = self._target
if puncher
and puncher:get_pos() then
return 0.6, {self, puncher}
end
self._target = nil
return 0
end
} }
}, },
activate_func = function(self) activate_func = function(self)
@ -132,6 +156,10 @@ creatura.register_mob("animalia:turkey", {
animalia.head_tracking(self, 0.75, 0.75) animalia.head_tracking(self, 0.75, 0.75)
animalia.do_growth(self, 60) animalia.do_growth(self, 60)
animalia.update_lasso_effects(self) animalia.update_lasso_effects(self)
if self.fall_start then
self:set_gravity(-4.9)
self:animate("fall")
end
end, end,
death_func = function(self) death_func = function(self)
if self:get_utility() ~= "animalia:die" then if self:get_utility() ~= "animalia:die" then
@ -149,8 +177,7 @@ creatura.register_mob("animalia:turkey", {
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) 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) creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
self:initiate_utility("animalia:flee_from_player", self, puncher) self._target = puncher
self:set_utility_score(1)
end end
}) })

View file

@ -2,7 +2,20 @@
-- Wolf -- -- Wolf --
---------- ----------
local vec_dist = vector.distance local function shared_owner(obj1, obj2)
if not obj1 or not obj2 then return false end
obj1 = creatura.is_valid(obj1)
obj2 = creatura.is_valid(obj2)
if obj1
and obj2
and obj1:get_luaentity()
and obj2:get_luaentity() then
obj1 = obj1:get_luaentity()
obj2 = obj2:get_luaentity()
return obj1.owner and obj2.owner and obj1.owner == obj2.owner
end
return false
end
local follow = { local follow = {
"animalia:mutton_raw", "animalia:mutton_raw",
@ -40,6 +53,7 @@ creatura.register_mob("animalia:wolf", {
despawn_after = 2000, despawn_after = 2000,
-- Entity Physics -- Entity Physics
stepheight = 1.1, stepheight = 1.1,
max_fall = 3,
-- Visuals -- Visuals
mesh = "animalia_wolf.b3d", mesh = "animalia_wolf.b3d",
hitbox = { hitbox = {
@ -47,117 +61,91 @@ creatura.register_mob("animalia:wolf", {
height = 0.7 height = 0.7
}, },
visual_size = {x = 9, y = 9}, visual_size = {x = 9, y = 9},
textures = {"animalia_wolf.png"}, textures = {
"animalia_wolf_1.png",
"animalia_wolf_2.png",
"animalia_wolf_3.png",
"animalia_wolf_4.png"
},
animations = { animations = {
stand = {range = {x = 30, y = 49}, speed = 10, frame_blend = 0.3, loop = true}, stand = {range = {x = 1, y = 39}, speed = 10, frame_blend = 0.3, loop = true},
sit = {range = {x = 60, y = 90}, speed = 20, frame_blend = 0.3, loop = true}, walk = {range = {x = 41, y = 59}, speed = 30, frame_blend = 0.3, loop = true},
walk = {range = {x = 1, y = 20}, speed = 30, frame_blend = 0.3, loop = true}, run = {range = {x = 41, y = 59}, speed = 45, frame_blend = 0.3, loop = true},
run = {range = {x = 1, y = 20}, speed = 45, frame_blend = 0.3, loop = true}, sit = {range = {x = 61, y = 79}, speed = 20, frame_blend = 0.3, loop = true},
leap = {range = {x = 100, y = 100}, speed = 1, frame_blend = 0.15, loop = false}
}, },
-- Misc -- Misc
step_delay = 0.25,
catch_with_net = true, catch_with_net = true,
catch_with_lasso = true, catch_with_lasso = true,
assist_owner = true, assist_owner = true,
follow = follow, follow = follow,
head_data = { head_data = {
offset = {x = 0, y = 0.22, z = 0}, offset = {x = 0, y = 0.33, z = 0},
pitch_correction = -25, pitch_correction = -67,
pivot_h = 0.65, pivot_h = 0.65,
pivot_v = 0.65 pivot_v = 0.65
}, },
-- Function -- Function
utility_stack = { utility_stack = {
[1] = { {
utility = "animalia:skittish_boid_wander", utility = "animalia:wander_skittish",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
return 0.1, {self, true} return 0.1, {self}
end end
}, },
[2] = { {
utility = "animalia:swim_to_land", utility = "animalia:swim_to_land",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.in_liquid then if self.in_liquid then
return 0.9, {self} return 0.3, {self}
end end
return 0 return 0
end end
}, },
[3] = { {
utility = "animalia:attack", utility = "animalia:attack_target",
get_score = function(self) get_score = function(self)
local target = creatura.get_nearby_entity(self, "animalia:sheep") local order = self.order or "wander"
local player = self._nearby_player if order ~= "wander" then return 0 end
local is_attacking = self:get_utility() == "animalia:attack" local target = self._target or creatura.get_nearby_object(self, "animalia:sheep")
if player if target
and player:get_player_name() then and not shared_owner(self, target) then
if is_value_in_table(self.enemies, player:get_player_name()) then return 0.4, {self, target}
local nearby_players = creatura.get_nearby_players(self)
local nearby_allies = creatura.get_nearby_entities(self, self.name)
if #nearby_players < #nearby_allies then
target = player
end
end
end
if target then
if is_attacking
and self._utility_data.args[2]
and self._utility_data.args[2] == target then
return 0
end
return 0.85, {self, target}
end end
return 0 return 0
end end
}, },
[4] = { {
utility = "animalia:flee_from_player", utility = "animalia:stay",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
local player = self._nearby_player local order = self.order or "wander"
if player if order == "sit" then
and player:get_player_name() then return 0.5, {self}
if is_value_in_table(self.enemies, player:get_player_name()) then
local nearby_players = creatura.get_nearby_players(self)
local nearby_allies = creatura.get_nearby_entities(self, self.name)
if #nearby_players >= #nearby_allies then
return 0.86, {self, player}
end
end
end end
return 0 return 0
end end
}, },
[5] = { {
utility = "animalia:sit",
get_score = function(self)
if self.order == "sit" then
return 0.8, {self}
end
return 0
end
},
[6] = {
utility = "animalia:follow_player", utility = "animalia:follow_player",
get_score = function(self) get_score = function(self)
local trust = 0 local lasso = type(self.lasso_origin or {}) == "userdata" and self.lasso_origin
local player = self._nearby_player local owner = self.owner and self.order == "follow" and minetest.get_player_by_name(self.owner)
if self.lasso_origin local force = (lasso and lasso ~= false) or owner
and type(self.lasso_origin) == "userdata" then local player = (force and (owner or lasso)) or creatura.get_nearby_player(self)
return 0.7, {self, self.lasso_origin, true} if player
elseif player and (self:follow_wielded_item(player)
and self:follow_wielded_item(player) then or force) then
return 0.7, {self, player} return 0.6, {self, player, force}
end
if self.order == "follow"
and self.owner
and minetest.get_player_by_name(self.owner) then
return 1, {self, minetest.get_player_by_name(self.owner), true}
end end
return 0 return 0
end end
}, },
[7] = { {
utility = "animalia:mammal_breed", utility = "animalia:breed",
step_delay = 0.25,
get_score = function(self) get_score = function(self)
if self.breeding if self.breeding
and animalia.get_nearby_mate(self, self.name) then and animalia.get_nearby_mate(self, self.name) then
@ -170,7 +158,6 @@ creatura.register_mob("animalia:wolf", {
activate_func = function(self) activate_func = function(self)
animalia.initialize_api(self) animalia.initialize_api(self)
animalia.initialize_lasso(self) animalia.initialize_lasso(self)
self._path = {}
self.order = self:recall("order") or "wander" self.order = self:recall("order") or "wander"
self.owner = self:recall("owner") or nil self.owner = self:recall("owner") or nil
self.enemies = self:recall("enemies") or {} self.enemies = self:recall("enemies") or {}
@ -194,10 +181,9 @@ creatura.register_mob("animalia:wolf", {
end, end,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if not clicker:is_player() then return end if not clicker:is_player() then return end
local name = clicker:get_player_name()
local passive = true local passive = true
if is_value_in_table(self.enemies, clicker:get_player_name()) then if is_value_in_table(self.enemies, name) then passive = false end
passive = false
end
if animalia.feed(self, clicker, passive, passive) then if animalia.feed(self, clicker, passive, passive) then
return return
end end
@ -205,21 +191,21 @@ creatura.register_mob("animalia:wolf", {
return return
end end
if self.owner if self.owner
and clicker:get_player_name() == self.owner and name == self.owner
and clicker:get_player_control().sneak then and clicker:get_player_control().sneak then
local order = self.order local order = self.order
if order == "wander" then if order == "wander" then
minetest.chat_send_player(clicker:get_player_name(), "Wolf is following") minetest.chat_send_player(name, "Wolf is following")
self.order = "follow" self.order = "follow"
self:initiate_utility("animalia:follow_player", self, clicker, true) self:initiate_utility("animalia:follow_player", self, clicker, true)
self:set_utility_score(1) self:set_utility_score(0.7)
elseif order == "follow" then elseif order == "follow" then
minetest.chat_send_player(clicker:get_player_name(), "Wolf is sitting") minetest.chat_send_player(name, "Wolf is sitting")
self.order = "sit" self.order = "sit"
self:initiate_utility("animalia:sit", self) self:initiate_utility("animalia:stay", self)
self:set_utility_score(0.8) self:set_utility_score(0.5)
else else
minetest.chat_send_player(clicker:get_player_name(), "Wolf is wandering") minetest.chat_send_player(name, "Wolf is wandering")
self.order = "wander" self.order = "wander"
self:set_utility_score(0) self:set_utility_score(0)
end end
@ -229,24 +215,24 @@ creatura.register_mob("animalia:wolf", {
end, end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction, damage) 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) creatura.basic_punch_func(self, puncher, time_from_last_punch, tool_capabilities, direction, damage)
if puncher:is_player() then local name = puncher:is_player() and puncher:get_player_name()
if name then
if self.owner if self.owner
and puncher:get_player_name() == self.owner then and name == self.owner then
return return
elseif not is_value_in_table(self.enemies, puncher:get_player_name()) then elseif not is_value_in_table(self.enemies, name) then
table.insert(self.enemies, puncher:get_player_name()) table.insert(self.enemies, name)
if #self.enemies > 15 then if #self.enemies > 15 then
table.remove(self.enemies, 1) table.remove(self.enemies, 1)
end end
self.enemies = self:memorize("enemies", self.enemies) self.enemies = self:memorize("enemies", self.enemies)
else else
table.remove(self.enemies, 1) table.remove(self.enemies, 1)
table.insert(self.enemies, puncher:get_player_name()) table.insert(self.enemies, name)
self.enemies = self:memorize("enemies", self.enemies) self.enemies = self:memorize("enemies", self.enemies)
end end
end end
self:initiate_utility("animalia:attack", self, puncher, true) self._target = puncher
self:set_utility_score(1)
end, end,
deactivate_func = function(self) deactivate_func = function(self)
if self.owner then if self.owner then

View file

@ -2,5 +2,6 @@ name = animalia
depends = creatura depends = creatura
optional_depends = default, mcl_player optional_depends = default, mcl_player
description = Adds unique and consistantly designed Animals description = Adds unique and consistantly designed Animals
release = 11481
author = ElCeejo author = ElCeejo
title = Animalia title = Animalia

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 921 B

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 806 B

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Some files were not shown because too many files have changed in this diff Show more