Core scripts used for an in-game building system I am working on.
Very much a work in progress.
A support point defines a point on a structure that either requires support or provides outgoing support.
A structure is an in game representation of a building element. e.g foundation, post, beam etc.
A structure must have support at it's required support points or else it will collapse.
A structure preview is a visualisation of structure to be positioned in the world.
A structure preview can only be placed if the supports it requires are present in the world.
A support maintains a heap of structures and the support value they provide at that position
The support value at the top of the heap will be the greatest value.
The registered structures are alerted to any changes made to the support value and react accordingly.
A build manager maintains an octree of all the supports created by a player.
This restricts the player to only placing structures on their own buildings
https://www.youtube.com/watch?v=jgyNRN919w4
Snapping structures together at specific support points while previewing a structure needs work.
Visual feedback for the player on whether the placement of a structure preview is valid.
Saving and loading of structures and support points needs to be implemented.