DIFF

class CarScriptSource

CarScript Car Transport Pawn EntityAI Entity ObjectTyped Object IEntity Managed

All members, including inherited

Base script class for cars

Constructors 2

void ~CarScript()
References CleanupEffects()

Constants 12

static const string MEMORY_POINT_NAME_CAR_HORN = "pos_carHorn"
private const float BATTERY_UPDATE_DELAY = 100
Referenced by OnUpdate()
static const int SELECTION_ID_FRONT_LIGHT_L = 0
static const int SELECTION_ID_FRONT_LIGHT_R = 1
static const int SELECTION_ID_BRAKE_LIGHT_L = 2
static const int SELECTION_ID_BRAKE_LIGHT_R = 3
static const int SELECTION_ID_REVERSE_LIGHT_L = 4
static const int SELECTION_ID_REVERSE_LIGHT_R = 5
static const int SELECTION_ID_TAIL_LIGHT_L = 6
static const int SELECTION_ID_TAIL_LIGHT_R = 7
static const int SELECTION_ID_DASHBOARD_LIGHT = 8
private const int DEBUG_MESSAGE_CLEAN_TIME_SECONDS = 10DEVELOPER
Referenced by EOnPostSimulate()

Members 92

static EVehicleDebugOutputType DEBUG_OUTPUT_TYPEDIAG_DEVELOPER
Referenced by CheckContactCache(), DamageCrew(), EOnPostSimulate()
Show 1 more, OnContact()
bool m_ContactCalledDIAG_DEVELOPER
Referenced by EOnPostSimulate(), and OnContact()
static ref map<typename, ref TInputActionMap> m_CarTypeActionsMap = new map<typename, ref TInputActionMap>
Referenced by InitializeActions()
TInputActionMap m_InputActionMap
Referenced by AddAction(), GetActions(), InitializeActions()
Show 1 more, RemoveAction()
bool m_ActionsInitialize
Referenced by AddAction(), and GetActions()
protected float m_MomentumPrevTick
protected vector m_VelocityPrevTick
ref CarContactCache m_ContactCache
protected float m_Time
Referenced by CarScript(), EOnPostSimulate(), ObtainState()
Show 1 more, RewindState()
static float DROWN_ENGINE_THRESHOLD = 0.5
Referenced by OnUpdate()
static float DROWN_ENGINE_DAMAGE = 350.0
Referenced by OnUpdate()
protected float m_FuelAmmount

keeps ammount of each fluid

Referenced by OnFluidChanged()
protected float m_CoolantAmmount
Referenced by OnFluidChanged()
protected float m_OilAmmount
Referenced by OnFluidChanged()
protected float m_BrakeAmmount
Referenced by OnFluidChanged()
protected float m_dmgContactCoef = 0.058
protected float m_EnviroHeatComfortOverride
Referenced by CarScript()
protected float m_DrownTime
Referenced by OnUpdate()
static vector m_DrownEnginePos
Referenced by CarScript(), and GetEnginePosWS()
protected float m_EngineHealth
Referenced by CarPartsHealthCheck(), CarScript(), EOnPostSimulate()
Show 1 more, LeakFluid()
protected float m_RadiatorHealth
protected float m_FuelTankHealth
Referenced by CarPartsHealthCheck(), CarScript(), EOnPostSimulate()
Show 1 more, LeakFluid()
protected float m_BatteryHealth
protected float m_PlugHealth
protected EntityAI m_Radiator
Referenced by EEItemAttached(), EEItemDetached(), GetRadiator()
Show 1 more, HasRadiator()
protected float m_BatteryConsume = 15

Battery energy consumption upon engine start

protected float m_BatteryContinuousConsume = 0.25

Battery consumption with lights on and engine is off

protected float m_BatteryRecharge = 0.15

Battery recharge rate when engine is on

private float m_BatteryTimer = 0

Used to factor energy consumption / recharging

Referenced by OnUpdate(), and UpdateBattery()
protected ref EffVehicleSmoke m_coolantFx

Particles

protected ref EffVehicleSmoke m_engineFx
protected ref EffVehicleSmoke m_exhaustFx
protected int m_enginePtcFx
protected int m_coolantPtcFx
Referenced by CarScript(), and EOnPostSimulate()
protected int m_exhaustPtcFx
Referenced by CarScript(), and EOnPostSimulate()
protected vector m_exhaustPtcPos
Referenced by CarScript(), and EOnPostSimulate()
protected vector m_exhaustPtcDir
Referenced by CarScript(), and EOnPostSimulate()
protected vector m_enginePtcPos
protected vector m_coolantPtcPos
protected vector m_enginePos
protected vector m_frontPos
protected vector m_backPos
Referenced by CarScript(), and GetBackPointPosWS()
protected vector m_side_1_1Pos
Referenced by CarScript(), and Get_1_1PointPosWS()
protected vector m_side_1_2Pos
Referenced by CarScript(), and Get_1_2PointPosWS()
protected vector m_side_2_1Pos
Referenced by CarScript(), and Get_2_1PointPosWS()
protected vector m_side_2_2Pos
Referenced by CarScript(), and Get_2_2PointPosWS()
string m_CarSeatShiftInSound = ""
string m_CarSeatShiftOutSound = ""
ref EffectSound m_CrashSoundLight
ref EffectSound m_CrashSoundHeavy
ref EffectSound m_WindowSmall
ref EffectSound m_WindowLarge
private ref EffectSound m_PreStartSound
Referenced by HandleEngineSound()
protected ref EffectSound m_CarHornSoundEffect
protected ref NoiseParams m_NoisePar
protected NoiseSystem m_NoiseSystem
protected bool m_PlayCrashSoundLight
protected bool m_PlayCrashSoundHeavy
protected int m_HeadlightsState
protected int m_RearLightType
protected bool m_ForceUpdateLights
protected bool m_EngineStarted
Referenced by OnSound(), and SetEngineStarted()
protected bool m_EngineDestroyed
Referenced by EEKilled()
protected int m_CarHornState
CarLightBase m_Headlight
static string m_ReverseLightPoint = "light_reverse"
Referenced by UpdateLightsClient()
static string m_LeftHeadlightPoint = "light_left"
Referenced by UpdateLightsClient()
static string m_RightHeadlightPoint = "light_right"
Referenced by UpdateLightsClient()
static string m_LeftHeadlightTargetPoint = "light_left_dir"
Referenced by UpdateLightsClient()
static string m_RightHeadlightTargetPoint = "light_right_dir"
Referenced by UpdateLightsClient()
static string m_DrownEnginePoint = "drown_engine"
protected ref array<ref EffWheelSmoke> m_WheelSmokeFx
protected ref array<int> m_WheelSmokePtcFx
protected int m_CarEngineSoundState
protected int m_CarEngineLastSoundState
private float m_DebugMessageCleanTimeDEVELOPER
Referenced by EOnPostSimulate()
private string m_DebugContactDamageMessageDEVELOPER
Referenced by OnAction(), and OnInput()
protected float m_BatteryEnergyStartMin = 5.0

DEPRECATED

protected bool m_HeadlightsOn
protected bool m_BrakesArePressed

not yet actually removed, but functionality will be moved to native to prevent requiring updating of lights every game tick

Methods 152

override string GetVehicleType()
vector GetEnginePosWS()
vector GetCoolantPtcPosWS()
vector GetEnginePointPosWS()
vector GetFrontPointPosWS()
vector GetBackPointPosWS()
vector Get_1_1PointPosWS()
vector Get_1_2PointPosWS()
vector Get_2_1PointPosWS()
vector Get_2_2PointPosWS()
override float GetLiquidThroughputCoef()
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
override void EEDelete(EntityAI parent)
References CleanupEffects()
void CleanupSound(EffectSound sound)
void UpdateHeadlightState()
override void OnAttachmentRuined(EntityAI attachment)
protected bool CanManipulateSpareWheel(string slotSelectionName)
override void EOnPostSimulate(IEntity other, float timeSlice)
References Math.AbsFloat(), Object.AddHealth(), CarPartsHealthCheck()
Show 83 more, Class.Cast(), CheckContactCache(), CheckVitalItem(), dBodyGetVelocityAt(), new EffCoolantSteam(), new EffExhaustSmoke(), new EffWheelSmoke(), Car.EngineGetRPM(), Car.EngineGetRPMMax(), Car.EngineGetRPMRedline(), Car.EngineIsOn(), Car.EngineStop(), array.Get(), array.Get(), Car.GetFluidFraction(), Object.GetMaxHealth(), Transport.GetMomentum(), CarWheel.GetRadius(), GetVelocity(), Surface.GetWheelParticleID(), vector.InvMultiply3(), Object.IsDamageDestroyed(), CGame.IsDedicatedServer(), SEffectManager.IsEffectExist(), Effect.IsPlaying(), CGame.IsServer(), IsServerOrOwner(), IsVitalFuelTank(), IsVitalGlowPlug(), IsVitalRadiator(), Transport.IsVitalSparkPlug(), LeakFluid(), vector.Length(), Debug.Log(), SEffectManager.PlayOnObject(), Object.ProcessDirectDamage(), Math.RandomFloat(), array.Set(), array.Set(), EffectParticle.SetCurrentLocalPosition(), Transport.SetEngineZoneReceivedHit(), Object.SetHealth(), EffVehicleSmoke.SetParticleStateHeavy(), EffVehicleSmoke.SetParticleStateLight(), EffVehicleSmoke.SetParticleStateLight(), EffWheelSmoke.SetSurface(), EffectParticle.Start(), EffectParticle.Stop(), SEffectManager.Stop(), CGame.SurfaceGetType(), Car.WheelCount(), Car.WheelGetAngularVelocity(), Car.WheelGetContactPosition(), Car.WheelGetDirection(), Car.WheelGetEntity(), Car.WheelHasContact(), Object.WorldToModel(), GameConstants.CARS_FLUIDS_TICK, GameConstants.DAMAGE_DAMAGED_VALUE, GameConstants.DAMAGE_RUINED_VALUE, DEBUG_MESSAGE_CLEAN_TIME_SECONDS, DEBUG_OUTPUT_TYPE, m_ContactCalled, m_coolantFx, m_coolantPtcFx, m_coolantPtcPos, m_DebugContactDamageMessage, m_DebugMessageCleanTime, m_EngineHealth, m_exhaustFx, m_exhaustPtcDir, m_exhaustPtcFx, m_exhaustPtcPos, m_FuelTankHealth, m_MomentumPrevTick, m_RadiatorHealth, m_Time, m_VelocityPrevTick, m_WheelSmokeFx, m_WheelSmokePtcFx, vector.Up, EffWheelSmoke.WHEEL_SMOKE_THRESHOLD, and vector.Zero
void OnBrakesPressed()

leaking of coolant from radiator when damaged

References UpdateLights()
Referenced by OnUpdate()
void OnBrakesReleased()
References UpdateLights()
Referenced by OnUpdate()
override void OnDriverExit(Human player)
override void EEKilled(Object killer)
override void OnContact(string zoneName, vector localPos, IEntity other, Contact data)

WARNING: Can be called very frequently in one frame, use with caution

override float OnSound(CarSoundCtrl ctrl, float oldValue)

Gets called every sound simulation step. In this callback, user can modify behaviour of sound controllers The higher the return value is the more muted sound is.

References m_EngineStarted
override void OnAnimationPhaseStarted(string animSource, float phase)
protected void HandleCarHornSound(ECarHornState pState)
void SetCarEngineSoundState(CarEngineSoundState pState)
override void MarkCrewMemberUnconscious(int crewMemberIndex)

postpone the engine sound played from c++ on soundcontroller (via OnSound override)

override void MarkCrewMemberDead(int crewMemberIndex)
override void OnFluidChanged(CarFluid fluid, float newValue, float oldValue)

Gets called everytime when the specified vehicle's fluid changes its current value eg. when vehicle is consuming fuel.

This callback is called on server.

References m_BrakeAmmount, m_CoolantAmmount, m_FuelAmmount
Show 1 more, m_OilAmmount
override bool OnBeforeEngineStart()

Gets called everytime the game wants to start the engine.

Returns: true if the engine can start, false otherwise.

void OnIgnition()
bool CheckOperationalState()
override void OnGearChanged(int newGear, int oldGear)
References UpdateLights()
bool IsScriptedLightsOn()

Proper way to get if light is swiched on

override bool OnBeforeLightOn()
void ToggleHeadlights()

Switches headlights on/off, including the illumination of the control panel and synchronizes this change to all clients.

protected void BrakesRearLight()
Referenced by UpdateLightsClient()
protected void ReverseRearLight()
Referenced by UpdateLightsClient()
protected void BrakeAndReverseRearLight()
Referenced by UpdateLightsClient()
protected void NoRearLight()
Referenced by UpdateLightsClient()
protected void LeftFrontLightShineOn()
Referenced by UpdateLightsServer()
protected void RightFrontLightShineOn()
Referenced by UpdateLightsServer()
protected void LeftFrontLightShineOff()
Referenced by UpdateLightsServer()
protected void RightFrontLightShineOff()
Referenced by UpdateLightsServer()
protected void ReverseLightsShineOn()
Referenced by UpdateLightsServer()
protected void ReverseLightsShineOff()
Referenced by UpdateLightsServer()
protected void BrakeLightsShineOn()
Referenced by UpdateLightsServer()
protected void BrakeLightsShineOff()
Referenced by UpdateLightsServer()
protected void TailLightsShineOn()
Referenced by UpdateLightsServer()
protected void TailLightsShineOff()
Referenced by UpdateLightsServer()
protected void DashboardShineOn()
Referenced by UpdateLightsServer()
protected void DashboardShineOff()
Referenced by UpdateLightsServer()
protected CarRearLightBase CreateRearLight()
Referenced by UpdateLightsClient()
protected CarLightBase CreateFrontLight()
Referenced by UpdateLightsClient()
protected void CheckVitalItem(bool isVital, int slotId)
Referenced by EOnPostSimulate()
protected void CheckVitalItem(bool isVital, string slot_name)
Referenced by EOnPostSimulate()
protected void LeakFluid(CarFluid fluid)
Referenced by EOnPostSimulate()
bool GetCrashLightSound()
void SynchCrashLightSound(bool play)
Referenced by CheckContactCache()
void PlayCrashLightSound()
bool GetCrashHeavySound()
void SynchCrashHeavySound(bool play)
Referenced by CheckContactCache()
void PlayCrashHeavySound()
void PlaySound(string soundset, EffectSound sound, out bool soundbool)
References PlaySoundEx()
string GetSelectionFromAnimSource(string animSource)
string GetDoorConditionPointFromSelection(string selection)
int GetCrewIndex(string selection)
override bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance = 1.0)
bool IsVitalCarBattery()

skip the height for now

bool IsVitalEngineBelt()
bool IsVitalFuelTank()
Referenced by EOnPostSimulate()
bool HasRadiator()
References m_Radiator
EntityAI GetRadiator()
References m_Radiator
bool IsMoving()
bool IsHandbrakeActive()
override int Get3rdPersonCameraType()

camera type

void SetEngineStarted(bool started)
References m_EngineStarted
string GetActionCompNameCoolant()
float GetActionDistanceCoolant()
string GetActionCompNameOil()
float GetActionDistanceOil()
string GetActionCompNameBrakes()
float GetActionDistanceBrakes()
override bool CanPutIntoHands(EntityAI parent)
void InitializeActions()
Referenced by GetActions()
override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void EEOnCECreate()
float GetBatteryConsumption()
References m_BatteryConsume
float GetBatteryRuntimeConsumption()
Referenced by UpdateBattery()
float GetBatteryRechargeRate()
Referenced by UpdateBattery()
void SetCarHornState(int pState)
protected void GenerateCarHornAINoise(int pState)
Referenced by SetCarHornState()
override vector GetDefaultHitPosition()
References vector.Zero
float GetPushForceCoefficientMultiplier()
override protected string GetDebugText()DEVELOPER
protected override event typename GetOwnerStateType()
protected override event typename GetMoveType()
protected override event void ObtainState(PawnOwnerState pState)
References Class.Cast(), and m_Time
protected override event void RewindState(PawnOwnerState pState, PawnMove pMove, inout NetworkRewindType pRewindType)
References Class.Cast(), and m_Time
bool OnBeforeSwitchLights(bool toOn)

DEPRECATED Gets called everytime the game wants to switch the lights.

Returns: true when lights can be switched, false otherwise.

float GetEnviroHeatComfortOverride()