t8rt0t

speakers.lua

Jul 8th, 2024
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.03 KB | None | 0 0
  1. local f = {}
  2. do
  3.     local perips = {
  4.         "redstoneIntegrator_24",
  5.         "redstoneIntegrator_25",
  6.         "redstoneIntegrator_26",
  7.         "redstoneIntegrator_27",
  8.         "redstoneIntegrator_28",
  9.         "redstoneIntegrator_29",
  10.         "redstoneIntegrator_30",
  11.         "redstoneIntegrator_31",
  12.         "redstoneIntegrator_32",
  13.         "redstoneIntegrator_33",
  14.     }
  15.     local wrapped_perips = {}
  16.     for k,v in pairs(perips) do
  17.         local p = assert(peripheral.wrap(v))
  18.         f[k] = function(side) p.setOutput(side,true);sleep(0.05);p.setOutput(side,false) end
  19.     end
  20. end
  21.  
  22.  
  23.  
  24. local SP = {
  25.     ["--DOXXER--"] = function() f[1]("east") end,
  26.     ["minecraft:overworld"] = function() f[1]("north") end,
  27.     ["minecraft:the_nether"] = function() f[1]("west") end,
  28.     ["minecraft:the_end"] = function() f[1]("south") end,
  29.     ["--DOXXER OUT--"] = function() f[1]("up") end,
  30.     ["-"] = function() f[2]("east") end,
  31.     [" "] = function() f[2]("north") end,
  32.     ["_"] = function() f[2]("west") end,
  33.     [":"] = function() f[2]("south") end,
  34.     [","] = function() f[2]("up") end,
  35.     a = function() f[3]("down") end,
  36.     b = function() f[3]("east") end,
  37.     c = function() f[3]("north") end,
  38.     d = function() f[3]("west") end,
  39.     e = function() f[3]("south") end,
  40.     f=function() f[4]("east") end,
  41.     g=function() f[4]("north") end,
  42.     h=function() f[4]("west") end,
  43.     i=function() f[4]("south") end,
  44.     j=function() f[4]("up") end,
  45.     k = function() f[5]("down") end,
  46.     l = function() f[5]("east") end,
  47.     m = function() f[5]("north") end,
  48.     n = function() f[5]("west") end,
  49.     o = function() f[5]("south") end,
  50.     p=function() f[6]("east") end,
  51.     q=function() f[6]("north") end,
  52.     r=function() f[6]("west") end,
  53.     s=function() f[6]("south") end,
  54.     t=function() f[6]("up") end,
  55.     u = function() f[7]("down") end,
  56.     v = function() f[7]("east") end,
  57.     w = function() f[7]("north") end,
  58.     x = function() f[7]("west") end,
  59.     y = function() f[7]("south") end,
  60.     z = function() f[8]("up") end,
  61.     Perfectellis19 = function() f[8]("east") end,
  62.     ckupen = function() f[8]("north") end,
  63.     t8rt0t = function() f[8]("west") end,
  64.     Superbug3003 = function() f[8]("south") end,
  65.     ["0"] = function() f[9]("down") end,
  66.     ["1"] = function() f[9]("east") end,
  67.     ["2"] = function() f[9]("north") end,
  68.     ["3"] = function() f[9]("west") end,
  69.     ["4"] = function() f[9]("south") end,
  70.     ["5"] = function() f[10]("east") end,
  71.     ["6"] = function() f[10]("north") end,
  72.     ["7"] = function() f[10]("west") end,
  73.     ["8"] = function() f[10]("south") end,
  74.     ["9"] = function() f[10]("up") end
  75. }
  76. local mt = {}
  77.  
  78. local expect = require("cc.expect").expect
  79.  
  80. setmetatable(SP,mt)
  81.  
  82. mt.__index = mt
  83.  
  84. function mt:__call(name)
  85.     expect(1,name,"string","number")
  86.     if self[name] then self[name]();return true end
  87.     name = tostring(name):lower()
  88.     for i=1,#name do
  89.         if self[name:sub(i,i)] then self[name:sub(i,i)]()
  90.         else return false end
  91.     end
  92. end
  93.  
  94. return SP
Advertisement
Add Comment
Please, Sign In to add comment