IVehicle

Vehicle implementation interface

C++
struct IVehicle : public IGameObjectExtension {
  enum EVehicleUpdateSlot {
    eVUS_Always = 0,
    eVUS_EnginePowered,
    eVUS_PassengerIn,
    eVUS_Visible,
    eVUS_AIControlled,
    eVUS_Last = eVUS_AIControlled
  };
  enum EVehicleObjectUpdate {
    eVOU_NoUpdate = 0,
    eVOU_AlwaysUpdate,
    eVOU_PassengerUpdate,
    eVOU_Visible
  };
  enum EVehicleNeedsUpdateFlags {
    eVUF_AwakePhysics = 1<<0
  };
};
File

IVehicleSystem.h

Description

Interface used to implement a vehicle.

IVehicle::EVehicleNeedsUpdateFlags Enumeration
C++
enum EVehicleNeedsUpdateFlags {
  eVUF_AwakePhysics = 1<<0
};
File

IVehicleSystem.h

IVehicle::EVehicleObjectUpdate Enumeration
C++
enum EVehicleObjectUpdate {
  eVOU_NoUpdate = 0,
  eVOU_AlwaysUpdate,
  eVOU_PassengerUpdate,
  eVOU_Visible
};
File

IVehicleSystem.h

IVehicle::EVehicleUpdateSlot Enumeration
C++
enum EVehicleUpdateSlot {
  eVUS_Always = 0,
  eVUS_EnginePowered,
  eVUS_PassengerIn,
  eVUS_Visible,
  eVUS_AIControlled,
  eVUS_Last = eVUS_AIControlled
};
File

IVehicleSystem.h

Members
Members
Description
eVUS_Always = 0
used for vehicle elements which always need to be updated
eVUS_EnginePowered
used for vehicle elements which should only be updated when the engine is powered
eVUS_PassengerIn
used for vehicle elements which should only when a passenger has entered the vehicle
eVUS_Visible
currently unused
eVUS_AIControlled
used for vehicle using new flight nav
IVehicle::AddHelper Method
C++
virtual bool AddHelper(const char* name, Vec3 position, Vec3 direction, IVehiclePart* pPart) = 0;
IVehicle::AddSeat Method
C++
virtual bool AddSeat(const SmartScriptTable& seatParams) = 0;
IVehicle::BroadcastVehicleEvent Method

Sends a vehicle event to all the listeners

C++
virtual void BroadcastVehicleEvent(EVehicleEvent event, const SVehicleEventParams& params) = 0;
Parameters
Parameters
Description
EVehicleEvent event
One of the event declared in EVehicleEvent
const SVehicleEventParams& params
optional parameter, see EVehicleEvent to know which member of this structure needs to be filled for the specific event
See Also
IVehicle::ClientEvictAllPassengers Method
C++
virtual void ClientEvictAllPassengers() = 0;
Description

Evacuate all passengers immediately on a client without having to ask the server for permission

IVehicle::ClientEvictPassenger Method
C++
virtual void ClientEvictPassenger(IActor * pActor) = 0;
Description

Evict specified passenger immediately on a client without having to ask the server for permission

IVehicle::Destroy Method
C++
virtual void Destroy() = 0;
IVehicle::EvictAllPassengers Method
C++
virtual void EvictAllPassengers() = 0;
Description

Evacuate all passengers

IVehicle::ExitVehicleAtPosition Method
C++
virtual void ExitVehicleAtPosition(EntityId passengerId, const Vec3 & pos) = 0;
Description

Request a passenger to leave the vehicle and spawn at pos

IVehicle::GetAction Method
C++
virtual IVehicleAction* GetAction(int index) = 0;
IVehicle::GetActionCount Method
C++
virtual int GetActionCount() = 0;
IVehicle::GetActionMap Method
C++
virtual const char* GetActionMap() const = 0;
Description

Returns the name of the action map specified for this vehicle type in the xml file

IVehicle::GetAltitude Method

Returns the altitude

C++
virtual float GetAltitude() = 0;
Returns

The altitude value, it should be a positive value

Description

Will return the altitude of the vehicle.

IVehicle::GetAmmoCount Method
C++
virtual int GetAmmoCount(IEntityClass* pAmmoType) const = 0;
IVehicle::GetAnimation Method
C++
virtual IVehicleAnimation* GetAnimation(const char* name) = 0;
IVehicle::GetAnimationComponent Method
C++
virtual IVehicleAnimationComponent & GetAnimationComponent() = 0;
IVehicle::GetChannelId Method
C++
uint16 GetChannelId();
IVehicle::GetComponent Method (char*)
C++
virtual IVehicleComponent* GetComponent(const char* name) = 0;
IVehicle::GetComponent Method (int)
C++
virtual IVehicleComponent* GetComponent(int index) = 0;
IVehicle::GetComponentCount Method
C++
virtual int GetComponentCount() const = 0;
IVehicle::GetCurrentWeaponId Method
C++
virtual EntityId GetCurrentWeaponId(EntityId passengerId, bool secondary = false) const = 0;
Description

get EntityId for currently used weapon for passengerId, or 0

IVehicle::GetCurrentWeaponInfo Method
C++
virtual bool GetCurrentWeaponInfo(SVehicleWeaponInfo & outInfo, EntityId passengerId, bool secondary = false) const = 0;
Description

get currently used weapon info for passengerId. Returns true if info was found.

IVehicle::GetDamageParams Method
C++
virtual const SVehicleDamageParams& GetDamageParams() const = 0;
IVehicle::GetDamageRatio Method
C++
virtual float GetDamageRatio(bool onlyMajorComponents = false) const = 0;
IVehicle::GetDriver Method

Get Actor on driver seat, or NULL

C++
virtual IActor* GetDriver() const = 0;
IVehicle::GetExitPositionForActor Method

Finds a valid world position the actor could be placed at when they exit the vehicle. Based on seat helpers, but does additional checks if these are all blocked. NB: actor may not necessarily be a passenger (used for MP spawn trucks) Returns true if a valid position was found, false otherwise. extended==true -> allows two actors to exit from one seat (lining up away from the vehicle).

C++
virtual bool GetExitPositionForActor(IActor* pActor, Vec3& pos, bool extended = false) = 0;
IVehicle::GetFireController Method
C++
virtual IFireController* GetFireController(uint32 controllerNum = 0) = 0;
IVehicle::GetHelper Method
C++
virtual IVehicleHelper* GetHelper(const char* pName) = 0;
IVehicle::GetLastSeatId Method
C++
virtual TVehicleSeatId GetLastSeatId() = 0;
Description

Get TVehicleSeatId of last seat

IVehicle::GetMass Method

Returns the mass

C++
virtual float GetMass() const = 0;
Returns

The mass value, it should never be a negative value

Description

Will return the mass of the vehicle.

IVehicle::GetModification Method

Returns vehicle modifications as a comma separated list (with no spaces)

C++
virtual const char* GetModification() const = 0;
IVehicle::GetMovement Method
C++
virtual IVehicleMovement* GetMovement() const = 0;
IVehicle::GetMovementController Method
C++
virtual IMovementController * GetMovementController() = 0;
Description

get the current movement controller

IVehicle::GetOwnerId Method
C++
virtual EntityId GetOwnerId() const = 0;
IVehicle::GetParentEntityId Method

Used in MP for logically linking associated vehicles together when spawning

C++
virtual EntityId GetParentEntityId() const = 0;
IVehicle::GetPart Method (char*)
C++
virtual IVehiclePart* GetPart(const char* name) = 0;
IVehicle::GetPart Method (unsigned int)
C++
virtual IVehiclePart* GetPart(unsigned int index) = 0;
IVehicle::GetPartCount Method
C++
virtual int GetPartCount() = 0;
IVehicle::GetParticleParams Method
C++
virtual SParticleParams* GetParticleParams() = 0;
IVehicle::GetParts Method
C++
virtual void GetParts(IVehiclePart** parts, int nMax) = 0;
IVehicle::GetPassengerMovementController Method
C++
virtual IMovementController * GetPassengerMovementController(EntityId passenger) = 0;
IVehicle::GetPhysicsParams Method

Gets the physics params

C++
virtual SEntityPhysicalizeParams& GetPhysicsParams() = 0;
Returns
Description

It will return the physics params which have been sent to the entity system when the vehicle entity was spawned

IVehicle::GetSeatById Method
C++
virtual IVehicleSeat* GetSeatById(const TVehicleSeatId seatId) const = 0;
Description

Get Seat by SeatId, or NULL

IVehicle::GetSeatCount Method
C++
virtual unsigned int GetSeatCount() = 0;
Description

Get amount of Seats

IVehicle::GetSeatForPassenger Method
C++
virtual IVehicleSeat* GetSeatForPassenger(EntityId passengerId) const = 0;
Description

get seat interface for passengerId, or NULL

IVehicle::GetSeatId Method
C++
virtual TVehicleSeatId GetSeatId(const char* pSeatName) = 0;
Description

Get SeatId by name

IVehicle::GetSelfCollisionMult Method
C++
virtual float GetSelfCollisionMult(const Vec3& velocity, const Vec3& normal, int partId, EntityId colliderId) const = 0;
Description

Returns collision damage multiplayer

IVehicle::GetSkipEntities Method

Returns the physical entities attached to this vehicle, for use with physics RWI and PWI tests

C++
virtual int GetSkipEntities(IPhysicalEntity** pSkipEnts, int nMaxSkip) = 0;
IVehicle::GetStatus Method

Gets the status

C++
virtual const SVehicleStatus& GetStatus() const = 0;
Returns

a SVehicleStatus structure

Description

Will return a structure which hold several status information on the vehicle, including destroyed state and passenger count.

IVehicle::GetWeaponCount Method
C++
virtual int GetWeaponCount() const = 0;
Description

get total number of weapon entities on vehicle

IVehicle::GetWeaponId Method
C++
virtual EntityId GetWeaponId(int index) const = 0;
Description

Get EntityId by weapon index

IVehicle::GetWeaponParentPart Method
C++
virtual IVehiclePart* GetWeaponParentPart(EntityId weaponId) = 0;
IVehicle::GetWeaponParentSeat Method
C++
virtual IVehicleSeat* GetWeaponParentSeat(EntityId weaponId) = 0;
IVehicle::GetWheelCount Method

Returns the wheel count

C++
virtual int GetWheelCount() = 0;
Returns

The wheel count, or 0 if none are available

Description

Will return the wheel count of the vehicle, if any are preset.

IVehicle::GetWheelPart Method
C++
virtual IVehiclePart* GetWheelPart(int idx) = 0;
IVehicle::HasFriendlyPassenger Method
C++
virtual bool HasFriendlyPassenger(IEntity * pPlayer) = 0;
Description

check if there is friendlyPassenger

IVehicle::HasHelper Method

Indicates if an helper position is available

C++
virtual bool HasHelper(const char* pName) = 0;
Parameters
Parameters
Description
name
name of the helper position
Description

Will find if a specified helper position exist on the vehicle.

IVehicle::IsCrewHostile Method
C++
virtual bool IsCrewHostile(EntityId actorId) = 0;
Description

Check that an enemy is not already using this vehicle, before entering

IVehicle::IsDestroyed Method
C++
virtual bool IsDestroyed() const = 0;
IVehicle::IsFlipped Method
C++
virtual bool IsFlipped(float maxSpeed = 0.f) = 0;
IVehicle::IsIndestructable Method
C++
virtual bool IsIndestructable() const = 0;
IVehicle::IsPlayerDriving Method
C++
virtual bool IsPlayerDriving(bool clientOnly = true) = 0;
Description

check if player/client is driving this vehicle

IVehicle::IsPlayerPassenger Method
C++
virtual bool IsPlayerPassenger() = 0;
Description

check if client is inside this vehicle

IVehicle::IsProbablyDistant Method
C++
virtual bool IsProbablyDistant() const = 0;
Description

Is vehicle probably distant from the player?

IVehicle::IsUsable Method
C++
virtual int IsUsable(EntityId userId) = 0;
IVehicle::KillTimer Method

Kill Entity Timer

C++
virtual int KillTimer(int timerId) = 0;
IVehicle::NeedsUpdate Method

Notify vehicle to that update is required

C++
virtual void NeedsUpdate(int flags = 0, bool bThreadSafe = false) = 0;
IVehicle::OffsetPosition Method
C++
virtual void OffsetPosition(const Vec3 & delta) = 0;
Description

Sound parameters structure.

IVehicle::OnAction Method
C++
virtual void OnAction(const TVehicleActionId actionId, int activationMode, float value, EntityId callerId) = 0;
Description

FIXME:move this to the gameside, its not really needed here, plus add callerId to the IActionListener interface

IVehicle::OnHit Method
C++
virtual void OnHit(const HitInfo& hitInfo, IVehicleComponent * pHitComponent = NULL) = 0;
IVehicle::OnUsed Method
C++
virtual bool OnUsed(EntityId userId, int index) = 0;
IVehicle::RegisterVehicleEventListener Method

Registers an event listener

C++
virtual void RegisterVehicleEventListener(IVehicleEventListener* pEvenListener, const char* name) = 0;
Parameters
Parameters
Description
IVehicleEventListener* pEvenListener
a pointer to class which implements the IVehicleEventListener interface
See Also
IVehicle::Reset Method

Reset vehicle

C++
virtual void Reset(bool enterGame) = 0;
Description

Will reset properly all components of the vehicle including the seats, components, parts and the movement.

IVehicle::SetAmmoCount Method
C++
virtual void SetAmmoCount(IEntityClass* pAmmoType, int amount) = 0;
IVehicle::SetChannelId Method
C++
void SetChannelId(uint16 id);
IVehicle::SetObjectUpdate Method
C++
virtual void SetObjectUpdate(IVehicleObject* pObject, EVehicleObjectUpdate updatePolicy) = 0;
IVehicle::SetOwnerId Method
C++
virtual void SetOwnerId(EntityId ownerId) = 0;
IVehicle::SetParentEntityId Method
C++
virtual void SetParentEntityId(EntityId parentEntityId) = 0;
IVehicle::SetTimer Method

Register Entity Timer. If timerId == -1, timerId will be assigned

C++
virtual int SetTimer(int timerId, int ms, IVehicleObject* pObject) = 0;
IVehicle::SetUnmannedFlippedThresholdAngle Method
C++
virtual void SetUnmannedFlippedThresholdAngle(float angle) = 0;
IVehicle::TriggerEngineSlotBySpeed Method

Enables/disables engine slot triggering by vehicle speed

C++
virtual void TriggerEngineSlotBySpeed(bool trigger) = 0;
IVehicle::UnregisterVehicleEventListener Method

Unregisters an event listener

C++
virtual void UnregisterVehicleEventListener(IVehicleEventListener* pEvenListener) = 0;
Parameters
Parameters
Description
IVehicleEventListener* pEvenListener
a pointer to class which implements the IVehicleEventListener interface
See Also
IVehicle::UpdatePassenger Method
C++
virtual void UpdatePassenger(float frameTime, EntityId playerId) = 0;
IVehicle::UpdateView Method

Updates view of a passenger

C++
virtual void UpdateView(SViewParams & viewParams, EntityId playerId = 0) = 0;
Parameters
Parameters
Description
SViewParams & viewParams
structure which is used to return the camera info
EntityId playerId = 0
entity id of the passenger
Description

Will update the SViewParams structure will the correct camera info for a specified passenger of the vehicle.