5.5 KiB
Code Documentation for Lazarr!
This file documents the code of this game. This file is still in WIP.
Coding rules
Some general rules for developing this game apply:
Nodes:
- All nodes incompatible with lasers MUST have
the
laser_incompatible=1
group (see below) - Nodes MUST NOT drop multiple items (for
lzr_protection
)
Lasers: 3) The "ends" of any laser node MUST NOT be visibly exposed to the player; they MUST either connect to another laser beam, or touch the side of a laser-compatible node. 3a) Rule 3 does not apply in the editor 4) All lasers SHOULD look like a clean continuous beam; there SHOULD NOT be visible seams between laser nodes or anywhere else 5) The 3 primary laser colors are red, green and blue 6) Secondary colors are created by mixing: red + green = yellow, red + blue = magenta, green + blue = cyan, red + green + blue = white. 7) Two colors are mixed by doing a logical OR between their primary color components. For example, red + yellow = yellow because yellow is made out of red and green.
Levels:
8) Levels must not use nodes with the laser_incompatible
group
9) Levels must have exactly one teleporter in off state
10) Levels must have at least one treasure chest
11) Player must not get stuck in a hole or be able to
escape the level bounds (you may use lzr_core:barrier
for the boundaries)
Laser compatibility
A node is said to be 'laser-compatible' when the visible laser beam will never end at a gap when it collides with the node from any side. Opaque full-cube nodes are laser-compatible, while air is laser-incompatible. Other drawtypes may or may not be compatible, depending on their shape and texture. To see if a node is compatible, shoot a laser to each of the node's sides. If the "end" of the laser is visibly exposed, i.e. not touching the node's visual border, it is incompatible. Otherwise, it is compatible.
Incompatible nodes are thus nodes where when the laser collides, there is a visible gap between the laser beam and the visual node.
Exception: If the node is immediately destroyed on contact or transformed into a compatible node, it counts as compatible.
Incompatible nodes can be also made compatible by adding
variants of the node with a laser beam inside of them,
and adding them as laser blocks in lzr_laser
.
This is done for slabs and panes, for example.
Function reference
TODO
Node special fields reference
This is a list of special fields for node definitions that Lazarr! recognizes:
_lzr_active
: If the node has an 'active' counterpart, this contains the itemstring of that 'active' counterpart. Used by blocks that interact with laser_lzr_inactive
: If the node has an 'inactive' counterpart, this contains the itemstring of that 'inactive' counterpart. Used by blocks that interact with laser_lzr_on_toggle(pos, node)
: Function is called when a special tool is used on this node.pos
is node position andnode
is node table_lzr_unlock(pos, node)
: Function is called on chests to unlock it.pos
is node position andnode
is node table_lzr_send_treasure(pos, node)
: Function is called on open chests with treasure to start an animation that "sends" the treasure into the sky. Used when a level is completed.pos
is node position andnode
is node table
Node groups reference
This is a reference of all groups used for nodes.
Digging groups
breakable=1
: Node is breakable with Ultra Pickaxepunchdig=1
: Node breaks when punchedtakable=1
: Node can be taken by player to be placed somewhere else
Gameplay groups
rotatable
: Node is rotatable by hook item1
: Always rotatable2
: Rotatable if takable, or if in editor/menu3
: Rotatable in editor/menu only
laser_destroys
: Node is destroyed when a laser touches it1
: Immediate destruction2
: Node catches fire first, then is destroyed._lzr_active
must contain the name of the burning variant. The burning variant in turn must have_lzr_inactive
laser_incompatible=1
: The node is "incompatible" with lasers. (see above)flammable=1
: Node catches fire from neighboring burning blocks
Laser node groups
laser=X
: Node is a laser node, consisting of 1 to 3 laser beams (X = number uniquely identifying each possible combination of laser axes and colors) (not including blocks that interact with lasers like mirrors)laser_block=1
: Node interacts with laser
Laser blocks
Group rating 1 is for the inactive state, group rating 2 is for the active state.
emitter
: Emitterdetector
: Detectorcrystal
: Crystalmirror
: Mirror (normal)transmissive_mirror
: Transmissive Mirrorhollow_barrel
: Hollow barrelshy_skull
: Shy Skullcursed_skull
: Cursed Skull
Misc. categorization groups
treasure=1
: Treasureteleporter
: Teleporter1
: Off2
: On
chest
: Chest1
: closed, unlocked2
: closed, locked3
: open, empty4
: open, with treasure
chest_closed=1
: Closed chestchest_open=1
: Open chestchest_open_treasure=1
: Open chest with treasurewater=3
: Waterliquid=3
: Node is a liquid in a semantic sensepane=1
: Pane (flat window-like block)stair=1
: Stairslab=1
: Slabcrate=1
: Crateskull=1
: Any skull (cursed or shy)
Item groups reference
This is a reference of groups for all items that are not nodes.
pickaxe=1
: Pickaxebucket=1
: Bucketcheat_item=1
: Item is not supposed to be used in normal gameplay (e.g. for editor)