Repository navigation
S6: Salvage, and selling it - #373
Conversation
Salvage lies at the maps' pickups and sells at the scrap trader's stall and the clinic, at the economy's prices, through the ledger. - TownMap reads each map's pickups layer. - The player's money goes through E3's ledger as PLAYER: meals, salvage sales and money found. They're outside the residents' books, so the residents' gap is as before, and net(PLAYER) is what they've gained. - Pickups: what lies at the maps' salvage and secret pickups until taken, and picking up from those and what they left. Taken pickups are kept in Player.taken; what doesn't fit of one goes into left. - Trade: the buyer where they stand, and selling to it. - player_state carries the buyer and the world's piles. - Client: E picks up and sells, the corner says what and for how much, and a glint marks each pile on the street. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each salvage pickup has its own respawn in PlayerConfig.salvage, a sim day for now, counted from when Player.taken says it was last taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The metro's six salvage pickups each have something set to lie there, its secrets hold 25, 40 and a ration pack, and the scrap trader's stall and the clinic buy. The synthetic pickups and stalls now live only where the real ones aren't. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Changes requested: one item, the comment rule. The behaviour, the ledger, the scope and the tests are right. Change
Checked and fine
Not blocking
Taste, for you
|
- Docstrings this PR adds or lengthens are one line; load_map's is back to three. - Economy.pay raises, recording nothing, when the player can't pay, so net(PLAYER) can't drift. - A salvage pickup can name its item in the map, as a secret does, with PlayerConfig.salvage the fallback for the metro's six, and PlayerConfig.respawn the delay unless a pickup has its own. - The hint and the sale log say each kind once: "copper wire ×2". - Wrap the two long README lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Approved. I re-reviewed at Since
|
Salvage to pick up in the metro with E, within the carry limit, and selling it at the scrap trader's stall and the clinic, at the economy's prices, through E3's ledger. Built on the contract in #372 and S3's metro (#370).
Closes #353
What it does
pickups.TownMapnow reads each map'spickupslayer. A pickup can name its item in the map, as a secret does, so S9's generated sewers can say what lies where. The metro's six (S3'smetro_salvage_1…_6) don't, soPlayerConfig.salvagefills them in, from copper wire (1.5 kg) to a servo motor on the high ledge (3 kg): 12.5 kg in all, against the 9 kg the player can carry beside the lamp.PlayerConfig.respawn(a sim day) after it was last taken, byPlayer.taken's time, unlessPlayerConfig.salvagegives it its own. The three secrets, 25 and 40 in cash and a ration pack, stay taken for good.Pickups,simile.player): E takes from the nearest pile in reach, theirs or the world's: its money, and each item that still fits. Whatever of a pickup didn't fit becomes a pile of theirs inleft.Trade): anywhere in the scrap trader's stall or the clinic,player_state'sbuyernames it with the economy's price for each kind of salvage they carry, and E sells everything it buys.EconomyConfig.salvage(copper wire 6, scrap steel 5, circuit board 8, brass valve 7, signal relay 6, servo motor 18), paid by thebuyers. Whoever later voices them only says them.side/piles.ts).The ledger balances, with the player in it
The player's money now goes through E3's ledger as
PLAYER: meals (S5 paid them as fromOUTSIDE), salvage sold (salvage) and money found (found), both fromOUTSIDE.Economy.paymovesPlayer.moneyforPLAYER, once the player module joins the player to the economy. It raisesValueErrorand records nothing when the player can't pay, so a caller that forgets to check (S7's fitting, say) can't letnet(PLAYER)drift. The player isn't a resident, so to the residents' books they're outside the village:came_in,went_out,heldandgapare as before for residents, andledger.net(PLAYER)is always what the player has gained. Tests check both after picking up and selling.Please look at
For S7
Notes
test_simulate's 24-hour day (from 08:00, seed 0, talk 3) on main (3bd04b0, with the metro) and on this branch: 75,577EntityMovedevents, identical, and the same summary.simile.dbin a temp dir: all 11 residents back on their saved tiles and the player as saved; then the stairwell's 25 and the copper wire picked up in the metro, the wire sold at the stall, and the save written and reloaded withtakenand both ledger entries.server/simile/world/map.pyandserver/tests/world/test_map.py, for thepickupslayer. In the client, besideui/andworld/reach.ts, the glint is a newclient/src/side/piles.tswith three lines inside-scene.tsand one inside/README.md.Hunger.pick_upmoved toPickups, with its tests.Follow-ups
simile/tools/report.py) counts any entry fromOUTSIDEas money into the village, so the player's salvage and found money show there as "in", and their meals as "between" residents. It wants a row for the player.