Skip to content

mission_task_build_construction_util

Source: base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl

Notes

Proposal checks used by the build-construction task and by other tasks that filter what the player may build.

Globals

Types

Name Definition Description
MissionInterface declared here, defined in MissionInterface Namespace of the core mission-framework types. A mission is a list of tasks; each task is run by a TaskScript and described by static data.

BuildConstructionUtil

record global base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:5

global record BuildConstructionUtil

Load: local build_construction_util = ug_require "::/mission/tasks/build_construction/mission_task_build_construction_util.tl"

Notes

Proposal checks for mission tasks. Each checkX tests one property of a build proposal; each makeCheckX returns that check as a function for a HandleProposalEventConfig field.

Details

A check returns true when the proposal passes. Otherwise it returns the failureResult given to it (shown to the player) or false/nil, which makes the handler ignore the proposal. The handler runs the checks in this order: checkBuilderId, checkSignal, checkSignalLocation, checkSignalDirection, checkStop, checkStopLocation, checkConstruction, checkLocation, checkRestrictedArea, checkSnapping. The first check that does not pass decides.

Functions

makeProposalHandlerFilterApply(filterApply : BuildConstructionUtil.HandleProposalEventConfig<any>, whitelist : boolean) : ProposalHandlerConfig base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:13

Call as build_construction_util.makeProposalHandlerFilterApply

Notes

Uses the same checks for previews and for applied proposals.

Parameter Type Description
filterApply BuildConstructionUtil.HandleProposalEventConfig<any> Checks to use.
whitelist boolean Marks passing results as whitelist results.

Returns ProposalHandlerConfig: Proposal handler config.

Used in the base game: 13 times in 6 files

base/content/mission/mission/tutorial/tutorial_story.tl:379

proposalHandler = build_construction_util.makeProposalHandlerFilterApply({
base/content/mission/mission/tutorial/tutorial_story_util.tl:80
return build_construction_util.makeProposalHandlerFilterApply({
mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:201
return build_construction_util.makeProposalHandlerFilterApply({
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story_cutscenes_only.tl:55
return build_construction_util.makeProposalHandlerFilterApply({
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story.tl:775
proposalHandler = build_construction_util.makeProposalHandlerFilterApply({
mods/release/urbangames_campaign_mission_04/content/mission/mission/mission_story.tl:395
proposalHandler = build_construction_util.makeProposalHandlerFilterApply({

checkStreetTerminalBuilderId<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>, failureResult : MissionInterface.ProposalHandlerResult) : boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:38

Call as build_construction_util.checkStreetTerminalBuilderId

Notes

Passes proposals of the street-stop tool (streetTerminalBuilder).

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams<TaskContext> Proposal event.
failureResult MissionInterface.ProposalHandlerResult Result for other tools.

Returns boolean: true, or failureResult (false if not set).

makeCheckStreetTerminalBuilderId(failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:39

Call as build_construction_util.makeCheckStreetTerminalBuilderId

Notes

Returns checkStreetTerminalBuilderId bound to a failure result.

Parameter Type Description
failureResult MissionInterface.ProposalHandlerResult Result for other tools.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : boolean: Check function.

Used in the base game: 3 times in 3 files

base/content/mission/mission/tutorial/tutorial_story_util.tl:81

checkBuilderId = build_construction_util.makeCheckStreetTerminalBuilderId({ error = _("Not a Stop!") }),
mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:202
checkBuilderId = build_construction_util.makeCheckStreetTerminalBuilderId({ error = _("Not a signal!") }),
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story_cutscenes_only.tl:56
checkBuilderId = build_construction_util.makeCheckStreetTerminalBuilderId({ error = _("Not a Stop!") }),

checkConstructionBuilderId<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>, failureResult : MissionInterface.ProposalHandlerResult) : boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:41

Call as build_construction_util.checkConstructionBuilderId

Notes

Passes proposals of the construction tool (constructionBuilder).

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams<TaskContext> Proposal event.
failureResult MissionInterface.ProposalHandlerResult Result for other tools.

Returns boolean: true, or failureResult (false if not set).

makeCheckConstructionBuilderId(failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:42

Call as build_construction_util.makeCheckConstructionBuilderId

Notes

Returns checkConstructionBuilderId bound to a failure result.

Parameter Type Description
failureResult MissionInterface.ProposalHandlerResult Result for other tools.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : boolean: Check function.

Used in the base game: 7 times in 3 files

base/content/mission/mission/tutorial/tutorial_story.tl:380

checkBuilderId = build_construction_util.makeCheckConstructionBuilderId({ error = _("Pick the Headquarters!") }),
mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:740
checkBuilderId = build_construction_util.makeCheckConstructionBuilderId({ error = _("MISSION_PROPOSAL_FEEDBACK_NOT_A_ROAD_DEPOT") }),
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story.tl:776
checkBuilderId = build_construction_util.makeCheckConstructionBuilderId({ error = _("MISSION_PROPOSAL_FEEDBACK_NOT_A_ROAD_DEPOT") }),

checkSignal<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, failureResult : MissionInterface.ProposalHandlerResult) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:45

Call as build_construction_util.checkSignal

Notes

Passes a proposal that replaces one segment and adds exactly one edge object, a signal.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns MissionInterface.ProposalHandlerResult | boolean: true or failureResult.

makeCheckSignal(failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:46

Call as build_construction_util.makeCheckSignal

Notes

Returns checkSignal bound to a failure result.

Parameter Type Description
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 1 time in 1 file

mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:203

checkSignal = build_construction_util.makeCheckSignal({ error = _("Not a signal!") }),

checkSignalLocation<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, baseEdgeEntities : {Engine.Entity}, failureResult : MissionInterface.ProposalHandlerResult) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:48

Call as build_construction_util.checkSignalLocation

Notes

Passes a proposal that adds one signal on one of the given edges.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
baseEdgeEntities {Engine.Entity} Allowed edges.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns MissionInterface.ProposalHandlerResult | boolean: true or failureResult.

makeCheckSignalLocation(baseEdgeEntities : {Engine.Entity}, failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:49

Call as build_construction_util.makeCheckSignalLocation

Notes

Returns checkSignalLocation bound to its arguments.

Parameter Type Description
baseEdgeEntities {Engine.Entity} Allowed edges.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 1 time in 1 file

mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:204

checkSignalLocation = build_construction_util.makeCheckSignalLocation(edges, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_IN_OUTLINED_AREA") }),

checkSignalDirection<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, baseEdgeEntitiesAndLeft : {Engine.Entity : boolean}, failureResult : MissionInterface.ProposalHandlerResult) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:51

Call as build_construction_util.checkSignalDirection

Notes

Passes a proposal that adds one signal on one of the given edges, on the required side.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
baseEdgeEntitiesAndLeft {Engine.Entity : boolean} Allowed edge -> required left flag of the signal.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns MissionInterface.ProposalHandlerResult | boolean: true or failureResult.

makeCheckSignalDirection(baseEdgeEntitiesAndLeft : {Engine.Entity : boolean}, failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:52

Call as build_construction_util.makeCheckSignalDirection

Notes

Returns checkSignalDirection bound to its arguments.

Parameter Type Description
baseEdgeEntitiesAndLeft {Engine.Entity : boolean} Allowed edge -> required left flag.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 1 time in 1 file

mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:205

checkSignalDirection = build_construction_util.makeCheckSignalDirection(edgesAndLeft, { error = _("Signal direction is wrong!") }),

checkStop<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, failureResult : MissionInterface.ProposalHandlerResult) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:54

Call as build_construction_util.checkStop

Notes

Passes a proposal that replaces one segment and adds one or two street stops.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns MissionInterface.ProposalHandlerResult | boolean: true or failureResult.

makeCheckStop(failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:55

Call as build_construction_util.makeCheckStop

Notes

Returns checkStop bound to a failure result.

Parameter Type Description
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 2 times in 2 files

base/content/mission/mission/tutorial/tutorial_story_util.tl:82

checkStop = build_construction_util.makeCheckStop({ error = _("Not a Station!") }),
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story_cutscenes_only.tl:57
checkStop = build_construction_util.makeCheckStop({ error = _("Not a Station!") }),

checkStopLocation<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, baseEdgeEntities : {Engine.Entity}, failureResult : MissionInterface.ProposalHandlerResult) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:57

Call as build_construction_util.checkStopLocation

Notes

Passes a proposal that adds one or two street stops on one of the given edges.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
baseEdgeEntities {Engine.Entity} Allowed edges.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns MissionInterface.ProposalHandlerResult | boolean: true or failureResult.

makeCheckStopLocation(baseEdgeEntities : {Engine.Entity}, failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:58

Call as build_construction_util.makeCheckStopLocation

Notes

Returns checkStopLocation bound to its arguments.

Parameter Type Description
baseEdgeEntities {Engine.Entity} Allowed edges.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 2 times in 2 files

base/content/mission/mission/tutorial/tutorial_story_util.tl:83

checkStopLocation = build_construction_util.makeCheckStopLocation(edges, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_IN_OUTLINED_AREA") }),
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story_cutscenes_only.tl:58
checkStopLocation = build_construction_util.makeCheckStopLocation(edges, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_IN_OUTLINED_AREA") }),

checkConstruction<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, conFileName : string, hasCargoPlatform : boolean, failureResult : MissionInterface.ProposalHandlerResult, customCheck? : function(Proposal.ConstructionEntity) : boolean) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:62

Call as build_construction_util.checkConstruction

{ error = _("MISSION_PROPOSAL_FEEDBACK_NOT_A_CARGO_ROAD_STATION") }

Notes

Passes a proposal whose first new construction has the given file, passes customCheck and, if hasCargoPlatform is not nil, has that cargo-platform flag.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
conFileName string Required construction file.
hasCargoPlatform boolean Required cargo-platform flag; nil accepts both.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.
customCheck? function(Proposal.ConstructionEntity) : boolean Extra test of the proposed construction.

Returns MissionInterface.ProposalHandlerResult | boolean: true, or failureResult (false if not set).

makeCheckConstruction(conFileName : string, hasCargoPlatform : boolean, failureResult : MissionInterface.ProposalHandlerResult, customCheck? : function(Proposal.ConstructionEntity) : boolean) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:63

Call as build_construction_util.makeCheckConstruction

Notes

Returns checkConstruction bound to its arguments.

Parameter Type Description
conFileName string Required construction file.
hasCargoPlatform boolean Required cargo-platform flag; nil accepts both.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.
customCheck? function(Proposal.ConstructionEntity) : boolean Extra test of the proposed construction.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 8 times in 4 files

base/content/mission/mission/tutorial/tutorial_story.tl:381

checkConstruction = build_construction_util.makeCheckConstruction("::/landmarks/hq/headquarter.con", nil, { error = _("Pick the Headquarters!") }),
mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:741
checkConstruction = build_construction_util.makeCheckConstruction("::/depots/road/road_depot/road_depot.con", nil, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_A_
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story.tl:777
checkConstruction = build_construction_util.makeCheckConstruction("::/depots/road/road_depot/road_depot.con", nil, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_A_
mods/release/urbangames_campaign_mission_04/content/mission/mission/mission_story.tl:396
checkConstruction = build_construction_util.makeCheckConstruction(params.toiletCon, nil, { error = _("Not a toilet!") }),

checkSnapping<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, snapAnyOf : {Engine.Entity}, failureResult : MissionInterface.ProposalHandlerResult) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:66

Call as build_construction_util.checkSnapping

{ error = _("MISSION_PROPOSAL_FEEDBACK_NOT_CONNECTED_TO_CROSSING") }

Notes

Passes a proposal whose new segments use one of the given existing nodes, or any existing node when the list is empty.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
snapAnyOf {Engine.Entity} Nodes of which one must be used.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns MissionInterface.ProposalHandlerResult | boolean: true, or failureResult (false if not set).

makeCheckSnapping(snapAnyOf : {Engine.Entity}, failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:67

Call as build_construction_util.makeCheckSnapping

Notes

Returns checkSnapping bound to its arguments.

Parameter Type Description
snapAnyOf {Engine.Entity} Nodes of which one must be used; empty or nil accepts any existing node.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 4 times in 3 files

base/content/mission/mission/tutorial/tutorial_story.tl:783

checkSnapping = build_construction_util.makeCheckSnapping({}, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_CONNECTED_TO_STREET") }),
mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:743
checkSnapping = build_construction_util.makeCheckSnapping({}, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_CONNECTED_TO_STREET") }),
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story.tl:779
checkSnapping = build_construction_util.makeCheckSnapping({}, { error = _("MISSION_PROPOSAL_FEEDBACK_NOT_CONNECTED_TO_STREET") }),

checkLocation<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, targetPosX : number, targetPosY : number, targetMaxDist : number, failureResult : MissionInterface.ProposalHandlerResult) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:71

Call as build_construction_util.checkLocation

{ error = _("MISSION_PROPOSAL_FEEDBACK_NOT_IN_OUTLINED_AREA") } targetDist = 20

Notes

Passes a proposal whose first new construction is within targetMaxDist metres of the target position.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
targetPosX number Target x position.
targetPosY number Target y position.
targetMaxDist number Maximum distance in metres.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns MissionInterface.ProposalHandlerResult | boolean: true, or failureResult (false if not set).

makeCheckLocation(targetPosX : number, targetPosY : number, targetMaxDist : number, failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:72

Call as build_construction_util.makeCheckLocation

Notes

Returns checkLocation bound to its arguments.

Parameter Type Description
targetPosX number Target x position.
targetPosY number Target y position.
targetMaxDist number Maximum distance in metres.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 6 times in 3 files

mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:742

checkLocation = build_construction_util.makeCheckLocation(params.streetDepotZone.pos[1], params.streetDepotZone.pos[2], 20, { error = _("MISSION_PROPOSAL_FEEDBA
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story.tl:778
checkLocation = build_construction_util.makeCheckLocation(params.streetDepotZone.pos[1], params.streetDepotZone.pos[2], 20, { error = _("MISSION_PROPOSAL_FEEDBA
mods/release/urbangames_campaign_mission_04/content/mission/mission/mission_story.tl:397
checkLocation = build_construction_util.makeCheckLocation(params.toiletCenter[1], params.toiletCenter[2], 500, { error = _("Build the toilets near the campgroun

makeCheckLocations(tagetPositions : {{number, number}}, targetMaxDist : number, failureResult : MissionInterface.ProposalHandlerResult) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:73

Call as build_construction_util.makeCheckLocations

Notes

Returns a check that passes when the construction is near any of several positions.

Parameter Type Description
tagetPositions {{number, number}} Target positions {x, y}.
targetMaxDist number Maximum distance in metres.
failureResult MissionInterface.ProposalHandlerResult Result otherwise.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

checkRestrictedArea<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams, areas : {PolygonUtil.Polygon}, failureResult : MissionInterface.ProposalHandlerResult, allowStreetTerminalBuilder? : boolean) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:75

Call as build_construction_util.checkRestrictedArea

Notes

Blocks proposals that build, bulldoze or add nodes inside the areas, and every tool other than construction, bulldozer, track and street builder.

Parameter Type Description
event BuildConstructionUtil.HandleProposalEventParams Proposal event.
areas {PolygonUtil.Polygon} Restricted polygons.
failureResult MissionInterface.ProposalHandlerResult Result for changes inside the areas.
allowStreetTerminalBuilder? boolean Also allows the street-stop tool.

Returns MissionInterface.ProposalHandlerResult | boolean: true, failureResult, or an error result for other tools.

makeRestrictedArea(areas : {PolygonUtil.Polygon}, failureResult : MissionInterface.ProposalHandlerResult, allowStreetTerminalBuilder? : boolean) : function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:76

Call as build_construction_util.makeRestrictedArea

Notes

Returns checkRestrictedArea bound to its arguments.

Parameter Type Description
areas {PolygonUtil.Polygon} Restricted polygons.
failureResult MissionInterface.ProposalHandlerResult Result for changes inside the areas.
allowStreetTerminalBuilder? boolean Also allows the street-stop tool.

Returns function<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean: Check function.

Used in the base game: 2 times in 1 file

mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:358

checkRestrictedArea = build_construction_util.makeRestrictedArea(params.restrictedAreaPolygons, { error = _("MISSION_PROPOSAL_FEEDBACK_RESTRICTED_AREA") }, true

handleConstructionProposal<TaskContext>(event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>, config : HandleProposalEventConfig<TaskContext>, taskApi : MissionInterface.DeferredTaskApi, isWhitelist : boolean) : MissionInterface.ProposalHandlerResult base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:80

Call as build_construction_util.handleConstructionProposal

this is the 'master' function for 'builder.proposalCreate'

Returns MissionInterface.ProposalHandlerResult

Used in the base game: 2 times in 1 file

base/content/mission/mission/tasks/build_construction/build_construction.tl:42

return build_construction_util.handleConstructionProposal(event, config as BuildConstructionUtil.HandleProposalEventConfig<TaskContext>, taskApi, proposalHandle

BuildConstructionUtil.ProposalHandlerConfig

record base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:7

record ProposalHandlerConfig

Notes

Checks used for proposal previews (filter) and for applied proposals (success).

Used in the base game: 5 times in 5 files

base/content/mission/mission/tutorial/tutorial_story_util.tl:79

tutorial_story_util.makeStopConfig = function(edges : {Engine.Entity}) : BuildConstructionUtil.ProposalHandlerConfig
base/content/mission/mission/tasks/build_construction/mission_task_build_construction_util.tl:399
function build_construction_util.makeProposalHandlerFilterApply(filterApply : BuildConstructionUtil.HandleProposalEventConfig<any>, whitelist : boolean) : Build
base/content/mission/mission/tasks/build_construction/build_construction.tl:27
local handleProposal = function(proposalHandler : BuildConstructionUtil.ProposalHandlerConfig,
mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:196
local makeSignalConfig = function(edgesAndLeft : {Engine.Entity : boolean}) : BuildConstructionUtil.ProposalHandlerConfig
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story_cutscenes_only.tl:54
local makeStopConfig = function(edges : {Engine.Entity}) : BuildConstructionUtil.ProposalHandlerConfig

Fields

Name Type Description
proposalApply BuildConstructionUtil.HandleProposalEventConfig<any> to detect success
proposalFilter BuildConstructionUtil.HandleProposalEventConfig<any> to disallow stuff
proposalFilterWhitelist boolean controls how multiple proposal handlers are combined

BuildConstructionUtil.HandleProposalEventParams

record base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:15

record HandleProposalEventParams<TaskContext>

Notes

A proposal event passed to the checks.

Used in the base game: 51 times in 2 files

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

event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>,
base/content/mission/mission/tasks/build_construction/build_construction.tl:28
event : BuildConstructionUtil.HandleProposalEventParams<TaskContext>,

Fields

Name Type Description
id string Id of the tool that made the proposal (e.g. constructionBuilder, streetTerminalBuilder, bulldozer, trackBuilder, streetBuilder).
name string Event name (builder.proposalCreate or builder.proposalApply).
param ProposalEventData Proposal, its data and, on apply, the result entities.
isApply boolean The proposal is being applied.
ctx TaskContext Context of the task.

BuildConstructionUtil.HandleProposalEventConfig

record base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:24

record HandleProposalEventConfig<TaskContext>

Notes

Set of checks; unset checks are skipped. The checkStreetTerminalBuilderId field is not read by the handler; use checkBuilderId with makeCheckStreetTerminalBuilderId.

Used in the base game: 5 times in 2 files

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

config : BuildConstructionUtil.HandleProposalEventConfig<TaskContext>,
base/content/mission/mission/tasks/build_construction/build_construction.tl:35
local config : BuildConstructionUtil.HandleProposalEventConfig<any> = nil

Functions

checkStreetTerminalBuilderId(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:25

return true if builder is ok, false/nil to skip, or if you like a specific message

Returns MissionInterface.ProposalHandlerResult | boolean

checkBuilderId(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:26

return true if builder is ok, false/nil to skip, or if you like a specific message

Returns MissionInterface.ProposalHandlerResult | boolean

checkConstruction(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:27

Notes

Checks the construction being built.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkSignal(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:28

Notes

Checks that the proposal adds a signal.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkSignalLocation(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:29

Notes

Checks where a signal is placed.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkSignalDirection(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:30

Notes

Checks the side of a signal.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkStop(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:31

Notes

Checks that the proposal adds a street stop.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkStopLocation(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:32

Notes

Checks where a street stop is placed.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkSnapping(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:33

Notes

Checks that new segments connect to existing nodes.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkLocation(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:34

Notes

Checks the position of the construction.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.

checkRestrictedArea(HandleProposalEventParams<TaskContext>) : MissionInterface.ProposalHandlerResult | boolean base/tealdef/mission/tasks/build_construction/mission_task_build_construction_util.d.tl:35

Notes

Blocks changes inside restricted areas.

Parameter Type Description
#1 HandleProposalEventParams<TaskContext> Proposal event.

Returns MissionInterface.ProposalHandlerResult | boolean: true, a failure result, or false/nil.