Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MineWeaponComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/ScriptWizard", description: "")]
5
6class SCR_MineWeaponComponent : WeaponComponent
7{
8 [RplProp(onRplName: "OnFlagEntitySync")]
9 protected RplId m_FlagEntityId = RplId.Invalid();
10
11 protected IEntity m_FlagEntity;
12
13 //------------------------------------------------------------------------------------------------
14 bool IsFlagged()
15 {
16 return m_FlagEntity != null;
17 }
18
19 //------------------------------------------------------------------------------------------------
21 {
22 return m_FlagEntity;
23 }
24
25 //------------------------------------------------------------------------------------------------
27 {
29 if (itemComponent)
30 itemComponent.m_OnParentSlotChangedInvoker.Remove(OnFlagParentSlotChanged);
31
32 m_FlagEntity = null;
33 m_FlagEntityId = RplId.Invalid();
34 Replication.BumpMe();
35 }
36
37 //------------------------------------------------------------------------------------------------
39 void SetFlag(IEntity flag)
40 {
41 if (m_FlagEntity || !flag)
42 return; // This should never happen!
43
45 if (itemComponent)
46 itemComponent.m_OnParentSlotChangedInvoker.Insert(OnFlagParentSlotChanged);
47
48 m_FlagEntity = flag;
49
50 RplComponent rpl = RplComponent.Cast(flag.FindComponent(RplComponent));
51 if (rpl)
52 m_FlagEntityId = rpl.Id();
53
54 Replication.BumpMe();
55 }
56
57 //------------------------------------------------------------------------------------------------
58 protected void OnFlagEntitySync()
59 {
60 const RplComponent rpl = RplComponent.Cast(Replication.FindItem(m_FlagEntityId));
61 if (rpl)
62 m_FlagEntity = rpl.GetEntity();
63 else
64 m_FlagEntity = null;
65 }
66}
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.
IEntity GetFlagEntity()
void OnFlagEntitySync()
void SetFlag(IEntity flag)
Call only on server!
void OnFlagParentSlotChanged(InventoryStorageSlot oldSlot, InventoryStorageSlot newSlot)
proto external Managed FindComponent(typename typeName)
Main replication API.
Definition Replication.c:14
Replication item identifier.
Definition RplId.c:14