Table of Contents

Class PlacementState

Namespace
GridPlacement.GDScript
Assembly
MoonBark.GridPlacement.GDScript.dll
class PlacementState extends RefCounted
PlacementState

Properties

placed_parent

The parent node where objects are placed during build mode.

var placed_parent: Node:

preview

The current preview object in build mode, moving with the mouse until placed.

var preview: Node:

cost

var cost: BuildCost = null

issues

var issues: Array[String] = []

Methods

set_manipulation_state

func set_manipulation_state(p_state: ManipulationState) -> void:

Parameters

p_state

Returns

get_owner

func get_owner() -> PlacementOwner:

Returns

get_editor_issues

func get_editor_issues() -> Array[String]:

Returns

get_runtime_issues

func get_runtime_issues() -> Array[String]:

Returns

Events

action_performed

Manages communication between the placement system and connected objects during gameplay. Emits signals for placement actions, previews, and state changes to coordinate placement. Validates readiness when the tile map is set, requiring all properties to be assigned in the same frame. Emitted when a placement action is performed (success or failure). Consolidated signal replacing [signal success] and [signal failed] for new consumers. Compat shim: [signal success] and [signal failed] are still emitted for 5.1.0.

signal action_performed(data: PlacementActionData)

success

Emitted when an object is successfully placed into the game world. @deprecated Prefer [signal action_performed] for new connections.

signal success(placement_action_data: PlacementActionData)

failed

Emitted when a placement action fails. @deprecated Prefer [signal action_performed] for new connections.

signal failed(build_action_data: PlacementActionData)

preview_changed

Emitted when the build preview instance changes.

signal preview_changed(preview: Node)

placed_parent_changed

Emitted when the parent node for placed objects changes.

signal placed_parent_changed(placed_parent: Node)

system_changed

Emitted when the connected placement system changes (currently unused).

signal system_changed(system: Node)

pre_instance_added

Emitted after the scene is instantiated but before it is added to the scene tree. Allows external code to configure the instance (set properties, attach scripts, etc.) before _ready() runs.

signal pre_instance_added(node: Node2D)

pre_terrain_paint

Emitted before a terrain tile is painted. Listeners can inspect the paint data or call veto().

signal pre_terrain_paint(data: TerrainPaintData)

post_terrain_paint

Emitted after a terrain tile is painted successfully.

signal post_terrain_paint(data: TerrainPaintData)

post_terrain_removed

Emitted after a terrain tile is erased. Listeners (like refunders) can inspect the paint data which carries the terrain name that was removed.

signal post_terrain_removed(data: TerrainPaintData)

pre_terrain_demolish

Emitted before terrain is demolished (5.1.0-P). Listeners can inspect the [TerrainDemolishData] or call [method TerrainDemolishData.veto] to cancel. This is the terrain analogue of [signal ManipulationState.pre_demolish].

signal pre_terrain_demolish(data: TerrainDemolishData)

post_terrain_demolish

Emitted after terrain is demolished successfully (5.1.0-P).

signal post_terrain_demolish(data: TerrainDemolishData)