mirror of
https://github.com/MinetestForFun/quests.git
synced 2025-01-10 10:10:22 +01:00
Add functions to set HUD offset and position
This commit is contained in:
parent
1fec0e3e2e
commit
e8305e38e9
18
hud.lua
18
hud.lua
@ -16,6 +16,24 @@ local hud_config = { position = {x = 1, y = 0.2},
|
||||
offset = { x = -200, y = 0},
|
||||
number = quests.colors.new }
|
||||
|
||||
--- Set the HUD position (not offset).
|
||||
-- Supplied positions may be `nil` and will be skipped.
|
||||
-- @note Calling this function while quests are already displayed will result
|
||||
-- in undefined behaviour. Call it beforehand.
|
||||
function quests.set_hud_position(x, y)
|
||||
hud_config.position.x = x or hud_config.position.x
|
||||
hud_config.position.y = y or hud_config.position.y
|
||||
end
|
||||
|
||||
--- Set the HUD offset (not position).
|
||||
-- Supplied positions may be `nil` and will be skipped.
|
||||
-- @note Calling this function while quests are already displayed will result
|
||||
-- in undefined behaviour. Call it beforehand.
|
||||
function quests.set_hud_position(x, y)
|
||||
hud_config.offset.x = x or hud_config.offset.x
|
||||
hud_config.offset.y = y or hud_config.offset.y
|
||||
end
|
||||
|
||||
--- Show quests HUD to player.
|
||||
-- The HUD can only show up to `show_max` quests
|
||||
-- @param playername Player whose quests HUD must be shown
|
||||
|
Loading…
Reference in New Issue
Block a user