Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void ServerInitState(ICharacter character)

this.ContainerHotbar ??= serverItemsService.CreateContainer<ItemsContainerCharacterHotbar>(
character,
slotsCount: 10);
slotsCount: PlayerConstants.HotbarSlotsCount);

this.CraftingQueue ??= new CharacterCraftingQueue();
this.Skills ??= new PlayerCharacterSkills();
Expand Down
6 changes: 6 additions & 0 deletions Core.cpk/Scripts/Characters/State/PlayerConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ public static class PlayerConstants
/// Please note that it doesn't apply to the already registered players (their inventory container is already created).
/// </summary>
public const int InventorySlotsCount = 40;
/// <summary>
/// The number of the hotbar slots is configured here.
/// Please note that it doesn't apply to the already registered players (their hotbar container is already created).
/// Also note if this value is odd then it will create a graphical bug in the display of the hotbar. See https://i.imgur.com/Dl6sRBi.png
/// </summary>
public const int HotbarSlotsCount = 10;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ private void ProcessInputUpdate()
// the key was pressed
var hotbarSlotId = pair.Value;

if (hotbarSlotId >= ClientHotbarSelectedItemManager.ContainerHotbar.SlotsCount)
{
break;
}

if (Input.IsKeyHeld(InputKey.Control, evenIfHandled: true)
|| Input.IsKeyHeld(InputKey.Alt, evenIfHandled: true))
{
Expand Down