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

◆ ActionCondition()

override bool ActionLockAttachment::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

См. определение в файле ActionLockAttachment.c строка 54

55 {
56 if ( !target )
57 return false;
58
59 EntityAI parent_EAI = EntityAI.Cast(target.GetParent());
60 ItemBase target_IB = ItemBase.Cast(target.GetObject());
61
62 array<int> compLock = ItemBaseType.Cast(item.GetEntityType()).m_CompatibleLocks;
63 int targetType = eLockTypes.NONE;
64
65 if ( target_IB && parent_EAI )
66 {
67 //CAR DOOR HANDLING
68 //I don't really like this, but sometimes specifics have to be handled in generics
69 CarDoor targetDoor = CarDoor.Cast(target_IB);
70 if ( targetDoor )
71 {
72 InventoryLocation loc = new InventoryLocation();
73 bool isPresent = targetDoor.GetInventory().GetCurrentInventoryLocation( loc );
74
75 if ( !isPresent || loc.GetSlot() == -1 )
76 return false;
77
78 string slotName = InventorySlots.GetSlotName( loc.GetSlot() );
79 if ( slotName && CarScript.Cast( parent_EAI ).GetCarDoorsState( slotName ) != CarDoorState.DOORS_OPEN )
80 return false;
81 }
82 //END OF CAR DOOR SPECIFICS
83
84 // CONSTRUCTION HANDLING
85 bool hasConstruction = parent_EAI.CanUseConstruction();
86 bool isPlayerInside = parent_EAI.IsPlayerInsideEx(player, "");
87 if (hasConstruction && !isPlayerInside)
88 return false;
89
90 // CODE LOCK HANDLING
91 DigitalCodeLock codeLock = DigitalCodeLock.Cast(target_IB);
92 if (codeLock)
93 {
94 array<string> selections = new array<string>;
95 codeLock.GetActionComponentNameList(target.GetComponentIndex(), selections);
96
97 foreach (string selectionName : selections)
98 {
99 if (selectionName != CODE_LOCK_SELECTION_BACK)
100 return false;
101 }
102 }
103
104 if ( target_IB.IsLockedInSlot() )
106 else if ( target_IB.IsAlive() )
108 else if ( !target_IB.IsLockedInSlot() )
109 return false;
110
111 targetType = target_IB.GetLockType();
112
113 for (int i = 0; i < compLock.Count(); i++)
114 {
115 if ( targetType == compLock[i] && targetType != eLockTypes.NONE)
116 {
117 return true;
118 }
119 }
120 }
121 return false;
122 }
class LogManager EntityAI
eLockTypes
Определения ActionLockAttachment.c:4
CarDoorState
Определения CarScript.c:2
PlayerSpawnPreset slotName
void DigitalCodeLock()
Определения CodeLock.c:590
class GP5GasMask extends MaskBase ItemBase
const string CODE_LOCK_SELECTION_BACK
Определения ActionLockAttachment.c:25
const string UNLOCK_VERSION
Определения ActionLockAttachment.c:23
string m_Name
Определения ActionLockAttachment.c:24
const string LOCK_VERSION
Определения ActionLockAttachment.c:22
proto native int GetSlot()
returns slot id if current type is Attachment

Перекрестные ссылки ActionTarget(), CODE_LOCK_SELECTION_BACK, CarScript::GetCarDoorsState(), InventoryLocation::GetSlot(), InventorySlots::GetSlotName(), LOCK_VERSION, ItemBaseType::m_CompatibleLocks, m_Name, slotName и UNLOCK_VERSION.