aboutsummaryrefslogtreecommitdiff
path: root/client/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'client/scripts')
-rw-r--r--client/scripts/character.gd28
-rw-r--r--client/scripts/controllable_player.gd110
-rw-r--r--client/scripts/credits_menu.gd19
-rw-r--r--client/scripts/follow_camera.gd65
-rw-r--r--client/scripts/game.gd110
-rw-r--r--client/scripts/item.gd56
-rw-r--r--client/scripts/main_menu.gd49
-rw-r--r--client/scripts/map.gd77
-rw-r--r--client/scripts/marker.gd23
-rw-r--r--client/scripts/menu_background.gd35
-rw-r--r--client/scripts/mirror.gd31
-rw-r--r--client/scripts/multiplayer.gd205
-rw-r--r--client/scripts/player.gd81
-rw-r--r--client/scripts/progress.gd22
-rw-r--r--client/scripts/scene_transition.gd28
-rw-r--r--client/scripts/socket_test.gd22
-rw-r--r--client/scripts/tiles/chair.gd28
-rw-r--r--client/scripts/tiles/counter.gd81
-rw-r--r--client/scripts/tiles/counter_base.gd27
-rw-r--r--client/scripts/tiles/crate.gd23
-rw-r--r--client/scripts/tiles/cutting_board.gd21
-rw-r--r--client/scripts/tiles/door.gd27
-rw-r--r--client/scripts/tiles/floor.gd85
-rw-r--r--client/scripts/tiles/flour_counter.gd26
-rw-r--r--client/scripts/tiles/full_tile.gd49
-rw-r--r--client/scripts/tiles/generic_tile.gd33
-rw-r--r--client/scripts/tiles/oven.gd21
-rw-r--r--client/scripts/tiles/raw_steak_crate.gd21
-rw-r--r--client/scripts/tiles/sink.gd27
-rw-r--r--client/scripts/tiles/stove.gd21
-rw-r--r--client/scripts/tiles/table.gd21
-rw-r--r--client/scripts/tiles/tomato_crate.gd21
-rw-r--r--client/scripts/tiles/trash.gd21
-rw-r--r--client/scripts/tiles/wall.gd29
-rw-r--r--client/scripts/tiles/wall_tile.gd74
-rw-r--r--client/scripts/tiles/window.gd29
36 files changed, 0 insertions, 1646 deletions
diff --git a/client/scripts/character.gd b/client/scripts/character.gd
deleted file mode 100644
index 847bd7b6..00000000
--- a/client/scripts/character.gd
+++ /dev/null
@@ -1,28 +0,0 @@
-# Undercooked - 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/>.
-#
-extends Node3D
-class_name Character
-
-@onready var hand_animations = $HandAnimations
-
-func _ready():
- play_animation("idle")
-
-func play_animation(name_: String):
- hand_animations.play(name_)
-
-func _on_hand_animations_animation_finished(name_):
- hand_animations.play(name_)
diff --git a/client/scripts/controllable_player.gd b/client/scripts/controllable_player.gd
deleted file mode 100644
index 4c157349..00000000
--- a/client/scripts/controllable_player.gd
+++ /dev/null
@@ -1,110 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 nokoe
-# Copyright 2024 metamuffin
-#
-# 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 ControllablePlayer
-extends Player
-
-
-const PLAYER_SPEED: float = 25.;
-
-var facing = Vector2(1, 0)
-var velocity_ = Vector2(0, 0)
-
-var target: Vector2i = Vector2i(0, 0)
-
-func _ready():
- var timer = Timer.new()
- timer.one_shot = false
- timer.wait_time = 1. / 25.
- add_child(timer)
- timer.start()
- timer.connect("timeout", func():
- Multiplayer.send_position(Vector2(position.x, position.z), rotation.y)
- )
-
-func _process(delta):
- var input = Vector2(Input.get_axis("left", "right"), Input.get_axis("forward", "backwards")).normalized()
- input = input.rotated(-game.camera.angle_target)
- position_anim = position_
- rotation_anim = rotation_
- if Input.is_action_pressed("interact") or Input.is_action_just_released("interact"):
- input *= 0
- else:
- target = Vector2i(
- int(floor(position.x + sin(rotation.y))),
- int(floor(position.z + cos(rotation.y)))
- )
- interact()
- update(delta, input)
- super(delta)
-
-func update(dt: float, input: Vector2):
- var direction = input.limit_length(1.);
- rotation.y = atan2(self.facing.x, self.facing.y);
- if direction.length() > 0.1:
- self.facing = direction + (self.facing - direction) * exp(-dt * 10.);
- self.velocity_ += direction * dt * PLAYER_SPEED;
- self.position_ += self.velocity_ * dt;
- self.velocity_ = self.velocity_ * exp(-dt * 5.);
- collide(dt);
-
-func collide(dt: float):
- for xo in range(-1,2):
- for yo in range(-1,2):
- var tile = Vector2i(xo, yo) + Vector2i(self.position_);
- if !Multiplayer.get_tile_collision(tile): continue
- tile = Vector2(tile)
- var d = aabb_point_distance(tile, tile + Vector2.ONE, self.position_);
- if d > PLAYER_SIZE: continue
- var h = 0.01;
- var d_sample_x = aabb_point_distance(tile, tile + Vector2.ONE, self.position_ + Vector2(h, 0));
- var d_sample_y = aabb_point_distance(tile, tile + Vector2.ONE, self.position_ + Vector2(0, h));
- var grad = (Vector2(d_sample_x - d, d_sample_y - d)) / h;
-
- self.position_ += (PLAYER_SIZE - d) * grad;
- self.velocity_ -= grad * grad.dot(self.velocity_)
-
- for player: Player in game.players.values():
- var diff = self.position_ - player.position_
- var d = diff.length()
- if d < 0.01: continue
- if d >= PLAYER_SIZE * 2: continue
- var norm = diff.normalized();
- var f = 100 / (1 + d)
- self.velocity_.x += norm.x * f * dt
- self.velocity_.y += norm.y * f * dt
-
-func aabb_point_distance(mi: Vector2, ma: Vector2, p: Vector2) -> float:
- return (p - p.clamp(mi, ma)).length()
-
-func update_position(new_position: Vector2, _new_rotation: float):
- if (new_position - position_).length() > 3.:
- position_ = new_position
-
-func interact():
- var tile_idx = str(target)
- var t: Floor = game.map.tile_by_pos.get(tile_idx)
- if t != null:
- game.marker.set_interactive(Multiplayer.get_tile_interactive(target))
- game.marker.visible = true
- game.marker_target = t.item_base.global_position
- if Input.is_action_just_pressed("interact"):
- Multiplayer.send_interact(target, true)
- t.interact()
- elif Input.is_action_just_released("interact"):
- Multiplayer.send_interact(target, false)
- else:
- game.marker.visible = false
diff --git a/client/scripts/credits_menu.gd b/client/scripts/credits_menu.gd
deleted file mode 100644
index a48d5461..00000000
--- a/client/scripts/credits_menu.gd
+++ /dev/null
@@ -1,19 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 metamuffin
-#
-# 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/>.
-#
-extends Control
-
-func _on_back_pressed():
- $SceneTransition.transition_to("res://scenes/main_menu.tscn")
diff --git a/client/scripts/follow_camera.gd b/client/scripts/follow_camera.gd
deleted file mode 100644
index 74355688..00000000
--- a/client/scripts/follow_camera.gd
+++ /dev/null
@@ -1,65 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 nokoe
-# Copyright 2024 metamuffin
-#
-# 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 FollowCamera
-extends Camera3D
-
-const ROTATE_SPEED: float = 1.5
-const ROTATE_WEIGHT: float = 8.0
-const ROTATE_UP_SPEED: float = 0.7
-const ROTATE_UP_WEIGHT: float = 4.0
-const ANGLE_UP_MIN: float = 0.5
-const ANGLE_UP_MAX: float = 1.2
-const LOOK_WEIGHT: float = 8.0
-const MOVE_WEIGHT: float = 2.0
-const CAMERA_DISTANCE: float = 10
-
-@export var target: Node3D
-
-var angle_target: float = 0
-var angle: float = 0
-var angle_up_target: float = 1
-var angle_up: float = 1
-var ground: Vector3
-
-func _ready():
- if target == null:
- push_warning("target is not set")
- else:
- ground = target.position
-
-func _process(delta):
- if target != null:
- follow(delta)
-
-func follow(delta):
- var new_transform = transform.looking_at(target.position)
-
- transform.basis = Basis.from_euler(Vector3(
- lerp_angle(transform.basis.get_euler().x, new_transform.basis.get_euler().x, delta * LOOK_WEIGHT),
- lerp_angle(transform.basis.get_euler().y, new_transform.basis.get_euler().y, delta * LOOK_WEIGHT),
- lerp_angle(transform.basis.get_euler().z, new_transform.basis.get_euler().z, delta * LOOK_WEIGHT)
- ))
-
- angle_target += Input.get_axis("rotate_left", "rotate_right") * ROTATE_SPEED * delta
- angle = lerp_angle(angle, angle_target, delta * ROTATE_WEIGHT)
-
- angle_up_target += Input.get_axis("rotate_down", "rotate_up") * ROTATE_UP_SPEED * delta
- angle_up_target = clamp(angle_up_target, ANGLE_UP_MIN, ANGLE_UP_MAX)
- angle_up = lerp_angle(angle_up, angle_up_target, delta * ROTATE_UP_WEIGHT)
-
- ground = ground.lerp(target.position, delta * MOVE_WEIGHT)
- position = ground + Vector3(0, sin(angle_up) * CAMERA_DISTANCE, cos(angle_up) * CAMERA_DISTANCE).rotated(Vector3.UP, angle)
diff --git a/client/scripts/game.gd b/client/scripts/game.gd
deleted file mode 100644
index eb338eaa..00000000
--- a/client/scripts/game.gd
+++ /dev/null
@@ -1,110 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 nokoe
-# Copyright 2024 metamuffin
-#
-# 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 Game
-extends Node3D
-
-@onready var camera: FollowCamera = $FollowCamera
-@onready var map: Map = $Map
-@onready var marker: Marker = $Marker
-var marker_target = Vector3(0,0,0)
-
-var players := {}
-# Called when the node enters the scene tree for the first time.
-func _ready():
- await Multiplayer.init
- if Multiplayer.player_id == -1:
- push_error("multiplayer has not been initialized")
- Multiplayer.connect("add_player",
- func(player: int, player_name: String, pos: Vector2, character: int):
- var player_instance: Player
- if player == Multiplayer.player_id:
- player_instance = ControllablePlayer.new(player, player_name, pos, character, self)
- camera.target = player_instance
- else:
- player_instance = Player.new(player, player_name, pos, character, self)
- players[player] = player_instance
- add_child(player_instance)
- )
-
- Multiplayer.connect("position",
- func(player: int, pos: Vector2, rot: float):
- var player_instance: Player = players[player]
- player_instance.update_position(pos, rot)
- )
-
- Multiplayer.connect("remove_player", func(id: int):
- var player: Player = players.get(id)
- if player != null:
- if player.hand != null:
- player.hand.queue_free()
- players.erase(id)
- player.queue_free()
- )
-
- Multiplayer.connect("set_tile_item", func(tile: Vector2i, item: int):
- var t: Floor = map.tile_by_pos[str(tile)]
- var i = Item.new(item, t.item_base)
- add_child(i)
- i.name = Multiplayer.item_names[item]
- t.set_item(i)
- )
-
- Multiplayer.connect("remove_tile_item", func(tile: Vector2i):
- var t: Floor = map.tile_by_pos[str(tile)]
- t.take_item().queue_free()
- )
-
- Multiplayer.connect("set_player_item", func(player: int, item: int):
- var p: Player = players[player]
- var i = Item.new(item, p.hand_base)
- add_child(i)
- i.name = Multiplayer.item_names[item]
- p.set_item(i)
- )
-
- Multiplayer.connect("remove_player_item", func(player: int):
- var p: Player = players[player]
- p.remove_item().queue_free()
- )
-
- Multiplayer.connect("take_item", func(tile: Vector2i, player: int):
- var t: Floor = map.tile_by_pos[str(tile)]
- var p: Player = players[player]
- p.take_item(t)
- )
-
- Multiplayer.connect("put_item", func(tile: Vector2i, player: int):
- var t: FullTile = map.tile_by_pos[str(tile)]
- var p: Player = players[player]
- p.put_item(t)
- )
-
- Multiplayer.connect("set_progress", func(tile: Vector2i, progress: float, warn: bool):
- var t: FullTile = map.tile_by_pos[str(tile)]
- t.progress(progress, warn)
- )
-
- Multiplayer.connect("set_finished", func(tile: Vector2i, warn: bool):
- var t: FullTile = map.tile_by_pos[str(tile)]
- t.finish(warn)
- )
-
- Multiplayer.send_join("Blub", 1)
-
-
-func _process(delta):
- marker.position = lerp(marker.position, marker_target, delta * 40.0)
diff --git a/client/scripts/item.gd b/client/scripts/item.gd
deleted file mode 100644
index 74e08c48..00000000
--- a/client/scripts/item.gd
+++ /dev/null
@@ -1,56 +0,0 @@
-# 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 Item
-extends Node3D
-
-var owned_by: Node3D
-
-var progress_instance: ProgressBar3D = preload("res://scenes/progress.tscn").instantiate()
-
-func _init(idx: int, owned_by_: Node3D):
- progress_instance.position.y = 2.
- add_child(progress_instance)
- progress_instance.visible = false
- match Multiplayer.item_names[idx]:
- var t:
- add_child(load("res://models/prefabs/map/bag.tscn").instantiate())
- var mesh = MeshInstance3D.new()
- var text = TextMesh.new()
- var mat = StandardMaterial3D.new()
- text.text = t
- text.font = SystemFont.new()
- text.depth = 0
- mesh.mesh = text
- mesh.position.y = 0.5
- mesh.scale = Vector3(3, 3, 3)
- mat.billboard_mode = mat.BILLBOARD_ENABLED
- mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
- text.material = mat
- add_child(mesh)
- owned_by = owned_by_
-
-func _ready():
- position = owned_by.global_position
-
-func _process(delta):
- position = lerp(position, owned_by.global_position, delta * 30.0)
-
-func progress(p: float, warn: bool):
- progress_instance.visible = true
- progress_instance.set_progress(p, warn)
-
-func finish(_warn: bool):
- progress_instance.visible = false
diff --git a/client/scripts/main_menu.gd b/client/scripts/main_menu.gd
deleted file mode 100644
index df09cf7f..00000000
--- a/client/scripts/main_menu.gd
+++ /dev/null
@@ -1,49 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 metamuffin
-# 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/>.
-#
-extends Control
-
-@onready var quick_connect = $side/margin/options/quick_connect
-@onready var quit_button = $side/margin/options/quit
-
-func _ready():
- quick_connect.grab_focus()
- if OS.has_feature("web"):
- quit_button.hide()
-
-func _on_quit_pressed():
- get_tree().quit()
-
-func _on_credits_pressed():
- $SceneTransition.transition_to("res://scenes/credits_menu.tscn")
-
-func _on_connect_pressed():
- connect_to($side/options/connect/uri.text)
-
-func _on_quick_connect_pressed():
- if OS.has_feature("JavaScript"):
- connect_to(JavaScriptBridge.eval("""
- window.location.protocol.endsWith("s:")
- ? `wss://${window.location.host}/`
- : `ws://${window.location.hostname}:27032/`
- """))
- else:
- connect_to("wss://undercooked.metamuffin.org/")
-
-func connect_to(url):
- print("Connecting to %s" % url)
- Multiplayer.url = url
- $SceneTransition.transition_to("res://scenes/game.tscn")
diff --git a/client/scripts/map.gd b/client/scripts/map.gd
deleted file mode 100644
index b5e519a6..00000000
--- a/client/scripts/map.gd
+++ /dev/null
@@ -1,77 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 nokoe
-# Copyright 2024 tpart
-# Copyright 2024 metamuffin
-#
-# 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/>.
-#
-@tool
-class_name Map
-extends Node3D
-
-var tile_by_pos: Dictionary = {}
-
-func _ready():
- Multiplayer.connect("update_map", update)
-
-func update(pos, tile_name, neighbors):
- var instance: Floor
- var node_name = str(pos)
-
- if has_node(node_name):
- queue_free_rename(get_node(node_name))
-
- match tile_name:
- "trash":
- instance = Trash.new(node_name, neighbors)
- "tomato-crate":
- instance = TomatoCrate.new(node_name, neighbors)
- "cuttingboard":
- instance = CuttingBoard.new(node_name, neighbors)
- "counter":
- instance = CounterBase.new(node_name, neighbors)
- "flour-crate":
- instance = FlourCounter.new(node_name, neighbors)
- "oven":
- instance = Oven.new(node_name, neighbors)
- "raw-steak-crate":
- instance = RawSteakCrate.new(node_name, neighbors)
- "stove":
- instance = Stove.new(node_name, neighbors)
- "sink":
- instance = Sink.new(node_name, neighbors)
- "dirty-plate-crate":
- instance = CounterBase.new(node_name, neighbors)
- "wall":
- instance = Wall.new(node_name, neighbors)
- "chair":
- instance = Chair.new(node_name, neighbors)
- "table":
- instance = Table.new(node_name, neighbors)
- "floor":
- instance = Floor.new(node_name, neighbors)
- "window":
- instance = WallWindow.new(node_name, neighbors)
- "door":
- instance = Door.new(node_name, neighbors)
- var t:
- push_warning("tile tile %s unknown" % t)
- instance = GenericTile.new(node_name, neighbors, t)
-
- instance.position = Vector3(pos[0], 0, pos[1])
- tile_by_pos[str(Vector2i(pos[0],pos[1]))] = instance
- add_child(instance)
-
-func queue_free_rename(node: Node) -> void:
- node.name += "_queued_free"
- node.queue_free()
diff --git a/client/scripts/marker.gd b/client/scripts/marker.gd
deleted file mode 100644
index 6e3e6ffa..00000000
--- a/client/scripts/marker.gd
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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 Marker
-extends Node3D
-
-@onready var _cube: MeshInstance3D = $Cube
-
-func set_interactive(val: bool):
- var mat: ShaderMaterial = _cube.get_active_material(0)
- mat.set_shader_parameter("interactive", val)
diff --git a/client/scripts/menu_background.gd b/client/scripts/menu_background.gd
deleted file mode 100644
index e5b8ac31..00000000
--- a/client/scripts/menu_background.gd
+++ /dev/null
@@ -1,35 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 metamuffin
-# 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/>.
-#
-@tool
-extends Node3D
-
-@onready var map = $map
-@onready var voxel_gi: VoxelGI = $VoxelGI
-
-const NULLS = [null,null,null,null]
-const BUCKETS = [[], ["floor","floor","floor","floor","tomato-crate", "raw-steak-crate"], ["table", "chair", "counter"], ["sink", "stove"]]
-
-func _ready():
- for x in range(-10,11):
- for y in range(-10,11):
- var w = exp(-sqrt(x*x+y*y) * 0.15)
- var k = randf() * w
- var bucket = BUCKETS[int(floor(k * BUCKETS.size())) % BUCKETS.size()]
- if bucket.size() == 0: continue
- var tile = bucket[randi() % bucket.size()]
- map.update([x,y], tile, NULLS)
- voxel_gi.bake()
diff --git a/client/scripts/mirror.gd b/client/scripts/mirror.gd
deleted file mode 100644
index ccec0e65..00000000
--- a/client/scripts/mirror.gd
+++ /dev/null
@@ -1,31 +0,0 @@
-# Undercooked - 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/>.
-#
-@tool
-
-# Hand mirror helper script, useful for animating characters
-
-extends Node3D
-
-@export var enabled := true
-
-@onready var hand_right = $Main/HandRight
-@onready var hand_left = $Main/HandLeft
-
-
-func _process(delta):
- if enabled:
- hand_right.position = hand_left.position * Vector3(-1,1,1)
- hand_right.rotation = hand_left.rotation * Vector3(1, -1, -1) - Vector3(0.2 * PI, 0, 0)
diff --git a/client/scripts/multiplayer.gd b/client/scripts/multiplayer.gd
deleted file mode 100644
index 534ef663..00000000
--- a/client/scripts/multiplayer.gd
+++ /dev/null
@@ -1,205 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 nokoe
-# Copyright 2024 metamuffin
-# 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/>.
-#
-extends Node
-
-signal init(player_id: int)
-signal update_map(tile: int, pos: Array, neighbors: Array)
-signal clear_message(player: int)
-signal text_message(player: int, text: String)
-signal item_message(player: int, item: int)
-signal add_player(player: int, name: String, pos: Vector2, character: int)
-signal remove_player(player: int)
-signal position(player: int, position: Vector2, rotation: float)
-signal take_item(tile: Vector2i, player: int)
-signal put_item(tile: Vector2i, player: int)
-signal set_tile_item(tile: Vector2i, item: int)
-signal remove_tile_item(tile: Vector2i)
-signal set_progress(tile: Vector2i, progress: float, warn: bool)
-signal set_finished(tile: Vector2i, warn: bool)
-
-var connected := false
-var socket := WebSocketPeer.new()
-
-var item_names = []
-var tile_names = []
-var tile_collide = []
-var tile_interact = []
-var item_idx_from_name: Dictionary = {}
-var player_id = -1
-
-var tileid_by_pos: Dictionary = {}
-
-func connectClient(url: String):
- socket.connect_to_url(url)
- connected = true
-
-func _process(_delta):
- if connected:
- socket.poll()
- var state = socket.get_ready_state()
- if state == WebSocketPeer.STATE_OPEN:
- while socket.get_available_packet_count():
- handle_packet(socket.get_packet())
- elif state == WebSocketPeer.STATE_CONNECTING:
- print("connecting")
- elif state == WebSocketPeer.STATE_CLOSING:
- # Keep polling to achieve proper close.
- print("closing")
- pass
- elif state == WebSocketPeer.STATE_CLOSED:
- var code = socket.get_close_code()
- var reason = socket.get_close_reason()
- print("WebSocket closed with code: %d, reason %s. Clean: %s" % [code, reason, code != - 1])
-
-func handle_packet(bytes: PackedByteArray):
- var decoded = decode_packet(bytes)
-
- if decoded == null:
- return
-
- var packet_type: String = decoded["type"]
- match packet_type:
- "init":
- player_id = decoded["id"]
- item_names = decoded["data"]["item_names"]
- tile_names = decoded["data"]["tile_names"]
- tile_collide = decoded["data"]["tile_collide"]
- tile_interact = decoded["data"]["tile_interact"]
- for i in range(item_names.size()):
- item_idx_from_name[item_names[i]] = i
- emit_signal("init", player_id)
- "add_player":
- var id = decoded["id"]
- var player_name = decoded["name"]
- var pos = decoded["position"]
- var character = decoded["character"]
- emit_signal("add_player", id, player_name, pos_to_vec2(pos), character)
- "remove_player":
- var id = decoded["id"]
- emit_signal("remove_player", id)
- "position":
- var player = decoded["player"]
- var pos = decoded["pos"]
- var rot = decoded["rot"]
- emit_signal("position", player, pos_to_vec2(pos), rot)
- "take_item":
- var tile = pos_to_vec2i(decoded["tile"])
- var player = decoded["player"]
- emit_signal("take_item", tile, player)
- "put_item":
- var tile = pos_to_vec2i(decoded["tile"])
- var player_id = decoded["player"]
- emit_signal("take_item", tile, player_id)
- "set_active":
- var tile = pos_to_vec2i(decoded["tile"])
- var warn = decoded["warn"]
- var progress = decoded.get("progress")
- if progress != null:
- emit_signal("set_progress", tile, decoded["progress"], warn)
- else:
- emit_signal("set_finished", tile, warn)
- "set_tile_item":
- var tile = pos_to_vec2i(decoded["tile"])
- var item = decoded.get("item")
- if item != null:
- emit_signal("set_tile_item", tile, item)
- else:
- emit_signal("remove_tile_item", tile)
- "set_player_item":
- var player = decoded["player"]
- var item = decoded.get("item")
- if item != null:
- emit_signal("set_player_item", player, decoded["item"])
- else:
- emit_signal("remove_player_item", player)
- "update_map":
- var tile: int = decoded["tile"]
- var pos: Array = decoded["pos"]
- var neighbors: Array = decoded["neighbors"]
- tileid_by_pos[str(Vector2i(pos[0],pos[1]))] = tile
- emit_signal("update_map", pos, tile_names[tile], neighbors)
- "communicate":
- var player = decoded["player"]
- var message = decoded.get("message")
- if message != null:
- var item = message.get("item")
- var text = message.get("text")
- if item != null:
- emit_signal("item_message", player, item)
- elif text != null:
- emit_signal("text_message", player, text)
- else:
- push_error("neither text nor item provided")
- else:
- emit_signal("clear_message", player)
- "error":
- var message = decoded["message"]
- push_warning("server error: %s" % message)
- _:
- push_error("Unrecognized packet type: %s" % packet_type)
-
-func send_join(player_name: String, character: int):
- send_packet({
- "type": "join",
- "name": player_name,
- "character": character
- })
-
-func send_position(pos: Vector2, rotation: float):
- send_packet({
- "type": "position",
- "pos": [pos.x, pos.y],
- "rot": rotation
- })
-
-func send_interact(pos: Vector2i, edge: bool):
- send_packet({
- "type": "interact",
- "pos": [pos.x, pos.y],
- "edge": edge
- })
-
-func send_packet(packet):
- var json = JSON.stringify(packet)
- socket.send_text(json)
-
-func decode_packet(bytes: PackedByteArray):
- var json = JSON.new()
- var in_str = bytes.get_string_from_utf8()
- var error = json.parse(in_str)
- if error == OK:
- return json.data
- else:
- print("Decode of packet failed: %s in %s" % [json.get_error_message(), in_str])
- return null
-
-func pos_to_vec2(pos: Array) -> Vector2:
- return Vector2(pos[0], pos[1])
-
-func pos_to_vec2i(pos: Array) -> Vector2i:
- return Vector2i(pos[0], pos[1])
-
-func get_tile_collision(pos: Vector2i) -> bool:
- var t = tileid_by_pos.get(str(pos))
- if t == null: return false
- else: return tile_collide[t]
-
-func get_tile_interactive(pos: Vector2i) -> bool:
- var t = tileid_by_pos.get(str(pos))
- if t == null: return false
- else: return tile_interact[t]
diff --git a/client/scripts/player.gd b/client/scripts/player.gd
deleted file mode 100644
index 423855e9..00000000
--- a/client/scripts/player.gd
+++ /dev/null
@@ -1,81 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 nokoe
-# Copyright 2024 metamuffin
-# 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 Player
-extends Node3D
-
-const PLAYER_SIZE: float = 0.4
-const SPEED: float = 25.
-
-var game: Game
-var position_ = Vector2(0, 0)
-
-var mesh = preload("res://scenes/player.tscn").instantiate()
-
-var hand: Node3D = null
-
-var _anim_angle: float = 0.0
-
-const HAND_BASE_POSITION: Vector3 = Vector3(0, .25, .4)
-
-@onready var character: Character = $Player/Character
-
-func _init(_id: int, new_name: String, pos: Vector2, _character: int, new_game: Game):
- add_child(mesh)
- position_ = pos
- name = new_name
- game = new_game
-
-func update_position(new_position: Vector2, new_rotation: float):
- position_ = new_position
- rotation_ = new_rotation
-
-func set_item(i: Item):
- i.owned_by = hand_base
- if i == null:
- push_error("tile is null")
- hand = i
- character.play_animation("hold")
-
-func remove_item() -> Item:
- var i = hand
- if i == null:
- push_error("holding nothing")
- hand = null
- character.play_animation("idle")
- return i
-
-func take_item(tile: Floor):
- if hand != null:
- push_error("already holding an item")
- var i = tile.take_item()
- if i == null:
- push_error("tile is null")
- hand = i
-
-func put_item(tile: Floor):
- var i = remove_item()
- tile.put_item(i)
-
-func _process(delta):
- _anim_angle = fmod(_anim_angle + delta, TAU)
- hand_base.position.y = HAND_BASE_POSITION.y + 0.05 * sin(_anim_angle * 3)
- position_anim = lerp(position_anim, position_, delta * 10)
- rotation_anim = lerp_angle(rotation_anim, rotation_, delta * 10)
- position.x = position_anim.x
- position.z = position_anim.y
- rotation.y = rotation_anim
diff --git a/client/scripts/progress.gd b/client/scripts/progress.gd
deleted file mode 100644
index 4d6494f6..00000000
--- a/client/scripts/progress.gd
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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 ProgressBar3D
-extends MeshInstance3D
-
-func set_progress(progress: float, bad: bool):
- var mat: ShaderMaterial = self.get_active_material(0)
- mat.set_shader_parameter("progress", progress)
- mat.set_shader_parameter("bad", bad)
diff --git a/client/scripts/scene_transition.gd b/client/scripts/scene_transition.gd
deleted file mode 100644
index b5c89579..00000000
--- a/client/scripts/scene_transition.gd
+++ /dev/null
@@ -1,28 +0,0 @@
-# Undercooked - a game about cooking
-# Copyright 2024 metamuffin
-#
-# 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 SceneTransition
-extends ColorRect
-
-
-@onready var anim = $animation
-
-func _ready():
- anim.play("fade_in")
-
-func transition_to(path: String):
- anim.play("fade_out")
- await anim.animation_finished
- get_tree().change_scene_to_file(path)
diff --git a/client/scripts/socket_test.gd b/client/scripts/socket_test.gd
deleted file mode 100644
index 853dd981..00000000
--- a/client/scripts/socket_test.gd
+++ /dev/null
@@ -1,22 +0,0 @@
-# Undercooked - 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/>.
-#
-extends Control
-
-@onready var address = $VBoxContainer/LineEdit
-
-func _on_button_pressed():
- Multiplayer.connectClient(address.text)
- get_tree().change_scene_to_file("res://scenes/game.tscn")
diff --git a/client/scripts/tiles/chair.gd b/client/scripts/tiles/chair.gd
deleted file mode 100644
index 34735fda..00000000
--- a/client/scripts/tiles/chair.gd
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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 Chair
-extends Floor
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- var chair = load("res://models/prefabs/map/chair_A.tscn").instantiate()
- var facing = 0;
- for i in range(4):
- if tile_name(neighbors[i]) == "table":
- facing = i
- break
- base.add_child(chair)
- turn_facing(facing)
diff --git a/client/scripts/tiles/counter.gd b/client/scripts/tiles/counter.gd
deleted file mode 100644
index c3032e4f..00000000
--- a/client/scripts/tiles/counter.gd
+++ /dev/null
@@ -1,81 +0,0 @@
-# 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
-
-var counters = [
- "counter",
- "pan",
- "sink",
- "oven",
-]
-
-enum CounterKind {
- OUTER_CORNER,
- STRAIGHT,
- STRAIGHT_BACKSPLASH
-}
-
-var kind: CounterKind = CounterKind.STRAIGHT
-
-static func interact_target() -> Vector3:
- return Vector3(0, 0.5, 0)
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- var facing = 0
- var edges = neighbors.duplicate()
- for i in range(4):
- var i_name = tile_name(edges[i])
- if Counter.is_counter(i_name):
- edges[i] = "counter"
- else:
- edges[i] = tile_name(edges[i])
-
- var series: int = 0
- var last_series: int = 0
- var adj: Array = []
-
- for i in range(4):
- if edges[i] == "floor":
- last_series += 1
- adj.append(i)
- if last_series > series:
- series = last_series
- else:
- last_series = 0
-
- var count = 4 - adj.size()
-
- # we can neither find out whether it is an inner corner nor an outer corner
- # backsplash
- if series == 1&&count == 3:
- facing = adj[0] % 4
-
- if edges[(adj[0] + 2) % 4] == "wall":
- kind = CounterKind.STRAIGHT_BACKSPLASH
- else:
- kind = CounterKind.STRAIGHT
- elif series == 2&&count == 2:
- facing = (adj[0] + 1) % 4
- kind = CounterKind.OUTER_CORNER
-
- turn_facing(facing)
-
-static func is_counter(tile_name_t) -> bool:
- if tile_name_t == null:
- return false
- return tile_name_t.ends_with("crate")||counters.has(tile_name_t)
diff --git a/client/scripts/tiles/counter_base.gd b/client/scripts/tiles/counter_base.gd
deleted file mode 100644
index ebeebb3b..00000000
--- a/client/scripts/tiles/counter_base.gd
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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 CounterBase
-extends Counter
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- match kind:
- CounterKind.OUTER_CORNER:
- base.add_child(load("res://models/prefabs/map/kitchencounter_outercorner.tscn").instantiate())
- CounterKind.STRAIGHT:
- base.add_child(load("res://models/prefabs/map/kitchencounter_straight_A.tscn").instantiate())
- CounterKind.STRAIGHT_BACKSPLASH:
- base.add_child(load("res://models/prefabs/map/kitchencounter_straight_A_backsplash.tscn").instantiate())
diff --git a/client/scripts/tiles/crate.gd b/client/scripts/tiles/crate.gd
deleted file mode 100644
index 21fae60b..00000000
--- a/client/scripts/tiles/crate.gd
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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 Crate
-extends Counter
-
-static func interact_target() -> Vector3:
- return Vector3(0, 0.25, 0)
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
diff --git a/client/scripts/tiles/cutting_board.gd b/client/scripts/tiles/cutting_board.gd
deleted file mode 100644
index 944a7a9f..00000000
--- a/client/scripts/tiles/cutting_board.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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 CuttingBoard
-extends CounterBase
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- base.add_child(load("res://models/prefabs/map/cuttingboard.tscn").instantiate())
diff --git a/client/scripts/tiles/door.gd b/client/scripts/tiles/door.gd
deleted file mode 100644
index cfba08b7..00000000
--- a/client/scripts/tiles/door.gd
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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 Door
-extends Floor
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
-
- var facing = 0
- for i in range(4):
- if tile_name(neighbors[i]) == "door":
- facing = i % 4
- base.add_child(load("res://models/prefabs/map/door.tscn").instantiate())
- turn_facing(facing)
diff --git a/client/scripts/tiles/floor.gd b/client/scripts/tiles/floor.gd
deleted file mode 100644
index fec68cbd..00000000
--- a/client/scripts/tiles/floor.gd
+++ /dev/null
@@ -1,85 +0,0 @@
-# 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 Floor
-extends Node3D
-
-var base = Node3D.new()
-var item: Item = null
-var item_base: Node3D
-
-enum Facing {
- NEG_Y = 0,
- NEG_X = 1,
- Y = 2,
- X = 3,
-}
-
-func _init(rename: String, _neighbors: Array):
- var floor_tile = load("res://models/prefabs/map/floor_kitchen_small.tscn").instantiate()
- floor_tile.position += Vector3(0.5, 0, 0.5)
- add_child(floor_tile)
- base.name = "Base"
- base.position += Vector3(0.5, 0, 0.5)
- add_child(base)
- self.name = rename
- var item_base_ = Node3D.new()
- # this method is supposed to be overriden
- @warning_ignore("static_called_on_instance")
- item_base_.position = interact_target()
- item_base_.name = "ItemBase"
- base.add_child(item_base_)
- item_base = item_base_
-
-func turn_facing(facing: Facing):
- base.rotate_y(facing * 0.5 * PI + PI)
-
-func tile_name(idx):
- if idx == null:
- return null
- return Multiplayer.tile_names[idx]
-
-
-# defines where items go when interacting
-static func interact_target() -> Vector3:
- return Vector3(0, 0, 0)
-
-# actions when interacting, e.g. animations
-func interact():
- pass
-
-func progress(p: float, warn: bool):
- if item != null:
- item.progress(p, warn)
-
-func finish(warn: bool):
- if item != null:
- item.finish(warn)
-
-func put_item(i: Item):
- if item != null:
- push_error("already holding an item")
- set_item(i)
-
-func set_item(i: Item):
- if item != null:
- item.queue_free()
- item = i
- i.owned_by = item_base
-
-func take_item() -> Item:
- var i = item
- item = null
- return i
diff --git a/client/scripts/tiles/flour_counter.gd b/client/scripts/tiles/flour_counter.gd
deleted file mode 100644
index 4bf2b1f3..00000000
--- a/client/scripts/tiles/flour_counter.gd
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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 FlourCounter
-extends CounterBase
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- var bag = load("res://models/prefabs/map/bag.tscn").instantiate()
- # this is supposed to be overridden
- @warning_ignore("static_called_on_instance")
- bag.position = interact_target()
- bag.rotation_degrees.y = 45
- base.add_child(bag)
diff --git a/client/scripts/tiles/full_tile.gd b/client/scripts/tiles/full_tile.gd
deleted file mode 100644
index 2da54237..00000000
--- a/client/scripts/tiles/full_tile.gd
+++ /dev/null
@@ -1,49 +0,0 @@
-# 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 FullTile
-extends Floor
-
-var static_body = StaticBody3D.new()
-var item: Node3D = null
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- var shape = CollisionShape3D.new()
- var box = BoxShape3D.new()
- shape.position.y += .5
- shape.shape = box
- shape.name = "Box"
- static_body.add_child(shape)
- static_body.name = "Body"
- base.add_child(static_body)
-
-# defines where items go when interacting
-static func interact_target() -> Vector3:
- return Vector3(0, 0, 0)
-
-# actions when interacting, e.g. animations
-func interact():
- pass
-
-func put_item(i: Node3D):
- if item != null:
- push_error("already holding an item")
- item = i
-
-func take_item() -> Node3D:
- var i = item
- item = null
- return i
diff --git a/client/scripts/tiles/generic_tile.gd b/client/scripts/tiles/generic_tile.gd
deleted file mode 100644
index f7d1b4a7..00000000
--- a/client/scripts/tiles/generic_tile.gd
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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 GenericTile
-extends Floor
-
-func _init(rename: String, neighbors: Array, kind: String):
- super(rename, neighbors)
- var mesh = MeshInstance3D.new()
- var text = TextMesh.new()
- var mat = StandardMaterial3D.new()
- text.text = kind
- text.font = SystemFont.new()
- text.depth = 0
- mesh.mesh = text
- mesh.position.y = 1
- mesh.scale = Vector3(3, 3, 3)
- mat.billboard_mode = mat.BILLBOARD_ENABLED
- mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
- text.material = mat
- item_base.add_child(mesh)
diff --git a/client/scripts/tiles/oven.gd b/client/scripts/tiles/oven.gd
deleted file mode 100644
index 88da3adb..00000000
--- a/client/scripts/tiles/oven.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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 Oven
-extends Counter
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- base.add_child(load("res://models/prefabs/map/oven.tscn").instantiate())
diff --git a/client/scripts/tiles/raw_steak_crate.gd b/client/scripts/tiles/raw_steak_crate.gd
deleted file mode 100644
index 8ff93d6b..00000000
--- a/client/scripts/tiles/raw_steak_crate.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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 RawSteakCrate
-extends Crate
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- base.add_child(load("res://models/prefabs/map/crate_steak.tscn").instantiate())
diff --git a/client/scripts/tiles/sink.gd b/client/scripts/tiles/sink.gd
deleted file mode 100644
index e4eaff60..00000000
--- a/client/scripts/tiles/sink.gd
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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 Sink
-extends Counter
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- match kind:
- CounterKind.STRAIGHT:
- base.add_child(load("res://models/prefabs/map/kitchencounter_sink.tscn").instantiate())
- CounterKind.STRAIGHT_BACKSPLASH:
- base.add_child(load("res://models/prefabs/map/kitchencounter_sink_backsplash.tscn").instantiate())
- _:
- base.add_child(load("res://models/prefabs/map/kitchencounter_sink.tscn").instantiate())
diff --git a/client/scripts/tiles/stove.gd b/client/scripts/tiles/stove.gd
deleted file mode 100644
index 93fad5a3..00000000
--- a/client/scripts/tiles/stove.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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 Stove
-extends Counter
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- base.add_child(load("res://models/prefabs/map/stove_single.tscn").instantiate())
diff --git a/client/scripts/tiles/table.gd b/client/scripts/tiles/table.gd
deleted file mode 100644
index 533223a4..00000000
--- a/client/scripts/tiles/table.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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 Table
-extends FullTile
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- base.add_child(load("res://models/prefabs/map/table_round_A_small.tscn").instantiate())
diff --git a/client/scripts/tiles/tomato_crate.gd b/client/scripts/tiles/tomato_crate.gd
deleted file mode 100644
index 078d0ba2..00000000
--- a/client/scripts/tiles/tomato_crate.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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 TomatoCrate
-extends Crate
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- base.add_child(load("res://models/prefabs/map/crate_tomatoes.tscn").instantiate())
diff --git a/client/scripts/tiles/trash.gd b/client/scripts/tiles/trash.gd
deleted file mode 100644
index fed1a502..00000000
--- a/client/scripts/tiles/trash.gd
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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 Trash
-extends Crate
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- base.add_child(load("res://models/prefabs/map/crate_trash.tscn").instantiate())
diff --git a/client/scripts/tiles/wall.gd b/client/scripts/tiles/wall.gd
deleted file mode 100644
index 0201d4d6..00000000
--- a/client/scripts/tiles/wall.gd
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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 Wall
-extends WallTile
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- match kind:
- WallKind.STRAIGHT:
- base.add_child(load("res://models/prefabs/map/wall_straight.tscn").instantiate())
- WallKind.OUTER_CORNER:
- base.add_child(load("res://models/prefabs/map/wall_corner.tscn").instantiate())
- WallKind.T:
- base.add_child(load("res://models/prefabs/map/wall_t.tscn").instantiate())
- WallKind.CROSS:
- base.add_child(load("res://models/prefabs/map/wall_cross.tscn").instantiate())
diff --git a/client/scripts/tiles/wall_tile.gd b/client/scripts/tiles/wall_tile.gd
deleted file mode 100644
index 7c9d4305..00000000
--- a/client/scripts/tiles/wall_tile.gd
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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 WallTile
-extends FullTile
-
-const WALLS: Array = [
- "wall",
- "window",
- "door"
-]
-
-enum WallKind {
- STRAIGHT,
- OUTER_CORNER,
- T,
- CROSS,
-}
-
-var kind: WallKind = WallKind.STRAIGHT
-var facing: int = 0
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
-
- var edges = neighbors.duplicate()
-
- var series: int = 0
- var last_series: int = 0
- var adj: Array = []
-
- for i in range(4):
- var i_name = tile_name(edges[i])
- if is_wall(i_name):
- edges[i] = "wall"
- else:
- edges[i] = tile_name(edges[i])
-
- for i in range(4):
- if edges[i] != "wall":
- last_series += 1
- adj.append(i)
- if last_series > series:
- series = last_series
- else:
- last_series = 0
-
- var count = 4 - adj.size()
-
- if series == 1&&count == 2:
- facing = adj[0]
- kind = WallKind.STRAIGHT
- elif series == 2&&count == 2:
- facing = adj[0]
- kind = WallKind.OUTER_CORNER
- elif series == 1&&count == 3:
- facing = adj[0]
- kind = WallKind.T
- elif series == 0&&count == 4:
- facing = adj[0]
- kind = WallKind.CROSS
- turn_facing(facing)
diff --git a/client/scripts/tiles/window.gd b/client/scripts/tiles/window.gd
deleted file mode 100644
index b2926080..00000000
--- a/client/scripts/tiles/window.gd
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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 WallWindow
-extends WallTile
-
-static func interact_target() -> Vector3:
- return Vector3(0, 0.625, 0)
-
-func _init(rename: String, neighbors: Array):
- super(rename, neighbors)
- match kind:
- WallKind.STRAIGHT:
- base.add_child(load("res://models/prefabs/map/window.tscn").instantiate())
- WallKind.OUTER_CORNER:
- push_warning("There is no corner window!")
- base.add_child(load("res://models/prefabs/map/window.tscn").instantiate())