Handle missing skills.
Log new player or missing skills.
This commit is contained in:
parent
8bc6d9ff0a
commit
6a14bccd27
@ -45,15 +45,17 @@ function skills.set_default_skills ( name )
|
||||
end
|
||||
|
||||
function skills.get_skill(name, skill_id)
|
||||
-- Return skill.
|
||||
-- Existing skill
|
||||
local playerSkills = skills.player_skills[name]
|
||||
if playerSkills ~= nil then
|
||||
return playerSkills[skill_id]
|
||||
local skill = playerSkills and playerSkills[skill_id]
|
||||
if skill ~= nil then
|
||||
return skill
|
||||
end
|
||||
|
||||
-- Return skill for new players.
|
||||
-- Missing player or skill
|
||||
minetest.log("info", "Requesting skill (id="..tostring(skill_id)..") for player '"..name.."'. Player is new or missing the skill.")
|
||||
skills.set_default_skills(name)
|
||||
return skills.get_skill(name, skill_id)
|
||||
return skills.player_skills[name][skill_id]
|
||||
end
|
||||
|
||||
function skills.get_player_level(name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user