Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WeaponRackEntity.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Campaign", description: "A rack filled with weapons.", color: "0 0 255 255")]
2 class SCR_WeaponRackEntityClass: GenericEntityClass
3 {
4 };
5 
6 //------------------------------------------------------------------------------------------------
8 {
9  // Simple timer setup
10  [Attribute("10")]
11  float m_fPeriodTime;
12 
13  protected SCR_ArsenalDisplayComponent m_ArsenalDisplayComponent;
14  protected SCR_FactionAffiliationComponent m_FactionAffiliationComponent;
15 
16  //------------------------------------------------------------------------------------------------
17  float GetPeriodTime()
18  {
19  return m_fPeriodTime;
20  }
21 
22  //------------------------------------------------------------------------------------------------
23  void ClearWeapons()
24  {
25  m_ArsenalDisplayComponent.ClearArsenal();
26  }
27 
28  //------------------------------------------------------------------------------------------------
30  void PeriodicalSpawn(notnull SCR_Faction faction)
31  {
32  Faction assignedFaction;
34  {
35  assignedFaction = m_FactionAffiliationComponent.GetAffiliatedFaction();
36  if (!assignedFaction || (assignedFaction && assignedFaction.GetFactionKey() != faction.GetFactionKey()))
37  {
38  m_FactionAffiliationComponent.SetAffiliatedFaction(faction);
39  // Set new faction on component,FactionChanged callback refreshes items in ArsenalDisplayComponent
40  return;
41  }
42  }
43 
44  m_ArsenalDisplayComponent.RefreshArsenal(faction);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  override void EOnInit(IEntity owner)
49  {
50  if (SCR_Global.IsEditMode())
51  return;
52 
53  m_ArsenalDisplayComponent = SCR_ArsenalDisplayComponent.Cast(owner.FindComponent(SCR_ArsenalDisplayComponent));
54 
55  if (!m_ArsenalDisplayComponent)
56  {
57  Print("Arsenal display component not found on WeaponRackEntity", LogLevel.ERROR);
58  return;
59  }
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  void SCR_WeaponRackEntity(IEntitySource src, IEntity parent)
64  {
65  SetEventMask(EntityEvent.INIT);
66  }
67 
68  //------------------------------------------------------------------------------------------------
69  void ~SCR_WeaponRackEntity()
70  {
71  }
72 
73 }
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_WeaponRackEntity
Definition: SCR_WeaponRackEntity.c:7
Attribute
typedef Attribute
Post-process effect of scripted camera.
Faction
Definition: Faction.c:12
SCR_Global
Definition: Functions.c:6
m_FactionAffiliationComponent
protected FactionAffiliationComponent m_FactionAffiliationComponent
Definition: SCR_BaseSupportStationComponent.c:122
SCR_FactionAffiliationComponent
Definition: SCR_FactionAffiliationComponent.c:10
SCR_Faction
Definition: SCR_Faction.c:6
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
SCR_WeaponRackEntityClass
Definition: SCR_WeaponRackEntity.c:2