Advertisement
kensuaga

Mothership code for board setup.

Sep 25th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.33 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. function onload()
  6.  
  7.     gameBox_GUID     = '03ceb9'
  8.     astNebBag_GUID   = '59ff75'
  9.     expTokenBag_GUID = '011cd7'
  10.  
  11.     fourPlayBd_GUID  = '9431a0'
  12.     sixPlayBd_GUID   = '52f496'
  13.  
  14.     layoutZone_GUID = '248cd5'
  15.     activeCardZone_GUID = '3b9c80'
  16.     testZone_GUID = 'a12b0c'
  17.  
  18.     --Setup Button
  19.     self.createButton(
  20.         {click_function='setupBoard', function_owner=self, label='Setup',
  21.         position={0,0.1,0.9}, rotation={0,0,0}, width=300, height=225, font_size=100,
  22.         scale={0.8,0.8,0.8}}
  23.     )
  24.  
  25.     --Clear Zone
  26.     self.createButton(
  27.         {click_function='clearBoard', function_owner=self, label='Clear',
  28.         position={1.3,0.1,0.9}, rotation={0,0,0}, width=300, height=225, font_size=100,
  29.         scale={0.8,0.8,0.8}}
  30.     )
  31.  
  32. end
  33.  
  34. function setupBoard()
  35.  
  36.     print('Setup layout function is called')
  37.  
  38.     --Locate the scripting zone by its GUID, since this will not change
  39.     --Get the GUID by using the scripting zone tool and right clicking a zone
  40.     local zone = getObjectFromGUID(activeCardZone_GUID)
  41.     --Get a list of any objects which are inside of the zone.
  42.     local activeCard = zone.getObjects()
  43.     --Check if the table we made is empty due to the zone being empty
  44.  
  45.     if #activeCard == 0 then
  46.         --What prints if the scripting zone was empty
  47.         print("Please Select a Layout Card and place it in the Active Zone")
  48.     else
  49.         --If it isn't empty, we use a for loop to look at each entry in the list
  50.         for _, card in ipairs(activeCard) do
  51.             --Find the name of the object
  52.             activeCard = card.getName()
  53.             --Then check if it had a name or not
  54.             print(activeCard .. " found.")
  55.         end
  56.     end
  57.  
  58.     --This will pull the data table for the active cardName
  59.     for layout, DataTable in pairs(ref_layoutPositions) do
  60.         if layout == activeCard then
  61.             print('Active card table found!')
  62.  
  63.             for _, entries in ipairs(DataTable) do
  64.                 gameBox = getObjectFromGUID(gameBox_GUID)
  65.                 gameBox.takeObject({
  66.                     guid           = enteries.guid_object,
  67.                     position       = enteries.pos_object,
  68.                     rotation       = enteries.rot_object
  69.  
  70.                 })
  71.  
  72.             end
  73.  
  74.         else
  75.             print('Active card table ignored!')
  76.         end
  77.     end
  78.  
  79. end
  80.  
  81. function clearBoard()
  82.     print('Clear layout function is called')
  83. end
  84.  
  85.  
  86. -- {guid_object="", pos_object=, rot_object=},
  87.  
  88. ref_layoutPositions = {
  89.     ["Default Setup"] = {
  90.         --Gameboard
  91.         --{guid_object="0e46ea", pos_object={0.00, 1.03, -0.33}, rot_object={0.00, 180.00, 0.00}},
  92.         --Astroids
  93.         --{guid_object="c5044f", pos_object={-4.52, 2.02, -8.50}, rot_object={0.00, 210.00, 180.00}},
  94.         --{guid_object="5b2eba", pos_object={-7.54, 2.02, -4.04}, rot_object={0.00, 300.00, 180.00}},
  95.         --{guid_object="4a6cb9", pos_object={-6.39, 2.02, 5.40}, rot_object={0.00, 60.00, 180.00}},
  96.         --{guid_object="e11258", pos_object={5.20, 2.02, -6.07}, rot_object={0.00, 240.00, 180.00}},
  97.         --{guid_object="ff141b", pos_object={7.53, 2.02, 2.65}, rot_object={0.00, 120.03, 180.00}},
  98.         --{guid_object="a76763", pos_object={4.52, 2.02, 7.14}, rot_object={0.00, 30.00, 180.00}},
  99.         --Planets
  100.         {guid_object="34e575", pos_object={-8.45, 1.97, -4.88}, rot_object={0.00, 90.00, 0.00}},
  101.         {guid_object="66a675", pos_object={-4.83, 1.97, 8.37}, rot_object={0.00, 90.00, 0.00}},
  102.         {guid_object="756716", pos_object={0.00, 1.97, 0.00}, rot_object={0.00, 90.00, 0.00}},
  103.         {guid_object="35f461", pos_object={3.62, 1.97, -9.06}, rot_object={0.00, 90.00, 0.00}},
  104.         {guid_object="ea9422", pos_object={8.45, 1.97, 4.88}, rot_object={0.00, 90.00, 0.00}},
  105.         --Colony Stations
  106.         --{guid_object="61f4e9", pos_object={-10.87, 1.97, -10.46}, rot_object={0.00, 330.00, 0.00}},
  107.         --{guid_object="d428e7", pos_object={-10.87, 1.97, 10.46}, rot_object={0.00, 0.00, 0.00}},
  108.         --{guid_object="c69557", pos_object={10.87, 1.97, -10.46}, rot_object={0.00, 330.00, 0.00}},
  109.         --{guid_object="ff979d", pos_object={10.87, 1.97, 10.46}, rot_object={0.00, 90.00, 0.00}},
  110.     },
  111.  
  112.     ["Layout02"] = {
  113.         {guid_object="0e46ea", pos_object={0.00, 1.03, -0.33}, rot_object={0.00, 180.00, 0.00}},
  114.     },
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement