24 if (itemComp && itemComp.GetParentSlot())
26 BaseInventoryStorageComponent tqStorage = itemComp.GetParentSlot().GetStorage();
50 protected ref SCR_TourniquetMovedCallback m_TourniquetMovedCallback =
new SCR_TourniquetMovedCallback();
60 if (!tourniquetStorageComp)
63 SCR_InventoryStorageManagerComponent storageMan = SCR_InventoryStorageManagerComponent.Cast(
GetOwner().FindComponent(SCR_InventoryStorageManagerComponent));
71 for (
int i, count = tourniquetStorageComp.GetSlotsCount(); i < count; i++)
77 if (tqTargetSlot.GetAssociatedHZGroup() != eHitZoneGroup)
81 if (tqTargetSlot.GetItem(i) == tourniquet)
84 if (tqTargetSlot.GetItem(i))
86 Print(
"TourniquetSlot already contained another item", LogLevel.WARNING);
93 SCR_CharacterInventoryStorageComponent charInventoryStorageComp = SCR_CharacterInventoryStorageComponent.Cast(
GetOwner().FindComponent(SCR_CharacterInventoryStorageComponent));
94 if (!charInventoryStorageComp)
97 m_TourniquetMovedCallback.m_Tourniquet = tourniquet;
98 m_TourniquetMovedCallback.m_CharInventoryStorageComp = charInventoryStorageComp;
99 m_TourniquetMovedCallback.m_iSlotId = eHitZoneGroup;
102 if (itemComp.GetParentSlot())
103 m_TourniquetMovedCallback.m_Storage = itemComp.GetParentSlot().GetStorage();
105 m_TourniquetMovedCallback.m_Storage =
null;
107 m_TourniquetMovedCallback.m_bRemove =
true;
109 if (storageMan.TryMoveItemToStorage(tourniquet, tourniquetStorageComp, tqTargetSlot.GetID(), m_TourniquetMovedCallback))
116 if (!invComp.GetParentSlot())
118 if (storageMan.TryInsertItemInStorage(tourniquet, tourniquetStorageComp, tqTargetSlot.GetID(), m_TourniquetMovedCallback))
130 ChimeraCharacter character = ChimeraCharacter.Cast(
GetOwner());
139 if (!tourniquetStorageComp)
142 if (!retrievingCharacter)
145 SCR_InventoryStorageManagerComponent storageMan = SCR_InventoryStorageManagerComponent.Cast(retrievingCharacter.FindComponent(SCR_InventoryStorageManagerComponent));
149 IEntity targetTourniquet;
151 for (
int i, count = tourniquetStorageComp.GetSlotsCount(); i < count; i++)
157 if (tqTargetSlot.GetAssociatedHZGroup() != eHitZoneGroup)
160 targetTourniquet = tqTargetSlot.GetItem(i);
164 BaseInventoryStorageComponent targetStorage = storageMan.FindStorageForItem(targetTourniquet,
EStoragePurpose.PURPOSE_DEPOSIT);
165 m_TourniquetMovedCallback.m_Storage = targetStorage;
166 m_TourniquetMovedCallback.m_bRemove =
false;
168 if (storageMan.TryMoveItemToStorage(targetTourniquet, targetStorage, tqTargetSlot.GetID(), m_TourniquetMovedCallback))
175 if (!invComp.GetParentSlot())
177 if (storageMan.TryInsertItemInStorage(targetTourniquet, targetStorage, tqTargetSlot.GetID(), m_TourniquetMovedCallback))
182 if (storageMan.TryMoveItemToStorage(targetTourniquet, targetStorage, tqTargetSlot.GetID(), m_TourniquetMovedCallback))
190 override void OnAddedToSlot(IEntity item,
int slotID)
192 ChimeraCharacter
char = ChimeraCharacter.Cast(
GetOwner());
204 damageMgr.SetTourniquettedGroup(tqSlot.GetAssociatedHZGroup(),
true);
208 override void OnRemovedFromSlot(IEntity item,
int slotID)
210 ChimeraCharacter
char = ChimeraCharacter.Cast(
GetOwner());
222 damageMgr.SetTourniquettedGroup(tqSlot.GetAssociatedHZGroup(),
false);
227 ScriptInvoker GetOnTourniquetMoved()
229 if (!m_TourniquetMovedCallback.m_OnTourniquetMoved)
230 m_TourniquetMovedCallback.m_OnTourniquetMoved =
new ScriptInvoker();
232 return m_TourniquetMovedCallback.m_OnTourniquetMoved;