From 37082d11862899602f04229aae3f3a634a57ae7e Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 10 Jan 2021 17:55:42 +0000 Subject: [PATCH] Rename background to hud_background --- README.md | 7 ++++--- src/api_awards.lua | 2 +- src/awards.lua | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 79c6d13..2903221 100644 --- a/README.md +++ b/README.md @@ -185,15 +185,16 @@ end * `secret` - boolean if this award is secret (i.e. showed on awards list) * `sound` - `SimpleSoundSpec` table to play on unlock. `false` to disable unlock sound. - * `icon` - the icon image, use default otherwise. - * `background` - the background image, use default otherwise. + * `icon` - the icon image. Defaults to `awards_unknown.png`. + * `hud_background` - the background image used in the HUD to contain the text and icon. + Defaults to `awards_bg_default.png`. * `trigger` - trigger definition, see [Builtin Trigger Types](#builtin-trigger-types). * `on_unlock(name, def)` - callback on unlock. * `awards.registered_awards` - table of award name to definition. * `awards.register_on_unlock(func(name, def))` * `name` is the player name * `def` is the award def. - * return true to cancel HUD + * return true to cancel HUD from appearing. * `awards.unlock(player_name, award_name)` * gives an award to a player * `awards.get_award_states(player_name)` diff --git a/src/api_awards.lua b/src/api_awards.lua index 88f429a..d68ebce 100644 --- a/src/api_awards.lua +++ b/src/api_awards.lua @@ -95,7 +95,7 @@ function awards.unlock(name, award) -- Get Notification Settings local title = awdef.title or award local desc = awdef.description or "" - local background = awdef.background or "awards_bg_default.png" + local background = awdef.hud_background or awdef.background or "awards_bg_default.png" local icon = (awdef.icon or "awards_unknown.png") .. "^[resize:32x32" local sound = awdef.sound if sound == nil then diff --git a/src/awards.lua b/src/awards.lua index 2e88de3..e9d487f 100644 --- a/src/awards.lua +++ b/src/awards.lua @@ -251,7 +251,7 @@ if minetest.get_modpath("default") then title = S("Lava and Water"), description = S("Mine your first obsidian."), icon = "awards_lava_and_water.png^awards_level1.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 1.5, trigger = { type = "dig", @@ -265,7 +265,7 @@ if minetest.get_modpath("default") then title = S("Obsessed with Obsidian"), description = S("Mine 50 obsidian."), icon = "awards_obsessed_with_obsidian.png^awards_level2.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 1.5, trigger = { type = "dig", @@ -279,7 +279,7 @@ if minetest.get_modpath("default") then title = S("Lava Miner"), description = S("Mine any block while being very close to lava."), icon = "awards_lava_miner.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 1, }) awards.register_on_dig(function(player,data) @@ -386,7 +386,7 @@ if minetest.get_modpath("default") then title = S("First Mese Find"), description = S("Mine your first mese ore."), icon = "awards_first_mese_find.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 1, trigger = { type = "dig", @@ -401,7 +401,7 @@ if minetest.get_modpath("default") then title = S("Mese Mastery"), description = S("Mine a mese block."), icon = "awards_mese_mastery.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 1.1, trigger = { type = "dig", @@ -415,7 +415,7 @@ if minetest.get_modpath("default") then title = S("You’re a copper"), description = S("Dig 1,000 copper ores."), icon = "awards_youre_a_copper.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 0.2, trigger = { type = "dig", @@ -429,7 +429,7 @@ if minetest.get_modpath("default") then title = S("Mini Miner"), description = S("Dig 100 stone blocks."), icon = "awards_mini_miner.png^awards_level1.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 0.02, trigger = { type = "dig", @@ -443,7 +443,7 @@ if minetest.get_modpath("default") then title = S("Hardened Miner"), description = S("Dig 1,000 stone blocks."), icon = "awards_hardened_miner.png^awards_level2.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 0.02, trigger = { type = "dig", @@ -457,7 +457,7 @@ if minetest.get_modpath("default") then title = S("Master Miner"), description = S("Dig 10,000 stone blocks."), icon = "awards_master_miner.png^awards_level3.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 0.02, trigger = { type = "dig", @@ -471,7 +471,7 @@ if minetest.get_modpath("default") then title = S("Marchand De Sable"), description = S("Dig 1,000 sand."), icon = "awards_marchand_de_sable.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 0.05, trigger = { type = "dig", @@ -581,7 +581,7 @@ if minetest.get_modpath("default") then title = S("First Gold Find"), description = S("Mine your first gold ore."), icon = "awards_first_gold_find.png^awards_level1.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 0.9, trigger = { type = "dig", @@ -594,7 +594,7 @@ if minetest.get_modpath("default") then title = S("Gold Rush"), description = S("Mine 45 gold ores."), icon = "awards_gold_rush.png^awards_level2.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 0.9, trigger = { type = "dig", @@ -619,7 +619,7 @@ if minetest.get_modpath("default") then title = S("Girl's Best Friend"), description = S("Mine 18 diamond ores."), icon = "awards_girls_best_friend.png^awards_level2.png", - background = "awards_bg_mining.png", + hud_background = "awards_bg_mining.png", difficulty = 1, trigger = { type = "dig",