988 {
989 super.EEItemLocationChanged(oldLoc, newLoc);
990
993
994 if (newLoc.GetParent())
995 newPlayer =
PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
996
997 if (oldLoc.GetParent())
998 oldPlayer =
PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
999
1001 {
1002 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
1003
1004 if (rIndex >= 0)
1005 {
1007 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
1008
1009 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
1012 {
1013 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
1014 }
1016 {
1018 }
1019
1020 }
1021 }
1022
1024 {
1025 if (newPlayer)
1026 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
1027
1028 if (newPlayer == oldPlayer)
1029 {
1030 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1031 {
1033 {
1034 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
1035 {
1036 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1037 }
1038 }
1039 else
1040 {
1041 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
1042 }
1043 }
1044
1045 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
1046 {
1047 int type = oldLoc.GetType();
1049 {
1050 oldLoc.GetParent().GetOnSetLock().Invoke(this);
1051 }
1053 {
1054 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
1055 }
1056 }
1057 if (!m_OldLocation)
1058 {
1060 }
1061 m_OldLocation.Copy(oldLoc);
1062 }
1063 else
1064 {
1065 if (m_OldLocation)
1066 {
1067 m_OldLocation.Reset();
1068 }
1069 }
1070
1071 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
1072 }
1073 else
1074 {
1075 if (newPlayer)
1076 {
1077 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
1078 if (resIndex >= 0)
1079 {
1081 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
1083 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
1086 {
1087 il.
GetParent().GetOnReleaseLock().Invoke(it);
1088 }
1090 {
1092 }
1093
1094 }
1095 }
1097 {
1098
1100 }
1101
1102 if (m_OldLocation)
1103 {
1104 m_OldLocation.Reset();
1105 }
1106 }
1107
1109 {
1110 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
1111 }
1112
1114 {
1115 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
1116 }
1117 }
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