PlacementService
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: systems/placement/placement_service.gd
Version: 5.1
class_name: PlacementService
extends: RefCounted
Summary
PlacementService
Behavior contract:
- Owns placement session state (selected_placeable, preview instance, last report).
- Delegates rule setup/validation to IndicatorManager via IndicatorContext.
- Does NOT instantiate or place nodes into the world (that remains BuildingSystem responsibility).
- Acts as the service boundary for placement configuration and state so systems (e.g. BuildingSystem) do not need to read or mutate shared state objects directly.
Scope/Topology:
- One PlacementService per GBCompositionContainer (per GBOwner scope).
- Do not share a PlacementService across owners/players.
Not asserted (explicitly):
- TileMap collision/shape overlap behavior.
- Visual indicator rendering quality.
Signals
build_mode_enteredbuild_mode_exitedreport_changedsuccessfailed
Exports
(none)
Methods
compute_preview_model()- Computes the preview model (transform, cells) for a given placeable and targeting snapshot.
validate_snapshot()- Validates a potential placement based on the snapshot. Does not rely on existing scene nodes (ideally).
build_rule_context_for_build()- Canonical Context Builder [90+ Plan] Creates a standardized PlacementRuleContext for rule evaluation.
[param p_snapshot] Targeting snapshot (optional, will fetch current if null) [param p_placeable] The item being placed (optional) [param p_rotation_degrees] Rotation in degrees (optional, defaults to 0.0) [param p_preview_node] Explicit preview node for engine-glue rules (optional)
_init()_as_state()get_state()get_builder_owner()get_preview()set_preview()clear_preview()get_placed_parent()set_placed_parent()get_selected_placeable()set_selected_placeable()clear_placement()get_actions()set_actions()emit_success()emit_failure()get_last_report()set_last_report()get_runtime_issues()is_in_build_mode()enter_build_mode()_ensure_preview_builder()_load_first_script()try_build()try_build_at_position()exit_build_mode()tear_down_indicators()apply_rules()align_preview_to_grid()report_built()- Reports a successful build action through the placement service. Emits the success signal with the placement report and build type.
[param p_report] The placement report for the build action [param p_build_type] Type of build operation (SINGLE, DRAG, or AREA)
report_failure()- Reports a failed build action through the placement service. Emits the failure signal with the placement report and build type.
[param p_report] The placement report containing failure details and issues. [param p_build_type] Type of build operation that failed (SINGLE, DRAG, or AREA).
is_ready_to_place()- Returns true if placement service is ready to place a selected placeable. Checks if the service is ready to build by validating the selected placeable and context. Returns true if all placement requirements are met and no issues are found.
check_is_in_build_mode()- Returns true if placement service is currently in build mode. Checks the current mode state to determine if build mode is active.
exit_place_mode()- Exits placement mode and cleans up all placement-related elements. Sets the mode to OFF, clears the preview, and tears down indicators.
_exit_build_cleanup()- Internal cleanup methods for build mode management
_try_clear_preview_builder()_on_mode_changed()get_placement_polygons()- Placement infrastructure accessors (moved from BuildingSystem)
set_placement_polygons()get_preview_layer()set_preview_layer()get_indicators_group()set_indicators_group()get_preview_builder()set_preview_builder()get_targeting_positioner()- Orchestrator façade APIs (delegate to TargetingService2D/ManipulationService2D)
reset_manipulation_parent()setup_preview_with_rules()validate_current_placement()_try_setup()