insideout-andrew / simple-card-pile-ui

This plugin provides a flexible and customizable card pile user interface for the Godot game engine. It is designed to handle various card-related functionalities including drawing, discarding, and managing different piles.
MIT License
84 stars 9 forks source link

can_drag_top_card is defined but never referenced #2

Open broomo opened 3 months ago

broomo commented 3 months ago

In the example scene provided, after having no luck with the "can_drag_top_card" toggle using dropzones, I noticed the discard pile had this var set to false, but when setting it to true, cards could still not be dragged from top of discard.

I find that after can_drag_top_card is defined, it is not referenced again in any scripts, also, the discard pile simple does not have any code allowing it to be clicked and dragged from. it seems the can_drag_top_card set to false on the discard pile was just an illusion of function.

broomo commented 3 months ago

added "and dropzone.can_drag_top_card" to card interacted method

`func _card_can_be_interacted_with(): var parent = get_parent() var valid = false if parent is CardPileUI:

check for cards in hand

    if parent.is_card_ui_in_hand(self):
        valid = parent.is_hand_enabled() and not parent.is_any_card_ui_clicked()
    # check for cards in dropzone
    var dropzone = parent.get_card_dropzone(self)
    if dropzone:

added and dropzone.can_drag_top_card here to enable

        valid = dropzone.get_top_card() == self and not parent.is_any_card_ui_clicked() and dropzone.can_drag_top_card
return valid`