initial commit

master
A. Demant 2019-01-09 16:23:44 +01:00
commit 4d94752ae3
8 changed files with 111 additions and 0 deletions

25
README.txt Normal file
View File

@ -0,0 +1,25 @@
Minetest Game mod: XPFW
==========================
See license.txt for license information.
XPFW provide an API for storing values relevant for experience mechanism into player metadata. It also stores several statistic values during playtime:
- Walked distances calculated out of velocity (important: teleporting does not influence this value)
- accumulated distance out of comparing with last known position (important: teleporting is included in this value)
- whole playtime on the server
- amount of dug nodes
- amount of build nodes
- amount of crafted items
- amount of occured deahts
- amount of text messages
- amount of logins
For several amounts also a kind of speed is calculated, like walking speed or crafting speed.
Authors of source code
----------------------
ademant (MIT)
Authors of media (textures)
---------------------------
Created by ademant (CC BY 3.0):

16
chat_commands.lua Normal file
View File

@ -0,0 +1,16 @@
minetest.register_chatcommand("cd", {
params = "<name>",
description = "Start a countdown",
func = function(name, param)
-- print(name,param)
local countdown=timer.countdown_default
local xp= string.split(param, " ")
if #xp == 1 then
countdown=tonumber(xp[1])
elseif #xp >1 then
countdown=tonumber(xp[2])
end
timer.player[name]=countdown
end
})

8
config.lua Normal file
View File

@ -0,0 +1,8 @@
timer.precision=tonumber(minetest.settings:get("timer.precision")) or 1
timer.countdown_default=tonumber(minetest.settings:get("timer.countdown_default")) or 120
timer.prefix="timer:countdown"
timer.player={}
timer.dtime=0
--xpfw.register_attribute(timer.prefix,{min=0,max=math.huge,default=timer.countdown_default,hud=1})

16
init.lua Normal file
View File

@ -0,0 +1,16 @@
timer = {}
timer.path = minetest.get_modpath("timer")
timer.modname=minetest.get_current_modname()
timer.mod_storage=minetest.get_mod_storage()
minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- start loading from "..minetest.get_modpath(minetest.get_current_modname()))
-- Load files
-- import settingtypes.txt
basic_functions.import_settingtype(timer.path .. "/settingtypes.txt")
dofile(timer.path .. "/config.lua") -- API
dofile(timer.path .. "/chat_commands.lua")
minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- loaded ")

15
license.txt Normal file
View File

@ -0,0 +1,15 @@
License of source code
----------------------
The MIT License (MIT)
Copyright 2019 ademant
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/mit-license.php

7
mod.conf Normal file
View File

@ -0,0 +1,7 @@
name = timer
title = timer
author = ademant
description = Use Countdown timer
depends = default,basic_functions,xpfw
license = MIT
version = 1.0.0

22
register.lua Normal file
View File

@ -0,0 +1,22 @@
local M=timer
minetest.register_on_joinplayer(function(player)
xpfw.player_set_attribute(player,timer.prefix,0)
end
)
minetest.register_on_leaveplayer(function(player)
if player ~= nil then
-- xpfw.player_set_attribute(player,timer.prefix,0)
end
end)
minetest.register_globalstep(function(dtime)
timer.dtime=timer.dtime+dtime
if timer.dtime>timer.precision then
timer.dtime=0
end
-- print("xpfw_abm: "..1000*(os.clock()-starttime))
end)

2
settingtypes.txt Normal file
View File

@ -0,0 +1,2 @@
timer.precision (precision of the timer in real time seconds) float 1
timer.countdown_default (default value of countdown in seconds) float 120