Compare commits
5 Commits
b69e6dc857
...
3090d2e9ee
Author | SHA1 | Date |
---|---|---|
ademant | 3090d2e9ee | |
ademant | 1e04f0e4c2 | |
ademant | 861d2810be | |
ademant | 72cbbbadf9 | |
A. Demant | 85baaf5d07 |
|
@ -1,5 +1,5 @@
|
|||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
||||
# Minetest Game mod: XPFW
|
||||
# Minetest Game mod: XPFW (eXPerience FrameWork)
|
||||
|
||||
See license.txt for license information.
|
||||
|
||||
|
@ -13,6 +13,10 @@ https://gitlab.com/ademant/minetest_xpfw.git
|
|||
|
||||
https://github.com/ademant/minetest_xpfw.git
|
||||
|
||||
Works only with Minetest >= 5.0
|
||||
|
||||
Minetest <= 0.4.17 does not support the mechanism for handling player related meta data.
|
||||
|
||||
## Short description
|
||||
XPFW provide an API for storing values relevant for experience mechanism into player metadata (Identified with prefix "XPFW_"). It also stores several statistic values during playtime:
|
||||
- Walked distances calculated out of velocity (important: teleporting does not influence this value)
|
||||
|
|
4
api.lua
4
api.lua
|
@ -60,6 +60,7 @@ xpfw.player_add_attribute=function(player,attrib,val)
|
|||
-- if <val> = nil then set to max value
|
||||
local nval=val
|
||||
local att_def=xpfw.attributes[attrib]
|
||||
if att_def == nil then return end
|
||||
if val==nil then
|
||||
nval=att_def.max or 20
|
||||
end
|
||||
|
@ -77,7 +78,8 @@ xpfw.player_sub_attribute=function(player,attrib,val)
|
|||
-- if <val> = nil then set to max value
|
||||
local nval=val
|
||||
local playername=player:get_player_name()
|
||||
local att_def=M.player[playername].attributes[attrib]
|
||||
local att_def=xpfw.attributes[attrib]
|
||||
if att_def == nil then return end
|
||||
if val==nil then
|
||||
nval=att_def.max or 20
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue