SpendMaterialsRuleGeneric
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
Generic material spending rule for placement validation.
Source File: addons/grid_building/placement/placement_rules/template_rules/spend_materials_rule_generic.gd
Extends: PlacementRule
Exported Properties
Property:
resource_stacks_to_spend : Array[ResourceStack] = []How many of each type need to be spent for the building rule to pass Resource should have fields type and count defined
Property:
locator : [NodeLocator](./node-locator/)Used to find the inventory on the _owner_root passed in as a setup parameter so that the rule knows where to spend the resource_stacks_to_spend from
Private Properties
- Property:
_mat_container : Object :(private) - The target container to search for materials to spend - Property:
_owner_root : Node(private) - The spender root node where the material container should be located for spending resources from
Public Methods
setup
apply
Tries to spend the resources from the _mat_container Returns an array of issues found during the spending process If the spending was successful, the array will be empty
tear_down
validate_placement
Checks to see if there are enough resources to build item
check_missing_resources
Checks the resouce _mat_container to see if it has enough of each resource type Returns ItemStacks that contain the amount missing for each type
Private Methods
_get_material_container_from_user
Flags: private
Finds the container for the spendable materials by searching either for the matching node by name or class name Starts at the user node of the building system and then checks children nodes recursively
_get_pre_setup_issues
Flags: private
_get_post_setup_issues
Flags: private
_get_material_name
Flags: private