RuleCheckIndicator

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Tile indicator showing placement validity based on rules and collisions.

Source File: addons/grid_building/placement/rule_check_indicator/rule_check_indicator.gd

Extends: ShapeCast2D

Signals

  • Signal: valid_changed(is_valid : bool) - Emitted when validity status changes.

Exported Properties

  • Property: validity_sprite: Sprite2D = null - Sprite showing tile validity status.

  • Property: show_indicators : bool = true : - Whether to show the indicator visual sprites for players or not.

  • Property: valid_settings: [IndicatorVisualSettings](./indicator-visual-settings/)

    Default display settings for when the rule check indicator is marked valid.

    If unset, will default at runtime. However you should define a valid IndicatorVisualSettings for production games

  • Property: invalid_settings: [IndicatorVisualSettings](./indicator-visual-settings/)

    Default display settings for when the rule check indicator is marked invalid.

    If unset, will default at runtime. However you should define a valid IndicatorVisualSettings for production games

  • Property: rules : Array[TileCheckRule] = [] :

    The rules to validate for whether this tile is valid for placement or not All rules must validate true to be valid. Otherwise, failed status will be shown

  • Property: valid : bool = false : - Whether the rules were validated for the area under the rule check indicator in the last test

Properties

  • Property: current_display_settings : [IndicatorVisualSettings](./indicator-visual-settings/) = null :

Private Properties

  • Property: _show_indicators : bool = true (private)

  • Property: _logger : [GBLogger](./gb-logger/) (private)

    Controls whether extra collision information should be drawn to the viewport for debug purposes and contact information printed in output

  • Property: _debug_draw_enabled: bool = false (private)

  • Property: _last_invalid_rule_count: int = -1 (private)

  • Property: _last_logged_valid: int = -1 (private)

  • Property: _post_ready_visuals_applied: bool = false (private)

  • Property: _rules : Array[TileCheckRule] = [] (private)

  • Property: _current_display_settings : [IndicatorVisualSettings](./indicator-visual-settings/) = null (private)

  • Property: _shown_sprite : Sprite2D = null (onready, private) - The currently showing sprite

  • Property: _valid : bool = false (private)

Constants

  • Constant: LogLevel = GBDebugSettings.LogLevel

Public Methods

resolve_gb_dependencies

1
resolve_gb_dependencies(p_container : GBCompositionContainer) -> void

Resolve dependencies for the indicator


get_rules

1
get_rules() -> Array[TileCheckRule]

Returns the active tile check rules assigned to this indicator.


add_rule

1
add_rule(p_rule : TileCheckRule)

Adds rule to indicator and self to indicators array on the rule for all indicator validation checks.

p_rule: TileCheckRule - Rule to add to this indicator


get_tile_position

1
get_tile_position(p_map : TileMapLayer) -> Vector2i

Gets the tile position that the indicator is currently positioned over.

p_map: TileMapLayer - TileMapLayer to convert global position to tile coordinates


clear

1
clear()

Clears reference to self from all rule indicator arrays


validate_rules

1
validate_rules(p_rules : Array[TileCheckRule]) -> Array[TileCheckRule]

Tests each of the TileCheckRules against the indicator. Returns all failing rules.

p_rules: Array[TileCheckRule] - Array of rules to validate against this indicator


get_debug_info

1
get_debug_info() -> Dictionary

Get current state information for debugging


validate_runtime

1
validate_runtime() -> bool

trace_runtime_if_enabled

1
trace_runtime_if_enabled() -> void

Highly verbose logging of the RuleCheckIndicator during runtime. Will only process if GBLogger is set to Trace verbosity (very high!)


get_runtime_issues

1
get_runtime_issues() -> Array[String]

Gets issues with the indicator in the scene Runtime-time validations: checks useful during gameplay/runtime [return] Array[String] - Returns array of issues found


get_editor_issues

1
get_editor_issues() -> Array[String]

Editor-time validations: checks useful in the editor / scene authoring Returns array of issues found


update_validity_state

1
update_validity_state() -> bool

Update the validity of the rule check indicator by validating all rules attached


force_validity_evaluation

1
force_validity_evaluation() -> bool

Immediately force shapecast update and a check for the validity of each rule given the new shapecast state


Private Methods

_init

1
_init(p_rules : Array[TileCheckRule] = [])

Flags: private


_ready

1
_ready()

Flags: private


_physics_process

1
_physics_process(_delta: float) -> void

Flags: private

Per-frame rule processing; indicators always re-evaluate rules every physics frame. This keeps visual feedback immediately responsive to dynamic collision or rule state changes.


_on_tree_entered_validate

1
_on_tree_entered_validate()

Flags: private


_indicator_debug_enabled

1
_indicator_debug_enabled() -> bool

Flags: private

Updates the visual display of the indicator based on display settings. Sets texture and modulate color from the provided settings.

p_display_settings: IndicatorVisualSettings - Visual settings to apply to the indicator


_indicator_log_enabled

1
_indicator_log_enabled() -> bool

Flags: private

Returns whether verbose indicator logs should be printed. This is stricter than _indicator_debug_enabled: requires explicit toggle or env var.


_update_visuals

1
_update_visuals(p_display_settings : IndicatorVisualSettings) -> Sprite2D

Flags: private


_update_current_display_settings

1
2
3
4
_update_current_display_settings(
    p_display_rules : Array[TileCheckRule],
    p_is_valid = null
)

Flags: private

Change the display settings of the indicator’s sprite based on validity and highest rule visual priority


_find_highest_rule_with_visual_settings

1
_find_highest_rule_with_visual_settings(p_rules : Array[TileCheckRule]) -> TileCheckRule

Flags: private

Finds the rule with highest visual priority among failing rules. Returns the rule with the highest visual priority that has fail_visual_settings defined.

p_rules: Array[TileCheckRule] - Array of rules to check for highest priority


_draw

1
_draw()

Flags: private

Draws debug visuals for collision contact points only.


_on_debug_settings_changed

1
_on_debug_settings_changed() -> void

Flags: private


_update_debug_cached_state

1
_update_debug_cached_state() -> void

Flags: private


_on_valid_changed

1
_on_valid_changed(is_valid : bool)

Flags: private

Callback when validity changes


_debug_setting_float_or

1
2
3
4
_debug_setting_float_or(
    default_value: float,
    getter_name: String
) -> float

Flags: private

Helpers to read debug tuning values from GBDebugSettings (if available).


_debug_setting_color_or

1
2
3
4
_debug_setting_color_or(
    default_value: Color,
    getter_name: String
) -> Color

Flags: private

Helpers to read debug tuning values from GBDebugSettings (if available).