Class: BuildRestrictions

BuildRestrictions()

new BuildRestrictions()

Source:

Methods

CheckPlacement()

Checks whether building placement is valid 1. Visibility is not hidden (may be fogged or visible) 2. Check foundation a. Doesn't obstruct foundation-blocking entities b. On valid terrain, based on passability class 3. Territory type is allowed (see note below) 4. Dock is on shoreline and facing into water 5. Distance constraints satisfied Returns result object: { "success": true iff the placement is valid, else false "message": message to display in UI for invalid placement, else "" "parameters": parameters to use in the GUI message "translateMessage": always true "translateParameters": list of parameters to translate "pluralMessage": we might return a plural translation instead (optional) "pluralCount": plural translation argument (optional) } Note: The entity which is used to check this should be a preview entity (template name should be "preview|"+templateName), as otherwise territory checks for buildings with territory influence will not work as expected.
Source: