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

Go to the source code of this file.

Classes

class  ActionPushCarDataReceiveData
 
class  CAContinuousRepeatPushCar
 
class  ActionPushCar
 

Functions

override void CreateActionComponent ()
 
override void ProgressActionComponent ()
 
override void EndActionComponent ()
 
void ApplyForce (ActionPushCarData actionData)
 

Variables

ActionPushCarDataReceiveData m_PushDirection = -1
 
int m_EndType = 0
 
float m_HorizontalDirectionRandom = 1.0
 
float m_VerticalDirectionRandom = 1.0
 
vector m_Origin = "0 0 0"
 
bool m_NeedUpdate
 
CarScript m_Car
 
CAContinuousRepeatPushCar PUSH_FORCE_IMPULSE_INCREMENT = 200.0
 
ActionPushCarData m_ActionDataPushCar
 

Function Documentation

◆ ApplyForce()

void ApplyForce ( ActionPushCarData actionData)
protected

Definition at line 101 of file ActionPushCar.c.

102 {
103 CarScript car = actionData.m_Car;
104
105 actionData.m_HorizontalDirectionRandom = Math.RandomFloat(1.0, 3.5);
106 actionData.m_VerticalDirectionRandom = Math.RandomFloat(-0.5, 0.5);
107
108 float bodyMass = dBodyGetMass(car);
109 float invBodyMass = 1.0 / bodyMass;
110 float force = dBodyGetMass(car) * PUSH_FORCE_IMPULSE_INCREMENT * car.GetPushForceCoefficientMultiplier();
111
112 float easedProgress = Easing.EaseInOutSine(actionData.m_ActionComponent.GetProgress());
113
114 vector impulse = car.GetDirection() * force * (float)actionData.m_PushDirection;
116 impulse[0] = impulse[0] * actionData.m_HorizontalDirectionRandom;
117 impulse[1] = impulse[1] * actionData.m_VerticalDirectionRandom;
119
120 actionData.m_Player.DepleteStamina(EStaminaModifiers.PUSH_CAR);
121
122 dBodyApplyImpulseAt(car, impulse, car.ModelToWorld(car.GetEnginePos()));
123 }
CAContinuousRepeatPushCar PUSH_FORCE_IMPULSE_INCREMENT
EStaminaModifiers
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition Easing.c:3
static float EaseInOutSine(float t)
Definition Easing.c:14
Definition EnMath.c:7
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
proto void dBodyApplyImpulseAt(notnull IEntity body, vector impulse, vector pos)
Applies impuls on a pos position in world coordinates.
proto native float dBodyGetMass(notnull IEntity ent)

References dBodyApplyImpulseAt(), dBodyGetMass(), Easing::EaseInOutSine(), PUSH_FORCE_IMPULSE_INCREMENT, and Math::RandomFloat().

Referenced by ProgressActionComponent().

◆ CreateActionComponent()

override void CreateActionComponent ( )
private

Definition at line 57 of file ActionPushCar.c.

58 {
59 m_ActionData.m_ActionComponent = new CAContinuousRepeatPushCar(10.0);
60 }

◆ EndActionComponent()

override void EndActionComponent ( )
private

Definition at line 70 of file ActionPushCar.c.

71 {
72 m_ActionDataPushCar = ActionPushCarData.Cast(m_ActionData);
73
75 {
76 super.EndActionComponent();
77 return;
78 }
79
80 if (m_ActionDataPushCar.m_State == UA_FINISHED)
81 {
82 if (m_ActionDataPushCar.m_EndType == 1)
83 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
84 else if (m_ActionDataPushCar.m_EndType == 0)
85 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
86 }
87 else if (m_ActionDataPushCar.m_State == UA_CANCEL)
88 {
90 if (action.HasAlternativeInterrupt())
91 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
92 else
93 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
94
95 return;
96 }
97
99 }
ActionPushCarData m_ActionDataPushCar
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
const int UA_FINISHED
Definition constants.c:436
const int UA_CANCEL
Definition constants.c:437

References m_ActionDataPushCar, UA_CANCEL, and UA_FINISHED.

◆ ProgressActionComponent()

override void ProgressActionComponent ( )
private

Definition at line 62 of file ActionPushCar.c.

63 {
64 super.ProgressActionComponent();
65
66 ActionPushCarData data = ActionPushCarData.Cast(m_ActionData);
68 }
void ApplyForce(ActionPushCarData actionData)

References ApplyForce().

Variable Documentation

◆ m_ActionDataPushCar

ActionPushCarData m_ActionDataPushCar
private

Definition at line 55 of file ActionPushCar.c.

Referenced by EndActionComponent().

◆ m_Car

CarScript m_Car

Definition at line 17 of file ActionPushCar.c.

◆ m_EndType

int m_EndType = 0

Definition at line 9 of file ActionPushCar.c.

◆ m_HorizontalDirectionRandom

float m_HorizontalDirectionRandom = 1.0

Definition at line 11 of file ActionPushCar.c.

◆ m_NeedUpdate

bool m_NeedUpdate

Definition at line 16 of file ActionPushCar.c.

◆ m_Origin

vector m_Origin = "0 0 0"

Definition at line 14 of file ActionPushCar.c.

◆ m_PushDirection

ActionPushCarDataReceiveData m_PushDirection = -1

◆ m_VerticalDirectionRandom

float m_VerticalDirectionRandom = 1.0

Definition at line 12 of file ActionPushCar.c.

◆ PUSH_FORCE_IMPULSE_INCREMENT

CAContinuousRepeatPushCar PUSH_FORCE_IMPULSE_INCREMENT = 200.0

Referenced by ApplyForce().