From bb5523874179b5523ebf93bda42e62a00cfbaf80 Mon Sep 17 00:00:00 2001 From: tpart Date: Mon, 19 Aug 2024 17:59:58 +0200 Subject: Generalize sink particles; Add stream particles when filling up glass --- client/map/tiles/sink.gd | 14 +++++---- client/map/tiles/sink_bubbles.gd | 25 ---------------- client/map/tiles/sink_bubbles.tscn | 56 ------------------------------------ client/map/tiles/sink_particles.gd | 25 ++++++++++++++++ client/map/tiles/sink_particles.tscn | 56 ++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 87 deletions(-) delete mode 100644 client/map/tiles/sink_bubbles.gd delete mode 100644 client/map/tiles/sink_bubbles.tscn create mode 100644 client/map/tiles/sink_particles.gd create mode 100644 client/map/tiles/sink_particles.tscn (limited to 'client') diff --git a/client/map/tiles/sink.gd b/client/map/tiles/sink.gd index e98a25d0..c39a2a2a 100644 --- a/client/map/tiles/sink.gd +++ b/client/map/tiles/sink.gd @@ -16,13 +16,13 @@ class_name Sink extends Counter -var bubbles: SinkBubbles = preload("res://map/tiles/sink_bubbles.tscn").instantiate() +var particles: SinkParticles = preload("res://map/tiles/sink_particles.tscn").instantiate() var running: AudioStreamPlayer3D = AudioStreamPlayer3D.new() var stopping: AudioStreamPlayer3D = AudioStreamPlayer3D.new() func _init(rename: String, neighbors: Array): super(rename, neighbors) - base.add_child(bubbles) + base.add_child(particles) match kind: CounterKind.STRAIGHT: base.add_child(load("res://map/tiles/sink.tscn").instantiate()) @@ -38,20 +38,22 @@ func _init(rename: String, neighbors: Array): func progress(p: float, warn: bool): super(p, warn) if item is Plate: - bubbles.start() + particles.start(true) + elif item is Glass: + particles.start() if not running.playing: running.play() func finish(warn: bool): super(warn) - bubbles.stop() + particles.stop() running.stop() stopping.play() func set_item(i: Item): super(i) - self.bubbles.stop() + particles.stop() func take_item() -> Item: - self.bubbles.stop() + particles.stop() return super() diff --git a/client/map/tiles/sink_bubbles.gd b/client/map/tiles/sink_bubbles.gd deleted file mode 100644 index 7afa7f5b..00000000 --- a/client/map/tiles/sink_bubbles.gd +++ /dev/null @@ -1,25 +0,0 @@ -# Hurry Curry! - a game about cooking -# 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 . -# -class_name SinkBubbles -extends Node3D - -func start(): - $Stream.emitting = true - $Bubbles.emitting = true - -func stop(): - $Stream.emitting = false - $Bubbles.emitting = false diff --git a/client/map/tiles/sink_bubbles.tscn b/client/map/tiles/sink_bubbles.tscn deleted file mode 100644 index 6e4487fa..00000000 --- a/client/map/tiles/sink_bubbles.tscn +++ /dev/null @@ -1,56 +0,0 @@ -[gd_scene load_steps=8 format=3 uid="uid://ckxtlgx7hg368"] - -[ext_resource type="Script" path="res://map/tiles/sink_bubbles.gd" id="1_xt81f"] - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b8p5f"] -vertex_color_use_as_albedo = true - -[sub_resource type="SphereMesh" id="SphereMesh_1r04j"] -material = SubResource("StandardMaterial3D_b8p5f") -radius = 0.025 -height = 0.05 - -[sub_resource type="Gradient" id="Gradient_p7a7b"] -offsets = PackedFloat32Array(0, 0.753333) -colors = PackedColorArray(0.119726, 0.715743, 1, 1, 1, 1, 1, 1) - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_588v1"] -vertex_color_use_as_albedo = true - -[sub_resource type="SphereMesh" id="SphereMesh_3wrov"] -material = SubResource("StandardMaterial3D_588v1") -radius = 0.05 -height = 0.1 - -[sub_resource type="Curve" id="Curve_wu4je"] -_data = [Vector2(0.264045, 0), 0.0, 0.0, 0, 0, Vector2(0.460674, 1), 0.0, 0.0, 0, 0, Vector2(0.949438, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] -point_count = 4 - -[node name="SinkBubbles" type="Node3D"] -script = ExtResource("1_xt81f") - -[node name="Stream" type="CPUParticles3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, -0.05) -emitting = false -amount = 10 -lifetime = 0.2 -mesh = SubResource("SphereMesh_1r04j") -direction = Vector3(0, -1, 0) -spread = 10.0 -initial_velocity_min = 0.1 -initial_velocity_max = 0.3 -color_ramp = SubResource("Gradient_p7a7b") - -[node name="Bubbles" type="CPUParticles3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0) -emitting = false -amount = 30 -mesh = SubResource("SphereMesh_3wrov") -direction = Vector3(0, 1, 0) -spread = 90.0 -gravity = Vector3(0, -0.2, 0) -initial_velocity_min = 0.1 -initial_velocity_max = 0.3 -scale_amount_min = 0.0 -scale_amount_max = 1.5 -scale_amount_curve = SubResource("Curve_wu4je") diff --git a/client/map/tiles/sink_particles.gd b/client/map/tiles/sink_particles.gd new file mode 100644 index 00000000..adc1564f --- /dev/null +++ b/client/map/tiles/sink_particles.gd @@ -0,0 +1,25 @@ +# Hurry Curry! - a game about cooking +# 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 . +# +class_name SinkParticles +extends Node3D + +func start(bubbles: bool = false): + $Stream.emitting = true + $Bubbles.emitting = bubbles + +func stop(): + $Stream.emitting = false + $Bubbles.emitting = false diff --git a/client/map/tiles/sink_particles.tscn b/client/map/tiles/sink_particles.tscn new file mode 100644 index 00000000..7a54f841 --- /dev/null +++ b/client/map/tiles/sink_particles.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=8 format=3 uid="uid://ckxtlgx7hg368"] + +[ext_resource type="Script" path="res://map/tiles/sink_particles.gd" id="1_vh7ox"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b8p5f"] +vertex_color_use_as_albedo = true + +[sub_resource type="SphereMesh" id="SphereMesh_1r04j"] +material = SubResource("StandardMaterial3D_b8p5f") +radius = 0.025 +height = 0.05 + +[sub_resource type="Gradient" id="Gradient_p7a7b"] +offsets = PackedFloat32Array(0, 0.753333) +colors = PackedColorArray(0.119726, 0.715743, 1, 1, 1, 1, 1, 1) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_588v1"] +vertex_color_use_as_albedo = true + +[sub_resource type="SphereMesh" id="SphereMesh_3wrov"] +material = SubResource("StandardMaterial3D_588v1") +radius = 0.05 +height = 0.1 + +[sub_resource type="Curve" id="Curve_wu4je"] +_data = [Vector2(0.264045, 0), 0.0, 0.0, 0, 0, Vector2(0.460674, 1), 0.0, 0.0, 0, 0, Vector2(0.949438, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 4 + +[node name="SinkParticles" type="Node3D"] +script = ExtResource("1_vh7ox") + +[node name="Stream" type="CPUParticles3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, -0.05) +emitting = false +amount = 10 +lifetime = 0.2 +mesh = SubResource("SphereMesh_1r04j") +direction = Vector3(0, -1, 0) +spread = 10.0 +initial_velocity_min = 0.1 +initial_velocity_max = 0.3 +color_ramp = SubResource("Gradient_p7a7b") + +[node name="Bubbles" type="CPUParticles3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0) +emitting = false +amount = 30 +mesh = SubResource("SphereMesh_3wrov") +direction = Vector3(0, 1, 0) +spread = 90.0 +gravity = Vector3(0, -0.2, 0) +initial_velocity_min = 0.1 +initial_velocity_max = 0.3 +scale_amount_min = 0.0 +scale_amount_max = 1.5 +scale_amount_curve = SubResource("Curve_wu4je") -- cgit v1.2.3-70-g09d2