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);
73 RegisterNetSyncVariableBool(
"m_EngineZoneReceivedHit");
75 if ( MemoryPointExists(
"refill") )
86 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
99 return TransportOwnerState;
105 return TransportMove;
241 return Random01() * (max - min) + min;
295 return EInventoryIconVisibility.HIDE_VICINITY;
310 return "VehicleTypeUndefined";
349 for (
int i = 0; i < 4; i++)
351 avgPosition = avgPosition + corners[i];
354 avgPosition = avgPosition * 0.25;
357 float depth =
g_Game.GetWaterDepth(avgPosition);
360 vector dirUp = GetDirectionUp();
362 bool testLand = depth < -1.0;
379 for (i = 0; i < 4; i++)
403 int color = 0xFF00FF00;
443 for (
int index = 0; index <
CrewSize(); ++index)
467#ifndef CFGMODS_DEFINE_TEST
468 Error(
"GetAnimInstance() not implemented");
477#ifndef CFGMODS_DEFINE_TEST
478 Error(
"GetSeatAnimationType() not implemented");
485#ifndef CFGMODS_DEFINE_TEST
486 Error(
"Get3rdPersonCameraType() not implemented");
495#ifndef CFGMODS_DEFINE_TEST
504#ifndef CFGMODS_DEFINE_TEST
513#ifndef CFGMODS_DEFINE_TEST
522#ifndef CFGMODS_DEFINE_TEST
532 switch (pDoorSelection)
537 case "DoorsCoDriver":
576 return ( ( e && (e.IsZombie() || e.IsHologram()) ) || o.CanBeSkinned() || o.IsBush() || o.IsTree() );
592 super.GetDebugActions(outputList);
595 if (Gizmo_IsSupported())
603 if (super.OnAction(action_id, player, ctx))
636 GetTransform(transform);
640 CrewEntry( currentSeat, crewPos, crewDir );
645 entry[1] = entry[2] * entry[0];
650 vector position = transform[3];
653 position[1] = position[1] + maxAllowedObjHeight + (extents[1] * 0.5);
658 excluded.Insert(
this);
660 g_Game.IsBoxColliding(position, orientation, extents, excluded, collided);
663 transform[3] = position;
665 foreach (
Object o : collided)
672 if (o.GetCollisionBox(minmax))
679 bool IsAreaAtDoorFree(
int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7 )
684 extents[0] = horizontalExtents;
685 extents[1] = playerHeight;
686 extents[2] = horizontalExtents;
688 return IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform );
691 Shape DebugFreeAreaAtDoor(
int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7 )
693 int color =
ARGB(20, 0, 255, 0);
698 extents[0] = horizontalExtents;
699 extents[1] = playerHeight;
700 extents[2] = horizontalExtents;
702 if (!
IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform ))
704 color =
ARGB(20, 255, 0, 0);
708 shape.SetMatrix(transform);
737 private bool m_bIsDebug;
749 void Reset(
bool isDebug =
false)
751 foreach (
Shape shape : m_DebugShapes)
756 m_DebugShapes.Clear();
758 m_bIsDebug = isDebug;
761 void AddShape(
Shape shape)
763 m_DebugShapes.Insert(shape);
Param4< int, int, string, int > TSelectableActionInfoWithColor
Super root of all classes in Enforce script.
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
bool m_EngineZoneReceivedHit
void MarkCrewMemberDead(int crewMemberIndex)
ref set< int > m_DeadCrewMemberIndices
proto void ApplyTorque(vector force)
Applies constant torque on the physics body.
ref TIntArray m_SingleUseActions
int GetSeatIndexFromDoor(string pDoorSelection)
proto native void LightToggle()
Calls LightOn/LightOff depending on current light state.
proto native float Random01()
Random number in range of <0,1> - !
bool IsIgnoredObject(Object o)
ref TIntArray m_InteractActions
proto native bool LightIsOn()
Returns true when lights are on, false otherwise.
static ref VehicleFlippedContext m_FlippedContext
Shared context across all vehicles for flipping.
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
proto void CrewTransformWS(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in world space.
override bool ShowZonesHealth()
void SetEngineZoneReceivedHit(bool pState)
proto native void CrewGetIn(Human player, int posIdx)
Performs transfer of player from world into vehicle on given position.
bool DetectFlippedUsingSurface(VehicleFlippedContext ctx, float angleTolerance)
proto native void Synchronize()
Synchronizes car's state in case the simulation is not running.
proto void ApplyForce(vector force)
-------------— deterministic physics ---------------------—
proto native float RandomRange(int pRange)
Random number in range of <0,pRange-1> - !
ref set< int > m_UnconsciousCrewMemberIndices
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight, inout vector extents, out vector transform[4])
vector GetRefillPointPosWS()
bool IsFlipped()
Don't override, may change to native for caching 'DetectFlipped' in the future based on active-ness (...
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
proto void CrewEntryWS(int posIdx, out vector pos, out vector dir)
Reads entry point and direction into vehicle on given position in world space.
override event GetOwnerStateType()
ref TIntArray m_ContinuousActions
proto void CrewTransform(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in model space.
proto native void LightOn()
Signals for LightIsOn to return true.
override int GetMeleeTargetType()
Shape DebugFreeAreaAtDoor(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
proto native Human CrewMember(int posIdx)
Returns crew member based on position index. Null can be returned if no Human is present on the given...
proto native int CrewSize()
Returns crew capacity of this vehicle.
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.
void OnInput(float dt)
Called after every input simulation step.
int Get3rdPersonCameraType()
proto native Human CrewDriver()
Returns the driver Null can be returned if no Human is present.
override bool IsHealthVisible()
proto native int CrewPositionIndex(int componentIdx)
Returns crew member index based on action component index. -1 is returned when no crew position corre...
void UpdateLights(int new_gear=-1)
bool OnBeforeLightOn()
Is called by native every time the game wants to turn on the light.
proto void ApplyForceAt(vector pos, vector force)
Applies constant force on the physics body at a position (world space coordinates).
override int GetHideIconMask()
override bool IsIgnoredByConstruction()
float RandomFloat(float min, float max)
Random number in range of <min,max> - !
void MarkCrewMemberUnconscious(int crewMemberIndex)
float GetActionDistanceFuel()
int GetSeatAnimationType(int posIdx)
void OnDriverExit(Human player)
Is called when the crew member leaves the driver seat.
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
bool HasEngineZoneReceivedHit()
void OnUpdateLight()
Is called by native every time the game wants to update the light.
vector GetTransportCameraOffset()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
bool IsActionFlipped(Man player)
Don't override, may change to native for caching 'DetectFlipped' in the future based on active-ness (...
proto native void LightOff()
Signals for LightIsOn to return false.
override event GetMoveType()
proto native int Random()
-------------— deterministic random numbers ---------------------—
proto void ApplyImpulseAt(vector pos, vector force)
Applies impulse on the physics body at a position (world space coordinates).
float GetTransportCameraDistance()
void OnContact(string zoneName, vector localPos, IEntity other, Contact data)
Is called every time when vehicle collides with other object.
void OnUpdate(float dt)
Is called every game frame on client, fixed rate on server.
bool CrewCanGetThrough(int posIdx)
override bool IsTransport()
string GetActionCompNameFuel()
VehicleFlippedContext GetFlipContext()
proto void CrewEntry(int posIdx, out vector pos, out vector dir)
Reads entry point and direction into vehicle on given position in model space.
proto native Human CrewGetOut(int posIdx)
Performs transfer of player from vehicle into world from given position.
proto native int CrewMemberIndex(Human player)
Returns crew member index based on player's instance. -1 is returned when the player is not isnide.
bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance=1.0)
bool DetectFlipped(VehicleFlippedContext ctx)
Override based on vehicle implementation (Car, Boat, modded, etc.).
void OnDriverEnter(Human player)
Is called when the crew member enters the driver seat.
proto void ApplyTorqueImpulse(vector torqueImpulse)
Applies impulse torque on the physics body.
proto void SelectPhysics(Physics physics)
Applies impulses to set the position when dynamic, otherwise sets the transform in the physics scene.
proto void SelectObject(Object object)
Sets the transform of the object directly.
proto native Transport GetTransport()
Internal ancestor of all Entity implementations.
Parameters for detecting the surface.
Object ignore
Object to ignore tracing against, SurfaceTraceType.Roadway only.
SurfaceDetectionType type
Type of surface to detect.
RoadSurfaceDetection rsd
See RoadSurfaceDetection, SurfaceTraceType.Roadway only.
vector position
3D position to trace the surface from
bool includeWater
Include water in the surface detection, will return the water if it is higher than the surface.
Output of surface detection.
float height
Height position.
Native class for boats - handles physics simulation.
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Base native class of all vehicles in game.
void HandleByCrewMemberState(ECrewMemberState state)
ref SurfaceDetectionResult m_SurfaceResult
ref SurfaceDetectionParameters m_SurfaceParams
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto float Normalize()
Normalizes vector.
proto void RotationMatrixFromAngles(out vector mat[3])
Creates rotation matrix from angles.
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
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 native float Random01()
Random number in range of <0,1> - !
Serializer ParamsReadContext
proto GizmoApi GetGizmoApi()
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
void Obsolete(string msg="")
static proto void MatrixMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Transforms matrix.
static proto vector MatrixToAngles(vector mat[3])
Returns angles of rotation matrix.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static const float DEG2RAD
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
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
int ARGB(int a, int r, int g, int b)