summaryrefslogtreecommitdiff
path: root/client/scripts/map.gd
diff options
context:
space:
mode:
Diffstat (limited to 'client/scripts/map.gd')
-rw-r--r--client/scripts/map.gd57
1 files changed, 57 insertions, 0 deletions
diff --git a/client/scripts/map.gd b/client/scripts/map.gd
new file mode 100644
index 00000000..64d15723
--- /dev/null
+++ b/client/scripts/map.gd
@@ -0,0 +1,57 @@
+extends Node3D
+
+func _ready():
+ Multiplayer.connect("update_map", update)
+
+func update(pos, tile_name, neighbors):
+ var instance: Floor
+ match tile_name:
+ "trash":
+ instance = Trash.new()
+ "tomato-crate":
+ instance = CounterBase.new()
+ "cuttingboard":
+ instance = CounterBase.new()
+ "counter":
+ instance = CounterBase.new()
+ "flour-crate":
+ instance = CounterBase.new()
+ "oven":
+ instance = CounterBase.new()
+ "raw-steak-crate":
+ instance = CounterBase.new()
+ "pan":
+ instance = CounterBase.new()
+ "watercooler":
+ instance = CounterBase.new()
+ "sink":
+ instance = CounterBase.new()
+ "dirty-plate-crate":
+ instance = CounterBase.new()
+ "wall":
+ instance = Wall.new()
+ "chair":
+ instance = Chair.new()
+ "table":
+ instance = Table.new()
+ "floor":
+ instance = Floor.new()
+ "window":
+ instance = Wall.new()
+ "door":
+ instance = Wall.new()
+ _:
+ instance = Floor.new()
+
+ var node_name = str(pos)
+
+ if has_node(node_name):
+ queue_free_rename(get_node(node_name))
+
+ instance.setup(node_name, neighbors)
+ instance.position = Vector3(pos[0], 0, pos[1])
+ add_child(instance)
+
+func queue_free_rename(node: Node) -> void:
+ node.name += "_queued_free"
+ node.queue_free()