DayZ 1.24
Loading...
Searching...
No Matches
ActionUnfoldMap.c
Go to the documentation of this file.
2{
8
15
17 {
18 if (GetGame() && GetGame().GetMission())
19 {
21 {
22 GetGame().GetMission().RemoveActiveInputExcludes({"map"}, false);
23 }
24 else
25 {
26 GetGame().GetMission().RemoveActiveInputExcludes({"loopedactions"}, false);
27 }
28 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
29 }
30
32 return;
33
34 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
35 if (chernomap && m_ActionData.m_Player.IsMapOpen())
36 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
37 }
38
40 {
42 m_InitMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
43 }
44
46 {
47 return m_CancelCondition;
48 }
49
50 override void OnStateChange(int pOldState, int pCurrentState)
51 {
53 return;
54
56 m_CancelCondition = true;
57 }
58
59 override void OnAnimationEvent(int pEventID)
60 {
62 return;
63
64 switch (pEventID)
65 {
66 case UA_ANIM_EVENT:
67 m_HasReceivedEvent = true;
68 m_FinalMovementState = m_ActionData.m_Player.m_MovementState.m_iStanceIdx;
69
70 if (StateCheck())
71 {
73 m_CancelCondition = false;
74 }
75 else
76 m_CancelCondition = true;
77 break;
78 }
79 }
80
81 override void OnFinish(bool pCanceled)
82 {
84 {
87
88 if ((!GetGame().IsDedicatedServer()) && GetGame().GetUIManager() && GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
89 GetGame().GetUIManager().FindMenu(MENU_MAP).Close();
90
94
95 m_ActionData.m_Player.SetMapClosingSyncSet(false); //reset
96
97 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
98 if (chernomap && m_ActionData.m_Player.IsMapOpen())
99 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
100
101 if (action)
102 action.End(m_ActionData);
103 }
104 }
105
107 {
108 if (m_ActionData.m_Player.IsSwimming() || m_ActionData.m_Player.IsClimbing() || m_ActionData.m_Player.IsFalling() || m_ActionData.m_Player.IsClimbingLadder() || m_ActionData.m_Player.IsUnconscious() || m_ActionData.m_Player.IsRestrained())
109 return;
110
111 ItemMap chernomap = ItemMap.Cast(m_ActionData.m_Player.GetItemInHands());
112 if (chernomap)
113 {
114 if (!m_ActionData.m_Player.IsMapOpen() && !m_MapFolding)
115 {
116 if (m_CancelCondition) //do not open when cancelling in progress
117 return;
118
119 chernomap.SetMapStateOpen(true, m_ActionData.m_Player);
120
121 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
122 {
123 //chernomap.SyncMapMarkers();
124 }
125
126 if (!GetGame().IsDedicatedServer())
127 {
128 UIManager m_UIManager;
130 m_UIManager = GetGame().GetUIManager();
131 m_UIManager.CloseAll();
133 {
134 mapMenu = m_UIManager.EnterScriptedMenu(MENU_MAP, null);
135 mapMenu.InitMapItem(chernomap);
136 mapMenu.LoadMapMarkers();
137 GetGame().GetMission().AddActiveInputExcludes({"map"});
138 }
139 else
140 {
141 GetGame().GetMission().AddActiveInputExcludes({"loopedactions"});
142 }
143
144 GetGame().GetMission().AddActiveInputRestriction(EInputRestrictors.MAP);
145 }
146 }
147 else if (m_ActionData.m_Player.IsMapOpen())
148 {
149 chernomap.SetMapStateOpen(false, m_ActionData.m_Player);
150 m_MapFolding = true;
151 m_ActionData.m_Player.SetMapOpen(false);
152 }
153 }
154 }
155
157 {
159 }
160}
161
162class ActionUnfoldMap: ActionBase
163{
164 void ActionUnfoldMap()
166 m_Text = "#unfold_map";
169 override bool IsInstant()
170 {
171 return false;
172 }
173
175 {
179
180 override bool HasTarget()
181 {
182 return false;
183 }
184
185 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
186 {
187 if (player.m_hac || player.IsMapOpen())
188 return false;
189 return true;
190 }
191
192 override int GetActionCategory()
193 {
194 return AC_SINGLE_USE;
195 }
196
198 {
200 }
203 {
205 ItemMap chernomap = ItemMap.Cast(action_data.m_MainItem);
206 chernomap.SyncMapMarkers();
208
210 {
211 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
213 }
214
216 {
217 if (action_data.m_Player.m_hac)
218 {
219 action_data.m_Player.m_hac.m_MapFolding = true;
220 action_data.m_Player.m_hac.PerformMapChange();
221 action_data.m_Player.m_hac.Cancel();
222 }
223 else //should never get here, End called from the callback
225 }
226
228 {
229 if (!action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE))
230 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_VIEWMAP, ActionUnfoldMapCB));
231 else
232 action_data.m_Player.m_hac = ActionUnfoldMapCB.Cast(action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_VIEWMAP, ActionUnfoldMapCB, DayZPlayerConstants.STANCEMASK_PRONE));
233
234 // sets player for associated callback to use
235 if (action_data.m_Player.m_hac)
236 {
237 action_data.m_Player.m_hac.SetActionData(action_data);
238 action_data.m_Callback = action_data.m_Player.m_hac;
239 }
240 }
241};
const int AC_SINGLE_USE
Definition _constants.c:2
string m_Text
Definition ActionBase.c:49
void CreateConditionComponents()
Definition ActionBase.c:196
bool HasTarget()
Definition ActionBase.c:210
int GetActionCategory()
Definition ActionBase.c:244
void OnStartClient(ActionData action_data)
Definition ActionBase.c:946
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
void OnStartServer(ActionData action_data)
Definition ActionBase.c:949
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
void OnEndRequest(ActionData action_data)
Definition ActionBase.c:586
bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBase.c:350
bool IsInstant()
Definition ActionBase.c:228
void Interrupt()
ActionUnfoldMapCB ActionBaseCB ActionUnfoldMap()
void OpenMap(ActionData action_data)
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
void End()
called on surrender end request end
ActionData m_ActionData
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionBase m_Action
Definition ActionBase.c:27
override void SetActionData(ActionData action_data)
override void OnFinish(bool pCanceled)
override void OnAnimationEvent(int pEventID)
override void OnStateChange(int pOldState, int pCurrentState)
proto native UIScriptedMenu EnterScriptedMenu(int id, UIMenuPanel parent)
Create & open menu with specific id (see MenuID) and set its parent.
bool CloseAll()
Close all opened menus.
Definition UIManager.c:76
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
const int MENU_MAP
Definition constants.c:181
const int UA_FINISHED
Definition constants.c:436
const int UA_ANIM_EVENT
Definition constants.c:443
static const int STATE_LOOP_IN
looped state
Definition human.c:351
proto native void EnableCancelCondition(bool pEnable)
proto native void EnableStateChangeCallback()
enables state change callback OnStateChange
static const int STATE_LOOP_LOOP
Definition human.c:352