Merge branch 'nil_check_hudbar_state' of fluxionary for hudbar state checks
* another fix for https://codeberg.org/Wuzzy/minetest_hudbars/issues/4 based on separate callbacks, when we have several mods that rely on * this solves and close https://codeberg.org/Wuzzy/minetest_hudbars/issues/4 but will need https://codeberg.org/Wuzzy/minetest_hudbars/pulls/7 also. * this must be use in join with commit 20843d95cec0fb18516bc3c3ee456254a381ad5b of this repository that is a backport of my own fork at @mckaygerhard
This commit is contained in:
commit
3e73d3fa50
2
API.md
2
API.md
@ -187,7 +187,7 @@ Makes a previously hidden HUD bar visible again to a player.
|
||||
It is also possible to read information about existing HUD bars.
|
||||
|
||||
### `hb.get_hudbar_state(player, identifier)`
|
||||
Returns the current state of the active player's HUD bar.
|
||||
Returns the current state of the active player's HUD bar. Will return `nil` if the hudbar is not initialized.
|
||||
|
||||
#### Parameters
|
||||
* `player`: `ObjectRef` of the player to which the HUD bar belongs to
|
||||
|
1
init.lua
1
init.lua
@ -485,6 +485,7 @@ end
|
||||
function hb.get_hudbar_state(player, identifier)
|
||||
if not player_exists(player) then return nil end
|
||||
local ref = hb.get_hudtable(identifier).hudstate[player:get_player_name()]
|
||||
if not ref then return nil end
|
||||
-- Do not forget to update this chunk of code in case the state changes
|
||||
local copy = {
|
||||
hidden = ref.hidden,
|
||||
|
Loading…
x
Reference in New Issue
Block a user