Version 1.3.2
[lazarr.git] / CODE_DOCUMENTATIION.md
bloba68028c9569ec66aac9e31e1e6d0f48f38c24da0
1 # Code Documentation for Lazarr!
2 This file documents the code of this game.
3 This file is still in WIP.
5 ## Function reference
6 TODO
8 ## Node special fields reference
9 This is a list of special fields for node definitions that Lazarr! recognizes:
11 * `_lzr_active`: If the node has an 'active' counterpart, this contains the
12     itemstring of that 'active' counterpart.
13     Used by blocks that interact with laser
14 * `_lzr_inactive`: If the node has an 'inactive' counterpart, this contains the
15     itemstring of that 'inactive' counterpart.
16     Used by blocks that interact with laser
17 * `_lzr_on_toggle(pos, node)`: Function is called when a special
18     tool is used on this node.
19   `pos` is node position and `node` is node table
20 * `_lzr_unlock(pos, node)`: Function is called on chests to unlock it.
21     `pos` is node position and `node` is node table
22 * `_lzr_send_treasure(pos, node)`: Function is called on open chests
23     with treasure to start an animation that "sends" the treasure into
24     the sky. Used when a level is completed.
25     `pos` is node position and `node` is node table
27 ## Node groups reference
28 This is a reference of all groups used for nodes.
30 ### Digging groups
31 * `breakable=1`: Node is breakable with Ultra Pickaxe
32 * `punchdig=1`: Node breaks when punched
33 * `takable=1`: Node can be taken by player to be placed somewhere else
35 ### Gameplay groups
36 * `rotatable`: Node is rotatable by hook item
37     * `1`: Always rotatable
38     * `2`: Rotatable if takable, or if in editor/menu
39     * `3`: Rotatable in editor/menu only
40 * `laser_destroys`: Node is destroyed when a laser touches it
41     * `1`: Immediate destruction
42     * `2`: Node catches fire first, then is destroyed.
43            `_lzr_active` must contain the name of the burning variant.
44            The burning variant in turn must have `_lzr_inactive`
45 * `flammable=1`: Node catches fire from neighboring burning blocks
47 ### Laser node groups
48 * `laser=X`: Node is a laser (X=bitmask of active laser axes)
49   (not including blocks that *contain* a laser like an active mirror)
50 * `laser_block=1`: Node interacts with laser
52 #### Laser blocks
53 Group rating 1 is for the inactive state, group rating 2 is for the active state.
55 * `emitter`: Emitter
56 * `detector`: Detector
57 * `crystal`: Crystal
58 * `mirror`: Mirror (normal)
59 * `transmissive_mirror`: Transmissive Mirror
60 * `crate`: Crate
62 ### Misc. categorization groups
63 * `treasure=1`: Treasure
64 * `teleporter`: Teleporter
65     * `1`: Off
66     * `2`: On
67 * `chest`: Chest
68     * `1`: closed, unlocked
69     * `2`: closed, locked
70     * `3`: open, empty
71     * `4`: open, with treasure
72 * `chest_closed=1`: Closed chest
73 * `chest_open=1`: Open chest
74 * `chest_open_treasure=1`: Open chest with treasure
75 * `water=3`: Water
76 * `liquid=3`: Node is a liquid in a semantic sense
77 * `pane=1`: Pane (flat window-like block)
78 * `stair=1`: Stair
79 * `slab=1`: Slab
81 ## Item groups reference
82 This is a reference of groups for all items that are not nodes.
84 * `pickaxe=1`: Pickaxe
85 * `bucket=1`: Bucket
86 * `cheat_item=1`: Item is not supposed to be used in normal gameplay (e.g. for editor)