The crew system
Archetype ids as a join key: name tokens, gated events, and perks wired at hook sites.
The crew system is the richest subsystem, and it is a case study in using one stable key to wire four different mechanics. That key is the archetype id (deb, randy, doses, rita, hitch, bird).
One id, four mechanisms
Everything hangs off crewHas, a two-line predicate:
1219 function crewHas(s, id) { var c = crewByArch(s, id); return !!(c && c.ok); }
With that in hand, the archetype id drives:
- Name tokens. Flavor text embeds
{deb},{randy}, … andresolveCrew(s, str)swaps in the current (possibly renamed) name — falling back to another living crew member if that archetype isn't aboard, so a raw token or "undefined" never renders. Applied to event title/text, choice labels, outcome lines, and driving captions. - Gated storylines. Events carry
needs: "<archetype>";driveOn's pool filter keeps them out unlesscrewHaspasses. A benched or lost van-mate's storyline never fires. - Passive perks.
crewHasis checked at each hook site, so perks apply only while the member rides with you:
| archetype | perk | hook |
|---|---|---|
| deb | −$1 Shakedown prices | lotPrice() |
| doses | −1 grub per leg | legNeeds() |
| rita | +6 tape quality | finishMini() |
| hitch | −1 van wear, +1 road luck | driveOn() |
| bird | +2 show Vibes | show boost |
| randy | scavenges on arrival | maybeRandyFind() |
- Arrival perks.
maybePoolCrew(morale-gated resource sharing above 65 Vibes) andmaybeRandyFindfire inresumeLeg.
Selection, renaming, and variants
S.crewPick (a roster with on/name) is edited on the crew screen; rebuildCrew(s) projects it into live S.crew ({id, name, trait, ok}), preserving each survivor's ok. Each archetype ships two name variants (a female and a male take), and rollRoster() picks one per trip — so a run fields Cosmic Deb or Cosmic Dean. Perks and traits are archetype-level, so either name reads right.
Loss
loseCrewById(s, id) sets ok = false. Lose the last one and checkDeath ends the run ("alone"). Low morale can make a member quit (maybeCrewQuits), which is why a Vibes crash is a compounding threat — it removes hands and their perks, not just a number.
Adding a van-mate
A roster entry in VANMATES, a crewHas check at the relevant hook site, and (optionally) a needs-gated event. That's the whole recipe — the four mechanisms above already understand a new archetype id.
- The archetype id is a join key wiring names, gated events, perks, and arrival bonuses.
- Everything crew-dependent funnels through
crewHas(aboard AND alive), so perks vanish with the member. - A new van-mate is a roster entry plus one
crewHashook; losing the last one ends the run.