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

◆ SetEntity() [1/2]

void ClosableContainer::SetEntity ( EntityAI entity,
bool immedUpdate = true )
inlineprotected

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

319 {
320 m_Entity = entity;
321
322 m_Atts = new Attachments( this, m_Entity );
323 m_Atts.InitAttachmentGrid( SORT_ATTACHMENTS_OWN );
324 m_AttachmentSlotsSorted = m_Atts.GetSlotsSorted();
325
328
329 m_ClosableHeader.SetItemPreview( m_Entity );
330 CheckHeaderDragability();
331
333 {
334 m_CargoGrid = new CargoContainer( this, false );
335 m_CargoGrid.GetRootWidget().SetSort( SORT_CARGO_OWN );
336 m_CargoGrid.SetEntity( m_Entity, 0, immedUpdate );
337 m_CargoGrid.UpdateHeaderText(); // TODO: refresh?
338 Insert( m_CargoGrid );
339 }
340 else
341 {
342 string name = m_Entity.GetDisplayName();
343 name.ToUpper();
344 m_ClosableHeader.SetName( name );
345 }
346
347 m_AttachmentCargos = new map<EntityAI, ref CargoContainer>;
348 m_AttachmentAttachmentsContainers = new map<EntityAI, ref AttachmentsWrapper>;
349 m_AttachmentAttachments = new map<EntityAI, ref Attachments>;
350
351 (Container.Cast( m_Parent )).Insert( this );
352
353 foreach ( int slot_id : m_AttachmentSlotsSorted )
354 {
355 EntityAI item = m_Entity.GetInventory().FindAttachment( slot_id );
356 if ( item )
357 AttachmentAddedEx( item, InventorySlots.GetSlotName( slot_id ), m_Entity, false );
358 }
359
361
362 if (m_CargoGrid)
363 {
364 bool hideCargo = m_Entity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) || !m_Entity.CanDisplayCargo() || m_ForcedHide;
365 if (m_CargoGrid.IsVisible() && hideCargo)
366 {
367 HideCargo();
368 }
369 else if (!m_CargoGrid.IsVisible() && !hideCargo)
370 {
371 ShowCargo();
372 }
373 }
374
375 if( IsDisplayable() )
376 SetOpenState( true );
377 else
378 SetOpenState( false );
379
380 if (immedUpdate)
381 m_Parent.m_Parent.Refresh();
382
383 RecomputeOpenedContainers();
384 }
class LogManager EntityAI
Entity m_Entity
Определения CachedEquipmentStorageBase.c:14
Entity m_Parent
Определения CachedEquipmentStorageBase.c:15
const string Container
Определения CentralEconomy.c:6
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
void AttachmentAddedEx(EntityAI item, string slot, EntityAI parent, bool immedUpdate=true)
void AttachmentRemoved(EntityAI item, string slot, EntityAI parent)
ref map< EntityAI, ref Attachments > m_AttachmentAttachments
ref map< EntityAI, ref AttachmentsWrapper > m_AttachmentAttachmentsContainers
void AttachmentAdded(EntityAI item, string slot, EntityAI parent)
ref CargoContainer m_CargoGrid
Определения ContainerWithCargo.c:3
ref Attachments m_Atts
ref array< int > m_AttachmentSlotsSorted
override bool IsDisplayable()
Определения ContainerWithCargo.c:19
proto native GameInventory GetInventory()
ScriptInvoker GetOnItemAttached()
bool CanDisplayCargo()
ScriptInvoker GetOnItemDetached()
proto native CargoBase GetCargo()
cargo
proto native bool IsInventoryLockedForLockType(int lockType)
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list

Перекрестные ссылки AttachmentAdded(), AttachmentAddedEx(), AttachmentRemoved(), InventorySlots::GetSlotName(), HideCargo(), IsDisplayable(), m_AttachmentAttachments, m_AttachmentAttachmentsContainers, m_AttachmentCargos, m_AttachmentSlotsSorted, m_Atts, m_CargoGrid, m_Entity, m_Parent, name, RecomputeContainers() и ShowCargo().