DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс RemotelyActivatedItemBehaviour

Защищенные члены

void RemotelyActivatedItemBehaviour (notnull EntityAI pParent)
 
void ~RemotelyActivatedItemBehaviour ()
 
void SetTrigger ()
 
void OnVariableSynchronized ()
 
void OnStoreSave (ParamsWriteContext ctx)
 
bool OnStoreLoad (ParamsReadContext ctx, int version)
 
void OnAfterLoad ()
 
void SetPersistentPairID (int id)
 
void Pair ()
 
void Pair (notnull EntityAI device)
 
void Unpair ()
 
EntityAI GetPairDevice ()
 
bool IsPaired ()
 
void SetPairDeviceNetIds (notnull EntityAI device)
 
int GetPairDeviceNetIdLow ()
 
int GetPairDeviceNetIdHigh ()
 

Защищенные статические члены

static int GeneratePersistentID ()
 

Защищенные данные

EntityAI m_Parent
 
bool m_IsTrigger
 
EntityAI m_PairDevice
 
int m_PairDeviceNetIdLow
 
int m_PairDeviceNetIdHigh
 
int m_PersistentPairID = int.MIN
 

Статические защищенные данные

static ref map< int, EntityAIm_RemoteReceivers = new map<int,EntityAI>()
 

Подробное описание

Конструктор(ы)

◆ RemotelyActivatedItemBehaviour()

13 {
15
18 }
Definition EntityAI.c:95
EntityAI m_Parent
Definition RemotelyActivatedItemBehaviour.c:3
int m_PairDeviceNetIdLow
Definition RemotelyActivatedItemBehaviour.c:6
int m_PairDeviceNetIdHigh
Definition RemotelyActivatedItemBehaviour.c:7

Перекрестные ссылки m_PairDeviceNetIdHigh, m_PairDeviceNetIdLow и m_Parent.

◆ ~RemotelyActivatedItemBehaviour()

void ~RemotelyActivatedItemBehaviour ( )
inlineprotected
21 {
22 if (m_Parent)
23 Unpair();
24 }
void Unpair()
Definition RemotelyActivatedItemBehaviour.c:122

Перекрестные ссылки m_Parent и Unpair().

Методы

◆ GeneratePersistentID()

static int GeneratePersistentID ( )
inlinestaticprotected
82 {
83 int randomID = Math.RandomInt(0, int.MAX);
84 if (m_RemoteReceivers.Contains(randomID))
85 {
86 //it's very unlikely to have a collision here, but lets handle it anyway
87 return GeneratePersistentID();
88 }
89 else
90 return randomID;
91 }
const int MAX
Definition EnConvert.c:27
Definition EnMath.c:7
static ref map< int, EntityAI > m_RemoteReceivers
Definition RemotelyActivatedItemBehaviour.c:10
static int GeneratePersistentID()
Definition RemotelyActivatedItemBehaviour.c:81
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

Перекрестные ссылки GeneratePersistentID(), m_RemoteReceivers, MAX и Math::RandomInt().

Используется в GeneratePersistentID() и InventoryItem::PairWithDevice().

◆ GetPairDevice()

EntityAI GetPairDevice ( )
inlineprotected
144 {
145 return m_PairDevice;
146 }
EntityAI m_PairDevice
Definition RemotelyActivatedItemBehaviour.c:5

Перекрестные ссылки m_PairDevice.

◆ GetPairDeviceNetIdHigh()

int GetPairDeviceNetIdHigh ( )
inlineprotected
164 {
166 }

Перекрестные ссылки m_PairDeviceNetIdHigh.

Используется в Pair().

◆ GetPairDeviceNetIdLow()

int GetPairDeviceNetIdLow ( )
inlineprotected
159 {
161 }

Перекрестные ссылки m_PairDeviceNetIdLow.

Используется в Pair().

◆ IsPaired()

bool IsPaired ( )
inlineprotected
149 {
150 return m_PairDevice != null;
151 }

Перекрестные ссылки m_PairDevice.

◆ OnAfterLoad()

void OnAfterLoad ( )
inlineprotected
64 {
66 {
68 if (receiver)
69 {
70 //if both the receiver and trigger are somewhere in the world outside of the player inventory, there is no guarantee
71 //that the pairing is going to be succesful during the 'OnStoreLoad' event as that requires the receiver to already be loaded when the trigger is being loaded
72 //therefore, it's necessary to also perform pairing in this event, which happens at the end of the storage loading process
73 //do note that this event is not called when the entity is being loaded as part of the player inventory, therefore, we need to pair both in 'OnStoreLoad' and here to handle both situations
74 //(when the trigger is in the player's inventory, it always loads correctly after the receiver, which is always in the world)
76 }
77 }
78 }
const int MIN
Definition EnConvert.c:28
Definition Building.c:6
int m_PersistentPairID
Definition RemotelyActivatedItemBehaviour.c:8
void Pair()
Definition RemotelyActivatedItemBehaviour.c:101
bool m_IsTrigger
Definition RemotelyActivatedItemBehaviour.c:4

Перекрестные ссылки m_IsTrigger, m_PairDevice, m_PersistentPairID, m_RemoteReceivers, MIN и Pair().

◆ OnStoreLoad()

bool OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected
42 {
43 if (!ctx.Read(m_PersistentPairID))
44 return false;
45
46 if (m_PersistentPairID == int.MIN)//default value, no point in going further
47 return true;
48
49 if (m_IsTrigger)//trigger
50 {
52 if (receiver)
54 }
55 else // remotely controlled device
56 {
57 m_RemoteReceivers.Insert(m_PersistentPairID, m_Parent);//receivers will register themselves upon being loaded from the storage
58 }
59
60 return true;
61 }

Перекрестные ссылки m_IsTrigger, m_Parent, m_PersistentPairID, m_RemoteReceivers, MIN и Pair().

◆ OnStoreSave()

void OnStoreSave ( ParamsWriteContext ctx)
inlineprotected
37 {
39 }

Перекрестные ссылки m_PersistentPairID.

◆ OnVariableSynchronized()

void OnVariableSynchronized ( )
inlineprotected
32 {
33 Pair();
34 }

Перекрестные ссылки Pair().

◆ Pair() [1/2]

void Pair ( )
inlineprotected
102 {
103 EntityAI device = EntityAI.Cast(GetGame().GetObjectByNetworkId(GetPairDeviceNetIdLow(), GetPairDeviceNetIdHigh()));
104 if (device)
105 {
106 Pair(device);
107 }
108 }
int GetPairDeviceNetIdHigh()
Definition RemotelyActivatedItemBehaviour.c:163
int GetPairDeviceNetIdLow()
Definition RemotelyActivatedItemBehaviour.c:158
proto native CGame GetGame()

Перекрестные ссылки GetGame(), GetPairDeviceNetIdHigh(), GetPairDeviceNetIdLow() и Pair().

Используется в OnAfterLoad(), OnStoreLoad(), OnVariableSynchronized() и Pair().

◆ Pair() [2/2]

void Pair ( notnull EntityAI device)
inlineprotected
111 {
114
115 if (device != m_Parent && (!m_Parent.GetPairDevice() || m_Parent.GetPairDevice() != m_PairDevice))
116 m_PairDevice.PairRemote(m_Parent);
117
118 m_PairDevice.SetSynchDirty();
119 m_Parent.SetSynchDirty();
120 }
void SetPairDeviceNetIds(notnull EntityAI device)
Definition RemotelyActivatedItemBehaviour.c:153

Перекрестные ссылки m_PairDevice, m_Parent и SetPairDeviceNetIds().

◆ SetPairDeviceNetIds()

void SetPairDeviceNetIds ( notnull EntityAI device)
inlineprotected
154 {
156 }

Перекрестные ссылки m_PairDeviceNetIdHigh и m_PairDeviceNetIdLow.

Используется в Pair().

◆ SetPersistentPairID()

void SetPersistentPairID ( int id)
inlineprotected
94 {
96
97 if (!m_IsTrigger)
98 m_RemoteReceivers.Insert(id,m_Parent);
99 }

Перекрестные ссылки m_IsTrigger, m_Parent, m_PersistentPairID и m_RemoteReceivers.

◆ SetTrigger()

void SetTrigger ( )
inlineprotected
27 {
28 m_IsTrigger = true;
29 }

Перекрестные ссылки m_IsTrigger.

◆ Unpair()

void Unpair ( )
inlineprotected
123 {
126
127 if (m_PairDevice)
128 {
129 m_PairDevice.SetSynchDirty();
131 }
132
133 if (m_PersistentPairID != int.MIN)
134 {
137 }
138
139 m_PersistentPairID = int.MIN;
140 m_Parent.SetSynchDirty();
141 }

Перекрестные ссылки m_PairDevice, m_PairDeviceNetIdHigh, m_PairDeviceNetIdLow, m_Parent, m_PersistentPairID, m_RemoteReceivers и MIN.

Используется в ~RemotelyActivatedItemBehaviour().

Поля

◆ m_IsTrigger

bool m_IsTrigger
protected

◆ m_PairDevice

EntityAI m_PairDevice
protected

Используется в GetPairDevice(), IsPaired(), OnAfterLoad(), Pair() и Unpair().

◆ m_PairDeviceNetIdHigh

int m_PairDeviceNetIdHigh
protected

◆ m_PairDeviceNetIdLow

int m_PairDeviceNetIdLow
protected

◆ m_Parent

◆ m_PersistentPairID

int m_PersistentPairID = int.MIN
protected

◆ m_RemoteReceivers

ref map<int,EntityAI> m_RemoteReceivers = new map<int,EntityAI>()
staticprotected

Объявления и описания членов класса находятся в файле: