refactor: separate content from presentation assets
This commit is contained in:
@@ -51,9 +51,10 @@ func _run() -> void:
|
||||
(
|
||||
goat_definition.behavior_id == AnimalDefinition.BEHAVIOR_GRAZER_ROUTINE
|
||||
and sheep_definition.behavior_id == AnimalDefinition.BEHAVIOR_GRAZER_ROUTINE
|
||||
and goat_definition.presentation_scene_path == sheep_definition.presentation_scene_path
|
||||
and goat_definition.presentation_cue_id == PresentationCueIds.ANIMAL_DOMESTIC_GOAT
|
||||
and sheep_definition.presentation_cue_id == PresentationCueIds.ANIMAL_DOMESTIC_SHEEP
|
||||
),
|
||||
"Both animals should reuse one grazer behavior and presentation contract"
|
||||
"Both animals should reuse one grazer behavior with stable presentation cues"
|
||||
)
|
||||
_check(
|
||||
(
|
||||
@@ -63,7 +64,29 @@ func _run() -> void:
|
||||
"Both data definitions should advertise the existing care action"
|
||||
)
|
||||
|
||||
var generic_scene := load(goat_definition.presentation_scene_path) as PackedScene
|
||||
var presentation_catalog := PresentationCatalog.create_core()
|
||||
_check(
|
||||
presentation_catalog != null and presentation_catalog.is_valid(),
|
||||
"The presentation-side catalog should validate independently"
|
||||
)
|
||||
if presentation_catalog == null or not presentation_catalog.is_valid():
|
||||
_finish()
|
||||
return
|
||||
var goat_cue := presentation_catalog.get_definition(goat_definition.presentation_cue_id)
|
||||
var sheep_cue := presentation_catalog.get_definition(sheep_definition.presentation_cue_id)
|
||||
_check(
|
||||
(
|
||||
goat_cue != null
|
||||
and sheep_cue != null
|
||||
and goat_cue.scene_path == sheep_cue.scene_path
|
||||
and goat_cue.scene_path == "res://world/animals/grazer/cozy_grazer.tscn"
|
||||
),
|
||||
"Presentation cues should map both data-only animals to the shared grazer scene"
|
||||
)
|
||||
if goat_cue == null or sheep_cue == null:
|
||||
_finish()
|
||||
return
|
||||
var generic_scene := load(goat_cue.scene_path) as PackedScene
|
||||
var generic := generic_scene.instantiate() as AnimalNode
|
||||
_check(
|
||||
(
|
||||
@@ -79,7 +102,7 @@ func _run() -> void:
|
||||
if generic != null:
|
||||
generic.free()
|
||||
|
||||
var factory := AnimalFactory.new(catalog)
|
||||
var factory := AnimalFactory.new(catalog, presentation_catalog)
|
||||
var goat := (
|
||||
factory
|
||||
. create_presentation(
|
||||
|
||||
Reference in New Issue
Block a user