aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2026-03-12 22:55:42 +0100
committertpart <tpart120@proton.me>2026-03-12 22:55:44 +0100
commit1a55a5d74bb3e57eb6e77286b86a5be559d43589 (patch)
tree2553b325863c178663ab703d55335e16ea1aecc3 /client
parent08d32f1dd3cfdfb0f2065cca1342e99bf514d1cd (diff)
downloadhurrycurry-1a55a5d74bb3e57eb6e77286b86a5be559d43589.tar
hurrycurry-1a55a5d74bb3e57eb6e77286b86a5be559d43589.tar.bz2
hurrycurry-1a55a5d74bb3e57eb6e77286b86a5be559d43589.tar.zst
Add button-base interact target; Refactor tile interact targets
Diffstat (limited to 'client')
-rw-r--r--client/map/tile_factory.gd2
-rw-r--r--client/map/tiles/active_interact_counter.gd2
-rw-r--r--client/map/tiles/button_base.gd24
-rw-r--r--client/map/tiles/button_base.gd.uid1
-rw-r--r--client/map/tiles/conveyor.gd2
-rw-r--r--client/map/tiles/counter.gd2
-rw-r--r--client/map/tiles/counter_window.gd2
-rw-r--r--client/map/tiles/counter_window_conveyor.gd2
-rw-r--r--client/map/tiles/crate.gd2
-rw-r--r--client/map/tiles/cutting_board.gd2
-rw-r--r--client/map/tiles/deep_fryer.gd2
-rw-r--r--client/map/tiles/rolling_board.gd2
-rw-r--r--client/map/tiles/stove.gd2
-rw-r--r--client/map/tiles/table.gd2
-rw-r--r--client/map/tiles/tile.gd15
-rw-r--r--client/map/tiles/window.gd2
16 files changed, 50 insertions, 16 deletions
diff --git a/client/map/tile_factory.gd b/client/map/tile_factory.gd
index aec67c53..80f0df5e 100644
--- a/client/map/tile_factory.gd
+++ b/client/map/tile_factory.gd
@@ -59,7 +59,7 @@ func produce(raw_name: String, position: Vector2i, neighbors: Array, below_tile_
match tile_name.name:
"book": return CounterBase.new(ctx, preload("res://map/tiles/book.tscn"))
"button": return Button_.new(ctx)
- "button-base": return GenericTile.new(ctx, preload("res://map/tiles/button_base.tscn"))
+ "button-base": return ButtonBase.new(ctx)
"ceiling-lamp": return GenericTile.new(ctx, preload("res://map/tiles/ceiling_lamp.tscn"))
"chair": return Chair.new(ctx)
"chandelier": return GenericTile.new(ctx, preload("res://map/tiles/chandelier.tscn"))
diff --git a/client/map/tiles/active_interact_counter.gd b/client/map/tiles/active_interact_counter.gd
index 11ab9d5a..fef23bba 100644
--- a/client/map/tiles/active_interact_counter.gd
+++ b/client/map/tiles/active_interact_counter.gd
@@ -57,5 +57,5 @@ func finish():
interact_tool.visible = true
interact_sound.stop()
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., 0.575, 0.)
diff --git a/client/map/tiles/button_base.gd b/client/map/tiles/button_base.gd
new file mode 100644
index 00000000..8f6597e9
--- /dev/null
+++ b/client/map/tiles/button_base.gd
@@ -0,0 +1,24 @@
+# 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 ButtonBase
+extends Tile
+
+func _init(ctx: TileFactory.TileCC):
+ super(ctx)
+ base.add_child(load("res://map/tiles/button_base.tscn").instantiate())
+
+static func interact_target(): # -> Vector3?
+ return Vector3(0, .5, 0)
diff --git a/client/map/tiles/button_base.gd.uid b/client/map/tiles/button_base.gd.uid
new file mode 100644
index 00000000..eafbd5d4
--- /dev/null
+++ b/client/map/tiles/button_base.gd.uid
@@ -0,0 +1 @@
+uid://dblj24kid00tx
diff --git a/client/map/tiles/conveyor.gd b/client/map/tiles/conveyor.gd
index 8f2c6d12..421bc411 100644
--- a/client/map/tiles/conveyor.gd
+++ b/client/map/tiles/conveyor.gd
@@ -22,7 +22,7 @@ func _init(ctx: TileFactory.TileCC):
super(ctx)
base.add_child(conveyor)
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., .425, 0.)
func pass_to(tile: Tile):
diff --git a/client/map/tiles/counter.gd b/client/map/tiles/counter.gd
index fc302694..f91c5cbc 100644
--- a/client/map/tiles/counter.gd
+++ b/client/map/tiles/counter.gd
@@ -40,7 +40,7 @@ enum CounterKind {
var kind: CounterKind = CounterKind.STRAIGHT
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0, 0.5, 0)
func _init(ctx: TileFactory.TileCC):
diff --git a/client/map/tiles/counter_window.gd b/client/map/tiles/counter_window.gd
index 46889e43..8b01979d 100644
--- a/client/map/tiles/counter_window.gd
+++ b/client/map/tiles/counter_window.gd
@@ -16,7 +16,7 @@
class_name CounterWindow
extends WallTile
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0, 0.625, 0)
func _init(ctx: TileFactory.TileCC):
diff --git a/client/map/tiles/counter_window_conveyor.gd b/client/map/tiles/counter_window_conveyor.gd
index a22b65cd..cd661298 100644
--- a/client/map/tiles/counter_window_conveyor.gd
+++ b/client/map/tiles/counter_window_conveyor.gd
@@ -27,7 +27,7 @@ func _init(ctx: TileFactory.TileCC):
push_warning("There is no corner counter window!")
add_dyed_mesh(ctx, conveyor)
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., .425, 0.)
func pass_to(tile: Tile):
diff --git a/client/map/tiles/crate.gd b/client/map/tiles/crate.gd
index 32c3dc80..24dada3c 100644
--- a/client/map/tiles/crate.gd
+++ b/client/map/tiles/crate.gd
@@ -16,7 +16,7 @@
class_name Crate
extends Counter
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0, 0.25, 0)
func _init(ctx: TileFactory.TileCC):
diff --git a/client/map/tiles/cutting_board.gd b/client/map/tiles/cutting_board.gd
index a7975a44..65487417 100644
--- a/client/map/tiles/cutting_board.gd
+++ b/client/map/tiles/cutting_board.gd
@@ -19,5 +19,5 @@ extends ActiveInteractCounter
func _init(ctx: TileFactory.TileCC):
super(ctx, preload("res://map/tiles/cutting_board.tscn"), "CuttingBoard/Knife", func (p: Player, x: bool): p.character.cutting = x, preload("res://map/tiles/sounds/chop.ogg"))
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., 0.575, 0.)
diff --git a/client/map/tiles/deep_fryer.gd b/client/map/tiles/deep_fryer.gd
index f7580c99..5318cd62 100644
--- a/client/map/tiles/deep_fryer.gd
+++ b/client/map/tiles/deep_fryer.gd
@@ -25,5 +25,5 @@ func set_item(i: Item):
if i != null:
i.rotation_target = item_base.global_rotation.y + PI
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., 0.55, 0.)
diff --git a/client/map/tiles/rolling_board.gd b/client/map/tiles/rolling_board.gd
index 81934dbc..00c28ba1 100644
--- a/client/map/tiles/rolling_board.gd
+++ b/client/map/tiles/rolling_board.gd
@@ -19,5 +19,5 @@ extends ActiveInteractCounter
func _init(ctx: TileFactory.TileCC):
super(ctx, preload("res://map/tiles/rolling_board.tscn"), "RollingBoard/RollingPin", func (p: Player, x: bool): p.character.rolling = x, preload("res://map/tiles/sounds/roll.ogg"))
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., 0.575, 0.)
diff --git a/client/map/tiles/stove.gd b/client/map/tiles/stove.gd
index d305da8c..3adb6c91 100644
--- a/client/map/tiles/stove.gd
+++ b/client/map/tiles/stove.gd
@@ -20,5 +20,5 @@ func _init(ctx: TileFactory.TileCC):
super(ctx)
base.add_child(load("res://map/tiles/stove.tscn").instantiate())
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., 0.625, 0.)
diff --git a/client/map/tiles/table.gd b/client/map/tiles/table.gd
index 046749d7..72352dac 100644
--- a/client/map/tiles/table.gd
+++ b/client/map/tiles/table.gd
@@ -20,5 +20,5 @@ func _init(ctx: TileFactory.TileCC):
super(ctx)
base.add_child(load("res://map/tiles/table.tscn").instantiate())
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0., .5, 0.)
diff --git a/client/map/tiles/tile.gd b/client/map/tiles/tile.gd
index d46723a0..cd41ecc9 100644
--- a/client/map/tiles/tile.gd
+++ b/client/map/tiles/tile.gd
@@ -36,10 +36,18 @@ func _init(ctx: TileFactory.TileCC):
var item_base_ = Node3D.new()
# this method is supposed to be overriden
@warning_ignore("static_called_on_instance")
- item_base_.position = interact_target()
+
+ var item_base_pos = interact_target()
+ if item_base_pos == null:
+ if ctx.below_tile_instances.is_empty():
+ item_base_pos = Vector3.ZERO
+ else:
+ item_base_pos = ctx.below_tile_instances[-1].item_base.position
+ item_base_.position = item_base_pos
item_base_.name = "ItemBase"
base.add_child(item_base_)
item_base = item_base_
+
base_mesh = get_base_mesh()
if base_mesh != null:
var m: Node3D = base_mesh
@@ -52,8 +60,8 @@ func turn_facing(facing: Facing):
base.rotation.y = facing * 0.5 * PI + PI
# defines where items go when interacting
-static func interact_target() -> Vector3:
- return Vector3(0, 0, 0)
+static func interact_target(): #-> Vector3?
+ return null
# actions when interacting, e.g. animations
func interact():
@@ -86,6 +94,7 @@ func set_item(i: Item):
item.remove()
item = i
if i != null:
+ printt("I am", self, "and item", i, "now has item target", item_base.global_position)
i.owned_by = item_base
i.position_target = item_base.global_position
diff --git a/client/map/tiles/window.gd b/client/map/tiles/window.gd
index da0963ed..f8444fff 100644
--- a/client/map/tiles/window.gd
+++ b/client/map/tiles/window.gd
@@ -16,7 +16,7 @@
class_name WallWindow
extends WallTile
-static func interact_target() -> Vector3:
+static func interact_target(): # -> Vector3?
return Vector3(0, 0.625, 0)
func _init(ctx: TileFactory.TileCC):