max_fleet_size() clamped itself to DEFAULT_FORMATION.size(), so the ceiling on the fleet was a property of the LAYOUT - the wedge ran out of authored positions at twenty - rather than a rule anyone decided on. Capacity is the supplied Fleet Offices and nothing else now. Dropping the clamp alone would index off the end of the formation array, so the wedge continues by rule instead of stopping: formation_slot() grows it on demand, each further pair stepping 30 further out and 40 further back, which is what the authored rows already do - the first twenty slots come back unchanged. A grown slot is rotated by formation_rotation so a fleet that outgrows the array after the player has pivoted does not sprout hulls facing the original heading, and that angle is saved with the layout. Two "fleet is full" messages pointed at the vanished ceiling. Both now say what actually buys a berth, and the hangar's stops claiming it is research, which it has not been since #219. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QR2Mdk42ghEpeyXPe4UFyn
83 lines
2.6 KiB
GDScript
83 lines
2.6 KiB
GDScript
extends Control
|
|
|
|
# Editor-only entry into the live sandbox. The modal scene owns presentation;
|
|
# this small controller owns the boundary to the world nodes it manipulates.
|
|
|
|
@onready var button: IconButton = $Button
|
|
@onready var menu: Control = get_node("../DevMenu")
|
|
@onready var fleet: Node = get_node("../../Fleet")
|
|
|
|
|
|
func _ready() -> void:
|
|
button.pressed.connect(_on_pressed)
|
|
menu.fleet_add_requested.connect(_on_fleet_add_requested)
|
|
menu.fleet_remove_requested.connect(_on_fleet_remove_requested)
|
|
menu.unlock_skills_requested.connect(_on_unlock_skills_requested)
|
|
menu.unlimited_resources_requested.connect(_on_unlimited_resources_requested)
|
|
menu.free_costs_requested.connect(_on_free_costs_requested)
|
|
menu.wave_requested.connect(_on_wave_requested)
|
|
visible = false
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
var show_it: bool = GameState.dev_mode and not GameState.intro_active
|
|
if show_it != visible:
|
|
visible = show_it
|
|
if not show_it and menu.visible:
|
|
menu.close_menu()
|
|
|
|
|
|
func _on_pressed() -> void:
|
|
if not GameState.dev_mode:
|
|
return
|
|
menu.open_for(fleet)
|
|
|
|
|
|
func _on_fleet_add_requested(vessel_type: String) -> void:
|
|
if fleet.add_ship(vessel_type):
|
|
menu.set_status("Added %s" % GameState.vessel_name(vessel_type))
|
|
else:
|
|
menu.set_status("Fleet is full at %d — every berth past the first is a supplied Fleet Office" \
|
|
% GameState.max_fleet_size())
|
|
|
|
|
|
func _on_fleet_remove_requested(vessel_type: String) -> void:
|
|
var index: int = -1
|
|
for i in range(fleet.ships.size()):
|
|
if is_instance_valid(fleet.ships[i]) \
|
|
and String(fleet.ships[i].vessel_type) == vessel_type:
|
|
index = i
|
|
break
|
|
if index < 0:
|
|
menu.set_status("No %s is currently deployed" % GameState.vessel_name(vessel_type))
|
|
return
|
|
if fleet.store_ship(index) == "":
|
|
menu.set_status("Keep at least one vessel in the fleet")
|
|
return
|
|
menu.set_status("Removed %s" % GameState.vessel_name(vessel_type))
|
|
|
|
|
|
func _on_unlock_skills_requested() -> void:
|
|
var unlocked_count: int = GameState.dev_unlock_all_skills()
|
|
if unlocked_count > 0:
|
|
menu.set_status("Unlocked all skills (%d new)" % unlocked_count)
|
|
else:
|
|
menu.set_status("All skills are already unlocked")
|
|
|
|
|
|
func _on_unlimited_resources_requested(enabled: bool) -> void:
|
|
if not GameState.set_dev_unlimited_resources(enabled):
|
|
return
|
|
menu.set_status("Unlimited resources %s" % ("enabled" if enabled else "disabled"))
|
|
|
|
|
|
func _on_free_costs_requested(enabled: bool) -> void:
|
|
if not GameState.set_dev_free_costs(enabled):
|
|
return
|
|
menu.set_status("Research and production costs %s" \
|
|
% ("are now free" if enabled else "are charged again"))
|
|
|
|
|
|
func _on_wave_requested() -> void:
|
|
GameState.force_wave_now()
|
|
menu.close_menu()
|