Add name hide and show commands

This commit is contained in:
ezhh 2017-01-14 00:17:22 +00:00
commit 5fe7d6e9b9
5 changed files with 64 additions and 0 deletions

15
README.md Normal file
View File

@ -0,0 +1,15 @@
name_hider
=========
Minetest mod by Shara RedCat which adds two commands:
1. '/hidenames' hides the nametags of all currently connected players.
2. '/shownames' shows the name tags of all currently connected players.
Licenses and Attribution
-----------------------
Code for this mod is released under MIT (https://opensource.org/licenses/MIT).

0
depends.txt Normal file
View File

21
init.lua Normal file
View File

@ -0,0 +1,21 @@
minetest.register_chatcommand("hidenames", {
description = "Make all nametags invisible",
privs = {server = true},
func = function(name, param)
for _, player in pairs(minetest.get_connected_players()) do
player:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}})
end
end
})
minetest.register_chatcommand("shownames", {
description = "Make all nametags visible",
privs = {server = true},
func = function(name, param)
for _, player in pairs(minetest.get_connected_players()) do
player:set_nametag_attributes({color = {a = 255, r = 255, g = 255, b = 255}})
end
end
})

27
license.txt Normal file
View File

@ -0,0 +1,27 @@
License: MIT (https://opensource.org/licenses/MIT)
By Shara RedCat
---
The MIT License (MIT)
Copyright (c) 2016 Shara RedCat
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.

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = name_hider