Sync systems and go back to GLES2 for now

This commit is contained in:
Hamcha 2020-07-13 22:18:02 +02:00
parent e1221af9ec
commit b95246209a
Signed by: hamcha
GPG key ID: 41467804B19A3315
14 changed files with 211 additions and 119 deletions

View file

@ -64,15 +64,21 @@ func refresh_sprite() -> void:
socket.material.set_shader_param("cable_color", bidirectional_color)
func serialize():
var connection_paths = []
for conn in connections:
connection_paths.append({ "path": get_path_to(conn), "powered": conn.powered })
return {
"direction": direction,
"flow": flow,
"network": "", #TODO
"connections": [] #TODO
"connections": connection_paths
}
func deserialize(data):
set_direction(data["direction"])
set_flow(data["flow"])
#TODO Connections
#TODO Network
for node in data["connections"]:
var manager = get_node(node.path) as PowerManager
manager.socket = self
manager.powered = node.powered
connections.append(manager)

View file

@ -42,7 +42,6 @@ shader_param/cable_color = Color( 0, 0, 0, 0 )
radius = 12.0
[node name="ElectricSocket" type="Area2D"]
z_index = -8
collision_layer = 4
collision_mask = 2147483652
script = ExtResource( 2 )

View file

@ -13,6 +13,8 @@ export var current_charge = MAX_CHARGE setget set_charge
export var max_charge_rate = 0 setget set_max_charge
export var max_discharge_rate = 200 setget set_max_discharge
var next_network_update = Multiplayer.SYSTEMS_UPDATE_INTERVAL
func _ready() -> void:
if not Engine.editor_hint:
activationRange.visible = true
@ -21,15 +23,28 @@ func _ready() -> void:
set_max_charge(max_charge_rate)
func _physics_process(delta: float) -> void:
if not is_network_master():
return
next_network_update -= 1
if next_network_update < 0:
next_network_update = Multiplayer.SYSTEMS_UPDATE_INTERVAL
if manager.wired:
if current_charge > 0:
manager.power_source = min(current_charge, max_discharge_rate)
if manager.power_load > 0:
set_charge(current_charge - manager.power_load * delta)
var new_charge = current_charge - manager.power_load * delta
if next_network_update == 0:
rpc("set_charge", new_charge)
else:
set_charge(new_charge)
if PowerNetwork.DEBUG:
update()
if manager.powered:
set_charge(current_charge + max_charge_rate * delta)
var new_charge = current_charge + max_charge_rate * delta
if next_network_update == 0:
rpc("set_charge", new_charge)
else:
set_charge(new_charge)
func _input(event):
if event is InputEventMouseButton and event.pressed and not is_inside and open:
@ -69,15 +84,15 @@ func _draw():
charge_color = Color.red
draw_rect(Rect2(32, 32-charge_px, 4, charge_px), charge_color)
func set_max_discharge(val: float) -> void:
remotesync func set_max_discharge(val: float) -> void:
max_discharge_rate = val
func set_max_charge(val: float) -> void:
remotesync func set_max_charge(val: float) -> void:
max_charge_rate = val
if manager != null:
manager.power_usage = val
func set_charge(val: float) -> void:
remotesync func set_charge(val: float) -> void:
current_charge = val
$Control/PowerUI.set_current_charge(current_charge)

View file

@ -2,7 +2,7 @@ extends Node
class_name PowerNetwork
const DEBUG = true
const DEBUG = false
var nodes = []
var sockets = []
@ -86,3 +86,18 @@ func _physics_process(_delta: float) -> void:
for source in sources:
var source_load = source.power_source / total_source * remaining_drain
source.power_load = source_load
func serialize():
var node_paths = []
var socket_paths = []
for node in nodes:
node_paths.append(get_path_to(node))
for socket in sockets:
socket_paths.append(get_path_to(socket))
return { "nodes": node_paths, "sockets": socket_paths }
func deserialize(data):
for node_path in data["nodes"]:
nodes.append(get_node(node_path))
for socket_path in data["sockets"]:
sockets.append(get_node(socket_path))

View file

@ -4,7 +4,6 @@
code = "shader_type canvas_item;
render_mode unshaded;"
custom_defines = ""
[resource]
shader = SubResource( 1 )

View file

@ -2,6 +2,8 @@ extends Node
class_name GameInstance
signal state_received()
onready var ui = $CanvasLayer/ui
onready var world = $world
onready var systems = $systems
@ -15,13 +17,25 @@ func _ready() -> void:
else:
world.load_map(GameWorld.Map.EMPTY)
rpc_id(1, "send_map")
yield(world.map, "map_received")
yield(self, "state_received")
rpc_id(1, "ready_to_spawn")
master func send_map() -> void:
var id = get_tree().get_rpc_sender_id()
var map_data = world.map.serialize()
var systems_data = systems.serialize()
print("sending map data to ", id)
world.map.send_data(id)
rpc_id(id, "receive_data", {
"map": map_data,
"systems": systems_data
})
puppet func receive_data(data: Dictionary) -> void:
print(data.systems)
world.map.deserialize(data["map"])
systems.deserialize(data["systems"])
print("Received map data from master")
emit_signal("state_received")
master func ready_to_spawn() -> void:
var id = get_tree().get_rpc_sender_id()

View file

@ -1,5 +1,6 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Scenes/systems.gd" type="Script" id=1]
[ext_resource path="res://Scenes/UI.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/World.gd" type="Script" id=4]
[ext_resource path="res://Scenes/Game.gd" type="Script" id=5]
@ -8,6 +9,7 @@
script = ExtResource( 5 )
[node name="systems" type="Node" parent="."]
script = ExtResource( 1 )
[node name="world" type="Node2D" parent="."]
scale = Vector2( 2, 2 )

View file

@ -8,6 +8,9 @@ const SERVER_PORT = 5513
const MAX_PLAYERS = 30
var port = SERVER_PORT
# Throttle network updates of often-changed variables by this many physics frames
const SYSTEMS_UPDATE_INTERVAL = 10
# Master server data
const MASTER_SERVER_ADDR = "fgms.zyg.ovh"
const MASTER_SERVER_UDP_PORT = 9434

View file

@ -3,8 +3,6 @@ extends Node2D
class_name GameMap
signal map_received()
var ship_direction = 0
var ship_speed = 0
@ -33,18 +31,16 @@ func _ready():
if Engine.editor_hint:
return
$editor.queue_free()
set_unlit(true)
set_unlit(false)
if not is_network_master():
return
# Run special tiling
# Run autotile conversions and generate occlusions
$walls.run_conversions()
# Electricity setup
make_electric_probes($cables, "Wire")
print(serialize())
func _process(delta: float):
if Engine.editor_hint:
@ -73,18 +69,19 @@ func serialize() -> Dictionary:
for cell in tilemap.get_used_cells():
data.append([cell, tilemap.get_cellv(cell)])
tilemapdata[tilemap.name] = data
# Get objects
var engines = serialize_children($engines)
var objects = serialize_children($objects)
var lights = serialize_children($lights)
var sockets = serialize_children($sockets)
var pois = serialize_children($pois)
return {
"tilemaps": tilemapdata,
"engines": engines,
"objects": objects,
"lights": lights,
"sockets": sockets,
"pois": pois
}
@ -99,16 +96,11 @@ func deserialize(data: Dictionary) -> void:
deserialize_children($objects, data["objects"])
deserialize_children($lights, data["lights"])
deserialize_children($pois, data["pois"])
deserialize_children($sockets, data["sockets"])
# Run autotile conversions and generate occlusions
$walls.run_conversions()
master func send_data(id: int) -> void:
rpc_id(id, "receive_data", serialize())
puppet func receive_data(data: Dictionary) -> void:
deserialize(data)
print("Received map data from master")
emit_signal("map_received")
func serialize_children(node: Node) -> Dictionary:
var data = {}
for child in node.get_children():
@ -125,8 +117,8 @@ func deserialize_children(node: Node, data: Dictionary) -> void:
var node_scene = load(node_data.filename).instance()
node_scene.name = node_name
node_scene.transform = node_data.transform
node_scene.deserialize(node_data.data)
node.add_child(node_scene, true)
node_scene.deserialize(node_data.data)
# Lighting

View file

@ -33,6 +33,7 @@ __meta__ = {
[node name="base" type="TileMap" parent="."]
z_index = 1
z_as_relative = false
tile_set = ExtResource( 11 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -41,6 +42,7 @@ format = 1
[node name="cables" type="TileMap" parent="."]
z_index = 2
z_as_relative = false
tile_set = ExtResource( 13 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -49,6 +51,7 @@ format = 1
[node name="floor" type="TileMap" parent="."]
z_index = 3
z_as_relative = false
tile_set = ExtResource( 9 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -57,6 +60,7 @@ format = 1
[node name="walls" type="TileMap" parent="."]
z_index = 4
z_as_relative = false
tile_set = ExtResource( 1 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -67,6 +71,7 @@ extended_tilemap_node = NodePath("../1x1")
[node name="1x1" type="TileMap" parent="."]
z_index = 5
z_as_relative = false
tile_set = ExtResource( 2 )
cell_size = Vector2( 16, 16 )
format = 1
@ -84,6 +89,10 @@ __meta__ = {
"_editor_description_": ""
}
[node name="sockets" type="Node2D" parent="."]
z_index = 2
z_as_relative = false
[node name="lights" type="Node2D" parent="."]
modulate = Color( 0.980392, 0.980392, 0.980392, 1 )
z_index = 11

View file

@ -40,6 +40,7 @@ __meta__ = {
[node name="base" type="TileMap" parent="."]
z_index = 1
z_as_relative = false
tile_set = ExtResource( 11 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -49,6 +50,7 @@ tile_data = PoolIntArray( -589821, 0, 0, -589820, 0, 0, -589819, 0, 0, -458763,
[node name="cables" type="TileMap" parent="."]
z_index = 2
z_as_relative = false
tile_set = ExtResource( 13 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -58,6 +60,7 @@ tile_data = PoolIntArray( -524284, 0, 131073, -393224, 0, 131073, -393217, 0, 13
[node name="floor" type="TileMap" parent="."]
z_index = 3
z_as_relative = false
tile_set = ExtResource( 9 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -67,6 +70,7 @@ tile_data = PoolIntArray( -589820, 1, 0, -524284, 1, 0, -393226, 1, 0, -393225,
[node name="walls" type="TileMap" parent="."]
z_index = 4
z_as_relative = false
tile_set = ExtResource( 1 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -78,6 +82,7 @@ extended_tilemap_node = NodePath("../1x1")
[node name="1x1" type="TileMap" parent="."]
z_index = 5
z_as_relative = false
tile_set = ExtResource( 2 )
cell_size = Vector2( 16, 16 )
format = 1
@ -190,257 +195,261 @@ position = Vector2( -320, -192 )
[node name="SMES4" parent="objects" instance=ExtResource( 12 )]
position = Vector2( -320, -96 )
[node name="ElectricSocket" parent="objects" instance=ExtResource( 14 )]
[node name="sockets" type="Node2D" parent="."]
z_index = 2
z_as_relative = false
[node name="ElectricSocket" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -288, -160 )
direction = 0
connectionPaths = [ NodePath("../SMES1") ]
connectionPaths = [ NodePath("../../objects/SMES1") ]
[node name="ElectricSocket2" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket2" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -288, -128 )
direction = 0
connectionPaths = [ NodePath("../SMES2") ]
connectionPaths = [ NodePath("../../objects/SMES2") ]
[node name="ElectricSocket3" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket3" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -288, -192 )
direction = 0
connectionPaths = [ NodePath("../SMES3") ]
connectionPaths = [ NodePath("../../objects/SMES3") ]
[node name="ElectricSocket4" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket4" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -288, -96 )
direction = 0
connectionPaths = [ NodePath("../SMES4") ]
connectionPaths = [ NodePath("../../objects/SMES4") ]
[node name="ElectricSocket5" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket5" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 320, 128 )
connectionPaths = [ NodePath("../../lights/Lighttube2") ]
flow = 1
[node name="ElectricSocket34" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket34" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 384, 192 )
direction = 1
connectionPaths = [ NodePath("../BridgeDoor") ]
connectionPaths = [ NodePath("../../objects/BridgeDoor") ]
flow = 1
[node name="ElectricSocket36" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket36" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 0, 192 )
direction = 0
connectionPaths = [ NodePath("../EngineDoor") ]
connectionPaths = [ NodePath("../../objects/EngineDoor") ]
flow = 1
[node name="ElectricSocket37" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket37" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 0, 288 )
direction = 0
connectionPaths = [ NodePath("../EngineDoor2") ]
connectionPaths = [ NodePath("../../objects/EngineDoor2") ]
flow = 1
[node name="ElectricSocket35" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket35" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 384, 288 )
direction = 1
connectionPaths = [ NodePath("../BridgeDoor2") ]
connectionPaths = [ NodePath("../../objects/BridgeDoor2") ]
flow = 1
[node name="ElectricSocket6" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket6" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 64, 128 )
connectionPaths = [ NodePath("../../lights/Lighttube") ]
flow = 1
[node name="ElectricSocket7" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket7" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 64, -64 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube9") ]
flow = 1
[node name="ElectricSocket8" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket8" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 256, -64 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube10") ]
flow = 1
[node name="ElectricSocket32" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket32" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 192, -32 )
direction = 1
connectionPaths = [ NodePath("../../lights/Lighttube16") ]
flow = 1
[node name="ElectricSocket33" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket33" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 192, 96 )
direction = 0
connectionPaths = [ NodePath("../../lights/Lighttube15") ]
flow = 1
[node name="ElectricSocket9" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket9" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 256, -224 )
connectionPaths = [ NodePath("../../lights/Lighttube11") ]
flow = 1
[node name="ElectricSocket42" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket42" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 128, -192 )
connectionPaths = [ NodePath("../AirlockInt") ]
connectionPaths = [ NodePath("../../objects/AirlockInt") ]
flow = 1
[node name="ElectricSocket43" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket43" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 128, -256 )
connectionPaths = [ NodePath("../AirlockExt") ]
connectionPaths = [ NodePath("../../objects/AirlockExt") ]
flow = 1
[node name="ElectricSocket10" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket10" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -32, -224 )
direction = 0
connectionPaths = [ NodePath("../../lights/Lighttube12") ]
flow = 1
[node name="ElectricSocket44" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket44" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -96, -160 )
direction = 0
connectionPaths = [ NodePath("../StorageDoor") ]
connectionPaths = [ NodePath("../../objects/StorageDoor") ]
flow = 1
[node name="ElectricSocket45" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket45" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -96, -128 )
direction = 0
connectionPaths = [ NodePath("../StorageDoor2") ]
connectionPaths = [ NodePath("../../objects/StorageDoor2") ]
flow = 1
[node name="ElectricSocket11" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket11" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -256, -224 )
connectionPaths = [ NodePath("../../lights/Lighttube13") ]
flow = 1
[node name="ElectricSocket12" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket12" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -256, -64 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube14") ]
flow = 1
[node name="ElectricSocket13" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket13" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -128, 352 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube8") ]
flow = 1
[node name="ElectricSocket14" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket14" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -128, 128 )
connectionPaths = [ NodePath("../../lights/Lighttube7") ]
flow = 1
[node name="ElectricSocket15" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket15" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -160, 192 )
direction = 0
connectionPaths = [ NodePath("../Computer4") ]
connectionPaths = [ NodePath("../../objects/Computer4") ]
flow = 1
[node name="ElectricSocket16" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket16" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -160, 288 )
direction = 0
connectionPaths = [ NodePath("../Computer2") ]
connectionPaths = [ NodePath("../../objects/Computer2") ]
flow = 1
[node name="ElectricSocket17" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket17" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -224, -128 )
direction = 0
connectionPaths = [ NodePath("../Computer3") ]
connectionPaths = [ NodePath("../../objects/Computer3") ]
flow = 1
[node name="ElectricSocket18" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket18" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -224, -160 )
direction = 0
connectionPaths = [ NodePath("../Computer") ]
connectionPaths = [ NodePath("../../objects/Computer") ]
flow = 1
[node name="ElectricSocket19" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket19" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 544, 224 )
direction = 1
connectionPaths = [ NodePath("../CommsComp") ]
connectionPaths = [ NodePath("../../objects/CommsComp") ]
flow = 1
[node name="ElectricSocket20" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket20" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 544, 256 )
direction = 1
connectionPaths = [ NodePath("../ControlComp") ]
connectionPaths = [ NodePath("../../objects/ControlComp") ]
flow = 1
[node name="ElectricSocket21" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket21" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 512, 128 )
connectionPaths = [ NodePath("../../lights/Lighttube6") ]
flow = 1
[node name="ElectricSocket22" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket22" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 512, 352 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube5") ]
flow = 1
[node name="ElectricSocket23" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket23" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 320, 352 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube3") ]
flow = 1
[node name="ElectricSocket24" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket24" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 64, 352 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube4") ]
flow = 1
[node name="ElectricSocket38" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket38" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -32, 576 )
direction = 0
connectionPaths = [ NodePath("../AirlockInt3") ]
connectionPaths = [ NodePath("../../objects/AirlockInt3") ]
flow = 1
[node name="ElectricSocket39" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket39" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -128, 576 )
direction = 0
connectionPaths = [ NodePath("../AirlockExt3") ]
connectionPaths = [ NodePath("../../objects/AirlockExt3") ]
flow = 1
[node name="ElectricSocket40" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket40" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -128, 672 )
direction = 0
connectionPaths = [ NodePath("../AirlockExt2") ]
connectionPaths = [ NodePath("../../objects/AirlockExt2") ]
flow = 1
[node name="ElectricSocket41" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket41" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -32, 672 )
direction = 0
connectionPaths = [ NodePath("../AirlockInt2") ]
connectionPaths = [ NodePath("../../objects/AirlockInt2") ]
flow = 1
[node name="ElectricSocket25" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket25" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 192, 384 )
direction = 1
connectionPaths = [ NodePath("../../lights/Lighttube17") ]
flow = 1
[node name="ElectricSocket26" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket26" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 192, 512 )
direction = 0
connectionPaths = [ NodePath("../../lights/Lighttube18") ]
flow = 1
[node name="ElectricSocket27" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket27" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 64, 704 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube22") ]
flow = 1
[node name="ElectricSocket28" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket28" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 256, 704 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube20") ]
flow = 1
[node name="ElectricSocket29" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket29" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( 32, 544 )
connectionPaths = [ NodePath("../../lights/Lighttube19") ]
flow = 1
[node name="ElectricSocket30" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket30" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -256, 544 )
connectionPaths = [ NodePath("../../lights/Lighttube21") ]
flow = 1
[node name="ElectricSocket31" parent="objects" instance=ExtResource( 14 )]
[node name="ElectricSocket31" parent="sockets" instance=ExtResource( 14 )]
position = Vector2( -256, 704 )
direction = 3
connectionPaths = [ NodePath("../../lights/Lighttube23") ]

View file

@ -24,6 +24,7 @@ func _ready():
light_mode = 1
[node name="map" type="Node2D"]
z_as_relative = false
script = SubResource( 1 )
[node name="darkness" type="CanvasModulate" parent="."]
@ -44,6 +45,7 @@ __meta__ = {
[node name="base" type="TileMap" parent="."]
z_index = 1
z_as_relative = false
tile_set = ExtResource( 11 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -53,6 +55,7 @@ tile_data = PoolIntArray( 262137, 0, 0, 262138, 0, 0, 262139, 0, 0, 262140, 0, 0
[node name="cables" type="TileMap" parent="."]
z_index = 2
z_as_relative = false
tile_set = ExtResource( 4 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -62,6 +65,7 @@ tile_data = PoolIntArray( 393212, 0, 131072, 393213, 0, 65536, 393214, 0, 65536,
[node name="floor" type="TileMap" parent="."]
z_index = 3
z_as_relative = false
tile_set = ExtResource( 9 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -70,6 +74,7 @@ format = 1
[node name="walls" type="TileMap" parent="."]
z_index = 4
z_as_relative = false
tile_set = ExtResource( 1 )
cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
@ -81,6 +86,7 @@ extended_tilemap_node = NodePath("../1x1")
[node name="1x1" type="TileMap" parent="."]
z_index = 5
z_as_relative = false
tile_set = ExtResource( 2 )
cell_size = Vector2( 16, 16 )
format = 1
@ -140,44 +146,48 @@ position = Vector2( 128, 128 )
position = Vector2( 64, 128 )
computer_type = 6
[node name="ElectricSocket4" parent="objects" instance=ExtResource( 13 )]
[node name="sockets" type="Node2D" parent="."]
z_index = 2
z_as_relative = false
[node name="ElectricSocket4" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( -128, 160 )
connectionPaths = [ NodePath("../Computer6") ]
connectionPaths = [ NodePath("../../objects/Computer6") ]
flow = 1
[node name="ElectricSocket5" parent="objects" instance=ExtResource( 13 )]
[node name="ElectricSocket5" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( -96, 160 )
connectionPaths = [ NodePath("../Computer5") ]
connectionPaths = [ NodePath("../../objects/Computer5") ]
flow = 1
[node name="ElectricSocket6" parent="objects" instance=ExtResource( 13 )]
[node name="ElectricSocket6" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( -64, 160 )
connectionPaths = [ NodePath("../Computer") ]
connectionPaths = [ NodePath("../../objects/Computer") ]
flow = 1
[node name="ElectricSocket7" parent="objects" instance=ExtResource( 13 )]
[node name="ElectricSocket7" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( -32, 160 )
connectionPaths = [ NodePath("../Computer2") ]
connectionPaths = [ NodePath("../../objects/Computer2") ]
flow = 1
[node name="ElectricSocket8" parent="objects" instance=ExtResource( 13 )]
[node name="ElectricSocket8" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 0, 160 )
connectionPaths = [ NodePath("../Computer3") ]
connectionPaths = [ NodePath("../../objects/Computer3") ]
flow = 1
[node name="ElectricSocket9" parent="objects" instance=ExtResource( 13 )]
[node name="ElectricSocket9" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 32, 160 )
connectionPaths = [ NodePath("../Computer4") ]
connectionPaths = [ NodePath("../../objects/Computer4") ]
flow = 1
[node name="ElectricSocket10" parent="objects" instance=ExtResource( 13 )]
[node name="ElectricSocket10" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 64, 160 )
connectionPaths = [ NodePath("../Computer7") ]
connectionPaths = [ NodePath("../../objects/Computer7") ]
flow = 1
[node name="ElectricSocket3" parent="objects" instance=ExtResource( 13 )]
[node name="ElectricSocket3" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 128, 160 )
connectionPaths = [ NodePath("../SMES2") ]
connectionPaths = [ NodePath("../../objects/SMES2") ]
[node name="lights" type="Node2D" parent="."]
modulate = Color( 0.980392, 0.980392, 0.980392, 1 )
@ -191,5 +201,3 @@ z_index = 999
[node name="SpawnpointPlayer" parent="pois" instance=ExtResource( 5 )]
position = Vector2( 80, 272 )
poitype = 1
poiclass = 1

18
Scenes/systems.gd Normal file
View file

@ -0,0 +1,18 @@
extends Node
func serialize() -> Dictionary:
var systems = {}
for child in get_children():
systems[child.name] = {
"script": child.script.resource_path,
"data": child.serialize()
}
return systems
func deserialize(data: Dictionary) -> void:
for system_name in data:
var system_data = data[system_name] as Dictionary
var system_node = load(system_data.script).new()
system_node.name = system_name
add_child(system_node, true)
system_node.deserialize(system_data.data)

View file

@ -202,6 +202,9 @@ sprint={
[rendering]
quality/driver/driver_name="GLES2"
quality/2d/use_pixel_snap=true
threads/thread_model=2
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0, 0, 0, 1 )