You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(vehicles): expose managed seat metadata and occupancy - #371
Adds LandVehicle.Seats as a shared, read-only collection of VehicleSeatInfo objects in native array order. Each seat exposes its index, driver metadata, live occupancy, a nullable managed Player occupant, and OccupantChanged(previous, current).
Notifications observe the generated RpcLogic___SetSeatOccupant_* mutation by verified signature: native observer/target readers bypass the outer SetSeatOccupant method. Assignment notifications run after the native mutation, suppress native identity no-ops, preserve transitions whose managed arguments are both null, and isolate subscriber failures. A per-update observation handles player destruction without an assignment. Vehicle destruction and scene/deinitialization cleanup invalidate retained seats and release subscribers without synthesizing exits.
Compatibility
Additive public surface only: LandVehicle.Seats, VehicleSeatInfo, its four read-only properties, and its event. Existing vehicle members, including writable LandVehicle.IsOccupied, remain unchanged.
Occupants resolve through Player.All; no native player/seat types are exposed. No entry/ejection/reservation controls, new RPCs, IDs, save formats, or network payload changes.
ApiCompat against a source build of exact target base afc8b5a passes, including parameter-name and attribute rules. Focused contract checks also retain the legacy writable property.
Seat objects live for the vehicle/scene. Resolve seats again after scene changes. Native assignments notify synchronously; destruction-only occupancy changes notify on the next API update.
Validation
Check
MonoMelon
Il2CppMelon
Restore and solution build, local deployment disabled
Pass
Pass
Full contract suite
818 passed
781 passed
New focused seat contracts
6 passed
6 passed
Live loaded-save single-player probe
Pass
Pass
Live two-peer probe
Pass
Pass
DocFX build passes (four unresolved dependency-reference warnings); public API documentation coverage is 82.56% (minimum 80%). git diff --check passes.
Live probes use isolated regular-game 0.4.7f12 installs (Mono Alternate and public IL2CPP), disposable copies of a completed save, and local Steam emulation for peer sessions. They exercise probe-driven native seat assignments, metadata/order, shared wrappers, immutable collections, callback state/timing, duplicate suppression, subscriber isolation, driver/passenger transitions, replicated host/client observations, disconnect cleanup, unavailable managed-player conversion, vehicle destruction, scene cleanup, and reload. These are automated native-path probes, not manual vehicle-entry/UI testing or real Steam matchmaking certification.
No proprietary assemblies, decompiled code, game assets, smoke implementations, fixtures, logs, or generated evidence are included in this PR. No version bump or release is included.
Summary by CodeRabbit
New Features
Added a read-only vehicle seat collection with seat indices, driver-seat status, occupancy, and managed occupant details.
Seat occupant changes trigger notifications when native occupant identity changes, even if the occupant cannot be resolved to a player.
Bug Fixes
Seat data refreshes as occupants change and is cleared when vehicles are destroyed or scenes change, preventing stale information.
Vehicles without available seat data return an empty collection.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: be43fb00-5784-4b94-a874-8a9a18a4db09
📥 Commits
Reviewing files that changed from the base of the PR and between 985450a and eedd4e7.
📒 Files selected for processing: 5
S1API/Internal/Patches/LandVehiclePatches.cs
S1API/Internal/Patches/VehicleSeatPatches.cs
S1API/Internal/Vehicles/VehicleSeats.cs
S1API/S1API.cs
S1API/Vehicles/VehicleSeatInfo.cs
🚧 Files skipped from review as they are similar to previous changes: 5
S1API/Internal/Patches/VehicleSeatPatches.cs
S1API/Internal/Patches/LandVehiclePatches.cs
S1API/S1API.cs
S1API/Internal/Vehicles/VehicleSeats.cs
S1API/Vehicles/VehicleSeatInfo.cs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Walkthrough
The change adds a managed vehicle-seat API with seat metadata, occupant state, and occupant-change notifications. Internal caching and lifecycle hooks manage seat objects. A Harmony patch refreshes occupancy after native seat-occupant updates.
LandVehicle.Seats exposes a read-only list of managed seat information. VehicleSeatInfo provides seat metadata, occupancy properties, and an occupant-change event. Tests check the public surface.
Seat cache and lifecycle S1API/Internal/Vehicles/VehicleSeats.cs, S1API/S1API.cs, S1API/Internal/Patches/LandVehiclePatches.cs, S1API/Vehicles/VehicleSeatInfo.cs, S1API.Tests/Vehicles/VehicleSeatApiTests.cs
VehicleSeats caches seat lists and invalidates them during vehicle destruction, mod deinitialization, and scene unload. The update hook ticks the cache. Tests cover invalidation and unavailable vehicles.
Occupant refresh and notifications S1API/Internal/Patches/VehicleSeatPatches.cs, S1API/Vehicles/VehicleSeatInfo.cs, S1API.Tests/Vehicles/VehicleSeatApiTests.cs
A platform-conditional Harmony patch refreshes occupancy after the generated seat-occupant method runs. VehicleSeatInfo compares native occupant identity, resolves managed players, and dispatches change notifications. Tests cover patch selection and notification behavior.
sequenceDiagram
participant LandVehicle
participant VehicleSeats
participant VehicleSeatPatches
participant VehicleSeatInfo
LandVehicle->>VehicleSeats: Get seat list
VehicleSeats->>VehicleSeatInfo: Create and cache seat information
VehicleSeatPatches->>VehicleSeats: Refresh vehicle seat after occupant RPC
VehicleSeats->>VehicleSeatInfo: Refresh occupant state
VehicleSeatInfo->>VehicleSeatInfo: Resolve managed occupant and notify subscribers
Loading
Merge Risk:⚪ Minimal · up to eedd4
This adds a managed read-only seat API for land vehicles without changing existing vehicle members. No concrete merge-blocking risk was identified in the supplied context.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 7 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: exposing managed vehicle seat metadata and occupancy.
Description check
The description provides the linked issue, scope, compatibility impact, validation results, runtime evidence, and documentation status. It omits the explicit contributor checklist and separate Summary…
Linked Issues check
Issue #294 is active and directly linked. LandVehicle.Seats provides a read-only collection in native order. VehicleSeatInfo provides the seat index, driver status, live occupancy, managed `Player…
Out of Scope Changes check
The changes remain within issue #294. The cache, mutation patch, lifecycle hooks, public API, and focused tests support seat metadata, occupancy, notifications, or required cleanup. The reported chang…
Full details: Description check
Explanation
The description provides the linked issue, scope, compatibility impact, validation results, runtime evidence, and documentation status. It omits the explicit contributor checklist and separate Summary, Mono, IL2CPP, Runtime evidence, and Documentation headings, but the required information is mostly present.
Full details: Linked Issues check
Explanation
Issue #294 is active and directly linked. LandVehicle.Seats provides a read-only collection in native order. VehicleSeatInfo provides the seat index, driver status, live occupancy, managed Player? occupant, and OccupantChanged. The implementation preserves empty-slot indices, avoids native types, observes generated seat mutations, handles unavailable wrappers, disconnects, destruction, scene cleanup, and subscriber isolation. The reported MonoMelon and Il2CppMelon checks cover the required transitions and cleanup.
Full details: Out of Scope Changes check
Explanation
The changes remain within issue #294. The cache, mutation patch, lifecycle hooks, public API, and focused tests support seat metadata, occupancy, notifications, or required cleanup. The reported changes add no forced entry, ejection, reservation, remote-player control, direct RPC access, save format, or network payload. No unrelated change is demonstrated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #294.
Adds
LandVehicle.Seatsas a shared, read-only collection ofVehicleSeatInfoobjects in native array order. Each seat exposes its index, driver metadata, live occupancy, a nullable managedPlayeroccupant, andOccupantChanged(previous, current).Notifications observe the generated
RpcLogic___SetSeatOccupant_*mutation by verified signature: native observer/target readers bypass the outerSetSeatOccupantmethod. Assignment notifications run after the native mutation, suppress native identity no-ops, preserve transitions whose managed arguments are both null, and isolate subscriber failures. A per-update observation handles player destruction without an assignment. Vehicle destruction and scene/deinitialization cleanup invalidate retained seats and release subscribers without synthesizing exits.Compatibility
LandVehicle.Seats,VehicleSeatInfo, its four read-only properties, and its event. Existing vehicle members, including writableLandVehicle.IsOccupied, remain unchanged.Player.All; no native player/seat types are exposed. No entry/ejection/reservation controls, new RPCs, IDs, save formats, or network payload changes.afc8b5apasses, including parameter-name and attribute rules. Focused contract checks also retain the legacy writable property.Validation
DocFX build passes (four unresolved dependency-reference warnings); public API documentation coverage is 82.56% (minimum 80%).
git diff --checkpasses.Live probes use isolated regular-game 0.4.7f12 installs (Mono Alternate and public IL2CPP), disposable copies of a completed save, and local Steam emulation for peer sessions. They exercise probe-driven native seat assignments, metadata/order, shared wrappers, immutable collections, callback state/timing, duplicate suppression, subscriber isolation, driver/passenger transitions, replicated host/client observations, disconnect cleanup, unavailable managed-player conversion, vehicle destruction, scene cleanup, and reload. These are automated native-path probes, not manual vehicle-entry/UI testing or real Steam matchmaking certification.
No proprietary assemblies, decompiled code, game assets, smoke implementations, fixtures, logs, or generated evidence are included in this PR. No version bump or release is included.
Summary by CodeRabbit