diff --git a/nodes.md b/nodes.md new file mode 100644 index 0000000..a979fc0 --- /dev/null +++ b/nodes.md @@ -0,0 +1,57 @@ +![Node edit mode](http://fg.wzff.de/pub/aquaria/wikidata/editmode-nodes.jpg) + +Nodes are scriptable points, regions, and paths that can be used for a variety of purposes. + +A node has a at least one point (the center point) and spans a rectangular or circular area. Additional path points can be added if needed. + +Example use cases: +* Place currents and steam +* Make entities or the camera follow a path +* Provide hints for nearby entities or other nodes +* Perform an action when an entity enters a region +* ... + +# In the map editor + +See [[Editor controls|editor-controls#node-edit-mode-f7]] for how to manipulate nodes. + +The only way to create or delete nodes is via the map editor. + + +# Builtin nodes + +The game recognizes certain node names and performs a built-in function. Some built-in functions take parameters, these follow after the node name (separated by spaces). + +* __seting *ingredient* *amount*__ - short for _set ingredient_; instructs certain entities covered by the node area to spawn the specified ingredient on some condition (e.g. song plants, pullable leaves). +* __setent *entityname*__ - short for _set entity_, instructs an entity to spawn another entity on some condition. +* __current *alpha*__ - places a current that follows the path. Must have at least 2 path points. `Alpha` is used to control transparency. The width of the node area controls the current thickness. Can be enabled or disabled via `node_setActive()`. +* __gem *gemname*__ - when Naija enters the area, a gem is placed on the minimap. +* __waterbubble__ - When placed in air, the covered area acts like it's filled with water. Can be enabled or disabled via `node_setActive()`. +* __cook__ - places a map gem when first entered. Can use 3 cooking slots when in the area. +* __zoom *amount* *time*__ - When Naija is inside the area, set map zoom to `zoom` over `time` seconds. +* __radarhide__ - When Naija is inside the area, the minimap is blacked out and the main map is blocked. +* __bgsfxloop *sound*__ - When Naija is inside the area, play `sound` in a loop. +* __savepoint__ - Node is displayed as a save point icon on the world map. The actual saving functionality is scripted. +* __steam *speed*__ - Similar to a __current__ node. Steam flows along the individual path points. Can be enabled or disabled with `node_setActive()`. +* __warpnode *map* *nodename* *flip*__ - When Naija is inside the area, warp to the node `nodename` on `map`. By default Naija will face left after the warp. Pass `flip` = 1 to face right. See [[warping between maps|map-warps]] for details. +* __warplocalnode *nodename* *type*__ - When Naija is inside the area, warp to `nodename` on the current map. `Type` can be "in" or "out". See [[warping between maps|map-warps]] for details. +* __warp *map* *type*__ - When Naija is inside the area, warp to the corresponding node on map `map`. See [[warping between maps|map-warps]] for details. +* __spiritportal *map* *nodename*__ - When Naija is inside the area, revert to normal form and warp to the node `nodename` on `map`. _This node type is never used by the game and likely a leftover from the development process._ +* __spiritbeacon__ - When Naija is inside the area and the spirit form beacon ability is used, revert to normal form in place ("teleport the body to the spirit"). +* __vox *file* *re*__ - When Naija is inside the area, play voice `file`. Once the voice was played a permanent entry is set in the save file and this node will never play again. To allow the voice to play again, pass anything as `re`. The node will be active again after the next map load. +* __voice *file* *re*__ - Alias for __vox__. +* __se *name* *distance* *number*__ - _"spawn enemy"_ - When Naija is not within `distance`, spawn `number` enemies of type `name`. _Compatibility note_: There is only one map in the vanilla game that uses this. Using this node is not recommended since [[it may cause problems with scripting|entity-scripting#function-postinitme]]. +* __pe *name*__ - _"particle effect"_ - This node continuously plays the specified particle effect. Commonly used: __pe bubbles01__. _Due to a bug the particle effect is updated twice per frame, resulting in twice the intensity. Since the vanilla maps were designed with this bug present, it is to be considered a feature_. The particle emitter can be enabled or disabled via `node_setActive()`. +* __naijastart__. Places Naija on this node if the map is entered without a set position. Used to position Naija on the starting map. Also useful to specify a default position to start at when loading the map in the editor. If not present, Naija is placed at position (0, 0) (upper left corner). + + +# Node scripts + +Each node may have an attached script. See [[Node scripting|node-scripting]] for details. + +The script is independent of the builtin function; both will be handled if present. A good example for this is the _savepoint_ node: The world map gem functionality is built-in, but the right-click activation is scripted. + +There is no way to disable built-in functionality, but some nodes can be toggled using `node_setActive()`. + +Nodes can not be deleted or created via scripting. Existing nodes can be moved via `node_setPosition(me, x, y)`, although it is not recommended since a node is permanently moved once the map is saved. +