4.3.0 Rule Improvements & Validation Overhaul


Grid Building Inventory v4.3.0 Patch Notes

The v4.3.0 update refines the Grid Building plugin with better validation, new debugging tools, and Godot 4.4 compatibility (now required). Here’s what’s changed:

  • Godot 4.4 Required: This update leverages Godot 4.4’s new GDScript typed dictionary enhancements (e.g., Dictionary[String, Node]) for stricter type checking in validation systems, ensuring more robust code.
  • Templates: PlaceableView button template now defaults to “Expand Icon” enabled, ensuring uniform icon scaling in grid displays.
  • Enhanced Validation:
    • All validate() methods now return Array[String] problem lists instead of booleans, making debugging easier (success = problems.is_empty()).
    • PlacementValidator now emits a setup_failed signal with a Dictionary[PlacementRule, Array] of rule setup issues for better error reporting.
  • Placement Rules:
    • Base PlacementRule auto-sets _params and validates it, returning setup problems as Array[String] for improved diagnostics.
    • ValidPlacementTileRule fixed to require all custom tile data matches; added unit tests to verify this.
  • Rule Check Indicators: Fixed debug mode drawing (now correctly shows contact points with circles) and added clarifying comments.
  • Debugging Tools: Introduced GBDebugSettings resource to centralize debug toggling across objects (e.g., rules, indicators). Share one instance project-wide to enable/disable debug output—off by default unless explicitly set.
  • UI Tweaks: Separated “clear” and “setup” tabs in placeable_selection_ui for better usability.
  • Unit Tests: Added offset_logo.tscn to test offset cases (sprite/collision not at 0,0) and expanded ValidPlacementTileRule tests.
  • Code Cleanup: Simplified building_state.gd and building_system.gd, fixed debug loops, and refined grid_positioner_2d visibility logic.

This update prioritizes stability, debuggability, and developer experience.

Here’s more details if interested.

Templates

  • Changed default on PlaceableView button template to have expand icon checked. This lets the vertical size on different icons match when used in a grid display due to scaling of the icon.

Placement Validator

  • New signal setup_failed which emits with a Dictionary[PlacementRule, Array] of rule setup problems. This could be handy in debugging or error reporting.
  • Setup now works with Dictionary[PlacementRule, Array] return type gathered from each rule’s setup -> Array[String] return. The intention here is to massively improve issue reporting and debugging.

Placement Rule

  • The base class setup automatically sets _params : RuleValidationParams (now a base class property) and validates it with the static RuleValidationParams.Validate(params) call. This returns an Array[String] problems which will be used by the PlacementValidator in reporting bad setup issues.

Rule Check Indicator

  • Fixed bugs with the debug_mode where it would error rather than draw each contact point with a circle. Added comments to clarify the purpose of the _draw with debug mode.

Valid Placement Tile Rule

  • Fixed to properly require each custom tile data to match in the test tile for this rule to return true. Added accompanying unit tests to ensure this behavior.

GBDebugSettings Resource

  • Any grid building object that had debug settings now references a GBDebugSettings resource to check if it should print debug or not.
  • Sharability of the true / false setting is the goal here so you can optionally use one GBDebugSetting across your project and toggle it on or off. By default, if there is no GBDebugSetting object set to true, then extra debugging will be off.
  • For most cases, the end user should not need to use this but it exists if there ever seems to be any problems.

Unit Tests

  • Added an offset object (offset_logo.tscn) to test offset cases where the sprite and collision shape are not centered at 0,0 like the root object but located adjacently
  • Added extra tests for Validate Placement Tile Rule

Validate Method

  • All validate methods have been updated to acquire and return an Array[String] problems instead of true false whether they validate or not. This makes the return data leagues more useful and aids in debugging. The equivalent check for if the validate() method succeeded is validate().is_empty().

Files

Grid Building v4.3.0 & Demo - Godot 4.4+ 26 MB
7 days ago

Get Grid Building Plugin for Godot 4

Buy Now
On Sale!
15% Off
$40.00 $34.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.