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

◆ EEItemLocationChanged()

override void InventoryItem::EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
inlineprivate

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

1053 {
1054 super.EEItemLocationChanged(oldLoc,newLoc);
1055
1056 PlayerBase new_player = null;
1057 PlayerBase old_player = null;
1058
1059 if (newLoc.GetParent())
1060 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
1061
1062 if (oldLoc.GetParent())
1063 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
1064
1065 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
1066 {
1067 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
1068
1069 if (r_index >= 0)
1070 {
1071 InventoryLocation r_il = new InventoryLocation;
1072 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1073
1074 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1075 int r_type = r_il.GetType();
1076 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
1077 {
1078 r_il.GetParent().GetOnReleaseLock().Invoke(this);
1079 }
1080 else if (r_type == InventoryLocationType.ATTACHMENT)
1081 {
1082 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
1083 }
1084
1085 }
1086 }
1087
1088 if (newLoc.GetType() == InventoryLocationType.HANDS)
1089 {
1090 if (new_player)
1091 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
1092
1093 if (new_player == old_player)
1094 {
1095
1096 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1097 {
1098 if (oldLoc.GetType() == InventoryLocationType.CARGO)
1099 {
1100 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
1101 {
1102 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1103 }
1104 }
1105 else
1106 {
1107 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1108 }
1109 }
1110
1111 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
1112 {
1113 int type = oldLoc.GetType();
1114 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
1115 {
1116 oldLoc.GetParent().GetOnSetLock().Invoke(this);
1117 }
1118 else if (type == InventoryLocationType.ATTACHMENT)
1119 {
1120 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
1121 }
1122 }
1123 if (!m_OldLocation)
1124 {
1125 m_OldLocation = new InventoryLocation;
1126 }
1127 m_OldLocation.Copy(oldLoc);
1128 }
1129 else
1130 {
1131 if (m_OldLocation)
1132 {
1133 m_OldLocation.Reset();
1134 }
1135 }
1136
1138 }
1139 else
1140 {
1141 if (new_player)
1142 {
1143 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
1144 if (res_index >= 0)
1145 {
1146 InventoryLocation il = new InventoryLocation;
1147 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
1148 ItemBase it = ItemBase.Cast(il.GetItem());
1149 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
1150 int rel_type = il.GetType();
1151 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
1152 {
1153 il.GetParent().GetOnReleaseLock().Invoke(it);
1154 }
1155 else if (rel_type == InventoryLocationType.ATTACHMENT)
1156 {
1157 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
1158 }
1159 //it.GetOnReleaseLock().Invoke(it);
1160 }
1161 }
1162 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
1163 {
1164 //ThrowPhysically(old_player, vector.Zero);
1165 m_ThrowItemOnDrop = false;
1166 }
1167
1168 if (m_OldLocation)
1169 {
1170 m_OldLocation.Reset();
1171 }
1172 }
1173 }
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
bool m_ThrowItemOnDrop
Определения ItemBase.c:64
void ItemBase()
Определения ItemBase.c:140
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetType()
returns type of InventoryLocation
proto native EntityAI GetItem()
returns item of current inventory location
proto native CGame GetGame()

Перекрестные ссылки CGame::GetAnalyticsClient(), GetGame(), InventoryLocation::GetItem(), InventoryLocation::GetParent(), InventoryLocation::GetSlot(), InventoryLocation::GetType(), ItemBase(), m_ThrowItemOnDrop и AnalyticsManagerClient::OnItemAttachedAtPlayer().