Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseTriggerComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/ScriptWizard", description: "")]
5
7{
8 [Attribute("0", desc: "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 //------------------------------------------------------------------------------------------------
30 {
31 return m_bLive;
32 }
33
34 //------------------------------------------------------------------------------------------------
36 void SetUser(notnull IEntity user)
37 {
38 GetInstigator().SetInstigator(user);
39 //m_User = user;
40 }
41
42 //------------------------------------------------------------------------------------------------
44 // Only call this on the server
46 {
47 GenericEntity owner = GenericEntity.Cast(GetOwner());
48 RplComponent rplComponent = RplComponent.Cast(owner.FindComponent(RplComponent));
49 if (!rplComponent || rplComponent.IsProxy())
50 return;
51
52 auto garbageSystem = SCR_GarbageSystem.GetByEntityWorld(owner);
53 if (garbageSystem)
54 garbageSystem.Withdraw(owner);
55
56 SetLive();
57 m_bActivated = true;
58 ShowFuse();
59 Replication.BumpMe();
60 }
61
63 {
64 m_bActivated = false;
65 Replication.BumpMe();
66 }
67
68 //------------------------------------------------------------------------------------------------
70 void ShowFuse()
71 {
72 IEntity owner = GetOwner();
73 int meshIndex = GameAnimationUtils.FindMeshIndex(owner, m_sFuzeMeshName);
74 if (meshIndex == -1)
75 return;
76
77 GameAnimationUtils.ShowMesh(owner, meshIndex, true);
78 }
79
80 //------------------------------------------------------------------------------------------------
83 {
84 if (m_bActivated)
85 ShowFuse();
86 }
87
88 //------------------------------------------------------------------------------------------------
90 [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
92 {
93 // Can be called from CallLater. Therefore, we need to check if the entity still exists.
94 IEntity owner = GetOwner();
95 if (!owner)
96 return;
97
99 if (!baseTriggerComponent)
100 return;
101
102 baseTriggerComponent.OnUserTriggerOverrideInstigator(owner, GetInstigator());
103 }
104
105 //------------------------------------------------------------------------------------------------
106 override event protected void EOnInit(IEntity owner)
107 {
108 if (m_bLive)
109 ActivateTrigger(); // Using call later to avoid accessing uninitialized components
110 }
111
112 //------------------------------------------------------------------------------------------------
113 // constructor
118 {
119 SetEventMask(ent, EntityEvent.INIT);
120 }
121}
void ActivateTrigger()
void RPC_DoTrigger()
void DisarmTrigger()
void OnActivatedChanged()
Method called on the clients, the item should be outside inventory already.
void SetUser(notnull IEntity user)
void ShowFuse()
void SCR_BaseTriggerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
bool IsActivatedByDefault()
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void EOnInit(IEntity owner)
proto external Managed FindComponent(typename typeName)
Main replication API.
Definition Replication.c:14
Script entry for garbage system modding.
static SCR_GarbageSystem GetByEntityWorld(IEntity entity)
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14
BaseProjectileComponentClass GameComponentClass GetInstigator()
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition EnNetwork.c:95
RplRcver
Definition RplRcver.c:59
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition RplChannel.c:14