Add files via upload

master
AiTechEye 2018-06-26 11:12:39 +02:00 committed by GitHub
parent 265a9b1867
commit 1c84c36b35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1 @@
vexcazer

58
vexcazer_travel/init.lua Normal file
View File

@ -0,0 +1,58 @@
-- let you travel to 2 set positions, like /sethome but with the tool
vexcazer.registry_mode({
name="Travel1",
info="PLACE = set travelpoint 1\nUSE = teleport to travelpoint 1",
wear_on_use=10,
wear_on_place=0,
disallow_damage_on_use=true,
on_place=function(itemstack, user, pointed_thing,input)
local pos=user:getpos()
if minetest.is_protected(pos, input.user_name) then
minetest.chat_send_player(input.user_name, "<vexcazer> Travel: this position is protected")
return
end
pos={x=vexcazer.round(pos.x),y=vexcazer.round(pos.y),z=vexcazer.round(pos.z)}
pos=minetest.pos_to_string(pos)
vexcazer.save(input,"travel1",pos,false)
minetest.chat_send_player(input.user_name, "<vexcazer> Travel: position 1 ".. pos .." saved")
end,
on_use=function(itemstack, user, pointed_thing,input)
local spos=vexcazer.load(input,"travel1")
if not spos then return end
local pos=minetest.string_to_pos(spos)
if minetest.is_protected(pos, input.user_name) then
minetest.chat_send_player(input.user_name, "<vexcazer> Travel: this position ".. spos .." is protected")
return
end
user:moveto(pos)
end,
})
vexcazer.registry_mode({
name="Travel2",
info="PLACE = set travelpoint 2\nUSE = teleport to travelpoint 2",
wear_on_use=10,
wear_on_place=0,
disallow_damage_on_use=true,
on_place=function(itemstack, user, pointed_thing,input)
local pos=user:getpos()
if minetest.is_protected(pos, input.user_name) then
minetest.chat_send_player(input.user_name, "<vexcazer> Travel: this position is protected")
return
end
pos={x=vexcazer.round(pos.x),y=vexcazer.round(pos.y),z=vexcazer.round(pos.z)}
pos=minetest.pos_to_string(pos)
vexcazer.save(input,"travel2",pos,false)
minetest.chat_send_player(input.user_name, "<vexcazer> Travel: position 2 ".. pos .." saved")
end,
on_use=function(itemstack, user, pointed_thing,input)
local spos=vexcazer.load(input,"travel2")
if not spos then return end
local pos=minetest.string_to_pos(spos)
if minetest.is_protected(pos, input.user_name) then
minetest.chat_send_player(input.user_name, "<vexcazer> Travel: this position ".. spos .." is protected")
return
end
user:moveto(pos)
end,
})