Task #4: Alien Goop resource and drop-on-kill from Aliens
Add alien_goop as a 4th ResourceStore material alongside wood/scrap/straw, dropped only by killed Aliens (TYPE_THIEF) at a config-tunable rate/quantity (GameConfig.alien_goop_drop_chance default 0.33, alien_goop_drop_qty default 1), credited straight into the pouch like a gathered material via a new enemy_removed hook in FarmSim (seeded RNG for reproducible trials). It's stealable from the shed through the existing most-stocked-material sack mechanic once it outranks the others (ShedStock gets a placeholder front/ label spot for it, reusing the wood pile's proven-walkable spot; no new art). ResourceStore.from_dict() now treats a shed/pouch entry missing a material as 0 instead of rejecting it (old saves predate Alien Goop), and to_dict() always fills in every material so round-trips are consistent regardless of how the live dict was built; every method summing across MATERIALS reads with get(m, 0) so a hand-built 3-key dict elsewhere doesn't error out. New checks in test_economy.gd: _goop_persistence (retry discards goop gained since the morning; the morning snapshot round-trips through JSON) and _goop_drops (1000-kill statistical drop-rate check against config, type restriction to Aliens only, pouch-capacity-respecting credit, and shed-theft eligibility). Updated _state()'s and test_cycle.gd's hardcoded 3-key shed dicts for the new 4th material. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
aa50e97311
commit
1ab666e5e4
9 changed files with 178 additions and 37 deletions
|
|
@ -91,10 +91,12 @@ extends Resource
|
|||
@export var pickup_radius: float = 1.3
|
||||
|
||||
@export_group("Resources")
|
||||
## Wood, scrap, and straw in the supply shed when the vacation starts.
|
||||
## 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.
|
||||
@export_range(1, 200) var pouch_capacity: int = 16
|
||||
## Seconds of holding interact per gather (each takes one charge of the gather point).
|
||||
|
|
@ -271,6 +273,10 @@ extends Resource
|
|||
@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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue