4#ifdef FEATURE_NETWORK_RECONCILIATION
6class TransportOwnerState : PawnOwnerState
8 proto native
void SetWorldTransform(
vector transform[4]);
9 proto native
void GetWorldTransform(out
vector transform[4]);
11 proto native
void SetLinearVelocity(
vector value);
12 proto native
void GetLinearVelocity(out
vector value);
14 proto native
void SetAngularVelocity(
vector value);
15 proto native
void GetAngularVelocity(out
vector value);
17 proto native
void SetBuoyancySubmerged(
float value);
18 proto native
float GetBuoyancySubmerged();
21 override event void GetTransform(inout
vector transform[4])
23 GetWorldTransform(transform);
28class TransportMove : PawnMove
30 proto native
void SetWorldTransform(
vector transform[4]);
31 proto native
void GetWorldTransform(out
vector transform[4]);
33 proto native
void SetLinearVelocity(
vector value);
34 proto native
void GetLinearVelocity(out
vector value);
36 proto native
void SetAngularVelocity(
vector value);
37 proto native
void GetAngularVelocity(out
vector value);
40 override event void GetTransform(inout
vector transform[4])
42 GetWorldTransform(transform);
68 RegisterNetSyncVariableBool(
"m_EngineZoneReceivedHit");
70 if ( MemoryPointExists(
"refill") )
71 m_fuelPos = GetMemoryPointPos(
"refill");
75 m_UnconsciousCrewMemberIndices =
new set<int>();
76 m_DeadCrewMemberIndices =
new set<int>();
81 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
83 SetEngineZoneReceivedHit(dmgZone ==
"Engine");
94 return TransportOwnerState;
100 return TransportMove;
138 proto native
void CrewGetIn( Human player,
int posIdx );
185 return Random01() * (max - min) + min;
236 return EInventoryIconVisibility.HIDE_VICINITY;
251 return "VehicleTypeUndefined";
266 return ModelToWorld( m_fuelPos );
271 if (!m_FlippedContext)
280 return m_FlippedContext;
290 for (
int i = 0; i < 4; i++)
292 avgPosition = avgPosition + corners[i];
295 avgPosition = avgPosition * 0.25;
301 vector dirUp = GetDirectionUp();
303 bool testLand = depth < -1.0;
312 ctx.m_SurfaceParams.includeWater =
false;
315 ctx.m_SurfaceParams.ignore =
this;
318 ctx.m_SurfaceParams.rsd = RoadSurfaceDetection.CLOSEST;
320 for (i = 0; i < 4; i++)
322 ctx.m_SurfaceParams.position = corners[i];
326 corners[i][1] = ctx.m_SurfaceResult.height;
339 bool isFlipped =
vector.Dot(normal, dirUp) <
Math.Cos(angleTolerance *
Math.DEG2RAD);
344 int color = 0xFF00FF00;
368 ctx.m_bIsAction =
false;
369 ctx.m_ActionPlayer = null;
370 return DetectFlipped(ctx);
377 ctx.m_bIsAction =
true;
378 ctx.m_ActionPlayer = player;
379 return DetectFlipped(ctx);
384 for (
int index = 0; index < CrewSize(); ++index)
386 if (CrewMember(index) != null)
408#ifndef CFGMODS_DEFINE_TEST
409 Error(
"GetAnimInstance() not implemented");
418#ifndef CFGMODS_DEFINE_TEST
419 Error(
"GetSeatAnimationType() not implemented");
426#ifndef CFGMODS_DEFINE_TEST
427 Error(
"Get3rdPersonCameraType() not implemented");
436#ifndef CFGMODS_DEFINE_TEST
445#ifndef CFGMODS_DEFINE_TEST
454#ifndef CFGMODS_DEFINE_TEST
463#ifndef CFGMODS_DEFINE_TEST
473 switch (pDoorSelection)
478 case "DoorsCoDriver":
505 if (
Class.CastTo(player, o))
508 HumanCommandVehicle hcv = player.GetCommand_Vehicle();
509 if (hcv && hcv.GetTransport() ==
this)
517 return ( ( e && (e.IsZombie() || e.IsHologram()) ) || o.CanBeSkinned() || o.IsBush() || o.IsTree() );
522 m_EngineZoneReceivedHit = pState;
528 return m_EngineZoneReceivedHit;
533 super.GetDebugActions(outputList);
536 if (Gizmo_IsSupported())
544 if (super.OnAction(action_id, player, ctx))
552 GetGame().GizmoSelectObject(
this);
555 GetGame().GizmoSelectPhysics(GetPhysics());
575 GetTransform(transform);
579 CrewEntry( currentSeat, crewPos, crewDir );
583 entry[0] =
vector.Up * crewDir;
584 entry[1] = entry[2] * entry[0];
587 Math3D.MatrixMultiply4( transform, entry, transform );
589 vector position = transform[3];
592 position[1] = position[1] + maxAllowedObjHeight + (extents[1] * 0.5);
597 excluded.Insert(
this);
601 orientation.RotationMatrixFromAngles(transform);
602 transform[3] = position;
604 foreach (
Object o : collided)
607 if (IsIgnoredObject(o))
611 if (o.GetCollisionBox(minmax))
618 bool IsAreaAtDoorFree(
int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7 )
623 extents[0] = horizontalExtents;
624 extents[1] = playerHeight;
625 extents[2] = horizontalExtents;
627 return IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform );
630 Shape DebugFreeAreaAtDoor(
int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7 )
632 int color =
ARGB(20, 0, 255, 0);
637 extents[0] = horizontalExtents;
638 extents[1] = playerHeight;
639 extents[2] = horizontalExtents;
641 if (!
IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform ))
643 color =
ARGB(20, 255, 0, 0);
646 Shape shape =
Debug.DrawBox(-extents * 0.5, extents * 0.5, color);
647 shape.SetMatrix(transform);
668 bool m_bIsAction =
false;
676 private bool m_bIsDebug;
688 void Reset(
bool isDebug =
false)
690 foreach (
Shape shape : m_DebugShapes)
695 m_DebugShapes.Clear();
697 m_bIsDebug = isDebug;
700 void AddShape(
Shape shape)
702 m_DebugShapes.Insert(shape);
Param4< int, int, string, int > TSelectableActionInfoWithColor
proto native float GetWaterDepth(vector posWS)
proto native bool IsBoxColliding(vector center, vector orientation, vector edgeLength, array< Object > excludeObjects, array< Object > collidedObjects=NULL)
Finds all objects that are in choosen oriented bounding box (OBB)
proto native bool GetSurface(SurfaceDetectionParameters params, SurfaceDetectionResult result)
API for surface detection.
Super root of all classes in Enforce script.
bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
override bool IsHealthVisible()
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
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 OnDriverEnter(Human player)
bool DetectFlippedUsingSurface(VehicleFlippedContext ctx, float angleTolerance)
float GetActionDistanceFuel()
bool DetectFlipped(VehicleFlippedContext ctx)
Override based on vehicle implementation (Car, Boat, modded, etc.)
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 ShowZonesHealth()
bool m_EngineZoneReceivedHit
bool IsActionFlipped(Man player)
Don't override, may change to native for caching 'DetectFlipped' in the future based on active-ness (...
override int GetHideIconMask()
proto native Human CrewMember(int posIdx)
proto void CrewTransform(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in model space.
proto native Human CrewGetOut(int posIdx)
Performs transfer of player from vehicle into world from given position.
float GetTransportCameraDistance()
override int GetMeleeTargetType()
override event GetOwnerStateType()
void OnContact(string zoneName, vector localPos, IEntity other, Contact data)
proto native float Random01()
Random number in range of <0,1> - !!! use this only during deterministic simulation (EOnSimulate/EOnP...
void MarkCrewMemberUnconscious(int crewMemberIndex)
proto native int Random()
-------------— deterministic random numbers ---------------------—
void SetEngineZoneReceivedHit(bool pState)
proto native int CrewPositionIndex(int componentIdx)
proto native int CrewMemberIndex(Human player)
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight, inout vector extents, out vector transform[4])
override bool IsTransport()
proto native Human CrewDriver()
string GetActionCompNameFuel()
VehicleFlippedContext GetFlipContext()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
proto native void Synchronize()
Synchronizes car's state in case the simulation is not running.
float RandomFloat(float min, float max)
Random number in range of <min,max> - !!! use this only during deterministic simulation (EOnSimulate/...
override event GetMoveType()
proto void CrewTransformWS(int posIdx, out vector mat[4])
Returns crew transformation indside vehicle in world space.
vector GetTransportCameraOffset()
proto native int CrewSize()
Returns crew capacity of this vehicle.
bool CrewCanGetThrough(int posIdx)
int GetSeatIndexFromDoor(string pDoorSelection)
bool IsFlipped()
Don't override, may change to native for caching 'DetectFlipped' in the future based on active-ness (...
proto native void CrewGetIn(Human player, int posIdx)
Performs transfer of player from world into vehicle on given position.
Shape DebugFreeAreaAtDoor(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
int GetSeatAnimationType(int posIdx)
bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
bool HasEngineZoneReceivedHit()
int Get3rdPersonCameraType()
ref set< int > m_DeadCrewMemberIndices
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
void MarkCrewMemberDead(int crewMemberIndex)
override bool IsIgnoredByConstruction()
bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance=1.0)
ref set< int > m_UnconsciousCrewMemberIndices
proto native void CrewDeath(int posIdx)
Handles death of player in vehicle and awakes its physics if needed.
vector GetRefillPointPosWS()
proto native float RandomRange(int pRange)
Random number in range of <0,pRange-1> - !!! use this only during deterministic simulation (EOnSimula...
void OnDriverExit(Human player)
bool IsIgnoredObject(Object o)
Serialization general interface. Serializer API works with:
Native class for boats - handles physics simulation.
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
void HandleByCrewMemberState(ECrewMemberState state)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float Random01()
Random number in range of <0,1> - !!! use this only during deterministic simulation (CommandHandler)
vector m_LocalPos
Cached local pos.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
void Obsolete(string msg="")
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.
ref TIntArray m_SingleUseActions
ref TIntArray m_InteractActions
ref TIntArray m_ContinuousActions
int ARGB(int a, int r, int g, int b)