diff --git a/platform/domain/scum.go b/platform/domain/scum.go index 8663082..cbba71c 100644 --- a/platform/domain/scum.go +++ b/platform/domain/scum.go @@ -83,6 +83,7 @@ type SCUMVehicle struct { DisplayName string Exists bool Locked bool + Functional *bool X *float64 Y *float64 Z *float64 @@ -178,6 +179,7 @@ type SCUMVehicleFact struct { DisplayName string Exists *bool Locked *bool + Functional *bool LockedBySteamID string LockedAt time.Time ObservedAt time.Time @@ -223,6 +225,7 @@ func CopySCUMUserTrajectories(values []SCUMUserTrajectory) []SCUMUserTrajectory } func CopySCUMVehicle(value SCUMVehicle) SCUMVehicle { + value.Functional = copyBoolPtr(value.Functional) value.X = copyFloatPtr(value.X) value.Y = copyFloatPtr(value.Y) value.Z = copyFloatPtr(value.Z) @@ -293,6 +296,7 @@ func CopySCUMVehicleFacts(values []SCUMVehicleFact) []SCUMVehicleFact { out[i] = value out[i].Exists = copyBoolPtr(value.Exists) out[i].Locked = copyBoolPtr(value.Locked) + out[i].Functional = copyBoolPtr(value.Functional) if value.Position != nil { position := *value.Position out[i].Position = &position diff --git a/platform/dto/scum.go b/platform/dto/scum.go index 79e9a43..4480c7c 100644 --- a/platform/dto/scum.go +++ b/platform/dto/scum.go @@ -84,6 +84,7 @@ type SCUMVehicleResponse struct { Exists bool `json:"exists"` Status string `json:"status"` Locked bool `json:"locked"` + Functional *bool `json:"functional,omitempty"` X *float64 `json:"x,omitempty"` Y *float64 `json:"y,omitempty"` Z *float64 `json:"z,omitempty"` @@ -187,6 +188,7 @@ type SCUMVehicleFactBody struct { DisplayName string `json:"displayName,omitempty"` Exists *bool `json:"exists,omitempty"` Locked *bool `json:"locked,omitempty"` + Functional *bool `json:"functional,omitempty"` LockedBySteamID string `json:"lockedBySteamId,omitempty"` LockedAt time.Time `json:"lockedAt,omitempty"` ObservedAt time.Time `json:"observedAt,omitempty"` @@ -240,7 +242,7 @@ func SCUMVehicleFromDomain(value domain.SCUMVehicle) SCUMVehicleResponse { if value.Exists { status = "exists" } - return SCUMVehicleResponse{ID: value.ID, ServerInstanceID: value.ServerInstanceID, VehicleID: value.ID, GameVehicleID: value.GameVehicleID, EntityID: value.GameVehicleID, VehicleClass: value.VehicleClass, ClassName: value.VehicleClass, DisplayName: value.DisplayName, Label: value.DisplayName, Exists: value.Exists, Status: status, Locked: value.Locked, X: value.X, Y: value.Y, Z: value.Z, Position: positionFromPointers(value.X, value.Y, value.Z), LastObservedAt: value.LastObservedAt, VehicleObservedAt: value.LastObservedAt, Source: "platform.scum_vehicle", CreatedAt: value.CreatedAt, UpdatedAt: value.UpdatedAt} + return SCUMVehicleResponse{ID: value.ID, ServerInstanceID: value.ServerInstanceID, VehicleID: value.ID, GameVehicleID: value.GameVehicleID, EntityID: value.GameVehicleID, VehicleClass: value.VehicleClass, ClassName: value.VehicleClass, DisplayName: value.DisplayName, Label: value.DisplayName, Exists: value.Exists, Status: status, Locked: value.Locked, Functional: value.Functional, X: value.X, Y: value.Y, Z: value.Z, Position: positionFromPointers(value.X, value.Y, value.Z), LastObservedAt: value.LastObservedAt, VehicleObservedAt: value.LastObservedAt, Source: "platform.scum_vehicle", CreatedAt: value.CreatedAt, UpdatedAt: value.UpdatedAt} } func SCUMVehicleTrajectoryListFromDomain(values []domain.SCUMVehicleTrajectory) SCUMVehicleTrajectoryListResponse { @@ -284,7 +286,7 @@ func (request SCUMUserFactBody) ToDomain() domain.SCUMUserFact { } func (request SCUMVehicleFactBody) ToDomain() domain.SCUMVehicleFact { - return domain.SCUMVehicleFact{GameVehicleID: request.GameVehicleID, VehicleClass: request.VehicleClass, DisplayName: request.DisplayName, Exists: request.Exists, Locked: request.Locked, LockedBySteamID: request.LockedBySteamID, LockedAt: request.LockedAt, ObservedAt: request.ObservedAt, Position: positionToDomain(request.Position)} + return domain.SCUMVehicleFact{GameVehicleID: request.GameVehicleID, VehicleClass: request.VehicleClass, DisplayName: request.DisplayName, Exists: request.Exists, Locked: request.Locked, Functional: request.Functional, LockedBySteamID: request.LockedBySteamID, LockedAt: request.LockedAt, ObservedAt: request.ObservedAt, Position: positionToDomain(request.Position)} } func SCUMFactIngestFromDomain(result domain.SCUMFactIngestResult) SCUMFactIngestResponse { diff --git a/platform/model/scum.go b/platform/model/scum.go index 48397b7..5bf76a9 100644 --- a/platform/model/scum.go +++ b/platform/model/scum.go @@ -95,6 +95,8 @@ type SCUMVehicle struct { Exists bool `json:"exists" db:"exists"` // Locked marks the latest observed lock state. Locked bool `json:"locked" db:"locked"` + // Functional is the latest game-reported vehicle functional state when available. + Functional *bool `json:"functional,omitempty" db:"functional"` // X stores the latest observed world X coordinate. X *float64 `json:"x,omitempty" db:"x"` // Y stores the latest observed world Y coordinate. diff --git a/platform/repo/mysql_scum.go b/platform/repo/mysql_scum.go index 743bebf..f2b4d32 100644 --- a/platform/repo/mysql_scum.go +++ b/platform/repo/mysql_scum.go @@ -78,6 +78,7 @@ var scumTableDDL = []struct { display_name VARCHAR(191) NOT NULL DEFAULT '', exists_in_game BOOLEAN NOT NULL DEFAULT FALSE, locked BOOLEAN NOT NULL DEFAULT FALSE, + functional BOOLEAN NULL, x DOUBLE NULL, y DOUBLE NULL, z DOUBLE NULL, @@ -136,6 +137,23 @@ func (store *MySQLStore) initializeSCUMTables(ctx context.Context) error { return fmt.Errorf("create SCUM table %s: %w", entry.table, err) } } + if err := store.ensureSCUMVehicleFunctionalColumn(ctx); err != nil { + return err + } + return nil +} + +func (store *MySQLStore) ensureSCUMVehicleFunctionalColumn(ctx context.Context) error { + var found int + if err := store.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'scum_vehicle' AND COLUMN_NAME = 'functional'`).Scan(&found); err != nil { + return fmt.Errorf("inspect SCUM vehicle functional column: %w", err) + } + if found > 0 { + return nil + } + if _, err := store.db.ExecContext(ctx, `ALTER TABLE scum_vehicle ADD COLUMN functional BOOLEAN NULL AFTER locked`); err != nil { + return fmt.Errorf("add SCUM vehicle functional column: %w", err) + } return nil } @@ -268,12 +286,12 @@ func (repository *mysqlSCUMUserRepository) Delete(id string) error { type mysqlSCUMVehicleRepository struct{ db *sql.DB } -const scumVehicleColumns = `id, server_instance_id, game_vehicle_id, vehicle_class, display_name, exists_in_game, locked, x, y, z, last_observed_at, created_at, updated_at` +const scumVehicleColumns = `id, server_instance_id, game_vehicle_id, vehicle_class, display_name, exists_in_game, locked, functional, x, y, z, last_observed_at, created_at, updated_at` func (repository *mysqlSCUMVehicleRepository) Create(value domain.SCUMVehicle) error { ctx, cancel := scumQueryContext() defer cancel() - _, err := repository.db.ExecContext(ctx, `INSERT INTO scum_vehicle (`+scumVehicleColumns+`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)`, scumVehicleArgs(value)...) + _, err := repository.db.ExecContext(ctx, `INSERT INTO scum_vehicle (`+scumVehicleColumns+`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, scumVehicleArgs(value)...) if err != nil { if isMySQLDuplicateKey(err) { return ErrDuplicate @@ -337,7 +355,7 @@ func (repository *mysqlSCUMVehicleRepository) List(filter domain.SCUMVehicleFilt func (repository *mysqlSCUMVehicleRepository) Update(value domain.SCUMVehicle) error { ctx, cancel := scumQueryContext() defer cancel() - result, err := repository.db.ExecContext(ctx, `UPDATE scum_vehicle SET server_instance_id=?, game_vehicle_id=?, vehicle_class=?, display_name=?, exists_in_game=?, locked=?, x=?, y=?, z=?, last_observed_at=?, created_at=?, updated_at=? WHERE id=?`, scumVehicleUpdateArgs(value)...) + result, err := repository.db.ExecContext(ctx, `UPDATE scum_vehicle SET server_instance_id=?, game_vehicle_id=?, vehicle_class=?, display_name=?, exists_in_game=?, locked=?, functional=?, x=?, y=?, z=?, last_observed_at=?, created_at=?, updated_at=? WHERE id=?`, scumVehicleUpdateArgs(value)...) if err != nil { return fmt.Errorf("update scum_vehicle: %w", err) } @@ -754,7 +772,7 @@ func scumUserUpdateArgs(value domain.SCUMUser) []any { func scumVehicleArgs(value domain.SCUMVehicle) []any { return []any{ value.ID, value.ServerInstanceID, value.GameVehicleID, value.VehicleClass, value.DisplayName, - value.Exists, value.Locked, scumFloatValue(value.X), scumFloatValue(value.Y), scumFloatValue(value.Z), + value.Exists, value.Locked, value.Functional, scumFloatValue(value.X), scumFloatValue(value.Y), scumFloatValue(value.Z), scumTimeValue(value.LastObservedAt), value.CreatedAt.UTC(), value.UpdatedAt.UTC(), } } @@ -807,7 +825,7 @@ func scanSCUMVehicle(scanner scumRowScanner) (domain.SCUMVehicle, error) { ) err := scanner.Scan( &value.ID, &value.ServerInstanceID, &value.GameVehicleID, &value.VehicleClass, &value.DisplayName, - &value.Exists, &value.Locked, &x, &y, &z, &lastObservedAt, &value.CreatedAt, &value.UpdatedAt, + &value.Exists, &value.Locked, &value.Functional, &x, &y, &z, &lastObservedAt, &value.CreatedAt, &value.UpdatedAt, ) if err != nil { return domain.SCUMVehicle{}, err diff --git a/platform/service/scum.go b/platform/service/scum.go index 7321fa4..7a6272d 100644 --- a/platform/service/scum.go +++ b/platform/service/scum.go @@ -405,6 +405,10 @@ func (svc *CoreService) ingestSCUMVehicleFact(instance domain.ServerInstance, fa if fact.Locked != nil { vehicle.Locked = *fact.Locked } + if fact.Functional != nil { + functional := *fact.Functional + vehicle.Functional = &functional + } if fact.Position != nil { vehicle.X, vehicle.Y, vehicle.Z = floatPtr(fact.Position.X), floatPtr(fact.Position.Y), floatPtr(fact.Position.Z) } diff --git a/platform/service/scum_query_ingest.go b/platform/service/scum_query_ingest.go index e043941..ed083c7 100644 --- a/platform/service/scum_query_ingest.go +++ b/platform/service/scum_query_ingest.go @@ -535,6 +535,10 @@ func scumVehicleFactsFromRows(rows []scumQueryRow, projection domain.GameClientB DisplayName: scumRowText(row, projection, "displayName"), LockedBySteamID: scumRowText(row, projection, "lockedBySteamId"), } + if functional, ok := scumRowBool(row, projection, "functional"); ok { + value := functional + fact.Functional = &value + } if exists, ok := scumRowBool(row, projection, "exists"); ok { value := exists fact.Exists = &value diff --git a/platform/service/scum_query_ingest_test.go b/platform/service/scum_query_ingest_test.go index 176efa6..a61715a 100644 --- a/platform/service/scum_query_ingest_test.go +++ b/platform/service/scum_query_ingest_test.go @@ -46,7 +46,7 @@ func newSCUMQueryIngestFixture(t *testing.T) (*CoreService, string, domain.Serve PollIntervalSeconds: 120, MaxRows: 500, TimeoutSeconds: 30, Projections: []domain.GameClientBridgeQueryProjectionDeclaration{{ Collection: scumProjectionVehicles, RowPath: "rows", UpsertKeys: []string{"gameVehicleId"}, - FieldMappings: map[string]string{"gameVehicleId": "gameVehicleId", "vehicleClass": "vehicleClass", "displayName": "displayName", "exists": "existsInGame", "x": "x", "y": "y", "z": "z"}, + FieldMappings: map[string]string{"gameVehicleId": "gameVehicleId", "vehicleClass": "vehicleClass", "displayName": "displayName", "functional": "functional", "exists": "existsInGame", "x": "x", "y": "y", "z": "z"}, }}, }}}, }) @@ -178,7 +178,7 @@ func TestSCUMQueryProjectionFillsTypedTables(t *testing.T) { t.Fatalf("project player rows: %v", err) } vehicleJob.State = domain.JobStateSucceeded - vehicleJob.ExecutionResult = domain.JobExecutionResult{Kind: "sqlite.query", Content: `{"rows":[{"gameVehicleId":"5923426","vehicleClass":"MountainBike_ES","displayName":"","existsInGame":1,"x":-406400.84375,"y":558707.4375,"z":83294.6171875,"observedAt":"2026-09-16T08:05:00Z"}]}`} + vehicleJob.ExecutionResult = domain.JobExecutionResult{Kind: "sqlite.query", Content: `{"rows":[{"gameVehicleId":"5923426","vehicleClass":"MountainBike_ES","displayName":"","functional":1,"existsInGame":1,"x":-406400.84375,"y":558707.4375,"z":83294.6171875,"observedAt":"2026-09-16T08:05:00Z"}]}`} if err := svc.projectRemoteAdapterJobResult(vehicleJob, fixedTime); err != nil { t.Fatalf("project vehicle rows: %v", err) } @@ -198,7 +198,7 @@ func TestSCUMQueryProjectionFillsTypedTables(t *testing.T) { t.Fatalf("expected last login from database evidence, got %s", user.LastLoginAt) } vehicles, err := svc.ListSCUMVehiclesForSession(session, domain.SCUMVehicleFilter{ServerInstanceID: instance.ID}) - if err != nil || len(vehicles) != 1 || vehicles[0].VehicleClass != "MountainBike_ES" || vehicles[0].X == nil || *vehicles[0].X != -406400.84375 { + if err != nil || len(vehicles) != 1 || vehicles[0].VehicleClass != "MountainBike_ES" || vehicles[0].Functional == nil || !*vehicles[0].Functional || vehicles[0].X == nil || *vehicles[0].X != -406400.84375 { t.Fatalf("unexpected projected vehicle: vehicles=%+v err=%v", vehicles, err) } userTracks, err := svc.ListSCUMUserTrajectoriesForSession(session, domain.SCUMUserTrajectoryFilter{ServerInstanceID: instance.ID}) diff --git a/platform/service/scum_test.go b/platform/service/scum_test.go index 964f98e..93725c5 100644 --- a/platform/service/scum_test.go +++ b/platform/service/scum_test.go @@ -15,6 +15,7 @@ func TestSCUMFactIngestMaintainsPlatformTablesAndWelcomeQueue(t *testing.T) { gold := int64(3) exists := true locked := true + functional := true observedAt := fixedTime.Add(-1 * time.Minute) result, err := svc.IngestSCUMFacts(domain.SCUMFactIngest{ @@ -26,7 +27,7 @@ func TestSCUMFactIngestMaintainsPlatformTablesAndWelcomeQueue(t *testing.T) { ObservedAt: observedAt, LoginObservedAt: observedAt, Position: &domain.SCUMPosition{X: 10, Y: 20, Z: 3}, BankBalance: &bank, GoldBars: &gold, RiddenGameVehicleID: "game-veh-1", }}, Vehicles: []domain.SCUMVehicleFact{{ - GameVehicleID: "game-veh-1", VehicleClass: "BPC_Laika_C", DisplayName: "Laika", Exists: &exists, Locked: &locked, LockedBySteamID: "76561198000000001", LockedAt: observedAt, ObservedAt: observedAt, Position: &domain.SCUMPosition{X: 400, Y: 200, Z: 0}, + GameVehicleID: "game-veh-1", VehicleClass: "BPC_Laika_C", DisplayName: "Laika", Exists: &exists, Locked: &locked, Functional: &functional, LockedBySteamID: "76561198000000001", LockedAt: observedAt, ObservedAt: observedAt, Position: &domain.SCUMPosition{X: 400, Y: 200, Z: 0}, }}, }) if err != nil { @@ -61,7 +62,7 @@ func TestSCUMFactIngestMaintainsPlatformTablesAndWelcomeQueue(t *testing.T) { t.Fatalf("unexpected user trajectory rows: rows=%+v err=%v", userTracks, err) } vehicles, err := svc.ListSCUMVehiclesForSession(session, domain.SCUMVehicleFilter{ServerInstanceID: instance.ID}) - if err != nil || len(vehicles) != 1 || vehicles[0].GameVehicleID != "game-veh-1" || !vehicles[0].Exists || !vehicles[0].Locked { + if err != nil || len(vehicles) != 1 || vehicles[0].GameVehicleID != "game-veh-1" || !vehicles[0].Exists || !vehicles[0].Locked || vehicles[0].Functional == nil || !*vehicles[0].Functional { t.Fatalf("unexpected SCUM vehicles: vehicles=%+v err=%v", vehicles, err) } vehicleTracks, err := svc.ListSCUMVehicleTrajectoriesForSession(session, domain.SCUMVehicleTrajectoryFilter{ServerInstanceID: instance.ID}) diff --git a/platform_web/api/types.ts b/platform_web/api/types.ts index d80824f..67291c9 100644 --- a/platform_web/api/types.ts +++ b/platform_web/api/types.ts @@ -228,6 +228,7 @@ export interface ScumVehicleResponse { exists: boolean; status?: string; locked?: boolean; + functional?: boolean; x?: number; y?: number; z?: number; diff --git a/plugins/examples/scum-server-plugin/features/page.ts b/plugins/examples/scum-server-plugin/features/page.ts index d0f6772..81f4254 100644 --- a/plugins/examples/scum-server-plugin/features/page.ts +++ b/plugins/examples/scum-server-plugin/features/page.ts @@ -708,7 +708,7 @@ function mapHoverCard(e: ReactLike["createElement"], point: RecordMap, data: SCU } else if (layer === "vehicles") { push("载具", vehicleLabelFor(point)); push("类名", textField(point, "className", "vehicleClass", "entityClass", "vehicleType")); - push("状态", textField(point, "status", "state") || (boolField(point, "exists", "existsInGame") ? "存在" : "")); + push("状态", textField(point, "status", "state") || vehicleFunctionalLabel(point) || (boolField(point, "exists", "existsInGame") ? "存在" : "")); push("耐久", vehicleDurabilityLabel(point)); push("车锁", vehicleLockLabel(point, data)); pushDate("最后观测", "vehicleObservedAt", "lastObservedAt", "observedAt", "updatedAt"); @@ -760,6 +760,11 @@ function vehicleDurabilityLabel(point: RecordMap): string { return value ? `${value}${textField(point, "durabilityMax", "maxHealth") ? ` / ${textField(point, "durabilityMax", "maxHealth")}` : ""}` : ""; } +function vehicleFunctionalLabel(point: RecordMap): string { + if (field(point, "functional", "isFunctional") === undefined) return ""; + return boolField(point, "functional", "isFunctional") ? "可用" : "不可用"; +} + function mapUserMenu(e: ReactLike["createElement"], view: ViewState, users: Array<{ key: string; label: string; count: number }>, labels: Map) { const selected = view.mapUsers; const rows = [...users, ...(selected ?? []).filter((key) => !users.some((user) => user.key === key)).map((key) => ({ key, label: labels.get(key) || key, count: 0 }))]; @@ -1179,7 +1184,7 @@ function mapPointStrip(e: ReactLike["createElement"], point: RecordMap, trails: e("span", { className: "provider-id" }, `ID ${textField(point, "subjectId", "id", "_recordKey") || "unknown"}`), e("span", { className: "provider-id" }, `来源 ${textField(point, "source") || "平台表"}`), e("span", { className: "provider-id" }, freshness(point)), - layerOf(point) === "vehicles" ? e("span", { className: "provider-id" }, `${textField(point, "className", "vehicleClass", "vehicleType") || "unknown"} · ${textField(point, "status", "state", "isFunctional") || "unknown"} · ${boolField(point, "locked") ? "已上锁" : "未上锁/未知"} · 访问 ${dateField(point, "lastAccessTime", "vehicleObservedAt", "sampledAt")}`) : null), + layerOf(point) === "vehicles" ? e("span", { className: "provider-id" }, `${textField(point, "className", "vehicleClass", "vehicleType") || "unknown"} · ${textField(point, "status", "state") || vehicleFunctionalLabel(point) || "unknown"} · ${boolField(point, "locked") ? "已上锁" : "未上锁/未知"} · 访问 ${dateField(point, "lastAccessTime", "vehicleObservedAt", "sampledAt")}`) : null), locks.length ? e("div", { className: "console-row-list" }, locks.map((row, index) => e("div", { key: `selected-lock-${index}`, className: "console-row" }, e("span", null, dateField(row, "lockedAt", "createdAt")), e("strong", null, textField(row, "scumUserId") || "unknown"), e("strong", null, textField(row, "steamId") || "unknown")))) : null, trails.length ? e("div", { className: "console-row-list" }, trails.map((row, index) => e("div", { key: `selected-trail-${index}`, className: "console-row" }, e("span", null, dateField(row, "sampledAt", "observedAt")), e("strong", null, coords(row)), e("strong", null, textField(row, "source") || "平台轨迹表")))) : null ); diff --git a/plugins/examples/scum-server-plugin/manifest.json b/plugins/examples/scum-server-plugin/manifest.json index f0c8d19..add812d 100644 --- a/plugins/examples/scum-server-plugin/manifest.json +++ b/plugins/examples/scum-server-plugin/manifest.json @@ -370,7 +370,7 @@ }, { "key": "scum.database.vehicles", - "title": "Read SCUM vehicle positions and classes", + "title": "Read SCUM vehicle positions, classes, and functional state", "permission": "server.game-client.read", "engine": "sqlite", "transportKey": "scum-database", @@ -392,6 +392,7 @@ "gameVehicleId": "gameVehicleId", "vehicleClass": "vehicleClass", "displayName": "displayName", + "functional": "functional", "exists": "existsInGame", "x": "x", "y": "y", diff --git a/plugins/examples/scum-server-plugin/sql/scum-db-v57/vehicles.sql b/plugins/examples/scum-server-plugin/sql/scum-db-v57/vehicles.sql index 02a63e7..dd4ced2 100644 --- a/plugins/examples/scum-server-plugin/sql/scum-db-v57/vehicles.sql +++ b/plugins/examples/scum-server-plugin/sql/scum-db-v57/vehicles.sql @@ -2,6 +2,7 @@ SELECT CAST(spawner.vehicle_entity_id AS TEXT) AS gameVehicleId, entity.class AS vehicleClass, spawner.vehicle_alias AS displayName, + spawner.is_vehicle_functional AS functional, 1 AS existsInGame, entity.location_x AS x, entity.location_y AS y, diff --git a/plugins/tests/scum-feature-module.test.ts b/plugins/tests/scum-feature-module.test.ts index 5a54c3c..b4df7e1 100644 --- a/plugins/tests/scum-feature-module.test.ts +++ b/plugins/tests/scum-feature-module.test.ts @@ -39,7 +39,7 @@ const surfaceData: SCUMSurfaceData = { mapPoints: [{ id: "poi-1", name: "Airfield", layer: "other", x: 800, y: 900, z: 10, source: "plugin-map" }], mapRegions: [{ id: "region-1", name: "Safe Zone", x: 500, y: 600, z: 0, source: "server-config" }], mapSettings: [], - vehicles: [{ id: "scum-vehicle-1", vehicleId: "scum-vehicle-1", gameVehicleId: "veh-1", label: "Laika", className: "BPC_Laika_C", locked: true, position: { x: 400, y: 200, z: 0 }, freshness: { status: "fresh" } }], + vehicles: [{ id: "scum-vehicle-1", vehicleId: "scum-vehicle-1", gameVehicleId: "veh-1", label: "Laika", className: "BPC_Laika_C", functional: true, locked: true, position: { x: 400, y: 200, z: 0 }, freshness: { status: "fresh" } }], vehicleLocks: [{ id: "lock-1", scumVehicleId: "scum-vehicle-1", gameVehicleId: "veh-1", scumUserId: "scum-user-1", steamId: "76561198000000001", lockedAt: "2026-08-10T00:00:04Z", source: "platform.scum_vehicle_lock" }], trajectories: [ { subjectType: "player", subjectId: "76561198000000001", steamId: "76561198000000001", displayName: "Mira", x: 10, y: 20, z: 3, sampledAt: "2026-08-10T00:00:03Z", source: "platform.scum_user_trajectory" }, @@ -297,7 +297,9 @@ describe("SCUM plugin feature module", () => { expect(view.elements.find((element) => element.label === "SCUM 地图图层")?.style?.backgroundImage).toContain("scum-map-terrain-4096.webp"); expect(view.buttons.map((button) => button.label)).toEqual(expect.arrayContaining(["+", "-", "复位", "适应轨迹"])); const vehicleView = renderAndCollect({ pageKey: "live-map", pageTitle: "实时地图", data: { ...surfaceData, players: [], mapPoints: [], flags: [], mapRegions: [] } }); - expect(vehicleView.texts).toEqual(expect.arrayContaining(["BPC_Laika_C · unknown · 已上锁 · 访问 unknown", "scum-user-1", "76561198000000001"])); + expect(vehicleView.texts).toEqual(expect.arrayContaining(["BPC_Laika_C · 可用 · 已上锁 · 访问 unknown", "scum-user-1", "76561198000000001"])); + const unavailableVehicleView = renderAndCollect({ pageKey: "live-map", pageTitle: "实时地图", data: { ...surfaceData, vehicles: [{ ...surfaceData.vehicles[0], functional: false }], players: [], mapPoints: [], flags: [], mapRegions: [] } }); + expect(unavailableVehicleView.texts).toContain("BPC_Laika_C · 不可用 · 已上锁 · 访问 unknown"); }); it("keeps the live map full width with one compact filter row and dropdown menus", () => {