Compose buildings from definitions and capabilities
This commit is contained in:
parent
1721edd123
commit
0504b24d8d
46 changed files with 1091 additions and 878 deletions
|
|
@ -1,5 +1,7 @@
|
|||
extends SceneTree
|
||||
|
||||
const BUILDING_DEFINITIONS = preload("res://BuildingDefinitions.gd")
|
||||
|
||||
# Headless gameplay test: run with
|
||||
# godot --headless -s res://tests/test_transport_hub_building.gd
|
||||
# Forgejo #18 (part 5 of #12): the Transport Hub is a placeable building of
|
||||
|
|
@ -67,7 +69,7 @@ func _process(delta: float) -> bool:
|
|||
var icons: Dictionary = {}
|
||||
for type in [GameState.BUILDING_MOTHERSHIP, GameState.BUILDING_SHIP_CRAFTER,
|
||||
GameState.BUILDING_COMMAND_CENTER, GameState.BUILDING_TRANSPORT_HUB]:
|
||||
var icon: int = controller._action_icon_for(type)
|
||||
var icon: int = BUILDING_DEFINITIONS.get_definition(type).action_icon
|
||||
if icons.has(icon):
|
||||
print("TEST_TRANSPORT_HUB_BUILDING: FAIL (%s and %s share an icon)" % [type, icons[icon]])
|
||||
quit(1)
|
||||
|
|
@ -99,7 +101,7 @@ func _process(delta: float) -> bool:
|
|||
return false
|
||||
for b in field.spawned:
|
||||
if is_instance_valid(b) and b.building_type == GameState.BUILDING_TRANSPORT_HUB:
|
||||
hub = b
|
||||
hub = b.visual
|
||||
if hub == null:
|
||||
print("TEST_TRANSPORT_HUB_BUILDING: FAIL (never spawned)")
|
||||
quit(1)
|
||||
|
|
@ -120,9 +122,9 @@ func _process(delta: float) -> bool:
|
|||
for m in markers:
|
||||
if m.type == GameState.BUILDING_TRANSPORT_HUB:
|
||||
found = true
|
||||
if m.color == map_content.CRAFTER_MARKER_COLOR \
|
||||
or m.color == map_content.MOTHERSHIP_MARKER_COLOR \
|
||||
or m.color == map_content.COMMAND_MARKER_COLOR:
|
||||
if m.color == BUILDING_DEFINITIONS.get_definition(GameState.BUILDING_SHIP_CRAFTER).map_color \
|
||||
or m.color == BUILDING_DEFINITIONS.get_definition(GameState.BUILDING_MOTHERSHIP).map_color \
|
||||
or m.color == BUILDING_DEFINITIONS.get_definition(GameState.BUILDING_COMMAND_CENTER).map_color:
|
||||
print("TEST_TRANSPORT_HUB_BUILDING: FAIL (map marker reuses another building's colour)")
|
||||
quit(1)
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in a new issue