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* * [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* * [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* * [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* * [biofuel][] ([MIT](lic.biofuel)) -- version: [ca480ce Git][ver.biofuel] *2020-07-20*
* buildings/ * buildings/
* [bridges][] ([GPL][lic.gpl3.0]) -- version: [5b5f475 Git][ver.bridges] *2015-08-23* ([patched][patch.bridges]) * [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 [hbarmor]: https://forum.minetest.net/viewtopic.php?t=11337
[hbsprint]: https://forum.minetest.net/viewtopic.php?t=18069 [hbsprint]: https://forum.minetest.net/viewtopic.php?t=18069
[helicopter]: https://forum.minetest.net/viewtopic.php?t=24613 [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/ [hill_nodebox]: https://cornernote.github.io/minetest-hill_nodebox/
[home_gui]: http://cornernote.github.io/minetest-home_gui/ [home_gui]: http://cornernote.github.io/minetest-home_gui/
[homedecor]: https://forum.minetest.net/viewtopic.php?t=2041 [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.farming_plus]: mods/farming/farming_plus/README.txt
[lic.fort_spikes]: mods/buildings/fort_spikes/LICENSE [lic.fort_spikes]: mods/buildings/fort_spikes/LICENSE
[lic.home_gui]: mods/ui/home_gui/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.hill_nodebox]: mods/world/hill_nodebox/LICENSE
[lic.homedecor]: mods/modpacks/homedecor/LICENSE [lic.homedecor]: mods/modpacks/homedecor/LICENSE
[lic.hovercraft]: mods/transport/hovercraft/LICENSE.txt [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.hbarmor]: http://repo.or.cz/minetest_hbarmor.git/tree/93d994c
[ver.hbsprint]: https://github.com/tacotexmex/hbsprint/tree/f566d0f [ver.hbsprint]: https://github.com/tacotexmex/hbsprint/tree/f566d0f
[ver.helicopter]: https://github.com/APercy/helicopter/tree/1955cdd [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.hill_nodebox]: https://github.com/cornernote/minetest-hill_nodebox/tree/41bbfa2
[ver.home_gui]: https://github.com/cornernote/minetest-home_gui/tree/a291a09 [ver.home_gui]: https://github.com/cornernote/minetest-home_gui/tree/a291a09
[ver.homedecor]: https://gitlab.com/VanessaE/homedecor_modpack/tree/81e0d4e [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 --[[ MIT LICENSE HEADER
Copyright © 2017 Jordan Irwin (AntumDeluge) Copyright © 2017 Jordan Irwin (AntumDeluge)
See: LICENSE.txt See: LICENSE.txt
--]] --]]
@ -36,7 +36,7 @@ function hidename.hidden(nametag_data)
if hidename.use_alpha then if hidename.use_alpha then
return nametag_data.color.a == 0 return nametag_data.color.a == 0
end end
return nametag_data.text == '' or nametag_data.text == nil return nametag_data.text == '' or nametag_data.text == nil
end end
@ -47,19 +47,19 @@ end
function hidename.tellStatus(name) function hidename.tellStatus(name)
local player = core.get_player_by_name(name) local player = core.get_player_by_name(name)
local nametag = player:get_nametag_attributes() local nametag = player:get_nametag_attributes()
local status = 'Status: ' local status = 'Status: '
if hidename.hidden(nametag) then if hidename.hidden(nametag) then
status = status .. 'hidden' status = status .. 'hidden'
else else
status = status .. 'visible' status = status .. 'visible'
end end
-- Use name parameter value if nametag.text is empty -- Use name parameter value if nametag.text is empty
if nametag.text == '' or nametag.text == nil then if nametag.text == '' or nametag.text == nil then
nametag.text = name nametag.text = name
end end
core.chat_send_player(name, S('Nametag:') .. ' ' .. nametag.text) core.chat_send_player(name, S('Nametag:') .. ' ' .. nametag.text)
core.chat_send_player(name, S(status)) core.chat_send_player(name, S(status))
end end
@ -72,17 +72,17 @@ end
function hidename.hide(name) function hidename.hide(name)
local player = core.get_player_by_name(name) local player = core.get_player_by_name(name)
local nametag = player:get_nametag_attributes() local nametag = player:get_nametag_attributes()
if hidename.hidden(nametag) then if hidename.hidden(nametag) then
core.chat_send_player(name, S('Nametag is already hidden')) core.chat_send_player(name, S('Nametag is already hidden'))
return true return true
end end
if hidename.use_alpha then if hidename.use_alpha then
-- Preserve nametag alpha level -- Preserve nametag alpha level
player:set_attribute('nametag_stored_alpha', nametag.color.a) player:set_attribute('nametag_stored_alpha', nametag.color.a)
nametag.color.a = 0 nametag.color.a = 0
-- Set nametag alpha level to 0 -- Set nametag alpha level to 0
player:set_nametag_attributes({ player:set_nametag_attributes({
color = nametag.color, color = nametag.color,
@ -93,7 +93,7 @@ function hidename.hide(name)
text = '', text = '',
}) })
end end
if hidename.hidden(player:get_nametag_attributes()) then if hidename.hidden(player:get_nametag_attributes()) then
core.chat_send_player(name, S('Nametag is now hidden')) core.chat_send_player(name, S('Nametag is now hidden'))
else else
@ -101,8 +101,6 @@ function hidename.hide(name)
core.log('error', 'Could not set nametag to "hidden" for player ' .. 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') core.log('error', 'Please submit an error report to the "hidename" mod developer')
end end
return hidden
end end
@ -113,12 +111,12 @@ end
function hidename.show(name) function hidename.show(name)
local player = core.get_player_by_name(name) local player = core.get_player_by_name(name)
local nametag = player:get_nametag_attributes() local nametag = player:get_nametag_attributes()
if not hidename.hidden(nametag) then if not hidename.hidden(nametag) then
core.chat_send_player(name, S('Nametag is already visible')) core.chat_send_player(name, S('Nametag is already visible'))
return true return true
end end
if hidename.use_alpha then if hidename.use_alpha then
-- Restore nametag alpha level -- Restore nametag alpha level
local stored_alpha = player:get_attribute('nametag_stored_alpha') local stored_alpha = player:get_attribute('nametag_stored_alpha')
@ -127,7 +125,7 @@ function hidename.show(name)
-- Reset player attribute -- Reset player attribute
player:set_attribute('nametag_stored_alpha', nil) player:set_attribute('nametag_stored_alpha', nil)
end end
player:set_nametag_attributes({ player:set_nametag_attributes({
color = nametag.color, color = nametag.color,
}) })
@ -137,7 +135,7 @@ function hidename.show(name)
text = name, text = name,
}) })
end end
if not hidename.hidden(player:get_nametag_attributes()) then if not hidename.hidden(player:get_nametag_attributes()) then
core.chat_send_player(name, S('Nametag is now visible')) core.chat_send_player(name, S('Nametag is now visible'))
else else
@ -145,8 +143,6 @@ function hidename.show(name)
core.log('error', 'Could not set nametag to "visible" for player ' .. 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') core.log('error', 'Please submit an error report to the "hidename" mod developer')
end end
return shown
end end
@ -161,6 +157,6 @@ if not hidename.use_alpha then
}) })
end end
end end
core.register_on_joinplayer(setNametagText) core.register_on_joinplayer(setNametagText)
end end

View File

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