Skip to content

Commit

Permalink
Добавил проверку на блокирование слота ( например на лестнице и тп )
Browse files Browse the repository at this point in the history
Co-Authored-By: Laucer7 <38085008+laucer7@users.noreply.github.com>
  • Loading branch information
xrSimpodin and Laucer7 committed Apr 30, 2021
1 parent 1bd3815 commit fd2a9d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ogsr_engine/xrGame/Inventory.cpp
Expand Up @@ -1279,3 +1279,11 @@ PIItem CInventory::GetAmmoMinCurr( const char *name, bool forActor ) const {

return box;
}


bool CInventory::IsActiveSlotBlocked() const {
for (const auto& slot : m_slots)
if (slot.CanBeActivated())
return false;
return true;
}
1 change: 1 addition & 0 deletions ogsr_engine/xrGame/Inventory.h
Expand Up @@ -146,6 +146,7 @@ class CInventory
void InvalidateState () { m_dwModifyFrame = Device.dwFrame; }
void Items_SetCurrentEntityHud (bool current_entity);
bool isBeautifulForActiveSlot (CInventoryItem *pIItem);
bool IsActiveSlotBlocked() const;

// максимальный вес инвентаря
float m_fMaxWeight;
Expand Down
2 changes: 2 additions & 0 deletions ogsr_engine/xrGame/derived_client_classes.cpp
Expand Up @@ -243,6 +243,8 @@ void CInventoryScript::script_register(lua_State *L)
.property ("active_item" , &inventory_active_item)
.property ("selected_item" , &inventory_selected_item)
.property ("target" , &get_inventory_target)
.def("is_active_slot_blocked", &CInventory::IsActiveSlotBlocked)

//.property ("class_name" , &get_lua_class_name)
//.def ("to_belt" , &item_to_slot, raw(_2))
//.def ("to_slot" , &item_to_slot, raw(_2))
Expand Down

0 comments on commit fd2a9d7

Please sign in to comment.