forked from Mirrorlandia_minetest/mesetec
Add files via upload
This commit is contained in:
parent
2d6cfacab3
commit
6d076d6f66
9
init.lua
9
init.lua
@ -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}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
24
teleob.lua
24
teleob.lua
@ -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,
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user