Add files via upload

master
AiTechEye 2018-12-29 19:41:11 +01:00 committed by GitHub
parent 2d6cfacab3
commit 6d076d6f66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 47 deletions

View File

@ -1,4 +1,11 @@
mesetec={maxlight=default.LIGHT_MAX or 15, player_teleport={},mtcuser={},mtpuser={},rules={{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1}}
mesetec={
maxlight=default.LIGHT_MAX or 15,
player_teleport={},
mtcuser={},
mtpuser={},
nodeswitch_user={},
rules={{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1}
}

View File

@ -1,5 +1,4 @@
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if mesetec.nodeswitch_user then
local name=placer:get_player_name()
if mesetec.nodeswitch_user[name] then
if minetest.get_item_group(newnode.name,"liquid")>0 then
@ -16,11 +15,9 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
mesetec.nodeswitch_user[name].node1=newnode.name
end
end
end
end)
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if mesetec.nodeswitch_user then
local name=puncher:get_player_name()
if mesetec.nodeswitch_user[name] then
if minetest.get_node(pointed_thing.above).name~="air" then
@ -40,7 +37,6 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
mesetec.nodeswitch_user[name].node1=minetest.get_node(pointed_thing.above).name
end
end
end
end)
mesetec.consnodeswitch=function(name)
@ -56,7 +52,6 @@ mesetec.consnodeswitch=function(name)
meta:set_string("pos2",minetest.pos_to_string(npos2))
meta:set_int("able",1)
mesetec.nodeswitch_user[name]=nil
if #mesetec.nodeswitch_user==0 then mesetec.nodeswitch_user=nil end
end
end
@ -95,23 +90,20 @@ minetest.register_node("mesetec:nodeswitch", {
after_place_node = function(pos, placer)
local meta=minetest.get_meta(pos)
local p=placer:get_player_name()
local id=math.random(1,9999)
meta:set_string("owner",p)
minetest.chat_send_player(p, "Place the 1 or 2 nodes to replace with each other")
minetest.chat_send_player(p, "Or punch somwehere to move the node to there")
minetest.after(0.1, function(p,id,pos)
mesetec.nodeswitch_user[p]={pos=pos,name=p,id=id}
end, p,id,pos)
if not mesetec.nodeswitch_user then mesetec.nodeswitch_user={} end
minetest.after(0.1, function(p)
mesetec.nodeswitch_user[p]={pos=pos,name=p}
end, p)
minetest.after(60, function(p)
if mesetec.nodeswitch_user then
if mesetec.nodeswitch_user[p] then mesetec.nodeswitch_user[p]=nil end
if #mesetec.nodeswitch_user==0 then mesetec.nodeswitch_user=nil end
minetest.after(10, function(p,id)
if mesetec.nodeswitch_user[p] and mesetec.nodeswitch_user[p].id==id then
mesetec.nodeswitch_user[p]=nil
end
end, p)
end, p,id)
end,