mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-02-22 15:17:57 +01:00
The LootWindow now closes when the player moves.
This commit is contained in:
parent
8a46084f00
commit
6342dccbf4
@ -24,6 +24,13 @@ class_name PlayerGD
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
|
signal player_moved()
|
||||||
|
|
||||||
|
func _moved():
|
||||||
|
._moved()
|
||||||
|
|
||||||
|
emit_signal("player_moved")
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if Input.is_action_just_pressed("sheath"):
|
if Input.is_action_just_pressed("sheath"):
|
||||||
get_character_skeleton().toggle_sheath()
|
get_character_skeleton().toggle_sheath()
|
||||||
|
@ -59,6 +59,10 @@ func set_player(p_player : Entity) -> void:
|
|||||||
player.connect("ctarget_bag_changed", self, "ctarget_bag_changed")
|
player.connect("ctarget_bag_changed", self, "ctarget_bag_changed")
|
||||||
player.connect("onc_open_loot_winow_request", self, "onc_open_loot_winow_request")
|
player.connect("onc_open_loot_winow_request", self, "onc_open_loot_winow_request")
|
||||||
|
|
||||||
|
func on_player_moved():
|
||||||
|
if visible:
|
||||||
|
hide()
|
||||||
|
|
||||||
func on_visibility_changed():
|
func on_visibility_changed():
|
||||||
if visible:
|
if visible:
|
||||||
refresh()
|
refresh()
|
||||||
@ -66,7 +70,7 @@ func on_visibility_changed():
|
|||||||
if target_bag != null:
|
if target_bag != null:
|
||||||
target_bag.disconnect("item_removed", self, "on_item_removed")
|
target_bag.disconnect("item_removed", self, "on_item_removed")
|
||||||
target_bag = null
|
target_bag = null
|
||||||
|
|
||||||
func on_item_removed(bag: Bag, item: ItemInstance, slot_id: int) -> void:
|
func on_item_removed(bag: Bag, item: ItemInstance, slot_id: int) -> void:
|
||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
@ -84,3 +88,6 @@ func ctarget_bag_changed(entity: Entity, bag: Bag) -> void:
|
|||||||
|
|
||||||
func onc_open_loot_winow_request() -> void:
|
func onc_open_loot_winow_request() -> void:
|
||||||
show()
|
show()
|
||||||
|
|
||||||
|
if player.has_signal("player_moved") && !player.is_connected("player_moved", self, "on_player_moved"):
|
||||||
|
player.connect("player_moved", self, "on_player_moved", [], CONNECT_ONESHOT)
|
||||||
|
@ -45,6 +45,6 @@ size_flags_horizontal = 3
|
|||||||
[node name="Button" type="Button" parent="VBoxContainer"]
|
[node name="Button" type="Button" parent="VBoxContainer"]
|
||||||
margin_top = 566.0
|
margin_top = 566.0
|
||||||
margin_right = 1016.0
|
margin_right = 1016.0
|
||||||
margin_bottom = 592.269
|
margin_bottom = 592.57
|
||||||
text = "close"
|
text = "close"
|
||||||
[connection signal="pressed" from="VBoxContainer/Button" to="." method="hide"]
|
[connection signal="pressed" from="VBoxContainer/Button" to="." method="hide"]
|
||||||
|
Loading…
Reference in New Issue
Block a user