1
0
forked from MTSR/mapserver

player hide feature

This commit is contained in:
NatureFreshMilk 2019-03-22 13:23:19 +01:00
parent 1ba10ec549
commit 8f0e38e00a
4 changed files with 20 additions and 1 deletions

View File

@ -42,3 +42,12 @@ secure.http_mods = mapserver
mapserver.url = http://127.0.0.1:8080
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

View File

@ -78,6 +78,9 @@ function send_stats()
end
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 = {
name = player:get_player_name(),
pos = player:get_pos(),
@ -86,7 +89,9 @@ function send_stats()
velocity = player:get_player_velocity()
}
table.insert(data.players, info)
if not is_hidden then
table.insert(data.players, info)
end
end
local json = minetest.write_json(data)

View File

@ -7,6 +7,7 @@ dofile(MP.."/train.lua")
dofile(MP.."/label.lua")
dofile(MP.."/border.lua")
dofile(MP.."/legacy.lua")
dofile(MP.."/privs.lua")
-- optional mapserver-bridge stuff below

View File

@ -0,0 +1,4 @@
minetest.register_privilege("mapserver_hide_player", {
description = "Player is hidden from the map"
})