aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-02-03 20:43:46 +0100
committerorwell96 <mono96.mml@gmail.com>2017-02-03 20:43:46 +0100
commitb3ce833df80e679e55175fe324a9c6137a6c5cc3 (patch)
tree5f044de54f85ffa3d45fb031745363ae439d12e0
parent328d5054a105869c7e12df1941ceedb308ef1faa (diff)
downloadadvtrains-b3ce833df80e679e55175fe324a9c6137a6c5cc3.tar.gz
advtrains-b3ce833df80e679e55175fe324a9c6137a6c5cc3.tar.bz2
advtrains-b3ce833df80e679e55175fe324a9c6137a6c5cc3.zip
fix up stuff in itrainmap
-rw-r--r--advtrains/advtrains_itrainmap/init.lua11
1 files changed, 2 insertions, 9 deletions
diff --git a/advtrains/advtrains_itrainmap/init.lua b/advtrains/advtrains_itrainmap/init.lua
index b1168f1..02dbc9e 100644
--- a/advtrains/advtrains_itrainmap/init.lua
+++ b/advtrains/advtrains_itrainmap/init.lua
@@ -25,7 +25,7 @@ local function create_map_form_with_bg(d)
local lbl={}
for pts, tid in pairs(advtrains.detector.on_node) do
- local pos=minetest.get_position_from_hash(pts)
+ local pos=minetest.string_to_pos(pts)
form=form.."box["..(edge_x*(pos.x-minx))..","..(form_z-(edge_z*(pos.z-minz)))..";"..len_x..","..len_z..";red]"
lbl[sid(tid)]=pos
end
@@ -52,7 +52,7 @@ local function create_map_form(d)
if x>=minx and x<=maxx then
for z,y in pairs(itx) do
if z>=minz and z<=maxz then
- local adn=advtrains.detector.on_node[minetest.hash_node_position({x=x, y=y, z=z})]
+ local adn=advtrains.detector.on_node[minetest.pos_to_string({x=x, y=y, z=z})]
local color="gray"
if adn then
color="red"
@@ -128,21 +128,14 @@ local timer=0
minetest.register_globalstep(function(dtime)
timer=timer-math.min(dtime, 0.1)
if timer<=0 then
- local t1=os.clock()
- local any=false
for pname,d in pairs(itm_pdata) do
minetest.show_formspec(pname, "itrainmap", create_map_form(d))
- any=true
- end
- if any then
- minetest.log("action", "itm "..math.floor((os.clock()-t1)*1000).."ms")
end
timer=2
end
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname=="itrainmap" and fields.quit then
- minetest.log("action", "itm form quit")
itm_pdata[player:get_player_name()]=nil
end
end)