Map extends MutableShape, adding functions and properties to it.
Map is not creatable, there's only one instance of it. It can only be accessed through its globally exposed variable.

Map is a global variable that represents the game map.

How to load a map for your game?

Config = {
  Map = "aduermael.rockies"
Config.Map = "aduermael.rockies"

(See Config for more details regarding Map & Items loading)


Adds a Block to the Map.

Returns created Block (or nil if it fails).

local block = Block(1, 10, 10, 10)

-- AddBlock can also be called using
-- block's palette index and coordinates:
someMutableShape:AddBlock(1, 10, 10, 10)

-- created block is returned:
local newBlock = someMutableShape:AddBlock(1, 10, 10, 10)
if newBlock ~= nil then
  -- block successfully created!

-- ⚠️
local block = Block(1, 10, 10, 10)
local newBlock = someMutableShape:AddBlock(block)
-- Here `newBlock` is not the same as `block`
-- they both have the same palette index and coordinates
-- but `newBlock` has a parent shape while `block` doesn't.
nil AddChild ( Object child )

Adds given Object as a child.

Object extensions like Shape or MutableShape are naturally accepted too.

local o = Object()
local myShape = Shape(Items.someuser.someitem)

Gets a Block from the Map.
Returns nil if there is no Block at the given coordinates (i. e. if it's "air").

nil GetChild ( number index )

Get child Object at index.

if o.ChildrenCount > 0 then
  print(o:GetChild(1)) -- prints first child

Unsets parent/child relationship with child parameter. The child ends up being deleted if it has no other references.


Unsets parent/child relationship with all children. Individual children end up being deleted if they have no other references.



Map's continuous acceleration.

Default value: {0,0,0}.

⚠️ Acceleration is nil and can't be set if Map.Physics is false.

-- Acceleration can be used to compensate gravity: 
myObject.Acceleration = -Config.ConstantAcceleration
-- myObject's acceleration is now the invert of 
-- Config.ConstantAcceleration, cancelling it.
number ChildrenCount read-only

Returns number of child Objects.

number Depth read-only

Returns Map's depth, measured in cubes.

number Height read-only

Returns Map's height, measured in cubes.

Returns an array of BlockProperties (Palette)

Note: non-opaque and light emissive block colors can't be changed after game start.

number Width read-only

Returns Map's width, measured in cubes.