4463e524aa
Auto-format all GDScript files using gdformat from gdtoolkit. This is a baseline formatting pass to ensure consistent style: - Normalizes indentation and spacing - Wraps long lines to 100 characters - Removes trailing whitespace - Standardizes blank lines between functions 68 files reformatted, 8 files left unchanged (3rd-party addon files with parse errors excluded).
30 lines
1.0 KiB
GDScript
30 lines
1.0 KiB
GDScript
class_name ActionDefinition
|
|
extends Resource
|
|
|
|
@export var action_id: StringName
|
|
@export var display_name: String
|
|
@export_range(0.0, 1000.0, 0.1) var default_duration := 1.0
|
|
@export var preferred_profession_id: StringName
|
|
@export var target_type: StringName = SimulationIds.TARGET_ACTIVITY
|
|
@export var resource_action_id: StringName
|
|
|
|
|
|
func validate() -> Array[String]:
|
|
var errors: Array[String] = []
|
|
if action_id.is_empty():
|
|
errors.append("action_id is empty")
|
|
if display_name.is_empty():
|
|
errors.append("display_name is empty for '%s'" % action_id)
|
|
if default_duration <= 0.0:
|
|
errors.append("default_duration must be positive for '%s'" % action_id)
|
|
if (
|
|
target_type
|
|
not in [
|
|
SimulationIds.TARGET_RESOURCE, SimulationIds.TARGET_ACTIVITY, SimulationIds.TARGET_FREE
|
|
]
|
|
):
|
|
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)
|
|
return errors
|