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

◆ Combine()

override bool AttachmentCategoriesRow::Combine ( )
inlineprotected

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

168 {
169 if (CanCombine())
170 {
171 Man player = g_Game.GetPlayer();
172 ItemBase prev_item = ItemBase.Cast(GetFocusedItem());
173 ItemBase selected_item = ItemBase.Cast( player.GetEntityInHands() );
174 SlotsIcon focused_icon = GetFocusedSlotsIcon();
175
176 if (selected_item)
177 {
178 int selected_slot = GetFocusedSlot();
179 int stack_max;
180 if (selected_item && selected_item.GetInventory().CanRemoveEntity() && (focused_icon && !focused_icon.IsOutOfReach()))
181 {
182 if (!prev_item && m_Entity.GetInventory().CanAddAttachmentEx(selected_item, selected_slot))
183 {
184 stack_max = InventorySlots.GetStackMaxForSlotId(selected_slot);
185 float quantity = selected_item.GetQuantity();
186 if (stack_max == 0 || stack_max >= quantity || !selected_item.CanBeSplit())
187 {
188 player.PredictiveTakeEntityToTargetAttachmentEx(m_Entity, selected_item, selected_slot);
189 return true;
190 }
191 else
192 {
193 selected_item.SplitIntoStackMaxClient(m_Entity, selected_slot);
194 return true;
195 }
196 }
197 else if (selected_slot != -1)
198 {
199 if (prev_item)
200 {
201 InventoryLocation inv_loc = new InventoryLocation;
202 prev_item.GetInventory().GetCurrentInventoryLocation(inv_loc);
203 stack_max = InventorySlots.GetStackMaxForSlotId(inv_loc.GetSlot());
204 quantity = prev_item.GetQuantity();
205 if (prev_item.CanBeCombined(ItemBase.Cast(selected_item)))
206 {
207 prev_item.CombineItemsClient(selected_item, true);
208 return true;
209 }
210 else if (stack_max == 0 && GameInventory.CanSwapEntitiesEx(prev_item, selected_item))
211 {
212 player.PredictiveSwapEntities(selected_item, prev_item);
213 return true;
214 }
215 else if (m_AttachmentCargos.Contains(inv_loc.GetSlot()))
216 {
217 if (prev_item.GetInventory().CanAddEntityInCargo(selected_item, selected_item.GetInventory().GetFlipCargo()))
218 {
219 SplitItemUtils.TakeOrSplitToInventory(PlayerBase.Cast(player), prev_item, selected_item);
220 return true;
221 }
222 }
223 }
224 }
225 }
226 }
227 }
228 return false;
229 }
Entity m_Entity
Определения CachedEquipmentStorageBase.c:16
DayZGame g_Game
Определения DayZGame.c:4074
class GP5GasMask extends MaskBase ItemBase
ref map< int, ref ContainerWithCargo > m_AttachmentCargos
Определения AttachmentCategoriesRow.c:8
override bool CanCombine()
Определения AttachmentCategoriesRow.c:236
proto native GameInventory GetInventory()
proto native bool CanAddAttachmentEx(notnull EntityAI e, int slot)
Check if attachment can be added to slot @NOTE: Note that slot index IS NOT slot ID!...
proto native int GetSlot()
returns slot id if current type is Attachment
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool CanBeSplit()
Определения Rag.c:34
bool IsOutOfReach()
Определения SlotsIconBase.c:700

Перекрестные ссылки ItemBase::CanBeCombined(), ItemBase::CanBeSplit(), CanCombine(), GameInventory::CanSwapEntitiesEx(), g_Game, GetFocusedSlot(), InventoryLocation::GetSlot(), InventorySlots::GetStackMaxForSlotId(), SlotsIconBase::IsOutOfReach(), m_AttachmentCargos, m_Entity и SplitItemUtils::TakeOrSplitToInventory().