updates
This commit is contained in:
parent
276d43613d
commit
4298caf5cb
552 changed files with 42990 additions and 776 deletions
|
|
@ -1,16 +1,19 @@
|
|||
class_name CampaignDebug
|
||||
extends CanvasLayer
|
||||
## Temporary campaign readout and debug keys, until the phase HUD (Step 7) and menus (Step 11)
|
||||
## replace it.
|
||||
## Enter / Space / A begin the day (ends the untimed morning review)
|
||||
## Debug readout and keys (debug builds). The readout is hidden until F1; the keys always work.
|
||||
## F1 show / hide this readout
|
||||
## F2 cycle tonight's plan through the debug scenarios (one enemy type, then
|
||||
## pairs, then all three; game/resources/scenarios/) and back to the real one
|
||||
## N start the night early (only when GameConfig.allow_early_night is on)
|
||||
## R / Start after Game Over: retry the night; after the farmers return: new vacation
|
||||
## R after Game Over: retry the night; after the farmers return: new vacation
|
||||
## F6 end the current phase now
|
||||
## F7 cycle game speed 1x / 5x / 20x
|
||||
## F9 debug: scarecrow to 0 HP
|
||||
## F10 debug: strip every farm asset
|
||||
## T / G / H debug: send in a thief / a crow / a fence breaker (FarmSim)
|
||||
|
||||
const SPEEDS: Array[float] = [1.0, 5.0, 20.0]
|
||||
const SCENARIOS: Array[String] = ["crows", "thieves", "breakers", "crows_thieves", "thieves_breakers", "all_three"]
|
||||
const ENDINGS := {
|
||||
CampaignController.Outcome.GAME_OVER_SCARECROW: "GAME OVER: the scarecrow was destroyed",
|
||||
CampaignController.Outcome.GAME_OVER_STRIPPED: "GAME OVER: the farm was stripped bare",
|
||||
|
|
@ -18,17 +21,21 @@ const ENDINGS := {
|
|||
}
|
||||
|
||||
@export var campaign: CampaignController
|
||||
## Optional: shows thieves and crops in flight.
|
||||
@export var sim: FarmSim
|
||||
|
||||
var _label: Label
|
||||
var _speed_index: int = 0
|
||||
var _scenario: int = -1
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_label = Label.new()
|
||||
_label.position = Vector2(24.0, 20.0)
|
||||
_label.position = Vector2(24.0, 140.0)
|
||||
_label.add_theme_font_size_override("font_size", 22)
|
||||
_label.add_theme_color_override("font_outline_color", Color.BLACK)
|
||||
_label.add_theme_constant_override("outline_size", 6)
|
||||
_label.visible = false
|
||||
add_child(_label)
|
||||
|
||||
|
||||
|
|
@ -42,9 +49,7 @@ func _process(_delta: float) -> void:
|
|||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
var s := campaign.state
|
||||
if event.is_action_pressed("ui_accept") and s.phase == CampaignController.Phase.MORNING:
|
||||
campaign.begin_day()
|
||||
elif event.is_action_pressed("restart"):
|
||||
if event.is_action_pressed("restart") and event is InputEventKey:
|
||||
if s.phase == CampaignController.Phase.GAME_OVER:
|
||||
campaign.retry_night()
|
||||
elif s.phase == CampaignController.Phase.FARMERS_RETURN:
|
||||
|
|
@ -53,6 +58,10 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
if key == null or not key.pressed or key.echo:
|
||||
return
|
||||
match key.physical_keycode:
|
||||
KEY_F1:
|
||||
_label.visible = not _label.visible
|
||||
KEY_F2:
|
||||
cycle_scenario()
|
||||
KEY_N:
|
||||
campaign.start_night_early()
|
||||
KEY_F6:
|
||||
|
|
@ -63,9 +72,20 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
KEY_F9:
|
||||
s.scarecrow_hp = 0
|
||||
KEY_F10:
|
||||
s.crops = 0
|
||||
s.animals = 0
|
||||
s.supplies = 0
|
||||
s.strip()
|
||||
|
||||
|
||||
## Next debug scenario as tonight's plan (after the last, the real plan again).
|
||||
func cycle_scenario() -> void:
|
||||
if sim == null:
|
||||
return
|
||||
_scenario = _scenario + 1 if _scenario + 1 < SCENARIOS.size() else -1
|
||||
var plan: NightPlan = null
|
||||
if _scenario >= 0:
|
||||
plan = load("res://game/resources/scenarios/%s.tres" % SCENARIOS[_scenario]) as NightPlan
|
||||
sim.waves.debug_plan = plan
|
||||
if sim.toasts != null:
|
||||
sim.toasts.push("Tonight (debug): %s" % (plan.title if plan != null else "the night's own plan"), Color(0.8, 0.9, 1.0))
|
||||
|
||||
|
||||
func _describe() -> String:
|
||||
|
|
@ -81,11 +101,13 @@ func _describe() -> String:
|
|||
if s.animals_total > 0:
|
||||
farm += " · Animals %d/%d" % [s.animals, s.animals_total]
|
||||
if s.supplies_total > 0:
|
||||
farm += " · Supplies %d" % s.supplies
|
||||
farm += " · Supplies %d%s" % [s.supplies, " (raided)" if s.shed_raided else ""]
|
||||
lines.append(farm)
|
||||
if sim != null and sim.loot != null:
|
||||
lines.append("Thieves %d · carried %d, dropped %d, following %d · pen %s" % [sim.enemies.alive_count(),
|
||||
sim.loot.count(LootSystem.Status.CARRIED), sim.loot.count(LootSystem.Status.DROPPED),
|
||||
sim.loot.followers(), "open" if sim.animals.pen_open else "closed"])
|
||||
match s.phase:
|
||||
CampaignController.Phase.MORNING:
|
||||
lines.append("[Enter] begin the day")
|
||||
CampaignController.Phase.GAME_OVER:
|
||||
lines.append(ENDINGS[campaign.outcome] + " · [R] retry the night")
|
||||
CampaignController.Phase.FARMERS_RETURN:
|
||||
|
|
@ -93,5 +115,7 @@ func _describe() -> String:
|
|||
_:
|
||||
if campaign.can_start_night_early():
|
||||
lines.append("[N] start the night early")
|
||||
lines.append("F6 next phase · F7 speed · F9 scarecrow to 0 HP · F10 strip farm")
|
||||
if sim != null and sim.waves.debug_plan != null:
|
||||
lines.append("Scenario: %s (F2 next)" % sim.waves.debug_plan.title)
|
||||
lines.append("F1 hide · F2 scenario · F6 next phase · F7 speed · F9 scarecrow to 0 HP · F10 strip farm · T/G/H thief/crow/breaker")
|
||||
return "\n".join(lines)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue