diff options
Diffstat (limited to 'client/map')
-rw-r--r-- | client/map/items/cut.tscn | 22 | ||||
-rw-r--r-- | client/map/items/pot.gd | 15 | ||||
-rw-r--r-- | client/map/items/steam.tscn | 26 | ||||
-rw-r--r-- | client/map/items/tomato.gd | 12 | ||||
-rw-r--r-- | client/map/tiles/cutting_board.gd | 3 | ||||
-rw-r--r-- | client/map/tiles/oven.gd | 12 | ||||
-rw-r--r-- | client/map/tiles/oven.tscn | 49 | ||||
-rw-r--r-- | client/map/tiles/oven_model.gd | 19 |
8 files changed, 156 insertions, 2 deletions
diff --git a/client/map/items/cut.tscn b/client/map/items/cut.tscn new file mode 100644 index 00000000..0a15a2c8 --- /dev/null +++ b/client/map/items/cut.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=3 format=3 uid="uid://bbjair4iw1841"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_iypba"] +vertex_color_use_as_albedo = true + +[sub_resource type="SphereMesh" id="SphereMesh_0blsq"] +material = SubResource("StandardMaterial3D_iypba") +radius = 0.05 +height = 0.1 + +[node name="Cut" type="CPUParticles3D"] +emitting = false +amount = 25 +lifetime = 0.3 +explosiveness = 1.0 +lifetime_randomness = 0.5 +mesh = SubResource("SphereMesh_0blsq") +direction = Vector3(0, 1, 0) +spread = 90.0 +initial_velocity_min = 1.0 +initial_velocity_max = 3.0 +scale_amount_min = 0.4 diff --git a/client/map/items/pot.gd b/client/map/items/pot.gd index fa5b038d..ac865329 100644 --- a/client/map/items/pot.gd +++ b/client/map/items/pot.gd @@ -16,9 +16,24 @@ class_name Pot extends Item +var steam: CPUParticles3D = load("res://map/items/steam.tscn").instantiate() + func _init(owned_by_: Node3D): super(owned_by_) base.add_child(load("res://map/items/pot.tscn").instantiate()) + base.add_child(steam) + +func progress(p: float, warn: bool): + super(p, warn) + steam.emitting = true + if warn: + steam.color = Color(.2, .2, .2) + else: + steam.color = Color(1., 1., 1.) + +func finish(warn: bool): + super(warn) + steam.emitting = false static func base_position() -> Vector3: return Vector3(0., 0.015, 0.) diff --git a/client/map/items/steam.tscn b/client/map/items/steam.tscn new file mode 100644 index 00000000..4a112278 --- /dev/null +++ b/client/map/items/steam.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=4 format=3 uid="uid://g1wsqgb56o1o"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e1q7j"] +vertex_color_use_as_albedo = true + +[sub_resource type="SphereMesh" id="SphereMesh_mk24m"] +material = SubResource("StandardMaterial3D_e1q7j") +radius = 0.1 +height = 0.2 + +[sub_resource type="Curve" id="Curve_s1bty"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.10989), 0.0, 0.0, 0, 0] +point_count = 2 + +[node name="Steam" type="CPUParticles3D"] +emitting = false +amount = 25 +lifetime = 2.0 +mesh = SubResource("SphereMesh_mk24m") +direction = Vector3(0, 1, 0) +spread = 30.0 +gravity = Vector3(0, -0.1, 0) +initial_velocity_min = 0.2 +initial_velocity_max = 0.5 +scale_amount_min = 0.4 +scale_amount_curve = SubResource("Curve_s1bty") diff --git a/client/map/items/tomato.gd b/client/map/items/tomato.gd index 989e4a54..43e2e64d 100644 --- a/client/map/items/tomato.gd +++ b/client/map/items/tomato.gd @@ -16,6 +16,18 @@ class_name Tomato extends Item +var cut: CPUParticles3D = load("res://map/items/cut.tscn").instantiate() + func _init(owned_by_: Node3D): super(owned_by_) base.add_child(load("res://map/items/tomato.tscn").instantiate()) + base.add_child(cut) + cut.color = Color(1., 0., 0.) + +func progress(p: float, warn: bool): + super(p, warn) + cut.emitting = true + +func finish(warn: bool): + super(warn) + cut.emitting = false diff --git a/client/map/tiles/cutting_board.gd b/client/map/tiles/cutting_board.gd index cadfccfa..280235e8 100644 --- a/client/map/tiles/cutting_board.gd +++ b/client/map/tiles/cutting_board.gd @@ -19,3 +19,6 @@ extends CounterBase func _init(rename: String, neighbors: Array): super(rename, neighbors) base.add_child(load("res://map/tiles/cutting_board.tscn").instantiate()) + +static func interact_target() -> Vector3: + return Vector3(0., 0.575, 0.) 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") |