Vehicle implementation interface
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 }; };
IVehicleSystem.h
Interface used to implement a vehicle.
enum EVehicleNeedsUpdateFlags { eVUF_AwakePhysics = 1<<0 };
IVehicleSystem.h
enum EVehicleObjectUpdate { eVOU_NoUpdate = 0, eVOU_AlwaysUpdate, eVOU_PassengerUpdate, eVOU_Visible };
IVehicleSystem.h
enum EVehicleUpdateSlot { eVUS_Always = 0, eVUS_EnginePowered, eVUS_PassengerIn, eVUS_Visible, eVUS_AIControlled, eVUS_Last = eVUS_AIControlled };
IVehicleSystem.h
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 |
virtual bool AddHelper(const char* name, Vec3 position, Vec3 direction, IVehiclePart* pPart) = 0;
virtual bool AddSeat(const SmartScriptTable& seatParams) = 0;
Sends a vehicle event to all the listeners
virtual void BroadcastVehicleEvent(EVehicleEvent event, const SVehicleEventParams& params) = 0;
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 |
virtual void ClientEvictAllPassengers() = 0;
Evacuate all passengers immediately on a client without having to ask the server for permission
virtual void ClientEvictPassenger(IActor * pActor) = 0;
Evict specified passenger immediately on a client without having to ask the server for permission
virtual void Destroy() = 0;
virtual void EvictAllPassengers() = 0;
Evacuate all passengers
virtual void ExitVehicleAtPosition(EntityId passengerId, const Vec3 & pos) = 0;
Request a passenger to leave the vehicle and spawn at pos
virtual IVehicleAction* GetAction(int index) = 0;
virtual int GetActionCount() = 0;
virtual const char* GetActionMap() const = 0;
Returns the name of the action map specified for this vehicle type in the xml file
Returns the altitude
virtual float GetAltitude() = 0;
The altitude value, it should be a positive value
Will return the altitude of the vehicle.
virtual int GetAmmoCount(IEntityClass* pAmmoType) const = 0;
virtual IVehicleAnimation* GetAnimation(const char* name) = 0;
virtual IVehicleAnimationComponent & GetAnimationComponent() = 0;
uint16 GetChannelId();
virtual IVehicleComponent* GetComponent(const char* name) = 0;
virtual IVehicleComponent* GetComponent(int index) = 0;
virtual int GetComponentCount() const = 0;
get EntityId for currently used weapon for passengerId, or 0
virtual bool GetCurrentWeaponInfo(SVehicleWeaponInfo & outInfo, EntityId passengerId, bool secondary = false) const = 0;
get currently used weapon info for passengerId. Returns true if info was found.
virtual const SVehicleDamageParams& GetDamageParams() const = 0;
virtual float GetDamageRatio(bool onlyMajorComponents = false) const = 0;
Get Actor on driver seat, or NULL
virtual IActor* GetDriver() const = 0;
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).
virtual bool GetExitPositionForActor(IActor* pActor, Vec3& pos, bool extended = false) = 0;
virtual IFireController* GetFireController(uint32 controllerNum = 0) = 0;
virtual IVehicleHelper* GetHelper(const char* pName) = 0;
virtual TVehicleSeatId GetLastSeatId() = 0;
Get TVehicleSeatId of last seat
Returns the mass
virtual float GetMass() const = 0;
The mass value, it should never be a negative value
Will return the mass of the vehicle.
Returns vehicle modifications as a comma separated list (with no spaces)
virtual const char* GetModification() const = 0;
virtual IVehicleMovement* GetMovement() const = 0;
virtual IMovementController * GetMovementController() = 0;
get the current movement controller
virtual EntityId GetOwnerId() const = 0;
Used in MP for logically linking associated vehicles together when spawning
virtual EntityId GetParentEntityId() const = 0;
virtual IVehiclePart* GetPart(const char* name) = 0;
virtual IVehiclePart* GetPart(unsigned int index) = 0;
virtual int GetPartCount() = 0;
virtual SParticleParams* GetParticleParams() = 0;
virtual void GetParts(IVehiclePart** parts, int nMax) = 0;
virtual IMovementController * GetPassengerMovementController(EntityId passenger) = 0;
Gets the physics params
virtual SEntityPhysicalizeParams& GetPhysicsParams() = 0;
a SEntityPhysicalizeParams structure
It will return the physics params which have been sent to the entity system when the vehicle entity was spawned
virtual IVehicleSeat* GetSeatById(const TVehicleSeatId seatId) const = 0;
Get Seat by SeatId, or NULL
virtual unsigned int GetSeatCount() = 0;
Get amount of Seats
virtual IVehicleSeat* GetSeatForPassenger(EntityId passengerId) const = 0;
get seat interface for passengerId, or NULL
virtual TVehicleSeatId GetSeatId(const char* pSeatName) = 0;
Get SeatId by name
virtual float GetSelfCollisionMult(const Vec3& velocity, const Vec3& normal, int partId, EntityId colliderId) const = 0;
Returns collision damage multiplayer
Returns the physical entities attached to this vehicle, for use with physics RWI and PWI tests
virtual int GetSkipEntities(IPhysicalEntity** pSkipEnts, int nMaxSkip) = 0;
Gets the status
virtual const SVehicleStatus& GetStatus() const = 0;
a SVehicleStatus structure
Will return a structure which hold several status information on the vehicle, including destroyed state and passenger count.
virtual int GetWeaponCount() const = 0;
get total number of weapon entities on vehicle
virtual EntityId GetWeaponId(int index) const = 0;
Get EntityId by weapon index
virtual IVehiclePart* GetWeaponParentPart(EntityId weaponId) = 0;
virtual IVehicleSeat* GetWeaponParentSeat(EntityId weaponId) = 0;
Returns the wheel count
virtual int GetWheelCount() = 0;
The wheel count, or 0 if none are available
Will return the wheel count of the vehicle, if any are preset.
virtual IVehiclePart* GetWheelPart(int idx) = 0;
virtual bool HasFriendlyPassenger(IEntity * pPlayer) = 0;
check if there is friendlyPassenger
Indicates if an helper position is available
virtual bool HasHelper(const char* pName) = 0;
Parameters |
Description |
name |
name of the helper position |
Will find if a specified helper position exist on the vehicle.
virtual bool IsCrewHostile(EntityId actorId) = 0;
Check that an enemy is not already using this vehicle, before entering
virtual bool IsDestroyed() const = 0;
virtual bool IsFlipped(float maxSpeed = 0.f) = 0;
virtual bool IsIndestructable() const = 0;
virtual bool IsPlayerDriving(bool clientOnly = true) = 0;
check if player/client is driving this vehicle
virtual bool IsPlayerPassenger() = 0;
check if client is inside this vehicle
virtual bool IsProbablyDistant() const = 0;
Is vehicle probably distant from the player?
virtual int IsUsable(EntityId userId) = 0;
Kill Entity Timer
virtual int KillTimer(int timerId) = 0;
Notify vehicle to that update is required
virtual void NeedsUpdate(int flags = 0, bool bThreadSafe = false) = 0;
virtual void OffsetPosition(const Vec3 & delta) = 0;
Sound parameters structure.
virtual void OnAction(const TVehicleActionId actionId, int activationMode, float value, EntityId callerId) = 0;
FIXME:move this to the gameside, its not really needed here, plus add callerId to the IActionListener interface
virtual void OnHit(const HitInfo& hitInfo, IVehicleComponent * pHitComponent = NULL) = 0;
virtual bool OnUsed(EntityId userId, int index) = 0;
Registers an event listener
virtual void RegisterVehicleEventListener(IVehicleEventListener* pEvenListener, const char* name) = 0;
Parameters |
Description |
IVehicleEventListener* pEvenListener |
a pointer to class which implements the IVehicleEventListener interface |
Reset vehicle
virtual void Reset(bool enterGame) = 0;
Will reset properly all components of the vehicle including the seats, components, parts and the movement.
virtual void SetAmmoCount(IEntityClass* pAmmoType, int amount) = 0;
void SetChannelId(uint16 id);
virtual void SetObjectUpdate(IVehicleObject* pObject, EVehicleObjectUpdate updatePolicy) = 0;
virtual void SetOwnerId(EntityId ownerId) = 0;
virtual void SetParentEntityId(EntityId parentEntityId) = 0;
Register Entity Timer. If timerId == -1, timerId will be assigned
virtual int SetTimer(int timerId, int ms, IVehicleObject* pObject) = 0;
virtual void SetUnmannedFlippedThresholdAngle(float angle) = 0;
Enables/disables engine slot triggering by vehicle speed
virtual void TriggerEngineSlotBySpeed(bool trigger) = 0;
Unregisters an event listener
virtual void UnregisterVehicleEventListener(IVehicleEventListener* pEvenListener) = 0;
Parameters |
Description |
IVehicleEventListener* pEvenListener |
a pointer to class which implements the IVehicleEventListener interface |
virtual void UpdatePassenger(float frameTime, EntityId playerId) = 0;
Updates view of a passenger
virtual void UpdateView(SViewParams & viewParams, EntityId playerId = 0) = 0;
Parameters |
Description |
SViewParams & viewParams |
structure which is used to return the camera info |
EntityId playerId = 0 |
entity id of the passenger |
Will update the SViewParams structure will the correct camera info for a specified passenger of the vehicle.