forked from MTSR/invisible
Compare commits
2 Commits
796a5291ba
...
99e5bf15b7
Author | SHA1 | Date | |
---|---|---|---|
99e5bf15b7 | |||
5305b57309 |
12
README.md
12
README.md
@ -2,8 +2,18 @@ Licenses: code: LGPL-2.1, media: CC BY-SA-4.0
|
||||
|
||||
Version: 4
|
||||
|
||||
Hides players nametag when they are sneaking, or invisible if you have the invisible privilege.
|
||||
Hides players nametag and become invisible using the invisible privilege and the invisibility tool (invisible:tool).
|
||||
|
||||
Give yourself the invisible stick, to toggle your invisible on/off
|
||||
|
||||
```
|
||||
/giveme i
|
||||
```
|
||||
|
||||
Скрывает имена игроков и делает их невидимыми, если у вас есть привилегия невидимки и инструмент невидимости (invisible:tool).
|
||||
|
||||
Получить инструмент невидимости, чтобы включать/выключать невидимость:
|
||||
|
||||
```
|
||||
/giveme i
|
||||
```
|
||||
|
7
init.lua
7
init.lua
@ -8,13 +8,12 @@ minetest.register_privilege("invisible", {
|
||||
give_to_singleplayer = false,
|
||||
})
|
||||
|
||||
invisible.toggle=function(user,sneak)
|
||||
invisible.toggle=function(user)
|
||||
local name=user:get_player_name()
|
||||
if minetest.check_player_privs(user:get_player_name(), {invisible=true}) then
|
||||
if not invisible[name] then
|
||||
user:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}})
|
||||
invisible[name]={}
|
||||
invisible[name].tool=sneak
|
||||
invisible[name].visual_size=user:get_properties().visual_size
|
||||
invisible[name].textures=user:get_properties().textures
|
||||
user:set_properties({
|
||||
@ -73,9 +72,5 @@ minetest.register_globalstep(function(dtime)
|
||||
invisible.time=0
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local name=player:get_player_name()
|
||||
local sneak=player:get_player_control().sneak
|
||||
if (sneak and not invisible[name]) or (sneak==false and invisible[name] and not invisible[name].tool) then
|
||||
invisible.toggle(player)
|
||||
end
|
||||
end
|
||||
end)
|
Loading…
Reference in New Issue
Block a user