Repository navigation
S7a: Contract for the clinic - #381
Conversation
Adds what S7 needs for the clinic's doctor to buy a kidney and fit the bionics: `sell_part` sells a part of the player's body by its `Body` field, `fit` asks for a bionic in place of a part, and `player_state`'s `buyer` gains `parts`, what it pays for parts of the body, and `fittings`, the bionics it fits with their prices and the parts each can take. `BodyPart` names the six `Body` fields. The new fields are left out of dumps while empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # client/src/net/protocol.ts # docs/protocol.md # server/simile/protocol/messages.py # server/simile/protocol/protocol.schema.json # server/tests/protocol/test_messages.py
|
Scope and additivity check out: only the owned paths change. All 44 of main's example messages re-dump byte for byte on this branch. The design covers S7 and S15. But the fixed rules aren't checked on what the server sends:
A decision for S7, not this PR: the docs leave |
…s by BodyPart A Fitting rejects a part its bionic can't replace or a part named twice, a Buyer offers each bionic once, and Buyer.parts is keyed by BodyPart, so the schema gains propertyNames. The clinic's doctor buys one kidney, never the second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-review at 03eb34f: everything is still additive and the generated files are current. All 44 of main's example messages re-dump byte for byte. One gap:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-review at 54e2445: approved. |
The contract S7 (#354) needs for the clinic's doctor to buy a kidney and fit the bionics. Nothing sends or handles any of it yet; S7 does.
Client → server
sell_part:{"type": "sell_part", "part": "left_kidney"}sells a part of the player's body, by itsBodyfield, to the buyer where they stand, at its price inbuyer.parts. The part is"sold"from then on.sellstays as it is: it goes by carried item id, and a kidney isn't carried.fit:{"type": "fit", "bionic": "infrared_eye", "part": "right_eye"}has the buyer where they stand fit a bionic in place ofpart, one of the parts it can go in, for its price. The server ignores one that isn't on offer, a part it can't go in, or one they can't pay for.Server → client
player_state'sbuyergainsparts, what it pays for each part of their body it would buy now ({"left_kidney": 100}), andfittings, the bionics it would fit now, whether or not they can pay. AFittingis{"bionic": "hydraulic_legs", "name": "Hydraulic legs", "price": 80, "parts": ["legs"]}; the eye'spartsare["left_eye", "right_eye"]. Both are left out while empty, as at the scrap trader's stall.Schema
BodyPart, a literal of the sixBodyfield names, forsell_part,fitandFitting.parts, so the client gets a typed union. A test keeps it equal toBody's fields.Additive only
partsandfittingsare left out of dumps while empty and aren't required in the exported schema, so every existing message,buyerincluded, dumps as before. Nothing saved changes:Player.jsonis the same.sell_partandfitare only added to the client union.protocol.schema.jsonandprotocol.tsare regenerated, anddocs/protocol.mdhas both messages and the new fields.Choices
buyer, not a newclinicfield. The doctor is a keeper at their place who also buys salvage, so one object says everything they'd trade where the player stands, and the client's buyer hint and reach code extend rather than fork.sell'sitem: nullalready means "everything it buys", so a part there would have been ambiguous.fitnames the part. For the legs and the datajack there's only one, but the eye can go in either, and the player chooses.partskeyed byKey, notBodyPart, likeprices: a literal-keyed dict generates no better TypeScript.Closes #380
🤖 Generated with Claude Code