This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Tag365's profile picture

Build API (Build tools and Models)

Started by Tag365, 06 October 2015 - 01:55 PM
Tag365 #1
Posted 06 October 2015 - 03:55 PM
Using this API you are able to build and create models.


To get the API use pastebin get pHxpJAws.

The functions included in this API include:
Spoiler

-- Structure API. --
-- Creates a new Structure object with the selected dimensions.
-- Arguments:
-- width, height, and depth are the dimensions of the Structure.
function Structure.new(width, height, depth)
end
-- Creates a new Structure object based off of a region of the Terrain.
-- Arguments:
-- x1, y1, z1 is the first corner of the region.
-- x2, y2, z2 is the second corner of the region.
function Structure.loadFromWorld(x1, y1, z1, x2, y2, z2)
end
local FileIdentifier = "error('This is a Model and cannot be run.', 0)"
-- Loads a structure from a path.
-- Arguments:
-- path is the location of the file you want to load.
function Structure.load(path)
end
-- Saves the structure to a file.
-- Arguments:
-- path is the location of the new file.
function Structure:Save(path)
end
-- Sets a block in the Structure to the selected tilename and data string.
-- Arguments:
-- x, y, z is the absolute position you want to place the block.
-- tilename is the tilename of the block you want to use.
-- data is the metadata number of the block.
function Structure:BuildBlock(x, y, z, tilename, data)
end
-- Fills a 3D region of the structure with the selected block.
-- Arguments:
-- x1, y1, z1 is the first corner of the region.
-- x2, y2, z2 is the second corner of the region.
-- tilename is the tilename of the block you want to use.
-- data is the metadata number of the block.
function Structure:BuildBlocksInRegion(x1, y1, z1, x2, y2, z2, tilename, data)
end
-- Pastes another Structure to this Structure.
-- Arguments:
-- structure2 is the Structure with the contents you want to paste.
-- x, y, z is the position you want to paste the other Structure.
-- placeAirBlocks sets if Air blocks in the other Structure will overwrite and remove blocks in this Structure.
function Structure:PasteOtherStructure(structure2, xP, yP, zP, placeAirBlocks)
end
-- Pastes the contents of the Structure to the world.
-- Arguments:
-- x, y, z is the position you want to place the Structure.
-- placeAirBlocks sets if Air blocks in the Structure will overwrite and remove blocks in the world.
-- Returns the number of blocks changed in the world.
function Structure:PlaceInWorld(xP, yP, zP, placeAirBlocks)
end
-- Build API. --
-- Returns an absolute world position from a position relative to the center of the Command Computer.
-- Arguments:
-- x, y, z is the position relative to the center of the Command Computer.
-- All three variables are optional and can be set to nil.
-- Returns a position relative to the center of the world.
function API.getAbsolutePosition(x, y, z)
end
-- Returns a relative position from a position that is relative to the center of the world.
-- Arguments:
-- x, y, z is the position relative to the center of the world.
-- All three variables are optional and can be set to nil.
-- Returns a position relative to the center of the Command Computer.
function API.getRelativePosition(x, y, z)
end

-- Sets a block in the world to a selected tilename and metadata value.
-- Arguments:
-- x, y, z is the position you want to place the block.
-- tilename is the tilename of the block you want to use.
-- data is the metadata number of the block.
function API.buildBlock(x, y, z, tilename, data)
end
-- Fills a region of the world Terrain with the selected block.
-- Arguments:
-- x1, y1, z1 is the first corner of the region.
-- x2, y2, z2 is the second corner of the region.
-- tilename is the tilename of the block you want to use.
-- data is the metadata number of the block.
-- Returns the number of blocks changed in the world.
function API.buildBlocksInRegion(x1, y1, z1, x2, y2, z2, tilename, data)
end
Edited on 27 October 2015 - 05:35 PM
how2doit #2
Posted 15 October 2015 - 09:55 PM
Next time put a link to that instead of just putting it right here, or at least make it a spoiler.
how2doit #3
Posted 15 October 2015 - 10:03 PM
It doesn't do anything
Bomb Bloke #4
Posted 15 October 2015 - 10:14 PM
With what code did you try to "use" it?
FUNCTION MAN! #5
Posted 17 October 2015 - 07:19 PM
He tried to use the API doc.
Yarillo #6
Posted 18 October 2015 - 12:58 AM
It was to be expected tbh.
FUNCTION MAN! #7
Posted 18 October 2015 - 02:08 AM
Giant wall of code in the OP, people are going to think it's the actual API. ESPECIALLY when your docs are valid lua.
Edited on 18 October 2015 - 12:08 AM
Tag365 #8
Posted 27 October 2015 - 06:35 PM
The API does actually exist. As I said, you must use "pastebin get pHxpJAws" in the shell to get the API.
Edited on 27 October 2015 - 05:36 PM