Compare commits

...

5 Commits

Author SHA1 Message Date
A. Demant 84711c1c6b use rawget to test of enabled mods 2019-02-20 15:58:31 +01:00
ademant 83783fb92c add german translation 2019-02-14 13:59:30 +01:00
ademant 58e3ecd68a documentation 2019-02-13 14:35:29 +01:00
ademant cd314fcd95 compat for mt 0.4.17 2019-01-09 18:39:49 +01:00
ademant 8104945480 add settingtype with timer setting 2019-01-09 07:41:32 +01:00
10 changed files with 119 additions and 25 deletions

View File

@ -1,18 +1,21 @@
Minetest Game mod: Statistic Farming
==========================
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# Minetest Game mod: Statistic Farming
See license.txt for license information.
## Description
Mod with several awards based on statistical data from mod xpfw:
- Hiker: For walking miles and miles and miles....
- Swimmer: For swimming quite long
- Crafter: For crafting nice things
- Death: For dying always and respawning
## Authors of source code
Authors of source code
----------------------
Originally by ademant (MIT)
Authors of media (textures)
---------------------------
## Authors of media (textures)
Created by ademant (CC BY 3.0):
statistic_awards_hiker based on Art by Joel Lee
statistic_awards_death based on illustration by Paul Kidby

View File

@ -1,5 +1,5 @@
statistic_awards.globaltimer=0
statistic_awards.globaltimer=tonumber(minetest.settings:get("statistic_awards.globaltime")) or 1
minetest.register_globalstep(function(dtime)
statistic_awards.globaltimer=statistic_awards.globaltimer+dtime
@ -9,7 +9,6 @@ minetest.register_globalstep(function(dtime)
for i=1, #players do
local player=players[i]
local player_awards=awards.player(player:get_player_name())
-- print(dump2(player_awards))
local player_walked=xpfw.player_get_attribute(player,"walked")
local hike_award=statistic_awards.hiking[1]
if player_walked ~= nil then

View File

@ -1,4 +1,4 @@
if minetest.get_modpath("awards") and minetest.get_modpath("xpfw") then
if rawget(_G, "awards") and rawget(_G, "xpfw") then
for i,aw_def in ipairs(statistic_awards.hiking) do
local awdef={

View File

@ -1,36 +1,38 @@
local S=physio_stress.intllib
statistic_awards.hiking={
{basename="statisticawards_hiking",
level=1,
title="Walked 1000 miles",
description="You walked quite far. Keep going.",
description=S("You walked quite far. Keep going."),
baseicon = "statistic_awards_hiking.png",
threshold=1000,
difficulty=0.001,},
{basename="statisticawards_hiking",
level=2,
title="Walked 10000 miles",
description="You walked quite far. Keep going.",
description=S("You walked quite far. Keep going."),
baseicon = "statistic_awards_hiking.png",
threshold=10000,
difficulty=0.005,},
{basename="statisticawards_hiking",
level=3,
title="Walked 50000 miles",
description="You walked quite far. Keep going.",
description=S("You walked quite far. Keep going."),
baseicon = "statistic_awards_hiking.png",
threshold=50000,
difficulty=0.01,},
{basename="statisticawards_hiking",
level=4,
title="Walked 100000 miles",
description="You walked quite far. Keep going.",
description=S("You walked quite far. Keep going."),
baseicon = "statistic_awards_hiking.png",
threshold=100000,
difficulty=0.1,},
{basename="statisticawards_hiking",
level=5,
title="Walked 500000 miles",
description="You walked quite far. Keep going.",
description=S("You walked quite far. Keep going."),
baseicon = "statistic_awards_hiking.png",
threshold=500000,
difficulty=1,},
@ -39,21 +41,21 @@ statistic_awards.crafting={
{basename="statisticawards_crafting",
level=1,
title="crafted 100 items",
description="You crafted quite far. Keep going.",
description=S("You crafted quite much. Keep going."),
baseicon = "statistic_awards_crafting.png",
threshold=100,
difficulty=0.001,},
{basename="statisticawards_crafting",
level=2,
title="Crafted 1000 items",
description="You crafted quite far. Keep going.",
description=S("You crafted quite much. Keep going."),
baseicon = "statistic_awards_crafting.png",
threshold=1000,
difficulty=0.005,},
{basename="statisticawards_crafting",
level=3,
title="Crafted 5000 items",
description="You crafted quite far. Keep going.",
description=S("You crafted quite much. Keep going."),
baseicon = "statistic_awards_crafting.png",
threshold=5000,
difficulty=0.01,},
@ -62,14 +64,14 @@ statistic_awards.swimming={
{basename="statisticawards_swimming",
level=1,
title="Swam 100 miles",
description="You swam quite far. Keep going.",
description=S("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.",
description=S("You swam quite far. Keep going."),
baseicon = "statistic_awards_swimming.png",
threshold=1000,
difficulty=0.005,},
@ -83,14 +85,14 @@ statistic_awards.swimming={
{basename="statisticawards_swimming",
level=4,
title="Swam 10000 miles",
description="You swam quite far. Keep going.",
description=S("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.",
description=S("You swam quite far. Keep going."),
baseicon = "statistic_awards_swimming.png",
threshold=50000,
difficulty=1,},
@ -100,7 +102,7 @@ statistic_awards.deaths={
{basename="statisticawards_deaths",
level=1,
title="Died 7 times",
description="You're cat is jealous about you.",
description=S("You're cat is jealous about you."),
baseicon = "statistic_awards_death.png",
threshold=7,
difficulty=0.001,},
@ -114,14 +116,14 @@ statistic_awards.deaths={
{basename="statisticawards_deaths",
level=3,
title="Died 1000 times",
description="Expert in death",
description=S("Expert in death"),
baseicon = "statistic_awards_death.png",
threshold=1000,
difficulty=0.1,},
{basename="statisticawards_deaths",
level=4,
title="Died 5000 times",
description="Life is boring?",
description=S("Life is boring?"),
baseicon = "statistic_awards_death.png",
threshold=5000,
difficulty=1,},

4
depends.txt Normal file
View File

@ -0,0 +1,4 @@
default
awards
xpfw
basic_functions

View File

@ -1,6 +1,8 @@
statistic_awards = {}
statistic_awards.path = minetest.get_modpath("statistic_awards")
statistic_awards.modname = minetest.get_current_modname()
local S = dofile(statistic_awards.path .. "/intllib.lua")
statistic_awards.intllib = S
-- import settingtypes.txt
basic_functions.import_settingtype(statistic_awards.path .. "/settingtypes.txt")

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

39
locale/de.po Normal file
View File

@ -0,0 +1,39 @@
# German Translation for statistic_awards mod.
# Copyright (C) 2019
# This file is distributed under the same license as the farming package.
# Xanthin.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.27\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-14 HO:MI+ZONE\n"
"PO-Revision-Date: 2019-02-14 HO:MI+ZONE\n"
"Last-Translator: ademant\n"
"Language-Team: \n"
"Language: German \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "You walked quite far. Keep going."
msgstr "Du bist schon weit gekommen. Weiter so."
msgid "You crafted quite much. Keep going."
msgstr "Du hast schon viel hergestellt. Weiter so."
msgid "You swam quite far. Keep going."
msgstr "Du bist schon weit geschwommen. Weiter so."
msgid "You're cat is jealous about you."
msgstr "Deine Katze wird eifersüchtig."
msgid "You like the danger."
msgstr "Du liebst wohl die Gefahr."
msgid "Expert in death"
msgstr "Experte im Geschäft mit dem Tod"
msgid "Life is boring?"
msgstr "Ist das Leben langweilig?"

View File

@ -1 +1 @@
statistic_awards.globaltime (Global time step for checking awards) float 1.5

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB