Table of Contents

Class VehicleRegistry

Namespace
S1API.Vehicles
Assembly
S1API.dll

Registry utilities for discovering and resolving vehicles without exposing game types.

public static class VehicleRegistry
Inheritance
VehicleRegistry
Inherited Members

Methods

CreateVehicle(string)

Creates a new vehicle instance using a vehicle code and returns a wrapper. Useful when you need a vehicle that doesn't exist yet.

public static LandVehicle CreateVehicle(string vehicleCode)

Parameters

vehicleCode string

The vehicle code to spawn (e.g., "Sedan", "SUV", etc.).

Returns

LandVehicle

A new vehicle wrapper, or null if creation fails.

GetAll()

Returns all currently spawned land vehicles wrapped for modder use.

public static LandVehicle[] GetAll()

Returns

LandVehicle[]

GetByGUID(string)

Finds a vehicle by GUID string. Returns null if not found.

public static LandVehicle GetByGUID(string guid)

Parameters

guid string

Returns

LandVehicle

GetByName(string)

Finds a vehicle by GameObject name. Useful when vehicles aren't spawned yet. Falls back to finding in all vehicles if GameObject.Find fails.

public static LandVehicle GetByName(string gameObjectName)

Parameters

gameObjectName string

The name of the GameObject containing the vehicle.

Returns

LandVehicle

A vehicle wrapper, or null if not found.

RemoveVehicle(string)

Removes a vehicle from the game's lists, for permanently destroying a vehicle. This will be called automatically in OnDestroy, so there's likely no need to call this manually.

public static void RemoveVehicle(string guidString)

Parameters

guidString string

The GUID string of the vehicle to remove.