diff options
| author | tpart <tpart120@proton.me> | 2026-03-07 00:32:00 +0100 |
|---|---|---|
| committer | tpart <tpart120@proton.me> | 2026-03-07 00:32:00 +0100 |
| commit | 59c25d65ce9b61e6eb964adf0934127df9848e9d (patch) | |
| tree | ae8fb8d8f577082c6fccf5822e5e3a2b3430c0b1 | |
| parent | ee020802239f2b34a49266a5cee0d01effcdc62b (diff) | |
| download | hurrycurry-59c25d65ce9b61e6eb964adf0934127df9848e9d.tar hurrycurry-59c25d65ce9b61e6eb964adf0934127df9848e9d.tar.bz2 hurrycurry-59c25d65ce9b61e6eb964adf0934127df9848e9d.tar.zst | |
Fix incorrect deep fryer basket target; Add tile rotation system
| -rw-r--r-- | client/map/map.gd | 2 | ||||
| -rw-r--r-- | client/map/tile_factory.gd | 6 | ||||
| -rw-r--r-- | client/map/tiles/deep_fryer.gd | 29 | ||||
| -rw-r--r-- | client/map/tiles/deep_fryer.gd.uid | 1 | ||||
| -rw-r--r-- | client/map/tiles/tile.gd | 2 |
5 files changed, 37 insertions, 3 deletions
diff --git a/client/map/map.gd b/client/map/map.gd index da9f3f68..51359359 100644 --- a/client/map/map.gd +++ b/client/map/map.gd @@ -86,7 +86,7 @@ func _add_tiles(pos: Vector2i, tiles: Array, pending_changes: Dictionary[Vector2 add_child(tiles_parent) var tile_instances: Array[Tile] = [] for tile_name: String in tiles: - var tile := tile_factory.produce(tile_name, pos, neighbors, srv) + var tile := tile_factory.produce(tile_name, pos, neighbors, tile_instances, srv) tile_instances.append(tile) tile.position = Vector3(pos.x, 0, pos.y) tiles_parent.add_child(tile) diff --git a/client/map/tile_factory.gd b/client/map/tile_factory.gd index 1ff6baf4..e2138cbf 100644 --- a/client/map/tile_factory.gd +++ b/client/map/tile_factory.gd @@ -32,6 +32,7 @@ class TileCC: var neighbors: Array var floor_meshers: Dictionary[String, FloorMesher] var server_context: Game.ServerContext + var below_tile_instances: Array[Tile] var floor_meshers: Dictionary[String, FloorMesher] = { "floor": FloorMesher.new(Floor.floor_mesh()), @@ -40,7 +41,7 @@ var floor_meshers: Dictionary[String, FloorMesher] = { "street": FloorMesher.new(Street.floor_mesh()) } -func produce(raw_name: String, position: Vector2i, neighbors: Array, server_context: Game.ServerContext = null) -> Tile: +func produce(raw_name: String, position: Vector2i, neighbors: Array, below_tile_instances: Array[Tile] = [], server_context: Game.ServerContext = null) -> Tile: var tile_name = TileName.new(raw_name) var ctx := TileCC.new() @@ -53,6 +54,7 @@ func produce(raw_name: String, position: Vector2i, neighbors: Array, server_cont ) ctx.floor_meshers = floor_meshers ctx.server_context = server_context + ctx.below_tile_instances = below_tile_instances match tile_name.name: "book": return CounterBase.new(ctx, preload("res://map/tiles/book.tscn")) @@ -74,7 +76,7 @@ func produce(raw_name: String, position: Vector2i, neighbors: Array, server_cont "path": return Path.new(ctx) "rolling-board": return RollingBoard.new(ctx) "screen": return Screen.new(ctx) - "deep-fryer": return GenericTile.new(ctx, preload("res://map/tiles/deep_fryer.tscn")) + "deep-fryer": return DeepFryer.new(ctx) "sink": return Sink.new(ctx) "stove": return Stove.new(ctx) "street": return Street.new(ctx) diff --git a/client/map/tiles/deep_fryer.gd b/client/map/tiles/deep_fryer.gd new file mode 100644 index 00000000..f7580c99 --- /dev/null +++ b/client/map/tiles/deep_fryer.gd @@ -0,0 +1,29 @@ +# 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 DeepFryer +extends Tile + +func _init(ctx: TileFactory.TileCC): + super(ctx) + base.add_child(preload("res://map/tiles/deep_fryer.tscn").instantiate()) + +func set_item(i: Item): + super(i) + if i != null: + i.rotation_target = item_base.global_rotation.y + PI + +static func interact_target() -> Vector3: + return Vector3(0., 0.55, 0.) diff --git a/client/map/tiles/deep_fryer.gd.uid b/client/map/tiles/deep_fryer.gd.uid new file mode 100644 index 00000000..26210181 --- /dev/null +++ b/client/map/tiles/deep_fryer.gd.uid @@ -0,0 +1 @@ +uid://bd0pophijvqv5 diff --git a/client/map/tiles/tile.gd b/client/map/tiles/tile.gd index 7473ff78..d46723a0 100644 --- a/client/map/tiles/tile.gd +++ b/client/map/tiles/tile.gd @@ -45,6 +45,8 @@ func _init(ctx: TileFactory.TileCC): var m: Node3D = base_mesh m.position += Vector3(0.5, 0, 0.5) add_child(m) + if not ctx.below_tile_instances.is_empty(): + base.rotation.y = ctx.below_tile_instances[-1].base.rotation.y func turn_facing(facing: Facing): base.rotation.y = facing * 0.5 * PI + PI |