SpendMaterialsRuleGeneric

Finds the container for the...

sort Weight: 10

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

Version: v5.0.0

STABLE

Inherits: PlacementRule
Source: spend_materials_rule_generic.gd
Parsing: AST-based for maximum accuracy with symbol typing


Variables

_mat_container: Object

The target container to search for materials to spend

Type: Object


_owner_root: Node

The spender root node where the material container should be located for spending resources from

Type: Node


Methods

setup

Signature: setup(p_gts : GridTargetingState: Variant) -> Array

Returns: Array

Parameters:

  • p_gts : GridTargetingState: Variant

apply

Signature: apply() -> Array

If the spending was successful, the array will be empty

Returns: Array


tear_down

Signature: tear_down() -> void

Find the corresponding material type key and subtract the count from the material container

Returns: void


validate_placement

Signature: validate_placement() -> RuleResult

Checks to see if there are enough resources to build item

Returns: RuleResult


check_missing_resources

Signature: check_missing_resources(p_owner_root_container: Variant) -> Array

Returns ItemStacks that contain the amount missing for each type

Returns: Array

Parameters:

  • p_owner_root_container: Variant

_get_material_container_from_user

Signature: _get_material_container_from_user(user : Node: Variant) -> Node

nodes recursively

Returns: Node

Parameters:

  • user : Node: Variant

_get_pre_setup_issues

Signature: _get_pre_setup_issues(p_gts : GridTargetingState: Variant) -> Array

Returns: Array

Parameters:

  • p_gts : GridTargetingState: Variant

_get_post_setup_issues

Signature: _get_post_setup_issues() -> Array

Returns: Array


_get_material_name

Signature: _get_material_name(p_material : Resource: Variant) -> String

Returns: String

Parameters:

  • p_material : Resource: Variant