Merge pull request #3 from Athemis/master
[MineClone.git] / mods / command / vanish.lua
blob0db60933ff1bf128597d06a041bd5cafdab20ebd
1 vanished_players = {}
3 minetest.register_privilege("vanish", "Allow to use /vanish command")
5 minetest.register_chatcommand("vanish", {
6 params = "",
7 description = "Make user invisible at eye of all",
8 privs = {vanish = true},
9 func = function(name, param)
10 local prop
11 vanished_players[name] = not vanished_players[name]
13 if vanished_players[name] then
14 prop = {visual_size = {x=0, y=0}, collisionbox = {0,0,0,0,0,0}}
15 else
16 -- default player size
17 prop = {visual_size = {x=1, y=1},
18 collisionbox = {-0.35, -1, -0.35, 0.35, 1, 0.35}}
19 end
21 minetest.get_player_by_name(name):set_properties(prop)
22 end