Can't assign attributes to offline players like this.

Assign them only when online instead. This needs a rewrite.
This commit is contained in:
Auke Kok 2019-12-14 21:07:50 -08:00
parent 22a4490ffc
commit a82776cd81

View File

@ -434,7 +434,11 @@ local function grant_perks(box_id, boxes)
end
end
if accepted >= 3 then
local limit = tonumber(builder:get_attribute("box_create_limit") or "3")
local player = minetest.get_player_by_name(builder)
if not player then
return
end
local limit = tonumber(player:get_attribute("box_create_limit") or "3")
if limit <= 3 then
minetest.log("perks: granted more boxes to " .. builder)
announce.all(builder .. " has been granted the more boxes perk!")
@ -452,7 +456,7 @@ local function grant_perks(box_id, boxes)
"--sofar"
}
})
builder:set_attribute("box_create_limit", "5")
player:set_attribute("box_create_limit", "5")
end
end
if accepted >= 5 then