DayZ 1.24
Loading...
Searching...
No Matches
ActionPushCar Class Reference
Inheritance diagram for ActionPushCar:
[legend]
Collaboration diagram for ActionPushCar:
[legend]

Private Member Functions

void ActionPushCar ()
 
override GetInputType ()
 
override void CreateConditionComponents ()
 
override bool HasAlternativeInterrupt ()
 
override ActionData CreateActionData ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnUpdate (ActionData action_data)
 
override void OnStart (ActionData action_data)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override void OnEndInput (ActionData action_data)
 
override void WriteToContext (ParamsWriteContext ctx, ActionData action_data)
 
override bool ReadFromContext (ParamsReadContext ctx, out ActionReciveData action_recive_data)
 
override void HandleReciveData (ActionReciveData action_recive_data, ActionData action_data)
 
float GetDirectionDot (Object target, EntityAI player)
 
CarScript GetCar (ActionTarget target)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Detailed Description

Definition at line 126 of file ActionPushCar.c.

Constructor & Destructor Documentation

◆ ActionPushCar()

void ActionPushCar::ActionPushCar ( )
inlineprivate

Definition at line 128 of file ActionPushCar.c.

129 {
131 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_VEHICLE_PUSH;
132 m_FullBody = true;
133 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
134
135 m_Text = "#push_car";
136 }
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CallbackClass, AnimatedActionBase::m_CommandUID, m_FullBody, m_StanceMask, and m_Text.

Member Function Documentation

◆ ActionCondition()

override bool ActionPushCar::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 160 of file ActionPushCar.c.

161 {
162 if (!player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH))
163 return false;
164
165 if (!player.GetSurfaceType())
166 return false;
167
169 return false;
170
171 if (!player.CanConsumeStamina(EStaminaConsumers.PUSH))
172 return false;
173
175 if (car)
176 {
177 if (car.GetGear() != CarGear.NEUTRAL)
178 return false;
179
180 if (Math.AbsFloat(GetDirectionDot(car, player)) < 0.85)
181 return false;
182
183 return true;
184 }
185
186 return false;
187 }
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
EStaminaConsumers
CarScript GetCar(ActionTarget target)
float GetDirectionDot(Object target, EntityAI player)
Definition EnMath.c:7
const float SMALL
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), GetCar(), GetDirectionDot(), IsInReach(), and UAMaxDistances::SMALL.

◆ CreateActionData()

override ActionData ActionPushCar::CreateActionData ( )
inlineprivate

Definition at line 154 of file ActionPushCar.c.

155 {
157 return data;
158 }

◆ CreateConditionComponents()

override void ActionPushCar::CreateConditionComponents ( )
inlineprivate

Definition at line 143 of file ActionPushCar.c.

144 {
147 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetCar()

CarScript ActionPushCar::GetCar ( ActionTarget target)
inlineprivate

Definition at line 300 of file ActionPushCar.c.

301 {
302 if (target.IsProxy())
303 return CarScript.Cast(target.GetParent());
304
305 return CarScript.Cast(target.GetObject());
306 }

Referenced by ActionCondition(), and OnStart().

◆ GetDirectionDot()

float ActionPushCar::GetDirectionDot ( Object target,
EntityAI player )
inlineprivate

Definition at line 295 of file ActionPushCar.c.

296 {
297 return vector.Dot(target.GetDirection(), player.GetDirection());
298 }
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271

References vector::Dot().

Referenced by ActionCondition(), and OnStartServer().

◆ GetInputType()

override ActionPushCar::GetInputType ( )
inlineprivate

Definition at line 138 of file ActionPushCar.c.

◆ HandleReciveData()

override void ActionPushCar::HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )
inlineprivate

◆ HasAlternativeInterrupt()

override bool ActionPushCar::HasAlternativeInterrupt ( )
inlineprivate

Definition at line 149 of file ActionPushCar.c.

150 {
151 return true;
152 }

◆ OnEndInput()

override void ActionPushCar::OnEndInput ( ActionData action_data)
inlineprivate

Definition at line 251 of file ActionPushCar.c.

252 {
253 super.OnEndInput(action_data);
254
256 data.m_State = UA_CANCEL;
257 data.m_EndType = 1;
258 data.m_NeedUpdate = false;
259 }
const int UA_CANCEL
Definition constants.c:437

References UA_CANCEL.

◆ OnEndServer()

override void ActionPushCar::OnEndServer ( ActionData action_data)
inlineprivate

Definition at line 242 of file ActionPushCar.c.

243 {
244 super.OnEndServer(action_data);
245
247 if (data.m_Car)
248 data.m_Car.SetBrakesActivateWithoutDriver(true);
249 }

◆ OnStart()

override void ActionPushCar::OnStart ( ActionData action_data)
inlineprivate

Definition at line 213 of file ActionPushCar.c.

214 {
215 super.OnStart(action_data);
216
218 data.m_Car = GetCar(action_data.m_Target);
219 data.m_Origin = data.m_Car.GetPosition();
220 data.m_NeedUpdate = true;
221 }

References GetCar().

◆ OnStartServer()

override void ActionPushCar::OnStartServer ( ActionData action_data)
inlineprivate

Definition at line 223 of file ActionPushCar.c.

224 {
225 super.OnStartServer(action_data);
226
228
229 if (data.m_Car)
230 {
231 data.m_Car.SetBrake(0.0);
232 data.m_Car.SetHandbrake(0.0);
233 data.m_Car.SetBrakesActivateWithoutDriver(false);
234 }
235
236 data.m_PushDirection = -1;
237 if (GetDirectionDot(data.m_Car, data.m_Player) > 0)
238 data.m_PushDirection = 1;
239
240 }

References GetDirectionDot().

◆ OnUpdate()

override void ActionPushCar::OnUpdate ( ActionData action_data)
inlineprivate

Definition at line 189 of file ActionPushCar.c.

190 {
191 super.OnUpdate(action_data);
192
194 if (data.m_NeedUpdate)
195 {
196 if (!data.m_Player.CanConsumeStamina(EStaminaConsumers.PUSH))
197 {
198 data.m_State = UA_CANCEL;
199 data.m_NeedUpdate = false;
200
201 return;
202 }
203
204 if (vector.Distance(data.m_Car.GetPosition(), data.m_Origin) > 0.5)
205 {
206 data.m_State = UA_FINISHED;
207 data.m_EndType = 0;
208 data.m_NeedUpdate = false;
209 }
210 }
211 }
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
const int UA_FINISHED
Definition constants.c:436

References vector::Distance(), UA_CANCEL, and UA_FINISHED.

◆ ReadFromContext()

override bool ActionPushCar::ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
inlineprivate

Definition at line 270 of file ActionPushCar.c.

271 {
274
275 super.ReadFromContext(ctx, action_recive_data);
276
278 if (!ctx.Read(car))
279 return false;
280
282 receiveData.m_Car = car;
283
284 return true;
285 }

◆ WriteToContext()

override void ActionPushCar::WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
inlineprivate

Definition at line 261 of file ActionPushCar.c.

262 {
263 super.WriteToContext(ctx, action_data);
264
266
267 ctx.Write(data.m_Car);
268 }

The documentation for this class was generated from the following file: