Compatibility and migration ​
np_vehiclehandler is a standalone shared service for OneSync vehicles. It does not replace a framework garage schema, vehicle ownership or key resource. Keep your existing source of truth for ownership and use the handler for world entity lifecycle and supported vehicle state.
Migrating a server-created vehicle ​
Replace direct server creation of a durable world vehicle with a stable-ID registration. Build the definition on the server from trusted garage or fleet data.
-- Before: CreateVehicleServerSetter(...) and keep only the entity handle.
-- After: register from server-owned data so the stable ID survives restarts.
exports.np_vehiclehandler:registerPersistent(('np_garage:vehicle:%s'):format(vehicleId), {
model = vehicle.model,
coords = vehicle.coords,
bucket = vehicle.bucket or 0,
owner = vehicle.owner,
props = vehicle.props,
metadata = { garageId = vehicle.garageId },
})
Do not call this for a vehicle that is stored in a garage; stored records should not also be registered as parked world vehicles. When the vehicle is returned to storage or transferred, remove its active world record through the handler lifecycle and update your own garage data.
Keep old callers working ​
For a compatibility wrapper, vendor lib/np_vehiclehandler.lua in the consuming resource and load it from the server manifest. NpVehicleHandlerCompat.available() checks whether the service is running, while methods return handler_stopped if it is not. The helper supports SpawnVehicle / DespawnVehicle aliases, but does not patch natives or create an unmanaged duplicate entity when the handler is absent. Numeric IDs must specify whether they are entity handles or network IDs with idFrom(value, 'entity' | 'netId'); entity handles stay server-side. See Exports.
Unsupported assumptions ​
Do not assume that framework-specific vehicle properties, ownership tables or key exports are automatically discovered. Map them in your bridge and test plate formats, buckets, entity recreation and restart restoration with your framework and game artifact.