Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /c
- local pl = game.player;
- local prevPos = nil;
- local memPos = nil;
- local tpSpecPoints = { "S", "U", "M", "L", "C", "R", "B", "D", "P" };
- local tpPoints =
- {
- { name = "HighTech", pos = {96, 22}},
- { name = "Iron", pos = {274, -1485}},
- { name = "Copper", pos = {103, -1803}},
- { name = "Chromium", pos = {103, -2766}},
- { name = "Lead", pos = {103, -3766}},
- { name = "PH", pos = {-586, -829}},
- { name = "Petr1", pos = {-150, -350}},
- { name = "Petr2", pos = {-155, -495}},
- { name = "Coke", pos = {-550, -320}},
- { name = "Tar Proc", pos = {-1640, -250}},
- { name = "Alien1", pos = {-144, 100}},
- { name = "Alien2", pos = {-116, 250}},
- { name = "Alien3", pos = {-165, 423}},
- { name = "Alien4", pos = {-165, 653}},
- { name = "Sand", pos = {432, -323}},
- { name = "Wood", pos = {-777, -105}},
- { name = "-------- Q Input / Output", pos = {83, -343}},
- { name = "Q[1]", pos = {-375, -800}},
- { name = "Q[2]", pos = {-700, -100}},
- { name = "Q[3]", pos = {-715, 450}},
- { name = "Q[4]", pos = {-1165, 865}},
- { name = "I[0]", pos = {-510, -208}},
- { name = "L[0]", pos = {-300, -1540}},
- { name = "Cop[0]", pos = {-470, -1116}},
- { name = "-------- T Input / Output", pos = {84, -716}},
- { name = "T[0]", pos = {-715, -365}},
- { name = "T[1]", pos = {-1904, -270}},
- { name = "Stone[0]", pos = {-927, 277}},
- { name = "Boiler", pos = {91, -60}},
- { name = "Coal[0]", pos = {-85, -200}},
- { name = "----------------Nexelit Input", pos = {177, -862}},
- { name = "Nexelit[0]", pos = {68, -580}},
- { name = "Nexelit[1]", pos = {580, -376}}
- };
- function getPos (btn)
- if btn.name == "SpecM" then
- return memPos;
- elseif btn.name == "SpecC" then
- return { 0, 0};
- elseif btn.name == "SpecB" or btn.name == "SpecP" then
- return prevPos;
- elseif btn.name == "SpecU" then
- return { pl.position.x, pl.position.y - 100};
- elseif btn.name == "SpecD" then
- return { pl.position.x, pl.position.y + 100};
- elseif btn.name == "SpecL" then
- return { pl.position.x - 100, pl.position.y};
- elseif btn.name == "SpecR" then
- return { pl.position.x + 100, pl.position.y};
- end
- for _, tpPoint in pairs (tpPoints) do
- if tpPoint.name == btn.caption then
- return tpPoint.pos;
- end
- end
- return nil;
- end
- script.on_event(defines.events.on_gui_click, function(event)
- local btn = event.element;
- if btn.name == "SpecS" then
- memPos = pl.position;
- return;
- end
- local pos = getPos(btn);
- if (pos ~= nil) then
- prevPos = pl.position;
- pl.teleport (pos);
- end
- end)
- local frameCont = pl.gui.left;
- if frameCont.tpOffsetFrame ~= nil then frameCont.tpOffsetFrame.destroy() end;
- local tpOffsetFrame = frameCont.add{type = "frame", name = "tpOffsetFrame", direction = "vertical"};
- local tpOffsetFrameTable = tpOffsetFrame.add{type ="table", name = "offsetTpFrameTable", column_count = 3, row_count = 3 };
- for index, tpSpecBtn in pairs (tpSpecPoints) do
- local specBtn = tpOffsetFrameTable.add ({type = "button", name = "Spec" .. tpSpecBtn, caption = tpSpecBtn });
- specBtn.style.maximal_width = 40;
- end
- if frameCont.tpFrame ~= nil then frameCont.tpFrame.destroy() end;
- local tpFrame = frameCont.add{type = "frame", name = "tpFrame", direction = "vertical"};
- local tpFrameTable = tpFrame.add{type ="table", name = "tpFrameTable", column_count = 1 };
- for index, tpPoint in pairs (tpPoints) do
- tpFrameTable.add ({type = "button", name = "tpButton" .. index, caption = tpPoint.name });
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement