forked from MTSR/invisible
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
99e5bf15b7 | |||
5305b57309 | |||
|
796a5291ba |
12
README.md
12
README.md
@ -2,8 +2,18 @@ Licenses: code: LGPL-2.1, media: CC BY-SA-4.0
|
|||||||
|
|
||||||
Version: 4
|
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
|
Give yourself the invisible stick, to toggle your invisible on/off
|
||||||
|
|
||||||
|
```
|
||||||
/giveme i
|
/giveme i
|
||||||
|
```
|
||||||
|
|
||||||
|
Скрывает имена игроков и делает их невидимыми, если у вас есть привилегия невидимки и инструмент невидимости (invisible:tool).
|
||||||
|
|
||||||
|
Получить инструмент невидимости, чтобы включать/выключать невидимость:
|
||||||
|
|
||||||
|
```
|
||||||
|
/giveme i
|
||||||
|
```
|
||||||
|
17
init.lua
17
init.lua
@ -1,18 +1,19 @@
|
|||||||
|
local S = minetest.get_translator("invisible")
|
||||||
|
|
||||||
minetest.register_alias("i", "invisible:tool")
|
minetest.register_alias("i", "invisible:tool")
|
||||||
|
|
||||||
invisible = { time = 0, armor = minetest.get_modpath("3d_armor")}
|
invisible = { time = 0, armor = minetest.get_modpath("3d_armor")}
|
||||||
minetest.register_privilege("invisible", {
|
minetest.register_privilege("invisible", {
|
||||||
description = "Allows the player to become invisible.",
|
description = S("Allows the player to become invisible."),
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
invisible.toggle=function(user,sneak)
|
invisible.toggle=function(user)
|
||||||
local name=user:get_player_name()
|
local name=user:get_player_name()
|
||||||
if minetest.check_player_privs(user:get_player_name(), {invisible=true}) then
|
if minetest.check_player_privs(user:get_player_name(), {invisible=true}) then
|
||||||
if not invisible[name] then
|
if not invisible[name] then
|
||||||
user:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}})
|
user:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}})
|
||||||
invisible[name]={}
|
invisible[name]={}
|
||||||
invisible[name].tool=sneak
|
|
||||||
invisible[name].visual_size=user:get_properties().visual_size
|
invisible[name].visual_size=user:get_properties().visual_size
|
||||||
invisible[name].textures=user:get_properties().textures
|
invisible[name].textures=user:get_properties().textures
|
||||||
user:set_properties({
|
user:set_properties({
|
||||||
@ -21,7 +22,7 @@ invisible.toggle=function(user,sneak)
|
|||||||
visual_size = {x=0, y=0},
|
visual_size = {x=0, y=0},
|
||||||
pointable=false,
|
pointable=false,
|
||||||
})
|
})
|
||||||
minetest.chat_send_player(name, "invisible on")
|
minetest.chat_send_player(name, S("invisible on"))
|
||||||
else
|
else
|
||||||
user:set_nametag_attributes({color = {a = 255, r = 255, g = 255, b = 255}})
|
user:set_nametag_attributes({color = {a = 255, r = 255, g = 255, b = 255}})
|
||||||
user:set_properties({
|
user:set_properties({
|
||||||
@ -37,7 +38,7 @@ invisible.toggle=function(user,sneak)
|
|||||||
armor:update_inventory(user)
|
armor:update_inventory(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(name, "invisible off")
|
minetest.chat_send_player(name, S("invisible off"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ invisible.toggle=function(user,sneak)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_tool("invisible:tool", {
|
minetest.register_tool("invisible:tool", {
|
||||||
description = "invisible",
|
description = S("invisible"),
|
||||||
inventory_image = "default_stick.png",
|
inventory_image = "default_stick.png",
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
@ -71,9 +72,5 @@ minetest.register_globalstep(function(dtime)
|
|||||||
invisible.time=0
|
invisible.time=0
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local name=player:get_player_name()
|
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
|
||||||
end)
|
end)
|
6
locale/invisible.ru.tr
Normal file
6
locale/invisible.ru.tr
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# textdomain: invisible
|
||||||
|
|
||||||
|
Allows the player to become invisible.=Позволяет игроку стать невидимкой.
|
||||||
|
invisible on=режим невидимки включен
|
||||||
|
invisible off=режим невидимки выключен
|
||||||
|
invisible=невидимка
|
Loading…
Reference in New Issue
Block a user