add swimmer awards

master
A. Demant 2018-12-11 06:22:38 +01:00
parent 5b00f38d78
commit 47243fccfe
5 changed files with 4145 additions and 0 deletions

26
abm.lua
View File

@ -37,6 +37,32 @@ minetest.register_globalstep(function(dtime)
end
end
end
local player_swam=xpfw.player_get_attribute(player,"swam")
local swam_award=statistic_awards.swimming[1]
if player_swam ~= nil then
if player_swam > 0 then
local swim_i=1
local bswim = true
local aw_def=statistic_awards.swimming[swim_i]
while bswim do
local aw_def=statistic_awards.swimming[swim_i]
if aw_def ~= nil then
if basic_functions.has_value(player_awards.unlocked,aw_def.basename..aw_def.level) == false then
bswim=false
swam_award=aw_def
end
else
bswim = false
end
swim_i=swim_i+1
end
if aw_def ~= nil then
if aw_def.threshold<player_swam then
awards.unlock(player:get_player_name(),aw_def.basename..aw_def.level)
end
end
end
end
end
end
end)

View File

@ -13,6 +13,19 @@ if minetest.get_modpath("awards") and minetest.get_modpath("xpfw") then
end
awards.register_achievement(aw_def.basename..aw_def.level,awdef)
end
for i,aw_def in ipairs(statistic_awards.swimming) do
local awdef={
title=aw_def.titel,
description=aw_def.description,
icon=aw_def.baseicon.."^awards_level"..aw_def.level..".png",
background = "awards_bg_mining.png",
}
if aw_def.level > 1 then
awdef.requires=aw_def.basename..(aw_def.level-1)
awdef.secret=true
end
awards.register_achievement(aw_def.basename..aw_def.level,awdef)
end
for i,aw_def in ipairs(statistic_awards.deaths) do
local awdef={
title=aw_def.titel,

View File

@ -35,6 +35,43 @@ statistic_awards.hiking={
threshold=500000,
difficulty=1,},
}
statistic_awards.swimming={
{basename="statisticawards_swimming",
level=1,
title="Swam 100 miles",
description="You swam quite far. Keep going.",
baseicon = "statistic_awards_swimming.png",
threshold=100,
difficulty=0.001,},
{basename="statisticawards_swimming",
level=2,
title="Swam 1000 miles",
description="You swam quite far. Keep going.",
baseicon = "statistic_awards_swimming.png",
threshold=1000,
difficulty=0.005,},
{basename="statisticawards_swimming",
level=3,
title="Swam 5000 miles",
description="You swam quite far. Keep going.",
baseicon = "statistic_awards_swimming.png",
threshold=5000,
difficulty=0.01,},
{basename="statisticawards_swimming",
level=4,
title="Swam 10000 miles",
description="You swam quite far. Keep going.",
baseicon = "statistic_awards_swimming.png",
threshold=10000,
difficulty=0.1,},
{basename="statisticawards_swimming",
level=5,
title="Swam 50000 miles",
description="You swam quite far. Keep going.",
baseicon = "statistic_awards_swimming.png",
threshold=50000,
difficulty=1,},
}
statistic_awards.deaths={
{basename="statisticawards_deaths",

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB