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 spriteProperty:
_valid : bool = false(private)
Constants
- Constant:
LogLevel = GBDebugSettings.LogLevel
Public Methods
resolve_gb_dependencies
Resolve dependencies for the indicator
get_rules
Returns the active tile check rules assigned to this indicator.
add_rule
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
Gets the tile position that the indicator is currently positioned over.
p_map: TileMapLayer - TileMapLayer to convert global position to tile coordinates
clear
Clears reference to self from all rule indicator arrays
validate_rules
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
Get current state information for debugging
validate_runtime
trace_runtime_if_enabled
Highly verbose logging of the RuleCheckIndicator during runtime. Will only process if GBLogger is set to Trace verbosity (very high!)
get_runtime_issues
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
Editor-time validations: checks useful in the editor / scene authoring Returns array of issues found
update_validity_state
Update the validity of the rule check indicator by validating all rules attached
force_validity_evaluation
Immediately force shapecast update and a check for the validity of each rule given the new shapecast state
Private Methods
_init
Flags: private
_ready
Flags: private
_physics_process
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
Flags: private
_indicator_debug_enabled
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
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
Flags: private
_update_current_display_settings
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
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
Flags: private
Draws debug visuals for collision contact points only.
_on_debug_settings_changed
Flags: private
_update_debug_cached_state
Flags: private
_on_valid_changed
Flags: private
Callback when validity changes
_debug_setting_float_or
Flags: private
Helpers to read debug tuning values from GBDebugSettings (if available).
_debug_setting_color_or
Flags: private
Helpers to read debug tuning values from GBDebugSettings (if available).