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

◆ OnItemAttachedAtPlayer()

void AnalyticsManagerClient::OnItemAttachedAtPlayer ( EntityAI item,
string slot_name )
inlineprivate

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

78 {
79 bool weapon_present;
80 bool melee_present;
81 bool backpack_present;
82 HumanInventory inventory;
83
84 if ( GetDayZGame().GetGameState() != DayZGameState.IN_GAME )
85 {
86 return;
87 }
88
89 Man player = GetGame().GetPlayer();
90 if (!player)
91 {
92 return;
93 }
94
95 inventory = player.GetHumanInventory();
96
97 if ( player && inventory )
98 {
99 for ( int i = 0; i < GEAR_COUNT; ++i )
100 {
101 int slot_id = InventorySlots.GetSlotIdFromString(m_FullGear[i]);
102 EntityAI att_item = inventory.FindAttachment( slot_id ); // Boris V [27.2.2019]: Consider using player.GetItemOnSlot(m_FullGear[i]) instead.
103
104 if ( !att_item )
105 {
106 //Print("index: "+ i +" slot_id: "+ slot_id +" = "+ att_item + " EMPTY");
107 continue;
108 }
109
110 //checks for firearm
111 if (att_item.IsWeapon())
112 weapon_present = true;
113 //checks for melee weapon
114 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Melee")))
115 melee_present = true;
116 //checks for backpack
117 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Back")))
118 backpack_present = true;
119 //Print("index: "+ i +" slot_id: "+ slot_id +" = "+ att_item + " ATTACHED");
120 }
121
122 //separate check for hand slot; TODO remove duplicates
123 att_item = inventory.GetEntityInHands();
124 if ( att_item )
125 {
126 //checks for firearm
127 if (att_item.IsWeapon())
128 weapon_present = true;
129 //checks for melee weapon
130 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Melee")) )
131 melee_present = true;
132 //checks for backpack
133 else if (!att_item.IsWeapon() && att_item.GetInventory().HasInventorySlot(InventorySlots.GetSlotIdFromString("Back")))
134 backpack_present = true;
135 }
136
137 if (weapon_present && melee_present && backpack_present)
138 {
139 //Print("---EAchievementActionId.ACTION_EQUIP_GEAR");
140 Achievements.OnEquippedFullGear();
141 }
142 }
143 }
class LogManager EntityAI
DayZGame GetDayZGame()
Определения DayZGame.c:3870
static string m_FullGear[GEAR_COUNT]
Определения AnalyticsManagerClient.c:4
static const int GEAR_COUNT
Определения AnalyticsManagerClient.c:3
proto native DayZPlayer GetPlayer()
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
proto native EntityAI GetEntityInHands()
proto native CGame GetGame()

Перекрестные ссылки GameInventory::FindAttachment(), GEAR_COUNT, GetDayZGame(), HumanInventory::GetEntityInHands(), GetGame(), CGame::GetPlayer(), InventorySlots::GetSlotIdFromString(), m_FullGear и Achievements::OnEquippedFullGear().

Используется в ManBase::EEItemAttached() и InventoryItem::EEItemLocationChanged().