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

◆ EEItemLocationChanged()

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

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

1063 {
1064 super.EEItemLocationChanged(oldLoc, newLoc);
1065
1066 PlayerBase newPlayer = null;
1067 PlayerBase oldPlayer = null;
1068
1069 if (newLoc.GetParent())
1070 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
1071
1072 if (oldLoc.GetParent())
1073 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
1074
1075 if (oldPlayer && oldLoc.GetType() == InventoryLocationType.HANDS)
1076 {
1077 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
1078
1079 if (rIndex >= 0)
1080 {
1081 InventoryLocation rIl = new InventoryLocation;
1082 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
1083
1084 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
1085 int rType = rIl.GetType();
1086 if (rType == InventoryLocationType.CARGO || rType == InventoryLocationType.PROXYCARGO)
1087 {
1088 rIl.GetParent().GetOnReleaseLock().Invoke(this);
1089 }
1090 else if (rType == InventoryLocationType.ATTACHMENT)
1091 {
1092 rIl.GetParent().GetOnAttachmentReleaseLock().Invoke(this, rIl.GetSlot());
1093 }
1094
1095 }
1096 }
1097
1098 if (newLoc.GetType() == InventoryLocationType.HANDS && oldLoc.GetType() != InventoryLocationType.TEMP)
1099 {
1100 if (newPlayer)
1101 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
1102
1103 if (newPlayer == oldPlayer)
1104 {
1105 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1106 {
1107 if (oldLoc.GetType() == InventoryLocationType.CARGO)
1108 {
1109 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
1110 {
1111 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1112 }
1113 }
1114 else
1115 {
1116 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1117 }
1118 }
1119
1120 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
1121 {
1122 int type = oldLoc.GetType();
1123 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
1124 {
1125 oldLoc.GetParent().GetOnSetLock().Invoke(this);
1126 }
1127 else if (type == InventoryLocationType.ATTACHMENT)
1128 {
1129 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
1130 }
1131 }
1132 if (!m_OldLocation)
1133 {
1134 m_OldLocation = new InventoryLocation;
1135 }
1136 m_OldLocation.Copy(oldLoc);
1137 }
1138 else
1139 {
1140 if (m_OldLocation)
1141 {
1142 m_OldLocation.Reset();
1143 }
1144 }
1145
1146 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(this,"Hands");
1147 }
1148 else
1149 {
1150 if (newPlayer)
1151 {
1152 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
1153 if (resIndex >= 0)
1154 {
1155 InventoryLocation il = new InventoryLocation;
1156 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
1157 ItemBase it = ItemBase.Cast(il.GetItem());
1158 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
1159 int rel_type = il.GetType();
1160 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
1161 {
1162 il.GetParent().GetOnReleaseLock().Invoke(it);
1163 }
1164 else if (rel_type == InventoryLocationType.ATTACHMENT)
1165 {
1166 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
1167 }
1168 //it.GetOnReleaseLock().Invoke(it);
1169 }
1170 }
1171 else if (oldPlayer && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
1172 {
1173 //ThrowPhysically(oldPlayer, vector.Zero);
1174 m_ThrowItemOnDrop = false;
1175 }
1176
1177 if (m_OldLocation)
1178 {
1179 m_OldLocation.Reset();
1180 }
1181 }
1182
1183 if (oldLoc.GetType() == InventoryLocationType.TEMP)
1184 {
1185 PluginInventoryRepair.Cast(GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
1186 }
1187
1188 if (newLoc.GetType() == InventoryLocationType.TEMP)
1189 {
1190 PluginInventoryRepair.Cast(GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
1191 }
1192 }
DayZGame g_Game
Определения DayZGame.c:3942
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:325
bool m_ThrowItemOnDrop
Определения ItemBase.c:70
void ItemBase()
Определения ItemBase.c:148
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

Перекрестные ссылки g_Game, InventoryLocation::GetItem(), InventoryLocation::GetParent(), GetPlugin(), InventoryLocation::GetSlot(), InventoryLocation::GetType(), ItemBase() и m_ThrowItemOnDrop.