--File Manipulating
specialties.writeXP = function(name)
local file = io.open(minetest.get_worldpath().."/"..name.."_XP", "w")
for skill,num in pairs(specialties.players[name].skills) do
file:write(skill.." "..tostring(num).."\n")
end
file:close()
end
specialties.readXP = function(name, specialty)
local file = io.open(minetest.get_worldpath().."/"..name.."_XP", "r")
if file == nil then
specialties.writeXP(name)
local empty = {}
for skill,_ in pairs(specialties.skills) do
empty[skill] = 0
end
return empty
end
local xp = {}
local line = file:read("*l")
while line ~= nil do
local params = line:split(" ")
xp[params[1]] = tonumber(params[2])
line = file:read("*l")
end
file:close()
return xp
end
--Table Modification
specialties.changeXP = function(name, specialty, amount)
local current = specialties.players[name].skills[specialty]
if current == nil then current = 0 end
local newAmount = current+amount
if newAmount >= 0 then
specialties.players[name].skills[specialty] = newAmount
local player = minetest.get_player_by_name(name)
local id = specialties.players[name].hud[specialty]
player:hud_change(id, "text", newAmount)
return true
else
return false
end
end20:21:43: ACTION[ServerThread]: Inocudom places node default:cobble at (-42,8,-8)
20:21:43: ERROR[main]: ServerError: caught (...)
20:21:43: ERROR[main]: stack traceback:
20:21:43: ERROR[main]: [C]: in function 'get_meta'
20:21:43: ERROR[main]: /home/derek/.minetest/mods/specialties/init.lua:281: in function </home/derek/.minetest/mods/specialties/init.lua:274>Don wrote:Its a great mod. I hope someone continues it
Shammmmmm wrote:What is your texture pack?
Napiophelios wrote:Shammmmmm wrote:What is your texture pack?
Its one of the Dokucraft packs I think.
Users browsing this forum: No registered users and 32 guests