master
octacian 2017-06-08 07:04:09 -07:00
parent f952a301dc
commit 464581821d
2 changed files with 15 additions and 1 deletions

View File

@ -4,7 +4,7 @@ Invisibility Command [invis]
- Download: https://github.com/octacian/minetest-mod-invis/archive/master.zip
- Forum: https://forum.minetest.net/viewtopic.php?f=9&t=17389
This extremely simple mod introduces a single command that allows you to make yourself or another player invisible (both the player itself and the nametag).
This extremely simple mod introduces a single command that allows you to make yourself or another player invisible (both the player itself and the nametag). While you are in vanish mod, a simple text HUD will be shown above the hotbar with a notice that you are currently invisible to other players.
__Usage:__
- `/vanish`: Toggle invisibility for yourself

View File

@ -2,6 +2,7 @@
invis = {}
local invisible = {}
local huds = {}
-- [function] Get visible
function invis.get(name)
@ -32,6 +33,14 @@ function invis.toggle(player, toggle)
color = {a = 0, r = 255, g = 255, b = 255},
})
msg = "now invisible"
-- Add HUD
huds[name] = player:hud_add({
hud_elem_type = "text",
position = {x = 0.5, y = 0.85},
text = "You are invisible to other players",
number = 0x00BC00
})
else
-- Show player and nametag
prop = {
@ -42,6 +51,11 @@ function invis.toggle(player, toggle)
color = {a = 255, r = 255, g = 255, b = 255},
})
msg = "no longer invisible"
-- Remove HUD
if huds[name] then
player:hud_remove(huds[name])
end
end
-- Update properties