Satchel icon indicating copy to clipboard operation
Satchel copied to clipboard

Update number of hotbar slots at runtime

Open legendoj1 opened this issue 1 year ago • 1 comments

Is your feature request related to a problem?

Currently, it is hard to update the number of slots that show in the hotbar at runtime. The easiest way to configure the number of slots showing is by editing the constants at the top of the script, but updating these at runtime is impossible.

Describe the solution you'd like

I would like a method to be added to the API which allows setting the number of hotbar slots to show at runtime, e.g. Satchel:SetNumHotbarSlots(n: number). If the number passed is less than the number of currently showing tools, it would move current tools to the inventory to preserve them. If the number passed is more than the number of currently showing tools, it would move tool slots from the inventory into the hotbar.

Describe alternatives you've considered

No response

Additional context

The use case for this feature is that some users in my game complain about the 6 slots on mobile and I want to add a setting which allows people to choose between 1-10 slots to show on their own screen.

Code of Conduct

legendoj1 avatar Oct 24 '24 21:10 legendoj1

This is a very interesting and a good suggestion.

The issue currently is that Satchel only can update the hotbar slots when it's initiated (stored in NumberOfHotbarSlots), so updating it dynamically would need a fair bit of work and custom logic. I tried before to get Satchel to update dynamically at runtime based on the viewport size but it was too hard to implement.

I'll leave this issue up for any PRs and since it is a great request, but I personally won't be doing any work on this since it was pretty difficult for me to touch anything that relates to making hard-coded values update on the fly (reduced transparency was hard to add).

ryanlua avatar Oct 24 '24 22:10 ryanlua