Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseDeployableInventoryItemComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/DeployableItems", description: "")]
3 {
4 }
5 
7 class SCR_BaseDeployableInventoryItemComponent : ScriptComponent
8 {
9  [RplProp(onRplName: "OnRplDeployed")]
10  protected bool m_bIsDeployed;
11 
12  protected int m_iItemOwnerID = -1;
13 
14  protected RplComponent m_RplComponent;
15 
16  //------------------------------------------------------------------------------------------------
19  void Deploy(IEntity userEntity = null)
20  {
21  if (!m_RplComponent || m_RplComponent.IsProxy())
22  return;
23 
24  PlayerManager playerManager = GetGame().GetPlayerManager();
25  if (!playerManager)
26  return;
27 
28  if (userEntity)
29  m_iItemOwnerID = playerManager.GetPlayerIdFromControlledEntity(userEntity);
30 
31  // Put deploy logic here
32 
33  m_bIsDeployed = true;
34  Replication.BumpMe();
35  }
36 
37  //------------------------------------------------------------------------------------------------
40  void Dismantle(IEntity userEntity = null)
41  {
42  if (!m_RplComponent || m_RplComponent.IsProxy())
43  return;
44 
45  m_iItemOwnerID = -1; // Reset owner ID
46 
47  // Put dismantle logic here
48 
49  m_bIsDeployed = false;
50  Replication.BumpMe();
51  }
52 
53  //------------------------------------------------------------------------------------------------
55  protected void OnRplDeployed();
56 
57  //------------------------------------------------------------------------------------------------
61  bool CanDeployBeShown(notnull IEntity userEntity)
62  {
63  return !m_bIsDeployed;
64  }
65 
66  //------------------------------------------------------------------------------------------------
70  bool CanDismantleBeShown(notnull IEntity userEntity)
71  {
72  return m_bIsDeployed;
73  }
74 
75  //------------------------------------------------------------------------------------------------
78  bool IsDeployed()
79  {
80  return m_bIsDeployed;
81  }
82 
83  //------------------------------------------------------------------------------------------------
86  {
87  return m_iItemOwnerID;
88  }
89 
90  //------------------------------------------------------------------------------------------------
91  override void OnPostInit(IEntity owner)
92  {
93  super.OnPostInit(owner);
94  SetEventMask(GetOwner(), EntityEvent.INIT);
95  m_RplComponent = RplComponent.Cast(GetOwner().FindComponent(RplComponent));
96  }
97 }
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
m_bIsDeployed
protected bool m_bIsDeployed
Definition: SCR_CampaignMobileAssemblyComponent.c:39
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
CanDismantleBeShown
bool CanDismantleBeShown(notnull IEntity userEntity)
Definition: SCR_BaseDeployableInventoryItemComponent.c:70
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetItemOwnerID
int GetItemOwnerID()
Definition: SCR_BaseDeployableInventoryItemComponent.c:85
Dismantle
void Dismantle(IEntity userEntity=null)
Definition: SCR_BaseDeployableInventoryItemComponent.c:40
IsDeployed
bool IsDeployed()
Definition: SCR_BaseDeployableInventoryItemComponent.c:78
RplProp
SCR_BaseDeployableInventoryItemComponentClass ScriptComponentClass RplProp(onRplName:"OnRplDeployed")
Base class which all deployable inventory items inherit from.
Definition: SCR_BaseDeployableInventoryItemComponent.c:9
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_BaseDeployableInventoryItemComponent.c:91
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
OnRplDeployed
protected void OnRplDeployed()
Definition: SCR_BaseDeployableSpawnPointComponent.c:85
m_RplComponent
protected RplComponent m_RplComponent
Definition: SCR_CampaignBuildingManagerComponent.c:42
SCR_BaseDeployableInventoryItemComponentClass
Definition: SCR_BaseDeployableInventoryItemComponent.c:2
CanDeployBeShown
bool CanDeployBeShown(notnull IEntity userEntity)
Definition: SCR_BaseDeployableInventoryItemComponent.c:61
Deploy
bool Deploy(SCR_EMobileAssemblyStatus status, int playerId=0)
Definition: SCR_CampaignMobileAssemblyComponent.c:195
PlayerManager
Definition: PlayerManager.c:12
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180