DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс ActionAttachOnSelection
+ Граф наследования:ActionAttachOnSelection:

Закрытые члены

void ActionAttachOnSelection ()
 
override void CreateConditionComponents ()
 
override ActionData CreateActionData ()
 
int FindSlotIdToAttachOrCombine (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=null)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 
override void OnExecuteClient (ActionData action_data)
 

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

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

◆ ActionAttachOnSelection()

void ActionAttachOnSelection ( )
inlineprivate
4 {
5 m_Text = "#attach";
6 }
string m_Text
Definition ActionBase.c:58

Перекрестные ссылки ActionBase::m_Text.

Методы

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate
96 {
97 if (GetGame().IsMultiplayer() && GetGame().IsServer())
98 return true;
99
100 if (target.GetObject() && target.GetObject().CanUseConstruction())
101 return false;
102
104 }
int FindSlotIdToAttachOrCombine(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionAttachOnSelection.c:20
provides access to slot configuration
Definition InventorySlots.c:6
const int INVALID
Invalid slot (-1)
Definition InventorySlots.c:17
Definition EntityAI.c:95
proto native CGame GetGame()

Перекрестные ссылки FindSlotIdToAttachOrCombine(), GetGame() и InventorySlots::INVALID.

◆ CreateActionData()

override ActionData CreateActionData ( )
inlineprivate
15 {
17 return action_data;
18 }
Definition ActionAttach.c:2

◆ CreateConditionComponents()

override void CreateConditionComponents ( )
inlineprivate
9 {
12 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:64
ref CCTBase m_ConditionTarget
Definition ActionBase.c:65
Definition CCINonRuined.c:2
Definition CCTCursor.c:2

Перекрестные ссылки ActionBase::m_ConditionItem и ActionBase::m_ConditionTarget.

◆ FindSlotIdToAttachOrCombine()

int FindSlotIdToAttachOrCombine ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate
21 {
22 EntityAI targetEntity = EntityAI.Cast(target.GetObject());
23 if (targetEntity && item)
24 {
25 if (!targetEntity.GetInventory())
27
28 int slotsCount = item.GetInventory().GetSlotIdCount();
30 targetEntity.GetActionComponentNameList(target.GetComponentIndex(), selections);
31
32 foreach (string selection : selections)
33 {
34 int slotId = -1;
35 if (!targetEntity.TranslateSlotFromSelection(selection, slotId))
37
38 if (slotId == -1)
39 continue;
40
41 for (int i=0; i < slotsCount; ++i)
42 {
43 int itemSlotId = item.GetInventory().GetSlotId(i);
44 if (slotId == itemSlotId)
45 {
46 ItemBase currentAttachment = ItemBase.Cast(targetEntity.GetInventory().FindAttachment(slotId));
48 {
49 if (currentAttachment.CanBeCombined(item))
50 return itemSlotId;
51 }
52 else
53 {
54 if (targetEntity.GetInventory() && targetEntity.GetInventory().CanAddAttachment(item))
55 return itemSlotId;
56 }
57 }
58 }
59 }
60 }
61
63 }
Definition Building.c:6
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
Definition InventoryItem.c:731

Перекрестные ссылки InventorySlots::GetSlotIdFromString() и InventorySlots::INVALID.

Используется в ActionCondition() и SetupAction().

◆ OnExecuteClient()

override void OnExecuteClient ( ActionData action_data)
inlineprivate
132 {
134 EntityAI targetEntity = EntityAI.Cast(action_data.m_Target.GetObject());
135 EntityAI itemEntity = action_data.m_MainItem;
136
138
139 ItemBase attachment = ItemBase.Cast(targetEntity.GetInventory().FindAttachment(action_data_a.m_AttSlot));
140 if (attachment)
141 {
142 attachment.CombineItemsClient(itemEntity);
143 }
144 else
145 {
147 float stackable = item_base.GetTargetQuantityMax( action_data_a.m_AttSlot );
148
149 if (stackable == 0 || stackable >= item_base.GetQuantity())
150 {
151 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(targetEntity, itemEntity, action_data_a.m_AttSlot);
152 }
153 else if (stackable != 0 && stackable < item_base.GetQuantity())
154 {
155 item_base.SplitIntoStackMaxClient(targetEntity, action_data_a.m_AttSlot);
156 }
157 }
158 }
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:921

Перекрестные ссылки ActionBase::ClearInventoryReservationEx().

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)
inlineprivate
107 {
108 if (GetGame().IsMultiplayer())
109 return;
110
112
115
116 if (action_data.m_Target.IsProxy())
117 {
118 entity = EntityAI.Cast(action_data.m_Target.GetParent());
119 }
120 else
121 {
122 entity = EntityAI.Cast(action_data.m_Target.GetObject());
123 }
124
125 if (entity && action_data.m_MainItem)
126 {
127 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(entity, action_data_a.m_MainItem, action_data_a.m_AttSlot);
128 }
129 }

Перекрестные ссылки ActionBase::ClearInventoryReservationEx() и GetGame().

◆ SetupAction()

override bool SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = null )
inlineprivate
67 {
69 if (!GetGame().IsDedicatedServer() )
70 {
72 }
73
74 if (super.SetupAction( player, target, item, action_data, extra_data))
75 {
76 if (!GetGame().IsDedicatedServer())
77 {
79 {
81 action_data_a.m_AttSlot = attSlotId;
82
83 return true;
84 }
85
86 return false;
87 }
88
89 return true;
90 }
91
92 return false;
93 }

Перекрестные ссылки FindSlotIdToAttachOrCombine(), GetGame() и InventorySlots::INVALID.


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