Add Deposit and ResourceDeposits classes for resource placement #29
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder#29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First implementation slice of #26's deposit data model, scoped to just enough to get two resources - Iron and Clay - modelled. No placement algorithm here; this is the data type and its container only. Ore and clay generation land in separate issues that build on this one.
DepositTypeA
Resource, not part ofDeposititself - authored, shared config data (display name, colour for visualisation, flavour text), identical for every deposit of that kind on every map. Same pattern asTerrainPreset: one.tresper type under something likeresources/deposits/(e.g.iron.tres,clay.tres), loaded viaload()and referenced rather than duplicated. No enum of resource types anywhere - adding a new resource later is authoring a new.tres, not touching an enum or a switch statement.DepositA plain
RefCounted, not aResource- a deposit is transient, per-map generated output, not authored/shared data the wayDepositTypeorTerrainPresetare. Fields:type: DepositType- a reference to the shared, authored resource above, not an enum.load()returns the same cached instance every time (seeterrain_grid.gd's note on this undernext_shape()), so==comparisons and type-filtering work the same as they would against an enum value.Array[Vector2i]No per-cell richness variation and no discovered/revealed state field. #26 leaves room for both (the dot-grid richness gradient, and a reveal/fog-of-war mechanic), but neither has a consumer yet, so adding the fields now would be speculative. They can be added when something actually needs them.
ResourceDepositsA class of its own, sibling to
TerrainGridrather than a responsibility bolted onto it -TerrainGridalready owns terrain shape/seed lifecycle and is busy enough. HoldsArray[Deposit]and exposes basic query accessors (e.g. deposits at a cell, deposits of a givenDepositType) - enough for the two placement issues and any future consumer, without guessing ahead at what mining or sensors will eventually need.generate(terrain: TerrainGrid, map_seed: int)is called bygame.gdimmediately afterTerrainGrid.generate(), mirroring the existing seed-handover pattern (TerrainGriddeliberately doesn't generate in_ready()so its owner can hand over the run seed first - same reasoning applies here). This issue can leavegenerate()as an empty placeholder; #31 and #32 are what actually populate it.References
#26 (deposit data model decision). Depended on by #31 (clay deposit generation) and #32 (iron deposit generation).