aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornokoe <nokoe@mailbox.org>2024-06-24 17:54:11 +0200
committernokoe <nokoe@mailbox.org>2024-06-24 17:54:11 +0200
commit9905a63865545ef118bd6e2d0ce1b290f307bf81 (patch)
tree00ef0861521604253e210259d6b532e38a8468a4
parent971c795b02f6a8f9702fe39e489f8ee5d0ae14a7 (diff)
downloadhurrycurry-9905a63865545ef118bd6e2d0ce1b290f307bf81.tar
hurrycurry-9905a63865545ef118bd6e2d0ce1b290f307bf81.tar.bz2
hurrycurry-9905a63865545ef118bd6e2d0ce1b290f307bf81.tar.zst
add oven interaction
-rw-r--r--client/map/tiles/oven.gd12
-rw-r--r--client/map/tiles/oven.tscn49
-rw-r--r--client/map/tiles/oven_model.gd19
3 files changed, 78 insertions, 2 deletions
diff --git a/client/map/tiles/oven.gd b/client/map/tiles/oven.gd
index 59d734e1..c6e446cf 100644
--- a/client/map/tiles/oven.gd
+++ b/client/map/tiles/oven.gd
@@ -16,6 +16,16 @@
class_name Oven
extends Counter
+var oven: OvenModel = load("res://map/tiles/oven.tscn").instantiate()
+
func _init(rename: String, neighbors: Array):
super(rename, neighbors)
- base.add_child(load("res://map/tiles/oven.tscn").instantiate())
+ base.add_child(oven)
+
+func put_item(i: Item):
+ oven.open()
+ super(i)
+
+func take_item() -> Item:
+ oven.open()
+ return super()
diff --git a/client/map/tiles/oven.tscn b/client/map/tiles/oven.tscn
index 369a1fa5..44535678 100644
--- a/client/map/tiles/oven.tscn
+++ b/client/map/tiles/oven.tscn
@@ -1,9 +1,45 @@
-[gd_scene load_steps=3 format=3 uid="uid://bil6eip7uwqvs"]
+[gd_scene load_steps=7 format=3 uid="uid://bil6eip7uwqvs"]
+[ext_resource type="Script" path="res://map/tiles/oven_model.gd" id="1_3v43w"]
[ext_resource type="ArrayMesh" uid="uid://blc1q50d5ky86" path="res://map/tiles/oven_base.res" id="1_d1hwl"]
[ext_resource type="ArrayMesh" uid="uid://blb5oew3sh7ek" path="res://map/tiles/oven_door.res" id="2_i5vso"]
+[sub_resource type="Animation" id="Animation_yb3ht"]
+resource_name = "open"
+length = 0.5
+tracks/0/type = "rotation_3d"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath("Base/Door")
+tracks/0/interp = 2
+tracks/0/loop_wrap = true
+tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1, 0.1, 1, 0.766044, 0, 0, 0.642788, 0.2, 1, 0.707107, 0, 0, 0.707107, 0.4, 1, 0, 0, 0, 1)
+tracks/1/type = "scale_3d"
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/path = NodePath("Base/Door")
+tracks/1/interp = 2
+tracks/1/loop_wrap = true
+tracks/1/keys = PackedFloat32Array(0, 1, 1, 1, 1, 0.1, 1, 1, 1, 1, 0.2, 1, 1, 1, 1, 0.4, 1, 1, 1, 1)
+
+[sub_resource type="Animation" id="Animation_yo2v1"]
+length = 0.001
+tracks/0/type = "rotation_3d"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath("Base/Door")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1)
+
+[sub_resource type="AnimationLibrary" id="AnimationLibrary_io5nw"]
+_data = {
+"RESET": SubResource("Animation_yo2v1"),
+"open": SubResource("Animation_yb3ht")
+}
+
[node name="Oven" type="Node3D"]
+script = ExtResource("1_3v43w")
[node name="Base" type="MeshInstance3D" parent="."]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
@@ -14,3 +50,14 @@ skeleton = NodePath("")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.25, 0.43, 0.9)
mesh = ExtResource("2_i5vso")
skeleton = NodePath("")
+
+[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
+libraries = {
+"": SubResource("AnimationLibrary_io5nw")
+}
+
+[node name="OmniLight3D" type="OmniLight3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7, 0)
+light_color = Color(0.944743, 0.70243, 0.38641, 1)
+light_energy = 2.0
+shadow_enabled = true
diff --git a/client/map/tiles/oven_model.gd b/client/map/tiles/oven_model.gd
new file mode 100644
index 00000000..52a876a8
--- /dev/null
+++ b/client/map/tiles/oven_model.gd
@@ -0,0 +1,19 @@
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name OvenModel
+extends Node3D
+
+func open():
+ $AnimationPlayer.play("open")