feat: define action completion costs
This commit is contained in:
@@ -7,6 +7,8 @@ extends Resource
|
||||
@export var preferred_profession_id: StringName
|
||||
@export var target_type: StringName = SimulationIds.TARGET_ACTIVITY
|
||||
@export var resource_action_id: StringName
|
||||
@export var completion_cost_resource_id: StringName
|
||||
@export_range(0.0, 1000.0, 0.1) var completion_cost_amount := 0.0
|
||||
|
||||
|
||||
func validate() -> Array[String]:
|
||||
@@ -26,4 +28,12 @@ func validate() -> Array[String]:
|
||||
errors.append("target_type '%s' is invalid for '%s'" % [target_type, action_id])
|
||||
if target_type == SimulationIds.TARGET_RESOURCE and resource_action_id.is_empty():
|
||||
errors.append("resource_action_id is required for '%s'" % action_id)
|
||||
if completion_cost_resource_id.is_empty() and completion_cost_amount > 0.0:
|
||||
errors.append("completion cost resource is required for '%s'" % action_id)
|
||||
if not completion_cost_resource_id.is_empty() and completion_cost_amount <= 0.0:
|
||||
errors.append("completion cost amount must be positive for '%s'" % action_id)
|
||||
return errors
|
||||
|
||||
|
||||
func has_completion_cost() -> bool:
|
||||
return not completion_cost_resource_id.is_empty() and completion_cost_amount > 0.0
|
||||
|
||||
Reference in New Issue
Block a user