Skip to content

Commit

Permalink
Fix SOC/CS slots ordering support (#382, #392)
Browse files Browse the repository at this point in the history
In SOC and CS slots start from -1.
e.g. knife slot is 0 in SOC/CS and 1 in COP.
  • Loading branch information
Xottab-DUTY committed Dec 12, 2024
1 parent 068fc05 commit 4312254
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions res/gamedata/configs/openxray.ltx
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ game_mode = cop
; Always try to put item in the slot, SOC behaviour
; For the comparison, COP tries to do that only if item has default_to_ruck = false
default_to_slot = false

; SOC/CS slots ordering
; e.g. knife slot is 0 in SOC/CS and 1 in COP
minus_one_slot_ordering = false
3 changes: 3 additions & 0 deletions src/xrGame/script_game_object_inventory_owner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,9 @@ CScriptGameObject* CScriptGameObject::item_in_slot(u32 slot_id) const
return (0);
}

if (pSettingsOpenXRay->read_if_exists<bool>("compatibility", "minus_one_slot_ordering", ShadowOfChernobylMode || ClearSkyMode))
++slot_id;

CInventoryItem* result = inventory_owner->inventory().ItemFromSlot((u16)slot_id);
return (result ? result->object().lua_game_object() : 0);
}
Expand Down

0 comments on commit 4312254

Please sign in to comment.