diff options
| -rw-r--r-- | client/map/item_factory.gd | 9 | ||||
| -rw-r--r-- | client/map/items/plate.gd | 7 | ||||
| -rw-r--r-- | client/map/items/rolled_dough.gd | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/client/map/item_factory.gd b/client/map/item_factory.gd index 028b9a15..8596b0d1 100644 --- a/client/map/item_factory.gd +++ b/client/map/item_factory.gd @@ -23,9 +23,14 @@ class ItemName: func _init(raw_name: String): raw = raw_name - var c = Array(raw_name.split(":")) + var c = Array(raw_name.split(":", false, 1)) name = c[0] - contents = c[1].split(",") if c.size() > 1 else [] + if c.size() == 1: + contents = [] + elif not c[1].contains(":"): + contents = c[1].split(",") + else: + contents = [c[1]] # Don't parse it, handle it in the item instead static func produce(raw_name: String, owned_by: Node3D) -> Item: var name = ItemName.new(raw_name) diff --git a/client/map/items/plate.gd b/client/map/items/plate.gd index 10918595..088d8734 100644 --- a/client/map/items/plate.gd +++ b/client/map/items/plate.gd @@ -46,7 +46,7 @@ func add_contents(contents: Array[String]): # Stack content items on top of each other var height_sum := 0. - for c in contents: + for c: String in contents: var item: Item match c: "curry": add_child(PlateFill.new(self, Color(.75, .45, .1))) @@ -66,7 +66,10 @@ func add_contents(contents: Array[String]): base.add_child(seared_steak) seared_steak.scale *= 0.5 seared_steak.position += Vector3(.1, 0, .1) - _: item = ItemFactory.produce(c, base) + _: + item = ItemFactory.produce(c, base) + if c.contains("pizza"): + item.scale = Vector3(.7, .7, .7) if item != null: base.add_child(item) item.position.y = height_sum diff --git a/client/map/items/rolled_dough.gd b/client/map/items/rolled_dough.gd index fd6ae3d8..86c12062 100644 --- a/client/map/items/rolled_dough.gd +++ b/client/map/items/rolled_dough.gd @@ -22,10 +22,10 @@ func _init(owned_by_: Node3D): func add_contents(contents: Array[String]): contents.sort() - if contents.is_empty(): - base.add_child(load("res://map/items/rolled_dough.tscn").instantiate()) if contents.has("tomato-juice"): base.add_child(load("res://map/items/raw_pizza.tscn").instantiate()) + else: + base.add_child(load("res://map/items/rolled_dough.tscn").instantiate()) for c: String in contents: match c: |