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

◆ EEItemLocationChanged()

override void EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
private

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

988 {
989 super.EEItemLocationChanged(oldLoc, newLoc);
990
991 PlayerBase newPlayer = null;
992 PlayerBase oldPlayer = null;
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
1000 if (oldPlayer && oldLoc.GetType() == InventoryLocationType.HANDS)
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);
1010 int rType = rIl.GetType();
1011 if (rType == InventoryLocationType.CARGO || rType == InventoryLocationType.PROXYCARGO)
1012 {
1013 rIl.GetParent().GetOnReleaseLock().Invoke(this);
1014 }
1015 else if (rType == InventoryLocationType.ATTACHMENT)
1016 {
1017 rIl.GetParent().GetOnAttachmentReleaseLock().Invoke(this, rIl.GetSlot());
1018 }
1019
1020 }
1021 }
1022
1023 if (newLoc.GetType() == InventoryLocationType.HANDS && oldLoc.GetType() != InventoryLocationType.TEMP)
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 {
1032 if (oldLoc.GetType() == InventoryLocationType.CARGO)
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();
1048 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
1049 {
1050 oldLoc.GetParent().GetOnSetLock().Invoke(this);
1051 }
1052 else if (type == InventoryLocationType.ATTACHMENT)
1053 {
1054 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
1055 }
1056 }
1057 if (!m_OldLocation)
1058 {
1059 m_OldLocation = new InventoryLocation;
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);
1082 ItemBase it = ItemBase.Cast(il.GetItem());
1083 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
1084 int rel_type = il.GetType();
1085 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
1086 {
1087 il.GetParent().GetOnReleaseLock().Invoke(it);
1088 }
1089 else if (rel_type == InventoryLocationType.ATTACHMENT)
1090 {
1091 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
1092 }
1093 //it.GetOnReleaseLock().Invoke(it);
1094 }
1095 }
1096 else if (oldPlayer && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
1097 {
1098 //ThrowPhysically(oldPlayer, vector.Zero);
1099 m_ThrowItemOnDrop = false;
1100 }
1101
1102 if (m_OldLocation)
1103 {
1104 m_OldLocation.Reset();
1105 }
1106 }
1107
1108 if (oldLoc.GetType() == InventoryLocationType.TEMP)
1109 {
1110 PluginInventoryRepair.Cast(GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
1111 }
1112
1113 if (newLoc.GetType() == InventoryLocationType.TEMP)
1114 {
1115 PluginInventoryRepair.Cast(GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
1116 }
1117 }
DayZGame g_Game
Определения DayZGame.c:4074
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
bool m_ThrowItemOnDrop
Определения ItemBase.c:58
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
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
InventoryLocation.
Определения InventoryLocation.c:30
Определения PlayerBaseClient.c:2

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