diff --git a/Core.cpk/Scripts/Characters/State/PlayerCharacterPrivateState.cs b/Core.cpk/Scripts/Characters/State/PlayerCharacterPrivateState.cs index e2c4ea680..ef7c25d57 100644 --- a/Core.cpk/Scripts/Characters/State/PlayerCharacterPrivateState.cs +++ b/Core.cpk/Scripts/Characters/State/PlayerCharacterPrivateState.cs @@ -154,7 +154,7 @@ public void ServerInitState(ICharacter character) this.ContainerHotbar ??= serverItemsService.CreateContainer( character, - slotsCount: 10); + slotsCount: PlayerConstants.HotbarSlotsCount); this.CraftingQueue ??= new CharacterCraftingQueue(); this.Skills ??= new PlayerCharacterSkills(); diff --git a/Core.cpk/Scripts/Characters/State/PlayerConstants.cs b/Core.cpk/Scripts/Characters/State/PlayerConstants.cs index 723c94745..122beec75 100644 --- a/Core.cpk/Scripts/Characters/State/PlayerConstants.cs +++ b/Core.cpk/Scripts/Characters/State/PlayerConstants.cs @@ -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). /// public const int InventorySlotsCount = 40; + /// + /// 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 + /// + public const int HotbarSlotsCount = 10; } } \ No newline at end of file diff --git a/Core.cpk/Scripts/ClientComponents/InputListeners/ClientComponentHotBarHelper.cs b/Core.cpk/Scripts/ClientComponents/InputListeners/ClientComponentHotBarHelper.cs index 88abf3414..5b7b72a91 100644 --- a/Core.cpk/Scripts/ClientComponents/InputListeners/ClientComponentHotBarHelper.cs +++ b/Core.cpk/Scripts/ClientComponents/InputListeners/ClientComponentHotBarHelper.cs @@ -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)) {