feat(rust): Guarded Crate — feed, map, Warden, Place a guarded crate (PLAN_REDESIGNS §14.3.5)
Stage 6 of the §14.3 integration plan, on protocol 14. Spec: docs rust-link/PROTOCOL.md §20.9. - gc.started and gc.ended public, gc.failed staff's; guardedCrate.js reads each row per viewer (the clearer's name for the presence audience, Steam id, position and key for staff, `won` for everyone). - Triggers rust.gc.started and rust.gc.ended (a crate a player cleared only). - The step rust.gc.place: an event from rust.options.gc_events and a world call's location; refused at verify for Guarded Crate absent, NpcSpawn missing (D364), console unavailable, or an unknown event. Kept (D373); the run log's success line says so (D380). Budget rust.gc.crates. - Warden (D375): guarded_won, title category guardedwon, Crates cleared column. - Map marker, server settings line, swagger, engagement manifest, bundle, README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -275,10 +275,42 @@ async function dtReportFor(serverId) {
|
||||
return rows[0] || null
|
||||
}
|
||||
|
||||
/**
|
||||
* What one server's last status said about Guarded Crate (with NpcSpawn and its
|
||||
* event names) and its console (protocol 14, PLAN_REDESIGNS §14.3.5):
|
||||
* `{ guardedCrate, console }`, as `dtReportFor`'s are. Null for a server with no
|
||||
* state yet.
|
||||
*/
|
||||
async function gcReportFor(serverId) {
|
||||
const rows = await core.query(
|
||||
`SELECT JSON_EXTRACT(raw, '$.integrations.guardedCrate') AS guardedCrate,
|
||||
JSON_EXTRACT(raw, '$.console') AS console
|
||||
FROM ${STATE}
|
||||
WHERE server_id = ?`,
|
||||
[serverId],
|
||||
)
|
||||
return rows[0] || null
|
||||
}
|
||||
|
||||
/** `gcReportFor` for every enabled server, with its id and name: the event list a step offers. */
|
||||
async function gcReports() {
|
||||
return core.query(
|
||||
`SELECT s.id AS serverId, s.name AS name,
|
||||
JSON_EXTRACT(st.raw, '$.integrations.guardedCrate') AS guardedCrate,
|
||||
JSON_EXTRACT(st.raw, '$.console') AS console
|
||||
FROM ${SERVERS} s
|
||||
JOIN ${STATE} st ON st.server_id = s.id
|
||||
WHERE s.enabled = 1
|
||||
ORDER BY s.sort_order ASC, s.id ASC`,
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
SERVERS,
|
||||
STATE,
|
||||
dtReportFor,
|
||||
gcReportFor,
|
||||
gcReports,
|
||||
listServers,
|
||||
getServer,
|
||||
upsertServer,
|
||||
|
||||
Reference in New Issue
Block a user