BuildNode: Difference between revisions

From Crumbled World Wiki
(Created page with "{{:BuildNodeNodeExampleCode}} ==Inheritance== SceneNode ==Static functions== {| class="wikitable" !|return !|function !|description |- |BuildNode |new() |Create a new Instance of the the BuildNode |- |} ==Functions== {| class="wikitable" !|return !|function !|description |- | |addPath(SceneNode island1, Vec3 localIslandP...")
 
 
(One intermediate revision by the same user not shown)
Line 72: Line 72:
|{SceneNode()}
|{SceneNode()}
|[[BuildNode:getBuildingList()|getBuildingList]]()
|[[BuildNode:getBuildingList()|getBuildingList]]()
|
|-
|{SceneNode()}
|[[BuildNode:getAllBuildingFromPoint(Vec3 position, float radius)|getAllBuildingFromPoint]](Vec3 position, float radius)
|
|
|-
|-
Line 86: Line 90:
|
|
|-
|-
|{ }
|{ navMeshPosition=Vec3(), rotation=float, islandId=float, towerLocalIslandMatrix=Matrix(), towerScriptName=string }
|[[BuildNode:getBuildInfo()|getBuildInfo]]()
|[[BuildNode:getBuildInfo()|getBuildInfo]]()
|This function can only be called after a building has been placed. Returns a table with information to build the tower again in the same location.
|This function can only be called after a building has been placed. Returns a table with information to build the tower again in the same location.

Latest revision as of 07:32, 5 August 2025

BuildNodeNodeExampleCode

Inheritance

SceneNode

Static functions

return function description
BuildNode new() Create a new Instance of the the BuildNode

Functions

return function description
addPath(SceneNode island1, Vec3 localIslandPosition1, SceneNode island2, Vec3 localIslandPosition2) Add a protected path that can't be built ower.
addProtectedPoint(SceneNode island, Vec3 localIslandPosition) Add a protected point where nothinge can be built.
addProtectedLine(SceneNode island, Vec3 point1, Vec3 point2) Add a protected Line on witch no tower can be built.
addProtectedLine(SceneNode island, Line3D localLine) Add a protected Line on witch no tower can be built.
bool tryToSnapBuildingInToPlace(SceneNode building, SceneNode collisionNode, Vec3 global pos, float yRotation)
bool removeBuilding(SceneNode buildNode)
Island getTargetIsland()
Matrix getLocalIslandMatrix()
SceneNode TryToBuild() Return the buildings SceneNode when the building is built else return nil.
bool activatePathRender()
bool clearBuildings() Try to remove all buildings from the BuildNode. Return true if all buildings was successfully removed.
bool sellBuilding(SceneNode buildingNode) Try to sell a building from the BuildNode. Return true if the building was successfully removed.
{SceneNode()} getBuildingList()
{SceneNode()} getAllBuildingFromPoint(Vec3 position, float radius)
SceneNode getBuldingFromLine(Line3D line)
SceneNode getNearestBuildingFromLine(Line3D line) Return the nearest building from the given line. return nil when there is no tower created.
Matrix getCurrentGlobalTowerMatrix()
{ navMeshPosition=Vec3(), rotation=float, islandId=float, towerLocalIslandMatrix=Matrix(), towerScriptName=string } getBuildInfo() This function can only be called after a building has been placed. Returns a table with information to build the tower again in the same location.
SceneNode buildFromBuildInfo(SceneNode building, table buildInfo) Return the buildings SceneNode when the building is built else return nil. buildInfo is the table created by the getBuildInfo() function.
{ { island=Island(), position=Vec3()} } getProtectedPoints() This function return all protected points. in following format { {island=Island(),position=Vec3()}, ... }
{ { { island=Island(), position=Vec3()} } } getProtectedLines() This function return all protected lines. in following format { { {island=Island(),position=Vec3()}, {island=Island(),position=Vec3()} }, ... }, allLines(line(p1, p2))
{ { { island=Island(), position=Vec3()} } } getProtectedPaths() This function return all protected paths. in following format { { {island=Island(),position=Vec3()}, {island=Island(),position=Vec3()} }, ... }, allLines(line(p1, p2))