Skip to content

RuleResult

Results from placement rule validation.

RuleResult encapsulates the outcome of evaluating a placement rule, storing validation issues, success state, and contextual information for debugging and logging. The class supports both incremental construction (for building issues during validation) and complete construction (for finished results). Success is determined by the absence of validation issues, making the result self-documenting and suitable for build logs and user feedback systems.

rule: PlacementRule

The rule that was tested.

issues: Array[String] = []

Issues found during validation.

func _init( p_rule: PlacementRule ) -> void

Creates a basic rule result for incremental building during validation. Use this when you need to build up issues gradually during rule evaluation. p_rule: The placement rule being tested. Cannot be null.

static func build( p_rule: PlacementRule, p_issues: Array[String] ) -> RuleResult

Factory for creating a finished rule result. Creates an immutable result with all validation data complete. p_rule: The rule that was tested p_issues: Issues found during validation p_reason: Reason for success or failure

func add_issue( p_issue: String ) -> void

Adds a single validation issue to the result. p_issue: A descriptive validation issue. Should not be empty.

func add_issues( p_issues: Array[String] ) -> void

Adds multiple validation issues to the result. p_issues: Array of descriptive validation issues. Should not be null.

func is_successful( ) -> bool

Returns whether the rule validation was successful. A rule is considered successful if no validation issues were found.

func is_empty( ) -> bool

Backward compatibility shim expected by legacy validation code which called is_empty on RuleResult

func get_issues( ) -> Array[String]

Convenience accessor returning all issues (alias)

addons/grid_building/placement/placement_rules/rule_result.gd


This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.