extends Button ## One click transfers the exact expected item; normal inventory guards stay authoritative. var item: ItemInstance var retrieve := false var transfer: Callable var locked := false func _ready() -> void: custom_minimum_size = Vector2(48,48) mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND if item != null else Control.CURSOR_ARROW var accent: Color = item.get_type_color() if item != null else Color("425554") for state in ["normal","hover","pressed","disabled","focus"]: var box := StyleBoxFlat.new() box.bg_color = Color("13222a") if not locked else Color("11191d") box.bg_color.a = 0.85 box.border_color = accent if state != "hover" else Color("e7c38a") box.set_border_width_all(1) box.set_corner_radius_all(4) add_theme_stylebox_override(state,box) if item != null: var art := TextureRect.new() art.expand_mode = TextureRect.EXPAND_IGNORE_SIZE art.texture = item.definition.icon art.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED art.texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS art.mouse_filter = Control.MOUSE_FILTER_IGNORE add_child(art) art.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) art.offset_left = 4 art.offset_top = 4 art.offset_right = -4 art.offset_bottom = -7 var arrow := Label.new() arrow.text = "←" if retrieve else "→" arrow.position = Vector2(31,29) arrow.add_theme_font_override("font",ThemeDB.fallback_font) arrow.add_theme_font_size_override("font_size",15) arrow.add_theme_color_override("font_color",Color("f1cc8a")) arrow.add_theme_color_override("font_shadow_color",Color.BLACK) arrow.add_theme_constant_override("shadow_outline_size",3) arrow.mouse_filter = Control.MOUSE_FILTER_IGNORE add_child(arrow) set_meta("transfer_action","← ODBIERZ" if retrieve else "ODŁÓŻ →") tooltip_text = item.get_tooltip_text()+"\nKliknij: "+("odbierz do statku" if retrieve else "przenieś na fregatę") pressed.connect(transfer) else: disabled = true text = "×" if locked else "·" tooltip_text = "Odblokuj kolejne rzędy ładowni w Hangarze." if locked else "Wolny slot"