12 class ForcedActionData
24 bool m_DetectFromItem;
25 bool m_DetectFromTarget;
26 bool m_DetectFromPlayer;
35 ref ForcedActionData m_ForcedActionData;
47 m_ForcedTarget =
null;
48 m_ForcedActionData =
null;
52 m_JustActivate =
false;
53 m_DetectFromTarget =
false;
54 m_DetectFromItem =
true;
55 m_DetectFromPlayer =
true;
66 Debug.ActionLog(
"n/a",this.
ToString(),
"n/a",
"Init()", player.ToString());
71 void SetEnablity(
bool value)
76 protected void SetInput(
string input_name)
78 m_input =
GetUApi().GetInputByName(input_name).GetPersistentWrapper();
82 if (m_input && m_input.InputP())
83 Debug.ActionLog(
"(+) input set to " + input_name ,this.
ToString(),
"n/a",
"SetInput()",
"n/a");
85 Debug.ActionLog(
"(-) input is not set to " + input_name ,this.
ToString(),
"n/a",
"SetInput()",
"n/a");
96 return m_input.InputP();
101 return m_JustActivate;
119 m_JustActivate =
false;
123 switch ( m_InputType )
126 m_JustActivate =
false;
129 m_Active = m_input.InputP().LocalHold();
133 m_Active = m_input.InputP().LocalHoldBegin();
134 m_JustActivate = m_Active;
138 m_Active = m_input.InputP().LocalClick();
139 m_JustActivate = m_Active;
142 m_Active = m_input.InputP().LocalDoubleClick();
143 m_JustActivate = m_Active;
147 m_Active = m_input.InputP().LocalHoldBegin();
148 m_JustActivate = m_Active;
152 m_JustActivate =
false;
155 if ( m_input.InputP().LocalClick() )
162 m_Active = m_input.InputP().LocalClick();
163 m_JustActivate = m_Active;
175 ActionsSelectReset();
207 int GetPossibleActionIndex()
219 ActionsSelectReset();
227 void ActionsSelectReset()
232 m_ForcedActionData =
new ForcedActionData;
233 m_ForcedActionData.m_Action = action;
234 m_ForcedActionData.m_Target = target;
235 m_ForcedActionData.m_Item = item;
240 m_ForcedTarget = target;
243 void ClearForcedAction()
245 m_ForcedActionData =
null;
248 void ClearForcedTarget()
250 m_ForcedTarget = NULL;
255 if (m_ForcedActionData)
257 if (m_ForcedActionData.m_Action.Can(player, m_ForcedActionData.m_Target, m_ForcedActionData.m_Item))
260 m_Target = m_ForcedActionData.m_Target;
267 void SelectNextAction()
271 void SelectPrevAction()
274 int GetPossibleActionsCount()
281 return m_input != NULL;
303 super.ForceAction(action, target, item);
310 if ( !action_source_object )
315 action_source_object.GetActions(this.
Type(), possible_actions);
320 for (
int i = 0; i < possible_actions.Count(); i++)
322 action =
ActionBase.Cast(possible_actions.Get(i));
324 if ( action.HasVariants() )
327 action.GetVariants( variant_actions);
328 for (
int j = 0; j < variant_actions.Count(); j++)
330 action = variant_actions[j];
333 select_actions_all.Insert(action);
334 if (action.HasTarget())
335 has_any_action_target =
true;
343 select_actions_all.Insert(action);
344 if (action.HasTarget())
345 has_any_action_target =
true;
354 if ( ForceActionCheck(player))
363 target = m_ForcedTarget;
376 if( m_DetectFromItem )
382 if( m_DetectFromTarget )
388 if( m_DetectFromPlayer )
393 if ( select_actions_all.Count() )
396 for ( i = 0; i < select_actions_all.Count(); i++ )
401 if ( action.HasTarget() )
416 action.OnActionInfoUpdate(player, target, item);
435 action.OnActionInfoUpdate(player, target, item);
458 m_Player.GetActionManager().SelectFirstActionCategory();
528 m_DetectFromTarget =
true;
529 m_DetectFromItem =
false;
530 m_DetectFromPlayer =
true;
542 override void OnActionStart()
544 super.OnActionStart();
548 override bool WasEnded()
558 m_DetectFromTarget =
false;
571 return m_ForcedActionData.m_Action;
581 for (
int i = 0; i < possible_actions.Count(); i++)
583 action =
ActionBase.Cast(possible_actions.Get(i));
611 m_DetectFromTarget =
false;
612 m_DetectFromItem =
true;
613 m_DetectFromPlayer =
true;
625 super.ActionsSelectReset();
638 override void OnActionStart()
640 super.OnActionStart();
644 override bool WasEnded()
668 m_DetectFromItem =
false;
669 m_DetectFromTarget =
false;
670 m_DetectFromPlayer =
false;
675 if (ForceActionCheck(player))
687 if (player && player.IsInVehicle())
692 Transport trans = vehCommand.GetTransport();
706 target = m_ForcedTarget;
709 if (target && target.GetObject())
711 target.GetObject().GetActions(this.
Type(), possibleActions);
714 for (i = 0; i < possibleActions.Count(); i++)
716 action =
ActionBase.Cast(possibleActions.Get(i));
717 if (action.Can(player, target,
m_MainItem, action_condition_mask))
740 m_DetectFromItem =
false;
741 m_DetectFromTarget =
false;
742 m_DetectFromPlayer =
false;
759 if( ForceActionCheck(player) )
772 if ( player && !player.IsInVehicle() )
774 Clothing headgear =
Clothing.Cast(player.FindAttachmentBySlotName(
"Headgear"));
775 Clothing eyewear =
Clothing.Cast(player.FindAttachmentBySlotName(
"Eyewear"));
778 if ( headgear && headgear.GetLightSourceItem() )
781 ForceActionTarget(target_new);
783 else if ( eyewear && eyewear.GetLightSourceItem() )
786 ForceActionTarget(target_new);
791 else if ( player && player.IsInVehicle() )
796 Transport trans = vehCommand.GetTransport();
800 ForceActionTarget(target_new);
808 target = m_ForcedTarget;
811 if(target && target.GetObject())
813 target.GetObject().GetActions(this.
Type(), possible_actions);
816 for (i = 0; i < possible_actions.Count(); i++)
818 action =
ActionBase.Cast(possible_actions.Get(i));
819 if ( action.Can(player, target,
m_MainItem, action_condition_mask) )
848 if( ForceActionCheck(player) )
863 Mich2001Helmet helmet = Mich2001Helmet.Cast(player.FindAttachmentBySlotName(
"Headgear"));
864 NVGHeadstrap headstrap = NVGHeadstrap.Cast(player.FindAttachmentBySlotName(
"Eyewear"));
869 ForceActionTarget(target_new);
871 else if ( headstrap )
874 ForceActionTarget(target_new);
880 target = m_ForcedTarget;
883 if(target && target.GetObject())
885 target.GetObject().GetActions(this.
Type(), possible_actions);
888 for (i = 0; i < possible_actions.Count(); i++)
890 action =
ActionBase.Cast(possible_actions.Get(i));
891 if ( action.Can(player, target,
m_MainItem, action_condition_mask) )