From 96272855e7f6093ed48e3c4da232ded124e9615b Mon Sep 17 00:00:00 2001 From: nokoe Date: Fri, 12 Dec 2025 21:45:05 +0100 Subject: remove redundant classes for tiles --- client/map/tile_factory.gd | 8 ++++---- client/map/tiles/book.gd | 21 --------------------- client/map/tiles/book.gd.uid | 1 - client/map/tiles/ceiling_lamp.gd | 21 --------------------- client/map/tiles/ceiling_lamp.gd.uid | 1 - client/map/tiles/chair.gd | 12 +++++------- client/map/tiles/chandelier.gd | 21 --------------------- client/map/tiles/chandelier.gd.uid | 1 - client/map/tiles/counter_base.gd | 4 +++- client/map/tiles/cutting_board.gd | 5 ++--- client/map/tiles/deep_fryer.gd | 5 ++--- client/map/tiles/generic_tile.gd | 10 +++------- client/map/tiles/generic_tile.gd.uid | 2 +- client/map/tiles/rolling_board.gd | 3 +-- client/map/tiles/unknown_tile.gd | 25 +++++++++++++++++++++++++ client/map/tiles/unknown_tile.gd.uid | 1 + 16 files changed, 47 insertions(+), 94 deletions(-) delete mode 100644 client/map/tiles/book.gd delete mode 100644 client/map/tiles/book.gd.uid delete mode 100644 client/map/tiles/ceiling_lamp.gd delete mode 100644 client/map/tiles/ceiling_lamp.gd.uid delete mode 100644 client/map/tiles/chandelier.gd delete mode 100644 client/map/tiles/chandelier.gd.uid create mode 100644 client/map/tiles/unknown_tile.gd create mode 100644 client/map/tiles/unknown_tile.gd.uid (limited to 'client/map') diff --git a/client/map/tile_factory.gd b/client/map/tile_factory.gd index cb5e5f13..4cfbb724 100644 --- a/client/map/tile_factory.gd +++ b/client/map/tile_factory.gd @@ -49,14 +49,14 @@ func produce(raw_name: String, position: Vector2i, neighbors: Array) -> Tile: match tile_name.name: "black-hole-counter": return ItemPortal.new(ctx, false) "black-hole": return PlayerPortal.new(ctx, false) - "book": return Book.new(ctx) - "ceiling-lamp": return CeilingLamp.new(ctx) + "book": return CounterBase.new(ctx, preload("res://map/tiles/book.tscn")) + "ceiling-lamp": return GenericTile.new(ctx, preload("res://map/tiles/ceiling_lamp.tscn")) "chair": return Chair.new(ctx) - "chandelier": return Chandelier.new(ctx) + "chandelier": return GenericTile.new(ctx, preload("res://map/tiles/chandelier.tscn")) "conveyor": return Conveyor.new(ctx) "counter-window": return CounterWindow.new(ctx) "counter-window-conveyor": return CounterWindowConveyor.new(ctx) - "counter": return CounterBase.new(ctx) + "counter": return CounterBase.new(ctx, null) "cutting-board": return CuttingBoard.new(ctx) "door": return Door.new(ctx) "fence": return Fence.new(ctx) diff --git a/client/map/tiles/book.gd b/client/map/tiles/book.gd deleted file mode 100644 index 6a48752a..00000000 --- a/client/map/tiles/book.gd +++ /dev/null @@ -1,21 +0,0 @@ -# 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 . -# -class_name Book -extends CounterBase - -func _init(ctx: TileFactory.TileCC): - super(ctx) - base.add_child(load("res://map/tiles/book.tscn").instantiate()) diff --git a/client/map/tiles/book.gd.uid b/client/map/tiles/book.gd.uid deleted file mode 100644 index a53157dc..00000000 --- a/client/map/tiles/book.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://tx2an1h38i3c diff --git a/client/map/tiles/ceiling_lamp.gd b/client/map/tiles/ceiling_lamp.gd deleted file mode 100644 index 3b504ed7..00000000 --- a/client/map/tiles/ceiling_lamp.gd +++ /dev/null @@ -1,21 +0,0 @@ -# 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 . -# -class_name CeilingLamp -extends Floor - -func _init(ctx: TileFactory.TileCC): - super(ctx) - base.add_child(load("res://map/tiles/ceiling_lamp.tscn").instantiate()) diff --git a/client/map/tiles/ceiling_lamp.gd.uid b/client/map/tiles/ceiling_lamp.gd.uid deleted file mode 100644 index 23e304d9..00000000 --- a/client/map/tiles/ceiling_lamp.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://c2eke3hg0l85c diff --git a/client/map/tiles/chair.gd b/client/map/tiles/chair.gd index c17f3f9b..45b45638 100644 --- a/client/map/tiles/chair.gd +++ b/client/map/tiles/chair.gd @@ -21,12 +21,10 @@ func _init(ctx: TileFactory.TileCC): var chair = preload("res://map/tiles/chair.tscn").instantiate() var facing = 0; for i in range(4): - if ctx.neighbors[i] == "conveyor": - facing = i - break - for i in range(4): - if ctx.neighbors[i] == "table": - facing = i - break + match ctx.neighbors[i]: + "coveyor", "table", "counter": + facing = i + break + base.add_child(chair) turn_facing(facing) diff --git a/client/map/tiles/chandelier.gd b/client/map/tiles/chandelier.gd deleted file mode 100644 index cce877ea..00000000 --- a/client/map/tiles/chandelier.gd +++ /dev/null @@ -1,21 +0,0 @@ -# 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 . -# -class_name Chandelier -extends Floor - -func _init(ctx: TileFactory.TileCC): - super(ctx) - base.add_child(load("res://map/tiles/chandelier.tscn").instantiate()) diff --git a/client/map/tiles/chandelier.gd.uid b/client/map/tiles/chandelier.gd.uid deleted file mode 100644 index df037e09..00000000 --- a/client/map/tiles/chandelier.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://xj1r8ubad6mu diff --git a/client/map/tiles/counter_base.gd b/client/map/tiles/counter_base.gd index 34bc5b59..d29953ad 100644 --- a/client/map/tiles/counter_base.gd +++ b/client/map/tiles/counter_base.gd @@ -16,7 +16,7 @@ class_name CounterBase extends Counter -func _init(ctx: TileFactory.TileCC): +func _init(ctx: TileFactory.TileCC, top): super(ctx) match kind: CounterKind.OUTER_CORNER: @@ -25,3 +25,5 @@ func _init(ctx: TileFactory.TileCC): base.add_child(load("res://map/tiles/counter_straight.tscn").instantiate()) CounterKind.STRAIGHT_BACKSPLASH: base.add_child(load("res://map/tiles/counter_straight_backsplash.tscn").instantiate()) + if top is PackedScene: + base.add_child(top.instantiate()) diff --git a/client/map/tiles/cutting_board.gd b/client/map/tiles/cutting_board.gd index 07c6d5ae..c2c54ae1 100644 --- a/client/map/tiles/cutting_board.gd +++ b/client/map/tiles/cutting_board.gd @@ -16,15 +16,14 @@ class_name CuttingBoard extends CounterBase -var board = load("res://map/tiles/cutting_board.tscn").instantiate() +var board = preload("res://map/tiles/cutting_board.tscn") var chopping: AudioStreamPlayer3D = AudioStreamPlayer3D.new() var acting_players: Array[Player] = [] func _init(ctx: TileFactory.TileCC): - super(ctx) + super(ctx, board) chopping.stream = preload("res://map/tiles/sounds/chop.ogg") add_child(chopping) - base.add_child(board) func progress(position_: float, speed: float, warn: bool, acting_players_: Array[Player]): super(position_, speed, warn, acting_players) diff --git a/client/map/tiles/deep_fryer.gd b/client/map/tiles/deep_fryer.gd index 82204cb8..229028e7 100644 --- a/client/map/tiles/deep_fryer.gd +++ b/client/map/tiles/deep_fryer.gd @@ -16,11 +16,10 @@ class_name DeepFryer extends CounterBase -var deep_fryer = load("res://map/tiles/deep_fryer.tscn").instantiate() +var deep_fryer = preload("res://map/tiles/deep_fryer.tscn") func _init(ctx: TileFactory.TileCC): - super(ctx) - base.add_child(deep_fryer) + super(ctx, deep_fryer) func set_item(i: Item): super(i) diff --git a/client/map/tiles/generic_tile.gd b/client/map/tiles/generic_tile.gd index 0a11efc6..abcb4d05 100644 --- a/client/map/tiles/generic_tile.gd +++ b/client/map/tiles/generic_tile.gd @@ -13,13 +13,9 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -class_name UnknownTile +class_name GenericTile extends Floor -func _init(ctx: TileFactory.TileCC): +func _init(ctx: TileFactory.TileCC, scene: PackedScene): super(ctx) - var label = Label3D.new() - label.text = ctx.tile_name.name - label.position.y = 0.5 - label.billboard = BaseMaterial3D.BILLBOARD_ENABLED - item_base.add_child(label) + base.add_child(scene.instantiate()) diff --git a/client/map/tiles/generic_tile.gd.uid b/client/map/tiles/generic_tile.gd.uid index 3c331921..f73a3209 100644 --- a/client/map/tiles/generic_tile.gd.uid +++ b/client/map/tiles/generic_tile.gd.uid @@ -1 +1 @@ -uid://l154vna0x8de +uid://dtq5tlmwi8gxy diff --git a/client/map/tiles/rolling_board.gd b/client/map/tiles/rolling_board.gd index b9e1f8af..ececee8b 100644 --- a/client/map/tiles/rolling_board.gd +++ b/client/map/tiles/rolling_board.gd @@ -21,11 +21,10 @@ var rolling: AudioStreamPlayer3D = AudioStreamPlayer3D.new() var acting_players: Array[Player] func _init(ctx: TileFactory.TileCC): - super(ctx) + super(ctx, board) rolling.stream = preload("res://map/tiles/sounds/roll.ogg") rolling.volume_db = -10 add_child(rolling) - base.add_child(board) func progress(position_: float, speed: float, warn: bool, acting_players_: Array[Player]): super(position_, speed, warn, acting_players_) diff --git a/client/map/tiles/unknown_tile.gd b/client/map/tiles/unknown_tile.gd new file mode 100644 index 00000000..0a11efc6 --- /dev/null +++ b/client/map/tiles/unknown_tile.gd @@ -0,0 +1,25 @@ +# 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 . +# +class_name UnknownTile +extends Floor + +func _init(ctx: TileFactory.TileCC): + super(ctx) + var label = Label3D.new() + label.text = ctx.tile_name.name + label.position.y = 0.5 + label.billboard = BaseMaterial3D.BILLBOARD_ENABLED + item_base.add_child(label) diff --git a/client/map/tiles/unknown_tile.gd.uid b/client/map/tiles/unknown_tile.gd.uid new file mode 100644 index 00000000..3c331921 --- /dev/null +++ b/client/map/tiles/unknown_tile.gd.uid @@ -0,0 +1 @@ +uid://l154vna0x8de -- cgit v1.3