Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseTriggerComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/ScriptWizard", description: "")]
3 {
4 }
5 
7 {
8  [Attribute("0", "Is this mine live by default?")]
9  protected bool m_bLive;
10 
11  [RplProp(onRplName:"OnActivatedChanged")]
12  protected bool m_bActivated = false;
13 
14  [Attribute("", desc: "Name of the fuze mesh that should unhide when mine is activated")]
15  protected string m_sFuzeMeshName;
16 
17  //protected Instigator m_User;
18 
19  //------------------------------------------------------------------------------------------------
22  bool IsActivated()
23  {
24  return m_bActivated;
25  }
26 
27  //------------------------------------------------------------------------------------------------
29  void SetUser(notnull IEntity user)
30  {
31  GetInstigator().SetInstigator(user);
32  //m_User = user;
33  }
34 
35  //------------------------------------------------------------------------------------------------
37  // Only call this on the server
39  {
40  GenericEntity owner = GenericEntity.Cast(GetOwner());
41  RplComponent rplComponent = RplComponent.Cast(owner.FindComponent(RplComponent));
42  if (!rplComponent || rplComponent.IsProxy())
43  return;
44 
45  auto garbageSystem = SCR_GarbageSystem.GetByEntityWorld(owner);
46  if (garbageSystem)
47  garbageSystem.Withdraw(owner);
48 
49  SetLive();
50  m_bActivated = true;
51  ShowFuse();
52  Replication.BumpMe();
53  }
54 
55  //------------------------------------------------------------------------------------------------
57  void ShowFuse()
58  {
59  IEntity owner = GetOwner();
60  int meshIndex = GameAnimationUtils.FindMeshIndex(owner, m_sFuzeMeshName);
61  if (meshIndex == -1)
62  return;
63 
64  GameAnimationUtils.ShowMesh(owner, meshIndex, true);
65  }
66 
67  //------------------------------------------------------------------------------------------------
70  {
71  if (m_bActivated)
72  ShowFuse();
73  }
74 
75  //------------------------------------------------------------------------------------------------
77  [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
79  {
80  BaseTriggerComponent baseTriggerComponent = BaseTriggerComponent.Cast(GetOwner().FindComponent(BaseTriggerComponent));
81  if (!baseTriggerComponent)
82  return;
83 
84  baseTriggerComponent.OnUserTriggerOverrideInstigator(GetOwner(), GetInstigator());
85  }
86 
87  //------------------------------------------------------------------------------------------------
88  override event protected void EOnInit(IEntity owner)
89  {
90  if (m_bLive)
91  ActivateTrigger(); // Using call later to avoid accessing uninitialized components
92  }
93 
94  //------------------------------------------------------------------------------------------------
95  // constructor
99  void SCR_BaseTriggerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
100  {
101  SetEventMask(ent, EntityEvent.INIT);
102  }
103 }
BaseTriggerComponent
Definition: BaseTriggerComponent.c:12
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
RplProp
SCR_RplTestEntityClass RplProp
Used for handling entity spawning requests for SCR_CatalogEntitySpawnerComponent and inherited classe...
ActivateTrigger
void ActivateTrigger()
Definition: SCR_BaseTriggerComponent.c:38
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
Attribute
SCR_BaseTriggerComponentClass BaseTriggerComponentClass Attribute("0", "Is this mine live by default?")
Definition: SCR_BaseTriggerComponent.c:8
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
RPC_DoTrigger
void RPC_DoTrigger()
Definition: SCR_BaseTriggerComponent.c:78
OnActivatedChanged
void OnActivatedChanged()
Method called on the clients, the item should be outside inventory already.
Definition: SCR_BaseTriggerComponent.c:69
GetInstigator
BaseProjectileComponentClass GameComponentClass GetInstigator()
SCR_BaseTriggerComponent
void SCR_BaseTriggerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_BaseTriggerComponent.c:99
BaseTriggerComponentClass
Definition: BaseTriggerComponentClass.c:12
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
ShowFuse
void ShowFuse()
Definition: SCR_BaseTriggerComponent.c:57
SetUser
void SetUser(notnull IEntity user)
Definition: SCR_BaseTriggerComponent.c:29
SCR_BaseTriggerComponentClass
Definition: SCR_BaseTriggerComponent.c:2
SCR_GarbageSystem
Script entry for garbage system modding.
Definition: SCR_GarbageSystem.c:2
EOnInit
override event protected void EOnInit(IEntity owner)
Initialise this component with data from FactionsManager.
Definition: SCR_BaseTriggerComponent.c:88
GameAnimationUtils
Definition: GameAnimationUtils.c:7
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180