fix: improve SCUM map playback filters
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import type { ScumSurfaceResponse, ScumUserTrajectoryResponse } from "../../api/types";
|
||||
import type { PluginBridgeHostContext, PluginPageContract } from "../../contracts/pluginBridge";
|
||||
import type { PluginPageWorkspaceActions } from "../../contracts/pluginPageHost";
|
||||
|
||||
export const scumMapPage: PluginPageContract = {
|
||||
key: "live-map", title: "实时地图", path: "/live-map", bundleKey: "scum-server-plugin", bundleVersion: "1.0.3",
|
||||
bundleIntegritySha256: "sha256:3488b316d909e597024f8f31c7bc96ab8019f643d74a528dc442d3df0dc3d54e"
|
||||
};
|
||||
|
||||
export const scumMapContext: PluginBridgeHostContext = {
|
||||
pluginId: "game.scum", routeKey: "live-map", serverInstanceId: "map-test", permissions: ["server.read"], bridgeActions: [], aiPurposes: [],
|
||||
themeTokens: { colorScheme: "dark", accentColor: "#4ECDC4" },
|
||||
pageQuery: { focus: "mira", from: "2026-09-19T00:00:00Z", to: "2026-09-19T00:10:00Z" }
|
||||
};
|
||||
|
||||
// Deterministic fixture only: no server, Run channel, database or authenticated API is called.
|
||||
export function createScumMapFixture(): { surface: ScumSurfaceResponse; actions: PluginPageWorkspaceActions } {
|
||||
const sample = (steamId: string, displayName: string, minute: number, x: number, y: number, riding = false): ScumUserTrajectoryResponse => ({
|
||||
id: `${steamId}-${minute}`, serverInstanceId: "map-test", scumUserId: `user-${steamId}`, subjectType: "player", subjectId: steamId, steamId, displayName,
|
||||
x, y, z: 0, sampledAt: `2026-09-19T00:0${minute}:00Z`, ...(riding ? { riddenVehicleId: "vehicle-1", gameVehicleId: "car-1" } : {})
|
||||
});
|
||||
const surface: ScumSurfaceResponse = {
|
||||
users: { count: 2, items: [
|
||||
{ id: "user-mira", serverInstanceId: "map-test", steamId: "mira", displayName: "Mira", online: true, x: 0, y: 0, z: 0, riddenVehicleId: "vehicle-1", gameVehicleId: "car-1" },
|
||||
{ id: "user-nova", serverInstanceId: "map-test", steamId: "nova", displayName: "Nova", online: true, x: 1000, y: 1000, z: 0 }
|
||||
] },
|
||||
vehicles: { count: 1, items: [{ id: "vehicle-1", vehicleId: "vehicle-1", gameVehicleId: "car-1", serverInstanceId: "map-test", label: "Laika", className: "BPC_Laika_C", exists: true, functional: true, locked: true, x: 40000, y: 40000, z: 0 }] },
|
||||
userTrajectories: { count: 6, items: [sample("mira", "Mira", 0, 0, 0), sample("mira", "Mira", 4, -250000, -250000, true), sample("mira", "Mira", 8, -550000, -550000, true), sample("nova", "Nova", 0, 1000, 1000), sample("nova", "Nova", 4, 250000, 250000), sample("nova", "Nova", 8, 600000, 600000)] },
|
||||
vehicleTrajectories: { count: 0, items: [] },
|
||||
vehicleLocks: { count: 1, items: [{ id: "lock-1", serverInstanceId: "map-test", scumVehicleId: "vehicle-1", gameVehicleId: "car-1", scumUserId: "user-mira", steamId: "mira", lockedAt: "2026-09-19T00:00:00Z" }] }
|
||||
};
|
||||
const collections: Record<string, Record<string, unknown>[]> = {
|
||||
scum_squads: [{ squadId: "wolves", name: "Wolves" }],
|
||||
scum_squad_members: [{ squadId: "wolves", steamId: "mira" }, { squadId: "wolves", steamId: "nova" }],
|
||||
scum_flags: [{ flagId: "flag-1", name: "Wolves Flag", ownerPlayerId: "mira", ownerSquadId: "wolves", x: -40000, y: 40000, z: 0 }]
|
||||
};
|
||||
const actions: PluginPageWorkspaceActions = {
|
||||
pluginData: {
|
||||
list: async (collection) => ({ items: (collections[collection] ?? []).map((value, index) => ({ key: `${collection}-${index}`, value })) }),
|
||||
put: async () => undefined, delete: async () => undefined, transact: async () => undefined
|
||||
},
|
||||
scum: {
|
||||
surface: async () => surface, users: async () => surface.users, vehicles: async () => surface.vehicles,
|
||||
userTrajectories: async () => surface.userTrajectories, vehicleTrajectories: async () => surface.vehicleTrajectories, vehicleLocks: async () => surface.vehicleLocks
|
||||
}
|
||||
};
|
||||
return { surface, actions };
|
||||
}
|
||||
Reference in New Issue
Block a user