Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlayerRadioSpawnPoint.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/GameMode", description: "")]
3 {
4 }
5 
6 class SCR_PlayerRadioSpawnPoint : SCR_PlayerSpawnPoint
7 {
8  //------------------------------------------------------------------------------------------------
9  protected void OnItemAdded(IEntity item, BaseInventoryStorageComponent storageOwner)
10  {
11  BaseLoadoutClothComponent loadoutCloth = BaseLoadoutClothComponent.Cast(item.FindComponent(BaseLoadoutClothComponent));
12  if (loadoutCloth && loadoutCloth.GetAreaType() && loadoutCloth.GetAreaType().IsInherited(LoadoutBackpackArea) && item.FindComponent(SCR_RadioComponent))
13  super.ActivateSpawnPoint();
14  }
15 
16  //------------------------------------------------------------------------------------------------
17  protected void OnItemRemoved(IEntity item, BaseInventoryStorageComponent storageOwner)
18  {
19  BaseLoadoutClothComponent loadoutCloth = BaseLoadoutClothComponent.Cast(item.FindComponent(BaseLoadoutClothComponent));
20  if (loadoutCloth && loadoutCloth.GetAreaType() && loadoutCloth.GetAreaType().IsInherited(LoadoutBackpackArea) && item.FindComponent(SCR_RadioComponent))
21  super.DeactivateSpawnPoint();
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  override protected void ActivateSpawnPoint()
26  {
27  //--- Track when the player picks up or drops radio backpack
28  SCR_InventoryStorageManagerComponent inventoryManager = SCR_InventoryStorageManagerComponent.Cast(m_TargetPlayer.FindComponent(SCR_InventoryStorageManagerComponent));
29  if (inventoryManager)
30  {
31  inventoryManager.m_OnItemAddedInvoker.Insert(OnItemAdded);
32  inventoryManager.m_OnItemRemovedInvoker.Insert(OnItemRemoved);
33  }
34 
35  //--- If the player currently has a radio backpack, activate the spawn point instantly
36  EquipedLoadoutStorageComponent loadoutStorage = EquipedLoadoutStorageComponent.Cast(m_TargetPlayer.FindComponent(EquipedLoadoutStorageComponent));
37  if (loadoutStorage)
38  {
39  IEntity backpack = loadoutStorage.GetClothFromArea(LoadoutBackpackArea);
40  if (backpack)
41  OnItemAdded(backpack, null);
42  }
43  }
44 
45  //------------------------------------------------------------------------------------------------
46  override protected void DeactivateSpawnPoint()
47  {
48  if (m_TargetPlayer)
49  {
50  SCR_InventoryStorageManagerComponent inventoryManager = SCR_InventoryStorageManagerComponent.Cast(m_TargetPlayer.FindComponent(SCR_InventoryStorageManagerComponent));
51  if (inventoryManager)
52  {
53  inventoryManager.m_OnItemAddedInvoker.Remove(OnItemAdded);
54  inventoryManager.m_OnItemRemovedInvoker.Remove(OnItemRemoved);
55  }
56  }
57 
58  super.DeactivateSpawnPoint();
59  }
60 }
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
OnItemRemoved
protected void OnItemRemoved(IEntity item, BaseInventoryStorageComponent storageOwner)
Definition: SCR_PlayerRadioSpawnPoint.c:17
DeactivateSpawnPoint
override protected void DeactivateSpawnPoint()
Definition: SCR_PlayerRadioSpawnPoint.c:46
LoadoutBackpackArea
Definition: LoadoutBackpackArea.c:12
OnItemAdded
SCR_PlayerRadioSpawnPointClass SCR_PlayerSpawnPointClass OnItemAdded(IEntity item, BaseInventoryStorageComponent storageOwner)
Definition: SCR_PlayerRadioSpawnPoint.c:9
SCR_PlayerRadioSpawnPointClass
Definition: SCR_PlayerRadioSpawnPoint.c:2
SCR_PlayerSpawnPointClass
Definition: SCR_PlayerSpawnPoint.c:2
BaseLoadoutClothComponent
Definition: BaseLoadoutClothComponent.c:12
ActivateSpawnPoint
override protected void ActivateSpawnPoint()
Definition: SCR_PlayerRadioSpawnPoint.c:25
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180