9#ifdef FEATURE_NETWORK_RECONCILIATION
11class TransportOwnerState : PawnOwnerState
13 proto native
void SetWorldTransform(
vector transform[4]);
14 proto native
void GetWorldTransform(out
vector transform[4]);
16 proto native
void SetLinearVelocity(
vector value);
17 proto native
void GetLinearVelocity(out
vector value);
19 proto native
void SetAngularVelocity(
vector value);
20 proto native
void GetAngularVelocity(out
vector value);
22 proto native
void SetBuoyancySubmerged(
float value);
23 proto native
float GetBuoyancySubmerged();
26 override event void GetTransform(inout
vector transform[4])
28 GetWorldTransform(transform);
33class TransportMove : PawnMove
35 proto native
void SetWorldTransform(vector transform[4]);
36 proto native
void GetWorldTransform(out vector transform[4]);
38 proto native
void SetLinearVelocity(vector value);
39 proto native
void GetLinearVelocity(out vector value);
41 proto native
void SetAngularVelocity(vector value);
42 proto native
void GetAngularVelocity(out vector value);
45 override event void GetTransform(inout vector transform[4])
47 GetWorldTransform(transform);
103 #ifdef DIAG_DEVELOPER
104 static EVehicleDebugOutputType DEBUG_OUTPUT_TYPE;
105 bool m_ContactCalled;
110 RegisterNetSyncVariableBool(
"m_EngineZoneReceivedHit");
112 if ( MemoryPointExists(
"refill") )
146 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
162 return TransportOwnerState;
168 return TransportMove;
304 return Random01() * (max - min) + min;
319 #ifdef DIAG_DEVELOPER
320 m_ContactCalled =
true;
321 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.CONTACT)
323 string output =
"Zone: " + zoneName +
" | Impulse:" + data.
Impulse;
339 contactData.
SetData(localPos, other, momentumDelta);
340 ccd.Insert(contactData);
391 return EInventoryIconVisibility.HIDE_VICINITY;
423 if ( !isVital || !inventory )
428 if (!item || item.IsRuined())
430 if (caller && callbackMethodName)
456 return "VehicleTypeUndefined";
486 GetSelectionList(allSelections);
488 int allSelectionCount = allSelections.Count();
489 for (
int s = 0; s < allSelectionCount; ++s)
491 string selectionAll = allSelections[s];
494 if (animSrc != animSource)
529 for (
int i = 0; i < 4; i++)
531 avgPosition = avgPosition + corners[i];
534 avgPosition = avgPosition * 0.25;
537 float depth =
g_Game.GetWaterDepth(avgPosition);
540 vector dirUp = GetDirectionUp();
542 bool testLand = depth < -1.0;
559 for (i = 0; i < 4; i++)
583 int color = 0xFF00FF00;
623 for (
int index = 0; index <
CrewSize(); ++index)
636 for (
int index = 0; index <
CrewSize(); ++index)
641 indices.Insert(index);
645 positionIndices.Copy(indices);
664#ifndef CFGMODS_DEFINE_TEST
665 Error(
"GetAnimInstance() not implemented");
684#ifndef CFGMODS_DEFINE_TEST
685 Error(
"GetSeatAnimationType() not implemented");
692#ifndef CFGMODS_DEFINE_TEST
693 Error(
"GetSeatAnimationTypeDirectional() not implemented");
700#ifndef CFGMODS_DEFINE_TEST
701 Error(
"Get3rdPersonCameraType() not implemented");
726#ifndef CFGMODS_DEFINE_TEST
735#ifndef CFGMODS_DEFINE_TEST
744#ifndef CFGMODS_DEFINE_TEST
753#ifndef CFGMODS_DEFINE_TEST
763 switch (pDoorSelection)
768 case "DoorsCoDriver":
807 return ( ( e && (e.IsZombie() || e.IsHologram()) ) || o.CanBeSkinned() || o.IsBush() || o.IsTree() );
846 GetTransform(transform);
850 CrewEntry( currentSeat, crewPos, crewDir );
855 entry[1] = entry[2] * entry[0];
868 excluded.Insert(
this);
875 foreach (
Object o : collided)
882 if (o.GetCollisionBox(minmax))
889 bool IsAreaAtDoorFree(
int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7 )
894 extents[0] = horizontalExtents;
895 extents[1] = playerHeight;
896 extents[2] = horizontalExtents;
898 return IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform );
906 return IsAreaAtDoorFree(currentSeat, maxAllowedObjHeight, extents, transform);
909 bool IsAreaAtDoorFreeDiag(
int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7)
914 return IsAreaAtDoorFree(currentSeat, maxAllowedObjHeight, horizontalExtents, playerHeight);
1006 #ifdef DIAG_DEVELOPER
1007 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
1009 super.GetDebugActions(outputList);
1012 if (Gizmo_IsSupported())
1020 if (super.OnAction(action_id, player, ctx))
1054 int color =
ARGB(20, 0, 255, 0);
1059 extents[0] = horizontalExtents;
1060 extents[1] = playerHeight;
1061 extents[2] = horizontalExtents;
1063 if (!
IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform ))
1065 color =
ARGB(20, 255, 0, 0);
1069 shape.SetMatrix(transform);
1074#ifdef DIAG_DEVELOPER
1075enum EVehicleDebugOutputType
1079 DAMAGE_CONSIDERED = 2,
1087 static ref array<ref CrashDebugData> m_CrashData =
new array<ref CrashDebugData>;
1088 static ref CrashDebugData m_CrashDataPoint;
1090 static void SendData(DayZPlayer player)
1098 GetGame().RPCSingleParam(player,
ERPCs.DIAG_VEHICLES_DUMP_CRASH_DATA_CONTENTS,
new Param1<array<ref CrashDebugData>>(m_CrashData),
true, player.GetIdentity());
1102 static void DumpDataArray(array<ref CrashDebugData> dataArray)
1104 Print(
"Vehicle; DamageType; Damage; Zone; Momentum; Momentum Prev; Momentum Delta; Speedometer; SpeedWorld; SpeedWorld Prev; SpeedWorld Delta; Velocity; Velocity Prev; Velocity Dot; TimeStamp (ms); CrewDamageBase; ShockTemp; DMGHealth; DMGShock");
1105 foreach (CrashDebugData data:dataArray)
1111 static void DumpData(CrashDebugData data)
1113 string output = data.m_VehicleType+
";"+data.m_DamageType+
";"+data.m_Damage+
";"+data.m_Zone+
";"+data.m_MomentumCurr+
";"+data.m_MomentumPrev+
";"+data.m_MomentumDelta+
";"+data.m_Speedometer;
1114 output +=
";"+data.m_SpeedWorld+
";"+data.m_SpeedWorldPrev+
";"+data.m_SpeedWorldDelta+
";"+data.m_VelocityCur;
1115 output +=
";"+data.m_VelocityPrev+
";"+data.m_VelocityDot+
";"+data.m_Time+
";"+data.m_CrewDamageBase+
";"+data.m_ShockTemp+
";"+data.m_DMGHealth+
";"+data.m_DMGShock;
1119 string m_VehicleType;
1123 float m_MomentumCurr;
1124 float m_MomentumPrev;
1125 float m_MomentumDelta;
1126 float m_Speedometer;
1128 float m_SpeedWorldPrev;
1129 float m_SpeedWorldDelta;
1130 vector m_VelocityCur;
1131 vector m_VelocityPrev;
1132 float m_VelocityDot;
1134 float m_CrewDamageBase;
1166#ifdef DIAG_DEVELOPER
1168 private bool m_bIsDebug;
1180 void Reset(
bool isDebug =
false)
1182 foreach (
Shape shape : m_DebugShapes)
1187 m_DebugShapes.Clear();
1189 m_bIsDebug = isDebug;
1192 void AddShape(
Shape shape)
1194 m_DebugShapes.Insert(shape);
Param4< int, int, string, int > TSelectableActionInfoWithColor
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
proto GizmoApi GetGizmoApi()
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override void UpdateLights(int new_gear=-1)
override void CleanupEffects()
override string GetAnimSourceFromSelection(string selection)
Super root of all classes in Enforce script.
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
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.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
bool SoundPlay()
Plays sound.
Wrapper class for managing sound through SEffectManager.
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
script counterpart to engine's class Inventory
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native Transport GetTransport()
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
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.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Manager class for managing Effect (EffectParticle, EffectSound)
bool includeWater
Include water in the surface detection, will return the water if it is higher than the surface.
SurfaceDetectionType type
Type of surface to detect.
RoadSurfaceDetection rsd
See RoadSurfaceDetection, SurfaceTraceType.Roadway only.
Object ignore
Object to ignore tracing against, SurfaceTraceType.Roadway only.
vector position
3D position to trace the surface from
float height
Height position.
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Native class for boats - handles physics simulation.
ref SurfaceDetectionParameters m_SurfaceParams
void HandleByCrewMemberState(ECrewMemberState state)
ref SurfaceDetectionResult m_SurfaceResult
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
string GetActionCompNameFuel()
override bool CanPutIntoHands(EntityAI parent)
void OnDriverExit(Human player)
vector m_VelocityPrevTick
void SetEngineZoneReceivedHit(bool pState)
proto void CrewEntry(int posIdx, out vector pos, out vector dir)
Reads entry point and direction into vehicle on given position in model space.
override bool IsHealthVisible()
void OnDriverEnter(Human player)
Shape DebugFreeAreaAtDoor(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
proto void CrewEntryWS(int posIdx, out vector pos, out vector dir)
Reads entry point and direction into vehicle on given position in world space.
void SynchCrashHeavySound(bool play)
vector GetTransportCameraOffset()
float GetWeightCoef()
artificial value that helps to distinguish between different weight categories (mainly for particles)
bool GetCrashHeavySound()
ref VehicleContactData m_ContactData
proto native int CrewMemberIndex(Human player)
bool DetectFlippedUsingSurface(VehicleFlippedContext ctx, float angleTolerance)
ref TIntArray m_ContinuousActions
bool IsAnyCrewPresent(TIntArray positionIndices)
ref TIntArray m_InteractActions
float GetFluidFractionScript(ETransportFluid fluidType)
bool m_PlayCrashSoundLight
float GetTransportCameraDistance()
override int GetHideIconMask()
ref EffectSound m_CrashSoundHeavy
override event GetMoveType()
bool m_EngineZoneReceivedHit
bool NeedElectricitySourceDevice()
EffectSound CreateSoundForAnimationSource(string animSource)
proto void CrewTransformWS(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in world space.
proto native void Synchronize()
Synchronizes car's state in case the simulation is not running.
bool IsIgnoredObject(Object o)
int Get3rdPersonCameraType()
ref EffectSound m_CrashSoundLight
override event GetOwnerStateType()
Managed GetVehicleHornComponent()
component helpers
bool IsFlipped()
Don't override, may change to native for caching 'DetectFlipped' in the future based on active-ness (...
void PlayCrashHeavySound()
string GetElectricitySourceDeviceType()
bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance=1.0)
void FillScript(ETransportFluid fluidType, float amount)
proto void ApplyTorque(vector force)
Applies constant torque on the physics body.
void PlaySound(string soundset, EffectSound sound, out bool soundbool)
override void EEDelete(EntityAI parent)
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
proto native void CrewGetIn(Human player, int posIdx)
Performs transfer of player from world into vehicle on given position.
VehicleFlippedContext GetFlipContext()
void MarkCrewMemberUnconscious(int crewMemberIndex)
EntityAI GetElectricitySourceDevice()
void UpdateBattery(IEntity battery)
proto native void LightToggle()
Calls LightOn/LightOff depending on current light state.
static ref VehicleFlippedContext m_FlippedContext
proto void ApplyCentralImpulse(vector centralImpulse)
Applies impulse on the physics body (at origin).
proto native void CrewDeath(int posIdx)
Handles death of player in vehicle and awakes its physics if needed.
bool m_PlayCrashSoundHeavy
override bool IsDetectableByVicinityCone()
proto native int Random()
-------------— deterministic random numbers ---------------------—
proto void CrewTransform(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in model space.
float GetActionDistanceFuel()
void MarkCrewMemberDead(int crewMemberIndex)
proto native Human CrewDriver()
override int GetMeleeTargetType()
bool IsAreaAtDoorFreeDiag(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
proto native int CrewSize()
Returns crew capacity of this vehicle.
string GetSelectionFromAnimSource(string animSource)
vector GetRefillPointPosWS()
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight, inout vector extents, out vector transform[4])
ref set< int > m_UnconsciousCrewMemberIndices
proto native bool LightIsOn()
Returns true when lights are on, false otherwise.
override bool ShowZonesHealth()
proto native Human CrewGetOut(int posIdx)
Performs transfer of player from vehicle into world from given position.
override bool IsIgnoredByConstruction()
int GetSeatAnimationTypeDirectional(int posIdx, int directionIndex)
void SynchCrashLightSound(bool play)
void PlayCrashLightSound()
void PlaySoundEx(string soundset, EffectSound sound, out bool soundbool)
bool HasEngineZoneReceivedHit()
proto void ApplyForce(vector force)
-------------— deterministic physics ---------------------—
void OnContact(string zoneName, vector localPos, IEntity other, Contact data)
ref TIntArray m_SingleUseActions
bool CrewCanEject(int posIdx)
proto void ApplyTorqueImpulse(vector torqueImpulse)
Applies impulse torque on the physics body.
proto native Human CrewMember(int posIdx)
bool IsActionFlipped(Man player)
Don't override, may change to native for caching 'DetectFlipped' in the future based on active-ness (...
void CheckVitalItemCallback(bool isVital, int slotId, Object caller=null, string callbackMethodName="", Param params=null)
override bool IsTransport()
float RandomFloat(float min, float max)
Random number in range of <min,max> - !!! use this only during deterministic simulation (EOnSimulate/...
string GetAnimSourceFromSelection(string selection)
bool CrewShouldEject(int posIdx)
bool DetectFlipped(VehicleFlippedContext ctx)
Override based on vehicle implementation (Car, Boat, modded, etc.)
int GetSeatIndexFromDoor(string pDoorSelection)
proto native void LightOn()
Signals for LightIsOn to return true.
float m_CrewContactDamageCoef
bool CrewCanGetThrough(int posIdx)
int GetFluidCapacityScript(ETransportFluid fluidType)
fluids
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
proto native int CrewPositionIndex(int componentIdx)
void UpdateLights(int new_gear=-1)
bool IsAreaAtDoorFreeDiag(int currentSeat, float maxAllowedObjHeight, inout vector extents, out vector transform[4])
proto void ApplyForceAt(vector pos, vector force)
Applies constant force on the physics body at a position (world space coordinates).
ref VehicleContactCache m_ContactCache
proto void ApplyImpulseAt(vector pos, vector force)
Applies impulse on the physics body at a position (world space coordinates).
bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
bool HasDirectionalInOutAction()
int GetSeatAnimationType(int posIdx)
proto native float RandomRange(int pRange)
Random number in range of <0,pRange-1> - !!! use this only during deterministic simulation (EOnSimula...
proto native void LightOff()
Signals for LightIsOn to return false.
proto native float Random01()
Random number in range of <0,1> - !!! use this only during deterministic simulation (EOnSimulate/EOnP...
bool GetCrashLightSound()
ref set< int > m_DeadCrewMemberIndices
bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
float m_VehicleContactDamageCoef
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.
proto float Normalize()
Normalizes vector. Returns length.
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
proto native float Random01()
Random number in range of <0,1> - !!! use this only during deterministic simulation (CommandHandler)
Serializer ParamsReadContext
void Error(string err)
Messagebox with error message.
proto void Print(void var)
Prints content of variable to console/log.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
class array< Class T > TStringArray
void Obsolete(string msg="")
@ USER1
Flags for custom usage and filterings.
static proto vector MatrixToAngles(vector mat[3])
Returns angles of rotation matrix.
static proto void MatrixMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Transforms matrix.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static const float DEG2RAD
@ NONE
body is not in simulation, nor in collision world
proto native bool dGetInteractionLayer(notnull IEntity worldEntity, int mask1, int mask2)
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto native float dBodyGetMass(notnull IEntity ent)
proto native int dBodyGetInteractionLayer(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
proto int ToLower()
Changes string to lowercase. Returns length.
int ARGB(int a, int r, int g, int b)