fix incorrect camera pos and send contect and identity every second
with minetest 5.3.0 camera position no longer needs to be divided by 10
This commit is contained in:
parent
3c738f6720
commit
9f49f3b29b
@ -1,5 +1,8 @@
|
|||||||
local player
|
local player
|
||||||
local serverinfo
|
local serverinfo
|
||||||
|
local minetestversion = string.gsub(minetest.get_version().string, '%.', '')
|
||||||
|
minetestversion = tonumber(minetestversion)
|
||||||
|
local timer = 0
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
if minetest.localplayer and not player then
|
if minetest.localplayer and not player then
|
||||||
@ -10,15 +13,25 @@ minetest.register_globalstep(function(dtime)
|
|||||||
minetest.display_chat_message("!Mumble loaded! This mod uses print() to send ingame positional data, so your debug.txt may get quite large, and it's recommended to set debug_log_level to nothing if you haven't already.")
|
minetest.display_chat_message("!Mumble loaded! This mod uses print() to send ingame positional data, so your debug.txt may get quite large, and it's recommended to set debug_log_level to nothing if you haven't already.")
|
||||||
end
|
end
|
||||||
if player then
|
if player then
|
||||||
|
timer = timer + dtime
|
||||||
|
if timer > 1 then
|
||||||
|
serverinfo = minetest.get_server_info()
|
||||||
|
minetest.log("action", "mumble id "..player:get_name())
|
||||||
|
minetest.log("action", "mumble context "..serverinfo.ip..":"..serverinfo.port)
|
||||||
|
timer = 0
|
||||||
|
end
|
||||||
local player_pos = player:get_pos() or {x=0, y=0, z=0}
|
local player_pos = player:get_pos() or {x=0, y=0, z=0}
|
||||||
local player_look = {x=0, y=0, z=0}
|
local player_look = {x=0, y=0, z=0}
|
||||||
local camera_pos = {x=0, y=0, z=0}
|
local camera_pos = {x=0, y=0, z=0}
|
||||||
local camera_look = {x=0, y=0, z=0}
|
local camera_look = {x=0, y=0, z=0}
|
||||||
if minetest.camera then
|
if minetest.camera then
|
||||||
camera_pos = minetest.camera:get_pos()
|
camera_pos = minetest.camera:get_pos()
|
||||||
|
--before Minetest 5.2.0 camera positions were 10x player position.
|
||||||
|
if minetestversion <= 520 then
|
||||||
camera_pos.x = (camera_pos.x/10)
|
camera_pos.x = (camera_pos.x/10)
|
||||||
camera_pos.y = (camera_pos.y/10)
|
camera_pos.y = (camera_pos.y/10)
|
||||||
camera_pos.z = (camera_pos.z/10)
|
camera_pos.z = (camera_pos.z/10)
|
||||||
|
end
|
||||||
camera_look = minetest.camera:get_look_dir()
|
camera_look = minetest.camera:get_look_dir()
|
||||||
player_look = camera_look
|
player_look = camera_look
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user