Loot changes
This commit is contained in:
@@ -123,7 +123,7 @@ func _toggle_char_sheet():
|
||||
char_sheet_ui.visible = not char_sheet_ui.visible
|
||||
|
||||
func _create_settings_panel():
|
||||
# Create settings button (top right corner, smaller)
|
||||
# Create settings button (top right corner, 1/3 original size)
|
||||
settings_btn = TextureButton.new()
|
||||
settings_btn.custom_minimum_size = Vector2(16, 16)
|
||||
|
||||
@@ -133,7 +133,7 @@ func _create_settings_panel():
|
||||
var settings_texture = UpdateManager.load_texture("textures/ui/buttons/settings.png")
|
||||
if settings_texture:
|
||||
settings_btn.texture_normal = settings_texture
|
||||
settings_btn.scale = Vector2(.5,.5)
|
||||
settings_btn.scale = Vector2(.17,.17) # 1/3 of 0.5 = 0.167
|
||||
texture_loaded = true
|
||||
|
||||
# Fallback: add a visible background if texture doesn't load
|
||||
@@ -144,12 +144,12 @@ func _create_settings_panel():
|
||||
fallback_style.set_border_width_all(2)
|
||||
fallback_style.set_corner_radius_all(8)
|
||||
settings_btn.add_theme_stylebox_override("normal", fallback_style)
|
||||
|
||||
|
||||
|
||||
# Add a label to show "⚙" gear icon
|
||||
var label = Label.new()
|
||||
label.text = "⚙"
|
||||
label.add_theme_font_size_override("font_size", 18)
|
||||
label.add_theme_font_size_override("font_size", 6) # Smaller for 1/3 size
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
label.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
@@ -158,12 +158,12 @@ func _create_settings_panel():
|
||||
settings_btn.pressed.connect(_toggle_settings_panel)
|
||||
add_child(settings_btn)
|
||||
|
||||
# Position top right corner (moved further left)
|
||||
# Position top right corner (moved further left and down)
|
||||
settings_btn.set_anchors_and_offsets_preset(Control.PRESET_TOP_RIGHT)
|
||||
settings_btn.offset_left = -100
|
||||
settings_btn.offset_left = -50
|
||||
settings_btn.offset_top = 10
|
||||
settings_btn.offset_right = -118
|
||||
settings_btn.offset_bottom = 42
|
||||
settings_btn.offset_right = -56
|
||||
settings_btn.offset_bottom = 24
|
||||
|
||||
# Create settings panel (initially hidden)
|
||||
settings_panel = Panel.new()
|
||||
|
||||
@@ -26,6 +26,7 @@ var minimap_tex: ImageTexture = null
|
||||
# Mobile UI buttons
|
||||
var inventory_button: Button = null
|
||||
var crafting_button: Button = null
|
||||
var stats_button: Button = null
|
||||
|
||||
const MINIMAP_SIZE := 120
|
||||
const MINIMAP_SCALE := 3 # How many world pixels per minimap pixel
|
||||
@@ -172,6 +173,28 @@ func _setup_mobile_buttons():
|
||||
crafting_button.offset_right = -10
|
||||
crafting_button.offset_bottom = -150
|
||||
|
||||
# Create stats button (bottom right, above crafting)
|
||||
stats_button = Button.new()
|
||||
stats_button.text = "Stats"
|
||||
stats_button.custom_minimum_size = Vector2(60, 60)
|
||||
|
||||
var stats_style = StyleBoxFlat.new()
|
||||
stats_style.bg_color = Color(0.3, 0.5, 0.3, 0.9)
|
||||
stats_style.border_color = Color(0.5, 0.7, 0.5)
|
||||
stats_style.set_border_width_all(2)
|
||||
stats_style.set_corner_radius_all(8)
|
||||
stats_button.add_theme_stylebox_override("normal", stats_style)
|
||||
|
||||
stats_button.pressed.connect(_on_mobile_stats_pressed)
|
||||
add_child(stats_button)
|
||||
|
||||
# Position bottom right, above crafting button
|
||||
stats_button.set_anchors_and_offsets_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
stats_button.offset_left = -70
|
||||
stats_button.offset_top = -280
|
||||
stats_button.offset_right = -10
|
||||
stats_button.offset_bottom = -220
|
||||
|
||||
func _on_mobile_inventory_pressed():
|
||||
# Toggle inventory visibility
|
||||
var dungeon_manager = get_tree().get_first_node_in_group("dungeon_manager")
|
||||
@@ -184,6 +207,12 @@ func _on_mobile_crafting_pressed():
|
||||
if dungeon_manager and dungeon_manager.has_method("_toggle_crafting"):
|
||||
dungeon_manager._toggle_crafting()
|
||||
|
||||
func _on_mobile_stats_pressed():
|
||||
# Toggle char sheet visibility
|
||||
var dungeon_manager = get_tree().get_first_node_in_group("dungeon_manager")
|
||||
if dungeon_manager and dungeon_manager.has_method("_toggle_char_sheet"):
|
||||
dungeon_manager._toggle_char_sheet()
|
||||
|
||||
func _generate_minimap():
|
||||
if not GameState or GameState.dungeon.tiles.is_empty():
|
||||
return
|
||||
@@ -438,6 +467,8 @@ func set_mobile_controls_visible(visible: bool):
|
||||
inventory_button.visible = visible
|
||||
if crafting_button:
|
||||
crafting_button.visible = visible
|
||||
if stats_button:
|
||||
stats_button.visible = visible
|
||||
|
||||
# Show/hide touch joystick
|
||||
var joystick = get_node_or_null("TouchJoystick")
|
||||
|
||||
+47
-21
@@ -302,10 +302,22 @@ func _get_item_emoji(item: Dictionary) -> String:
|
||||
func _on_inventory_gui_input(event: InputEvent, slot_index: int):
|
||||
if not event is InputEventMouseButton:
|
||||
return
|
||||
|
||||
|
||||
var item = GameState.inventory[slot_index] if slot_index < GameState.inventory.size() else null
|
||||
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
|
||||
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
if item == null:
|
||||
return
|
||||
# Left click: equip/unequip or assign to hotbar
|
||||
var item_type = item.get("type", item.get("Type", ""))
|
||||
if item_type == "Consumable":
|
||||
# Show hotbar menu for consumables
|
||||
_show_hotbar_menu(slot_index)
|
||||
elif item_type in ["Weapon", "Armor", "Accessory"]:
|
||||
# Equip on left click
|
||||
GameState.send_equip_item(slot_index)
|
||||
|
||||
elif event.button_index == MOUSE_BUTTON_RIGHT:
|
||||
if event.pressed:
|
||||
# Start drag if has item
|
||||
if item and not item.is_empty() and DragManager:
|
||||
@@ -313,25 +325,18 @@ func _on_inventory_gui_input(event: InputEvent, slot_index: int):
|
||||
else:
|
||||
# End drag on release (if still dragging)
|
||||
if DragManager and DragManager.is_dragging:
|
||||
# Check if we should equip or use
|
||||
# Check if we're dropping onto another inventory slot
|
||||
var target_item = GameState.inventory[slot_index] if slot_index < GameState.inventory.size() else null
|
||||
var drag_item = DragManager.get_drag_item()
|
||||
var item_type = drag_item.get("type", drag_item.get("Type", ""))
|
||||
GameState.send_use_item(slot_index)
|
||||
# If released over same slot or no target, treat as click
|
||||
# For now, just end the drag
|
||||
|
||||
# Try to stack consumables
|
||||
if target_item and drag_item and _can_stack_items(drag_item, target_item):
|
||||
var source_slot = DragManager.drag_data.get("source_slot", -1)
|
||||
if source_slot >= 0 and source_slot != slot_index:
|
||||
GameState.send_stack_items(source_slot, slot_index)
|
||||
|
||||
# Just end the drag - drop handling is done by the drop target
|
||||
DragManager.end_drag()
|
||||
|
||||
elif event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
|
||||
if item == null:
|
||||
return
|
||||
# Right click: context action
|
||||
var item_type = item.get("type", item.get("Type", ""))
|
||||
if item_type == "Consumable":
|
||||
# Use consumable on right click
|
||||
_show_hotbar_menu(slot_index)
|
||||
elif item_type in ["Weapon", "Armor", "Accessory"]:
|
||||
# Equip on right click
|
||||
GameState.send_equip_item(slot_index)
|
||||
|
||||
func _on_equipment_gui_input(event: InputEvent, slot_name: String):
|
||||
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
@@ -339,6 +344,27 @@ func _on_equipment_gui_input(event: InputEvent, slot_name: String):
|
||||
if item != null:
|
||||
GameState.send_unequip_item(slot_name)
|
||||
|
||||
func _can_stack_items(item1: Dictionary, item2: Dictionary) -> bool:
|
||||
# Check if both items are consumables with the same name
|
||||
var type1 = item1.get("type", item1.get("Type", ""))
|
||||
var type2 = item2.get("type", item2.get("Type", ""))
|
||||
|
||||
if type1 != "Consumable" or type2 != "Consumable":
|
||||
return false
|
||||
|
||||
# Check if same item type
|
||||
var name1 = item1.get("name", item1.get("Name", ""))
|
||||
var name2 = item2.get("name", item2.get("Name", ""))
|
||||
|
||||
if name1 != name2:
|
||||
return false
|
||||
|
||||
# Check if target has room (not already at max stack)
|
||||
var max_stack = item2.get("maxStack", item2.get("MaxStack", 99))
|
||||
var current_quantity = item2.get("quantity", item2.get("Quantity", 1))
|
||||
|
||||
return current_quantity < max_stack
|
||||
|
||||
func _show_hotbar_menu(inv_slot: int):
|
||||
# Simple approach: assign to next empty hotbar slot or use slot 0
|
||||
# For now, find first empty slot or use slot 0
|
||||
@@ -347,7 +373,7 @@ func _show_hotbar_menu(inv_slot: int):
|
||||
if GameState.hotbar[i] == null:
|
||||
target_slot = i
|
||||
break
|
||||
|
||||
|
||||
GameState.assign_hotbar(target_slot, inv_slot)
|
||||
print("Assigned inventory slot %d to hotbar slot %d" % [inv_slot, target_slot])
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
extends CanvasLayer
|
||||
|
||||
@onready var progress_bar = $Panel/VBoxContainer/ProgressBar
|
||||
@onready var status_label = $Panel/VBoxContainer/StatusLabel
|
||||
@onready var file_label = $Panel/VBoxContainer/FileLabel
|
||||
|
||||
func _ready():
|
||||
print("[LoadingScreen] _ready called")
|
||||
|
||||
# Connect to UpdateManager signals
|
||||
if UpdateManager:
|
||||
UpdateManager.update_check_started.connect(_on_update_check_started)
|
||||
UpdateManager.update_progress.connect(_on_update_progress)
|
||||
UpdateManager.update_completed.connect(_on_update_completed)
|
||||
UpdateManager.update_failed.connect(_on_update_failed)
|
||||
|
||||
progress_bar.value = 0
|
||||
|
||||
func _on_update_check_started():
|
||||
status_label.text = "Checking for updates..."
|
||||
progress_bar.value = 0
|
||||
|
||||
func _on_update_progress(downloaded: int, total: int, current_file: String):
|
||||
if total > 0:
|
||||
progress_bar.value = (float(downloaded) / float(total)) * 100.0
|
||||
status_label.text = "Downloading assets... (%d/%d)" % [downloaded, total]
|
||||
file_label.text = current_file
|
||||
else:
|
||||
progress_bar.value = 100.0
|
||||
status_label.text = "No updates needed"
|
||||
file_label.text = ""
|
||||
|
||||
func _on_update_completed(updated_count: int):
|
||||
progress_bar.value = 100.0
|
||||
if updated_count > 0:
|
||||
status_label.text = "Downloaded %d assets" % updated_count
|
||||
else:
|
||||
status_label.text = "All assets up to date"
|
||||
file_label.text = ""
|
||||
|
||||
# Wait a moment then proceed to auth screen
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
GameState.set_state(0)
|
||||
|
||||
func _on_update_failed(error: String):
|
||||
status_label.text = "Update failed: " + error
|
||||
file_label.text = "Click to continue anyway"
|
||||
progress_bar.value = 0
|
||||
|
||||
# Allow continuing anyway after 2 seconds
|
||||
await get_tree().create_timer(2.0).timeout
|
||||
GameState.set_state(0)
|
||||
@@ -0,0 +1 @@
|
||||
uid://dpavdbbtbxlao
|
||||
+16
-8
@@ -1,5 +1,6 @@
|
||||
extends Node
|
||||
|
||||
@onready var loading_screen = $LoadingScreen
|
||||
@onready var auth_screen = $AuthScreen
|
||||
@onready var hub_screen = $HubScreen
|
||||
@onready var dungeon_scene = $DungeonScene
|
||||
@@ -7,8 +8,18 @@ extends Node
|
||||
|
||||
func _ready():
|
||||
print("[Main] _ready called")
|
||||
_show_screen("AUTH")
|
||||
_show_screen("LOADING")
|
||||
call_deferred("_setup_signals")
|
||||
call_deferred("_start_loading")
|
||||
|
||||
func _start_loading():
|
||||
# Connect to server and start asset download
|
||||
if not Network.is_socket_connected():
|
||||
print("[Main] Connecting to server...")
|
||||
Network.connect_to_server()
|
||||
await Network.connected
|
||||
print("[Main] Connected! Calling check_for_updates...")
|
||||
UpdateManager.check_for_updates()
|
||||
|
||||
func _setup_signals():
|
||||
print("[Main] _setup_signals called")
|
||||
@@ -25,16 +36,13 @@ func _on_state_changed(new_state: String):
|
||||
|
||||
func _show_screen(state: String):
|
||||
print("[Main] _show_screen called with: ", state)
|
||||
|
||||
|
||||
if loading_screen:
|
||||
_set_screen_visible(loading_screen, state == "LOADING")
|
||||
print("[Main] LoadingScreen visible: ", state == "LOADING")
|
||||
if auth_screen:
|
||||
_set_screen_visible(auth_screen, state == "AUTH")
|
||||
print("[Main] AuthScreen visible: ", state == "AUTH")
|
||||
if state == "AUTH" and not Network.is_socket_connected():
|
||||
print("[Main] Connecting to server...")
|
||||
Network.connect_to_server()
|
||||
await Network.connected
|
||||
print("[Main] Connected! Calling check_for_updates...")
|
||||
UpdateManager.check_for_updates()
|
||||
if hub_screen:
|
||||
_set_screen_visible(hub_screen, state == "HUB")
|
||||
print("[Main] HubScreen visible: ", state == "HUB")
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
extends CanvasLayer
|
||||
|
||||
## Mob Loot UI
|
||||
## Displays loot from a dead mob in a 5x4 grid with scrollbar
|
||||
|
||||
@onready var panel_container = $PanelContainer
|
||||
@onready var close_button = $PanelContainer/VBoxContainer/Header/CloseButton
|
||||
@onready var mob_name_label = $PanelContainer/VBoxContainer/Header/MobNameLabel
|
||||
@onready var loot_grid = $PanelContainer/VBoxContainer/Content/ScrollContainer/LootGrid
|
||||
@onready var scroll_container = $PanelContainer/VBoxContainer/Content/ScrollContainer
|
||||
@onready var take_all_button = $PanelContainer/VBoxContainer/Footer/TakeAllButton
|
||||
|
||||
const RARITY_COLORS = {
|
||||
"Common": Color(0.7, 0.7, 0.7),
|
||||
"Uncommon": Color(0.18, 0.8, 0.44),
|
||||
"Rare": Color(0.2, 0.6, 0.86),
|
||||
"Epic": Color(0.61, 0.35, 0.71),
|
||||
"Legendary": Color(0.95, 0.61, 0.07)
|
||||
}
|
||||
|
||||
var current_mob_id: int = -1
|
||||
var loot_slots: Array = []
|
||||
|
||||
func _ready():
|
||||
visible = false
|
||||
|
||||
if close_button:
|
||||
close_button.pressed.connect(_on_close)
|
||||
|
||||
if take_all_button:
|
||||
take_all_button.pressed.connect(_on_take_all)
|
||||
|
||||
_setup_loot_grid()
|
||||
|
||||
# Connect to GameState signal
|
||||
if GameState:
|
||||
GameState.mob_loot_state_received.connect(_on_mob_loot_state_received)
|
||||
|
||||
func _on_mob_loot_state_received(data: Dictionary):
|
||||
var mob_id = data.get("mobId", -1)
|
||||
var mob_name = data.get("mobName", "Mob")
|
||||
var items = data.get("items", [])
|
||||
|
||||
show_loot(mob_id, mob_name, items)
|
||||
|
||||
func _setup_loot_grid():
|
||||
if not loot_grid:
|
||||
return
|
||||
|
||||
# Create 20 slots (5x4 grid) initially
|
||||
for i in range(20):
|
||||
var slot = _create_slot_button()
|
||||
slot.set_meta("slot_index", i)
|
||||
slot.set_meta("item", null)
|
||||
slot.gui_input.connect(_on_slot_gui_input.bind(i))
|
||||
loot_grid.add_child(slot)
|
||||
loot_slots.append(slot)
|
||||
|
||||
func _create_slot_button() -> Button:
|
||||
var btn = Button.new()
|
||||
btn.custom_minimum_size = Vector2(48, 48)
|
||||
btn.add_theme_stylebox_override("normal", _create_slot_style(Color(0.408, 0.408, 0.322, 1.0)))
|
||||
btn.add_theme_stylebox_override("hover", _create_slot_style(Color(0.408, 0.408, 0.322, 0.902)))
|
||||
return btn
|
||||
|
||||
func _create_slot_style(color: Color) -> StyleBoxFlat:
|
||||
var style = StyleBoxFlat.new()
|
||||
style.bg_color = color
|
||||
style.border_color = Color(0.0, 0.0, 0.0, 1.0)
|
||||
style.set_border_width_all(2)
|
||||
style.set_corner_radius_all(4)
|
||||
return style
|
||||
|
||||
func show_loot(mob_id: int, mob_name: String, loot_items: Array):
|
||||
current_mob_id = mob_id
|
||||
|
||||
if mob_name_label:
|
||||
mob_name_label.text = "%s's Loot" % mob_name
|
||||
|
||||
# Clear existing slots
|
||||
for slot in loot_slots:
|
||||
_clear_slot(slot)
|
||||
|
||||
# Add more slots if needed (expandable to show all loot)
|
||||
var needed_slots = loot_items.size()
|
||||
while loot_slots.size() < needed_slots:
|
||||
var slot = _create_slot_button()
|
||||
var slot_index = loot_slots.size()
|
||||
slot.set_meta("slot_index", slot_index)
|
||||
slot.set_meta("item", null)
|
||||
slot.gui_input.connect(_on_slot_gui_input.bind(slot_index))
|
||||
loot_grid.add_child(slot)
|
||||
loot_slots.append(slot)
|
||||
|
||||
# Populate loot items
|
||||
for i in range(loot_items.size()):
|
||||
if i < loot_slots.size():
|
||||
_update_slot(loot_slots[i], loot_items[i])
|
||||
|
||||
visible = true
|
||||
|
||||
func _clear_slot(slot: Button):
|
||||
for child in slot.get_children():
|
||||
child.queue_free()
|
||||
slot.set_meta("item", null)
|
||||
slot.text = ""
|
||||
slot.add_theme_stylebox_override("normal", _create_slot_style(Color(0.15, 0.15, 0.2)))
|
||||
|
||||
func _update_slot(slot: Button, item: Dictionary):
|
||||
_clear_slot(slot)
|
||||
|
||||
if item.is_empty():
|
||||
return
|
||||
|
||||
slot.set_meta("item", item)
|
||||
slot.text = ""
|
||||
|
||||
# Try to load sprite from CDN
|
||||
var sprite_path = item.get("spritePath", item.get("SpritePath", ""))
|
||||
var has_sprite = false
|
||||
|
||||
if sprite_path and not sprite_path.is_empty() and UpdateManager:
|
||||
var texture = UpdateManager.load_texture(sprite_path)
|
||||
if texture:
|
||||
var sprite = TextureRect.new()
|
||||
sprite.texture = texture
|
||||
sprite.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
|
||||
sprite.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
sprite.custom_minimum_size = Vector2(32, 32)
|
||||
sprite.anchors_preset = Control.PRESET_CENTER
|
||||
sprite.position = Vector2(8, 8)
|
||||
|
||||
# Apply tint if specified
|
||||
var tint = item.get("tintColor", item.get("TintColor", ""))
|
||||
if tint and not tint.is_empty():
|
||||
sprite.modulate = Color.from_string(tint, Color.WHITE)
|
||||
|
||||
slot.add_child(sprite)
|
||||
has_sprite = true
|
||||
|
||||
# Fall back to emoji if no sprite
|
||||
if not has_sprite:
|
||||
slot.text = _get_item_emoji(item)
|
||||
|
||||
# Add stack count label if quantity > 1
|
||||
var quantity = item.get("quantity", item.get("Quantity", 1))
|
||||
if quantity > 1:
|
||||
var count_label = Label.new()
|
||||
count_label.text = str(quantity)
|
||||
count_label.add_theme_font_size_override("font_size", 10)
|
||||
count_label.add_theme_color_override("font_color", Color.WHITE)
|
||||
count_label.add_theme_color_override("font_shadow_color", Color.BLACK)
|
||||
count_label.add_theme_constant_override("shadow_offset_x", 1)
|
||||
count_label.add_theme_constant_override("shadow_offset_y", 1)
|
||||
count_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||
count_label.vertical_alignment = VERTICAL_ALIGNMENT_BOTTOM
|
||||
count_label.anchors_preset = Control.PRESET_BOTTOM_RIGHT
|
||||
count_label.position = Vector2(slot.custom_minimum_size.x - 20, slot.custom_minimum_size.y - 16)
|
||||
slot.add_child(count_label)
|
||||
|
||||
# Style based on rarity
|
||||
var rarity = item.get("rarity", item.get("Rarity", "Common"))
|
||||
var style = _create_slot_style(Color(0.15, 0.15, 0.2))
|
||||
style.border_color = RARITY_COLORS.get(rarity, Color.GRAY)
|
||||
style.border_width_bottom = 3
|
||||
slot.add_theme_stylebox_override("normal", style)
|
||||
|
||||
func _get_item_emoji(item: Dictionary) -> String:
|
||||
var item_type = item.get("type", item.get("Type", "")).to_lower()
|
||||
var item_name = item.get("name", item.get("Name", "")).to_lower()
|
||||
|
||||
match item_type:
|
||||
"consumable":
|
||||
if "health" in item_name: return "❤️"
|
||||
if "mana" in item_name: return "💙"
|
||||
if "escape" in item_name: return "🏃"
|
||||
return "🧪"
|
||||
"material":
|
||||
if "bone" in item_name: return "🦴"
|
||||
if "hide" in item_name or "leather" in item_name: return "🥩"
|
||||
if "essence" in item_name or "soul" in item_name: return "👻"
|
||||
if "shard" in item_name or "crystal" in item_name: return "💎"
|
||||
return "📦"
|
||||
"weapon": return "⚔️"
|
||||
"armor":
|
||||
if "helm" in item_name: return "🎩"
|
||||
return "🛡️"
|
||||
"accessory": return "💍"
|
||||
_: return "❓"
|
||||
|
||||
func _on_slot_gui_input(event: InputEvent, slot_index: int):
|
||||
if not event is InputEventMouseButton:
|
||||
return
|
||||
|
||||
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
var item = loot_slots[slot_index].get_meta("item", null)
|
||||
if item and not item.is_empty():
|
||||
_take_item(slot_index)
|
||||
|
||||
func _take_item(slot_index: int):
|
||||
if current_mob_id < 0:
|
||||
return
|
||||
|
||||
# Send message to server to take item from mob loot
|
||||
GameState.take_mob_loot_item(current_mob_id, slot_index)
|
||||
print("[MobLootUI] Taking item at index %d from mob %d" % [slot_index, current_mob_id])
|
||||
|
||||
# Clear slot locally (server will update inventory)
|
||||
_clear_slot(loot_slots[slot_index])
|
||||
|
||||
func _on_take_all():
|
||||
if current_mob_id < 0:
|
||||
return
|
||||
|
||||
# Send message to server to take all items from mob loot
|
||||
GameState.take_all_mob_loot(current_mob_id)
|
||||
print("[MobLootUI] Taking all items from mob %d" % current_mob_id)
|
||||
|
||||
# Clear all slots locally (server will update inventory)
|
||||
for slot in loot_slots:
|
||||
_clear_slot(slot)
|
||||
|
||||
_on_close()
|
||||
|
||||
func _on_close():
|
||||
visible = false
|
||||
current_mob_id = -1
|
||||
|
||||
func _input(event):
|
||||
if visible and event.is_action_pressed("escape_menu"):
|
||||
_on_close()
|
||||
get_viewport().set_input_as_handled()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bo2ai0nxfcwas
|
||||
Reference in New Issue
Block a user