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

◆ OnItemLocationChanged()

override void InventoryItem::OnItemLocationChanged ( EntityAI old_owner,
EntityAI new_owner )
inlineprivate

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

1216 {
1217 super.OnItemLocationChanged(old_owner, new_owner);
1218
1219 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
1220 PlayerBase playerNew = PlayerBase.Cast(new_owner);
1221
1222 if (!relatedPlayer && playerNew)
1223 relatedPlayer = playerNew;
1224
1225 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
1226 {
1227 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
1228 if (actionMgr)
1229 {
1230 ActionBase currentAction = actionMgr.GetRunningAction();
1231 if (currentAction)
1232 currentAction.OnItemLocationChanged(this);
1233 }
1234 }
1235
1236 Man ownerPlayerOld = null;
1237 Man ownerPlayerNew = null;
1238
1239 if (old_owner)
1240 {
1241 if (old_owner.IsMan())
1242 {
1243 ownerPlayerOld = Man.Cast(old_owner);
1244 }
1245 else
1246 {
1247 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
1248 }
1249 }
1250 else
1251 {
1252 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
1253 {
1254 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
1255
1256 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
1257 {
1258 GetCompEM().UnplugThis();
1259 }
1260 }
1261 }
1262
1263 if (new_owner)
1264 {
1265 if (new_owner.IsMan())
1266 {
1267 ownerPlayerNew = Man.Cast(new_owner);
1268 }
1269 else
1270 {
1271 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
1272 }
1273 }
1274
1275 if (ownerPlayerOld != ownerPlayerNew)
1276 {
1277 if (ownerPlayerOld)
1278 {
1279 array<EntityAI> subItemsExit = new array<EntityAI>;
1280 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
1281 for (int i = 0; i < subItemsExit.Count(); i++)
1282 {
1283 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
1284 itemExit.OnInventoryExit(ownerPlayerOld);
1285 }
1286 }
1287
1288 if (ownerPlayerNew)
1289 {
1290 array<EntityAI> subItemsEnter = new array<EntityAI>;
1291 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
1292 for (int j = 0; j < subItemsEnter.Count(); j++)
1293 {
1294 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
1295 itemEnter.OnInventoryEnter(ownerPlayerNew);
1296 }
1297 }
1298 }
1299 else if (ownerPlayerNew != null)
1300 {
1301 PlayerBase nplayer;
1302 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
1303 {
1304 array<EntityAI> subItemsUpdate = new array<EntityAI>;
1305 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
1306 for (int k = 0; k < subItemsUpdate.Count(); k++)
1307 {
1308 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
1309 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
1310 }
1311 }
1312 }
1313
1314 if (old_owner)
1315 old_owner.OnChildItemRemoved(this);
1316 if (new_owner)
1317 new_owner.OnChildItemReceived(this);
1318 }
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
override bool IsMan()
Определения Man.c:44
void ItemBase()
Определения ItemBase.c:140
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6

Перекрестные ссылки ActionManagerBase(), ActionBase::GetID(), ItemBase::IsElectricAppliance(), EntityAI::IsMan(), ItemBase(), ItemBase::OnInventoryEnter(), ItemBase::OnInventoryExit() и ActionBase::OnItemLocationChanged().