hide name via alpha channel when empty; setting it to the empty string reverts it to the "default" value, the player's name.
This commit is contained in:
parent
6e1ab86ffc
commit
3ce1d2828b
@ -10,6 +10,20 @@ repos:
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: detect_debug
|
||||
name: detect debug
|
||||
language: pygrep
|
||||
entry: DEBUG
|
||||
pass_filenames: true
|
||||
exclude: .pre-commit-config.yaml
|
||||
fail_fast: true
|
||||
- id: stylua
|
||||
name: stylua
|
||||
language: system
|
||||
entry: stylua
|
||||
pass_filenames: true
|
||||
types: [ file, lua ]
|
||||
fail_fast: true
|
||||
- id: luacheck
|
||||
name: luacheck
|
||||
language: system
|
||||
@ -17,9 +31,4 @@ repos:
|
||||
pass_filenames: true
|
||||
types: [ file, lua ]
|
||||
args: [ -q ]
|
||||
- id: stylua
|
||||
name: stylua
|
||||
language: system
|
||||
entry: stylua
|
||||
pass_filenames: true
|
||||
types: [ file, lua ]
|
||||
fail_fast: true
|
||||
|
20
monoid.lua
20
monoid.lua
@ -96,7 +96,7 @@ name_monoid.monoid_def = {
|
||||
apply = function(nametag_attributes, player)
|
||||
if nametag_attributes.hide_all then
|
||||
player:set_nametag_attributes({
|
||||
text = "",
|
||||
text = " ",
|
||||
color = { a = 0, r = 0, g = 0, b = 0 },
|
||||
bgcolor = { a = 0, r = 0, g = 0, b = 0 },
|
||||
})
|
||||
@ -143,11 +143,19 @@ name_monoid.monoid_def = {
|
||||
text = nametag_attributes.text
|
||||
end
|
||||
|
||||
player:set_nametag_attributes({
|
||||
text = text,
|
||||
color = nametag_attributes.color,
|
||||
bgcolor = nametag_attributes.bgcolor or false,
|
||||
})
|
||||
if text == "" then
|
||||
player:set_nametag_attributes({
|
||||
text = " ",
|
||||
color = { a = 0, r = 0, g = 0, b = 0 },
|
||||
bgcolor = { a = 0, r = 0, g = 0, b = 0 },
|
||||
})
|
||||
else
|
||||
player:set_nametag_attributes({
|
||||
text = text,
|
||||
color = nametag_attributes.color,
|
||||
bgcolor = nametag_attributes.bgcolor or false,
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user