Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_DeployInventoryItemBaseAction.c
Go to the documentation of this file.
2{
4 protected bool m_bActionStarted;
5
6 //------------------------------------------------------------------------------------------------
7 override bool CanBeShownScript(IEntity user)
8 {
10 return false;
11
12 return m_DeployableItemComp.CanDeployBeShown(user);
13 }
14
15 //------------------------------------------------------------------------------------------------
16 override bool CanBePerformedScript(IEntity user)
17 {
19 return false;
20
21 return m_bActionStarted || !m_DeployableItemComp.IsDeploying();
22 }
23
24 //------------------------------------------------------------------------------------------------
25 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
26 {
28 return;
29
30 m_DeployableItemComp.Deploy(pUserEntity);
31 GetGame().GetCallqueue().CallLater(ResetDeployingDelayed, 100, param1: pUserEntity); //reset bool later so there is enough time for user action to disappear
32 }
33
34 //------------------------------------------------------------------------------------------------
35 protected void ResetDeployingDelayed(IEntity pUserEntity)
36 {
38 m_DeployableItemComp.SetDeploying(false);
39
40 PlayerController playerController = GetGame().GetPlayerController();
41 if (!playerController)
42 return;
43
44 IEntity controlledEntity = playerController.GetControlledEntity();
45 if (!controlledEntity)
46 return;
47
48 if (pUserEntity == controlledEntity)
49 m_bActionStarted = false;
50 }
51
52 //------------------------------------------------------------------------------------------------
53 override void OnActionStart(IEntity pUserEntity)
54 {
56 return;
57
58 m_DeployableItemComp.SetDeploying(true);
59
60 PlayerController playerController = GetGame().GetPlayerController();
61 if (!playerController)
62 return;
63
64 IEntity controlledEntity = playerController.GetControlledEntity();
65 if (!controlledEntity)
66 return;
67
68 if (pUserEntity == controlledEntity)
69 m_bActionStarted = true;
70 }
71
72 //------------------------------------------------------------------------------------------------
73 override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
74 {
76 return;
77
78 m_DeployableItemComp.SetDeploying(false);
79
80 PlayerController playerController = GetGame().GetPlayerController();
81 if (!playerController)
82 return;
83
84 IEntity controlledEntity = playerController.GetControlledEntity();
85 if (!controlledEntity)
86 return;
87
88 if (pUserEntity == controlledEntity)
89 m_bActionStarted = false;
90 }
91
92 //------------------------------------------------------------------------------------------------
93 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
94 {
95 IEntity owner = GetOwner();
96 if (!owner)
97 return;
98
100 }
101}
ArmaReforgerScripted GetGame()
Definition game.c:1398
proto external IEntity GetOwner()
Returns the parent entity of this action.
proto external Managed FindComponent(typename typeName)
Base class which all deployable inventory items inherit from.
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
override void OnActionStart(IEntity pUserEntity)
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
SCR_BaseDeployableInventoryItemComponent m_DeployableItemComp
override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
Tuple param1