Add breeding achievement

This commit is contained in:
Wuzzy 2019-09-22 14:17:33 +02:00
parent 58a6c3284d
commit 3aec00cfb4
4 changed files with 27 additions and 1 deletions

View File

@ -43,6 +43,14 @@ achievements.register_achievement(
times = 1,
})
achievements.register_achievement(
"the_wonder_of_life",
{
title = S("The Wonder of Life"),
description = S("Get two animals to breed."),
times = 1,
})
achievements.register_achievement(
"smalltalk",
{
@ -50,3 +58,4 @@ achievements.register_achievement(
description = S("Visit a village and have a friendly chat with a villager."),
times = 1,
})

View File

@ -158,6 +158,7 @@ function mobs:register_mob(name, def)
fly = def.fly,
fly_in = def.fly_in or "air",
owner = def.owner or "",
last_feeder = "",
order = def.order or "",
on_die = def.on_die,
do_custom = def.do_custom,
@ -242,6 +243,8 @@ function mobs:register_mob(name, def)
self.horny = true
end
self.last_feeder = name
self.gotten = false
if (not self.tamed) and name ~= nil
@ -723,11 +726,21 @@ function mobs:register_mob(name, def)
if num > 1 then
self.hornytimer = 41
ent.hornytimer = 41
local feeder
if self.last_feeder and self.last_feeder ~= "" and self.last_feeder == ent.last_feeder then
feeder = self.last_feeder
end
minetest.after(
7,
function(dtime)
local mob = minetest.add_entity(pos, self.name)
local ent2 = mob:get_luaentity()
if feeder then
local pfeeder = minetest.get_player_by_name(feeder)
if pfeeder:is_player() then
achievements.trigger_achievement(pfeeder, "the_wonder_of_life")
end
end
local textures = self.base_texture
if def.child_texture then
textures = def.child_texture[1]
@ -750,7 +763,7 @@ function mobs:register_mob(name, def)
ent2.child = true
ent2.tamed = true
--ent2.following = ent -- follow mother
end)
end, feeder)
num = 0
break
end

View File

@ -93,3 +93,5 @@ Isn't it stressful to carry this heavy bed around?=Ist es nicht anstrengend, die
Get this thing out of my face!=Nimm dieses Ding aus meinem Gesicht!
Smalltalk=Gerede
Visit a village and have a friendly chat with a villager.=Besuchen Sie ein Dorf und haben Sie ein nettes Gespräch mit einem Dorfbewohner.
The Wonder of Life=Das Wunder des Lebens
Get two animals to breed.=Bring zwei Tiere dazu, sich zu vermehren.

View File

@ -96,3 +96,5 @@ Isn't it stressful to carry this heavy bed around?=
Get this thing out of my face!=
Smalltalk=
Visit a village and have a friendly chat with a villager.=
The Wonder of Life=
Get two animals to breed.=