Repository navigation
Basic API Usage part 1
On this page we will show you basic usage of this API.
Every mod needs in the file at the end of the file where the mod is loaded from it needs to return a table. That table needs a few properties. It needs a init property, and a update porperty. They have to be functions. There are also more properties it can have to make your mod do more things, but we will get on them later.
init and update need to be functions. init should have no parameters, as it gets none. init is called when the mod is first initialised, and typically it is the function that adds the cells. update is called for every modded cell from any mod that is updated. update should have 4 parameters, the cell id, the cell's x coordonate, the cell's y coordonate and the cell's rotation.
Keep in mind: All CelLua functions can be accessed by the mod and many variables can also be accessed and used normally.
Now, to add cells, you have to use addCell. addCell has a few arguments. addCell has, as arguments that need to be specified, the cell's label used to identify it better by other mods, the cell's texture file name, the function that defines if it can be pushed, a optional string that is its type of modded cell (like "mover", "enemy", "trash", "normal" etc.), a optional boolean that defines if it is invisible (invisible cells do not appear in the user's cell bar)
The function that defines if the cell can be pushed has a few arguments. They are: its x, its y, its rotation, the pushers x, the pushers y, the pushers rotation, and what type of pushing is happening. The types of pushing are: "push" for standard pushing with PushCell, "mirror" which means a mirror is moving this cell, "pull" which means it is moved by PullCell, "gear" which means a gear is moving it.