1
0
mirror of https://gitlab.com/rubenwardy/awards.git synced 2025-07-05 17:40:27 +02:00

Fix rebase and remove things already fixed earlier.

This commit is contained in:
Beha
2020-04-05 11:33:50 -04:00
parent 0ef385c514
commit 0790e8feeb
3 changed files with 5 additions and 11 deletions

View File

@ -43,7 +43,8 @@ end
-- name - the name of the player -- name - the name of the player
-- award - the name of the award to give -- award - the name of the award to give
function awards.unlock(name, award) function awards.unlock(name, award)
if not minetest.get_player_by_name(name) or not minetest.get_player_by_name(name):is_player() then -- Ensure the player is online.
if not minetest.get_player_by_name(name) then
return return
end end
@ -95,7 +96,7 @@ function awards.unlock(name, award)
local title = awdef.title or award local title = awdef.title or award
local desc = awdef.description or "" local desc = awdef.description or ""
local background = awdef.background or "awards_bg_default.png" local background = awdef.background or "awards_bg_default.png"
local icon = awdef.icon.."^[resize:16x16" or "awards_unknown.png" local icon = (awdef.icon or "awards_unknown.png") .. "^[resize:32x32"
local sound = awdef.sound local sound = awdef.sound
if sound == nil then if sound == nil then
-- Explicit check for nil because sound could be `false` to disable it -- Explicit check for nil because sound could be `false` to disable it

View File

@ -62,9 +62,6 @@ function awards.register_trigger(tname, tdef)
end end
function tdef.notify(player) function tdef.notify(player)
if not player:is_player() or not minetest.get_player_by_name(player:get_player_name()) then
return
end
assert(player and player.is_player and player:is_player()) assert(player and player.is_player and player:is_player())
local name = player:get_player_name() local name = player:get_player_name()
local data = awards.player(name) local data = awards.player(name)
@ -155,10 +152,6 @@ function awards.register_trigger(tname, tdef)
end end
end end
if not player:is_player() or not minetest.get_player_by_name(player:get_player_name()) then
return
end
assert(player and player.is_player and player:is_player() and key) assert(player and player.is_player and player:is_player() and key)
local name = player:get_player_name() local name = player:get_player_name()
local data = awards.player(name) local data = awards.player(name)

View File

@ -120,7 +120,7 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
local itemname = itemstack:get_name() local itemname = itemstack:get_name()
itemname = minetest.registered_aliases[itemname] or itemname itemname = minetest.registered_aliases[itemname] or itemname
awards.notify_eat(player, itemname) awards.notify_craft(player, itemname, itemstack:get_count())
end) end)
@ -141,5 +141,5 @@ minetest.register_on_item_eat(function(_, _, itemstack, player, _)
local itemname = itemstack:get_name() local itemname = itemstack:get_name()
itemname = minetest.registered_aliases[itemname] or itemname itemname = minetest.registered_aliases[itemname] or itemname
awards.notify_eat(player, itemname, itemstack:get_count()) awards.notify_eat(player, itemname)
end) end)