forked from MTSR/mapserver
player hide feature
This commit is contained in:
parent
1ba10ec549
commit
8f0e38e00a
@ -42,3 +42,12 @@ secure.http_mods = mapserver
|
|||||||
mapserver.url = http://127.0.0.1:8080
|
mapserver.url = http://127.0.0.1:8080
|
||||||
mapserver.key = ZJoSpysiKGlYexof
|
mapserver.key = ZJoSpysiKGlYexof
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Hiding players from the map
|
||||||
|
|
||||||
|
If (for any reason) you want to hide players on the map, you can `/grant` them the following priv:
|
||||||
|
```
|
||||||
|
mapserver_hide_player
|
||||||
|
```
|
||||||
|
|
||||||
|
The player-position and data will not be sent to the mapserver
|
||||||
|
@ -78,6 +78,9 @@ function send_stats()
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
|
||||||
|
local is_hidden = minetest.check_player_privs(player:get_player_name(), {mapserver_hide_player = true}) then
|
||||||
|
|
||||||
local info = {
|
local info = {
|
||||||
name = player:get_player_name(),
|
name = player:get_player_name(),
|
||||||
pos = player:get_pos(),
|
pos = player:get_pos(),
|
||||||
@ -86,7 +89,9 @@ function send_stats()
|
|||||||
velocity = player:get_player_velocity()
|
velocity = player:get_player_velocity()
|
||||||
}
|
}
|
||||||
|
|
||||||
table.insert(data.players, info)
|
if not is_hidden then
|
||||||
|
table.insert(data.players, info)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local json = minetest.write_json(data)
|
local json = minetest.write_json(data)
|
||||||
|
@ -7,6 +7,7 @@ dofile(MP.."/train.lua")
|
|||||||
dofile(MP.."/label.lua")
|
dofile(MP.."/label.lua")
|
||||||
dofile(MP.."/border.lua")
|
dofile(MP.."/border.lua")
|
||||||
dofile(MP.."/legacy.lua")
|
dofile(MP.."/legacy.lua")
|
||||||
|
dofile(MP.."/privs.lua")
|
||||||
|
|
||||||
|
|
||||||
-- optional mapserver-bridge stuff below
|
-- optional mapserver-bridge stuff below
|
||||||
|
4
mapserver_mod/mapserver/privs.lua
Normal file
4
mapserver_mod/mapserver/privs.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
minetest.register_privilege("mapserver_hide_player", {
|
||||||
|
description = "Player is hidden from the map"
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user