DayZ 1.24
Loading...
Searching...
No Matches
CarScript.c File Reference

Go to the source code of this file.

Enumerations

enum  CarDoorState { DOORS_MISSING , DOORS_OPEN , DOORS_CLOSED }
 

Functions

void CarScript ()
 
override void EEInit ()
 
vector GetEnginePosWS ()
 
vector GetCoolantPtcPosWS ()
 
vector GetRefillPointPosWS ()
 
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)
 
void ~CarScript ()
 
void CleanupEffects ()
 
void CleanupSound (EffectSound sound)
 
override void GetDebugActions (out TSelectableActionInfoArrayEx outputList)
 
override bool OnAction (int action_id, Man player, ParamsReadContext ctx)
 
override void OnVariablesSynchronized ()
 
void CreateCarDestroyedEffect ()
 
override void EEItemAttached (EntityAI item, string slot_name)
 
void UpdateHeadlightState ()
 
override void EEItemDetached (EntityAI item, string slot_name)
 
override void OnAttachmentRuined (EntityAI attachment)
 
override bool CanReceiveAttachment (EntityAI attachment, int slotId)
 
override bool CanReleaseAttachment (EntityAI attachment)
 
bool CanManipulateSpareWheel (string slotSelectionName)
 
override void EOnPostSimulate (IEntity other, float timeSlice)
 
void OnBrakesPressed ()
 
void OnBrakesReleased ()
 
override void OnUpdate (float dt)
 
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.
 
void CheckContactCache ()
 Responsible for damaging the car according to contact events from OnContact.
 
void DamageCrew (float dmg)
 Responsible for damaging crew in a car crash.
 
override float OnSound (CarSoundCtrl ctrl, float oldValue)
 
override void OnAnimationPhaseStarted (string animSource, float phase)
 
void HandleDoorsSound (string animSource, float phase)
 
void HandleSeatAdjustmentSound (string animSource, float phase)
 
void HandleCarHornSound (ECarHornState pState)
 
void HandleEngineSound (CarEngineSoundState state)
 
override void MarkCrewMemberUnconscious (int crewMemberIndex)
 
override void MarkCrewMemberDead (int crewMemberIndex)
 
override void HandleByCrewMemberState (ECrewMemberState state)
 
float GetEnviroHeatComfortOverride ()
 DEPRECATED.
 
override void OnFluidChanged (CarFluid fluid, float newValue, float oldValue)
 
override bool OnBeforeEngineStart ()
 
override void OnGearChanged (int newGear, int oldGear)
 
override void OnEngineStart ()
 Gets called everytime the engine starts.
 
override void OnEngineStop ()
 Gets called everytime the engine stops.
 
bool OnBeforeSwitchLights (bool toOn)
 
bool IsScriptedLightsOn ()
 Propper way to get if light is swiched on. Use instead of IsLightsOn().
 
void ToggleHeadlights ()
 Switches headlights on/off, including the illumination of the control panel and synchronizes this change to all clients.
 
void UpdateLights (int new_gear=-1)
 
void UpdateLightsClient (int newGear=-1)
 
void UpdateLightsServer (int newGear=-1)
 
void BrakesRearLight ()
 
void ReverseRearLight ()
 
void BrakeAndReverseRearLight ()
 
void NoRearLight ()
 
void LeftFrontLightShineOn ()
 
void RightFrontLightShineOn ()
 
void LeftFrontLightShineOff ()
 
void RightFrontLightShineOff ()
 
void ReverseLightsShineOn ()
 
void ReverseLightsShineOff ()
 
void BrakeLightsShineOn ()
 
void BrakeLightsShineOff ()
 
void TailLightsShineOn ()
 
void TailLightsShineOff ()
 
void DashboardShineOn ()
 
void DashboardShineOff ()
 
CarRearLightBase CreateRearLight ()
 
CarLightBase CreateFrontLight ()
 
void CheckVitalItem (bool isVital, string itemName)
 
void LeakFluid (CarFluid fluid)
 
void CarPartsHealthCheck ()
 
bool GetCrashLightSound ()
 
void SynchCrashLightSound (bool play)
 
void PlayCrashLightSound ()
 
bool GetCrashHeavySound ()
 
void SynchCrashHeavySound (bool play)
 
void PlayCrashHeavySound ()
 
void PlaySoundEx (string soundset, EffectSound sound, out bool soundbool)
 
void PlaySound (string soundset, ref EffectSound sound, out bool soundbool)
 
string GetAnimSourceFromSelection (string selection)
 
string GetDoorConditionPointFromSelection (string selection)
 
string GetDoorSelectionNameFromSeatPos (int posIdx)
 
string GetDoorInvSlotNameFromSeatPos (int posIdx)
 
int GetCrewIndex (string selection)
 
override bool CanReachSeatFromDoors (string pSeatSelection, vector pFromPos, float pDistance=1.0)
 
bool IsVitalCarBattery ()
 
bool IsVitalTruckBattery ()
 
bool IsVitalSparkPlug ()
 
bool IsVitalGlowPlug ()
 
bool IsVitalEngineBelt ()
 
bool IsVitalRadiator ()
 
bool IsVitalFuelTank ()
 
bool HasRadiator ()
 
EntityAI GetRadiator ()
 
bool IsMoving ()
 
bool IsHandbrakeActive ()
 
override int Get3rdPersonCameraType ()
 camera type
 
void SetEngineStarted (bool started)
 
int GetCarDoorsState (string slotType)
 
CarDoorState TranslateAnimationPhaseToCarDoorState (string animation)
 
string GetActionCompNameCoolant ()
 
float GetActionDistanceCoolant ()
 
string GetActionCompNameFuel ()
 
float GetActionDistanceFuel ()
 
string GetActionCompNameOil ()
 
float GetActionDistanceOil ()
 
string GetActionCompNameBrakes ()
 
float GetActionDistanceBrakes ()
 
void InitializeActions ()
 
override void GetActions (typename action_input_type, out array< ActionBase_Basic > actions)
 
void SetActions ()
 
void AddAction (typename actionName)
 
void RemoveAction (typename actionName)
 
override bool IsInventoryVisible ()
 
override void EEHealthLevelChanged (int oldLevel, int newLevel, string zone)
 
override void EEOnCECreate ()
 
void ForceUpdateLightsStart ()
 
void ForceUpdateLightsEnd ()
 
float GetBatteryConsumption ()
 
float GetBatteryRuntimeConsumption ()
 
float GetBatteryRechargeRate ()
 
ItemBase GetBattery ()
 
void SetCarHornState (int pState)
 
void GenerateCarHornAINoise (int pState)
 
override vector GetDefaultHitPosition ()
 
void SetEngineZoneReceivedHit (bool pState)
 
bool HasEngineZoneReceivedHit ()
 
float GetMomentum ()
 
float GetPushForceCoefficientMultiplier ()
 
void SpawnUniversalParts ()
 
void SpawnAdditionalItems ()
 
void FillUpCarFluids ()
 

Variables

enum CarDoorState NONE
 
enum CarDoorState LEFT
 
enum CarDoorState RIGHT
 
enum CarDoorState BRAKES_ONLY
 
enum CarDoorState REVERSE_ONLY
 
enum CarDoorState STARTING
 
enum CarDoorState START_OK
 
enum CarDoorState START_NO_FUEL
 
enum CarDoorState START_NO_BATTERY
 
enum CarDoorState START_NO_SPARKPLUG
 
enum CarDoorState STOP_OK
 
enum CarDoorState OFF = 0
 
enum CarDoorState SHORT = 1
 
enum CarDoorState LONG
 
enum CarDoorState typename
 
enum CarDoorState m_CarTypeActionsMap = new map<typename, ref TInputActionMap>
 
TInputActionMap m_InputActionMap
 
bool m_ActionsInitialize
 
float m_MomentumPrevTick
 
vector m_VelocityPrevTick
 
ref CarContactCache m_ContactCache
 
float m_Time
 
static float DROWN_ENGINE_THRESHOLD = 0.5
 
static float DROWN_ENGINE_DAMAGE = 350.0
 
static const string MEMORY_POINT_NAME_CAR_HORN = "pos_carHorn"
 
float m_FuelAmmount
 keeps ammount of each fluid
 
float m_CoolantAmmount
 
float m_OilAmmount
 
float m_BrakeAmmount
 
float m_dmgContactCoef = 0.058
 
float m_EnviroHeatComfortOverride
 
float m_DrownTime
 
static vector m_DrownEnginePos
 
float m_EngineHealth
 
float m_RadiatorHealth
 
float m_FuelTankHealth
 
float m_BatteryHealth
 
float m_PlugHealth
 
EntityAI m_Radiator
 
float m_BatteryConsume = 15
 
float m_BatteryContinuousConsume = 0.25
 
float m_BatteryRecharge = 0.15
 
float m_BatteryTimer = 0
 
const float BATTERY_UPDATE_DELAY = 100
 
float m_BatteryEnergyStartMin = 5.0
 
ref EffVehicleSmoke m_coolantFx
 Particles.
 
ref EffVehicleSmoke m_engineFx
 
ref EffVehicleSmoke m_exhaustFx
 
int m_enginePtcFx
 
int m_coolantPtcFx
 
int m_exhaustPtcFx
 
vector m_exhaustPtcPos
 
vector m_exhaustPtcDir
 
vector m_enginePtcPos
 
vector m_coolantPtcPos
 
vector m_fuelPos
 
vector m_enginePos
 
vector m_frontPos
 
vector m_backPos
 
vector m_side_1_1Pos
 
vector m_side_1_2Pos
 
vector m_side_2_1Pos
 
vector m_side_2_2Pos
 
string m_EngineStartOK = ""
 Sounds.
 
string m_EngineStartBattery = ""
 
string m_EngineStartPlug = ""
 
string m_EngineStartFuel = ""
 
string m_EngineStopFuel = ""
 
string m_CarDoorOpenSound = ""
 
string m_CarDoorCloseSound = ""
 
string m_CarSeatShiftInSound = ""
 
string m_CarSeatShiftOutSound = ""
 
string m_CarHornShortSoundName = ""
 
string m_CarHornLongSoundName = ""
 
ref EffectSound m_CrashSoundLight
 
ref EffectSound m_CrashSoundHeavy
 
ref EffectSound m_WindowSmall
 
ref EffectSound m_WindowLarge
 
ref EffectSound m_PreStartSound
 
ref EffectSound m_CarHornSoundEffect
 
ref NoiseParams m_NoisePar
 
NoiseSystem m_NoiseSystem
 
bool m_PlayCrashSoundLight
 
bool m_PlayCrashSoundHeavy
 
bool m_HeadlightsOn
 
bool m_HeadlightsState
 
bool m_BrakesArePressed
 
bool m_RearLightType
 
bool m_ForceUpdateLights
 
bool m_EngineStarted
 
bool m_EngineDestroyed
 
int m_CarHornState
 
CarLightBase m_Headlight
 
CarRearLightBase m_RearLight
 
static string m_ReverseLightPoint = "light_reverse"
 
static string m_LeftHeadlightPoint = "light_left"
 
static string m_RightHeadlightPoint = "light_right"
 
static string m_LeftHeadlightTargetPoint = "light_left_dir"
 
static string m_RightHeadlightTargetPoint = "light_right_dir"
 
static string m_DrownEnginePoint = "drown_engine"
 
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
 
bool m_EngineBeforeStart
 
bool m_EngineStartDoOnce
 
bool m_EngineZoneReceivedHit
 
ref set< intm_UnconsciousCrewMemberIndices
 
ref set< intm_DeadCrewMemberIndices
 

Enumeration Type Documentation

◆ CarDoorState

Enumerator
DOORS_MISSING 
DOORS_OPEN 
DOORS_CLOSED 

Definition at line 1 of file CarScript.c.

2{
6}
@ DOORS_CLOSED
Definition CarScript.c:5
@ DOORS_MISSING
Definition CarScript.c:3
@ DOORS_OPEN
Definition CarScript.c:4

Function Documentation

◆ AddAction()

void AddAction ( typename actionName )
protected

Definition at line 2323 of file CarScript.c.

2324 {
2325 ActionBase action = ActionManagerBase.GetAction(actionName);
2326
2327 if (!action)
2328 {
2329 Debug.LogError("Action " + actionName + " dosn't exist!");
2330 return;
2331 }
2332
2333 typename ai = action.GetInputType();
2334 if (!ai)
2335 {
2336 m_ActionsInitialize = false;
2337 return;
2338 }
2340
2341 if (!action_array)
2342 {
2345 }
2346
2348 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString(), "n/a", "Add action");
2349 action_array.Insert(action);
2350 }
TInputActionMap m_InputActionMap
Definition CarScript.c:138
bool m_ActionsInitialize
Definition CarScript.c:139
Definition Debug.c:14
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:341
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:143
static bool IsActionLogEnable()
Definition Debug.c:719

References Debug::ActionLog(), LogManager::IsActionLogEnable(), Debug::LogError(), m_ActionsInitialize, and m_InputActionMap.

◆ BrakeAndReverseRearLight()

void BrakeAndReverseRearLight ( )
protected

Definition at line 1839 of file CarScript.c.

1840 {
1841 m_RearLight.AggregateLight();
1842 m_RearLight.SetFadeOutTime(1);
1843 }
CarRearLightBase m_RearLight
Definition CarScript.c:246

References m_RearLight.

Referenced by UpdateLightsClient().

◆ BrakeLightsShineOff()

void BrakeLightsShineOff ( )
protected

Definition at line 1916 of file CarScript.c.

1917 {
1918 string material = ConfigGetString("brakeReflectorMatOff");
1919
1920 if (material)
1921 {
1922 SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_L, material);
1923 SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_R, material);
1924 }
1925 }
static const int SELECTION_ID_BRAKE_LIGHT_R
Definition CarScript.c:261
static const int SELECTION_ID_BRAKE_LIGHT_L
Definition CarScript.c:260

References SELECTION_ID_BRAKE_LIGHT_L, and SELECTION_ID_BRAKE_LIGHT_R.

Referenced by UpdateLightsServer().

◆ BrakeLightsShineOn()

void BrakeLightsShineOn ( )
protected

Definition at line 1905 of file CarScript.c.

1906 {
1907 string material = ConfigGetString("brakeReflectorMatOn");
1908
1909 if (material)
1910 {
1911 SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_L, material);
1912 SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_R, material);
1913 }
1914 }

References SELECTION_ID_BRAKE_LIGHT_L, and SELECTION_ID_BRAKE_LIGHT_R.

Referenced by UpdateLightsServer().

◆ BrakesRearLight()

void BrakesRearLight ( )
protected

Definition at line 1829 of file CarScript.c.

1830 {
1831 m_RearLight.SetAsSegregatedBrakeLight();
1832 }

References m_RearLight.

Referenced by UpdateLightsClient().

◆ CanManipulateSpareWheel()

bool CanManipulateSpareWheel ( string slotSelectionName)
protected

Definition at line 799 of file CarScript.c.

800 {
801 return false;
802 }

◆ CanReachSeatFromDoors()

override bool CanReachSeatFromDoors ( string pSeatSelection,
vector pFromPos,
float pDistance = 1.0 )
protected

skip the height for now

Definition at line 2147 of file CarScript.c.

2148 {
2150 if (conPointName.Length() > 0)
2151 {
2152 if (MemoryPointExists(conPointName))
2153 {
2154 vector conPointMS = GetMemoryPointPos(conPointName);
2155 vector conPointWS = ModelToWorld(conPointMS);
2156
2158 conPointWS[1] = 0;
2159 pFromPos[1] = 0;
2160
2162 return true;
2163 }
2164 }
2165
2166 return false;
2167 }
string GetDoorConditionPointFromSelection(string selection)
Definition CarScript.c:2111
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

References vector::Distance(), and CarScript::GetDoorConditionPointFromSelection().

◆ CanReceiveAttachment()

override bool CanReceiveAttachment ( EntityAI attachment,
int slotId )
protected

Definition at line 744 of file CarScript.c.

745 {
746 if (!super.CanReceiveAttachment(attachment, slotId))
747 return false;
748
750 attachment.GetInventory().GetCurrentInventoryLocation(attachmentInventoryLocation);
751 if (attachmentInventoryLocation.GetParent() == null)
752 return true;
753
754 if (attachment && attachment.Type().IsInherited(CarWheel))
755 {
756 string slotSelectionName;
758
759 switch (slotSelectionName)
760 {
761 case "wheel_spare_1":
762 case "wheel_spare_2":
764 break;
765 }
766 }
767
768 return true;
769 }
bool CanManipulateSpareWheel(string slotSelectionName)
Definition CarScript.c:799
InventoryLocation.
provides access to slot configuration
static proto bool GetSelectionForSlotId(int slot_Id, out string selection)

References CarScript::CanManipulateSpareWheel(), and InventorySlots::GetSelectionForSlotId().

◆ CanReleaseAttachment()

override bool CanReleaseAttachment ( EntityAI attachment)
protected

Definition at line 771 of file CarScript.c.

772 {
773 if (!super.CanReleaseAttachment(attachment))
774 return false;
775
776 if (EngineIsOn() && IsMoving())
777 return false;
778
779 if (attachment && attachment.Type().IsInherited(CarWheel))
780 {
782 attachment.GetInventory().GetCurrentInventoryLocation(attachmentInventoryLocation);
783
784 string slotSelectionName;
786
787 switch (slotSelectionName)
788 {
789 case "wheel_spare_1":
790 case "wheel_spare_2":
792 break;
793 }
794 }
795
796 return true;
797 }
bool IsMoving()
Definition CarScript.c:2214

References CarScript::CanManipulateSpareWheel(), InventorySlots::GetSelectionForSlotId(), and IsMoving().

◆ CarPartsHealthCheck()

void CarPartsHealthCheck ( )
protected

Definition at line 2027 of file CarScript.c.

2028 {
2029 if (GetGame().IsServer())
2030 {
2031 if (HasRadiator())
2032 m_RadiatorHealth = GetRadiator().GetHealth01("", "");
2033 else
2034 m_RadiatorHealth = 0;
2035
2036 m_EngineHealth = GetHealth01("Engine", "");
2037 m_FuelTankHealth = GetHealth01("FuelTank", "");
2038 }
2039 }
float m_FuelTankHealth
Definition CarScript.c:169
float m_EngineHealth
Definition CarScript.c:167
bool HasRadiator()
Definition CarScript.c:2204
EntityAI GetRadiator()
Definition CarScript.c:2209
float m_RadiatorHealth
Definition CarScript.c:168
proto native CGame GetGame()

References GetGame(), GetRadiator(), HasRadiator(), m_EngineHealth, m_FuelTankHealth, and m_RadiatorHealth.

Referenced by EOnPostSimulate().

◆ CarScript()

void CarScript ( )
protected

Definition at line 282 of file CarScript.c.

283 {
284#ifdef DEVELOPER
285 _car = this;
286#endif
287
288 SetEventMask(EntityEvent.POSTSIMULATE);
289
291
292 m_Time = 0;
293 // sets max health for all components at init
294 m_EngineHealth = 1;
296 m_RadiatorHealth = -1;
297 m_BatteryHealth = -1;
298 m_PlugHealth = -1;
299
300 m_enginePtcFx = -1;
301 m_coolantPtcFx = -1;
302 m_exhaustPtcFx = -1;
303
305
306 m_PlayCrashSoundLight = false;
307 m_PlayCrashSoundHeavy = false;
308
310
313
314 RegisterNetSyncVariableBool("m_HeadlightsOn");
315 RegisterNetSyncVariableBool("m_BrakesArePressed");
316 RegisterNetSyncVariableBool("m_ForceUpdateLights");
317 RegisterNetSyncVariableBool("m_EngineZoneReceivedHit");
318 RegisterNetSyncVariableBoolSignal("m_PlayCrashSoundLight");
319 RegisterNetSyncVariableBoolSignal("m_PlayCrashSoundHeavy");
320 RegisterNetSyncVariableInt("m_CarHornState", ECarHornState.OFF, ECarHornState.LONG);
321
322 if (MemoryPointExists("ptcExhaust_end"))
323 {
324 m_exhaustPtcPos = GetMemoryPointPos("ptcExhaust_end");
325 if (MemoryPointExists("ptcExhaust_start"))
326 {
327 vector exhaustStart = GetMemoryPointPos("ptcExhaust_start");
329
330 m_exhaustPtcDir[0] = -tempOri[2];
331 m_exhaustPtcDir[1] = tempOri[1];
332 m_exhaustPtcDir[2] = tempOri[0];
333
334 m_exhaustPtcDir = m_exhaustPtcDir.Normalized().VectorToAngles();
335 }
336 }
337 else
338 {
339 m_exhaustPtcPos = "0 0 0";
340 m_exhaustPtcDir = "1 1 1";
341 }
342
343 if (MemoryPointExists("ptcEnginePos"))
344 m_enginePtcPos = GetMemoryPointPos("ptcEnginePos");
345 else
346 m_enginePtcPos = "0 0 0";
347
348 if (MemoryPointExists("ptcCoolantPos"))
349 m_coolantPtcPos = GetMemoryPointPos("ptcCoolantPos");
350 else
351 m_coolantPtcPos = "0 0 0";
352
353 if (MemoryPointExists("refill"))
354 m_fuelPos = GetMemoryPointPos("refill");
355 else
356 m_fuelPos = "0 0 0";
357
358 if (MemoryPointExists("drown_engine"))
359 m_DrownEnginePos = GetMemoryPointPos("drown_engine");
360 else
361 m_DrownEnginePos = "0 0 0";
362
363 if (MemoryPointExists("dmgZone_engine"))
364 m_enginePos = GetMemoryPointPos("dmgZone_engine");
365 else
366 m_enginePos = "0 0 0";
367
368 if (MemoryPointExists("dmgZone_front"))
369 m_frontPos = GetMemoryPointPos("dmgZone_front");
370 else
371 m_frontPos = "0 0 0";
372
373 if (MemoryPointExists("dmgZone_back"))
374 m_backPos = GetMemoryPointPos("dmgZone_back");
375 else
376 m_backPos = "0 0 0";
377
378 if (MemoryPointExists("dmgZone_fender_1_1"))
379 m_side_1_1Pos = GetMemoryPointPos("dmgZone_fender_1_1");
380 else
381 m_side_1_1Pos = "0 0 0";
382
383 if (MemoryPointExists("dmgZone_fender_1_2"))
384 m_side_1_2Pos = GetMemoryPointPos("dmgZone_fender_1_2");
385 else
386 m_side_1_2Pos = "0 0 0";
387
388 if (MemoryPointExists("dmgZone_fender_2_1"))
389 m_side_2_1Pos = GetMemoryPointPos("dmgZone_fender_2_1");
390 else
391 m_side_2_1Pos = "0 0 0";
392
393 if (MemoryPointExists("dmgZone_fender_2_2"))
394 m_side_2_2Pos = GetMemoryPointPos("dmgZone_fender_2_2");
395 else
396 m_side_2_2Pos = "0 0 0";
397 }
ref set< int > m_DeadCrewMemberIndices
Definition CarScript.c:274
float m_Time
Definition CarScript.c:144
float m_BatteryHealth
Definition CarScript.c:170
vector m_exhaustPtcPos
Definition CarScript.c:191
int m_CarHornState
Definition CarScript.c:243
int m_coolantPtcFx
Definition CarScript.c:188
vector m_enginePos
Definition CarScript.c:198
vector m_backPos
Definition CarScript.c:200
int m_enginePtcFx
Definition CarScript.c:187
ref set< int > m_UnconsciousCrewMemberIndices
Definition CarScript.c:273
float m_EnviroHeatComfortOverride
Definition CarScript.c:160
vector m_fuelPos
Definition CarScript.c:196
bool m_PlayCrashSoundLight
Definition CarScript.c:231
int m_exhaustPtcFx
Definition CarScript.c:189
vector m_coolantPtcPos
Definition CarScript.c:194
vector m_frontPos
Definition CarScript.c:199
vector m_side_1_2Pos
Definition CarScript.c:202
vector m_enginePtcPos
Definition CarScript.c:193
vector m_exhaustPtcDir
Definition CarScript.c:192
vector m_side_1_1Pos
Definition CarScript.c:201
vector m_side_2_2Pos
Definition CarScript.c:204
float m_PlugHealth
Definition CarScript.c:171
vector m_side_2_1Pos
Definition CarScript.c:203
bool m_PlayCrashSoundHeavy
Definition CarScript.c:232
static vector m_DrownEnginePos
Definition CarScript.c:164
ref CarContactCache m_ContactCache
Definition CarScript.c:142
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
Definition EnConvert.c:220
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44

References vector::Direction(), m_backPos, m_BatteryHealth, m_CarHornState, m_ContactCache, m_coolantPtcFx, m_coolantPtcPos, m_DeadCrewMemberIndices, m_DrownEnginePos, m_EngineHealth, m_enginePos, m_enginePtcFx, m_enginePtcPos, m_EnviroHeatComfortOverride, m_exhaustPtcDir, m_exhaustPtcFx, m_exhaustPtcPos, m_frontPos, m_fuelPos, m_FuelTankHealth, m_PlayCrashSoundHeavy, m_PlayCrashSoundLight, m_PlugHealth, m_RadiatorHealth, m_side_1_1Pos, m_side_1_2Pos, m_side_2_1Pos, m_side_2_2Pos, m_Time, m_UnconsciousCrewMemberIndices, and vector::Normalized().

◆ CheckContactCache()

void CheckContactCache ( )
protected

Responsible for damaging the car according to contact events from OnContact.

Definition at line 1085 of file CarScript.c.

1086 {
1087
1088 int contactZonesCount = m_ContactCache.Count();
1089
1090 if (contactZonesCount == 0)
1091 return;
1092
1093
1094 for (int i = 0; i < contactZonesCount; ++i)
1095 {
1096 string zoneName = m_ContactCache.GetKey(i);
1098
1100 float crewDmgBase = Math.AbsInt((data[0].impulse / dBodyGetMass(this)) * 1000 * m_dmgContactCoef);// calculates damage as if the object's weight was 1000kg instead of its actual weight
1101
1102#ifdef DIAG_DEVELOPER
1103 CrashDebugData.m_CrashDataPoint = new CrashDebugData();
1104 CrashDebugData.m_CrashDataPoint.m_VehicleType = GetDisplayName();
1105 CrashDebugData.m_CrashDataPoint.m_Damage = dmg;
1106 CrashDebugData.m_CrashDataPoint.m_Zone = zoneName;
1107 CrashDebugData.m_CrashDataPoint.m_MomentumCurr = GetMomentum();
1108 CrashDebugData.m_CrashDataPoint.m_MomentumPrev = m_MomentumPrevTick;
1109 CrashDebugData.m_CrashDataPoint.m_MomentumDelta = data[0].impulse;
1110 CrashDebugData.m_CrashDataPoint.m_SpeedWorld = GetVelocity(this).Length() * 3.6;
1111 CrashDebugData.m_CrashDataPoint.m_SpeedWorldPrev = m_VelocityPrevTick.Length() * 3.6;
1112 CrashDebugData.m_CrashDataPoint.m_SpeedWorldDelta = (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6;
1113 CrashDebugData.m_CrashDataPoint.m_VelocityCur = GetVelocity(this);
1114 CrashDebugData.m_CrashDataPoint.m_VelocityPrev = m_VelocityPrevTick;
1115 CrashDebugData.m_CrashDataPoint.m_VelocityDot = vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized());
1116 CrashDebugData.m_CrashDataPoint.m_Time = GetGame().GetTime();
1117
1118
1119 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_CONSIDERED)
1120 {
1121 Debug.Log("--------------------------------------------------");
1122 Debug.Log("Vehicle:" + GetDisplayName());
1123 Debug.Log("DMG: " + dmg);
1124 Debug.Log("zoneName : " + zoneName);
1125 Debug.Log("momentumCurr : " + GetMomentum());
1126 Debug.Log("momentumPrev : " + m_MomentumPrevTick);
1127 Debug.Log("momentumDelta : " + data[0].impulse);
1128 Debug.Log("speed(km/h): " + GetVelocity(this).Length() * 3.6);
1129 Debug.Log("speedPrev(km/h): " + m_VelocityPrevTick.Length() * 3.6);
1130 Debug.Log("speedDelta(km/h) : " + (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6);
1131 Debug.Log("velocityCur.): " + GetVelocity(this));
1132 Debug.Log("velocityPrev.): " + m_VelocityPrevTick);
1133 Debug.Log("velocityDot): " + vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized()));
1134 Debug.Log("GetGame().GetTime(): " + GetGame().GetTime());
1135 Debug.Log("--------------------------------------------------");
1136 }
1137#endif
1139 continue;
1140
1141 int pddfFlags;
1142#ifdef DIAG_DEVELOPER
1143 CrashDebugData.m_CrashData.Insert(CrashDebugData.m_CrashDataPoint);
1144 CrashDebugData.m_CrashDataPoint.m_Speedometer = GetSpeedometer();
1145 //Print("Crash data recorded");
1146#endif
1148 {
1149#ifdef DIAG_DEVELOPER
1150 CrashDebugData.m_CrashDataPoint.m_DamageType = "Small";
1151 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1152 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is SMALL (threshold: %3), SPEEDOMETER: %4, TIME: %5", dmg, zoneName, GameConstants.CARS_CONTACT_DMG_MIN, GetSpeedometer(), GetGame().GetTime()));
1153#endif
1155 pddfFlags = ProcessDirectDamageFlags.NO_TRANSFER;
1156 }
1157 else
1158 {
1159#ifdef DIAG_DEVELOPER
1160 CrashDebugData.m_CrashDataPoint.m_DamageType = "Big";
1161 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1162 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is BIG (threshold: %3), SPEED: %4, TIME: %5", dmg, zoneName, GameConstants.CARS_CONTACT_DMG_THRESHOLD, GetSpeedometer(), GetGame().GetTime()));
1163#endif
1166 pddfFlags = 0;
1167 }
1168
1169#ifdef DEVELOPER
1170 m_DebugContactDamageMessage += string.Format("%1: %2\n", zoneName, dmg);
1171#endif
1172
1173 ProcessDirectDamage(DT_CUSTOM, null, zoneName, "EnviroDmg", "0 0 0", dmg, pddfFlags);
1174 }
1175
1177 UpdateLights();
1178
1179 m_ContactCache.Clear();
1180
1181 }
vector m_VelocityPrevTick
Definition CarScript.c:141
void DamageCrew(float dmg)
Responsible for damaging crew in a car crash.
Definition CarScript.c:1184
float m_MomentumPrevTick
Definition CarScript.c:140
void UpdateLights(int new_gear=-1)
Definition CarScript.c:1597
float GetMomentum()
Definition CarScript.c:2494
void SynchCrashHeavySound(bool play)
Definition CarScript.c:2065
void UpdateHeadlightState()
Definition CarScript.c:680
float m_dmgContactCoef
Definition CarScript.c:159
void SynchCrashLightSound(bool play)
Definition CarScript.c:2046
float GetTime()
ProcessDirectDamageFlags
Definition Object.c:2
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
Definition EnMath.c:7
proto native float Length()
Returns length of vector (magnitude)
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
const float CARS_CONTACT_DMG_THRESHOLD
Definition constants.c:747
const float CARS_CONTACT_DMG_MIN
Definition constants.c:748
static proto int AbsInt(int i)
Returns absolute value.
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto native float dBodyGetMass(notnull IEntity ent)

References Math::AbsInt(), GameConstants::CARS_CONTACT_DMG_MIN, GameConstants::CARS_CONTACT_DMG_THRESHOLD, DamageCrew(), dBodyGetMass(), vector::Dot(), GetGame(), GetMomentum(), GetTime(), GetVelocity(), vector::Length(), Debug::Log(), m_ContactCache, m_dmgContactCoef, m_MomentumPrevTick, m_VelocityPrevTick, vector::Normalized(), SynchCrashHeavySound(), SynchCrashLightSound(), UpdateHeadlightState(), and UpdateLights().

Referenced by EOnPostSimulate().

◆ CheckVitalItem()

void CheckVitalItem ( bool isVital,
string itemName )
protected

Definition at line 1991 of file CarScript.c.

1992 {
1993 if (!isVital)
1994 return;
1995
1996 EntityAI item = FindAttachmentBySlotName(itemName);
1997
1998 if (!item)
1999 EngineStop();
2000 else if (item.IsRuined())
2001 EngineStop();
2002 }

Referenced by EOnPostSimulate().

◆ CleanupEffects()

void CleanupEffects ( )
protected

Definition at line 514 of file CarScript.c.

515 {
519
520 if (m_Headlight)
521 m_Headlight.Destroy();
522
523 if (m_RearLight)
524 m_RearLight.Destroy();
525
531 }
ref EffVehicleSmoke m_coolantFx
Particles.
Definition CarScript.c:183
ref EffectSound m_WindowLarge
Definition CarScript.c:224
void CleanupSound(EffectSound sound)
Definition CarScript.c:533
ref EffectSound m_WindowSmall
Definition CarScript.c:223
ref EffVehicleSmoke m_engineFx
Definition CarScript.c:184
ref EffectSound m_CrashSoundHeavy
Definition CarScript.c:222
ref EffVehicleSmoke m_exhaustFx
Definition CarScript.c:185
ref EffectSound m_CrashSoundLight
Definition CarScript.c:221
ref EffectSound m_CarHornSoundEffect
Definition CarScript.c:227
CarLightBase m_Headlight
Definition CarScript.c:245
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.

References CleanupSound(), SEffectManager::DestroyEffect(), m_CarHornSoundEffect, m_coolantFx, m_CrashSoundHeavy, m_CrashSoundLight, m_engineFx, m_exhaustFx, m_Headlight, m_RearLight, m_WindowLarge, and m_WindowSmall.

Referenced by EEDelete(), and ~CarScript().

◆ CleanupSound()

void CleanupSound ( EffectSound sound)
protected

Definition at line 533 of file CarScript.c.

534 {
536 }

References SEffectManager::DestroyEffect().

Referenced by CleanupEffects(), and HandleCarHornSound().

◆ CreateCarDestroyedEffect()

void CreateCarDestroyedEffect ( )
protected

Definition at line 630 of file CarScript.c.

631 {
632 if (!SEffectManager.IsEffectExist(m_enginePtcFx) && GetGame().GetWaterDepth(GetEnginePosWS()) <= 0)
633 {
635 m_engineFx.SetParticleStateHeavy();
637 }
638 }
vector GetEnginePosWS()
Definition CarScript.c:440
static int PlayOnObject(notnull Effect eff, Object obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_relative_to_world=false)
Play an Effect.
static bool IsEffectExist(int effect_id)
Checks whether an Effect ID is registered in SEffectManager.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

References GetEnginePosWS(), GetGame(), SEffectManager::IsEffectExist(), m_engineFx, m_enginePtcFx, m_enginePtcPos, SEffectManager::PlayOnObject(), and Vector().

Referenced by EEHealthLevelChanged().

◆ CreateFrontLight()

CarLightBase CreateFrontLight ( )
protected

Definition at line 1986 of file CarScript.c.

1987 {
1988 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
1989 }

◆ CreateRearLight()

CarRearLightBase CreateRearLight ( )
protected

Definition at line 1980 of file CarScript.c.

1981 {
1982 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
1983 }

◆ DamageCrew()

void DamageCrew ( float dmg)
protected

Responsible for damaging crew in a car crash.

Definition at line 1184 of file CarScript.c.

1185 {
1186 for (int c = 0; c < CrewSize(); ++c)
1187 {
1188 Human crew = CrewMember(c);
1189 if (!crew)
1190 continue;
1191
1193 if (Class.CastTo(player, crew))
1194 {
1196 {
1197#ifdef DIAG_DEVELOPER
1198 CrashDebugData.m_CrashDataPoint.m_CrewDamageBase = dmg;
1199 CrashDebugData.m_CrashDataPoint.m_DMGHealth = -100;
1200 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1201 {
1202 Debug.Log("--------------------------------------------------");
1203 Debug.Log("Killing the player");
1204 Debug.Log("Crew DMG Base: " + dmg);
1205 Debug.Log("--------------------------------------------------");
1206
1207 }
1208#endif
1209 player.SetHealth(0.0);
1210 }
1211 else
1212 {
1214 shockTemp = Math.Clamp(shockTemp, 0, 1);
1215 float shock = Math.Lerp(50, 150, shockTemp);
1216 float hp = Math.Lerp(2, 100, shockTemp);
1217
1218#ifdef DIAG_DEVELOPER
1219 CrashDebugData.m_CrashDataPoint.m_CrewDamageBase = dmg;
1220 CrashDebugData.m_CrashDataPoint.m_ShockTemp = shockTemp;
1221 CrashDebugData.m_CrashDataPoint.m_DMGHealth = hp;
1222 CrashDebugData.m_CrashDataPoint.m_DMGShock = shock;
1223 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1224 {
1225 Debug.Log("--------------------------------------------------");
1226 Debug.Log("Crew DMG Base: " + dmg);
1227 Debug.Log("Crew shockTemp: " + shockTemp);
1228 Debug.Log("Crew DMG Health: " + hp);
1229 Debug.Log("Crew DMG Shock: " + shock);
1230 Debug.Log("--------------------------------------------------");
1231 }
1232#endif
1233
1234 player.AddHealth("", "Shock", -shock);
1235 player.AddHealth("", "Health", -hp);
1236 }
1237 }
1238 }
1239 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float CARS_CONTACT_DMG_KILLCREW
Definition constants.c:749
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...

References GameConstants::CARS_CONTACT_DMG_KILLCREW, GameConstants::CARS_CONTACT_DMG_THRESHOLD, Class::CastTo(), Math::Clamp(), Math::InverseLerp(), Math::Lerp(), and Debug::Log().

Referenced by CheckContactCache().

◆ DashboardShineOff()

void DashboardShineOff ( )
protected

Definition at line 1971 of file CarScript.c.

1972 {
1973 string material = ConfigGetString("dashboardMatOff");
1974
1975 if (material)
1976 SetObjectMaterial(SELECTION_ID_DASHBOARD_LIGHT, material);
1977 }
static const int SELECTION_ID_DASHBOARD_LIGHT
Definition CarScript.c:266

References SELECTION_ID_DASHBOARD_LIGHT.

Referenced by UpdateLightsServer().

◆ DashboardShineOn()

void DashboardShineOn ( )
protected

Definition at line 1963 of file CarScript.c.

1964 {
1965 string material = ConfigGetString("dashboardMatOn");
1966
1967 if (material)
1968 SetObjectMaterial(SELECTION_ID_DASHBOARD_LIGHT, material);
1969 }

References SELECTION_ID_DASHBOARD_LIGHT.

Referenced by UpdateLightsServer().

◆ EEDelete()

override void EEDelete ( EntityAI parent)
protected

Definition at line 500 of file CarScript.c.

501 {
502#ifndef SERVER
504#endif
505 }
void CleanupEffects()
Definition CarScript.c:514

References CleanupEffects().

◆ EEHealthLevelChanged()

override void EEHealthLevelChanged ( int oldLevel,
int newLevel,
string zone )
protected

Definition at line 2368 of file CarScript.c.

2369 {
2370 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
2371
2373 {
2374 bool dummy;
2375 switch (zone)
2376 {
2377 case "WindowLR":
2378 case "WindowRR":
2379 if (m_Initialized)
2380 PlaySoundEx("offroad_hit_window_small_SoundSet", m_WindowSmall, dummy);
2381 break;
2382
2383 case "WindowFront":
2384 case "WindowBack":
2385 case "WindowFrontLeft":
2386 case "WindowFrontRight":
2387 if (m_Initialized)
2388 PlaySoundEx("offroad_hit_window_large_SoundSet", m_WindowLarge, dummy);
2389 break;
2390
2391 case "Engine":
2392#ifndef SERVER
2394#endif
2395 break;
2396 }
2397 }
2398 }
void CreateCarDestroyedEffect()
Definition CarScript.c:630
void PlaySoundEx(string soundset, EffectSound sound, out bool soundbool)
Definition CarScript.c:2079
bool m_Initialized
const int STATE_RUINED
Definition constants.c:757

References CreateCarDestroyedEffect(), m_Initialized, m_WindowLarge, m_WindowSmall, PlaySoundEx(), and GameConstants::STATE_RUINED.

◆ EEHitBy()

override void EEHitBy ( TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo,
vector modelPos,
float speedCoef )
protected

Definition at line 490 of file CarScript.c.

491 {
493
495 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(ForceUpdateLightsEnd, 100, false);
496
498 }
void SetEngineZoneReceivedHit(bool pState)
Definition CarScript.c:2483
void ForceUpdateLightsStart()
Definition CarScript.c:2409
void ForceUpdateLightsEnd()
Definition CarScript.c:2418
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10

References CALL_CATEGORY_GAMEPLAY, component, ForceUpdateLightsEnd(), ForceUpdateLightsStart(), GetGame(), and SetEngineZoneReceivedHit().

◆ EEInit()

override void EEInit ( )
protected

Definition at line 399 of file CarScript.c.

400 {
401 super.EEInit();
402
403 if (GetGame().IsServer())
404 {
405 m_NoiseSystem = GetGame().GetNoiseSystem();
407 {
408 m_NoisePar = new NoiseParams();
409 m_NoisePar.LoadFromPath("cfgVehicles " + GetType() + " NoiseCarHorn");
410 }
411 }
412 }
eBleedingSourceType GetType()
ref NoiseParams m_NoisePar
Definition CarScript.c:228
NoiseSystem m_NoiseSystem
Definition CarScript.c:229
class NoiseSystem NoiseParams()
Definition Noise.c:15

References GetGame(), GetType(), m_NoisePar, m_NoiseSystem, and NoiseParams().

◆ EEItemAttached()

override void EEItemAttached ( EntityAI item,
string slot_name )
protected

Definition at line 640 of file CarScript.c.

641 {
642 super.EEItemAttached(item, slot_name);
643
644 switch (slot_name)
645 {
646 case "Reflector_1_1":
647 if (GetGame().IsServer())
648 SetHealth("Reflector_1_1", "Health", item.GetHealth());
649 break;
650 case "Reflector_2_1":
651 if (GetGame().IsServer())
652 SetHealth("Reflector_2_1", "Health", item.GetHealth());
653 break;
654 case "CarBattery":
655 case "TruckBattery":
656 if (GetGame().IsServer())
657 m_BatteryHealth = item.GetHealth01();
658 break;
659 case "SparkPlug":
660 case "GlowPlug":
661 if (GetGame().IsServer())
662 m_PlugHealth = item.GetHealth01();
663 break;
664 case "CarRadiator":
665 if (GetGame().IsServer())
666 m_RadiatorHealth = item.GetHealth01();
667
669 break;
670 }
671
672 if (GetGame().IsServer())
673 Synchronize();
674
676 UpdateLights();
677 }
EntityAI m_Radiator
Definition CarScript.c:173
void Synchronize()

References GetGame(), m_BatteryHealth, m_PlugHealth, m_Radiator, m_RadiatorHealth, Synchronize(), UpdateHeadlightState(), and UpdateLights().

◆ EEItemDetached()

override void EEItemDetached ( EntityAI item,
string slot_name )
protected

Definition at line 695 of file CarScript.c.

696 {
697 switch (slot_name)
698 {
699 case "CarBattery":
700 case "TruckBattery":
701 m_BatteryHealth = -1;
702 if (GetGame().IsServer())
703 {
704 if (EngineIsOn())
705 EngineStop();
706
707 if (IsScriptedLightsOn())
709 }
710 break;
711 case "SparkPlug":
712 case "GlowPlug":
713 m_PlugHealth = -1;
714 if (GetGame().IsServer() && EngineIsOn())
715 EngineStop();
716 break;
717 case "CarRadiator":
719 if (GetGame().IsServer())
720 {
721 LeakAll(CarFluid.COOLANT);
722
723 if (m_DamageZoneMap.Contains("Radiator"))
724 SetHealth("Radiator", "Health", 0);
725 }
726 break;
727 }
728
729 if (GetGame().IsServer())
730 Synchronize();
731
733 UpdateLights();
734 }
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
void ToggleHeadlights()
Switches headlights on/off, including the illumination of the control panel and synchronizes this cha...
Definition CarScript.c:1591
bool IsScriptedLightsOn()
Propper way to get if light is swiched on. Use instead of IsLightsOn().
Definition CarScript.c:1585

References GetGame(), IsScriptedLightsOn(), m_BatteryHealth, m_PlugHealth, m_Radiator, Synchronize(), ToggleHeadlights(), UpdateHeadlightState(), and UpdateLights().

◆ EEKilled()

override void EEKilled ( Object killer)
protected

Definition at line 1051 of file CarScript.c.

1052 {
1053 super.EEKilled(killer);
1054 m_EngineDestroyed = true;
1055 }
bool m_EngineDestroyed
Definition CarScript.c:241

References m_EngineDestroyed.

◆ EEOnCECreate()

override void EEOnCECreate ( )
protected

Definition at line 2400 of file CarScript.c.

2401 {
2402
2403 float maxVolume = GetFluidCapacity(CarFluid.FUEL);
2404 float amount = Math.RandomFloat(0.0, maxVolume * 0.35);
2405
2406 Fill(CarFluid.FUEL, amount);
2407 }
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].

References Math::RandomFloat().

◆ EOnPostSimulate()

override void EOnPostSimulate ( IEntity other,
float timeSlice )
protected

actions runned when the engine on

leaking of coolant from radiator when damaged

Definition at line 804 of file CarScript.c.

805 {
806 m_Time += timeSlice;
807
808 if (GetGame().IsServer())
809 {
812
813#ifdef DIAG_DEVELOPER
815 {
816 if (m_ContactCalled)
817 {
818 Debug.Log("Momentum delta: " + (GetMomentum() - m_MomentumPrevTick));
819 Debug.Log("--------------------------------------------------------------------");
820 m_ContactCalled = false;
821 }
822 }
823#endif
824
825
829#ifdef DEVELOPER
832 {
835 }
836#endif
837 }
838
840 {
841 m_Time = 0;
842
844
845 //First of all check if the car should stop the engine
846 if (GetGame().IsServer() && EngineIsOn())
847 {
848 if (GetFluidFraction(CarFluid.FUEL) <= 0 || m_EngineHealth <= 0)
849 EngineStop();
850
851 CheckVitalItem(IsVitalCarBattery(), "CarBattery");
852 CheckVitalItem(IsVitalTruckBattery(), "TruckBattery");
853 CheckVitalItem(IsVitalSparkPlug(), "SparkPlug");
854 CheckVitalItem(IsVitalGlowPlug(), "GlowPlug");
855 }
856
857 if (GetGame().IsServer())
858 {
859 if (IsVitalFuelTank())
860 {
862 SetHealth("Engine", "Health", GameConstants.DAMAGE_RUINED_VALUE);
863 }
864 }
865
867 if (EngineIsOn())
868 {
869 if (GetGame().IsServer())
870 {
871 float dmg;
872
873 if (EngineGetRPM() >= EngineGetRPMRedline())
874 {
875 if (EngineGetRPM() > EngineGetRPMMax())
876 AddHealth("Engine", "Health", -GetMaxHealth("Engine", "") * 0.05); //CAR_RPM_DMG
877
878 dmg = EngineGetRPM() * 0.001 * Math.RandomFloat(0.02, 1.0); //CARS_TICK_DMG_MIN; //CARS_TICK_DMG_MAX
879 ProcessDirectDamage(DamageType.CUSTOM, null, "Engine", "EnviroDmg", vector.Zero, dmg);
881 }
882 else
884
886 if (IsVitalRadiator())
887 {
888 if (GetFluidFraction(CarFluid.COOLANT) > 0 && m_RadiatorHealth < 0.5) //CARS_LEAK_THRESHOLD
889 LeakFluid(CarFluid.COOLANT);
890 }
891
892 if (GetFluidFraction(CarFluid.FUEL) > 0 && m_FuelTankHealth < GameConstants.DAMAGE_DAMAGED_VALUE)
893 LeakFluid(CarFluid.FUEL);
894
895 if (GetFluidFraction(CarFluid.BRAKE) > 0 && m_EngineHealth < GameConstants.DAMAGE_DAMAGED_VALUE)
896 LeakFluid(CarFluid.BRAKE);
897
898 if (GetFluidFraction(CarFluid.OIL) > 0 && m_EngineHealth < GameConstants.DAMAGE_DAMAGED_VALUE)
899 LeakFluid(CarFluid.OIL);
900
901 if (m_EngineHealth < 0.25)
902 LeakFluid(CarFluid.OIL);
903
904 if (IsVitalRadiator())
905 {
906 if (GetFluidFraction(CarFluid.COOLANT) < 0.5 && GetFluidFraction(CarFluid.COOLANT) >= 0)
907 {
908 dmg = (1 - GetFluidFraction(CarFluid.COOLANT)) * Math.RandomFloat(0.02, 10.00); //CARS_DMG_TICK_MIN_COOLANT; //CARS_DMG_TICK_MAX_COOLANT
909 AddHealth("Engine", "Health", -dmg);
911 }
912 }
913 }
914
915 //FX only on Client and in Single
916 if (!GetGame().IsDedicatedServer())
917 {
919 {
922 m_exhaustFx.SetParticleStateLight();
923 }
924
925 if (IsVitalRadiator() && GetFluidFraction(CarFluid.COOLANT) < 0.5)
926 {
928 {
931 }
932
933 if (m_coolantFx)
934 {
935 if (GetFluidFraction(CarFluid.COOLANT) > 0)
936 m_coolantFx.SetParticleStateLight();
937 else
938 m_coolantFx.SetParticleStateHeavy();
939 }
940 }
941 else
942 {
945 }
946 }
947 }
948 else
949 {
950 //FX only on Client and in Single
951 if (!GetGame().IsDedicatedServer())
952 {
954 {
956 m_exhaustPtcFx = -1;
957 }
958
960 {
962 m_coolantPtcFx = -1;
963 }
964 }
965 }
966 }
967 }
bool IsVitalGlowPlug()
Definition CarScript.c:2184
void CheckVitalItem(bool isVital, string itemName)
Definition CarScript.c:1991
void CheckContactCache()
Responsible for damaging the car according to contact events from OnContact.
Definition CarScript.c:1085
override void HandleByCrewMemberState(ECrewMemberState state)
Definition CarScript.c:1415
void LeakFluid(CarFluid fluid)
Definition CarScript.c:2004
bool IsVitalRadiator()
Definition CarScript.c:2194
bool IsVitalCarBattery()
Definition CarScript.c:2169
bool IsVitalSparkPlug()
Definition CarScript.c:2179
bool IsVitalTruckBattery()
Definition CarScript.c:2174
void CarPartsHealthCheck()
Definition CarScript.c:2027
bool IsVitalFuelTank()
Definition CarScript.c:2199
DamageType
exposed from C++ (do not change)
ECrewMemberState
static void Stop(int effect_id)
Stops the Effect.
static const vector Zero
Definition EnConvert.c:110
const int CARS_FLUIDS_TICK
Definition constants.c:736
const float DAMAGE_RUINED_VALUE
Definition constants.c:773
const float DAMAGE_DAMAGED_VALUE
Definition constants.c:771

References CarPartsHealthCheck(), GameConstants::CARS_FLUIDS_TICK, CheckContactCache(), CheckVitalItem(), GameConstants::DAMAGE_DAMAGED_VALUE, GameConstants::DAMAGE_RUINED_VALUE, GetGame(), GetMomentum(), GetVelocity(), HandleByCrewMemberState(), SEffectManager::IsEffectExist(), CarScript::IsVitalCarBattery(), IsVitalFuelTank(), CarScript::IsVitalGlowPlug(), CarScript::IsVitalRadiator(), CarScript::IsVitalSparkPlug(), CarScript::IsVitalTruckBattery(), LeakFluid(), Debug::Log(), m_coolantFx, m_coolantPtcFx, m_coolantPtcPos, m_EngineHealth, m_exhaustFx, m_exhaustPtcDir, m_exhaustPtcFx, m_exhaustPtcPos, m_FuelTankHealth, m_MomentumPrevTick, m_RadiatorHealth, m_Time, m_VelocityPrevTick, SEffectManager::PlayOnObject(), Math::RandomFloat(), SetEngineZoneReceivedHit(), SEffectManager::Stop(), and vector::Zero.

◆ FillUpCarFluids()

void FillUpCarFluids ( )
protected

Definition at line 2578 of file CarScript.c.

2579 {
2580 Fill(CarFluid.FUEL, 200.0);
2581 Fill(CarFluid.COOLANT, 200.0);
2582 Fill(CarFluid.OIL, 200.0);
2583 }

Referenced by CarScript::OnDebugSpawn(), CivilianSedan::OnDebugSpawn(), Hatchback_02::OnDebugSpawn(), Sedan_02::OnDebugSpawn(), and Truck_01_Covered::OnDebugSpawn().

◆ ForceUpdateLightsEnd()

void ForceUpdateLightsEnd ( )
protected

Definition at line 2418 of file CarScript.c.

2419 {
2421 {
2422 m_ForceUpdateLights = false;
2423 SetSynchDirty();
2424 }
2425 }
bool m_ForceUpdateLights
Definition CarScript.c:239

References m_ForceUpdateLights.

Referenced by EEHitBy().

◆ ForceUpdateLightsStart()

void ForceUpdateLightsStart ( )
protected

Definition at line 2409 of file CarScript.c.

2410 {
2412 {
2413 m_ForceUpdateLights = true;
2414 SetSynchDirty();
2415 }
2416 }

References m_ForceUpdateLights.

Referenced by EEHitBy().

◆ GenerateCarHornAINoise()

void GenerateCarHornAINoise ( int pState)
protected

Definition at line 2463 of file CarScript.c.

2464 {
2465 if (pState != ECarHornState.OFF)
2466 {
2468 {
2469 float noiseMultiplier = 1.0;
2470 if (pState == ECarHornState.LONG)
2471 noiseMultiplier = 2.0;
2472
2474 }
2475 }
2476 }
class JsonUndergroundAreaTriggerData GetPosition
proto void AddNoiseTarget(vector pos, float lifetime, NoiseParams noise_params, float external_strength_multiplier=1.0)
Will make a noise at that position which the AI will "see" for the duration of 'lifetime'.

References NoiseSystem::AddNoiseTarget(), GetPosition, m_NoisePar, and m_NoiseSystem.

Referenced by SetCarHornState().

◆ Get3rdPersonCameraType()

override int Get3rdPersonCameraType ( )
protected

camera type

Definition at line 2225 of file CarScript.c.

2226 {
2228
2229 }
static const int DAYZCAMERA_3RD_VEHICLE
generic vehicle 3rd person

References DayZPlayerCameras::DAYZCAMERA_3RD_VEHICLE.

◆ Get_1_1PointPosWS()

vector Get_1_1PointPosWS ( )
protected

Definition at line 467 of file CarScript.c.

468 {
469 return ModelToWorld(m_side_1_1Pos);
470 }

References m_side_1_1Pos.

◆ Get_1_2PointPosWS()

vector Get_1_2PointPosWS ( )
protected

Definition at line 471 of file CarScript.c.

472 {
473 return ModelToWorld(m_side_1_2Pos);
474 }

References m_side_1_2Pos.

◆ Get_2_1PointPosWS()

vector Get_2_1PointPosWS ( )
protected

Definition at line 475 of file CarScript.c.

476 {
477 return ModelToWorld(m_side_2_1Pos);
478 }

References m_side_2_1Pos.

◆ Get_2_2PointPosWS()

vector Get_2_2PointPosWS ( )
protected

Definition at line 479 of file CarScript.c.

480 {
481 return ModelToWorld(m_side_2_2Pos);
482 }

References m_side_2_2Pos.

◆ GetActionCompNameBrakes()

string GetActionCompNameBrakes ( )
protected

Definition at line 2279 of file CarScript.c.

2280 {
2281 return "carradiator";
2282 }

◆ GetActionCompNameCoolant()

string GetActionCompNameCoolant ( )
protected

Definition at line 2249 of file CarScript.c.

2250 {
2251 return "radiator";
2252 }

◆ GetActionCompNameFuel()

string GetActionCompNameFuel ( )
protected

Definition at line 2259 of file CarScript.c.

2260 {
2261 return "refill";
2262 }

◆ GetActionCompNameOil()

string GetActionCompNameOil ( )
protected

Definition at line 2269 of file CarScript.c.

2270 {
2271 return "carradiator";
2272 }

◆ GetActionDistanceBrakes()

float GetActionDistanceBrakes ( )
protected

Definition at line 2284 of file CarScript.c.

2285 {
2286 return 2.0;
2287 }

◆ GetActionDistanceCoolant()

float GetActionDistanceCoolant ( )
protected

Definition at line 2254 of file CarScript.c.

2255 {
2256 return 2.0;
2257 }

◆ GetActionDistanceFuel()

float GetActionDistanceFuel ( )
protected

Definition at line 2264 of file CarScript.c.

2265 {
2266 return 1.5;
2267 }

◆ GetActionDistanceOil()

float GetActionDistanceOil ( )
protected

Definition at line 2274 of file CarScript.c.

2275 {
2276 return 2.0;
2277 }

◆ GetActions()

override void GetActions ( typename action_input_type ,
out array< ActionBase_Basic > actions )
protected

Definition at line 2301 of file CarScript.c.

2302 {
2304 {
2305 m_ActionsInitialize = true;
2307 }
2308
2310 }
void InitializeActions()
Definition CarScript.c:2289

References InitializeActions(), m_ActionsInitialize, and m_InputActionMap.

◆ GetAnimSourceFromSelection()

string GetAnimSourceFromSelection ( string selection)
protected

Definition at line 2106 of file CarScript.c.

2107 {
2108 return "";
2109 }

◆ GetBackPointPosWS()

vector GetBackPointPosWS ( )
protected

Definition at line 463 of file CarScript.c.

464 {
465 return ModelToWorld(m_backPos);
466 }

References m_backPos.

◆ GetBattery()

ItemBase GetBattery ( )
protected

Definition at line 2443 of file CarScript.c.

2444 {
2445 if (IsVitalCarBattery())
2446 return ItemBase.Cast(FindAttachmentBySlotName("CarBattery"));
2447 else if (IsVitalTruckBattery())
2448 return ItemBase.Cast(FindAttachmentBySlotName("TruckBattery"));
2449
2450 return null;
2451 }

References CarScript::IsVitalCarBattery(), and CarScript::IsVitalTruckBattery().

Referenced by OnBeforeEngineStart(), OnEngineStart(), and OnUpdate().

◆ GetBatteryConsumption()

float GetBatteryConsumption ( )
protected

Definition at line 2428 of file CarScript.c.

2429 {
2430 return m_BatteryConsume;
2431 }
float m_BatteryConsume
Definition CarScript.c:175

References m_BatteryConsume.

Referenced by OnEngineStart().

◆ GetBatteryRechargeRate()

float GetBatteryRechargeRate ( )
protected

Definition at line 2438 of file CarScript.c.

2439 {
2440 return -m_BatteryRecharge;
2441 }
float m_BatteryRecharge
Definition CarScript.c:177

References m_BatteryRecharge.

Referenced by OnUpdate().

◆ GetBatteryRuntimeConsumption()

float GetBatteryRuntimeConsumption ( )
protected

Definition at line 2433 of file CarScript.c.

2434 {
2436 }
float m_BatteryContinuousConsume
Definition CarScript.c:176

References m_BatteryContinuousConsume.

Referenced by OnUpdate().

◆ GetCarDoorsState()

int GetCarDoorsState ( string slotType)
protected

Definition at line 2236 of file CarScript.c.

2237 {
2238 return -1;
2239 }

Referenced by CarScript::CrewCanGetThrough(), and CarScript::OnSound().

◆ GetCoolantPtcPosWS()

vector GetCoolantPtcPosWS ( )
protected

Definition at line 445 of file CarScript.c.

446 {
447 return ModelToWorld(m_coolantPtcPos);
448 }

References m_coolantPtcPos.

◆ GetCrashHeavySound()

bool GetCrashHeavySound ( )
protected

Definition at line 2060 of file CarScript.c.

2061 {
2062 return m_PlayCrashSoundHeavy;
2063 }

References m_PlayCrashSoundHeavy.

Referenced by OnVariablesSynchronized().

◆ GetCrashLightSound()

bool GetCrashLightSound ( )
protected

Definition at line 2041 of file CarScript.c.

2042 {
2043 return m_PlayCrashSoundLight;
2044 }

References m_PlayCrashSoundLight.

Referenced by OnVariablesSynchronized().

◆ GetCrewIndex()

int GetCrewIndex ( string selection)
protected

Definition at line 2142 of file CarScript.c.

2143 {
2144 return -1;
2145 }

◆ GetDebugActions()

override void GetDebugActions ( out TSelectableActionInfoArrayEx outputList)
protected

Definition at line 538 of file CarScript.c.

539 {
540 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_HORN_START_SHORT, "Car Horn Start Short", FadeColors.LIGHT_GREY));
541 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_HORN_START_LONG, "Car Horn Start Long", FadeColors.LIGHT_GREY));
542 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_HORN_STOP, "Car Horn Stop", FadeColors.LIGHT_GREY));
543
544 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "Car Fuel", FadeColors.RED));
545 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_FUEL_FULL, "Full", FadeColors.LIGHT_GREY));
546 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_FUEL_EMPTY, "Empty", FadeColors.LIGHT_GREY));
547 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_FUEL_INCREASE, "10% increase", FadeColors.LIGHT_GREY));
548 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_FUEL_DECREASE, "10% decrease", FadeColors.LIGHT_GREY));
549 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
550 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "Car Cooler", FadeColors.RED));
551 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_COOLANT_FULL, "Full", FadeColors.LIGHT_GREY));
552 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_COOLANT_EMPTY, "Empty", FadeColors.LIGHT_GREY));
553 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_COOLANT_INCREASE, "10% increase", FadeColors.LIGHT_GREY));
554 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.CAR_COOLANT_DECREASE, "10% decrease", FadeColors.LIGHT_GREY));
555 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
556
557 super.GetDebugActions(outputList);
558
559 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
561 }
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
EActions
Definition EActions.c:2
const int SAT_DEBUG_ACTION
Definition constants.c:424

References SAT_DEBUG_ACTION.

◆ GetDefaultHitPosition()

override vector GetDefaultHitPosition ( )
protected

Definition at line 2478 of file CarScript.c.

2479 {
2480 return vector.Zero;
2481 }

References vector::Zero.

◆ GetDoorConditionPointFromSelection()

string GetDoorConditionPointFromSelection ( string selection)
protected

Definition at line 2111 of file CarScript.c.

2112 {
2113 switch (selection)
2114 {
2115 case "seat_driver":
2116 return "seat_con_1_1";
2117 break;
2118 case "seat_codriver":
2119 return "seat_con_2_1";
2120 break;
2121 case "seat_cargo1":
2122 return "seat_con_1_2";
2123 break;
2124 case "seat_cargo2":
2125 return "seat_con_2_2";
2126 break;
2127 }
2128
2129 return "";
2130 }

◆ GetDoorInvSlotNameFromSeatPos()

string GetDoorInvSlotNameFromSeatPos ( int posIdx)
protected

Definition at line 2137 of file CarScript.c.

2138 {
2139 return "";
2140 }

◆ GetDoorSelectionNameFromSeatPos()

string GetDoorSelectionNameFromSeatPos ( int posIdx)
protected

Definition at line 2132 of file CarScript.c.

2133 {
2134 return "";
2135 }

◆ GetEnginePointPosWS()

vector GetEnginePointPosWS ( )
protected

Definition at line 455 of file CarScript.c.

456 {
457 return ModelToWorld(m_enginePos);
458 }

References m_enginePos.

◆ GetEnginePosWS()

vector GetEnginePosWS ( )
protected

Definition at line 440 of file CarScript.c.

441 {
442 return ModelToWorld(m_DrownEnginePos);
443 }

References m_DrownEnginePos.

Referenced by CreateCarDestroyedEffect(), and OnUpdate().

◆ GetEnviroHeatComfortOverride()

float GetEnviroHeatComfortOverride ( )
protected

DEPRECATED.

◆ GetFrontPointPosWS()

vector GetFrontPointPosWS ( )
protected

Definition at line 459 of file CarScript.c.

460 {
461 return ModelToWorld(m_frontPos);
462 }

References m_frontPos.

◆ GetLiquidThroughputCoef()

override float GetLiquidThroughputCoef ( )
protected

Definition at line 484 of file CarScript.c.

485 {
487 }
const float LIQUID_THROUGHPUT_CAR_DEFAULT
Definition constants.c:526

References LIQUID_THROUGHPUT_CAR_DEFAULT.

◆ GetMomentum()

float GetMomentum ( )
protected

Definition at line 2494 of file CarScript.c.

2495 {
2496 return GetVelocity(this).Length() * dBodyGetMass(this);
2497 }

References dBodyGetMass(), and GetVelocity().

Referenced by CheckContactCache(), EOnPostSimulate(), and OnContact().

◆ GetPushForceCoefficientMultiplier()

float GetPushForceCoefficientMultiplier ( )
protected

Definition at line 2499 of file CarScript.c.

2500 {
2501 return 1.0;
2502 }

◆ GetRadiator()

EntityAI GetRadiator ( )
protected

Definition at line 2209 of file CarScript.c.

2210 {
2211 return m_Radiator;
2212 }

References m_Radiator.

Referenced by CarPartsHealthCheck().

◆ GetRefillPointPosWS()

vector GetRefillPointPosWS ( )
protected

Definition at line 450 of file CarScript.c.

451 {
452 return ModelToWorld(m_fuelPos);
453 }

References m_fuelPos.

◆ HandleByCrewMemberState()

override void HandleByCrewMemberState ( ECrewMemberState state)
protected

Definition at line 1415 of file CarScript.c.

1416 {
1417 switch (state)
1418 {
1419 case ECrewMemberState.UNCONSCIOUS:
1421 {
1422 if (unconsciousCrewMemberIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
1423 {
1424 EngineStop();
1425 SetBrake(0.5);
1426 }
1427
1429 }
1430
1431 break
1432
1433 case ECrewMemberState.DEAD:
1435 {
1436 if (deadCrewMemberIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
1437 {
1438 EngineStop();
1439 SetBrake(0.5);
1440 }
1441
1443 }
1444
1445 break
1446 }
1447 }
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References m_DeadCrewMemberIndices, and m_UnconsciousCrewMemberIndices.

Referenced by EOnPostSimulate().

◆ HandleCarHornSound()

void HandleCarHornSound ( ECarHornState pState)
protected

Definition at line 1310 of file CarScript.c.

1311 {
1312 switch (pState)
1313 {
1314 case ECarHornState.SHORT:
1315 PlaySoundSet(m_CarHornSoundEffect, m_CarHornShortSoundName, 0, 0, false);
1316 break;
1317 case ECarHornState.LONG:
1318 PlaySoundSet(m_CarHornSoundEffect, m_CarHornLongSoundName, 0, 0, true);
1319 break;
1320 default:
1322 break;
1323 }
1324 }
string m_CarHornShortSoundName
Definition CarScript.c:218
string m_CarHornLongSoundName
Definition CarScript.c:219

References CleanupSound(), m_CarHornLongSoundName, m_CarHornShortSoundName, and m_CarHornSoundEffect.

Referenced by OnVariablesSynchronized().

◆ HandleDoorsSound()

void HandleDoorsSound ( string animSource,
float phase )
protected

Definition at line 1267 of file CarScript.c.

1268 {
1269 switch (animSource)
1270 {
1271 case "doorsdriver":
1272 case "doorscodriver":
1273 case "doorscargo1":
1274 case "doorscargo2":
1275 case "doorshood":
1276 case "doorstrunk":
1278 if (phase == 0)
1280 else
1282
1283 if (sound)
1284 sound.SetAutodestroy(true);
1285
1286 break;
1287 }
1288 }
string m_CarDoorCloseSound
Definition CarScript.c:214
string m_CarDoorOpenSound
Definition CarScript.c:213
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.

References GetPosition, m_CarDoorCloseSound, m_CarDoorOpenSound, and SEffectManager::PlaySound().

Referenced by OnAnimationPhaseStarted().

◆ HandleEngineSound()

void HandleEngineSound ( CarEngineSoundState state)
protected

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

Definition at line 1326 of file CarScript.c.

1327 {
1328#ifndef SERVER
1331 WaveKind waveKind = WaveKind.WAVEEFFECT;
1332
1333 switch (state)
1334 {
1335 case CarEngineSoundState.STARTING:
1336 m_PreStartSound = SEffectManager.PlaySound("Offroad_02_Starting_SoundSet", ModelToWorld(GetEnginePos()));
1337 m_PreStartSound.SetSoundFadeOut(0.15);
1338 break;
1339 case CarEngineSoundState.START_OK:
1340 // play different sound based on selected camera
1341 if (Class.CastTo(player, CrewMember(0)))
1342 {
1343 if (!player.IsCameraInsideVehicle())
1344 waveKind = WaveKind.WAVEEFFECTEX;
1345
1346 sound = SEffectManager.CreateSound(m_EngineStartOK, ModelToWorld(GetEnginePos()));
1347 if (sound)
1348 {
1349 sound.SetSoundWaveKind(waveKind);
1350 sound.SoundPlay();
1351 sound.SetAutodestroy(true);
1352 }
1353 }
1354
1356 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(SetEngineStarted, 1000, false, true);
1357 break;
1358
1359 case CarEngineSoundState.START_NO_FUEL:
1360 sound = SEffectManager.PlaySound("offroad_engine_failed_start_fuel_SoundSet", ModelToWorld(GetEnginePos()));
1361 sound.SetAutodestroy(true);
1362 break;
1363
1364 case CarEngineSoundState.START_NO_BATTERY:
1365 sound = SEffectManager.PlaySound("offroad_engine_failed_start_battery_SoundSet", ModelToWorld(GetEnginePos()));
1366 sound.SetAutodestroy(true);
1367 break;
1368
1369 case CarEngineSoundState.START_NO_SPARKPLUG:
1370 sound = SEffectManager.PlaySound("offroad_engine_failed_start_sparkplugs_SoundSet", ModelToWorld(GetEnginePos()));
1371 sound.SetAutodestroy(true);
1372 break;
1373
1374 case CarEngineSoundState.STOP_OK:
1375 case CarEngineSoundState.STOP_NO_FUEL:
1376 // play different sound based on selected camera
1377 if (Class.CastTo(player, CrewMember(0)))
1378 {
1379 if (!player.IsCameraInsideVehicle())
1380 waveKind = WaveKind.WAVEEFFECTEX;
1381
1382 sound = SEffectManager.CreateSound(m_EngineStopFuel, ModelToWorld(GetEnginePos()));
1383 if (sound)
1384 {
1385 sound.SetSoundWaveKind(waveKind);
1386 sound.SoundPlay();
1387 sound.SetAutodestroy(true);
1388 }
1389 }
1390
1391 SetEngineStarted(false);
1392 break;
1393 }
1394#endif
1395 }
void SetEngineStarted(bool started)
Definition CarScript.c:2231
string m_EngineStartOK
Sounds.
Definition CarScript.c:207
ref EffectSound m_PreStartSound
Definition CarScript.c:225
string m_EngineStopFuel
Definition CarScript.c:211
WaveKind
Definition Sound.c:2
static EffectSound CreateSound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false, bool enviroment=false)
Create an EffectSound.

References CALL_CATEGORY_GAMEPLAY, Class::CastTo(), SEffectManager::CreateSound(), GetGame(), m_EngineStartOK, m_EngineStopFuel, m_PreStartSound, SEffectManager::PlaySound(), and SetEngineStarted().

Referenced by OnBeforeEngineStart(), OnEngineStart(), and OnEngineStop().

◆ HandleSeatAdjustmentSound()

void HandleSeatAdjustmentSound ( string animSource,
float phase )
protected

Definition at line 1290 of file CarScript.c.

1291 {
1292 switch (animSource)
1293 {
1294 case "seatdriver":
1295 case "seatcodriver":
1297 if (phase == 0)
1299 else
1301
1302 if (sound)
1303 sound.SetAutodestroy(true);
1304
1305 break;
1306 }
1307 }
string m_CarSeatShiftInSound
Definition CarScript.c:215
string m_CarSeatShiftOutSound
Definition CarScript.c:216

References GetPosition, m_CarSeatShiftInSound, m_CarSeatShiftOutSound, and SEffectManager::PlaySound().

Referenced by OnAnimationPhaseStarted().

◆ HasEngineZoneReceivedHit()

bool HasEngineZoneReceivedHit ( )
protected

Definition at line 2489 of file CarScript.c.

2490 {
2492 }
bool m_EngineZoneReceivedHit
Definition CarScript.c:271

References m_EngineZoneReceivedHit.

◆ HasRadiator()

bool HasRadiator ( )
protected

Definition at line 2204 of file CarScript.c.

2205 {
2206 return m_Radiator != null;
2207 }

References m_Radiator.

Referenced by CarPartsHealthCheck().

◆ InitializeActions()

void InitializeActions ( )
protected

Definition at line 2289 of file CarScript.c.

2290 {
2292 if (!m_InputActionMap)
2293 {
2296 SetActions();
2298 }
2299 }
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void SetActions()
Definition CarScript.c:2312
enum CarDoorState m_CarTypeActionsMap
string Type

References m_CarTypeActionsMap, m_InputActionMap, CarScript::SetActions(), and Type.

◆ IsHandbrakeActive()

bool IsHandbrakeActive ( )
protected

Definition at line 2219 of file CarScript.c.

2220 {
2221 return GetHandbrake() > 0.0;
2222 }

◆ IsInventoryVisible()

override bool IsInventoryVisible ( )
protected

Definition at line 2363 of file CarScript.c.

2364 {
2365 return (GetGame().GetPlayer() && (!GetGame().GetPlayer().GetCommand_Vehicle() || GetGame().GetPlayer().GetCommand_Vehicle().GetTransport() == this));
2366 }
PlayerBase GetPlayer()
proto native HumanCommandVehicle GetCommand_Vehicle()

References GetCommand_Vehicle(), GetGame(), and GetPlayer().

◆ IsMoving()

bool IsMoving ( )
protected

Definition at line 2214 of file CarScript.c.

2215 {
2216 return GetSpeedometerAbsolute() > 3.5;
2217 }

Referenced by CanReleaseAttachment().

◆ IsScriptedLightsOn()

bool IsScriptedLightsOn ( )
protected

Propper way to get if light is swiched on. Use instead of IsLightsOn().

Definition at line 1585 of file CarScript.c.

1586 {
1587 return m_HeadlightsOn;
1588 }
bool m_HeadlightsOn
Definition CarScript.c:234

References m_HeadlightsOn.

Referenced by EEItemDetached(), and OnUpdate().

◆ IsVitalCarBattery()

bool IsVitalCarBattery ( )
protected

Definition at line 2169 of file CarScript.c.

2170 {
2171 return true;
2172 }

◆ IsVitalEngineBelt()

bool IsVitalEngineBelt ( )
protected

Definition at line 2189 of file CarScript.c.

2190 {
2191 return true;
2192 }

◆ IsVitalFuelTank()

bool IsVitalFuelTank ( )
protected

Definition at line 2199 of file CarScript.c.

2200 {
2201 return true;
2202 }

Referenced by EOnPostSimulate().

◆ IsVitalGlowPlug()

bool IsVitalGlowPlug ( )
protected

Definition at line 2184 of file CarScript.c.

2185 {
2186 return true;
2187 }

◆ IsVitalRadiator()

bool IsVitalRadiator ( )
protected

Definition at line 2194 of file CarScript.c.

2195 {
2196 return true;
2197 }

◆ IsVitalSparkPlug()

bool IsVitalSparkPlug ( )
protected

Definition at line 2179 of file CarScript.c.

2180 {
2181 return true;
2182 }

◆ IsVitalTruckBattery()

bool IsVitalTruckBattery ( )
protected

Definition at line 2174 of file CarScript.c.

2175 {
2176 return true;
2177 }

◆ LeakFluid()

void LeakFluid ( CarFluid fluid)
protected

Definition at line 2004 of file CarScript.c.

2005 {
2006 float ammount = 0;
2007
2008 switch (fluid)
2009 {
2010 case CarFluid.COOLANT:
2011 ammount = (1 - m_RadiatorHealth) * Math.RandomFloat(0.02, 0.05); //CARS_LEAK_TICK_MIN; CARS_LEAK_TICK_MAX
2012 Leak(fluid, ammount);
2013 break;
2014
2015 case CarFluid.OIL:
2016 ammount = (1 - m_EngineHealth) * Math.RandomFloat(0.02, 1.0); //CARS_LEAK_OIL_MIN; CARS_LEAK_OIL_MAX
2017 Leak(fluid, ammount);
2018 break;
2019
2020 case CarFluid.FUEL:
2021 ammount = (1 - m_FuelTankHealth) * Math.RandomFloat(0.02, 0.05); //CARS_LEAK_TICK_MIN; CARS_LEAK_TICK_MAX
2022 Leak(fluid, ammount);
2023 break;
2024 }
2025 }

References m_EngineHealth, m_FuelTankHealth, m_RadiatorHealth, and Math::RandomFloat().

Referenced by EOnPostSimulate().

◆ LeftFrontLightShineOff()

void LeftFrontLightShineOff ( )
protected

Definition at line 1867 of file CarScript.c.

1868 {
1869 string material = ConfigGetString("frontReflectorMatOff");
1870
1871 if (material)
1872 SetObjectMaterial(SELECTION_ID_FRONT_LIGHT_L, material);
1873 }
static const int SELECTION_ID_FRONT_LIGHT_L
Definition CarScript.c:258

References SELECTION_ID_FRONT_LIGHT_L.

Referenced by UpdateLightsServer().

◆ LeftFrontLightShineOn()

void LeftFrontLightShineOn ( )
protected

Definition at line 1851 of file CarScript.c.

1852 {
1853 string material = ConfigGetString("frontReflectorMatOn");
1854
1855 if (material)
1856 SetObjectMaterial(SELECTION_ID_FRONT_LIGHT_L, material);
1857 }

References SELECTION_ID_FRONT_LIGHT_L.

Referenced by UpdateLightsServer().

◆ MarkCrewMemberDead()

override void MarkCrewMemberDead ( int crewMemberIndex)
protected

◆ MarkCrewMemberUnconscious()

override void MarkCrewMemberUnconscious ( int crewMemberIndex)
protected

◆ NoRearLight()

void NoRearLight ( )
protected

Definition at line 1845 of file CarScript.c.

1846 {
1847 m_RearLight.FadeOut();
1848 m_RearLight = null;
1849 }

References m_RearLight.

Referenced by UpdateLightsClient().

◆ OnAction()

override bool OnAction ( int action_id,
Man player,
ParamsReadContext ctx )
protected

Definition at line 563 of file CarScript.c.

564 {
565 if (super.OnAction(action_id, player, ctx))
566 return true;
567
568 if (!GetGame().IsServer())
569 return false;
570
571 switch (action_id)
572 {
573 case EActions.CAR_HORN_START_SHORT:
575 return true;
576 case EActions.CAR_HORN_START_LONG:
578 return true;
579 case EActions.CAR_HORN_STOP:
581 return true;
582
583 case EActions.CAR_FUEL_FULL:
584 Fill(CarFluid.FUEL, GetFluidCapacity(CarFluid.FUEL));
585 return true;
586 case EActions.CAR_FUEL_EMPTY:
587 LeakAll(CarFluid.FUEL);
588 return true;
589 case EActions.CAR_FUEL_INCREASE:
590 Fill(CarFluid.FUEL, GetFluidCapacity(CarFluid.FUEL) * 0.1);
591 return true;
592 case EActions.CAR_FUEL_DECREASE:
593 Leak(CarFluid.FUEL, GetFluidCapacity(CarFluid.FUEL) * 0.1);
594 return true;
595
596 case EActions.CAR_COOLANT_FULL:
597 Fill(CarFluid.COOLANT, GetFluidCapacity(CarFluid.COOLANT));
598 return true;
599 case EActions.CAR_COOLANT_EMPTY:
600 LeakAll(CarFluid.COOLANT);
601 return true;
602 case EActions.CAR_COOLANT_INCREASE:
603 Fill(CarFluid.COOLANT, GetFluidCapacity(CarFluid.COOLANT) * 0.1);
604 return true;
605 case EActions.CAR_COOLANT_DECREASE:
606 Leak(CarFluid.COOLANT, GetFluidCapacity(CarFluid.COOLANT) * 0.1);
607 return true;
608 case EActions.DELETE:
609 Delete();
610 return true;
611 }
612
613 return false;
614 }
void SetCarHornState(int pState)
Definition CarScript.c:2453

References GetGame(), and SetCarHornState().

◆ OnAnimationPhaseStarted()

override void OnAnimationPhaseStarted ( string animSource,
float phase )
protected

Definition at line 1259 of file CarScript.c.

1260 {
1261#ifndef SERVER
1264#endif
1265 }
void HandleDoorsSound(string animSource, float phase)
Definition CarScript.c:1267
void HandleSeatAdjustmentSound(string animSource, float phase)
Definition CarScript.c:1290

References HandleDoorsSound(), and HandleSeatAdjustmentSound().

◆ OnAttachmentRuined()

override void OnAttachmentRuined ( EntityAI attachment)
protected

Definition at line 736 of file CarScript.c.

737 {
738 super.OnAttachmentRuined(attachment);
739
741 UpdateLights();
742 }

References UpdateHeadlightState(), and UpdateLights().

◆ OnBeforeEngineStart()

override bool OnBeforeEngineStart ( )
protected

Gets called everytime the game wants to start the engine. This callback is called on server only.

Returns
true if the engine can start, false otherwise.

Definition at line 1486 of file CarScript.c.

1487 {
1488 EntityAI item = null;
1489
1491 {
1492 m_EngineStartDoOnce = false;
1493 return m_EngineBeforeStart;
1494 }
1495
1496 if (GetFluidFraction(CarFluid.FUEL) <= 0)
1497 {
1499 return false;
1500 }
1501
1503 {
1504 item = GetBattery();
1505 if (!item || (item && (item.IsRuined() || item.GetCompEM().GetEnergy() < m_BatteryEnergyStartMin)))
1506 {
1507 m_EngineStartDoOnce = true;
1508 HandleEngineSound(CarEngineSoundState.START_NO_BATTERY);
1509 return false;
1510 }
1511 }
1512
1513 if (IsVitalSparkPlug())
1514 {
1515 item = FindAttachmentBySlotName("SparkPlug");
1516 if (!item || (item && item.IsRuined()))
1517 {
1518 m_EngineStartDoOnce = true;
1519 HandleEngineSound(CarEngineSoundState.START_NO_SPARKPLUG);
1520 return false;
1521 }
1522 }
1523
1524 if (IsVitalGlowPlug())
1525 {
1526 item = FindAttachmentBySlotName("GlowPlug");
1527 if (!item || (item && item.IsRuined()))
1528 {
1529 m_EngineStartDoOnce = true;
1530 HandleEngineSound(CarEngineSoundState.START_NO_SPARKPLUG);
1531 return false;
1532 }
1533 }
1534
1536 {
1537 m_EngineBeforeStart = true;
1539 }
1540
1541 return true;
1542 }
ItemBase GetBattery()
Definition CarScript.c:2443
bool m_EngineStartDoOnce
Definition CarScript.c:269
float m_BatteryEnergyStartMin
Definition CarScript.c:180
bool m_EngineBeforeStart
Definition CarScript.c:268
void HandleEngineSound(CarEngineSoundState state)
Definition CarScript.c:1326

References GetBattery(), HandleEngineSound(), CarScript::IsVitalCarBattery(), CarScript::IsVitalGlowPlug(), CarScript::IsVitalSparkPlug(), CarScript::IsVitalTruckBattery(), m_BatteryEnergyStartMin, m_EngineBeforeStart, and m_EngineStartDoOnce.

◆ OnBeforeSwitchLights()

bool OnBeforeSwitchLights ( bool toOn)
protected

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

Returns
true when lights can be switched, false otherwise.

Definition at line 1579 of file CarScript.c.

1580 {
1581 return true;
1582 }

◆ OnBrakesPressed()

void OnBrakesPressed ( )
protected

Definition at line 969 of file CarScript.c.

970 {
971 UpdateLights();
972 }

References UpdateLights().

Referenced by OnUpdate().

◆ OnBrakesReleased()

void OnBrakesReleased ( )
protected

Definition at line 974 of file CarScript.c.

975 {
976 UpdateLights();
977 }

References UpdateLights().

Referenced by OnUpdate().

◆ OnContact()

override void OnContact ( string zoneName,
vector localPos,
IEntity other,
Contact data )
protected

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

Definition at line 1058 of file CarScript.c.

1059 {
1060 if (GetGame().IsServer())
1061 {
1062#ifdef DIAG_DEVELOPER
1063 m_ContactCalled = true;
1065 {
1066 string output = "Zone: " + zoneName + " | Impulse:" + data.Impulse;
1067 Debug.Log(output);
1068 }
1069#endif
1070 if (m_ContactCache.Count() == 0)
1071 {
1073 m_ContactCache.Insert(zoneName, ccd);
1075 float dot = vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized());
1076 if (dot < 0)
1078
1080 }
1081 }
1082 }

References vector::Dot(), GetGame(), GetMomentum(), GetVelocity(), Debug::Log(), m_ContactCache, m_MomentumPrevTick, m_VelocityPrevTick, and vector::Normalized().

◆ OnEngineStart()

override void OnEngineStart ( )
protected

Gets called everytime the engine starts.

Definition at line 1551 of file CarScript.c.

1552 {
1554 if (GetGame().IsServer() && battery)
1555 battery.GetCompEM().ConsumeEnergy(GetBatteryConsumption());
1556
1557 UpdateLights();
1558
1560
1561 m_EngineBeforeStart = false;
1562 }
float GetBatteryConsumption()
Definition CarScript.c:2428

References GetBattery(), GetBatteryConsumption(), GetGame(), HandleEngineSound(), m_EngineBeforeStart, and UpdateLights().

◆ OnEngineStop()

override void OnEngineStop ( )
protected

Gets called everytime the engine stops.

Definition at line 1565 of file CarScript.c.

1566 {
1567 UpdateLights();
1568
1571
1572 m_EngineBeforeStart = false;
1573 }

References HandleEngineSound(), m_EngineBeforeStart, SetEngineZoneReceivedHit(), and UpdateLights().

◆ OnFluidChanged()

override void OnFluidChanged ( CarFluid fluid,
float newValue,
float oldValue )
protected

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

This callback is called on both server and client.

Definition at line 1458 of file CarScript.c.

1459 {
1460 switch (fluid)
1461 {
1462 case CarFluid.FUEL:
1464 break;
1465
1466 case CarFluid.OIL:
1468 break;
1469
1470 case CarFluid.BRAKE:
1472 break;
1473
1474 case CarFluid.COOLANT:
1476 break;
1477 }
1478 }
float m_BrakeAmmount
Definition CarScript.c:155
float m_CoolantAmmount
Definition CarScript.c:153
float m_OilAmmount
Definition CarScript.c:154
float m_FuelAmmount
keeps ammount of each fluid
Definition CarScript.c:152

References m_BrakeAmmount, m_CoolantAmmount, m_FuelAmmount, and m_OilAmmount.

◆ OnGearChanged()

override void OnGearChanged ( int newGear,
int oldGear )
protected

Definition at line 1544 of file CarScript.c.

1545 {
1546 //Debug.Log(string.Format("OnGearChanged newGear=%1,oldGear=%2", newGear, oldGear));
1548 }

References UpdateLights().

◆ OnSound()

override float OnSound ( CarSoundCtrl ctrl,
float oldValue )
protected

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.

Definition at line 1246 of file CarScript.c.

1247 {
1248 switch (ctrl)
1249 {
1250 case CarSoundCtrl.ENGINE:
1251 if (!m_EngineStarted)
1252 return 0.0;
1253 break;
1254 }
1255
1256 return oldValue;
1257 }
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
bool m_EngineStarted
Definition CarScript.c:240

References m_EngineStarted.

◆ OnUpdate()

override void OnUpdate ( float dt)
protected

Definition at line 979 of file CarScript.c.

980 {
981 if (GetGame().IsServer())
982 {
984 if (battery)
985 {
986 if (EngineIsOn())
987 {
990 {
991 battery.GetCompEM().ConsumeEnergy(GetBatteryRechargeRate() * m_BatteryTimer);
992 m_BatteryTimer = 0;
993 }
994 }
995 else if (!EngineIsOn() && IsScriptedLightsOn())
996 {
999 {
1000 battery.GetCompEM().ConsumeEnergy(GetBatteryRuntimeConsumption() * m_BatteryTimer);
1001 m_BatteryTimer = 0;
1002
1003 if (battery.GetCompEM().GetEnergy() <= 0)
1005 }
1006 }
1007 }
1008
1009 if (GetGame().GetWaterDepth(GetEnginePosWS()) > 0)
1010 {
1011 m_DrownTime += dt;
1013 {
1014 // *dt to get damage per second
1015 AddHealth("Engine", "Health", -DROWN_ENGINE_DAMAGE * dt);
1017 }
1018 }
1019 else
1020 m_DrownTime = 0;
1021 }
1022
1023 // For visualisation of brake lights for all players
1024 float brake_coef = GetBrake();
1025 if (brake_coef > 0)
1026 {
1027 if (!m_BrakesArePressed)
1028 {
1029 m_BrakesArePressed = true;
1030 SetSynchDirty();
1032 }
1033 }
1034 else
1035 {
1037 {
1038 m_BrakesArePressed = false;
1039 SetSynchDirty();
1041 }
1042 }
1043
1044 if ((!GetGame().IsDedicatedServer()) && m_ForceUpdateLights)
1045 {
1046 UpdateLights();
1047 m_ForceUpdateLights = false;
1048 }
1049 }
void OnBrakesPressed()
Definition CarScript.c:969
float GetBatteryRuntimeConsumption()
Definition CarScript.c:2433
float m_DrownTime
Definition CarScript.c:163
static float DROWN_ENGINE_DAMAGE
Definition CarScript.c:147
bool m_BrakesArePressed
Definition CarScript.c:236
float m_BatteryTimer
Definition CarScript.c:178
static float DROWN_ENGINE_THRESHOLD
Definition CarScript.c:146
const float BATTERY_UPDATE_DELAY
Definition CarScript.c:179
float GetBatteryRechargeRate()
Definition CarScript.c:2438
void OnBrakesReleased()
Definition CarScript.c:974

References BATTERY_UPDATE_DELAY, DROWN_ENGINE_DAMAGE, DROWN_ENGINE_THRESHOLD, GetBattery(), GetBatteryRechargeRate(), GetBatteryRuntimeConsumption(), GetEnginePosWS(), GetGame(), IsScriptedLightsOn(), m_BatteryTimer, m_BrakesArePressed, m_DrownTime, m_ForceUpdateLights, OnBrakesPressed(), OnBrakesReleased(), SetEngineZoneReceivedHit(), ToggleHeadlights(), and UpdateLights().

◆ OnVariablesSynchronized()

override void OnVariablesSynchronized ( )
protected

Definition at line 616 of file CarScript.c.

617 {
618 super.OnVariablesSynchronized();
619
620 if (GetCrashHeavySound())
622 else if (GetCrashLightSound())
624
626
627 UpdateLights();
628 }
void PlayCrashHeavySound()
Definition CarScript.c:2074
void PlayCrashLightSound()
Definition CarScript.c:2055
bool GetCrashHeavySound()
Definition CarScript.c:2060
void HandleCarHornSound(ECarHornState pState)
Definition CarScript.c:1310
bool GetCrashLightSound()
Definition CarScript.c:2041

References GetCrashHeavySound(), GetCrashLightSound(), HandleCarHornSound(), m_CarHornState, PlayCrashHeavySound(), PlayCrashLightSound(), and UpdateLights().

◆ PlayCrashHeavySound()

void PlayCrashHeavySound ( )
protected

Definition at line 2074 of file CarScript.c.

2075 {
2076 PlaySoundEx("offroad_hit_heavy_SoundSet", m_CrashSoundHeavy, m_PlayCrashSoundHeavy);
2077 }

References m_CrashSoundHeavy, m_PlayCrashSoundHeavy, and PlaySoundEx().

Referenced by OnVariablesSynchronized().

◆ PlayCrashLightSound()

void PlayCrashLightSound ( )
protected

Definition at line 2055 of file CarScript.c.

2056 {
2057 PlaySoundEx("offroad_hit_light_SoundSet", m_CrashSoundLight, m_PlayCrashSoundLight);
2058 }

References m_CrashSoundLight, m_PlayCrashSoundLight, and PlaySoundEx().

Referenced by OnVariablesSynchronized().

◆ PlaySound()

void PlaySound ( string soundset,
ref EffectSound sound,
out bool soundbool )
protected

Definition at line 2101 of file CarScript.c.

2102 {
2104 }

References PlaySoundEx().

◆ PlaySoundEx()

void PlaySoundEx ( string soundset,
EffectSound sound,
out bool soundbool )
protected

Definition at line 2079 of file CarScript.c.

2080 {
2081#ifndef SERVER
2082 if (!sound)
2083 {
2085 if (sound)
2086 sound.SetAutodestroy(true);
2087 }
2088 else
2089 {
2090 if (!sound.IsSoundPlaying())
2091 {
2092 sound.SetPosition(GetPosition());
2093 sound.SoundPlay();
2094 }
2095 }
2096
2097 soundbool = false;
2098#endif
2099 }
static EffectSound PlaySoundCachedParams(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, using or creating cached SoundParams.

References GetPosition, and SEffectManager::PlaySoundCachedParams().

Referenced by EEHealthLevelChanged(), PlayCrashHeavySound(), PlayCrashLightSound(), and PlaySound().

◆ RemoveAction()

void RemoveAction ( typename actionName )
protected

Definition at line 2352 of file CarScript.c.

2353 {
2355 ActionBase action = player.GetActionManager().GetAction(actionName);
2356 typename ai = action.GetInputType();
2358
2359 if (action_array)
2360 action_array.RemoveItem(action);
2361 }

References GetGame(), GetPlayer(), and m_InputActionMap.

◆ ReverseLightsShineOff()

void ReverseLightsShineOff ( )
protected

Definition at line 1894 of file CarScript.c.

1895 {
1896 string material = ConfigGetString("ReverseReflectorMatOff");
1897
1898 if (material)
1899 {
1900 SetObjectMaterial(SELECTION_ID_REVERSE_LIGHT_L, material);
1901 SetObjectMaterial(SELECTION_ID_REVERSE_LIGHT_R, material);
1902 }
1903 }
static const int SELECTION_ID_REVERSE_LIGHT_L
Definition CarScript.c:262
static const int SELECTION_ID_REVERSE_LIGHT_R
Definition CarScript.c:263

References SELECTION_ID_REVERSE_LIGHT_L, and SELECTION_ID_REVERSE_LIGHT_R.

Referenced by UpdateLightsServer().

◆ ReverseLightsShineOn()

void ReverseLightsShineOn ( )
protected

Definition at line 1883 of file CarScript.c.

1884 {
1885 string material = ConfigGetString("ReverseReflectorMatOn");
1886
1887 if (material)
1888 {
1889 SetObjectMaterial(SELECTION_ID_REVERSE_LIGHT_L, material);
1890 SetObjectMaterial(SELECTION_ID_REVERSE_LIGHT_R, material);
1891 }
1892 }

References SELECTION_ID_REVERSE_LIGHT_L, and SELECTION_ID_REVERSE_LIGHT_R.

Referenced by UpdateLightsServer().

◆ ReverseRearLight()

void ReverseRearLight ( )
protected

Definition at line 1834 of file CarScript.c.

1835 {
1836 m_RearLight.SetAsSegregatedReverseLight();
1837 }

References m_RearLight.

Referenced by UpdateLightsClient().

◆ RightFrontLightShineOff()

void RightFrontLightShineOff ( )
protected

Definition at line 1875 of file CarScript.c.

1876 {
1877 string material = ConfigGetString("frontReflectorMatOff");
1878
1879 if (material)
1880 SetObjectMaterial(SELECTION_ID_FRONT_LIGHT_R, material);
1881 }
static const int SELECTION_ID_FRONT_LIGHT_R
Definition CarScript.c:259

References SELECTION_ID_FRONT_LIGHT_R.

Referenced by UpdateLightsServer().

◆ RightFrontLightShineOn()

void RightFrontLightShineOn ( )
protected

Definition at line 1859 of file CarScript.c.

1860 {
1861 string material = ConfigGetString("frontReflectorMatOn");
1862
1863 if (material)
1864 SetObjectMaterial(SELECTION_ID_FRONT_LIGHT_R, material);
1865 }

References SELECTION_ID_FRONT_LIGHT_R.

Referenced by UpdateLightsServer().

◆ SetActions()

◆ SetCarHornState()

void SetCarHornState ( int pState)
protected

Definition at line 2453 of file CarScript.c.

2454 {
2456 SetSynchDirty();
2457
2458 if (GetGame().IsServer())
2460 }
void GenerateCarHornAINoise(int pState)
Definition CarScript.c:2463

References GenerateCarHornAINoise(), GetGame(), and m_CarHornState.

Referenced by OnAction().

◆ SetEngineStarted()

void SetEngineStarted ( bool started)
protected

Definition at line 2231 of file CarScript.c.

2232 {
2234 }

References m_EngineStarted.

Referenced by HandleEngineSound().

◆ SetEngineZoneReceivedHit()

void SetEngineZoneReceivedHit ( bool pState)
protected

Definition at line 2483 of file CarScript.c.

2484 {
2486 SetSynchDirty();
2487 }

References m_EngineZoneReceivedHit.

Referenced by EEHitBy(), EOnPostSimulate(), OnEngineStop(), and OnUpdate().

◆ SpawnAdditionalItems()

void SpawnAdditionalItems ( )
protected

Definition at line 2554 of file CarScript.c.

2555 {
2556 GetInventory().CreateInInventory("Wrench");
2557 GetInventory().CreateInInventory("LugWrench");
2558 GetInventory().CreateInInventory("Screwdriver");
2559 GetInventory().CreateInInventory("EpoxyPutty");
2560
2561 GetInventory().CreateInInventory("CanisterGasoline");
2562
2563 EntityAI ent;
2565 ent = GetInventory().CreateInInventory("CanisterGasoline");
2566 if (Class.CastTo(container, ent))
2567 container.SetLiquidType(LIQUID_WATER, true);
2568
2569 ent = GetInventory().CreateInInventory("Blowtorch");
2570 if (ent)
2571 ent.GetInventory().CreateInInventory("LargeGasCanister");
2572
2573 ent = GetInventory().CreateInInventory("Blowtorch");
2574 if (ent)
2575 ent.GetInventory().CreateInInventory("LargeGasCanister");
2576 }
const int LIQUID_WATER
Definition constants.c:504

References Class::CastTo(), and LIQUID_WATER.

Referenced by CarScript::OnDebugSpawn(), CivilianSedan::OnDebugSpawn(), Hatchback_02::OnDebugSpawn(), Sedan_02::OnDebugSpawn(), and Truck_01_Covered::OnDebugSpawn().

◆ SpawnUniversalParts()

void SpawnUniversalParts ( )
protected

Definition at line 2516 of file CarScript.c.

2517 {
2518 GetInventory().CreateInInventory("HeadlightH7");
2519 GetInventory().CreateInInventory("HeadlightH7");
2520 GetInventory().CreateInInventory("HeadlightH7");
2521 GetInventory().CreateInInventory("HeadlightH7");
2522
2523 if (IsVitalCarBattery())
2524 {
2525 GetInventory().CreateInInventory("CarBattery");
2526 GetInventory().CreateInInventory("CarBattery");
2527 }
2528
2529 if (IsVitalTruckBattery())
2530 {
2531 GetInventory().CreateInInventory("TruckBattery");
2532 GetInventory().CreateInInventory("TruckBattery");
2533 }
2534
2535 if (IsVitalRadiator())
2536 {
2537 GetInventory().CreateInInventory("CarRadiator");
2538 GetInventory().CreateInInventory("CarRadiator");
2539 }
2540
2541 if (IsVitalSparkPlug())
2542 {
2543 GetInventory().CreateInInventory("SparkPlug");
2544 GetInventory().CreateInInventory("SparkPlug");
2545 }
2546
2547 if (IsVitalGlowPlug())
2548 {
2549 GetInventory().CreateInInventory("GlowPlug");
2550 GetInventory().CreateInInventory("GlowPlug");
2551 }
2552 }

References CarScript::IsVitalCarBattery(), CarScript::IsVitalGlowPlug(), CarScript::IsVitalRadiator(), CarScript::IsVitalSparkPlug(), and CarScript::IsVitalTruckBattery().

Referenced by CarScript::OnDebugSpawn(), CivilianSedan::OnDebugSpawn(), Hatchback_02::OnDebugSpawn(), Sedan_02::OnDebugSpawn(), and Truck_01_Covered::OnDebugSpawn().

◆ SynchCrashHeavySound()

void SynchCrashHeavySound ( bool play)
protected

Definition at line 2065 of file CarScript.c.

2066 {
2068 {
2070 SetSynchDirty();
2071 }
2072 }

References m_PlayCrashSoundHeavy.

Referenced by CheckContactCache().

◆ SynchCrashLightSound()

void SynchCrashLightSound ( bool play)
protected

Definition at line 2046 of file CarScript.c.

2047 {
2049 {
2051 SetSynchDirty();
2052 }
2053 }

References m_PlayCrashSoundLight.

Referenced by CheckContactCache().

◆ TailLightsShineOff()

void TailLightsShineOff ( )
protected

Definition at line 1952 of file CarScript.c.

1953 {
1954 string material = ConfigGetString("TailReflectorMatOff");
1955
1956 if (material)
1957 {
1958 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_L, material);
1959 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_R, material);
1960 }
1961 }
static const int SELECTION_ID_TAIL_LIGHT_R
Definition CarScript.c:265
static const int SELECTION_ID_TAIL_LIGHT_L
Definition CarScript.c:264

References SELECTION_ID_TAIL_LIGHT_L, and SELECTION_ID_TAIL_LIGHT_R.

Referenced by UpdateLightsServer().

◆ TailLightsShineOn()

void TailLightsShineOn ( )
protected

Definition at line 1927 of file CarScript.c.

1928 {
1929 string material = ConfigGetString("TailReflectorMatOn");
1930 string materialOff = ConfigGetString("TailReflectorMatOff");
1931
1932 if (material && materialOff)
1933 {
1935 {
1936 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_L, material);
1937 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_R, materialOff);
1938 }
1939 else if (m_HeadlightsState == CarHeadlightBulbsState.RIGHT)
1940 {
1941 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_L, materialOff);
1942 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_R, material);
1943 }
1945 {
1946 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_L, material);
1947 SetObjectMaterial(SELECTION_ID_TAIL_LIGHT_R, material);
1948 }
1949 }
1950 }
bool m_HeadlightsState
Definition CarScript.c:235

References m_HeadlightsState, SELECTION_ID_TAIL_LIGHT_L, and SELECTION_ID_TAIL_LIGHT_R.

Referenced by UpdateLightsServer().

◆ ToggleHeadlights()

void ToggleHeadlights ( )
protected

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

Definition at line 1591 of file CarScript.c.

1592 {
1594 SetSynchDirty();
1595 }

References m_HeadlightsOn.

Referenced by EEItemDetached(), and OnUpdate().

◆ TranslateAnimationPhaseToCarDoorState()

CarDoorState TranslateAnimationPhaseToCarDoorState ( string animation)
protected

Definition at line 2241 of file CarScript.c.

2242 {
2243 if (GetAnimationPhase(animation) > 0.5)
2244 return CarDoorState.DOORS_OPEN;
2245 else
2246 return CarDoorState.DOORS_CLOSED;
2247 }
CarDoorState
Definition CarScript.c:2

Referenced by CarScript::GetCarDoorsState().

◆ UpdateHeadlightState()

void UpdateHeadlightState ( )
protected

Definition at line 680 of file CarScript.c.

681 {
682 EntityAI bulb_L = FindAttachmentBySlotName("Reflector_1_1");
683 EntityAI bulb_R = FindAttachmentBySlotName("Reflector_2_1");
684
685 if (bulb_L && !bulb_L.IsRuined() && bulb_R && !bulb_R.IsRuined())
687 else if (bulb_L && !bulb_L.IsRuined())
689 else if (bulb_R && !bulb_R.IsRuined())
691 else if ((!bulb_L || bulb_L.IsRuined()) && (!bulb_R || bulb_R.IsRuined()))
693 }

References m_HeadlightsState.

Referenced by CheckContactCache(), EEItemAttached(), EEItemDetached(), and OnAttachmentRuined().

◆ UpdateLights()

void UpdateLights ( int new_gear = -1)
protected

Definition at line 1597 of file CarScript.c.

1598 {
1599#ifndef SERVER
1601#endif
1603 }
void UpdateLightsServer(int newGear=-1)
Definition CarScript.c:1716
void UpdateLightsClient(int newGear=-1)
Definition CarScript.c:1605

References UpdateLightsClient(), and UpdateLightsServer().

Referenced by CheckContactCache(), EEItemAttached(), EEItemDetached(), OnAttachmentRuined(), OnBrakesPressed(), OnBrakesReleased(), OnEngineStart(), OnEngineStop(), OnGearChanged(), OnUpdate(), and OnVariablesSynchronized().

◆ UpdateLightsClient()

void UpdateLightsClient ( int newGear = -1)
protected

Definition at line 1605 of file CarScript.c.

1606 {
1607 int gear;
1608
1609 if (newGear == -1)
1610 gear = GetGear();
1611 else
1612 gear = newGear;
1613
1614 if (m_HeadlightsOn)
1615 {
1618
1619 if (m_Headlight)
1620 {
1621 switch (m_HeadlightsState)
1622 {
1623 case CarHeadlightBulbsState.LEFT:
1625 m_Headlight.SegregateLight();
1626 break;
1627 case CarHeadlightBulbsState.RIGHT:
1629 m_Headlight.SegregateLight();
1630 break;
1631 case CarHeadlightBulbsState.BOTH:
1632 vector local_pos_left = GetMemoryPointPos(m_LeftHeadlightPoint);
1633 vector local_pos_right = GetMemoryPointPos(m_RightHeadlightPoint);
1634
1636 m_Headlight.AttachOnObject(this, local_pos_middle);
1637 m_Headlight.AggregateLight();
1638 break;
1639 default:
1640 m_Headlight.FadeOut();
1641 m_Headlight = null;
1642 }
1643 }
1644 }
1645 else
1646 {
1647 if (m_Headlight)
1648 {
1649 m_Headlight.FadeOut();
1650 m_Headlight = null;
1651 }
1652 }
1653
1654 // brakes & reverse
1655 switch (gear)
1656 {
1657 case CarGear.REVERSE:
1660 m_RearLightType = CarRearLightType.BRAKES_AND_REVERSE;
1661 else
1662 m_RearLightType = CarRearLightType.REVERSE_ONLY;
1663 break;
1664 default:
1666 m_RearLightType = CarRearLightType.BRAKES_ONLY;
1667 else
1669 }
1670
1671 //Debug.Log(string.Format("m_BrakesArePressed=%1, m_RearLightType=%2", m_BrakesArePressed.ToString(), EnumTools.EnumToString(CarRearLightType, m_RearLightType)));
1672
1674 {
1675 if (EngineIsOn() || m_RearLightType == CarRearLightType.BRAKES_ONLY || m_RearLightType == CarRearLightType.BRAKES_AND_REVERSE)
1676 {
1678 vector localPos = GetMemoryPointPos(m_ReverseLightPoint);
1679 m_RearLight.AttachOnObject(this, localPos, "180 0 0");
1680 }
1681 }
1682
1683 // rear lights
1685 {
1686 switch (m_RearLightType)
1687 {
1688 case CarRearLightType.BRAKES_ONLY:
1690 break;
1691 case CarRearLightType.REVERSE_ONLY:
1692 if (EngineIsOn())
1694 else
1695 NoRearLight();
1696
1697 break;
1698 case CarRearLightType.BRAKES_AND_REVERSE:
1699 if (EngineIsOn())
1701 else
1703
1704 break;
1705 default:
1706 NoRearLight();
1707 }
1708 }
1709 else
1710 {
1711 if (m_RearLight)
1712 NoRearLight();
1713 }
1714 }
CarAutomaticGearboxMode
Enumerated automatic gearbox modes. (native, do not change or extend)
Definition Car.c:65
CarLightBase CreateFrontLight()
Definition CarScript.c:1986
static string m_RightHeadlightPoint
Definition CarScript.c:251
static string m_LeftHeadlightPoint
Definition CarScript.c:250
static string m_ReverseLightPoint
Definition CarScript.c:249
CarRearLightBase CreateRearLight()
Definition CarScript.c:1980
void BrakesRearLight()
Definition CarScript.c:1829
static string m_LeftHeadlightTargetPoint
Definition CarScript.c:252
void NoRearLight()
Definition CarScript.c:1845
void BrakeAndReverseRearLight()
Definition CarScript.c:1839
static string m_RightHeadlightTargetPoint
Definition CarScript.c:253
void ReverseRearLight()
Definition CarScript.c:1834
bool m_RearLightType
Definition CarScript.c:237

References BrakeAndReverseRearLight(), BrakesRearLight(), CarScript::CreateFrontLight(), CarScript::CreateRearLight(), m_BrakesArePressed, m_Headlight, m_HeadlightsOn, m_HeadlightsState, m_LeftHeadlightPoint, m_LeftHeadlightTargetPoint, m_RearLight, m_RearLightType, m_ReverseLightPoint, m_RightHeadlightPoint, m_RightHeadlightTargetPoint, NoRearLight(), and ReverseRearLight().

Referenced by UpdateLights().

◆ UpdateLightsServer()

void UpdateLightsServer ( int newGear = -1)
protected

Definition at line 1716 of file CarScript.c.

1717 {
1718 int gear;
1719
1720 if (newGear == -1)
1721 {
1722 gear = GetGear();
1723 if (GearboxGetType() == CarGearboxType.AUTOMATIC)
1724 gear = GearboxGetMode();
1725 }
1726 else
1727 gear = newGear;
1728
1729 if (m_HeadlightsOn)
1730 {
1733
1734 switch (m_HeadlightsState)
1735 {
1736 case CarHeadlightBulbsState.LEFT:
1739 break;
1740 case CarHeadlightBulbsState.RIGHT:
1743 break;
1744 case CarHeadlightBulbsState.BOTH:
1747 break;
1748 default:
1751 }
1752
1753 //Debug.Log(string.Format("m_HeadlightsOn=%1, m_HeadlightsState=%2", m_HeadlightsOn.ToString(), EnumTools.EnumToString(CarHeadlightBulbsState, m_HeadlightsState)));
1754 }
1755 else
1756 {
1761 }
1762
1763
1764 // brakes & reverse
1765 switch (gear)
1766 {
1767 case CarGear.REVERSE:
1770 m_RearLightType = CarRearLightType.BRAKES_AND_REVERSE;
1771 else
1772 m_RearLightType = CarRearLightType.REVERSE_ONLY;
1773 break;
1774 default:
1776 m_RearLightType = CarRearLightType.BRAKES_ONLY;
1777 else
1779 }
1780
1781 //Debug.Log(string.Format("m_BrakesArePressed=%1, m_RearLightType=%2", m_BrakesArePressed.ToString(), EnumTools.EnumToString(CarRearLightType, m_RearLightType)));
1782
1783
1784 // rear lights
1786 {
1787 switch (m_RearLightType)
1788 {
1789 case CarRearLightType.BRAKES_ONLY:
1792 break;
1793 case CarRearLightType.REVERSE_ONLY:
1794 if (EngineIsOn())
1795 {
1798 }
1799 else
1800 {
1803 }
1804 break;
1805 case CarRearLightType.BRAKES_AND_REVERSE:
1806 if (EngineIsOn())
1807 {
1810 }
1811 else
1812 {
1815 }
1816 break;
1817 default:
1820 }
1821 }
1822 else
1823 {
1826 }
1827 }
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
Definition Car.c:33
void ReverseLightsShineOn()
Definition CarScript.c:1883
void TailLightsShineOn()
Definition CarScript.c:1927
void BrakeLightsShineOff()
Definition CarScript.c:1916
void DashboardShineOff()
Definition CarScript.c:1971
void BrakeLightsShineOn()
Definition CarScript.c:1905
void ReverseLightsShineOff()
Definition CarScript.c:1894
void RightFrontLightShineOn()
Definition CarScript.c:1859
void DashboardShineOn()
Definition CarScript.c:1963
void LeftFrontLightShineOn()
Definition CarScript.c:1851
void LeftFrontLightShineOff()
Definition CarScript.c:1867
void RightFrontLightShineOff()
Definition CarScript.c:1875
void TailLightsShineOff()
Definition CarScript.c:1952

References BrakeLightsShineOff(), BrakeLightsShineOn(), DashboardShineOff(), DashboardShineOn(), LeftFrontLightShineOff(), LeftFrontLightShineOn(), m_BrakesArePressed, m_HeadlightsOn, m_HeadlightsState, m_RearLightType, ReverseLightsShineOff(), ReverseLightsShineOn(), RightFrontLightShineOff(), RightFrontLightShineOn(), TailLightsShineOff(), and TailLightsShineOn().

Referenced by UpdateLights().

◆ ~CarScript()

void ~CarScript ( )
protected

Definition at line 507 of file CarScript.c.

508 {
509#ifndef SERVER
511#endif
512 }

References CleanupEffects().

Variable Documentation

◆ BATTERY_UPDATE_DELAY

const float BATTERY_UPDATE_DELAY = 100
private

Definition at line 179 of file CarScript.c.

Referenced by OnUpdate().

◆ BRAKES_ONLY

enum CarDoorState BRAKES_ONLY

◆ DROWN_ENGINE_DAMAGE

float DROWN_ENGINE_DAMAGE = 350.0
staticprotected

Definition at line 147 of file CarScript.c.

Referenced by OnUpdate().

◆ DROWN_ENGINE_THRESHOLD

float DROWN_ENGINE_THRESHOLD = 0.5
staticprotected

Definition at line 146 of file CarScript.c.

Referenced by OnUpdate().

◆ LEFT

◆ LONG

◆ m_ActionsInitialize

bool m_ActionsInitialize

Definition at line 139 of file CarScript.c.

◆ m_backPos

vector m_backPos
protected

Definition at line 200 of file CarScript.c.

Referenced by CarScript(), and GetBackPointPosWS().

◆ m_BatteryConsume

float m_BatteryConsume = 15
protected

Definition at line 175 of file CarScript.c.

Referenced by GetBatteryConsumption().

◆ m_BatteryContinuousConsume

float m_BatteryContinuousConsume = 0.25
protected

Definition at line 176 of file CarScript.c.

Referenced by GetBatteryRuntimeConsumption().

◆ m_BatteryEnergyStartMin

float m_BatteryEnergyStartMin = 5.0
protected

Definition at line 180 of file CarScript.c.

Referenced by OnBeforeEngineStart().

◆ m_BatteryHealth

float m_BatteryHealth
protected

Definition at line 170 of file CarScript.c.

Referenced by CarScript(), EEItemAttached(), and EEItemDetached().

◆ m_BatteryRecharge

float m_BatteryRecharge = 0.15
protected

Definition at line 177 of file CarScript.c.

Referenced by GetBatteryRechargeRate().

◆ m_BatteryTimer

float m_BatteryTimer = 0
private

Definition at line 178 of file CarScript.c.

Referenced by OnUpdate().

◆ m_BrakeAmmount

float m_BrakeAmmount
protected

Definition at line 155 of file CarScript.c.

Referenced by OnFluidChanged().

◆ m_BrakesArePressed

bool m_BrakesArePressed
protected

Definition at line 236 of file CarScript.c.

Referenced by OnUpdate(), UpdateLightsClient(), and UpdateLightsServer().

◆ m_CarDoorCloseSound

◆ m_CarDoorOpenSound

◆ m_CarHornLongSoundName

◆ m_CarHornShortSoundName

◆ m_CarHornSoundEffect

ref EffectSound m_CarHornSoundEffect
protected

Definition at line 227 of file CarScript.c.

Referenced by CleanupEffects(), and HandleCarHornSound().

◆ m_CarHornState

int m_CarHornState
protected

Definition at line 243 of file CarScript.c.

Referenced by CarScript(), OnVariablesSynchronized(), and SetCarHornState().

◆ m_CarSeatShiftInSound

string m_CarSeatShiftInSound = ""
protected

Definition at line 215 of file CarScript.c.

Referenced by HandleSeatAdjustmentSound(), and CarScript::OffroadHatchback().

◆ m_CarSeatShiftOutSound

string m_CarSeatShiftOutSound = ""
protected

Definition at line 216 of file CarScript.c.

Referenced by HandleSeatAdjustmentSound(), and CarScript::OffroadHatchback().

◆ m_CarTypeActionsMap

enum CarDoorState m_CarTypeActionsMap = new map<typename, ref TInputActionMap>

Referenced by InitializeActions().

◆ m_ContactCache

ref CarContactCache m_ContactCache
protected

Definition at line 142 of file CarScript.c.

Referenced by CarScript(), CheckContactCache(), and OnContact().

◆ m_CoolantAmmount

float m_CoolantAmmount
protected

Definition at line 153 of file CarScript.c.

Referenced by OnFluidChanged().

◆ m_coolantFx

ref EffVehicleSmoke m_coolantFx
protected

Particles.

Definition at line 183 of file CarScript.c.

Referenced by CleanupEffects(), and EOnPostSimulate().

◆ m_coolantPtcFx

int m_coolantPtcFx
protected

Definition at line 188 of file CarScript.c.

Referenced by CarScript(), and EOnPostSimulate().

◆ m_coolantPtcPos

vector m_coolantPtcPos
protected

Definition at line 194 of file CarScript.c.

Referenced by CarScript(), EOnPostSimulate(), and GetCoolantPtcPosWS().

◆ m_CrashSoundHeavy

ref EffectSound m_CrashSoundHeavy
protected

Definition at line 222 of file CarScript.c.

Referenced by CleanupEffects(), and PlayCrashHeavySound().

◆ m_CrashSoundLight

ref EffectSound m_CrashSoundLight
protected

Definition at line 221 of file CarScript.c.

Referenced by CleanupEffects(), and PlayCrashLightSound().

◆ m_DeadCrewMemberIndices

ref set<int> m_DeadCrewMemberIndices
protected

Definition at line 274 of file CarScript.c.

Referenced by CarScript(), HandleByCrewMemberState(), and MarkCrewMemberDead().

◆ m_dmgContactCoef

float m_dmgContactCoef = 0.058
protected

Definition at line 159 of file CarScript.c.

Referenced by CheckContactCache(), and CarScript::Sedan_02().

◆ m_DrownEnginePoint

string m_DrownEnginePoint = "drown_engine"
staticprotected

Definition at line 254 of file CarScript.c.

◆ m_DrownEnginePos

vector m_DrownEnginePos
staticprotected

Definition at line 164 of file CarScript.c.

Referenced by CarScript(), and GetEnginePosWS().

◆ m_DrownTime

float m_DrownTime
protected

Definition at line 163 of file CarScript.c.

Referenced by OnUpdate().

◆ m_EngineBeforeStart

bool m_EngineBeforeStart
protected

Definition at line 268 of file CarScript.c.

Referenced by OnBeforeEngineStart(), OnEngineStart(), and OnEngineStop().

◆ m_EngineDestroyed

bool m_EngineDestroyed
protected

Definition at line 241 of file CarScript.c.

Referenced by EEKilled().

◆ m_engineFx

ref EffVehicleSmoke m_engineFx
protected

Definition at line 184 of file CarScript.c.

Referenced by CleanupEffects(), and CreateCarDestroyedEffect().

◆ m_EngineHealth

float m_EngineHealth
protected

Definition at line 167 of file CarScript.c.

Referenced by CarPartsHealthCheck(), CarScript(), EOnPostSimulate(), and LeakFluid().

◆ m_enginePos

vector m_enginePos
protected

Definition at line 198 of file CarScript.c.

Referenced by CarScript(), and GetEnginePointPosWS().

◆ m_enginePtcFx

int m_enginePtcFx
protected

Definition at line 187 of file CarScript.c.

Referenced by CarScript(), and CreateCarDestroyedEffect().

◆ m_enginePtcPos

vector m_enginePtcPos
protected

◆ m_EngineStartBattery

◆ m_EngineStartDoOnce

bool m_EngineStartDoOnce
protected

Definition at line 269 of file CarScript.c.

Referenced by OnBeforeEngineStart().

◆ m_EngineStarted

bool m_EngineStarted
protected

Definition at line 240 of file CarScript.c.

Referenced by OnSound(), and SetEngineStarted().

◆ m_EngineStartFuel

◆ m_EngineStartOK

◆ m_EngineStartPlug

◆ m_EngineStopFuel

◆ m_EngineZoneReceivedHit

bool m_EngineZoneReceivedHit
protected

Definition at line 271 of file CarScript.c.

Referenced by HasEngineZoneReceivedHit(), and SetEngineZoneReceivedHit().

◆ m_EnviroHeatComfortOverride

float m_EnviroHeatComfortOverride
protected

Definition at line 160 of file CarScript.c.

Referenced by CarScript().

◆ m_exhaustFx

ref EffVehicleSmoke m_exhaustFx
protected

Definition at line 185 of file CarScript.c.

Referenced by CleanupEffects(), and EOnPostSimulate().

◆ m_exhaustPtcDir

vector m_exhaustPtcDir
protected

Definition at line 192 of file CarScript.c.

Referenced by CarScript(), and EOnPostSimulate().

◆ m_exhaustPtcFx

int m_exhaustPtcFx
protected

Definition at line 189 of file CarScript.c.

Referenced by CarScript(), and EOnPostSimulate().

◆ m_exhaustPtcPos

vector m_exhaustPtcPos
protected

Definition at line 191 of file CarScript.c.

Referenced by CarScript(), and EOnPostSimulate().

◆ m_ForceUpdateLights

bool m_ForceUpdateLights
protected

Definition at line 239 of file CarScript.c.

Referenced by ForceUpdateLightsEnd(), ForceUpdateLightsStart(), and OnUpdate().

◆ m_frontPos

vector m_frontPos
protected

Definition at line 199 of file CarScript.c.

Referenced by CarScript(), and GetFrontPointPosWS().

◆ m_FuelAmmount

float m_FuelAmmount
protected

keeps ammount of each fluid

Definition at line 152 of file CarScript.c.

Referenced by OnFluidChanged().

◆ m_fuelPos

vector m_fuelPos
protected

Definition at line 196 of file CarScript.c.

Referenced by CarScript(), and GetRefillPointPosWS().

◆ m_FuelTankHealth

float m_FuelTankHealth
protected

Definition at line 169 of file CarScript.c.

Referenced by CarPartsHealthCheck(), CarScript(), EOnPostSimulate(), and LeakFluid().

◆ m_Headlight

CarLightBase m_Headlight
protected

Definition at line 245 of file CarScript.c.

Referenced by CleanupEffects(), and UpdateLightsClient().

◆ m_HeadlightsOn

bool m_HeadlightsOn
protected

◆ m_HeadlightsState

bool m_HeadlightsState
protected

◆ m_InputActionMap

TInputActionMap m_InputActionMap

Definition at line 138 of file CarScript.c.

◆ m_LeftHeadlightPoint

string m_LeftHeadlightPoint = "light_left"
staticprotected

Definition at line 250 of file CarScript.c.

Referenced by UpdateLightsClient().

◆ m_LeftHeadlightTargetPoint

string m_LeftHeadlightTargetPoint = "light_left_dir"
staticprotected

Definition at line 252 of file CarScript.c.

Referenced by UpdateLightsClient().

◆ m_MomentumPrevTick

float m_MomentumPrevTick
protected

Definition at line 140 of file CarScript.c.

Referenced by CheckContactCache(), EOnPostSimulate(), and OnContact().

◆ m_NoisePar

ref NoiseParams m_NoisePar
protected

Definition at line 228 of file CarScript.c.

◆ m_NoiseSystem

NoiseSystem m_NoiseSystem
protected

Definition at line 229 of file CarScript.c.

Referenced by EEInit(), and GenerateCarHornAINoise().

◆ m_OilAmmount

float m_OilAmmount
protected

Definition at line 154 of file CarScript.c.

Referenced by OnFluidChanged().

◆ m_PlayCrashSoundHeavy

bool m_PlayCrashSoundHeavy
protected

◆ m_PlayCrashSoundLight

bool m_PlayCrashSoundLight
protected

◆ m_PlugHealth

float m_PlugHealth
protected

Definition at line 171 of file CarScript.c.

Referenced by CarScript(), EEItemAttached(), and EEItemDetached().

◆ m_PreStartSound

ref EffectSound m_PreStartSound
private

Definition at line 225 of file CarScript.c.

Referenced by HandleEngineSound().

◆ m_Radiator

EntityAI m_Radiator
protected

Definition at line 173 of file CarScript.c.

Referenced by EEItemAttached(), EEItemDetached(), GetRadiator(), and HasRadiator().

◆ m_RadiatorHealth

float m_RadiatorHealth
protected

◆ m_RearLight

◆ m_RearLightType

bool m_RearLightType
protected

Definition at line 237 of file CarScript.c.

Referenced by UpdateLightsClient(), and UpdateLightsServer().

◆ m_ReverseLightPoint

string m_ReverseLightPoint = "light_reverse"
staticprotected

Definition at line 249 of file CarScript.c.

Referenced by UpdateLightsClient().

◆ m_RightHeadlightPoint

string m_RightHeadlightPoint = "light_right"
staticprotected

Definition at line 251 of file CarScript.c.

Referenced by UpdateLightsClient().

◆ m_RightHeadlightTargetPoint

string m_RightHeadlightTargetPoint = "light_right_dir"
staticprotected

Definition at line 253 of file CarScript.c.

Referenced by UpdateLightsClient().

◆ m_side_1_1Pos

vector m_side_1_1Pos
protected

Definition at line 201 of file CarScript.c.

Referenced by CarScript(), and Get_1_1PointPosWS().

◆ m_side_1_2Pos

vector m_side_1_2Pos
protected

Definition at line 202 of file CarScript.c.

Referenced by CarScript(), and Get_1_2PointPosWS().

◆ m_side_2_1Pos

vector m_side_2_1Pos
protected

Definition at line 203 of file CarScript.c.

Referenced by CarScript(), and Get_2_1PointPosWS().

◆ m_side_2_2Pos

vector m_side_2_2Pos
protected

Definition at line 204 of file CarScript.c.

Referenced by CarScript(), and Get_2_2PointPosWS().

◆ m_Time

◆ m_UnconsciousCrewMemberIndices

ref set<int> m_UnconsciousCrewMemberIndices
protected

Definition at line 273 of file CarScript.c.

Referenced by CarScript(), HandleByCrewMemberState(), and MarkCrewMemberUnconscious().

◆ m_VelocityPrevTick

vector m_VelocityPrevTick
protected

Definition at line 141 of file CarScript.c.

Referenced by CheckContactCache(), EOnPostSimulate(), and OnContact().

◆ m_WindowLarge

ref EffectSound m_WindowLarge
protected

Definition at line 224 of file CarScript.c.

Referenced by CleanupEffects(), and EEHealthLevelChanged().

◆ m_WindowSmall

ref EffectSound m_WindowSmall
protected

Definition at line 223 of file CarScript.c.

Referenced by CleanupEffects(), and EEHealthLevelChanged().

◆ MEMORY_POINT_NAME_CAR_HORN

const string MEMORY_POINT_NAME_CAR_HORN = "pos_carHorn"
staticprotected

Definition at line 149 of file CarScript.c.

◆ NONE

◆ OFF

enum CarDoorState OFF = 0

◆ REVERSE_ONLY

enum CarDoorState REVERSE_ONLY

◆ RIGHT

◆ SELECTION_ID_BRAKE_LIGHT_L

const int SELECTION_ID_BRAKE_LIGHT_L = 2
staticprotected

Definition at line 260 of file CarScript.c.

Referenced by BrakeLightsShineOff(), and BrakeLightsShineOn().

◆ SELECTION_ID_BRAKE_LIGHT_R

const int SELECTION_ID_BRAKE_LIGHT_R = 3
staticprotected

Definition at line 261 of file CarScript.c.

Referenced by BrakeLightsShineOff(), and BrakeLightsShineOn().

◆ SELECTION_ID_DASHBOARD_LIGHT

const int SELECTION_ID_DASHBOARD_LIGHT = 8
staticprotected

Definition at line 266 of file CarScript.c.

Referenced by DashboardShineOff(), and DashboardShineOn().

◆ SELECTION_ID_FRONT_LIGHT_L

const int SELECTION_ID_FRONT_LIGHT_L = 0
staticprotected

Definition at line 258 of file CarScript.c.

Referenced by LeftFrontLightShineOff(), and LeftFrontLightShineOn().

◆ SELECTION_ID_FRONT_LIGHT_R

const int SELECTION_ID_FRONT_LIGHT_R = 1
staticprotected

Definition at line 259 of file CarScript.c.

Referenced by RightFrontLightShineOff(), and RightFrontLightShineOn().

◆ SELECTION_ID_REVERSE_LIGHT_L

const int SELECTION_ID_REVERSE_LIGHT_L = 4
staticprotected

Definition at line 262 of file CarScript.c.

Referenced by ReverseLightsShineOff(), and ReverseLightsShineOn().

◆ SELECTION_ID_REVERSE_LIGHT_R

const int SELECTION_ID_REVERSE_LIGHT_R = 5
staticprotected

Definition at line 263 of file CarScript.c.

Referenced by ReverseLightsShineOff(), and ReverseLightsShineOn().

◆ SELECTION_ID_TAIL_LIGHT_L

const int SELECTION_ID_TAIL_LIGHT_L = 6
staticprotected

Definition at line 264 of file CarScript.c.

Referenced by TailLightsShineOff(), and TailLightsShineOn().

◆ SELECTION_ID_TAIL_LIGHT_R

const int SELECTION_ID_TAIL_LIGHT_R = 7
staticprotected

Definition at line 265 of file CarScript.c.

Referenced by TailLightsShineOff(), and TailLightsShineOn().

◆ SHORT

enum CarDoorState SHORT = 1

◆ START_NO_BATTERY

enum CarDoorState START_NO_BATTERY

◆ START_NO_FUEL

enum CarDoorState START_NO_FUEL

◆ START_NO_SPARKPLUG

enum CarDoorState START_NO_SPARKPLUG

◆ START_OK

enum CarDoorState START_OK

◆ STARTING

enum CarDoorState STARTING

◆ STOP_OK

enum CarDoorState STOP_OK

◆ typename

enum CarDoorState typename

Base script class for all motorized wheeled vehicles.