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
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);
1087 {
1088 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
1089 }
1091 {
1093 }
1094
1095 }
1096 }
1097
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 {
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();
1124 {
1125 oldLoc.GetParent().GetOnSetLock().Invoke(this);
1126 }
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);
1158 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
1161 {
1162 il.
GetParent().GetOnReleaseLock().Invoke(it);
1163 }
1165 {
1167 }
1168
1169 }
1170 }
1172 {
1173
1175 }
1176
1177 if (m_OldLocation)
1178 {
1179 m_OldLocation.Reset();
1180 }
1181 }
1182
1184 {
1185 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
1186 }
1187
1189 {
1190 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
1191 }
1192 }
InventoryLocationType
types of Inventory Location
PluginBase GetPlugin(typename plugin_type)
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