harvest/game/scripts/game_config.gd
Forrest ca8601029e Task #17: Propane Torch sprays a band of fire
Hit test: _band_hit replaces the torch's cone. It hits the enemies in a
torch_width (1.6 m) wide band along the gun's line, from the scarecrow's
center out to torch_range (4.5 m) past the muzzle, each enemy's hit radius
added. The nearest torch_targets with a clear line are hit; _cone_hit and
_band_hit share _hit_nearest. torch_arc is gone, and the torch joins
MUZZLE_WEAPONS so scripted aim matches the mouse.

Flame: TorchFlame (CPUParticles3D jet plus a flickering light) is sized to
the band. WeaponModels gains a reusable held-effect pattern for #18:
- add_held_effect / lit / douse / advance.
- attack() lights the effect for HOLD_TICKS (1.5) tick intervals instead
  of replaying the kick.
- douse() puts it out the moment fire is let go; it then fades for the
  particle lifetime.
- Timers run on the sim clock (ScarecrowCombat.tick), or on physics frames
  when nothing advances them. That covers the other scarecrow on the
  partner's machine, which the existing "attack" events light, so there is
  no protocol change.

Sound: a new burned signal and a "burn" cue (synth torch_roar.wav,
generated by synth_audio.gd with its own seed) replace the pitchfork's
stab sound.

Tests (test_weapons): band in, beside, behind and beyond; a melee hugger
is burned; held fire over 5 intervals ticks 5 times and stops on release;
the flame is lit at every step while held and hidden after release; the
replica and attack-event paths; the flame follows the model's yaw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:04:54 -04:00

415 lines
25 KiB
GDScript

class_name GameConfig
extends Resource
## Every tunable campaign setting, kept in one resource (see game/RULES.md for the rules these
## values feed). The defaults live in res://game/resources/game_config.tres; every number is a
## starting value to tune during balancing.
@export_group("Campaign")
## Nights the scarecrow must survive before the farmers return.
@export_range(1, 60) var campaign_nights: int = 5
@export_group("Waves")
## Every night plan's groups are scaled when played: this many times the enemies, arriving this
## many times the plan's spacing apart (NightPlan.scaled_count / scaled_every). 5 and 0.4: five
## times the enemies, two and a half times as often. A plan can set its own instead
## (NightPlan.count_scale / spacing_scale; night 1 plays unscaled).
@export_range(0.1, 20.0) var wave_count_scale: float = 7.0
@export_range(0.05, 4.0) var wave_spacing_scale: float = 0.3
## Every enemy arrives at its own random point along the farm's edge (FarmZones.edge), on foot this
## many meters outside the playable map (also where carriers escape to), flyers this far out.
## Ground arrivals stay inside the navigation grid (5 m beyond the map).
@export_range(0.5, 4.5) var spawn_margin: float = 3.0
@export var flyer_spawn_margin: float = 8.0
@export_group("Phases")
## Seconds of game time per phase. The morning review is untimed: it waits for the player.
@export var day_length: float = 180.0
@export var dusk_length: float = 30.0
@export var night_length: float = 150.0
## After sunrise: enemies retreat and carriers can still be intercepted for this long.
@export var dawn_grace: float = 20.0
## D1: lets the player skip the rest of the day/dusk and start the night (off by default).
@export var allow_early_night: bool = false
@export_group("Scarecrow")
## HP carries over between nights (D7); 0 HP is an immediate Game Over.
@export_range(1, 100) var scarecrow_max_hp: int = 3
## After an accepted hit the scarecrow ignores further hits for this long.
@export var invulnerability_time: float = 1.0
## Fear: enemies within fear_radius flee for fear_duration; usable every fear_cooldown seconds.
@export var fear_radius: float = 6.0
@export var fear_cooldown: float = 12.0
@export var fear_duration: float = 2.0
## Patch up: hold for patch_time (rooted, no shooting) to restore patch_heal HP.
@export var patch_time: float = 2.0
@export_range(1, 100) var patch_heal: int = 3
## Sprint (the workbench's Sprint upgrade): hold sprint while moving to run sprint_speed_mult
## times as fast for up to sprint_time seconds; once it ends, sprint_cooldown seconds until the
## next one.
@export var sprint_speed_mult: float = 1.8
@export var sprint_time: float = 4.0
@export var sprint_cooldown: float = 10.0
@export_group("Farm assets")
## Crop units and animals on the farm when the vacation starts; they must match the farm scene
## (the crop field's CropUnits, the animals in the pen). Supplies are the shed's stock (the start
## materials below). A category with nothing in it at the start is not in play and is ignored by
## the "farm stripped" check (D2).
@export_range(0, 500) var start_crops: int = 30
@export_range(0, 100) var start_animals: int = 8
## Structures standing when the vacation starts ({"type", "x", "z", "rot"}). Empty: the animal
## pen is fully player-built (its fence/gate ring is no longer a scene prop or a free starter).
@export var start_structures: Array[Dictionary] = []
@export_group("Theft rules")
## D5: fear makes carriers drop their loot, not only killing them.
@export var fear_drops_loot: bool = true
## D6: dropped loot still on the ground when the dawn grace ends returns home automatically.
@export var loot_returns_at_dawn: bool = true
## D6: animals that can follow the scarecrow back to the pen at once.
@export_range(1, 10) var max_following_animals: int = 5
## Seconds an enemy needs to take a crop unit, catch an animal, or fill a sack at the shed (times
## its type's steal_time); damage during that time resets it.
@export var crop_steal_time: float = 2.5
@export var animal_capture_time: float = 2.0
@export var supply_steal_time: float = 1.0
## A supply thief takes this many units of the material the shed holds most of (never more than
## there is).
@export_range(1, 100) var supply_bundle: int = 5
## Loose animals (dropped, or wandered out of an open pen) walk toward the farm's nearest edge at
## this speed, stopping to graze now and then; one that gets off the farm is lost.
@export var stray_speed: float = 1.1
## At night, while the pen is open (its gate broken or removed), one animal wanders out every
## this many seconds. An animal brought back stays calm (won't wander out) for animal_calm_time.
@export var animal_wander_interval: float = 10.0
@export var animal_calm_time: float = 30.0
## Animals following the scarecrow walk its trail at up to this speed.
@export var follow_speed: float = 6.0
## Where loose animals start (#12): scattered open-farmyard spots outside FarmZone.Kind.ANIMAL_PEN
## (x -10..4, z -11..-1), walkable, and clear of the future crop fields (x -11..-1 z 2..12 and
## x 2..12 z 2..12 -- see LAYOUT.md). Each is grazed around (AnimalSystem.LOOSE_WANDER_RADIUS)
## until the player leads that animal into a built pen. Cycles if there are more animals than spots.
@export var animal_loose_spots: Array[Vector2] = [
Vector2(-9.0, 0.5), Vector2(-6.0, 0.5), Vector2(-3.0, 0.5), Vector2(0.0, 0.5), Vector2(3.0, 0.5),
Vector2(-12.0, -3.0), Vector2(-12.0, -6.0), Vector2(-12.0, -9.0),
]
## What a thief with no set target goes for ("any" in a night plan), and where a thief whose target
## is gone goes next: relative weights per category.
@export var target_weights: Dictionary = {"crops": 2.0, "animals": 1.0, "supplies": 1.0}
## The scarecrow recovers dropped loot by walking within this distance of it.
@export var pickup_radius: float = 1.3
@export_group("Resources")
## Wood, scrap, and straw in the supply shed when the vacation starts. Alien Goop is never a
## starting stock (it's found only by killing Aliens), but the shed still tracks a count for it.
@export_range(0, 999) var start_wood: int = 4
@export_range(0, 999) var start_scrap: int = 2
@export_range(0, 999) var start_straw: int = 4
@export_range(0, 999) var start_alien_goop: int = 0
## The scarecrow's pouch holds this many units in total; it empties into the shed on entry.
## Raised to 16 by the Bigger pouch upgrade (Upgrades, "pouch_capacity").
@export_range(1, 200) var pouch_capacity: int = 8
## Seconds of holding interact per gather (each takes one charge of the gather point).
@export var gather_time: float = 1.5
## What things cost: name -> {material: amount}: patching up, the buildables, and the upgrades.
@export var costs: Dictionary = {
"patch": {"straw": 2},
"straw_stuffing": {"straw": 12, "wood": 4},
"pouch_upgrade": {"wood": 10, "straw": 8},
"sprint": {"wood": 8, "straw": 6},
"corn_shooter": {"scrap": 10, "wood": 4},
"pumpkin_bomb": {"straw": 12, "scrap": 6},
"potato_cannon": {"scrap": 14, "wood": 8},
"shurikens": {"scrap": 6, "straw": 4},
"propane_torch": {"scrap": 12, "straw": 4, "wood": 6},
"alien_ray": {"alien_goop": 6, "scrap": 10},
"rapid_fire": {"scrap": 12, "wood": 8},
"heavy_seeds": {"scrap": 14, "straw": 10},
"wide_fear": {"straw": 20, "wood": 4},
"quick_fear": {"straw": 16, "scrap": 6},
"reinforced_fences": {"wood": 20, "scrap": 6},
"long_range": {"scrap": 14, "wood": 10},
"sticky_tar": {"straw": 14, "scrap": 6},
"radar": {"scrap": 8, "wood": 6},
"fence": {"wood": 2},
"gate": {"wood": 4, "scrap": 1},
"slowing_trap": {"scrap": 3, "wood": 1},
"automated_defense": {"scrap": 6, "wood": 2, "straw": 2},
}
@export_group("Upgrades")
## Bought once each by day, for costs[id] (Upgrades), either at the work area's workbench (the
## default shop) or the supply shed's counter ("shop": "shed": weapons and other purchasable
## items, Upgrades.shop_of, UpgradePanel's shop filter). Each changes one stat: "mult" multiplies
## it, "add" adds to it. Stats are GameConfig settings, plus scarecrow_max_hp (the scarecrow's, in
## FarmState) and barrier_hp (fences' and gates' health). One without a stat unlocks something
## instead (sprint: PlayerCharacter; the corn shooter and pumpkin bombs: ScarecrowCombat).
## "requires": another upgrade that must be bought first (from either shop).
@export var upgrades: Dictionary = {
"corn_shooter": {"name": "Corn shooter", "text": "A gun that fires corn kernels, from afar", "track": "Weapon", "shop": "shed"},
"rapid_fire": {"name": "Rapid fire", "text": "The corn shooter fires a third faster", "track": "Weapon", "stat": "fire_rate", "mult": 1.333, "requires": "corn_shooter"},
"heavy_seeds": {"name": "Heavy seeds", "text": "Each kernel does 2 damage", "track": "Weapon", "stat": "shot_damage", "add": 1, "requires": "corn_shooter"},
"pumpkin_bomb": {"name": "Pumpkin bombs", "text": "Throw a pumpkin that bursts, hurting everything within 3 m (one every 4 s)", "track": "Weapon", "shop": "shed"},
"potato_cannon": {"name": "Potato cannon", "text": "A slow heavy potato shot that hits hard from afar", "track": "Weapon", "shop": "shed"},
"shurikens": {"name": "Shurikens", "text": "Fast, cheap throws for a quick hit", "track": "Weapon", "shop": "shed"},
"propane_torch": {"name": "Propane torch", "text": "A jet of flame that burns everything in a band ahead of you while held", "track": "Weapon", "shop": "shed"},
"alien_ray": {"name": "Alien ray", "text": "A salvaged alien weapon: a fast, powerful beam", "track": "Weapon", "shop": "shed", "hidden": true},
"radar": {"name": "Radar", "text": "A minimap showing nearby enemy positions", "track": "Item", "shop": "shed", "hidden": true},
"wide_fear": {"name": "Wide fear", "text": "Fear reaches 30% farther", "track": "Fear", "stat": "fear_radius", "mult": 1.3},
"quick_fear": {"name": "Quick fear", "text": "Fear recharges 20% faster", "track": "Fear", "stat": "fear_cooldown", "mult": 0.8},
"straw_stuffing": {"name": "Straw stuffing", "text": "+2 max health", "track": "Scarecrow", "stat": "scarecrow_max_hp", "add": 2},
"pouch_upgrade": {"name": "Bigger pouch", "text": "+8 pouch capacity (16 total)", "track": "Scarecrow", "stat": "pouch_capacity", "add": 8},
"sprint": {"name": "Sprint", "text": "Sprint 80% faster for 4 s at a time, every 10 s", "track": "Scarecrow"},
"reinforced_fences": {"name": "Reinforced fences", "text": "Fences and gates +50% health", "track": "Defenses", "stat": "barrier_hp", "mult": 1.5},
"long_range": {"name": "Long-range defenses", "text": "Turrets reach 30% farther", "track": "Defenses", "stat": "turret_range", "mult": 1.3},
"sticky_tar": {"name": "Sticky tar", "text": "Tar patches hold 50% longer", "track": "Defenses", "stat": "trap_slow_time", "mult": 1.5},
}
## An upgrade with "hidden": true (e.g. Alien Ray, Radar, #7/#8) shows only a "?" (no name, text,
## or cost) and can't be bought until the player has collected this much Alien Goop in total
## (Upgrades.goop_collected); then it shows and buys normally for its defined cost. Overridable
## per item with its own "reveal_goop". 5 is about 15 Alien kills at the default 33% drop chance
## (alien_goop_drop_chance) — a few kills in, not instant and not a grind.
@export_range(0, 999) var hidden_reveal_goop: int = 5
@export_group("Assessment")
## The final assessment's weight per category (Assessment): the score is the weighted share of
## each category kept, renormalized over the categories in play, as 0..100 points.
@export var assessment_weights: Dictionary = {"crops": 0.5, "animals": 0.3, "supplies": 0.2}
## Rating tiers, best first: the first one whose min the score reaches.
@export var rating_tiers: Array[Dictionary] = [
{"min": 95, "name": "Blue-ribbon harvest", "text": "The farmers can hardly tell they were gone."},
{"min": 80, "name": "Bumper crop", "text": "A few gaps in the rows, nothing a good week won't fix."},
{"min": 60, "name": "Fair season", "text": "The farm made it, a little thinner than they left it."},
{"min": 40, "name": "Lean season", "text": "The farmers will be counting what's missing for a while."},
{"min": 0, "name": "Hanging by a thread", "text": "There's a farm left, but only just."},
]
@export_group("Structures")
## Hit points of the built defenses; a slowing trap's "HP" is the enemies it can still slow.
@export_range(1, 500) var fence_hp: int = 20
@export_range(1, 500) var gate_hp: int = 30
@export_range(1, 500) var trap_triggers: int = 10
@export_range(1, 500) var turret_hp: int = 25
## The Workbench (#9): not built by the player (it's granted once Night 1 is survived --
## StructureSystem.grant_workbench()), but it has HP, can be damaged, and is repaired like any
## other structure (repair-only: it stays, broken, at 0 HP instead of being destroyed).
@export_range(1, 500) var workbench_hp: int = 50
## A ground enemy crossing a slowing trap moves at this share of its speed for this long.
@export_range(0.05, 1.0) var trap_slow_factor: float = 0.5
@export var trap_slow_time: float = 2.0
## The automated defense shoots the nearest enemy in range with a clear line, every interval.
@export var turret_range: float = 7.0
@export var turret_fire_interval: float = 1.0
## The scarecrow builds within this distance of itself.
@export var build_range: float = 9.0
## Enemies treat each cell of a barrier as this many meters of extra path, so they walk around
## a short wall but break through a long one.
@export var barrier_detour: float = 18.0
## Holding interact for repair_time repairs a structure fully, for its build cost scaled by the
## share of HP (or triggers) it is missing, rounded up.
@export var repair_time: float = 1.5
## Dismantling gives back this share of the build cost (rounded down), into the shed.
@export_range(0.0, 1.0) var dismantle_refund: float = 0.5
## Cells finalized per tick while flow fields rebuild after a structure change.
@export_range(100, 100000) var flow_slice_cells: int = 2000
## Per-instance leveling (StructureSystem.LEVELABLE: automated_defense, slowing_trap; L1-L3), not
## account-wide like the workbench upgrades above. Holding interact at a specific placed structure
## (by day; it must be undamaged first) pays structure_level_costs[type][level - 1] to take it from
## level to level + 1 (index 0: L1->L2, index 1: L2->L3).
@export var structure_level_costs: Dictionary = {
"automated_defense": [{"scrap": 10, "wood": 4, "straw": 2}, {"scrap": 16, "wood": 6, "straw": 4}],
"slowing_trap": [{"scrap": 5, "wood": 2}, {"scrap": 8, "wood": 4}],
}
## Turret L2 fires this many times as often (mirrors the Rapid Fire upgrade's live multiplier,
## 3.0 in game_config.tres); L3 keeps the same rate.
@export var turret_level_fire_mult: float = 3.0
## Turret L3 fires this many shots at once in a fan around the aim direction, turret_l3_spread_deg
## apart (a triangle spread: the outer two off by the full spread from the center shot).
@export_range(1, 8) var turret_l3_projectiles: int = 3
@export var turret_l3_spread_deg: float = 10.0
## A tar patch's footprint (trigger area) and visual grow by this multiple of its L1 size, per
## level (index 0 = L1, so always 1.0).
@export var trap_level_size_mult: Array[float] = [1.0, 2.0, 3.0]
## Holding interact for structure_upgrade_time levels up a structure, paying structure_level_costs
## at the end (by day only; see Interactions).
@export var structure_upgrade_time: float = 2.0
@export_group("Combat")
## Height of the gun muzzle, the bullets, and enemy hit proxies (shots fly horizontally). It
## clears the sunflowers (1.67 m) and the pen fence (1.69 m), so thieves in the field stay
## visible and shootable.
@export var combat_height: float = 1.8
## The pitchfork, every scarecrow's from the start (ScarecrowCombat): a stab every
## pitchfork_interval s hits the nearest pitchfork_targets enemies within pitchfork_reach m of the
## scarecrow's center (plus their hit radius) and pitchfork_arc degrees of the aim, with a clear
## line, for pitchfork_damage each.
@export var pitchfork_reach: float = 2.2
@export var pitchfork_arc: float = 100.0
@export_range(1, 20) var pitchfork_damage: int = 2
@export_range(1, 20) var pitchfork_targets: int = 3
@export var pitchfork_interval: float = 0.5
## Pumpkin bombs (the Pumpkin bombs upgrade): thrown at the aim point, bomb_min_range ..
## bomb_range m away, flying at bomb_speed m/s; on landing every enemy within bomb_radius m takes
## bomb_damage. One every bomb_cooldown s.
@export var bomb_range: float = 10.0
@export var bomb_min_range: float = 2.0
@export var bomb_speed: float = 12.0
@export var bomb_radius: float = 3.0
@export_range(1, 50) var bomb_damage: int = 3
@export var bomb_cooldown: float = 4.0
## The corn shooter (the Corn shooter upgrade) is the gun: kernels per second and their damage
## (rapid fire and heavy seeds raise them), and the projectiles below.
@export var fire_rate: float = 6.0
## Damage of one of the scarecrow's shots (automated defenses always do 1).
@export_range(1, 10) var shot_damage: int = 1
@export var projectile_speed: float = 24.0
@export var projectile_lifetime: float = 2.0
@export_range(1, 1024) var projectile_capacity: int = 64
## Horizontal distance from the scarecrow's center to the muzzle along the aim direction.
@export var muzzle_distance: float = 1.05
## Right-stick radial dead zone, and mouse travel (px) that switches aiming back to the mouse.
@export var aim_dead_zone: float = 0.3
@export var mouse_switch_threshold: float = 12.0
## Potato Cannon (the Potato cannon upgrade, bought at the supply shed, Task #7): one heavy potato
## every potato_cannon_cooldown s, potato_cannon_damage each, flying slow (potato_cannon_speed m/s)
## and not far (potato_cannon_lifetime s) through FarmProjectiles.
@export var potato_cannon_cooldown: float = 1.4
@export_range(1, 50) var potato_cannon_damage: int = 6
@export var potato_cannon_speed: float = 11.0
@export var potato_cannon_lifetime: float = 2.5
## Shurikens (the Shurikens upgrade, bought at the supply shed): shuriken_count thrown every
## shuriken_cooldown s, shuriken_damage each, flying fast (shuriken_speed m/s) and not far
## (shuriken_lifetime s).
@export var shuriken_cooldown: float = 0.25
@export_range(1, 20) var shuriken_damage: int = 1
@export var shuriken_speed: float = 34.0
@export var shuriken_lifetime: float = 1.0
@export_range(1, 6) var shuriken_count: int = 1
## Propane Torch (the Propane torch upgrade, bought at the supply shed): a band of fire while held
## (#17), a tick every torch_tick_interval s, torch_damage each to the enemies in a torch_width m
## wide band along the gun's line, from the scarecrow out to torch_range m past the muzzle (the
## nearest torch_targets), with a clear line (ScarecrowCombat._band_hit). Its flame (TorchFlame)
## is sized to the band.
@export var torch_range: float = 4.5
@export var torch_width: float = 1.6
@export_range(1, 20) var torch_damage: int = 1
@export_range(1, 20) var torch_targets: int = 5
@export var torch_tick_interval: float = 0.2
## Alien Ray (the Alien ray upgrade, hidden until hidden_reveal_goop Alien Goop is collected): one
## heavy shot every alien_ray_cooldown s, alien_ray_damage each, flying fast (alien_ray_speed m/s)
## through FarmProjectiles.
@export var alien_ray_cooldown: float = 0.9
@export_range(1, 80) var alien_ray_damage: int = 9
@export var alien_ray_speed: float = 50.0
@export var alien_ray_lifetime: float = 2.0
@export_group("Radar")
## Radar (the Radar item, bought at the supply shed, hidden until hidden_reveal_goop Alien Goop is
## collected, #8): once owned, a minimap shows every alive enemy within radar_range meters of the
## local scarecrow, redrawn every radar_refresh seconds (RadarHud). 40 m is generous: it covers
## most of the playable farm (60x60) from a central position, so the minimap is useful without
## needing to be perfectly centered on the scarecrow at all times. A quarter-second refresh keeps
## the dots responsive without redrawing every frame.
@export var radar_range: float = 40.0
@export var radar_refresh: float = 0.25
@export_group("Enemies")
@export_range(1, 1024) var enemy_capacity: int = 800
## The enemy roster (EnemySystem.TYPE_NAMES), one row per type:
## speed, acceleration m/s, m/s^2
## hp hits it takes
## flying ignores ground occupancy, structures, and traps; altitude is only
## visual (its hit proxy stays at combat height)
## targets what it goes for: loot categories ("crops", "animals", "supplies"), or
## "structures" (barriers guarding valuables)
## steal_time times the category's steal time
## carry_speed share of its speed while carrying loot
## structure_damage per hit on a barrier, every hit_interval
## damage, hit_interval per melee hit on the scarecrow, and the cooldown between hits
## aggression "none" (never fights), "contact" (hits the scarecrow when touching it
## while busy), "fight" (turns on a scarecrow within aggro_range, and
## hunts it when nothing is left to break)
## hit_radius projectile hit proxy
@export var enemy_types: Dictionary = {
"thief": {"speed": 3.0, "acceleration": 14.0, "hp": 3, "flying": false, "targets": ["animals", "supplies"],
"steal_time": 1.0, "carry_speed": 0.7, "structure_damage": 2, "damage": 1, "hit_interval": 1.2,
"aggression": "contact", "hit_radius": 0.4, "aggro_range": 0.0},
"crow": {"speed": 5.5, "acceleration": 18.0, "hp": 1, "flying": true, "targets": ["crops"],
"steal_time": 0.8, "carry_speed": 0.75, "structure_damage": 0, "damage": 0, "hit_interval": 1.0,
"aggression": "none", "hit_radius": 0.45, "aggro_range": 0.0},
"breaker": {"speed": 1.9, "acceleration": 8.0, "hp": 6, "flying": false, "targets": ["structures"],
"steal_time": 0.0, "carry_speed": 0.0, "structure_damage": 8, "damage": 2, "hit_interval": 1.5,
"aggression": "fight", "hit_radius": 0.55, "aggro_range": 4.0},
## Fast, fragile, and always spoiling for a fight: a UFO heads straight for the scarecrow (no
## loot, so no targets) and dives in for a strafing pass every hit_interval (ThiefBehavior).
"ufo": {"speed": 7.0, "acceleration": 20.0, "hp": 2, "flying": true, "targets": [],
"steal_time": 0.0, "carry_speed": 0.0, "structure_damage": 0, "damage": 1, "hit_interval": 1.5,
"aggression": "fight", "hit_radius": 0.5, "aggro_range": 10.0},
}
## Flyers cruise at this visual altitude and come down to land_altitude to take a crop.
@export var cruise_altitude: float = 3.2
@export var land_altitude: float = 1.55
## Barriers within this distance of the crop rows, the pen, or the shed guard them: fence
## breakers go for those first.
@export var guard_range: float = 6.0
## Body radius of ground enemies (navigation clearance is this plus nav_inflate_margin).
@export var enemy_radius: float = 0.3
@export var nav_cell_size: float = 0.5
@export var nav_inflate_margin: float = 0.05
@export var separation_radius: float = 0.8
@export var separation_weight: float = 1.4
## Bounded push per tick when enemies overlap each other or the scarecrow.
@export var max_correction_per_tick: float = 0.15
## Melee: an enemy touching the scarecrow (within this much of contact) and off cooldown hits
## it for its type's damage; the cooldown (hit_interval) starts on every attempt.
@export var enemy_attack_reach: float = 0.25
## Fleeing enemies (fear) run at this share of their normal speed.
@export var flee_speed_factor: float = 1.15
## Within this distance and with a clear line, enemies steer straight at their target.
@export var direct_seek_distance: float = 12.0
## Trickle mode, for tests and soaks: when above 0, the night's plan is ignored and this many
## enemies of trickle_type are kept on the farm, the next arriving thief_spawn_interval after one
## leaves (anywhere along the farm's edge). 0 plays the night's NightPlan (WaveDirector).
@export_range(0, 32) var night_thieves: int = 0
@export var thief_spawn_interval: float = 6.0
@export var trickle_type: String = "crow"
## What trickle enemies go for: "crops", "animals", "supplies", or "any" (of their type's targets).
@export var trickle_target: String = "any"
## Alien Goop (Decision 11): a killed Alien (TYPE_THIEF) drops this much goop this often, credited
## straight into the pouch like a gathered material (ResourceStore.MATERIALS).
@export_range(0.0, 1.0) var alien_goop_drop_chance: float = 0.33
@export_range(0, 20) var alien_goop_drop_qty: int = 1
## A row of the enemy roster.
func enemy(type_name: String) -> Dictionary:
return enemy_types.get(type_name, {})
## Full hit points of a structure type (a slowing trap's are the enemies it can still slow).
func structure_hp(type: String) -> int:
match type:
"fence":
return fence_hp
"gate":
return gate_hp
"slowing_trap":
return trap_triggers
"workbench":
return workbench_hp
return turret_hp
## Length of a phase in seconds, or INF for the untimed morning review and terminal phases.
func phase_length(phase: CampaignController.Phase) -> float:
match phase:
CampaignController.Phase.DAY:
return day_length
CampaignController.Phase.DUSK:
return dusk_length
CampaignController.Phase.NIGHT:
return night_length
CampaignController.Phase.DAWN:
return dawn_grace
return INF