Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MineWeaponComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/ScriptWizard", description: "")]
3 {
4 }
5 
6 class SCR_MineWeaponComponent : WeaponComponent
7 {
8  protected IEntity m_FlagEntity;
9 
10  //------------------------------------------------------------------------------------------------
13  bool IsFlagged()
14  {
15  return m_FlagEntity != null;
16  }
17 
18  //------------------------------------------------------------------------------------------------
21  {
22  m_FlagEntity = null;
23  action.GetOnItemPickUp().Remove(OnFlagRemoved);
24  }
25 
26  //------------------------------------------------------------------------------------------------
27  event protected bool RplLoad(ScriptBitReader reader)
28  {
29  return true;
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  event protected bool RplSave(ScriptBitWriter writer)
34  {
35  return true;
36  }
37 
38  //------------------------------------------------------------------------------------------------
40  {
41  if (newSlot != null) // slot is null when removed from inventory
42  m_FlagEntity = null;
43  }
44 
45  //------------------------------------------------------------------------------------------------
46  protected void RegisterToFlag(IEntity flag)
47  {
48  SCR_MineFlagPickUpAction action = FindAction(flag);
49  if (action)
50  action.GetOnItemPickUp().Insert(OnFlagRemoved);
51 
52  InventoryItemComponent itemComponent = InventoryItemComponent.Cast(flag.FindComponent(InventoryItemComponent));
53  if (itemComponent)
54  itemComponent.m_OnParentSlotChangedInvoker.Insert(OnFlagParentSlotChanged);
55  }
56 
57  //------------------------------------------------------------------------------------------------
58  protected SCR_MineFlagPickUpAction FindAction(IEntity flag)
59  {
60  BaseActionsManagerComponent actionManager = BaseActionsManagerComponent.Cast(flag.FindComponent(BaseActionsManagerComponent));
61  if (!actionManager)
62  return null;
63 
64  array<BaseUserAction> actions = {};
65  int count = actionManager.GetActionsList(actions);
67 
68  for (int i = 0; i < count; i++)
69  {
70  action = SCR_MineFlagPickUpAction.Cast(actions[i]);
71  if (action)
72  break;
73  }
74 
75  return action;
76  }
77 
78  //------------------------------------------------------------------------------------------------
81  void SetFlag(IEntity flag)
82  {
83  if (m_FlagEntity)
84  return; // This should never happen!
85 
86  m_FlagEntity = flag;
87 
88  if (flag)
89  RegisterToFlag(flag);
90  }
91 }
RegisterToFlag
protected void RegisterToFlag(IEntity flag)
Definition: SCR_MineWeaponComponent.c:46
IsFlagged
bool IsFlagged()
Definition: SCR_MineWeaponComponent.c:13
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
InventoryStorageSlot
Definition: InventoryStorageSlot.c:12
SetFlag
void SetFlag(IEntity flag)
Definition: SCR_MineWeaponComponent.c:81
SCR_MineFlagPickUpAction
Definition: SCR_MineFlagPickUpAction.c:2
FindAction
protected SCR_MineFlagPickUpAction FindAction(IEntity flag)
Definition: SCR_MineWeaponComponent.c:58
RplSave
event protected bool RplSave(ScriptBitWriter writer)
Definition: SCR_MineWeaponComponent.c:33
m_FlagEntity
SCR_MineWeaponComponentClass m_FlagEntity
SCR_MineWeaponComponentClass
Definition: SCR_MineWeaponComponent.c:2
RplLoad
event protected bool RplLoad(ScriptBitReader reader)
Definition: SCR_MineWeaponComponent.c:27
InventoryItemComponent
Definition: InventoryItemComponent.c:12
OnFlagParentSlotChanged
protected void OnFlagParentSlotChanged(InventoryStorageSlot oldSlot, InventoryStorageSlot newSlot)
Definition: SCR_MineWeaponComponent.c:39
OnFlagRemoved
void OnFlagRemoved(SCR_MineFlagPickUpAction action)
Definition: SCR_MineWeaponComponent.c:20
WeaponComponentClass
Definition: WeaponComponent.c:12
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180