forked from mtcontrib/awards
Fix prize giving bug
This commit is contained in:
parent
96746aaf1e
commit
1fe166e2c5
12
api.lua
12
api.lua
@ -181,16 +181,14 @@ function awards.unlock(name, award)
|
|||||||
if awdef and awdef.prizes then
|
if awdef and awdef.prizes then
|
||||||
for i = 1, #awdef.prizes do
|
for i = 1, #awdef.prizes do
|
||||||
local itemstack = ItemStack(awdef.prizes[i])
|
local itemstack = ItemStack(awdef.prizes[i])
|
||||||
if itemstack:is_empty() or not itemstack:is_known() then
|
if not itemstack:is_empty() then
|
||||||
return
|
local receiverref = minetest.get_player_by_name(name)
|
||||||
end
|
if receiverref then
|
||||||
local receiverref = core.get_player_by_name(name)
|
|
||||||
if not receiverref then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
receiverref:get_inventory():add_item("main", itemstack)
|
receiverref:get_inventory():add_item("main", itemstack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Run callbacks
|
-- Run callbacks
|
||||||
if awdef.on_unlock and awdef.on_unlock(name, awdef) then
|
if awdef.on_unlock and awdef.on_unlock(name, awdef) then
|
||||||
|
Loading…
Reference in New Issue
Block a user