Big fixes

This commit is contained in:
dingo
2026-01-26 17:42:23 -05:00
parent c1a97b219e
commit b434eb6031
10 changed files with 303 additions and 76 deletions
+17 -10
View File
@@ -93,12 +93,16 @@ func _setup_hotbar():
func _on_hotbar_slot_input(event: InputEvent, slot_index: int):
if not event is InputEventMouseButton:
return
# Check if dropping from DragManager
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
# Check if dropping from DragManager (on press or release)
if event.button_index == MOUSE_BUTTON_LEFT:
if DragManager and DragManager.is_dragging:
# Drop on either press or release to catch the item
DragManager.drop_on("hotbar", slot_index)
elif not event.pressed:
# Not dragging, clicked hotbar slot - use the item
_on_hotbar_pressed(slot_index)
# Right click to clear hotbar slot
elif event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
GameState.assign_hotbar(slot_index, -1) # -1 to clear
@@ -336,7 +340,7 @@ func _update_hotbar():
var inv_slot = hotbar_entry.inventory_slot
if inv_slot < GameState.inventory.size():
var item = GameState.inventory[inv_slot]
if item and item.get("type") == "Consumable":
if item and (item.get("type") == "Consumable" or item.get("type") == "Weapon" or item.get("type") == "Armor" or item.get("type") == "Accessory"):
slot.text = ""
# Try to load sprite from CDN
@@ -461,16 +465,19 @@ func _get_mobile_controls_enabled() -> bool:
return ProjectSettings.get_setting("application/config/mobile_controls_enabled", true)
return ProjectSettings.get_setting("application/config/mobile_controls_enabled", false)
func set_mobile_controls_visible(visible: bool):
func set_mobile_controls_visible(is_visible: bool):
# Show/hide mobile UI buttons
if inventory_button:
inventory_button.visible = visible
inventory_button.visible = is_visible
if crafting_button:
crafting_button.visible = visible
crafting_button.visible = is_visible
if stats_button:
stats_button.visible = visible
stats_button.visible = is_visible
# Show/hide touch joystick
var joystick = get_node_or_null("TouchJoystick")
if joystick:
joystick.visible = visible
joystick.visible = is_visible
func get_hotbar_slots() -> Array:
return hotbar_slots