summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-09-16 12:46:09 +0200
committertpart <tpart120@proton.me>2024-09-16 12:46:09 +0200
commitfee8f4ee5b331add43eb8b885b2f04d719d18d69 (patch)
treea2a148d6640aed7ee89d80a1c0ed98585c3005cc
parentd178223b1a916682c8dc4b9fdd0d7ad886bf9df6 (diff)
downloadhurrycurry-fee8f4ee5b331add43eb8b885b2f04d719d18d69.tar
hurrycurry-fee8f4ee5b331add43eb8b885b2f04d719d18d69.tar.bz2
hurrycurry-fee8f4ee5b331add43eb8b885b2f04d719d18d69.tar.zst
Fix item stacking on plate; Implement correct bun slice behaviour on plates
-rw-r--r--client/map/item_factory.gd4
-rw-r--r--client/map/items/item.gd8
-rw-r--r--client/map/items/plate.gd7
-rw-r--r--client/map/items/sliced_bun_bottom.gd21
-rw-r--r--client/map/items/sliced_bun_bottom.tscn10
-rw-r--r--client/map/items/sliced_bun_top.gd21
-rw-r--r--client/map/items/sliced_bun_top.tscn10
7 files changed, 74 insertions, 7 deletions
diff --git a/client/map/item_factory.gd b/client/map/item_factory.gd
index fb7e1131..2c77eb43 100644
--- a/client/map/item_factory.gd
+++ b/client/map/item_factory.gd
@@ -24,9 +24,11 @@ static func produce(full_name: String, owned_by: Node3D) -> Item:
var contents = c[1].split(",") if c.size() > 1 else []
match name:
- "bread-slice": return BreadSlice.new(owned_by)
+ # "bread-slice": return BreadSlice.new(owned_by)
"bun": return Bun.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)
"bread": return Bread.new(owned_by)
"burned": return Burned.new(owned_by)
"coconut": return Coconut.new(owned_by)
diff --git a/client/map/items/item.gd b/client/map/items/item.gd
index c7c06b05..d24cd36b 100644
--- a/client/map/items/item.gd
+++ b/client/map/items/item.gd
@@ -41,12 +41,8 @@ func _init(owned_by_: Node3D):
add_child(base)
owned_by = owned_by_
-func _ready():
- position = owned_by.global_position
-
func _process(delta):
- if owned_by.get_parent() is Item or owned_by is Item:
- position = Vector3(0.,0.,0.)
+ if owned_by.get_parent() is Item or owned_by is Item:
return
var p = owned_by.get_parent().get_parent() is Player
var ispeed = 30.0 if p else 10.
@@ -79,4 +75,4 @@ static func base_position() -> Vector3:
return Vector3(0., 0., 0.)
static func height() -> float:
- return 0.1
+ return .1
diff --git a/client/map/items/plate.gd b/client/map/items/plate.gd
index 1b736f59..eb9ee4b5 100644
--- a/client/map/items/plate.gd
+++ b/client/map/items/plate.gd
@@ -21,6 +21,13 @@ func _init(owned_by_: Node3D, contents: Array):
super(owned_by_)
add_child(load("res://map/items/plate.tscn").instantiate())
+ # Custom logic for handling burgers with buns on bottom and top
+ if contents.has("sliced-bun"):
+ contents.erase("sliced-bun")
+ contents.push_front("sliced-bun-bottom")
+ contents.push_back("sliced-bun-top")
+
+ # Stack content items on top of each other
var height_sum := 0.
for c in contents:
var item: Item
diff --git a/client/map/items/sliced_bun_bottom.gd b/client/map/items/sliced_bun_bottom.gd
new file mode 100644
index 00000000..28ccd90a
--- /dev/null
+++ b/client/map/items/sliced_bun_bottom.gd
@@ -0,0 +1,21 @@
+# Hurry Curry! - a game about cooking
+# 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 <https://www.gnu.org/licenses/>.
+#
+class_name SlicedBunBottom
+extends Item
+
+func _init(owned_by_: Node3D):
+ super(owned_by_)
+ base.add_child(load("res://map/items/sliced_bun_bottom.tscn").instantiate())
diff --git a/client/map/items/sliced_bun_bottom.tscn b/client/map/items/sliced_bun_bottom.tscn
new file mode 100644
index 00000000..573dba13
--- /dev/null
+++ b/client/map/items/sliced_bun_bottom.tscn
@@ -0,0 +1,10 @@
+[gd_scene load_steps=2 format=3 uid="uid://djtfnj11lljke"]
+
+[ext_resource type="ArrayMesh" uid="uid://c1qyv55xpv30n" path="res://map/items/sliced_bun_bottom.res" id="1_ekr5f"]
+
+[node name="SlicedBunBottom" type="Node3D"]
+
+[node name="Mesh" type="MeshInstance3D" parent="."]
+transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
+mesh = ExtResource("1_ekr5f")
+skeleton = NodePath("")
diff --git a/client/map/items/sliced_bun_top.gd b/client/map/items/sliced_bun_top.gd
new file mode 100644
index 00000000..c4ad4dc5
--- /dev/null
+++ b/client/map/items/sliced_bun_top.gd
@@ -0,0 +1,21 @@
+# Hurry Curry! - a game about cooking
+# 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 <https://www.gnu.org/licenses/>.
+#
+class_name SlicedBunTop
+extends Item
+
+func _init(owned_by_: Node3D):
+ super(owned_by_)
+ base.add_child(load("res://map/items/sliced_bun_top.tscn").instantiate())
diff --git a/client/map/items/sliced_bun_top.tscn b/client/map/items/sliced_bun_top.tscn
new file mode 100644
index 00000000..403ecea7
--- /dev/null
+++ b/client/map/items/sliced_bun_top.tscn
@@ -0,0 +1,10 @@
+[gd_scene load_steps=2 format=3 uid="uid://cpmnp5sy6fwbe"]
+
+[ext_resource type="ArrayMesh" uid="uid://dy180cecs6rb1" path="res://map/items/sliced_bun_top.res" id="1_q5w8k"]
+
+[node name="SlicedBunTop" type="Node3D"]
+
+[node name="Mesh" type="MeshInstance3D" parent="."]
+transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
+mesh = ExtResource("1_q5w8k")
+skeleton = NodePath("")