Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Use this script to clone the full catalogue from the old (pre 2.5) 20.000 BLOCKS layout
- -- to the new horizontal layout
- -- HOW TO USE
- -- You need two people in the world to be able to do this:
- -- 1. go to the old computer and write down its coordinates
- -- 2. open computer and type "edit registry"
- -- 3. write down the values of "NUMBER_OF_VOCAB", "VOCAB_WIDTH", "VOCAB_HEIGHT", "GRIDCELL_COUNT" and "GRIDCELL_SIZE"
- -- 4. press CTRL key and choose "EXIT" and press ENTER then press ESC to close the computer console
- -- 5. go to a new location in the world (at best find a location further down on positive Z from the old setup otherwise you might wipe your exisitng catalogue)
- -- 6. place a new command computer on the ground
- -- 7. download the latest 20.000 BLOCKS version 2.5 with command <pastebin get FcGRrZgr setup_2_5>
- -- 8. run "setup_2_5"
- -- 9. dont start the game yet
- -- 10. type "edit registry"
- -- 11. find CATALOGUE_SLOTCOUNT and change the field "x" to equal 4 and the field "z" to equal the value of "NUMBER_OF_VOCAB" form step 3.
- -- 12. find "GRIDCELL_SIZE" and "GRIDCELL_COUNT" and set them to the values from step 3.
- -- 13. press CTRL key and choose "SAVE" and press ENTER
- -- 14. press CTRL key and choose "EXIT" and press ENTER then press ESC to close the computer console
- -- 15. run "play" and once it loads terminate it with CTRL+T
- -- 16. type "edit clone_old_vocab_to_new_catalogue"
- -- 17. find "OLD_COMPUTER" and change the x,y,z fields to the coordinates from step 1.
- -- 18. find "NUMBER_OF_VOCAB", "VOCAB_WIDTH", "VOCAB_HEIGHT" and set them to the values from step 3.
- -- 19. press CTRL key and choose "SAVE" and press ENTER
- -- 20. press CTRL key and choose "EXIT" and press ENTER then press ESC to close the computer console
- -- 21. Have your second team member stay in the area with the old catalogue so its chunks stay loaded otherwise the copying will fail
- -- 22. run "clone_old_vocab_to_new_catalogue"
- -- 23. wait for it to complete. It will output "success" if all goes well
- -- 24. check the new catalogue to see if everything copied correctly
- -- 25. run "play" and test your game
- --FILL IN THE VARIABLES BELOW WITH THE INFO FROM YOUR OLD SETUP
- --the position of the old computer
- OLD_COMPUTER = {
- x = -58,
- y = 57,
- z = -525
- }
- NUMBER_OF_VOCAB = 5 -- the number of vocab columns in your old setup
- VOCAB_WIDTH = 27 -- in blocks
- VOCAB_HEIGHT = 19 -- in blocks
- ---DONT CHANGE THE CODE BELOW
- os.loadAPI('registry')
- FIRSTVOCAB= {
- x=OLD_COMPUTER.x,
- y=OLD_COMPUTER.y,
- z=OLD_COMPUTER.z
- }
- --a multi builder which uses the vocab constructor to create sets of vocab
- local function makeVocabZones(quant,w)
- local x,y,z = FIRSTVOCAB.x, FIRSTVOCAB.y, FIRSTVOCAB.z
- local result = {}
- local id = 1
- for i=0,quant-1 do
- for k=0,3 do
- local zpos = i-4
- local ypos = k
- local nextVocab = newVocabZone(
- x-(2*w)-6,y+(ypos*(VOCAB_HEIGHT+3)),
- z+((w+1)*zpos),
- w,
- id
- )
- table.insert(result,nextVocab)
- id = id +1
- end
- end
- return result
- end
- --vocab constructor. Enforces some data structure
- function newVocabZone(x,y,z,w,id )
- local nvz = {}
- nvz.x ,nvz.y ,nvz.z ,nvz.w = x,y,z,w
- nvz.id = id
- nvz.cx = nvz.x - nvz.w - 2
- nvz.cy = nvz.y
- nvz.cz = nvz.z
- return nvz
- end
- --a multi builder which uses the vocab constructor to create sets of vocab
- local function initCatalogueElements(countX, countZ, sizeX, sizeZ)
- local x,y,z = registry.FIRST_ELEMENT.x, registry.FIRST_ELEMENT.y, registry.FIRST_ELEMENT.z
- local result = {}
- local id = 1
- for i=0,countZ-1 do
- for k=0,countX-1 do
- local xpos = x - k * ( registry.GRIDCELL_SIZE * ( 2*registry.CATALOGUE_SLOTSIZE.x + 2 + registry.CATALOGUE_SLOT_OFFSET))
- local ypos = y
- local zpos = z + i*( registry.GRIDCELL_SIZE * ( registry.CATALOGUE_SLOTSIZE.z + 1 + registry.CATALOGUE_SLOT_OFFSET))
- --print("adding an element",i,k)
- local nextElement = newCatalogueElement(
- id,
- xpos,ypos,zpos,
- sizeX, sizeZ
- )
- table.insert(result,nextElement)
- id = id +1
- end
- end
- return result
- end
- --a catalogue slot constructor. Enforces some data structure
- function newCatalogueElement(id, x,y,z,sizeX, sizeZ)
- local nvz = {}
- nvz.id = id
- nvz.keyX ,nvz.keyY ,nvz.keyZ = x,y,z
- nvz.sizeX, nvz.sizeZ = sizeX, sizeZ
- nvz.elementX = nvz.keyX - nvz.sizeX - registry.GRIDCELL_SIZE --
- nvz.elementY = nvz.keyY
- nvz.elementZ = nvz.keyZ
- nvz.elementCenterX = nvz.elementX + math.floor ( nvz.sizeX/2 )
- nvz.elementCenterY = nvz.elementY
- nvz.elementCenterZ = nvz.elementZ + math.floor ( nvz.sizeZ/2 )
- nvz.keyCenterX = nvz.keyX + math.floor ( nvz.sizeX/2 )
- nvz.keyCenterY = nvz.keyY
- nvz.keyCenterZ = nvz.keyZ + math.floor ( nvz.sizeZ/2 )
- return nvz
- end
- --vocabzone creation
- vocabSet = makeVocabZones(NUMBER_OF_VOCAB,VOCAB_WIDTH)
- elementSet = initCatalogueElements(
- registry.CATALOGUE_SLOTCOUNT.x,
- registry.CATALOGUE_SLOTCOUNT.z,
- registry.ELEMENT.sizeX,
- registry.ELEMENT.sizeZ
- )
- -- this function does the cloning
- function cloneVocabToCatalogue()
- print("copying old catalogue to the new location...")
- for col=1, registry.CATALOGUE_SLOTCOUNT.z do
- for row = 1, registry.CATALOGUE_SLOTCOUNT.x do
- local index = (col-1)*registry.CATALOGUE_SLOTCOUNT.x + row
- local vocab = vocabSet[index]
- local element = elementSet[index]
- if vocab and element then
- --clone the key
- commands.clone( vocab.x, vocab.y, vocab.z, vocab.x+vocab.w, vocab.y+VOCAB_HEIGHT, vocab.z+vocab.w,
- element.keyCenterX-math.floor(vocab.w/2), element.keyCenterY, element.keyCenterZ-math.floor(vocab.w/2),"masked")
- --clone the element
- commands.clone( vocab.cx, vocab.cy, vocab.cz, vocab.cx+vocab.w, vocab.cy+VOCAB_HEIGHT, vocab.cz+vocab.w,
- element.elementCenterX-math.floor(vocab.w/2), element.elementCenterY, element.elementCenterZ-math.floor(vocab.w/2),"masked")
- --
- --print("cloned vocab key at col:"..col.." and row:"..row)
- --print("to x:"..(element.keyCenterX-math.floor(vocab.w/2))..", y:"..(element.keyCenterY)..", z:"..(element.keyCenterZ-math.floor(vocab.w/2))..". done!")
- --print("from x:"..vocab.x..", y"..vocab.y..", z:"..vocab.z)
- --print("from x:"..vocab.cx..", y"..vocab.cy..", z:"..vocab.cz)
- else
- print("something wrong with vocab",col,row,vocab,element)
- return
- end
- end
- end
- print("success!")
- end
- cloneVocabToCatalogue()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement