Use suitcase in dark cut prototype
All checks were successful
/ test (push) Successful in 2s

This commit is contained in:
Antonio Dell'Annunziata 2025-03-29 07:38:10 +01:00
parent 2cb41beef2
commit 7ab4a875b7
No known key found for this signature in database
GPG key ID: 8D2BB16641F06E94
8 changed files with 41 additions and 33 deletions

View file

@ -25,6 +25,7 @@ func _on_bob_clicked():
func _on_ritual_book_clicked():
var ritual_book = RITUAL_BOOK_SCENE.instantiate()
ritual_book.incantation_completed.connect(_on_ritual_book_incantation_completed.bind(ritual_book))
ritual_book.book_closed.connect(_on_ritual_book_closed.bind(ritual_book))
add_child.call_deferred(ritual_book)
func _show_dark_cut():
@ -33,6 +34,7 @@ func _show_dark_cut():
dark_cut.succeeded.connect(_on_dark_cut_succeeded.bind(dark_cut))
dark_cut.failed.connect(_on_dark_cut_failed.bind(dark_cut))
add_child.call_deferred(dark_cut)
move_child.call_deferred($Suitcase, -1)
func _on_map_selectable_clicked():
_disable_node2d(room)
@ -77,6 +79,9 @@ func _on_dark_cut_failed(dark_cut: DarkCut):
func _on_ritual_book_incantation_completed(ritual_book: PrototypeRitualBook):
ritual_book.queue_free()
func _on_ritual_book_closed(ritual_book: PrototypeRitualBook):
ritual_book.queue_free()
func _on_dialog_finished(choice_selected: String, dialog: Node):
is_dialog_shown = false
dialog.queue_free()

View file

@ -1,10 +1,9 @@
[gd_scene load_steps=37 format=3 uid="uid://w3ntt1yh1nq7"]
[gd_scene load_steps=34 format=3 uid="uid://w3ntt1yh1nq7"]
[ext_resource type="Script" uid="uid://lnmooufxbuym" path="res://main.gd" id="1_dp5o4"]
[ext_resource type="PackedScene" uid="uid://3oqyqft8w72m" path="res://selectable.tscn" id="3_g5hfc"]
[ext_resource type="Script" uid="uid://c3dlxuhruho8c" path="res://operation/feedback_canvas_modulate.gd" id="4_0odxb"]
[ext_resource type="PackedScene" uid="uid://cnq1uvadx0rwf" path="res://dropoff_area.tscn" id="4_ycdy4"]
[ext_resource type="Texture2D" uid="uid://bicjfwpoa3pma" path="res://operation/test_table.png" id="5_lswn8"]
[ext_resource type="PackedScene" uid="uid://bgp8l04mw4ddh" path="res://suitcase.tscn" id="12_dg77c"]
[ext_resource type="Texture2D" uid="uid://ccy71gl4qatjy" path="res://operation/pliers.png" id="17_b1qrp"]
[ext_resource type="Script" uid="uid://crkr8emyhv1fo" path="res://operation/pliers.gd" id="18_come4"]
@ -12,7 +11,6 @@
[ext_resource type="Texture2D" uid="uid://cg3dg7iqif56d" path="res://operation/test_scalpel.png" id="20_4lmeg"]
[ext_resource type="Script" uid="uid://cqnproj5khm5a" path="res://operation/test_scalpel.gd" id="21_0cp0l"]
[ext_resource type="Shape2D" uid="uid://bo77ihhtxfueg" path="res://operation/scalpel_pickup_area_collision_shape.tres" id="22_d2t1y"]
[ext_resource type="Script" uid="uid://drfykuqe2phdt" path="res://operation/bat_dropoff.gd" id="23_gngh3"]
[sub_resource type="Gradient" id="Gradient_qkope"]
offsets = PackedFloat32Array(0.0372881)
@ -78,9 +76,6 @@ radius = 8.24621
[sub_resource type="CircleShape2D" id="CircleShape2D_qmwrh"]
radius = 5.65684
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0odxb"]
size = Vector2(110, 65)
[sub_resource type="Gradient" id="Gradient_vivmo"]
offsets = PackedFloat32Array(0.353357, 0.929329, 1)
colors = PackedColorArray(0, 0, 0, 1, 0.498233, 0.498233, 0.498233, 1, 1, 1, 1, 1)
@ -280,23 +275,6 @@ debug_color = Color(0.879882, 0.304191, 0.394852, 0.42)
[node name="CutHurtTimer" type="Timer" parent="Room/Shelves/Scalpel"]
unique_name_in_owner = true
[node name="BatDropoff" type="Node2D" parent="Room/Shelves" groups=["bat_dropoff"]]
unique_name_in_owner = true
script = ExtResource("23_gngh3")
[node name="Sprite2D" type="Sprite2D" parent="Room/Shelves/BatDropoff"]
rotation = 1.5708
scale = Vector2(0.208791, 0.204598)
texture = ExtResource("5_lswn8")
[node name="Area2D" type="Area2D" parent="Room/Shelves/BatDropoff"]
collision_layer = 8
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="Room/Shelves/BatDropoff/Area2D"]
scale = Vector2(0.983051, 1)
shape = SubResource("RectangleShape2D_0odxb")
[node name="RitualBook" type="Node2D" parent="Room/Shelves"]
position = Vector2(-92, 240.5)

View file

@ -32,5 +32,15 @@ func grab_bat():
position = Vector2.ZERO
top_level = true
func drop_bat():
func abort_grabbing():
is_grabbed = false
grab_area.set_deferred("monitoring", true)
grab_area.set_deferred("monitorable", true)
path_follow.progress_ratio = 0.0
position = Vector2.ZERO
top_level = false
func drop_bat(new_parent: Node2D):
is_dropped = true
top_level = false
reparent.call_deferred(new_parent, false)

View file

@ -10,7 +10,7 @@ signal step_failed
var feedback_canvas_modulate: FeedbackCanvasModulate
var bat_dropoff: BatDropoff
var bat_dropoff: Node2D
var patience_bar: ProgressBar
@ -20,7 +20,7 @@ var pliers: Pliers
func _ready():
grabbing_target = get_node(grabbing_target_path) as BatExtractionBat
pliers = get_tree().get_first_node_in_group("grabber") as Pliers
bat_dropoff = get_tree().get_first_node_in_group("bat_dropoff") as BatDropoff
bat_dropoff = get_tree().get_first_node_in_group("bat_dropoff")
feedback_canvas_modulate = get_tree().get_first_node_in_group("effects") as FeedbackCanvasModulate
patience_bar = get_tree().get_first_node_in_group("patience_bar") as ProgressBar
pliers.pliers_used.connect(_on_pliers_used)
@ -33,6 +33,10 @@ func _on_pliers_used(top_area: Area2D):
else:
_hurt()
func _exit_tree():
if grabbing_target.is_grabbed:
grabbing_target.abort_grabbing()
pliers.enable_dropoff()
func _target_grabbed():
pliers.disable_dropoff()
@ -40,7 +44,7 @@ func _target_grabbed():
func _target_dropped():
pliers.enable_dropoff()
grabbing_target.drop_bat()
grabbing_target.drop_bat(bat_dropoff)
step_succeeded.emit()
func _hurt():

View file

@ -2,6 +2,11 @@ class_name PrototypeRitualBook
extends Node2D
signal incantation_completed
signal book_closed
func _on_incantation_completed():
incantation_completed.emit()
func _on_button_pressed():
book_closed.emit()

View file

@ -35,6 +35,13 @@ position = Vector2(606, 311)
rotation = 3.14159
texture = SubResource("GradientTexture2D_yaehf")
[node name="CloseButton" type="Button" parent="."]
offset_left = 698.0
offset_top = 117.0
offset_right = 748.0
offset_bottom = 148.0
text = "Close"
[node name="BlockInputArea" type="Area2D" parent="."]
script = ExtResource("2_m7f1b")
@ -69,4 +76,5 @@ offset_bottom = 23.0
script = ExtResource("2_5ntyk")
text = "Hallo dies ist ein langer TExt, er könnte auch eine Ritual sein. Wir werden sehen"
[connection signal="pressed" from="CloseButton" to="." method="_on_button_pressed"]
[connection signal="completed" from="Incantation" to="." method="_on_incantation_completed"]

View file

@ -7,6 +7,7 @@ extends Node2D
is_open = new_value
_update_suitcase()
@onready var dropoff_area: DropoffArea = $SuitcaseOpen/DropoffArea
func _ready():
if Engine.is_editor_hint(): return
@ -29,11 +30,6 @@ func _update_suitcase():
$SuitcaseClosed.queue_redraw()
func _on_area_2d_input_event(viewport, event, shape_idx):
pass # Replace with function body.
func _on_close_on_click_area_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.is_pressed():
is_open = false

View file

@ -5,7 +5,7 @@
[ext_resource type="Texture2D" uid="uid://yrcdv8en42cl" path="res://suitcase_open.png" id="2_kguwf"]
[ext_resource type="PackedScene" uid="uid://cnq1uvadx0rwf" path="res://dropoff_area.tscn" id="4_kmisx"]
[node name="Suitcase" type="Node2D"]
[node name="Suitcase" type="Node2D" groups=["bat_dropoff"]]
script = ExtResource("1_kguwf")
is_open = true
@ -24,6 +24,8 @@ polygon = PackedVector2Array(-10.4, -54.5, -77.5, -57.6, -77.5, -56.3, -82.8, -5
texture = ExtResource("2_kguwf")
[node name="DropoffArea" parent="SuitcaseOpen" instance=ExtResource("4_kmisx")]
collision_layer = 10
collision_mask = 10
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SuitcaseOpen/DropoffArea"]
polygon = PackedVector2Array(-93, -5, 20, -7, 107, -11, 116, 0, 118, 16, 139, 86, 138, 115, 125, 122, 99, 126, 92, 129, 51, 131, -68, 132, -78, 130, -102, 130, -121, 116, -121, 91, -105, 47)