Fill the SCUM user and vehicle tables from the plugin-declared database read path

The SCUM 用户管理 list stayed empty because the typed scum_user and
scum_vehicle tables had no producer: the run ingest endpoint is signed-run
only, and the previously registered plugin templates asked for a Run
database capability the endpoint never advertises.

The plugin now declares bounded, read-only SQLite projections for players
and vehicles (sql/scum-db-v57/*.sql with query schemas), and the platform
dispatches those templates as durable remote.run.db.sqlite.query jobs on
run heartbeat and page open, then projects the returned rows into the typed
SCUM tables through the same shared ingest path used by signed run facts.
This commit is contained in:
npc0-hue
2026-09-16 18:01:33 +08:00
parent 0ce264836f
commit 300390dc4d
15 changed files with 1104 additions and 32 deletions
@@ -0,0 +1,26 @@
SELECT
account.id AS steamId,
COALESCE(NULLIF(profile.name, ''), NULLIF(account.name, ''), account.id) AS displayName,
COALESCE(account.last_direct_connection_address, '') AS lastLoginIp,
CAST(member.squad_id AS TEXT) AS squadId,
entity.location_x AS x,
entity.location_y AS y,
entity.location_z AS z,
MAX(CASE WHEN currency.currency_type = 1 THEN currency.account_balance END) AS normalBalance,
MAX(CASE WHEN currency.currency_type = 2 THEN currency.account_balance END) AS goldBalance,
profile.last_login_time AS lastLoginTime,
CASE WHEN profile.last_login_time IS NOT NULL AND (profile.last_logout_time IS NULL OR profile.last_login_time > profile.last_logout_time) THEN 1 ELSE 0 END AS online,
CASE WHEN profile.last_login_time IS NOT NULL AND profile.last_login_time >= strftime('%Y-%m-%dT%H:%M:%fZ', 'now', '-20 seconds') THEN 1 ELSE 0 END AS freshLogin,
CAST(mount.vehicle_entity_id AS TEXT) AS riddenGameVehicleId
FROM user account
LEFT JOIN user_profile profile ON profile.user_id = account.id
LEFT JOIN prisoner ON prisoner.id = profile.prisoner_id
LEFT JOIN prisoner_entity ON prisoner_entity.prisoner_id = prisoner.id
LEFT JOIN entity ON entity.id = prisoner_entity.entity_id
LEFT JOIN squad_member member ON member.user_profile_id = profile.id
LEFT JOIN prisoner_vehicle_mountee_info mount ON mount.prisoner_id = prisoner.id
LEFT JOIN bank_account_registry bank ON bank.account_owner_user_profile_id = profile.id
LEFT JOIN bank_account_registry_currencies currency ON currency.bank_account_id = bank.id
GROUP BY account.id
ORDER BY profile.last_login_time DESC
LIMIT :limit
@@ -0,0 +1,13 @@
SELECT
CAST(spawner.vehicle_entity_id AS TEXT) AS gameVehicleId,
entity.class AS vehicleClass,
spawner.vehicle_alias AS displayName,
1 AS existsInGame,
entity.location_x AS x,
entity.location_y AS y,
entity.location_z AS z,
strftime('%Y-%m-%dT%H:%M:%SZ', 'now') AS observedAt
FROM vehicle_spawner spawner
JOIN entity ON entity.id = spawner.vehicle_entity_id
ORDER BY spawner.vehicle_last_access_time DESC
LIMIT :limit