player infos in bridge
This commit is contained in:
parent
13b3b144c3
commit
20613101b5
6855
doc/lua_api.txt
Normal file
6855
doc/lua_api.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,43 @@
|
|||||||
-- mapserver http bridge
|
-- mapserver http bridge
|
||||||
|
|
||||||
|
|
||||||
|
local function explode(sep, input)
|
||||||
|
local t={}
|
||||||
|
local i=0
|
||||||
|
for k in string.gmatch(input,"([^"..sep.."]+)") do
|
||||||
|
t[i]=k
|
||||||
|
i=i+1
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
local function get_max_lag()
|
||||||
|
local arrayoutput = explode(", ",minetest.get_server_status())
|
||||||
|
local arrayoutput = explode("=",arrayoutput[4])
|
||||||
|
return arrayoutput[1]
|
||||||
|
end
|
||||||
|
|
||||||
local http, url, key
|
local http, url, key
|
||||||
|
|
||||||
function send_stats()
|
function send_stats()
|
||||||
|
|
||||||
local data = {}
|
local data = {
|
||||||
|
time = minetest.get_timeofday() * 24000,
|
||||||
|
uptime = minetest.get_server_uptime(),
|
||||||
|
max_lag = get_max_lag(),
|
||||||
|
players = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
local info = {
|
||||||
|
name = player:get_player_name(),
|
||||||
|
pos = player:get_pos(),
|
||||||
|
hp = player:get_hp(),
|
||||||
|
breath = player:get_breath(),
|
||||||
|
velocity = player:get_player_velocity()
|
||||||
|
}
|
||||||
|
|
||||||
|
table.insert(data.players, player)
|
||||||
|
end
|
||||||
|
|
||||||
http.fetch({
|
http.fetch({
|
||||||
url = url,
|
url = url,
|
||||||
|
Loading…
Reference in New Issue
Block a user