From 81ee19796da30ded1631e716861aaafdf73d1178 Mon Sep 17 00:00:00 2001 From: jonathan Date: Sun, 1 Feb 2026 21:19:44 +0100 Subject: [PATCH] Phone --- scenes/room.tscn | 109 +++++++++++++++++++++++++++++++- scenes/telephone_station.gd | 12 ++++ scenes/telephone_station.gd.uid | 1 + 3 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 scenes/telephone_station.gd create mode 100644 scenes/telephone_station.gd.uid diff --git a/scenes/room.tscn b/scenes/room.tscn index 5c4896b..daa6e99 100644 --- a/scenes/room.tscn +++ b/scenes/room.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=97 format=4 uid="uid://157h04x0krfu"] +[gd_scene load_steps=103 format=4 uid="uid://157h04x0krfu"] [ext_resource type="PackedScene" uid="uid://bjufextny1icg" path="res://models/UndertakerAssets.glb" id="1_7dqbv"] [ext_resource type="ArrayMesh" uid="uid://c5hhygnuya8m4" path="res://models/ceiling.res" id="1_jn645"] @@ -48,6 +48,7 @@ [ext_resource type="ArrayMesh" uid="uid://ydc6tdd1gu42" path="res://models/telephone_station.res" id="46_geot1"] [ext_resource type="ArrayMesh" uid="uid://w8oivhqk4kv3" path="res://models/telephone.res" id="47_1s4n5"] [ext_resource type="PackedScene" uid="uid://dcvhqqp75xtws" path="res://prefabs/rose.tscn" id="48_1s4n5"] +[ext_resource type="Script" uid="uid://4301hu7hhhoq" path="res://scenes/telephone_station.gd" id="48_lxjld"] [ext_resource type="Script" uid="uid://bgrc6ktuxyrm6" path="res://scenes/pickupable.gd" id="49_bahpm"] [ext_resource type="PackedScene" uid="uid://cddhjs1rtgotq" path="res://models/RubberDuck.glb" id="50_11at7"] [ext_resource type="PackedScene" uid="uid://c4cpduyayg7m" path="res://models/Hammer.glb" id="51_gmm1g"] @@ -505,6 +506,96 @@ size = Vector3(0.6904297, 0.0803833, 0.5888672) [sub_resource type="BoxShape3D" id="BoxShape3D_11at7"] size = Vector3(0.6904297, 0.0803833, 1.6538086) +[sub_resource type="Animation" id="Animation_014nw"] +resource_name = "phone_pickzup" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Telephone:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.4), +"transitions": PackedFloat32Array(0.3922923, 1), +"update": 0, +"values": [Vector3(-0.15991092, 0.012449861, 0.42038155), Vector3(-0.5200389, 0.012449861, 0.6262381)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Telephone:rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.4), +"transitions": PackedFloat32Array(0.3922923, 1), +"update": 0, +"values": [Vector3(1.5707964, 0, 0), Vector3(1.5707964, -1.6794605, 0)] +} + +[sub_resource type="Animation" id="Animation_ki8oc"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Telephone:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(-0.15991092, 0.012449861, 0.42038155)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Telephone:rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(1.5707964, 0, 0)] +} + +[sub_resource type="Animation" id="Animation_wy7hx"] +resource_name = "Hangup" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Telephone:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.40234256), +"transitions": PackedFloat32Array(0.34151018, 1.0000005), +"update": 0, +"values": [Vector3(-0.5200389, 0.012449861, 0.6262381), Vector3(-0.15991092, 0.012449861, 0.42038155)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Telephone:rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.40234256), +"transitions": PackedFloat32Array(0.34151018, 1.0000005), +"update": 0, +"values": [Vector3(1.5707964, -1.6794605, 0), Vector3(1.5707964, 0, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_ki8oc"] +_data = { +&"Hangup": SubResource("Animation_wy7hx"), +&"RESET": SubResource("Animation_ki8oc"), +&"phone_pickzup": SubResource("Animation_014nw") +} + +[sub_resource type="SphereShape3D" id="SphereShape3D_pyvr3"] + [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_u215o"] resource_name = "Material.003" cull_mode = 2 @@ -1792,12 +1883,23 @@ skeleton = NodePath("") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1620214, 1.4303728, -3.3571877) mesh = ExtResource("46_geot1") skeleton = NodePath("") +script = ExtResource("48_lxjld") -[node name="Telephone" type="MeshInstance3D" parent="."] -transform = Transform3D(6.326305, 0, 0, 0, 0, -6.326305, 0, 6.326305, 0, 0.0021104813, 1.4428227, -2.9368062) +[node name="Telephone" type="MeshInstance3D" parent="Telephone_Station"] +transform = Transform3D(6.326305, 0, 0, 0, -2.7653158e-07, -6.326305, 0, 6.326305, -2.7653158e-07, -0.15991092, 0.012449861, 0.42038155) mesh = ExtResource("47_1s4n5") skeleton = NodePath("") +[node name="AnimationPlayer" type="AnimationPlayer" parent="Telephone_Station"] +libraries = { +&"": SubResource("AnimationLibrary_ki8oc") +} + +[node name="Interactable" parent="Telephone_Station" instance=ExtResource("3_w68ji")] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Telephone_Station/Interactable"] +shape = SubResource("SphereShape3D_pyvr3") + [node name="Roses" type="Node3D" parent="."] [node name="Rose" parent="Roses" instance=ExtResource("48_1s4n5")] @@ -2067,6 +2169,7 @@ light_energy = 0.0 [connection signal="changed" from="Lever" to="CoffinSwitcher/CoffinOpenable" method="_on_lever_changed"] [connection signal="on_hit" from="Button/Interactable" to="CoffinSwitcher/CoffinSlideFire" method="_on_interactable_on_hit"] [connection signal="on_hit" from="Button2/Interactable" to="CoffinSwitcher/CoffinSlideFire" method="_on_interactable_on_hit"] +[connection signal="on_hit" from="Telephone_Station/Interactable" to="Telephone_Station" method="_on_interactable_on_hit"] [editable path="UndertakerAssets"] [editable path="Character"] diff --git a/scenes/telephone_station.gd b/scenes/telephone_station.gd new file mode 100644 index 0000000..812f48f --- /dev/null +++ b/scenes/telephone_station.gd @@ -0,0 +1,12 @@ +extends MeshInstance3D + +@onready var animation_player: AnimationPlayer = $AnimationPlayer +var isPickedUp:bool = false + +func _on_interactable_on_hit() -> void: + isPickedUp = !isPickedUp + print("hit") + if isPickedUp: + animation_player.play("phone_pickzup") + else: + animation_player.play("Hangup") diff --git a/scenes/telephone_station.gd.uid b/scenes/telephone_station.gd.uid new file mode 100644 index 0000000..158dd36 --- /dev/null +++ b/scenes/telephone_station.gd.uid @@ -0,0 +1 @@ +uid://4301hu7hhhoq