1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# 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 ItemFactory
extends Object
class ItemName:
var name: String
var contents: Array
func _init(raw_name: String):
var c = Array(raw_name.split(":"))
name = c[0]
contents = c[1].split(",") if c.size() > 1 else []
static func produce(raw_name: String, owned_by: Node3D) -> Item:
var item: Item = produce_inner(raw_name, owned_by)
item.item_name = raw_name
return item
static func produce_inner(raw_name: String, owned_by: Node3D) -> Item:
var item = ItemName.new(raw_name)
match item.name:
"bun": return Bun.new(owned_by)
"cheese": return Cheese.new(owned_by)
"cooked-noodles": return CookedNoodles.new(owned_by)
"sliced-cheese": return SlicedCheese.new(owned_by)
"dirt": return Dirt.new(owned_by)
"sliced-bun": return SlicedBun.new(owned_by)
"sliced-bun-top": return SlicedBunTop.new(owned_by)
"sliced-bun-bottom": return SlicedBunBottom.new(owned_by)
"burned": return Burned.new(owned_by)
"coconut": return Coconut.new(owned_by)
"dough": return Dough.new(owned_by)
"fish": return Fish.new(owned_by)
"flour": return Flour.new(owned_by)
"leek": return Leek.new(owned_by)
"sliced-leek": return SlicedLeek.new(owned_by)
"noodles": return Noodles.new(owned_by)
"rolled-dough": return RolledDough.new(owned_by)
"strawberry-mochi": return Mochi.new(owned_by, Color(.98, .70, .75))
"nigiri": return Nigiri.new(owned_by)
"steak": return Steak.new(owned_by)
"seared-steak": return SearedSteak.new(owned_by)
"patty": return Patty.new(owned_by)
"seared-patty": return SearedPatty.new(owned_by)
"rice": return Rice.new(owned_by)
"sliced-fish": return SlicedFish.new(owned_by)
"strawberry": return Strawberry.new(owned_by)
"tomato": return Tomato.new(owned_by)
"sliced-tomato": return SlicedTomato.new(owned_by)
"lettuce": return Lettuce.new(owned_by)
"sliced-lettuce": return SlicedLettuce.new(owned_by)
"potato": return Potato.new(owned_by)
"dirty-plate": return Plate.new(owned_by, ["dirt"])
"pot": return Pot.new(owned_by, item.contents)
"basket": return Basket.new(owned_by, item.contents)
"pan": return Pan.new(owned_by, item.contents)
"foodprocessor": return FoodProcessor.new(owned_by, item.contents)
"glass": return Glass.new(owned_by, item.contents)
"plate": return Plate.new(owned_by, item.contents)
"unknown-order": return UnknownOrder.new(owned_by)
_: return GenericItem.new(owned_by, raw_name)
|