Skip to main content

Module placing

Module placing 

Source
Expand description

Takes care of the placing functionality of the track editor.

Implemented using bevyโ€™s state machines. The current shape and current step are tracked via their respective states, CurrentShape and CurrentStep. Keybinds change states and systems responding to state changes change the virtual node, segment, etc. Observers are then used to change between virtual and physical from/to node types.

Modulesยง

gizmos ๐Ÿ”’
input_handlers ๐Ÿ”’
move_to_cursor ๐Ÿ”’
observers ๐Ÿ”’
states ๐Ÿ”’

Structsยง

FromNodeType ๐Ÿ”’
Used to determine whether to place the segment from a physical node or the virtual one (cursor position).
LastConnectedBlock ๐Ÿ”’
Keeps track of the last connected block so that segments which either do not have any node to take blocks from or the choice of a block would be too ambiguous can join this one.
Placing ๐Ÿ”’
Marker component for entities which pertain to this editor.
PlacingPlugin
VirtualNode ๐Ÿ”’
A virtual track node. Used to provide the user visual feedback on where the next node is going to be placed.
VirtualSegment ๐Ÿ”’
A virtual track segment. Stores the information needed to place a new track segment, like its neighbouring nodes and current shape.

Enumsยง

NodeType ๐Ÿ”’
A node type. Used together with FromNodeType and in the VirtualSegment to determine if the node is a virtual one (currently not existing and needing to be placed), or a physical one (already placed).

Functionsยง

register_state_handlers ๐Ÿ”’
take_points ๐Ÿ”’
update_state_text ๐Ÿ”’