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
|
- repo: local
|
||||||
hooks:
|
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
|
- id: luacheck
|
||||||
name: luacheck
|
name: luacheck
|
||||||
language: system
|
language: system
|
||||||
@ -17,9 +31,4 @@ repos:
|
|||||||
pass_filenames: true
|
pass_filenames: true
|
||||||
types: [ file, lua ]
|
types: [ file, lua ]
|
||||||
args: [ -q ]
|
args: [ -q ]
|
||||||
- id: stylua
|
fail_fast: true
|
||||||
name: stylua
|
|
||||||
language: system
|
|
||||||
entry: stylua
|
|
||||||
pass_filenames: true
|
|
||||||
types: [ file, lua ]
|
|
||||||
|
10
monoid.lua
10
monoid.lua
@ -96,7 +96,7 @@ name_monoid.monoid_def = {
|
|||||||
apply = function(nametag_attributes, player)
|
apply = function(nametag_attributes, player)
|
||||||
if nametag_attributes.hide_all then
|
if nametag_attributes.hide_all then
|
||||||
player:set_nametag_attributes({
|
player:set_nametag_attributes({
|
||||||
text = "",
|
text = " ",
|
||||||
color = { a = 0, r = 0, g = 0, b = 0 },
|
color = { a = 0, r = 0, g = 0, b = 0 },
|
||||||
bgcolor = { a = 0, r = 0, g = 0, b = 0 },
|
bgcolor = { a = 0, r = 0, g = 0, b = 0 },
|
||||||
})
|
})
|
||||||
@ -143,12 +143,20 @@ name_monoid.monoid_def = {
|
|||||||
text = nametag_attributes.text
|
text = nametag_attributes.text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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({
|
player:set_nametag_attributes({
|
||||||
text = text,
|
text = text,
|
||||||
color = nametag_attributes.color,
|
color = nametag_attributes.color,
|
||||||
bgcolor = nametag_attributes.bgcolor or false,
|
bgcolor = nametag_attributes.bgcolor or false,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user