animals can make sounds now
This commit is contained in:
parent
925dde7e00
commit
3a36ef3d31
|
@ -705,6 +705,33 @@ creatura.register_utility("animalia:wander_water_surface", function(self)
|
|||
self:set_gravity(0)
|
||||
end
|
||||
self:set_utility(func)
|
||||
-- Speak
|
||||
|
||||
creatura.register_utility("animalia:birdsong", function(self)
|
||||
local sung = false
|
||||
local function func(self)
|
||||
if not sung and animalia.is_day
|
||||
then
|
||||
local song = self.textures[self.texture_no]:gsub("animalia_bird_", "")
|
||||
song = song:gsub(".png", "")
|
||||
self:play_sound(song)
|
||||
sung = true
|
||||
end
|
||||
end
|
||||
self:set_utility(func)
|
||||
end)
|
||||
|
||||
creatura.register_utility("animalia:speak", function(self)
|
||||
local spoke = false
|
||||
local function func(self)
|
||||
if not spoke and self.sounds.random then
|
||||
self:play_sound("random")
|
||||
spoke = true
|
||||
end
|
||||
end
|
||||
self:set_utility(func)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
-- "Eat" nodes
|
||||
|
|
14
mobs/bat.lua
14
mobs/bat.lua
|
@ -61,6 +61,7 @@ creatura.register_mob("animalia:bat", {
|
|||
max_health = 5,
|
||||
armor_groups = {fleshy = 200},
|
||||
damage = 0,
|
||||
chattiness = 50,
|
||||
speed = 4,
|
||||
tracking_range = 16,
|
||||
despawn_after = 2500,
|
||||
|
@ -177,7 +178,16 @@ creatura.register_mob("animalia:bat", {
|
|||
if not ceiling[1] then return 0 end
|
||||
return 1, {self}
|
||||
end
|
||||
}
|
||||
},
|
||||
[6] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -272,4 +282,4 @@ creatura.register_mob("animalia:bat", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:bat", "392517", "321b0b")
|
||||
creatura.register_spawn_egg("animalia:bat", "392517", "321b0b")
|
||||
|
|
|
@ -30,6 +30,7 @@ creatura.register_mob("animalia:bird", {
|
|||
armor_groups = {fleshy = 200},
|
||||
damage = 0,
|
||||
speed = 4,
|
||||
chattiness = 2,
|
||||
tracking_range = 16,
|
||||
despawn_after = 100,
|
||||
-- Entity Physics
|
||||
|
@ -140,7 +141,16 @@ creatura.register_mob("animalia:bird", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
{
|
||||
utility = "animalia:birdsong",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -166,16 +176,6 @@ creatura.register_mob("animalia:bird", {
|
|||
animalia.step_timers(self)
|
||||
animalia.do_growth(self, 60)
|
||||
animalia.update_lasso_effects(self)
|
||||
if animalia.is_day
|
||||
and self:timer(random(10,15)) then
|
||||
if self.texture_no == 1 then
|
||||
self:play_sound("cardinal")
|
||||
elseif self.texture_no == 2 then
|
||||
self:play_sound("eastern_blue")
|
||||
else
|
||||
self:play_sound("goldfinch")
|
||||
end
|
||||
end
|
||||
if self._anim == "fly" then
|
||||
local vel_y = self.object:get_velocity().y
|
||||
local rot = self.object:get_rotation()
|
||||
|
|
14
mobs/cat.lua
14
mobs/cat.lua
|
@ -19,6 +19,7 @@ creatura.register_mob("animalia:cat", {
|
|||
armor_groups = {fleshy = 200},
|
||||
damage = 1,
|
||||
speed = 5,
|
||||
chattiness = 50,
|
||||
tracking_range = 24,
|
||||
despawn_after = 2000,
|
||||
-- Entity Physics
|
||||
|
@ -188,7 +189,16 @@ creatura.register_mob("animalia:cat", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[8] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
step_func = function(self)
|
||||
animalia.step_timers(self)
|
||||
|
@ -310,4 +320,4 @@ creatura.register_mob("animalia:cat", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:cat", "db9764" ,"cf8d5a")
|
||||
creatura.register_spawn_egg("animalia:cat", "db9764" ,"cf8d5a")
|
||||
|
|
|
@ -19,6 +19,7 @@ creatura.register_mob("animalia:chicken", {
|
|||
armor_groups = {fleshy = 150},
|
||||
damage = 0,
|
||||
speed = 4,
|
||||
chattiness = 50,
|
||||
tracking_range = 16,
|
||||
despawn_after = 1500,
|
||||
-- Entity Physics
|
||||
|
@ -130,7 +131,16 @@ creatura.register_mob("animalia:chicken", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[6] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -163,4 +173,4 @@ creatura.register_mob("animalia:chicken", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:chicken", "c6c6c6", "d22222")
|
||||
creatura.register_spawn_egg("animalia:chicken", "c6c6c6", "d22222")
|
||||
|
|
20
mobs/cow.lua
20
mobs/cow.lua
|
@ -20,6 +20,7 @@ creatura.register_mob("animalia:cow", {
|
|||
armor_groups = {fleshy = 150},
|
||||
damage = 0,
|
||||
speed = 3,
|
||||
chattiness = 50,
|
||||
tracking_range = 16,
|
||||
despawn_after = 1500,
|
||||
-- Entity Physics
|
||||
|
@ -61,18 +62,18 @@ creatura.register_mob("animalia:cow", {
|
|||
sounds = {
|
||||
random = {
|
||||
name = "animalia_cow_random",
|
||||
gain = 0.4,
|
||||
gain = 0.01,
|
||||
distance = 8,
|
||||
variations = 3
|
||||
},
|
||||
hurt = {
|
||||
name = "animalia_cow_hurt",
|
||||
gain = 0.4,
|
||||
gain = 0.04,
|
||||
distance = 8
|
||||
},
|
||||
death = {
|
||||
name = "animalia_cow_death",
|
||||
gain = 0.4,
|
||||
gain = 0.04,
|
||||
distance = 8
|
||||
}
|
||||
},
|
||||
|
@ -147,7 +148,16 @@ creatura.register_mob("animalia:cow", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[6] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -211,4 +221,4 @@ creatura.register_mob("animalia:cow", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:cow", "cac3a1" ,"464438")
|
||||
creatura.register_spawn_egg("animalia:cow", "cac3a1" ,"464438")
|
||||
|
|
|
@ -12,6 +12,7 @@ creatura.register_mob("animalia:frog", {
|
|||
armor_groups = {fleshy = 200},
|
||||
damage = 0,
|
||||
speed = 4,
|
||||
chattiness = 60,
|
||||
tracking_range = 16,
|
||||
despawn_after = 2500,
|
||||
-- Entity Physics
|
||||
|
@ -122,7 +123,11 @@ creatura.register_mob("animalia:frog", {
|
|||
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}
|
||||
if self.object:get_pos()
|
||||
and player:get_pos()
|
||||
then
|
||||
return (10 - (vec_dist(self.object:get_pos(), player:get_pos()) + trust)) * 0.1, {self, player}
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
@ -138,11 +143,24 @@ creatura.register_mob("animalia:frog", {
|
|||
if player
|
||||
and player:get_player_name() then
|
||||
local trust = self.trust[player:get_player_name()] or 0
|
||||
return (10 - (vec_dist(self.object:get_pos(), player:get_pos()) + trust)) * 0.1, {self, player}
|
||||
if self.object:get_pos()
|
||||
and player:get_pos()
|
||||
then
|
||||
return (10 - (vec_dist(self.object:get_pos(), player:get_pos()) + trust)) * 0.1, {self, player}
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[8] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -159,9 +177,6 @@ creatura.register_mob("animalia:frog", {
|
|||
animalia.head_tracking(self, 0.2, 0.2)
|
||||
animalia.do_growth(self, 60)
|
||||
animalia.update_lasso_effects(self)
|
||||
if self:timer(random(5, 10)) then
|
||||
self:play_sound("random")
|
||||
end
|
||||
local props = self.object:get_properties()
|
||||
if self.growth_scale <= 0.6
|
||||
and props.mesh ~= "animalia_tadpole.b3d" then
|
||||
|
@ -199,4 +214,4 @@ creatura.register_mob("animalia:frog", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:frog", "67942e", "294811")
|
||||
creatura.register_spawn_egg("animalia:frog", "67942e", "294811")
|
||||
|
|
|
@ -60,6 +60,7 @@ creatura.register_mob("animalia:horse", {
|
|||
armor_groups = {fleshy = 100},
|
||||
damage = 0,
|
||||
speed = 10,
|
||||
chattiness = 50,
|
||||
tracking_range = 24,
|
||||
despawn_after = 2000,
|
||||
-- Entity Physics
|
||||
|
@ -184,7 +185,16 @@ creatura.register_mob("animalia:horse", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[7] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -306,4 +316,4 @@ creatura.register_mob("animalia:horse", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:horse", "ebdfd8" ,"653818")
|
||||
creatura.register_spawn_egg("animalia:horse", "ebdfd8" ,"653818")
|
||||
|
|
16
mobs/pig.lua
16
mobs/pig.lua
|
@ -31,6 +31,7 @@ creatura.register_mob("animalia:pig", {
|
|||
armor_groups = {fleshy = 100},
|
||||
damage = 0,
|
||||
speed = 3,
|
||||
chattiness = 50,
|
||||
tracking_range = 16,
|
||||
despawn_after = 1500,
|
||||
-- Entity Physics
|
||||
|
@ -75,7 +76,7 @@ creatura.register_mob("animalia:pig", {
|
|||
distance = 8
|
||||
},
|
||||
hurt = {
|
||||
name = "animalia_pig_hurt",
|
||||
name = "animalia_pig_death",
|
||||
gain = 1.0,
|
||||
distance = 8
|
||||
},
|
||||
|
@ -139,7 +140,16 @@ creatura.register_mob("animalia:pig", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[6] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.1, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -171,4 +181,4 @@ creatura.register_mob("animalia:pig", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:pig", "e0b1a7" ,"cc9485")
|
||||
creatura.register_spawn_egg("animalia:pig", "e0b1a7" ,"cc9485")
|
||||
|
|
|
@ -22,6 +22,7 @@ creatura.register_mob("animalia:reindeer", {
|
|||
armor_groups = {fleshy = 125},
|
||||
damage = 0,
|
||||
speed = 3,
|
||||
chattiness = 50,
|
||||
boid_seperation = 1,
|
||||
tracking_range = 16,
|
||||
despawn_after = 1500,
|
||||
|
@ -116,7 +117,16 @@ creatura.register_mob("animalia:reindeer", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[6] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -149,4 +159,4 @@ creatura.register_mob("animalia:reindeer", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:reindeer", "cac3a1" ,"464438")
|
||||
creatura.register_spawn_egg("animalia:reindeer", "cac3a1" ,"464438")
|
||||
|
|
|
@ -14,7 +14,7 @@ minetest.register_on_mods_loaded(function()
|
|||
end
|
||||
end)
|
||||
|
||||
local wool_block = "wool:white"
|
||||
local wool_block = "wool:wool"
|
||||
|
||||
if not minetest.get_modpath("wool") then
|
||||
wool_block = nil
|
||||
|
@ -46,6 +46,7 @@ creatura.register_mob("animalia:sheep", {
|
|||
armor_groups = {fleshy = 125},
|
||||
damage = 0,
|
||||
speed = 3,
|
||||
chattiness = 50,
|
||||
tracking_range = 16,
|
||||
despawn_after = 1500,
|
||||
-- Entity Physics
|
||||
|
@ -159,7 +160,16 @@ creatura.register_mob("animalia:sheep", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[6] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
self.gotten = self:recall("gotten") or false
|
||||
|
|
|
@ -19,6 +19,7 @@ creatura.register_mob("animalia:turkey", {
|
|||
armor_groups = {fleshy = 150},
|
||||
damage = 0,
|
||||
speed = 4,
|
||||
chattiness = 40,
|
||||
tracking_range = 16,
|
||||
despawn_after = 1500,
|
||||
-- Entity Physics
|
||||
|
@ -121,7 +122,16 @@ creatura.register_mob("animalia:turkey", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[6] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -154,4 +164,4 @@ creatura.register_mob("animalia:turkey", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:turkey", "352b22", "2f2721")
|
||||
creatura.register_spawn_egg("animalia:turkey", "352b22", "2f2721")
|
||||
|
|
|
@ -36,6 +36,7 @@ creatura.register_mob("animalia:wolf", {
|
|||
armor_groups = {fleshy = 100},
|
||||
damage = 4,
|
||||
speed = 5,
|
||||
chattiness = 50,
|
||||
tracking_range = 24,
|
||||
despawn_after = 2000,
|
||||
-- Entity Physics
|
||||
|
@ -101,6 +102,7 @@ creatura.register_mob("animalia:wolf", {
|
|||
end
|
||||
if target then
|
||||
if is_attacking
|
||||
and self._utiltiy_data
|
||||
and self._utility_data.args[2]
|
||||
and self._utility_data.args[2] == target then
|
||||
return 0
|
||||
|
@ -165,7 +167,16 @@ creatura.register_mob("animalia:wolf", {
|
|||
end
|
||||
return 0
|
||||
end
|
||||
}
|
||||
},
|
||||
[8] = {
|
||||
utility = "animalia:speak",
|
||||
get_score = function(self)
|
||||
if math.random(100) < self.chattiness then
|
||||
return 0.2, {self}
|
||||
end
|
||||
return 0
|
||||
end
|
||||
},
|
||||
},
|
||||
activate_func = function(self)
|
||||
animalia.initialize_api(self)
|
||||
|
@ -264,4 +275,4 @@ creatura.register_mob("animalia:wolf", {
|
|||
end
|
||||
})
|
||||
|
||||
creatura.register_spawn_egg("animalia:wolf", "a19678" ,"231b13")
|
||||
creatura.register_spawn_egg("animalia:wolf", "a19678" ,"231b13")
|
||||
|
|
Loading…
Reference in New Issue