Last active
January 8, 2017 14:40
-
-
Save mkarneim/6be5ea5f404aaca29dde2d2f6adbdf3e to your computer and use it in GitHub Desktop.
loocraft specific scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gist.8deed890e0d92ef19506e889819b2e97.sample" | |
require "gist.835077aed5123947fe006e6d5ed5582b.books" | |
function spawnpoint(pos) | |
if pos == nil then | |
move(UP) | |
pos = vec3(getWorldPos()) | |
end | |
local eventqueue = events.register(PLAYER_JOINED) | |
for event in eventqueue.next do | |
local n = event.player.name | |
cmd("tp "..n.." "..pos.x.." "..pos.y.." "..pos.z) | |
end | |
end | |
function welcome() | |
local eventqueue = events.register(PLAYER_SPAWNED) | |
for event in eventqueue.next do | |
--print(event.id,event.type,event.player.name) | |
local n = event.player.name | |
msg(n,"Welcome back, "..n.."!") | |
cmd("tp "..n.." ~ ~100 ~") | |
end | |
end | |
function particleInBox(inBox) | |
pushLoc() | |
local sel = selectInBox(inBox) | |
for _,p in pairs(sel) do | |
setWorldPos(p.x, p.y, p.z) | |
particle() | |
end | |
sleep(1) | |
for _,p in pairs(sel) do | |
setWorldPos(p.x, p.y, p.z) | |
particle() | |
end | |
sleep(1) | |
for _,p in pairs(sel) do | |
setWorldPos(p.x, p.y, p.z) | |
particle("endRod") | |
end | |
popLoc() | |
end | |
-- /lua b=toboxDelta(vec3(43,15,-32), 1,3,2); setupTeleporter(b,-17,26,0,1) | |
function setupTeleporter(fromBox,dx,dy,dz,pc) | |
pc = pc or 1 | |
if pc < 1 then | |
error("pc (player count) must be >= 1") | |
end | |
while true do | |
local names = detectPlayers(fromBox) | |
if #names==pc then | |
local fromBoxStr = "{p1=vec3("..fromBox.p1.x..","..fromBox.p1.y..","..fromBox.p1.z.."),p2=vec3("..fromBox.p2.x..","..fromBox.p2.y..","..fromBox.p2.z..")}" | |
local toBox = { | |
p1=vec3(fromBox.p1.x+dx,fromBox.p1.y+dy,fromBox.p1.z+dz), | |
p2=vec3(fromBox.p2.x+dx,fromBox.p2.y+dy,fromBox.p2.z+dz) | |
} | |
local toBoxStr = "{p1=vec3("..toBox.p1.x..","..toBox.p1.y..","..toBox.p1.z.."),p2=vec3("..toBox.p2.x..","..toBox.p2.y..","..toBox.p2.z..")}" | |
local cmd1 = "lua sleep(1); particleInBox("..fromBoxStr..");" | |
cmd(cmd1) | |
local cmd2 = "lua sleep(1); particleInBox("..toBoxStr..");" | |
cmd(cmd2) | |
sleep(16) | |
teleport(names,"~"..dx,"~"..dy,"~"..dz) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment