fix(rust): a zone resource carries its deadline as until (W1)
Stage 4 of docs/modules/rust/PLAN_LAST_FIXES.md, the module's half of W1. A placed zone now reports `until`, reckoned from the answer as now plus holdMs, so it lands a round trip after the game's own deadline and never before it. Core's reconcile then files a zone gone past that deadline as expired, where a reconnect used to log resource.orphaned five seconds before the game's world.expired arrived. Crates and NPCs send no holdMs, so they carry no until. No core pin change: `until` has been in the resource contract all along, and a core without the reconcile half only shows it on the console. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -324,11 +324,19 @@ async function place(server, send, body, what) {
|
||||
}
|
||||
|
||||
const placed = Array.isArray(data.placed) ? data.placed : []
|
||||
// A zone's deadline, as core's `until` (W1, PLAN_LAST_FIXES). The game erases
|
||||
// the zone `holdMs` after it placed it; reckoned from the answer, on this
|
||||
// clock, it lands a round trip after the game's, never before. With it core's
|
||||
// reconcile files a zone gone past its deadline as expired instead of
|
||||
// orphaned, which a reconnect used to show five seconds before the game's own
|
||||
// `world.expired` arrived. Crates and NPCs have no deadline and send none.
|
||||
const until = Number(body.holdMs) > 0 ? new Date(Date.now() + Number(body.holdMs)).toISOString() : null
|
||||
return {
|
||||
ok: true,
|
||||
resources: placed.map((row) => ({
|
||||
kind: OWNED_KIND,
|
||||
ref: refOf(server.id, row.id),
|
||||
...(until ? { until } : {}),
|
||||
payload: {
|
||||
serverId: server.id,
|
||||
what: row.kind,
|
||||
|
||||
Reference in New Issue
Block a user