aboutsummaryrefslogtreecommitdiff
path: root/client/map/items
diff options
context:
space:
mode:
authornokoe <nokoe@mailbox.org>2025-10-06 20:12:13 +0200
committernokoe <nokoe@mailbox.org>2025-10-06 20:13:30 +0200
commitfc4de182fa5c9afca17069f09f362109c0a957a2 (patch)
tree9e8c35475dfc1c9e26e9ac8d235983d4026a4888 /client/map/items
parenta251cf726551935b59072ffc01b87876968715c2 (diff)
downloadhurrycurry-fc4de182fa5c9afca17069f09f362109c0a957a2.tar
hurrycurry-fc4de182fa5c9afca17069f09f362109c0a957a2.tar.bz2
hurrycurry-fc4de182fa5c9afca17069f09f362109c0a957a2.tar.zst
allow every item to have contents
Diffstat (limited to 'client/map/items')
-rw-r--r--client/map/items/food_processor.gd7
-rw-r--r--client/map/items/item.gd6
-rw-r--r--client/map/items/nigiri.gd21
-rw-r--r--client/map/items/nigiri.gd.uid1
-rw-r--r--client/map/items/plate.gd5
5 files changed, 13 insertions, 27 deletions
diff --git a/client/map/items/food_processor.gd b/client/map/items/food_processor.gd
index 4932b791..f3ae0b9e 100644
--- a/client/map/items/food_processor.gd
+++ b/client/map/items/food_processor.gd
@@ -19,11 +19,12 @@ extends Item
var time := 0.
var processing: CPUParticles3D = load("res://map/items/processing.tscn").instantiate()
-func _init(owned_by_: Node3D, contents: Array):
+func _init(owned_by_: Node3D):
super(owned_by_)
add_child(load("res://map/items/food_processor.tscn").instantiate())
add_child(processing)
-
+
+func add_contents(contents: Array[String]):
for i in contents:
match i:
"milk":
@@ -55,7 +56,7 @@ func _init(owned_by_: Node3D, contents: Array):
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)
+ _: super([i])
func _process(delta: float):
super(delta)
diff --git a/client/map/items/item.gd b/client/map/items/item.gd
index 5a43af2d..44482c9b 100644
--- a/client/map/items/item.gd
+++ b/client/map/items/item.gd
@@ -57,6 +57,12 @@ func _init(owned_by_: Node3D):
add_child(base)
owned_by = owned_by_
+func add_contents(contents: Array[String]):
+ for i in contents:
+ match i:
+ _:
+ base.add_child(ItemFactory.produce(i, self))
+
func animate_spawn():
creation_timer = 0.0
scale = Vector3.ONE * 0.001 # setting to zero breaks assertions somewhere in the engine
diff --git a/client/map/items/nigiri.gd b/client/map/items/nigiri.gd
deleted file mode 100644
index af18c564..00000000
--- a/client/map/items/nigiri.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# Hurry Curry! - a game about cooking
-# Copyright (C) 2025 Hurry Curry! contributors
-#
-# 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 Nigiri
-extends Item
-
-func _init(owned_by_: Node3D):
- super(owned_by_)
- base.add_child(load("res://map/items/nigiri.tscn").instantiate())
diff --git a/client/map/items/nigiri.gd.uid b/client/map/items/nigiri.gd.uid
deleted file mode 100644
index c3e9866f..00000000
--- a/client/map/items/nigiri.gd.uid
+++ /dev/null
@@ -1 +0,0 @@
-uid://bedfy3i7dip8b
diff --git a/client/map/items/plate.gd b/client/map/items/plate.gd
index d6df1c46..b4ae8baf 100644
--- a/client/map/items/plate.gd
+++ b/client/map/items/plate.gd
@@ -16,10 +16,11 @@
class_name Plate
extends Item
-func _init(owned_by_: Node3D, contents: Array):
+func _init(owned_by_: Node3D):
super(owned_by_)
add_child(load("res://map/items/plate.tscn").instantiate())
-
+
+func add_contents(contents: Array[String]):
# Custom logic for handling burgers with buns on bottom and top
if contents.has("sliced-bun") and contents.size() > 1:
contents.erase("sliced-bun")