Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
smptanimmeta.c
Go to the documentation of this file.
2 {
5 }
6 
8 {
9  bool m_IsPlaying;
12  int m_AnimID;
16  bool m_Canceled;
17 
19  {
20  }
21 
22  void Init(ParamsReadContext ctx, SymptomManager manager, PlayerBase player)
23  {
24  m_Manager = manager;
25  m_Player = player;
26  }
27 
28  bool IsPlaying()
29  {
30  return m_IsPlaying;
31  }
32 
34  {
35  return m_DestroyRequested;
36  }
37 
39  {
40  m_DestroyRequested = true;
41  SymptomBase Symptom = m_Manager.GetCurrentPrimaryActiveSymptom();
42 
43  if( type == eAnimFinishType.FAILURE)// <--------------- FAILED
44  {
45  if( m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
46  {
47  if( Symptom )
48  {
49  Symptom.AnimationPlayFailed();
50  }
51  }
52  }
53  else if( type == eAnimFinishType.SUCCESS)// <--------------- SUCCESS
54  {
55  if( m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
56  {
57  if( Symptom )
58  {
59  Symptom.AnimationFinish();
60  }
61  }
62  }
63  }
64 
66  {
67  EAnimPlayState played = Play();
68 
69  if(played == EAnimPlayState.FAILED)
70  {
71  m_Manager.OnAnimationFinished(eAnimFinishType.FAILURE);
72  }
73  return played;
74  }
75 
76  protected EAnimPlayState Play();
77 
78  void Update(HumanMovementState movement_state);
79 
80 };
81 
82 class SmptAnimMetaFB extends SmptAnimMetaBase
83 {
84  int m_StanceMask;
85  float m_Duration;
86 
87  void ~SmptAnimMetaFB()
88  {
89  if(m_Player)
90  m_Player.m_isFBsymptomPlaying = false;
91  }
92 
93  override void Init(ParamsReadContext ctx, SymptomManager manager, PlayerBase player)
94  {
95  super.Init(ctx, manager, player);
96  DayZPlayerSyncJunctures.ReadPlayerSymptomFBParams( ctx, m_AnimID, m_StanceMask, m_Duration);
97  }
98 
99  override EAnimPlayState Play()
100  {
101  m_Canceled = false;
102 
103  HumanCommandActionCallback callback = m_Player.GetCommand_Action();
104 
105  if (!callback)
106  {
107  callback = m_Player.GetCommandModifier_Action();
108  }
109  if( callback )
110  {
111  callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
112  m_Canceled = true;
113  }
114 
115  if(!m_Canceled)
116  {
117  SymptomCB anim_callback = SymptomCB.Cast(m_Player.StartCommand_Action(m_AnimID, SymptomCB, m_StanceMask));
118 
119  if(anim_callback)
120  {
121  anim_callback.Init(m_Duration, m_Player);
122  m_IsPlaying = true;
123  m_Player.m_isFBsymptomPlaying = true;
124  return EAnimPlayState.OK;
125  }
126  else
127  {
128  return EAnimPlayState.FAILED;
129  }
130  }
131  return EAnimPlayState.POSTPONED;
132  }
133 }
134 
135 class SmptAnimMetaADD extends SmptAnimMetaBase
136 {
137  bool m_CalledAnimStart;
138  override void Init(ParamsReadContext ctx, SymptomManager manager, PlayerBase player)
139  {
140  super.Init(ctx, manager, player);
141  DayZPlayerSyncJunctures.ReadPlayerSymptomADDParams( ctx, m_AnimID);
142  }
143 
144  override EAnimPlayState Play()
145  {
146  HumanCommandActionCallback callback = m_Player.GetCommand_Action();
147  if (!callback)
148  {
149  callback = m_Player.GetCommandModifier_Action();
150  }
151  if( !callback )
152  {
153  HumanCommandWeapons hcw = m_Player.GetCommandModifier_Weapons();
154  if (hcw && !hcw.IsActionFinished())
155  return EAnimPlayState.FAILED;
156 
157  HumanCommandAdditives ad = m_Player.GetCommandModifier_Additives();
158  if(ad)
159  {
160  //Print("------------------ Playing -----------------");
161  ad.StartModifier(m_AnimID);
162  m_IsPlaying = true;
163 
164  return EAnimPlayState.OK;
165  }
166  }
167  return EAnimPlayState.FAILED;
168  }
169 
170  override void Update(HumanMovementState movement_state)
171  {
172  if( m_IsPlaying )
173  {
174  HumanCommandAdditives ad = m_Player.GetCommandModifier_Additives();
175  if(!ad || !ad.IsModifierActive())
176  {
177  //Print("------------------ Not Playing -----------------");
178  m_Manager.OnAnimationFinished();
179  }
180  else
181  {
182  if(!m_CalledAnimStart)
183  {
184  m_Manager.OnAnimationStarted();
185  m_CalledAnimStart = true;
186  }
187  }
188  }
189  }
190 }
191 
192 
193 class HeatComfortmMetaADD extends SmptAnimMetaADD
194 {
195  override void Update(HumanMovementState movement_state)
196  {
197  //if( movement_state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_WALK || movement_state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_RUN || movement_state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
198  if( movement_state.m_iMovement != DayZPlayerConstants.MOVEMENTIDX_IDLE || movement_state.IsInProne())
199  {
200  HumanCommandAdditives ad = m_Player.GetCommandModifier_Additives();
201  if(ad && ad.IsModifierActive())
202  {
203  ad.CancelModifier();
204  }
205  }
206 
207  super.Update(movement_state);
208  }
209 }
GetGame
proto native CGame GetGame()
HumanCommandAdditives
class HumanCommandWeapons HumanCommandAdditives()
Definition: human.c:1099
AnimFinished
void AnimFinished(eAnimFinishType type)
Definition: smptanimmeta.c:38
SmptAnimMetaADD
Definition: smptanimmeta.c:193
m_CalledAnimStart
class SmptAnimMetaFB extends SmptAnimMetaBase m_CalledAnimStart
m_Player
PlayerBase m_Player
Definition: smptanimmeta.c:11
Play
protected EAnimPlayState Play()
Definition: smptanimmeta.c:144
m_Duration
float m_Duration
Definition: bullethitreaction.c:56
IsDestroyReqested
bool IsDestroyReqested()
Definition: smptanimmeta.c:33
SymptomManager
Definition: statemanager.c:42
SymptomBase
Definition: statebase.c:1
m_SymptomType
int m_SymptomType
Definition: smptanimmeta.c:13
m_DestroyRequested
bool m_DestroyRequested
Definition: smptanimmeta.c:15
HumanMovementState
Definition: human.c:1125
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
m_Canceled
bool m_Canceled
Definition: smptanimmeta.c:16
PlayRequest
EAnimPlayState PlayRequest()
Definition: smptanimmeta.c:65
PlayerBase
Definition: playerbaseclient.c:1
m_IsPlaying
enum eAnimFinishType m_IsPlaying
EAnimPlayState
EAnimPlayState
Definition: statemanager.c:32
Init
void Init(ParamsReadContext ctx, SymptomManager manager, PlayerBase player)
Definition: smptanimmeta.c:22
m_Manager
SymptomManager m_Manager
Definition: smptanimmeta.c:10
IsPlaying
bool IsPlaying()
Definition: smptanimmeta.c:28
Update
void Update(HumanMovementState movement_state)
Definition: smptanimmeta.c:170
FAILURE
@ FAILURE
Definition: smptanimmeta.c:4
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
HumanCommandActionCallback
Definition: statecb.c:1
m_AnimID
int m_AnimID
Definition: smptanimmeta.c:12
DayZPlayerSyncJunctures
Definition: dayzplayersyncjunctures.c:4
m_StateType
int m_StateType
Definition: smptanimmeta.c:14
HumanCommandWeapons
Definition: human.c:986
SUCCESS
@ SUCCESS
Definition: smptanimmeta.c:3
SmptAnimMetaBase
void SmptAnimMetaBase()
Definition: smptanimmeta.c:18
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
eAnimFinishType
eAnimFinishType
Definition: smptanimmeta.c:1
SmptAnimMetaBase
Definition: smptanimmeta.c:82
DayZPlayerInstanceType
DayZPlayerInstanceType
defined in C++
Definition: dayzplayer.c:1058