From 4090b870fdc7f6b97b363e08ad3073fddb391246 Mon Sep 17 00:00:00 2001 From: tpart Date: Mon, 16 Sep 2024 12:12:12 +0200 Subject: Implement food processor contents in new item system --- client/map/items/food_processor.gd | 37 ++++++++++- client/map/items/food_processor_content.gd | 28 -------- client/map/items/food_processor_content.res | Bin 3141 -> 0 bytes client/map/items/food_processor_content.tscn | 13 ---- client/map/items/food_processor_fill.gd | 27 ++++++++ client/map/items/food_processor_fill.res | Bin 0 -> 3141 bytes client/map/items/food_processor_fill.tscn | 13 ++++ client/map/items/food_processor_items.gd | 92 --------------------------- 8 files changed, 74 insertions(+), 136 deletions(-) delete mode 100644 client/map/items/food_processor_content.gd delete mode 100644 client/map/items/food_processor_content.res delete mode 100644 client/map/items/food_processor_content.tscn create mode 100644 client/map/items/food_processor_fill.gd create mode 100644 client/map/items/food_processor_fill.res create mode 100644 client/map/items/food_processor_fill.tscn delete mode 100644 client/map/items/food_processor_items.gd diff --git a/client/map/items/food_processor.gd b/client/map/items/food_processor.gd index a53d2034..c082a741 100644 --- a/client/map/items/food_processor.gd +++ b/client/map/items/food_processor.gd @@ -1,5 +1,6 @@ # Hurry Curry! - a game about cooking # Copyright 2024 nokoe +# Copyright 2024 tpart # # 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 @@ -23,9 +24,39 @@ func _init(owned_by_: Node3D, contents: Array): super(owned_by_) add_child(load("res://map/items/food_processor.tscn").instantiate()) add_child(processing) - # TODO - # for c in contents: - # base.add_child(ItemFactory.produce(c)) + + for i in contents: + match i: + "milk": + add_child(FoodProcessorFill.new(self, Color(1., 1., 1.))) + "rice-flour": + add_child(FoodProcessorFill.new(self, Color(1.,1.,.8))) + "rice": + processing.color = Color(1.,1.,.8) + base.add_child(load("res://map/items/rice.tscn").instantiate()) + "flour": + processing.color = Color(.9, .9, .9) + base.add_child(load("res://map/items/flour.tscn").instantiate()) + "dough": + add_child(FoodProcessorFill.new(self, Color8(200, 180, 160))) + "coconut": + add_child(FoodProcessorFill.new(self, Color(.8, .5, .4))) + base.add_child(load("res://map/items/coconut.tscn").instantiate()) + "strawberry": + processing.color = Color(.9, .0, .0) + base.add_child(load("res://map/items/strawberry.tscn").instantiate()) + "strawberry-shake": + add_child(FoodProcessorFill.new(self, Color8(250, 140, 180))) + "strawberry-icecream": + add_child(FoodProcessorFill.new(self, Color8(250, 180, 210))) + "strawberry-puree": + add_child(FoodProcessorFill.new(self, Color8(200, 80, 80))) + "tomato": + processing.color = Color(1.,0.,0.) + base.add_child(load("res://map/items/tomato.tscn").instantiate()) + "tomato-juice": + add_child(FoodProcessorFill.new(self, Color(1., .0, .0))) + _: push_error("Food processor fill not implemented: %s" % contents) func _process(delta: float): super(delta) diff --git a/client/map/items/food_processor_content.gd b/client/map/items/food_processor_content.gd deleted file mode 100644 index 8968b390..00000000 --- a/client/map/items/food_processor_content.gd +++ /dev/null @@ -1,28 +0,0 @@ -# Hurry Curry! - a game about cooking -# Copyright 2024 Rusty Striker -# 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 FoodProcessorContent -extends FoodProcessor - -var content: MeshInstance3D = load("res://map/items/food_processor_content.tscn").instantiate() - -func _init(owned_by_: Node3D): - super(owned_by_) - add_child(content) - -func set_color(c: Color): - var mat: BaseMaterial3D = content.get_active_material(0) - mat.albedo_color = c diff --git a/client/map/items/food_processor_content.res b/client/map/items/food_processor_content.res deleted file mode 100644 index 7511cc75..00000000 Binary files a/client/map/items/food_processor_content.res and /dev/null differ diff --git a/client/map/items/food_processor_content.tscn b/client/map/items/food_processor_content.tscn deleted file mode 100644 index a1cac96e..00000000 --- a/client/map/items/food_processor_content.tscn +++ /dev/null @@ -1,13 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://di5nq2vgvostp"] - -[ext_resource type="ArrayMesh" uid="uid://vkd0ty7khthl" path="res://map/items/food_processor_content.res" id="1_pyn0j"] - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0xb6r"] -resource_local_to_scene = true -cull_mode = 1 - -[node name="FoodProcessorContent" type="MeshInstance3D"] -transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, 0, 0.3, 0) -mesh = ExtResource("1_pyn0j") -skeleton = NodePath("") -surface_material_override/0 = SubResource("StandardMaterial3D_0xb6r") diff --git a/client/map/items/food_processor_fill.gd b/client/map/items/food_processor_fill.gd new file mode 100644 index 00000000..aa92de69 --- /dev/null +++ b/client/map/items/food_processor_fill.gd @@ -0,0 +1,27 @@ +# Hurry Curry! - a game about cooking +# Copyright 2024 Rusty Striker +# Copyright 2024 nokoe +# Copyright 2024 tpart +# +# 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 FoodProcessorFill +extends Item + +var fill: MeshInstance3D = load("res://map/items/food_processor_fill.tscn").instantiate() + +func _init(owned_by_: Node3D, c: Color): + super(owned_by_) + var mat: BaseMaterial3D = fill.get_active_material(0) + mat.albedo_color = c + add_child(fill) diff --git a/client/map/items/food_processor_fill.res b/client/map/items/food_processor_fill.res new file mode 100644 index 00000000..7511cc75 Binary files /dev/null and b/client/map/items/food_processor_fill.res differ diff --git a/client/map/items/food_processor_fill.tscn b/client/map/items/food_processor_fill.tscn new file mode 100644 index 00000000..fa85e40a --- /dev/null +++ b/client/map/items/food_processor_fill.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=3 format=3 uid="uid://di5nq2vgvostp"] + +[ext_resource type="ArrayMesh" uid="uid://vkd0ty7khthl" path="res://map/items/food_processor_fill.res" id="1_tcr3k"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0xb6r"] +resource_local_to_scene = true +cull_mode = 1 + +[node name="FoodProcessorFill" type="MeshInstance3D"] +transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, 0, 0.3, 0) +mesh = ExtResource("1_tcr3k") +skeleton = NodePath("") +surface_material_override/0 = SubResource("StandardMaterial3D_0xb6r") diff --git a/client/map/items/food_processor_items.gd b/client/map/items/food_processor_items.gd deleted file mode 100644 index 0b5be011..00000000 --- a/client/map/items/food_processor_items.gd +++ /dev/null @@ -1,92 +0,0 @@ -# Hurry Curry! - a game about cooking -# Copyright 2024 metamuffin -# 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 FoodProcessorItems - -class MilkF extends FoodProcessorContent: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color8(250, 250, 250)) - -class RiceFlourF extends FoodProcessorContent: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,1.,.8)) - -class RiceF extends FoodProcessor: - func _init(owned_by_: Node3D): - super(owned_by_) - processing.color = Color(1.,1.,.8) - base.add_child(load("res://map/items/rice.tscn").instantiate()) - -class FlourF extends FoodProcessor: - func _init(owned_by_: Node3D): - super(owned_by_) - processing.color = Color(.9, .9, .9) - base.add_child(load("res://map/items/flour.tscn").instantiate()) - -class DoughF extends FoodProcessorContent: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color8(200, 180, 160)) - -class CoconutF extends FoodProcessor: - func _init(owned_by_: Node3D): - super(owned_by_) - processing.color = Color(.8, .5, .4) - base.add_child(load("res://map/items/coconut.tscn").instantiate()) - -class StrawberryF extends FoodProcessor: - func _init(owned_by_: Node3D): - super(owned_by_) - processing.color = Color(.9, .0, .0) - base.add_child(load("res://map/items/strawberry.tscn").instantiate()) - -class CoconutStrawberryPureeF extends StrawberryPureeF: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/coconut.tscn").instantiate()) - -class MilkStrawberryF extends MilkF: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/strawberry.tscn").instantiate()) - -class StrawberryShakeF extends FoodProcessorContent: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color8(250, 140, 180)) - -class StrawberryIcecreamF extends FoodProcessorContent: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color8(250, 180, 210)) - -class StrawberryPureeF extends FoodProcessorContent: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color8(200, 80, 80)) - -class TomatoF extends FoodProcessor: - func _init(owned_by_: Node3D): - super(owned_by_) - processing.color = Color(1.,0.,0.) - base.add_child(load("res://map/items/tomato.tscn").instantiate()) - -class TomatoJuiceF extends FoodProcessorContent: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,0.,0.)) -- cgit v1.2.3-70-g09d2