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

◆ ActionCondition()

override bool ActionDetachBattery::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprotected

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

15 {
16 if (!super.ActionCondition(player, target, item))
17 return false;
18
19 EntityAI targetEntity = EntityAI.Cast(target.GetObject());
20 if (!targetEntity || targetEntity && !targetEntity.GetInventory())
21 return false;
22
23 if (!targetEntity.GetInventory().HasAttachmentSlot(Battery9V.SLOT_ID))
24 return false;
25
26 EntityAI attachment = targetEntity.GetInventory().FindAttachment(Battery9V.SLOT_ID);
27 if (!attachment)
28 return false;
29
30 DigitalCodeLock codeLock = DigitalCodeLock.Cast(targetEntity);
31 if (codeLock)
32 {
33 if (!codeLock.GetHierarchyRoot())
34 return false;
35
36 if (codeLock.IsLocked() || codeLock.IsLockedInSlot())
37 return false;
38
39 array<string> selections = new array<string>;
40 if (codeLock)
41 codeLock.GetActionComponentNameList(target.GetComponentIndex(), selections);
42
43 bool isFactingBackSide;
44 foreach (string selectionName : selections)
45 {
46 if (selectionName == SELECTION_BACK)
47 {
48 isFactingBackSide = true;
49 break;
50 }
51 }
52
53 if (!isFactingBackSide)
54 return false;
55 }
56
57 if (player.GetInventory().CanAddEntityIntoHands(attachment))
58 {
59 if (attachment.CanDetachAttachment(targetEntity) && targetEntity.CanReleaseAttachment(attachment))
60 {
61 m_Text = "#detach_battery " + attachment.GetDisplayName();
62 return true;
63 }
64 }
65
66 return false;
67 }
class LogManager EntityAI
string m_Text
Определения ActionBase.c:57
void DigitalCodeLock()
Определения CodeLock.c:590
const string SELECTION_BACK
Определения ActionDetachBattery.c:3
bool IsLocked()
Определения CodeLock.c:373

Перекрестные ссылки ActionTarget(), DigitalCodeLock::IsLocked(), m_Text, SELECTION_BACK и Battery9V::SLOT_ID.