Update hidename mod to Git commit 7b3aa52...

https://github.com/AntumMT/mod-hidename/tree/7b3aa52
master
Jordan Irwin 2021-04-19 05:02:12 -07:00
parent 8a03f0abc9
commit f3ca2d168b
4 changed files with 44 additions and 23 deletions

View File

@ -20,6 +20,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* [whitelist][] ([CC0][lic.cc0]) -- version: [0.1 (b813b19 Git)][ver.whitelist] *2017-08-18*
* [awards][] ([MIT][lic.awards]) -- version: [3.4.0][ver.awards] *2021-01-10*
* [antum][] ([MIT][lic.antum]) -- version: [69b39a4 Git][ver.antum] *2017-08-30*
* [hidename][] ([MIT][lic.hidename]) -- version: [7b3aa52 Git][ver.hidename] *2021-04-19*
* [biofuel][] ([MIT](lic.biofuel)) -- version: [ca480ce Git][ver.biofuel] *2020-07-20*
* buildings/
* [bridges][] ([GPL][lic.gpl3.0]) -- version: [5b5f475 Git][ver.bridges] *2015-08-23* ([patched][patch.bridges])
@ -258,6 +259,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[hbarmor]: https://forum.minetest.net/viewtopic.php?t=11337
[hbsprint]: https://forum.minetest.net/viewtopic.php?t=18069
[helicopter]: https://forum.minetest.net/viewtopic.php?t=24613
[hidename]: https://forum.minetest.net/viewtopic.php?t=18190
[hill_nodebox]: https://cornernote.github.io/minetest-hill_nodebox/
[home_gui]: http://cornernote.github.io/minetest-home_gui/
[homedecor]: https://forum.minetest.net/viewtopic.php?t=2041
@ -357,6 +359,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[lic.farming_plus]: mods/farming/farming_plus/README.txt
[lic.fort_spikes]: mods/buildings/fort_spikes/LICENSE
[lic.home_gui]: mods/ui/home_gui/LICENSE
[lic.hidename]: mods/antum/hidename/LICENSE.txt
[lic.hill_nodebox]: mods/world/hill_nodebox/LICENSE
[lic.homedecor]: mods/modpacks/homedecor/LICENSE
[lic.hovercraft]: mods/transport/hovercraft/LICENSE.txt
@ -464,6 +467,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.hbarmor]: http://repo.or.cz/minetest_hbarmor.git/tree/93d994c
[ver.hbsprint]: https://github.com/tacotexmex/hbsprint/tree/f566d0f
[ver.helicopter]: https://github.com/APercy/helicopter/tree/1955cdd
[ver.hidename]: https://github.com/AntumMT/mod-hidename/tree/7b3aa52
[ver.hill_nodebox]: https://github.com/cornernote/minetest-hill_nodebox/tree/41bbfa2
[ver.home_gui]: https://github.com/cornernote/minetest-home_gui/tree/a291a09
[ver.homedecor]: https://gitlab.com/VanessaE/homedecor_modpack/tree/81e0d4e

View File

@ -0,0 +1,21 @@
MIT License
Copyright © 2017 Jordan Irwin (AntumDeluge)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,7 +1,7 @@
--[[ MIT LICENSE HEADER
Copyright © 2017 Jordan Irwin (AntumDeluge)
See: LICENSE.txt
--]]
@ -36,7 +36,7 @@ function hidename.hidden(nametag_data)
if hidename.use_alpha then
return nametag_data.color.a == 0
end
return nametag_data.text == '' or nametag_data.text == nil
end
@ -47,19 +47,19 @@ end
function hidename.tellStatus(name)
local player = core.get_player_by_name(name)
local nametag = player:get_nametag_attributes()
local status = 'Status: '
if hidename.hidden(nametag) then
status = status .. 'hidden'
else
status = status .. 'visible'
end
-- Use name parameter value if nametag.text is empty
if nametag.text == '' or nametag.text == nil then
nametag.text = name
end
core.chat_send_player(name, S('Nametag:') .. ' ' .. nametag.text)
core.chat_send_player(name, S(status))
end
@ -72,17 +72,17 @@ end
function hidename.hide(name)
local player = core.get_player_by_name(name)
local nametag = player:get_nametag_attributes()
if hidename.hidden(nametag) then
core.chat_send_player(name, S('Nametag is already hidden'))
return true
end
if hidename.use_alpha then
-- Preserve nametag alpha level
player:set_attribute('nametag_stored_alpha', nametag.color.a)
nametag.color.a = 0
-- Set nametag alpha level to 0
player:set_nametag_attributes({
color = nametag.color,
@ -93,7 +93,7 @@ function hidename.hide(name)
text = '',
})
end
if hidename.hidden(player:get_nametag_attributes()) then
core.chat_send_player(name, S('Nametag is now hidden'))
else
@ -101,8 +101,6 @@ function hidename.hide(name)
core.log('error', 'Could not set nametag to "hidden" for player ' .. name)
core.log('error', 'Please submit an error report to the "hidename" mod developer')
end
return hidden
end
@ -113,12 +111,12 @@ end
function hidename.show(name)
local player = core.get_player_by_name(name)
local nametag = player:get_nametag_attributes()
if not hidename.hidden(nametag) then
core.chat_send_player(name, S('Nametag is already visible'))
return true
end
if hidename.use_alpha then
-- Restore nametag alpha level
local stored_alpha = player:get_attribute('nametag_stored_alpha')
@ -127,7 +125,7 @@ function hidename.show(name)
-- Reset player attribute
player:set_attribute('nametag_stored_alpha', nil)
end
player:set_nametag_attributes({
color = nametag.color,
})
@ -137,7 +135,7 @@ function hidename.show(name)
text = name,
})
end
if not hidename.hidden(player:get_nametag_attributes()) then
core.chat_send_player(name, S('Nametag is now visible'))
else
@ -145,8 +143,6 @@ function hidename.show(name)
core.log('error', 'Could not set nametag to "visible" for player ' .. name)
core.log('error', 'Please submit an error report to the "hidename" mod developer')
end
return shown
end
@ -161,6 +157,6 @@ if not hidename.use_alpha then
})
end
end
core.register_on_joinplayer(setNametagText)
end

View File

@ -1,7 +1,7 @@
--[[ MIT LICENSE HEADER
Copyright © 2017 Jordan Irwin (AntumDeluge)
See: LICENSE.txt
]]
@ -12,8 +12,8 @@
--- Use alpha color level to hide nametag instead of clearing text.
--
--
-- @setting hidename.use_alpha
-- @settype bool
-- @default false
hidename.use_alpha = core.settings:get_bool('hidename.use_alpha') == true
hidename.use_alpha = core.settings:get_bool('hidename.use_alpha', false)