IVehicleSystem

Vehicle System interface

C++
struct IVehicleSystem {
};
File

IVehicleSystem.h

Description

Interface used to implement the vehicle system.

IVehicleSystem::~IVehicleSystem Destructor
C++
virtual ~IVehicleSystem();
IVehicleSystem::AddVehicle Method

Registers a newly spawned vehicle in the vehicle system

C++
virtual void AddVehicle(EntityId entityId, IVehicle* pProxy) = 0;
IVehicleSystem::AssignVehicleObjectId Method ()
C++
virtual TVehicleObjectId AssignVehicleObjectId() = 0;
IVehicleSystem::AssignVehicleObjectId Method (string&)
C++
virtual TVehicleObjectId AssignVehicleObjectId(const string& className) = 0;
IVehicleSystem::BroadcastVehicleUsageEvent Method

Announces OnUse events for vehicles.

C++
virtual void BroadcastVehicleUsageEvent(const EVehicleEvent eventId, const EntityId playerId, IVehicle* pVehicle) = 0;
Parameters
Parameters
Description
const EntityId playerId
the entity id of the player that the listener is registered for.
IVehicle* pVehicle
the vehicle which the player is interacting.
eventID
One of the events declared in EVehicleEvent, currently only eVE_PassengerEnter and eVE_PassengerExit
See Also

RegisterVehicleUsageEventListener UnregisterVehicleEventListener

IVehicleSystem::CreateVehicle Method

Spawns a new vehicle instance

C++
virtual IVehicle* CreateVehicle(uint16 channelId, const char * name, const char * vehicleClass, const Vec3 & pos, const Quat & rot, const Vec3 & scale, EntityId id = 0) = 0;
Parameters
Parameters
Description
uint16 channelId
Id of the intented channel
const char * name
Name of the new vehicle instance to be spawned
const char * vehicleClass
Name of the vehicle class requested
const Vec3 & pos
Position of the new vehicle instance
const Quat & rot
Rotation of the new vehicle instance
const Vec3 & scale
Scale factor of the new vehicle instance
EntityId id = 0
Unused
Returns

A pointer to the correct vehicle proxy. The value 0 is returned in case that the specified vehicle couldn't be created.

Description

Will spawn an entity based on the vehicle class requested. Usually called by the entity system when a vehicle entity is spawned.

IVehicleSystem::CreateVehicleAction Method
C++
virtual IVehicleAction* CreateVehicleAction(const string& name) = 0;
IVehicleSystem::CreateVehicleDamageBehavior Method
C++
virtual IVehicleDamageBehavior* CreateVehicleDamageBehavior(const string& name) = 0;
IVehicleSystem::CreateVehicleIterator Method
C++
virtual IVehicleIteratorPtr CreateVehicleIterator() = 0;
IVehicleSystem::CreateVehicleMovement Method
C++
virtual IVehicleMovement* CreateVehicleMovement(const string& name) = 0;
IVehicleSystem::CreateVehiclePart Method
C++
virtual IVehiclePart* CreateVehiclePart(const string& name) = 0;
IVehicleSystem::CreateVehicleSeatAction Method
C++
virtual IVehicleSeatAction* CreateVehicleSeatAction(const string& name) = 0;
IVehicleSystem::CreateVehicleView Method
C++
virtual IVehicleView* CreateVehicleView(const string& name) = 0;
IVehicleSystem::DECLARE_GAMEOBJECT_FACTORY Method (IVehicleAction)
C++
DECLARE_GAMEOBJECT_FACTORY(IVehicleAction);
IVehicleSystem::DECLARE_GAMEOBJECT_FACTORY Method (IVehicleDamageBehavior)
C++
DECLARE_GAMEOBJECT_FACTORY(IVehicleDamageBehavior);
IVehicleSystem::DECLARE_GAMEOBJECT_FACTORY Method (IVehicleMovement)
C++
DECLARE_GAMEOBJECT_FACTORY(IVehicleMovement);
IVehicleSystem::DECLARE_GAMEOBJECT_FACTORY Method (IVehiclePart)
C++
DECLARE_GAMEOBJECT_FACTORY(IVehiclePart);
IVehicleSystem::DECLARE_GAMEOBJECT_FACTORY Method (IVehicleSeatAction)
C++
DECLARE_GAMEOBJECT_FACTORY(IVehicleSeatAction);
IVehicleSystem::DECLARE_GAMEOBJECT_FACTORY Method (IVehicleView)
C++
DECLARE_GAMEOBJECT_FACTORY(IVehicleView);
IVehicleSystem::GetDamagesTemplateRegistry Method
C++
virtual IVehicleDamagesTemplateRegistry* GetDamagesTemplateRegistry() = 0;
IVehicleSystem::GetOptionalScript Method
C++
virtual bool GetOptionalScript(const char* vehicleName, char* buf, size_t len) = 0;
IVehicleSystem::GetVehicle Method

Gets the Vehicle proxy of an entity

C++
virtual IVehicle* GetVehicle(EntityId entityId) = 0;
Returns

A pointer to the correct vehicle proxy. The value 0 is returned in case that the proxy wasn't found.

Description

Will return the correct vehicle proxy of a vehicle entity.

IVehicleSystem::GetVehicleByChannelId Method
C++
virtual IVehicle* GetVehicleByChannelId(uint16 channelId) = 0;
IVehicleSystem::GetVehicleClient Method

Returns the vehicle client class implementation

C++
virtual IVehicleClient* GetVehicleClient() = 0;
Returns

A pointer to the current vehicle client implementation, or null if none as been registrated

See Also
IVehicleSystem::GetVehicleCount Method

Used to get the count of all vehicle instance

C++
virtual uint32 GetVehicleCount() = 0;
Returns

The count of all the vehicle instance created by the vehicle system

IVehicleSystem::GetVehicleImplementations Method
C++
virtual void GetVehicleImplementations(SVehicleImpls& impls) = 0;
IVehicleSystem::GetVehicleObjectId Method
C++
virtual TVehicleObjectId GetVehicleObjectId(const string& className) const = 0;
IVehicleSystem::Init Method
C++
virtual bool Init() = 0;
IVehicleSystem::IsVehicleClass Method
C++
virtual bool IsVehicleClass(const char * name) const = 0;
IVehicleSystem::RegisterVehicleClient Method

Performs the registration of vehicle client implementation

C++
virtual void RegisterVehicleClient(IVehicleClient* pVehicleClient) = 0;
Parameters
Parameters
Description
IVehicleClient* pVehicleClient
a pointer to the vehicle client implementation Notes Only one vehicle client implementation can be registrated
See Also
IVehicleSystem::RegisterVehicles Method

Performs the registration of all the different vehicle classes

C++
virtual void RegisterVehicles(IGameFramework* pGameFramework) = 0;
Parameters
Parameters
Description
IGameFramework* pGameFramework
A pointer to the game framework
Description

The vehicle system will read all the xml files which are inside the directory "Scripts/Entities/Vehicles/Implementations/Xml/". All the valid vehicle classes will be registered as game object extension with IGameObjectSystem.

Several default vehicle parts, views, actions and damage behaviors classes are registered in this function as well.

IVehicleSystem::RegisterVehicleUsageEventListener Method

Performs the registration of a class which wants to know when a specific player starts to use a vehicle

C++
virtual void RegisterVehicleUsageEventListener(const EntityId playerId, IVehicleUsageEventListener* pEventListener) = 0;
Parameters
Parameters
Description
const EntityId playerId
the entity id of the player to listen for.
pListener
a pointer to a listener object.
See Also
IVehicleSystem::Release Method
C++
virtual void Release() = 0;
IVehicleSystem::RemoveVehicle Method

Registers a newly removed vehicle in the vehicle system

C++
virtual void RemoveVehicle(EntityId entityId) = 0;
IVehicleSystem::Reset Method
C++
virtual void Reset() = 0;
IVehicleSystem::UnregisterVehicleUsageEventListener Method

Unregisters class listening to the current player's vehicle.

C++
virtual void UnregisterVehicleUsageEventListener(const EntityId playerId, IVehicleUsageEventListener* pEventListener) = 0;
Parameters
Parameters
Description
const EntityId playerId
the entity id of the player that the listener is registered for.
pListener
the pointer to be removed from the list of callbacks.
See Also
IVehicleSystem::Update Method
C++
virtual void Update(float deltaTime) = 0;