feat(bridge): Economics on protocol 14 — pay, balances, adjust (PLAN_REDESIGNS §11.2) #31
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/protocol-14-economics"
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?
What & why
The bridge half of
PLAN_REDESIGNS.md§11.2.2: Wulf's Economics as an optional integration (D199). The spec isdocs/rust-link/PROTOCOL.md§20.3 (docs PR alongside). It stays on protocol 14 (D332).integrations.economicsaddsstartingBalanceandwipesWithMap. Both are read fromEconomics.jsonin the framework's config directory, re-read only when the file changes, and absent when the file can't say. Hello is re-sent when Economics loads or unloads.economics.paypays coins from an event step, and the coins are kept once paid (D335).Depositanswerstruewhile rounding and clamping.failedreasons areat-limit,refused,unmeasuredandbad-id.data/RunicGateway/payments.json, so a retry answersrepeat: trueand pays nobody.{amount}replaced by what that player received. It is told now if they're awake, otherwise when they next wake (§20.2's rule).economics.balancesis bounded byPermMaxOps.economics.adjustis for staff: deposit, withdraw or set.insufficient, with the balance.at-limit.player.tallygainsbalance, a value rather than a change. It is read at connect (D336), when Economics loads with players on, and fromOnEconomicsBalanceUpdated. Offline players are included, and a frame carries anameonly for a connected player.economics.wipedcomes fromOnEconomicsDataWiped(IPlayer).newSaveis true for the no-argument (new save) call.Per the spike, every amount is boxed as
doubleand only parsed Steam ids reach Economics.requires_pluginsis unchanged. The README notes the plugin as optional.How it was tested
node scripts/checkPlugin.js: protocol 14, 57 hooks, every one void and listed.node --test scripts/checkPlugin.test.jspasses.DoubleFieldhelper, which was fixed by using the existing one. Both rigs were then given back their protocol 13 bridge.player.IsConnectedinOnEconomicsBalanceUpdated, a property the file already uses. Static checks were re-run.Checklist
AI-assisted contributions (required)
Claude Code (Claude Opus 5.5). I have reviewed and understandevery change, and take responsibility for it. AI-authored commits are
marked with a
Co-Authored-By/Assisted-Bytrailer.License
(GNU GPL v3.0 or later), and I have the right to contribute it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
Wulf's Economics as an optional integration (D199), as §11.2.2 designs it: - hello/status `integrations.economics` adds startingBalance and wipesWithMap, read from Economics.json (cached by mtime) because its API has neither. - `economics.pay`: coins from an event step, kept once paid (D335). One main- thread call for the list; each deposit measured as after - before, since Deposit answers true while rounding and clamping (`at-limit` otherwise). The key and its reply are kept in data/RunicGateway/payments.json for seven days, so a retry answers `repeat: true` and pays nobody. The optional message ({amount} = what landed) is told now if awake, else on wake. - `economics.balances` (bounded by PermMaxOps) and staff `economics.adjust` (deposit / withdraw / set; a withdrawal above the balance is refused `insufficient` with the balance). - `player.tally` gains `balance`, a value: read at connect (D336) and from OnEconomicsBalanceUpdated, offline players included. - `economics.wiped` from OnEconomicsDataWiped(IPlayer), with `newSave`. Amounts are boxed as double and only Steam ids are sent, per the spike. Compiled on both rigs (Oxide 2.0.7826, Carbon 2.0.262), then restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY