Table of Contents

Class PlacementReport

Namespace
GridPlacement.GDScript
Assembly
MoonBark.GridPlacement.GDScript.dll

Comprehensive report for placement operation results and validation feedback.\n\nThe [b]PlacementReport[/b] class serves as a detailed snapshot of any placement attempt within the Grid Building system. It encapsulates all relevant information about build, move, or placement operations, providing a complete audit trail for debugging, logging, and user feedback.\n\n[br][br][b]Core Purpose:[/b][br] This class aggregates data from multiple sources to provide a unified view of:[br] - The entity performing the placement action[br] - The object being placed or manipulated[br] - Validation results from rule checking systems[br] - Any issues or problems encountered during the process[br] - Diagnostic notes for debugging and monitoring[br][br]\n\n[b]Primary Use Cases:[/b][br] - [b]Success Validation:[/b] Determine if a placement operation completed successfully[br] - [b]Error Reporting:[/b] Collect and present validation failures to users[br] - [b]Debugging Support:[/b] Provide detailed diagnostic information for developers[br] - [b]Audit Logging:[/b] Maintain records of all placement attempts and outcomes[br] - [b]System Integration:[/b] Pass placement results between different system components[br][br]\n\n[b]Architecture Integration:[/b][br] The report works closely with:[br] - [member indicators_report]: Results from RuleCheckIndicator validation[br] - [member placer]: The PlacementOwner entity initiating the placement[br] - [member preview_instance]: The Node2D being tested for placement validity[br][br]\n\n[b]Usage Example:[/b] [codeblock] # Create a placement report after attempting to build var report = PlacementReport.new(placer, preview, indicators_report, PlacementEnums.Action.BUILD)\n\n# Check if placement was successful if report.is_successful(): print("Placement completed successfully!") # Log successful placement for analytics log_placement_success(report) else: print("Placement failed: ", report.get_issues()) # Handle placement failure - show user feedback show_placement_errors(report) [/codeblock][br][br]\n\n[b]Key Properties:[/b][br] - [member placer]: The PlacementOwner entity responsible for initiating placement[br] - [member preview_instance]: The Node2D object being placed/tested[br] - [member indicators_report]: Validation results from IndicatorSetupReport[br] - [member action_type]: Type of placement action (PlacementEnums.Action)[br] - [member issues]: Array of error messages and validation failures[br] - [member notes]: Additional diagnostic information and metadata[br][br]\n\n[b]Thread Safety:[/b] This class is not thread-safe. All operations should be[br] performed on the main thread to ensure proper integration with Godot's scene system.[br][br]\n\n[b]Performance Notes:[/b] Reports are lightweight objects designed for frequent[br] creation during placement operations. Memory usage scales with the number of[br] issues and notes collected.[br][br]

class PlacementReport
PlacementReport

Properties

placer

PlacementOwner for the root entity responsible for placing the preview_instance into the game world. This represents the player, AI, or other entity that initiated the placement action.

var placer: PlacementOwner

preview_instance

The preview instance for the object being manipulated (built, placed, etc.). This is the Node2D that represents the object being tested for placement validity.

var preview_instance: Node

placed

The root of the placed object (if any). This should be set after successful placement

var placed: Node

indicators_report

The report from RuleCheckIndicator generation for the preview object. Contains detailed information about collision detection, rule validation, and indicator setup.

var indicators_report: IndicatorSetupReport

action_type

The type of action that was attempted for this placement. Indicates whether this was a BUILD, MOVE, or other type of placement operation.

var action_type: PlacementEnums.Action

issues

General setup issues encountered during the placement attempt. Contains error messages and validation failures that prevented successful placement.

var issues: Array[String] = []

notes

Additional notes collected at setup time (aggregated from indicator reports and validator). Contains diagnostic information and metadata about the placement process.

var notes: Array[String] = []

parts

var parts: Array[String] = []

all_issues

var all_issues: Array[String] = []

report

var report = PlacementReport.new(owner, target, null, action)

keys

var keys = validator_issues.keys()

first_key

var first_key = keys[0]

msgs

var msgs = validator_issues[first_key]

Methods

add_issue

func add_issue(p_issue : String) -> void:

Parameters

p_issue

Returns

add_note

func add_note(p_note : String) -> void:

Parameters

p_note

Returns

get_owner_root

func get_owner_root() -> Node:

Returns

to_verbose_string

func to_verbose_string() -> String:

Returns

is_successful

func is_successful() -> bool:

Returns

get_issues

func get_issues() -> Array[String]:

Returns

from_failed_validation

static func from_failed_validation(validator_issues: Dictionary, owner: PlacementOwner, target: Node, action: PlacementEnums.Action = PlacementEnums.Action.BUILD) -> PlacementReport:

Parameters

validator_issues
owner
target
action

Returns