hotbar: wrap

This commit is contained in:
2026-01-09 18:10:16 +02:00
parent 4785795640
commit bc62f8bd70
4 changed files with 81 additions and 51 deletions

View File

@@ -81,9 +81,6 @@ local function sanitizeSelection(hotbar, selectedSlot)
if selectedSlot < 1 or selectedSlot > HOTBAR_SIZE then
return (#hotbar > 0) and 1 or 0
end
if not hotbar[selectedSlot] then
return (#hotbar > 0) and 1 or 0
end
return selectedSlot
end
@@ -138,7 +135,7 @@ local function handleReplicaEvents(player: Player, replica)
if not hotbar then
return
end
if slot and slot >= 1 and slot <= HOTBAR_SIZE and hotbar[slot] then
if slot and slot >= 1 and slot <= HOTBAR_SIZE then
replica:Set({"selectedSlot"}, slot)
end
end