Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_PlayerRadioSpawnPoint.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/GameMode", description: "")]
5
6class SCR_PlayerRadioSpawnPoint : SCR_PlayerSpawnPoint
7{
8 //------------------------------------------------------------------------------------------------
9 protected void OnItemAdded(IEntity item, BaseInventoryStorageComponent storageOwner)
10 {
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 {
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}
void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)
void OnItemRemoved(BaseInventoryStorageComponent storageOwner, IEntity item)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void ActivateSpawnPoint()
void DeactivateSpawnPoint()
proto external Managed FindComponent(typename typeName)