Skip to content

builder_util

Source: base/tealdef/mission/builder_util.d.tl

Notes

Small geometry helpers for checking build proposals in mission tasks.

BuilderUtil

record global base/tealdef/mission/builder_util.d.tl:3

global record BuilderUtil

Load: local builder_util = ug_require "/mission/builder_util.tl"

Notes

Geometry helpers for checking build proposals.

Functions

anglediff(alpha : number, beta : number) : number base/tealdef/mission/builder_util.d.tl:4

Call as builder_util.anglediff

Notes

Returns the absolute difference between two angles, wrapped to 0..pi.

Parameter Type Description
alpha number Angle in radians.
beta number Angle in radians.

Returns number: Difference in radians.

closeEnough(transf : Mat4f, goal : Vec2f, tol? : number) : boolean base/tealdef/mission/builder_util.d.tl:5

Call as builder_util.closeEnough

Notes

Tells whether the translation of a transformation is near a 2D point.

Parameter Type Description
transf Mat4f Transformation.
goal Vec2f Target position.
tol? number Tolerance in metres (default 12).

Returns boolean: true if closer than the tolerance.

Used in the base game: 1 time in 1 file

base/content/mission/mission/tasks/build_construction/mission_task_build_construction_util.tl:313

local ce = builder_util.closeEnough(con.transf, api.type.Vec2f.new(targetPosX, targetPosY), targetMaxDist)

segments2nodes(segments : {Proposal.SegmentAndEntity}, newnodes? : {Proposal.NodeAndEntity}) : {Engine.Entity : Engine.Component.BaseNode} base/tealdef/mission/builder_util.d.tl:6

Call as builder_util.segments2nodes

Notes

Collects the end nodes of proposal segments with their node components; new (negative) nodes are looked up in newnodes.

Parameter Type Description
segments {Proposal.SegmentAndEntity} Proposal segments.
newnodes? {Proposal.NodeAndEntity} New nodes of the proposal.

Returns {Engine.Entity : Engine.Component.BaseNode}: Node entity -> base-node component.

Used in the base game: 1 time in 1 file

base/content/mission/mission/tasks/build_construction/mission_task_build_construction_util.tl:290

local nodes = builder_util.segments2nodes(proposal.proposal.addedSegments, proposal.proposal.addedNodes)