Advertisement
drpepper240

sdata - laser console

Jan 25th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.80 KB | None | 0 0
  1. --computercraft
  2. --data table for general-purpose controller server by drPepper
  3.  
  4.  
  5.  
  6. --GUI data (from file)
  7. guiData = {}
  8. guiData.LASER_EM_P_1 = { guiType = "LASER_EM", guiName = "Pri-1", controllerIds = {"LASER_P_1"}, draw = { xPos = 1, yPos = 1 } }
  9. guiData.LASER_EM_S_1 = { guiType = "LASER_EM", guiName = "Sec-1", controllerIds = {"LASER_S_1"}, draw = { xPos = 1, yPos = 2 } }
  10. guiData.LASER_EM_S_2 = { guiType = "LASER_EM", guiName = "Sec-2", controllerIds = {"LASER_S_2"}, draw = { xPos = 1, yPos = 3 } }
  11. guiData.LASER_EM_S_3 = { guiType = "LASER_EM", guiName = "Sec-3", controllerIds = {"LASER_S_3"}, draw = { xPos = 1, yPos = 4 } }
  12. --guiData.LABEL_1 = { guiType = "LABEL", guiName = "Lazors:", draw = { xPos = 1, yPos = 1, len = 10, textCol = colors.black, bgCol = colors.white } }
  13. guiData.MODE_SW_VERSION = { guiType = "GUI_MODE_SWITCH", guiName = "ver", guiMode = "MODE_VERSION", draw = { xPos = nil, yPos = 1, len = 3 } }
  14. guiData.MODE_SW_COORD_REL = { guiType = "GUI_MODE_SWITCH", guiName = "rel", guiMode = "MODE_REL_COORDS", draw = { xPos = nil, yPos = 2, len = 3 } }
  15. guiData.MODE_SW_COORD_GLOB = { guiType = "GUI_MODE_SWITCH", guiName = "glb", guiMode = "MODE_ABS_COORDS", draw = { xPos = nil, yPos = 3, len = 3 } }
  16. guiData.MODE_SW_FREQ = { guiType = "GUI_MODE_SWITCH", guiName = "frq", guiMode = "MODE_FREQ", draw = { xPos = nil, yPos = 4, len = 3 } }
  17.  
  18. --controller data (from file)
  19. ctrlData = {}
  20. ctrlData.LASER_P_1 = { guiIds = {"LASER_EM_P_1"}, relX = 19, relY = 0, relZ = 5 }
  21. ctrlData.LASER_S_1 = { guiIds = {"LASER_EM_S_1"}, relX = 15, relY = 2, relZ = 10 }
  22. ctrlData.LASER_S_2 = { guiIds = {"LASER_EM_S_2"}, relX = 15, relY = 3, relZ = 10 }
  23. ctrlData.LASER_S_3 = { guiIds = {"LASER_EM_S_3"}, relX = 15, relY = 4, relZ = 10 }
  24.  
  25.  
  26. --server settings (from file)
  27. settings = {}
  28. --default values
  29. settings.modemSide = "back"
  30. settings.channelSend = 1211
  31. settings.channelReceive = 1210
  32. settings.pastebin = "6yNKPiNG"
  33. settings.pastebinSData = "rniskTUn"
  34. settings.monitorSide = "top"
  35. settings.textSize = 0.5
  36. --time interval from last response to initiate status request in kiloticks
  37. settings.statusUpdate = 0.5
  38. --time interval from last response to mark a controller missing
  39. settings.statusTimeout = 1.0
  40.  
  41. --GUI column length
  42. settings.guiColWidth = 10.0
  43. settings.guiRightColWidth = 6.0
  44. --
  45. settings.guiBgColor = colors.black
  46. settings.guiTextColor = colors.white
  47.  
  48.  
  49. --target rel coords as parameters
  50. function laserChooser(trx, try, trz)
  51.     --table to return
  52.     local tl = { p = {}, s = {} }
  53.     tl.p.LASER_P_1 = { tx = trx - ctrlData.LASER_P_1.relX, ty = try - ctrlData.LASER_P_1.relY, tz = trz - ctrlData.LASER_P_1.relZ }
  54.     tl.s.LASER_S_1 = { tx = ctrlData.LASER_P_1.relX - ctrlData.LASER_S_1.relX, ty = ctrlData.LASER_P_1.relY - ctrlData.LASER_S_1.relY, tz = ctrlData.LASER_P_1.relZ - ctrlData.LASER_S_1.relZ }
  55.    
  56.     return tl
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement