Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Side = { "bottom", "top", "back", "left", "right" }
- for i = 1,5 do
- print(Side[i].." : "..tostring(peripheral.getType(Side[i])))
- if peripheral.getType(Side[i]) == "warpcore" then
- warp = peripheral.wrap(Side[i])
- print("Warp found at "..Side[i])
- break
- else
- print("No core at "..Side[i])
- end
- end
- if warp==nil then
- error("Can't find warp core!")
- end
- Style = {
- CDeflt = colors.white,
- BGDeflt = colors.blue,
- CTitle = colors.black,
- BGTitle = colors.cyan,
- CWarn = colors.white,
- BGWarn = colors.red
- }
- function SetColorDeflt()
- term.setBackgroundColor(Style.BGDeflt)
- term.setTextColor(Style.CDeflt)
- end
- function SetColorTitle()
- term.setBackgroundColor(Style.BGTitle)
- term.setTextColor(Style.CTitle)
- end
- function SetColorWarn()
- term.setBackgroundColor(Style.BGWarn)
- term.setTextColor(Style.CWarn)
- end
- function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function Show(Text)
- term.write(Text)
- local xt,yt = term.getCursorPos()
- term.setCursorPos(1, yt+1)
- end
- function ShowTitle(Text)
- SetColorTitle()
- term.setCursorPos(12, 1)
- Show(Text)
- SetColorDeflt()
- end
- function ShowMenu(Text)
- term.write(Text)
- local xt, yt = term.getCursorPos()
- for i = xt, 51 do
- term.write(" ")
- end
- term.setCursorPos(1, yt+1)
- end
- function ShowWarning(Text)
- SetColorWarn()
- term.setCursorPos(10, 19)
- term.write(" "..Text.." ")
- SetColorDeflt()
- end
- function Summon()
- Clear()
- ShowTitle("<==== Summon players ====>")
- local players = Explode(",", warp.get_attached_players())
- for i = 1, #players do
- Show(i..". "..players[i])
- end
- SetColorTitle()
- ShowMenu("Enter player number")
- ShowMenu("or press enter to summon everyone")
- SetColorDeflt()
- sleep(0.3)
- term.write(":")
- local input = read()
- if input == "" then
- warp.summon_all()
- else
- input = tonumber(input)
- warp.summon(input - 1)
- end
- end
- Summon()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement