1235 {
1236 super.OnItemLocationChanged(old_owner, new_owner);
1237
1238 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
1239 PlayerBase playerNew = PlayerBase.Cast(new_owner);
1240
1241 if (!relatedPlayer && playerNew)
1242 relatedPlayer = playerNew;
1243
1244 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
1245 {
1247 if (actionMgr)
1248 {
1249 ActionBase currentAction = actionMgr.GetRunningAction();
1250 if (currentAction)
1252 }
1253 }
1254
1255 Man ownerPlayerOld = null;
1256 Man ownerPlayerNew = null;
1257
1258 if (old_owner)
1259 {
1260 if (old_owner.
IsMan())
1261 {
1262 ownerPlayerOld = Man.Cast(old_owner);
1263 }
1264 else
1265 {
1266 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
1267 }
1268 }
1269 else
1270 {
1271 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
1272 {
1274
1275 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
1276 {
1277 GetCompEM().UnplugThis();
1278 }
1279 }
1280 }
1281
1282 if (new_owner)
1283 {
1284 if (new_owner.
IsMan())
1285 {
1286 ownerPlayerNew = Man.Cast(new_owner);
1287 }
1288 else
1289 {
1290 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
1291 }
1292 }
1293
1294 if (ownerPlayerOld != ownerPlayerNew)
1295 {
1296 if (ownerPlayerOld)
1297 {
1298 array<EntityAI> subItemsExit = new array<EntityAI>;
1300 for (int i = 0; i < subItemsExit.Count(); i++)
1301 {
1304 }
1305 }
1306
1307 if (ownerPlayerNew)
1308 {
1309 array<EntityAI> subItemsEnter = new array<EntityAI>;
1311 for (int j = 0; j < subItemsEnter.Count(); j++)
1312 {
1315 }
1316 }
1317 }
1318 else if (ownerPlayerNew != null)
1319 {
1320 PlayerBase nplayer;
1321 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
1322 {
1323 array<EntityAI> subItemsUpdate = new array<EntityAI>;
1325 for (int k = 0; k < subItemsUpdate.Count(); k++)
1326 {
1328 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
1329 }
1330 }
1331 }
1332
1333 if (old_owner)
1334 old_owner.OnChildItemRemoved(this);
1335 if (new_owner)
1336 new_owner.OnChildItemReceived(this);
1337 }
void ActionManagerBase(PlayerBase player)
void OnItemLocationChanged(ItemBase item)
override void OnInventoryEnter(Man player)
override void OnInventoryExit(Man player)
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal