Add new space, remove obsolete runtime-map

This commit is contained in:
Hamcha 2020-09-11 11:30:14 +02:00
parent 1ee091c395
commit 1fbd1149ee
Signed by: hamcha
GPG key ID: 41467804B19A3315
5 changed files with 114 additions and 294 deletions

View file

@ -18,7 +18,7 @@ func _ready() -> void:
if netgame.hosting: if netgame.hosting:
world.load_map(netgame.get_current_map()) world.load_map(netgame.get_current_map())
world.map.current_ship_position = Vector2(randf() * 1e4, randf() * 1e4) world.map.current_ship_position = Vector2(randf() * 1e4, randf() * 1e4)
world.map.current_ship_target = world.map.current_ship_position + Vector2(randf() * 1e2, randf() * 1e2) world.map.current_ship_target = null
rpc("spawn_player", 1) rpc("spawn_player", 1)
else: else:
world.load_map(GameWorld.Map.EMPTY) world.load_map(GameWorld.Map.EMPTY)

View file

@ -15,6 +15,9 @@ var current_ship_target = Vector2.ZERO
var current_ship_direction = 0.0 var current_ship_direction = 0.0
var current_ship_speed = 0.0 var current_ship_speed = 0.0
var deepspace_mat: ShaderMaterial = null
var warp_state = false
puppet var pup_ship_position = Vector2.ZERO puppet var pup_ship_position = Vector2.ZERO
puppet var pup_ship_subpos = Vector2.ZERO puppet var pup_ship_subpos = Vector2.ZERO
puppet var pup_ship_target = Vector2.ZERO puppet var pup_ship_target = Vector2.ZERO
@ -30,7 +33,7 @@ const NO_SPEED_THRESHOLD = 0.01
const ProbeElectricity = preload("res://Actors/Systems/Electricity/ElectricProbe.tscn") const ProbeElectricity = preload("res://Actors/Systems/Electricity/ElectricProbe.tscn")
onready var tilemaps = [ $base, $cables, $floor, $walls ] onready var tilemaps = [ $tiles/base, $tiles/cables, $tiles/floor, $tiles/walls ]
onready var pois = $pois onready var pois = $pois
@ -42,21 +45,22 @@ export var shadow_intensity = 0.2
func _ready(): func _ready():
if Engine.editor_hint: if Engine.editor_hint:
return return
$editor.queue_free()
set_unlit(true) set_unlit(true)
if not is_network_master(): if not is_network_master():
return return
# Run autotile conversions and generate occlusions # Run autotile conversions and generate occlusions
$walls.run_conversions() $tiles/walls.run_conversions()
# Electricity setup # Electricity setup
make_electric_probes($cables, "Wire") make_electric_probes($tiles/cables, "Wire")
# Set engines to expected power level # Set engines to expected power level
set_engine_strength(current_ship_speed) set_engine_strength(current_ship_speed)
deepspace_mat = $deepspace.material as ShaderMaterial
func _process(delta: float): func _process(delta: float):
if Engine.editor_hint: if Engine.editor_hint:
return return
@ -86,8 +90,7 @@ func _process(delta: float):
current_ship_speed += MAX_ACCELERATION * max_speed * delta * sign(speed_delta) current_ship_speed += MAX_ACCELERATION * max_speed * delta * sign(speed_delta)
set_engine_strength(current_ship_speed * ENGINE_MULTIPLIER) set_engine_strength(current_ship_speed * ENGINE_MULTIPLIER)
$deepspace.rotation = -current_ship_direction-PI/2 deepspace_mat.set_shader_param("scroll_speed", current_ship_speed * 5000)
$deepspace.region_rect.position += Vector2(-sin(current_ship_direction), cos(current_ship_direction)) * current_ship_speed * SCROLL_MULTIPLIER * delta
func _physics_process(delta): func _physics_process(delta):
if Engine.editor_hint: if Engine.editor_hint:
@ -125,6 +128,12 @@ func _physics_process(delta):
current_ship_subpos.y -= int_part current_ship_subpos.y -= int_part
rset("pup_ship_position", current_ship_position) rset("pup_ship_position", current_ship_position)
rset("pup_ship_subpos", current_ship_subpos) rset("pup_ship_subpos", current_ship_subpos)
if not warp_state and current_ship_speed > 0.05:
# Engage FTL
rpc("warp_enter")
elif warp_state and current_ship_speed < 0.02:
# Diseangage FTL
rpc("warp_exit")
else: else:
ship_speed = 0.0 ship_speed = 0.0
rset("pup_ship_speed", ship_speed) rset("pup_ship_speed", ship_speed)
@ -205,7 +214,7 @@ func deserialize(data: Dictionary) -> void:
current_ship_direction = data["ship"]["direction"] current_ship_direction = data["ship"]["direction"]
# Run autotile conversions and generate occlusions # Run autotile conversions and generate occlusions
$walls.run_conversions() $tiles/walls.run_conversions()
func serialize_children(node: Node) -> Dictionary: func serialize_children(node: Node) -> Dictionary:
var data = {} var data = {}
@ -245,6 +254,14 @@ func set_engine_strength(val: float):
var engine = child as GameObjectEngine var engine = child as GameObjectEngine
engine.strength = val engine.strength = val
remotesync func warp_enter():
$deepspace/AnimationPlayer.play("warp-enter")
warp_state = true
remotesync func warp_exit():
$deepspace/AnimationPlayer.play("warp-exit")
warp_state = false
# Tileset related functions # Tileset related functions
func make_electric_probes(tilemap: TileMap, tile_name: String): func make_electric_probes(tilemap: TileMap, tile_name: String):

View file

@ -31,7 +31,9 @@ __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
[node name="base" type="TileMap" parent="."] [node name="tiles" type="Node2D" parent="."]
[node name="base" type="TileMap" parent="tiles"]
z_index = 1 z_index = 1
z_as_relative = false z_as_relative = false
tile_set = ExtResource( 11 ) tile_set = ExtResource( 11 )
@ -40,7 +42,7 @@ cell_quadrant_size = 32
occluder_light_mask = -2147483647 occluder_light_mask = -2147483647
format = 1 format = 1
[node name="cables" type="TileMap" parent="."] [node name="cables" type="TileMap" parent="tiles"]
z_index = 2 z_index = 2
z_as_relative = false z_as_relative = false
tile_set = ExtResource( 13 ) tile_set = ExtResource( 13 )
@ -49,7 +51,7 @@ cell_quadrant_size = 32
occluder_light_mask = -2147483647 occluder_light_mask = -2147483647
format = 1 format = 1
[node name="floor" type="TileMap" parent="."] [node name="floor" type="TileMap" parent="tiles"]
z_index = 3 z_index = 3
z_as_relative = false z_as_relative = false
tile_set = ExtResource( 9 ) tile_set = ExtResource( 9 )
@ -58,7 +60,7 @@ cell_quadrant_size = 32
occluder_light_mask = -2147483647 occluder_light_mask = -2147483647
format = 1 format = 1
[node name="walls" type="TileMap" parent="."] [node name="walls" type="TileMap" parent="tiles"]
z_index = 4 z_index = 4
z_as_relative = false z_as_relative = false
tile_set = ExtResource( 1 ) tile_set = ExtResource( 1 )
@ -69,7 +71,7 @@ format = 1
script = ExtResource( 3 ) script = ExtResource( 3 )
extended_tilemap_node = NodePath("../1x1") extended_tilemap_node = NodePath("../1x1")
[node name="1x1" type="TileMap" parent="."] [node name="1x1" type="TileMap" parent="tiles"]
z_index = 5 z_index = 5
z_as_relative = false z_as_relative = false
tile_set = ExtResource( 2 ) tile_set = ExtResource( 2 )

File diff suppressed because one or more lines are too long

View file

@ -1,203 +0,0 @@
[gd_scene load_steps=15 format=2]
[ext_resource path="res://Graphics/tgstation/walls.tres" type="TileSet" id=1]
[ext_resource path="res://Graphics/tgstation/1x1.tres" type="TileSet" id=2]
[ext_resource path="res://Scenes/Rendering/MapTiles.gd" type="Script" id=3]
[ext_resource path="res://Graphics/tgstation/cables.tres" type="TileSet" id=4]
[ext_resource path="res://Actors/Meta/POI/POI.tscn" type="PackedScene" id=5]
[ext_resource path="res://Actors/Objects/Computer/Computer.tscn" type="PackedScene" id=6]
[ext_resource path="res://Graphics/space.png" type="Texture" id=7]
[ext_resource path="res://Graphics/tgstation/floor.tres" type="TileSet" id=9]
[ext_resource path="res://Actors/Objects/Engine/Engine.tscn" type="PackedScene" id=10]
[ext_resource path="res://Graphics/tgstation/base.tres" type="TileSet" id=11]
[ext_resource path="res://Actors/Objects/PowerStorage/PowerStorage.tscn" type="PackedScene" id=12]
[ext_resource path="res://Actors/Objects/ElectricSocket/ElectricSocket.tscn" type="PackedScene" id=13]
[sub_resource type="GDScript" id=1]
script/source = "extends GameMap
func _ready():
set_unlit(true)
"
[sub_resource type="CanvasItemMaterial" id=2]
light_mode = 1
[node name="map" type="Node2D"]
z_as_relative = false
script = SubResource( 1 )
[node name="darkness" type="CanvasModulate" parent="."]
visible = false
color = Color( 0, 0, 0, 1 )
[node name="editor" type="Node2D" parent="."]
[node name="deepspace" type="Sprite" parent="."]
material = SubResource( 2 )
texture = ExtResource( 7 )
region_enabled = true
region_rect = Rect2( 0, 0, 10000, 10000 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
[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
occluder_light_mask = -2147483647
format = 1
tile_data = PoolIntArray( 262137, 0, 0, 262138, 0, 0, 262139, 0, 0, 262140, 0, 0, 262141, 0, 0, 262142, 0, 0, 262143, 0, 0, 196608, 0, 0, 196609, 0, 0, 196610, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 196615, 0, 0, 196616, 0, 0, 196617, 0, 0, 196618, 0, 0, 196619, 0, 0, 196620, 0, 0, 196621, 0, 0, 196622, 0, 0, 196623, 0, 0, 196624, 0, 0, 196625, 0, 0, 196626, 0, 0, 196627, 0, 0, 327673, 0, 0, 327674, 0, 0, 327675, 0, 0, 327676, 0, 0, 327677, 0, 0, 327678, 0, 0, 327679, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 0, 0, 262147, 0, 0, 262148, 0, 0, 262149, 0, 0, 262150, 0, 0, 262151, 0, 0, 262152, 0, 0, 262153, 0, 0, 262154, 0, 0, 262155, 0, 0, 262156, 0, 0, 262157, 0, 0, 262158, 0, 0, 262159, 0, 0, 262160, 0, 0, 262161, 0, 0, 262162, 0, 0, 262163, 0, 0, 393209, 0, 0, 393210, 0, 0, 393211, 0, 0, 393212, 0, 0, 393213, 0, 0, 393214, 0, 0, 393215, 0, 0, 327680, 0, 0, 327681, 0, 0, 327682, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 327689, 0, 0, 327690, 0, 0, 327691, 0, 0, 327692, 0, 0, 327693, 0, 0, 327694, 0, 0, 327695, 0, 0, 327696, 0, 0, 327697, 0, 0, 327698, 0, 0, 327699, 0, 0, 458745, 0, 0, 458746, 0, 0, 458747, 0, 0, 458748, 0, 0, 458749, 0, 0, 458750, 0, 0, 458751, 0, 0, 393216, 0, 0, 393217, 0, 0, 393218, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 393222, 0, 0, 393223, 0, 0, 393224, 0, 0, 393225, 0, 0, 393226, 0, 0, 393227, 0, 0, 393228, 0, 0, 393229, 0, 0, 393230, 0, 0, 393231, 0, 0, 393232, 0, 0, 393233, 0, 0, 393234, 0, 0, 393235, 0, 0, 524281, 0, 0, 524282, 0, 0, 524283, 0, 0, 524284, 0, 0, 524285, 0, 0, 524286, 0, 0, 524287, 0, 0, 458752, 0, 0, 458753, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 458758, 0, 0, 458759, 0, 0, 458760, 0, 0, 458761, 0, 0, 458762, 0, 0, 458763, 0, 0, 458764, 0, 0, 458765, 0, 0, 458766, 0, 0, 458767, 0, 0, 458768, 0, 0, 458769, 0, 0, 458770, 0, 0, 458771, 0, 0, 589817, 0, 0, 589818, 0, 0, 589819, 0, 0, 589820, 0, 0, 589821, 0, 0, 589822, 0, 0, 589823, 0, 0, 524288, 0, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 0, 0, 524293, 0, 0, 524294, 0, 0, 524295, 0, 0, 524296, 0, 0, 524297, 0, 0, 524298, 0, 0, 524299, 0, 0, 524300, 0, 0, 524301, 0, 0, 524302, 0, 0, 524303, 0, 0, 524304, 0, 0, 524305, 0, 0, 524306, 0, 0, 524307, 0, 0, 655353, 0, 0, 655354, 0, 0, 655355, 0, 0, 655356, 0, 0, 655357, 0, 0, 655358, 0, 0, 655359, 0, 0, 589824, 0, 0, 589825, 0, 0, 589826, 0, 0, 589827, 0, 0, 589828, 0, 0, 589829, 0, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 0, 0, 589834, 0, 0, 589835, 0, 0, 589836, 0, 0, 589837, 0, 0, 589838, 0, 0, 589839, 0, 0, 589840, 0, 0, 589841, 0, 0, 589842, 0, 0, 589843, 0, 0, 720889, 0, 0, 720890, 0, 0, 720891, 0, 0, 720892, 0, 0, 720893, 0, 0, 720894, 0, 0, 720895, 0, 0, 655360, 0, 0, 655361, 0, 0, 655362, 0, 0, 655363, 0, 0, 655364, 0, 0, 655365, 0, 0, 655366, 0, 0, 655367, 0, 0, 655368, 0, 0, 655369, 0, 0, 655370, 0, 0, 655371, 0, 0, 655372, 0, 0, 655373, 0, 0, 655374, 0, 0, 655375, 0, 0, 655376, 0, 0, 655377, 0, 0, 655378, 0, 0, 655379, 0, 0, 786425, 0, 0, 786426, 0, 0, 786427, 0, 0, 786428, 0, 0, 786429, 0, 0, 786430, 0, 0, 786431, 0, 0, 720896, 0, 0, 720897, 0, 0, 720898, 0, 0, 720899, 0, 0, 720900, 0, 0, 720901, 0, 0, 720902, 0, 0, 720903, 0, 0, 720904, 0, 0, 720905, 0, 0, 720906, 0, 0, 720907, 0, 0, 720908, 0, 0, 720909, 0, 0, 720910, 0, 0, 720911, 0, 0, 720912, 0, 0, 720913, 0, 0, 720914, 0, 0, 720915, 0, 0, 851961, 0, 0, 851962, 0, 0, 851963, 0, 0, 851964, 0, 0, 851965, 0, 0, 851966, 0, 0, 851967, 0, 0, 786432, 0, 0, 786433, 0, 0, 786434, 0, 0, 786435, 0, 0, 786436, 0, 0, 786437, 0, 0, 786438, 0, 0, 786439, 0, 0, 786440, 0, 0, 786441, 0, 0, 786442, 0, 0, 786443, 0, 0, 786444, 0, 0, 786445, 0, 0, 786446, 0, 0, 786447, 0, 0, 786448, 0, 0, 786449, 0, 0, 786450, 0, 0, 786451, 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
occluder_light_mask = -2147483647
format = 1
tile_data = PoolIntArray( 393212, 0, 131072, 393213, 0, 65536, 393214, 0, 65536, 393215, 0, 65536, 327680, 0, 65536, 327681, 0, 65536, 327682, 0, 65536, 327683, 0, 65536, 327684, 0, 262144 )
[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
occluder_light_mask = -2147483647
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
occluder_light_mask = -2147483647
format = 1
tile_data = PoolIntArray( 196601, 3, 0, 196602, 3, 0, 196603, 3, 0, 196604, 3, 0, 196605, 3, 0, 196606, 3, 0, 196607, 3, 0, 131072, 3, 0, 131073, 3, 0, 131074, 3, 0, 131075, 3, 0, 131076, 3, 0, 131077, 3, 0, 131078, 3, 0, 131079, 3, 0, 131080, 3, 0, 131081, 3, 0, 131082, 3, 0, 131083, 3, 0, 131084, 3, 0, 131085, 3, 0, 131086, 3, 0, 131087, 3, 0, 131088, 3, 0, 131089, 3, 0, 131090, 3, 0, 131091, 3, 0, 196628, 3, 0, 262164, 3, 0, 327700, 3, 0, 393236, 3, 0, 458772, 3, 0, 524308, 3, 0, 589844, 3, 0, 655380, 3, 0, 720916, 3, 0, 786452, 3, 0, 917497, 3, 0, 917498, 3, 0, 917499, 3, 0, 917500, 3, 0, 917501, 3, 0, 917502, 3, 0, 917503, 3, 0, 851968, 3, 0, 851969, 3, 0, 851970, 3, 0, 851971, 3, 0, 851972, 3, 0, 851973, 3, 0, 851974, 3, 0, 851975, 3, 0, 851976, 3, 0, 851977, 3, 0, 851978, 3, 0, 851979, 3, 0, 851980, 3, 0, 851981, 3, 0, 851982, 3, 0, 851983, 3, 0, 851984, 3, 0, 851985, 3, 0, 851986, 3, 0, 851987, 3, 0 )
script = ExtResource( 3 )
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
[node name="engines" type="Node2D" parent="."]
modulate = Color( 0.980392, 0.980392, 0.980392, 1 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
[node name="Engine" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -320, 321 )
direction = 0
[node name="Engine2" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -320, 208 )
direction = 0
[node name="Engine3" parent="engines" instance=ExtResource( 10 )]
position = Vector2( -320, 96 )
direction = 0
[node name="objects" type="Node2D" parent="."]
z_index = 10
__meta__ = {
"_editor_description_": ""
}
[node name="Computer" parent="objects" instance=ExtResource( 6 )]
position = Vector2( -64, 128 )
[node name="Computer2" parent="objects" instance=ExtResource( 6 )]
position = Vector2( -32, 128 )
computer_type = 1
[node name="Computer3" parent="objects" instance=ExtResource( 6 )]
position = Vector2( 0, 128 )
computer_type = 2
[node name="Computer4" parent="objects" instance=ExtResource( 6 )]
position = Vector2( 32, 128 )
computer_type = 3
[node name="Computer5" parent="objects" instance=ExtResource( 6 )]
position = Vector2( -96, 128 )
computer_type = 4
[node name="Computer6" parent="objects" instance=ExtResource( 6 )]
position = Vector2( -128, 128 )
computer_type = 5
[node name="SMES2" parent="objects" instance=ExtResource( 12 )]
position = Vector2( 128, 128 )
[node name="Computer7" parent="objects" instance=ExtResource( 6 )]
position = Vector2( 64, 128 )
computer_type = 6
[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("../../objects/Computer6") ]
flow = 1
[node name="ElectricSocket5" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( -96, 160 )
connectionPaths = [ NodePath("../../objects/Computer5") ]
flow = 1
[node name="ElectricSocket6" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( -64, 160 )
connectionPaths = [ NodePath("../../objects/Computer") ]
flow = 1
[node name="ElectricSocket7" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( -32, 160 )
connectionPaths = [ NodePath("../../objects/Computer2") ]
flow = 1
[node name="ElectricSocket8" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 0, 160 )
connectionPaths = [ NodePath("../../objects/Computer3") ]
flow = 1
[node name="ElectricSocket9" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 32, 160 )
connectionPaths = [ NodePath("../../objects/Computer4") ]
flow = 1
[node name="ElectricSocket10" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 64, 160 )
connectionPaths = [ NodePath("../../objects/Computer7") ]
flow = 1
[node name="ElectricSocket3" parent="sockets" instance=ExtResource( 13 )]
position = Vector2( 128, 160 )
connectionPaths = [ NodePath("../../objects/SMES2") ]
[node name="lights" type="Node2D" parent="."]
modulate = Color( 0.980392, 0.980392, 0.980392, 1 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
[node name="pois" type="Node2D" parent="."]
z_index = 999
[node name="SpawnpointPlayer" parent="pois" instance=ExtResource( 5 )]
position = Vector2( 80, 272 )