[gd_scene load_steps=9 format=2]

[ext_resource path="res://Scenes/Maps/odyssey.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/Rendering/SSLO.shader" type="Shader" id=2]
[ext_resource path="res://Scenes/UI.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/Rendering/SSLO.gd" type="Script" id=4]
[ext_resource path="res://Scenes/Game.gd" type="Script" id=5]
[ext_resource path="res://test.png" type="Texture" id=6]

[sub_resource type="GDScript" id=1]
script/source = "extends Node2D

enum Map { RUNTIME, ODYSSEY }

export(Map) var mapToLoad = Map.RUNTIME

const playerRes = preload(\"res://Actors/Player/Player.tscn\")

var map = null
var player = null

func initiate():
	player = playerRes.instance()
	player.is_controlled = true
	map = $map
	var spawnpoints = map.get_pois(POIData.POIType.SpawnPoint, POIData.POIClass.Player)
	if spawnpoints.size() > 0:
		player.transform.origin = (spawnpoints[0] as Node2D).transform.origin
	else:
		print(\"Map does not have Player spawnpoint POI! Spawning at origin (very bad)\")
	$players.add_child(player)
	$\"/root/scene\".lighting.player = player
	var occlusion_mask = map.get_occlusion_mask()
	$\"/root/scene\".lighting.occlusion_mask = occlusion_mask
	$\"/root/scene\".lighting.occlusion_offset = map.get_occlusion_offset()
	print(map.get_occlusion_offset())
	($\"/root/scene/CanvasLayer/TextureRect\" as TextureRect).texture = occlusion_mask

func initiate_editor():
	map = $map
	var occlusion_mask = map.get_occlusion_mask()
	$\"/root/scene\".lighting.occlusion_mask = occlusion_mask
	($\"/root/scene/CanvasLayer/TextureRect\" as TextureRect).texture = occlusion_mask
"

[sub_resource type="ShaderMaterial" id=2]
shader = ExtResource( 2 )
shader_param/viewport_rect = Plane( 0, 0, 1280, 800 )
shader_param/occlusion_rect = Plane( -12, -9, 32, 33 )
shader_param/cell_div = 0.03125
shader_param/diffusion = 0.3
shader_param/scale_factor = 0.5
shader_param/occlusion_mask = ExtResource( 6 )

[node name="scene" type="Node"]
script = ExtResource( 5 )

[node name="systems" type="Node" parent="."]

[node name="world" type="Node2D" parent="."]
scale = Vector2( 2, 2 )
script = SubResource( 1 )

[node name="map" parent="world" instance=ExtResource( 1 )]

[node name="players" type="Node2D" parent="world"]

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="TextureRect" type="TextureRect" parent="CanvasLayer"]
visible = false
margin_right = 20.0
margin_bottom = 15.0
rect_scale = Vector2( 4, 4 )
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}

[node name="sslo" type="ColorRect" parent="CanvasLayer"]
material = SubResource( 2 )
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
color = Color( 0, 0, 0, 0.764706 )
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ui" parent="CanvasLayer" instance=ExtResource( 3 )]
visible = false
