diff options
-rw-r--r-- | client/map/tile_factory.gd | 2 | ||||
-rw-r--r-- | client/map/tiles/counter.gd | 22 | ||||
-rw-r--r-- | client/map/tiles/fence.gd | 33 | ||||
-rw-r--r-- | client/map/tiles/fence_corner.res | bin | 0 -> 4533 bytes | |||
-rw-r--r-- | client/map/tiles/fence_corner.tscn | 10 | ||||
-rw-r--r-- | client/map/tiles/fence_straight.res | bin | 0 -> 4243 bytes | |||
-rw-r--r-- | client/map/tiles/fence_straight.tscn | 10 | ||||
-rw-r--r-- | client/map/tiles/fence_t.res | bin | 0 -> 4858 bytes | |||
-rw-r--r-- | client/map/tiles/fence_t.tscn | 10 | ||||
-rw-r--r-- | client/map/tiles/floor.gd | 7 | ||||
-rw-r--r-- | client/map/tiles/grass.gd | 8 | ||||
-rw-r--r-- | client/map/tiles/path.gd | 7 | ||||
-rw-r--r-- | client/map/tiles/tile.gd | 9 | ||||
-rw-r--r-- | client/map/tiles/wall_tile.gd | 3 | ||||
-rw-r--r-- | data/maps/5star.yaml | 14 | ||||
-rw-r--r-- | data/maps/depot.yaml | 7 | ||||
-rw-r--r-- | data/maps/station.yaml | 11 | ||||
-rw-r--r-- | data/maps/village.yaml | 19 |
18 files changed, 127 insertions, 45 deletions
diff --git a/client/map/tile_factory.gd b/client/map/tile_factory.gd index be2b3c49..c950cd1f 100644 --- a/client/map/tile_factory.gd +++ b/client/map/tile_factory.gd @@ -60,6 +60,8 @@ static func produce(tile_name: String, node_name: String, neighbors: Array) -> T return Grass.new(node_name, neighbors) "path": return Path.new(node_name, neighbors) + "fence": + return Fence.new(node_name, neighbors) var t: push_warning("tile %s unknown" % t) return GenericTile.new(node_name, neighbors, t) diff --git a/client/map/tiles/counter.gd b/client/map/tiles/counter.gd index 62868087..d511e90d 100644 --- a/client/map/tiles/counter.gd +++ b/client/map/tiles/counter.gd @@ -1,28 +1,33 @@ # Undercooked - a game about cooking # Copyright 2024 nokoe -# +# # 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 Counter extends FullTile -const counters: Array = [ +const COUNTERS: Array = [ "counter", "pan", "sink", "oven", ] +const FLOORS: Array = [ + "floor", + "grass", +] + enum CounterKind { OUTER_CORNER, STRAIGHT, @@ -43,7 +48,7 @@ func _init(rename: String, neighbors: Array): for start in range(4): var series = 0 for i in range(4): - if neighbors[(start + i) % 4] == "floor": + if Counter.is_floor(neighbors[(start + i) % 4]): series += 1 else: break @@ -67,4 +72,7 @@ func _init(rename: String, neighbors: Array): static func is_counter(tile_name_t) -> bool: if tile_name_t == null: return false - return tile_name_t.ends_with("crate") or counters.has(tile_name_t) + return tile_name_t.ends_with("crate") or COUNTERS.has(tile_name_t) + +static func is_floor(floor_name) -> bool: + return FLOORS.has(floor_name) diff --git a/client/map/tiles/fence.gd b/client/map/tiles/fence.gd new file mode 100644 index 00000000..61383959 --- /dev/null +++ b/client/map/tiles/fence.gd @@ -0,0 +1,33 @@ +# Undercooked - a game about cooking +# Copyright 2024 nokoe +# +# 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 Fence +extends WallTile + +func _init(rename: String, neighbors: Array): + super(rename, neighbors) + match kind: + WallKind.STRAIGHT: + base.add_child(load("res://map/tiles/fence_straight.tscn").instantiate()) + WallKind.OUTER_CORNER: + base.add_child(load("res://map/tiles/fence_corner.tscn").instantiate()) + WallKind.T: + base.add_child(load("res://map/tiles/fence_t.tscn").instantiate()) + WallKind.CROSS: + push_warning("no wall cross available!") + base.add_child(load("res://map/tiles/fence_straight.tscn").instantiate()) + +func get_base_mesh(): + return preload("res://map/tiles/grass.tscn").instantiate() diff --git a/client/map/tiles/fence_corner.res b/client/map/tiles/fence_corner.res Binary files differnew file mode 100644 index 00000000..14e345a6 --- /dev/null +++ b/client/map/tiles/fence_corner.res diff --git a/client/map/tiles/fence_corner.tscn b/client/map/tiles/fence_corner.tscn new file mode 100644 index 00000000..b7b0d356 --- /dev/null +++ b/client/map/tiles/fence_corner.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://cvac5lq82xqhq"] + +[ext_resource type="ArrayMesh" uid="uid://25vo0ohcya7a" path="res://map/tiles/fence_corner.res" id="1_5aqc4"] + +[node name="FenceCorner" type="Node3D"] + +[node name="Mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(-2.18557e-06, 0, 50, 0, 50, 0, -50, 0, -2.18557e-06, 0, 0, 0) +mesh = ExtResource("1_5aqc4") +skeleton = NodePath("") diff --git a/client/map/tiles/fence_straight.res b/client/map/tiles/fence_straight.res Binary files differnew file mode 100644 index 00000000..c3975138 --- /dev/null +++ b/client/map/tiles/fence_straight.res diff --git a/client/map/tiles/fence_straight.tscn b/client/map/tiles/fence_straight.tscn new file mode 100644 index 00000000..d31af10d --- /dev/null +++ b/client/map/tiles/fence_straight.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://d0w3mrbe8w8m0"] + +[ext_resource type="ArrayMesh" uid="uid://d1jfqqjhaqsgn" path="res://map/tiles/fence_straight.res" id="1_4ta43"] + +[node name="FenceStraight" type="Node3D"] + +[node name="Mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(-2.18557e-06, 0, 50, 0, 50, 0, -50, 0, -2.18557e-06, 0, 0, 0) +mesh = ExtResource("1_4ta43") +skeleton = NodePath("") diff --git a/client/map/tiles/fence_t.res b/client/map/tiles/fence_t.res Binary files differnew file mode 100644 index 00000000..93043f7c --- /dev/null +++ b/client/map/tiles/fence_t.res diff --git a/client/map/tiles/fence_t.tscn b/client/map/tiles/fence_t.tscn new file mode 100644 index 00000000..1efb3fe8 --- /dev/null +++ b/client/map/tiles/fence_t.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://bk6ufdmbtrkkh"] + +[ext_resource type="ArrayMesh" uid="uid://b8v4k4o8cusn4" path="res://map/tiles/fence_t.res" id="1_i484t"] + +[node name="FenceT" type="Node3D"] + +[node name="Mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 0, 0) +mesh = ExtResource("1_i484t") +skeleton = NodePath("") diff --git a/client/map/tiles/floor.gd b/client/map/tiles/floor.gd index 6a158c67..37e13686 100644 --- a/client/map/tiles/floor.gd +++ b/client/map/tiles/floor.gd @@ -16,8 +16,5 @@ class_name Floor extends Tile -func _init(rename: String, _neighbors: Array): - super(rename, _neighbors) - var floor_tile = load("res://map/tiles/floor.tscn").instantiate() - floor_tile.position += Vector3(0.5, 0, 0.5) - add_child(floor_tile) +func get_base_mesh(): + return preload("res://map/tiles/floor.tscn").instantiate() diff --git a/client/map/tiles/grass.gd b/client/map/tiles/grass.gd index 15ee7603..1c0dd844 100644 --- a/client/map/tiles/grass.gd +++ b/client/map/tiles/grass.gd @@ -22,15 +22,15 @@ const GRASS_COUNT: int = 16 func _init(rename: String, _neighbors: Array): super(rename, _neighbors) - var grass_tile = preload("res://map/tiles/grass.tscn").instantiate() - grass_tile.position += Vector3(0.5, 0, 0.5) - add_child(grass_tile) var random = RandomNumberGenerator.new() random.seed = rename.hash() for _i in Global.get_setting("grass_amount"): var g: Node3D = GRASS_SIDE.instantiate() - grass_tile.add_child(g) + base_mesh.add_child(g) g.position = Vector3(random.randf_range(-.5, .5), 0, random.randf_range(-.5, .5)) g.rotation = Vector3(0, random.randf_range(0, PI), 0) + +func get_base_mesh(): + return preload("res://map/tiles/grass.tscn").instantiate() diff --git a/client/map/tiles/path.gd b/client/map/tiles/path.gd index 76c49b64..02240632 100644 --- a/client/map/tiles/path.gd +++ b/client/map/tiles/path.gd @@ -16,8 +16,5 @@ class_name Path extends Tile -func _init(rename: String, _neighbors: Array): - super(rename, _neighbors) - var path_tile = preload("res://map/tiles/path.tscn").instantiate() - path_tile.position += Vector3(0.5, 0, 0.5) - add_child(path_tile) +func get_base_mesh(): + return preload("res://map/tiles/path.tscn").instantiate() diff --git a/client/map/tiles/tile.gd b/client/map/tiles/tile.gd index 6a73c596..38e425f0 100644 --- a/client/map/tiles/tile.gd +++ b/client/map/tiles/tile.gd @@ -17,6 +17,7 @@ class_name Tile extends Node3D var base = Node3D.new() +var base_mesh var item: Item = null var item_base: Node3D @@ -39,6 +40,11 @@ func _init(rename: String, _neighbors: Array): 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 + m.position += Vector3(0.5, 0, 0.5) + add_child(m) func turn_facing(facing: Facing): base.rotation.y = facing * 0.5 * PI + PI @@ -80,3 +86,6 @@ func take_item() -> Item: var i = item item = null return i + +func get_base_mesh(): + return null diff --git a/client/map/tiles/wall_tile.gd b/client/map/tiles/wall_tile.gd index b876990e..ae3ac9e1 100644 --- a/client/map/tiles/wall_tile.gd +++ b/client/map/tiles/wall_tile.gd @@ -20,7 +20,8 @@ const WALLS: Array = [ "wall", "wall-window", "counter-window", - "door" + "door", + "fence" ] enum WallKind { diff --git a/data/maps/5star.yaml b/data/maps/5star.yaml index d8101115..5ef9c931 100644 --- a/data/maps/5star.yaml +++ b/data/maps/5star.yaml @@ -1,11 +1,11 @@ map: - "''''''''''''''''''''''''████████████████████''''''''''''" - - "'''██▒███▒███▒███▒███▒███#LRTF#LRTF#pppppp#█''''''''''''" - - "'''█ctc.ctc.ctc.ctc..c..█..................d____________" - - "'''█.c...c...c...c..ctc.█..#pppp#fff#CCC..o█X_''''''''''" - - "'''█c...................d...........#.....o█X_''''''''''" - - "'''▒tc..............ctc.█#................o█X_''''''''''" - - "'''█c...c....c.......c..█.pppsss....SSSSSS#█''''''''''''" + - "'''██▒███▒███▒███▒███▒███#LRTF#LRTF#pppppp#█======''''''" + - "'''█ctc.ctc.ctc.ctc..c..█..................d__'*'=''''''" + - "'''█.c...c...c...c..ctc.█..#pppp#fff#CCC..o█X_'''=''''''" + - "'''█c...................d...........#.....o█X_'''=''''''" + - "'''▒tc..............ctc.█#................o█X_''*=''''''" + - "'''█c...c....c.......c..█.pppsss....SSSSSS#█'*'''=''''''" - "'''█...ctc..ctc...███████████████dd███████████████''''''" - "'''█c..ctc..ctc...█...ccccccc..█....█..ccccccc...█''''''" - "'''▒tc.ctc..ctc...█...ttttttt..█....█..ttttttt...▒''''''" @@ -57,6 +57,8 @@ tiles: "d": door "█": wall "▒": wall-window + "=": fence + items: "S": pot diff --git a/data/maps/depot.yaml b/data/maps/depot.yaml index 499966f6..67122dd3 100644 --- a/data/maps/depot.yaml +++ b/data/maps/depot.yaml @@ -5,9 +5,9 @@ map: - "''▒.ctc.tttt....#█#............#█''''''''''''''" - "''▒.ctc.cccc.....d....#...>v<..#█''''''''''''''" - "''▒.ctc.........#█X...^....v...#█''''''''''''''" - - "''▒.ctc.........#█#...^...>v<..#█''''''''''''''" - - "''█..............█#...^....v...#█X_''''''''''''" - - "''▒.ctc......ctc.█#...^...>v<..#█X_''''''''''''" + - "''▒.ctc.........#█#...^...>v<..#█========''''''" + - "''█..............█#...^....v...#█X_'''''=''''''" + - "''▒.ctc......ctc.█#...^...>v<..#█X_'''''=''''''" - "''▒.ctc......ctc.█#...^....v...#█X_________''''" - "''▒.ctc......ctc.█████^████v██████d██████'_''''" - "''▒.ctc......ctc.█#...^....v.CCCC...FF.L█'_''''" @@ -55,6 +55,7 @@ tiles: "d": door "█": wall "▒": wall-window + "=": fence tile_entities: ">": !conveyor { dir: [1, 0] } diff --git a/data/maps/station.yaml b/data/maps/station.yaml index 70d76157..880dd3fb 100644 --- a/data/maps/station.yaml +++ b/data/maps/station.yaml @@ -1,11 +1,11 @@ map: - "''''''''''''''''''''''''" - "''''███████████████'''''" - - "_~__d.ct.w.ss█#ff#█'''''" - - "_!__d.ct.w...d...o█X_'''" - - "''X'█.ct.█████.p.o█X_'''" - - "''''█.ct.....w.p.o█X_'''" - - "''''█.ct.....w.p..d__'''" + - "_~__d.ct.w.ss█#ff#█===='" + - "_!__d.ct.w...d...o█X_*='" + - "''X'█.ct.█████.p.o█X_'='" + - "''''█.ct.....w.p.o█X_'='" + - "''''█.ct.....w.p..d__'='" - "''''█.ct.....w.p.S██d██'" - "''''█.ct.....█.p.S█L.T█'" - "''''█.ct.....d...S█R.F█'" @@ -51,6 +51,7 @@ tiles: "d": door "█": wall "▒": wall-window + "=": fence items: "S": pot diff --git a/data/maps/village.yaml b/data/maps/village.yaml index 2319f3ee..9975e22b 100644 --- a/data/maps/village.yaml +++ b/data/maps/village.yaml @@ -10,15 +10,15 @@ map: - "'''█..d_d..█__█..d_d.p█'''" - "'''█LR█'█FT█__█ss█'█pp█'''" - "'''████'████__████'████'''" - - "''''ctc'ctc'__'ctc'ctc''''" - - "''''ctc'ctc'__'ctc'ctc''''" - - "'''''________________'''''" - - "''''ctc'ctc'__'ctc'ctc''''" - - "''''ctc'ctc'__'ctc'ctc''''" - - "'''''________________'''''" - - "''''ctc'ctc'__'ctc'ctc''''" - - "''''ctc'ctc'__'ctc'ctc''''" - - "''''''''''''__''''''''''''" + - "'''=ctc'ctc'__'ctc'ctc='''" + - "'''=ctc'ctc'__'ctc'ctc='''" + - "'''='________________'='''" + - "'''=ctc'ctc'__'ctc'ctc='''" + - "'''=ctc'ctc'__'ctc'ctc='''" + - "'''='________________'='''" + - "'''=ctc'ctc'__'ctc'ctc='''" + - "'''=ctc'ctc'__'ctc'ctc='''" + - "'''=========__========='''" - "''''''''''''_!''''''''''''" tiles: @@ -51,6 +51,7 @@ tiles: "d": door "█": wall "▒": wall-window + "=": fence items: "S": pot |