refactor: separate content from presentation assets

This commit is contained in:
Rijad Zuzo
2026-08-12 21:41:33 +02:00
parent 5a70aaaded
commit bf4bf73675
22 changed files with 480 additions and 70 deletions
+3 -34
View File
@@ -8,13 +8,8 @@ const BEHAVIOR_GRAZER_ROUTINE := &"grazer_routine"
@export var display_name: String
@export var behavior_id: StringName = BEHAVIOR_GRAZER_ROUTINE
@export var supported_action_ids: Array[StringName] = []
@export_file("*.tscn") var presentation_scene_path: String
@export var presentation_cue_id: StringName
@export_range(0.1, 10.0, 0.1) var movement_speed := 1.6
@export var visual_scale := Vector3.ONE
@export var body_scale := Vector3.ONE
@export var fluff_scale := Vector3.ONE
@export var show_horns := true
@export var show_beard := true
func validate() -> Array[String]:
@@ -29,36 +24,10 @@ func validate() -> Array[String]:
errors.append(
"behavior_id '%s' is unsupported for '%s'" % [behavior_id, animal_definition_id]
)
if (
presentation_scene_path.is_empty()
or not presentation_scene_path.begins_with("res://")
or presentation_scene_path.get_extension() != "tscn"
or not ResourceLoader.exists(presentation_scene_path, "PackedScene")
):
errors.append("presentation_scene_path is invalid for '%s'" % animal_definition_id)
if not is_valid_stable_id(presentation_cue_id):
errors.append("presentation_cue_id is invalid for '%s'" % animal_definition_id)
if not is_finite(movement_speed) or movement_speed <= 0.0:
errors.append("movement_speed must be positive for '%s'" % animal_definition_id)
if (
not visual_scale.is_finite()
or visual_scale.x <= 0.0
or visual_scale.y <= 0.0
or visual_scale.z <= 0.0
):
errors.append("visual_scale must be finite and positive for '%s'" % animal_definition_id)
if (
not body_scale.is_finite()
or body_scale.x <= 0.0
or body_scale.y <= 0.0
or body_scale.z <= 0.0
):
errors.append("body_scale must be finite and positive for '%s'" % animal_definition_id)
if (
not fluff_scale.is_finite()
or fluff_scale.x <= 0.0
or fluff_scale.y <= 0.0
or fluff_scale.z <= 0.0
):
errors.append("fluff_scale must be finite and positive for '%s'" % animal_definition_id)
var seen: Dictionary = {}
for action_id in supported_action_ids:
if not is_valid_stable_id(action_id):