zoned darkness (with workaround)
This commit is contained in:
parent
485de5791b
commit
833fc90b71
7 changed files with 41 additions and 9 deletions
|
@ -13,6 +13,10 @@ var open = false
|
|||
|
||||
onready var activationRange = $ActivationRange as ActivationRange
|
||||
|
||||
func _ready():
|
||||
if not Engine.editor_hint:
|
||||
activationRange.visible = true
|
||||
|
||||
func set_type(val):
|
||||
computer_type = val
|
||||
match computer_type:
|
||||
|
|
|
@ -146,6 +146,7 @@ margin_bottom = 59.6092
|
|||
rect_scale = Vector2( 0.5, 0.5 )
|
||||
|
||||
[node name="ActivationRange" type="Area2D" parent="."]
|
||||
visible = false
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ActivationRange"]
|
||||
|
|
|
@ -5,7 +5,8 @@ onready var activationRange = $ActivationRange as ActivationRange
|
|||
signal changed(open)
|
||||
|
||||
func _ready():
|
||||
activationRange.visible = true
|
||||
if not Engine.editor_hint:
|
||||
activationRange.visible = true
|
||||
|
||||
func set_open(open: bool):
|
||||
if open:
|
||||
|
|
|
@ -10,7 +10,8 @@ export var lit = true setget set_lit
|
|||
onready var activationRange = $ActivationRange as ActivationRange
|
||||
|
||||
func _ready():
|
||||
$Light2D.set_meta("_edit_lock_", true)
|
||||
if not Engine.editor_hint:
|
||||
activationRange.visible = true
|
||||
|
||||
func set_direction(dir):
|
||||
direction = dir
|
||||
|
|
|
@ -38,6 +38,7 @@ __meta__ = {
|
|||
shape = SubResource( 1 )
|
||||
|
||||
[node name="ActivationRange" type="Area2D" parent="."]
|
||||
visible = false
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ActivationRange"]
|
||||
|
|
17
Scenes/Map.gd
Executable file → Normal file
17
Scenes/Map.gd
Executable file → Normal file
|
@ -1,3 +1,4 @@
|
|||
tool
|
||||
extends Node2D
|
||||
|
||||
class_name Map
|
||||
|
@ -15,7 +16,23 @@ const EPSILON = 0.01
|
|||
export(NodePath) var tilemap_path
|
||||
onready var tilemap = get_node(tilemap_path) as MapTiles
|
||||
|
||||
export var unlit = false setget set_unlit
|
||||
onready var darkness = $darkness
|
||||
|
||||
func _ready():
|
||||
set_unlit(false)
|
||||
if not Engine.editor_hint:
|
||||
$editorDarkness.queue_free()
|
||||
|
||||
func set_unlit(val):
|
||||
unlit = val
|
||||
if darkness:
|
||||
darkness.visible = not val
|
||||
|
||||
func _process(delta):
|
||||
if Engine.editor_hint:
|
||||
return
|
||||
|
||||
if abs(ship_direction - current_ship_direction) < EPSILON:
|
||||
current_ship_direction = ship_direction
|
||||
else:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://Graphics/tgstation/2x2.tres" type="TileSet" id=1]
|
||||
[ext_resource path="res://Graphics/tgstation/1x1.tres" type="TileSet" id=2]
|
||||
|
@ -8,6 +8,7 @@
|
|||
[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://Actors/Objects/Lightbulb/Lightbulb.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://Graphics/white.png" type="Texture" id=9]
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id=1]
|
||||
light_mode = 1
|
||||
|
@ -15,13 +16,20 @@ light_mode = 1
|
|||
[node name="map" type="Node2D"]
|
||||
script = ExtResource( 5 )
|
||||
tilemap_path = NodePath("2x2")
|
||||
unlit = true
|
||||
|
||||
[node name="CanvasModulate" type="CanvasModulate" parent="."]
|
||||
[node name="editorDarkness" type="CanvasModulate" parent="."]
|
||||
visible = false
|
||||
color = Color( 0, 0, 0, 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true,
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="darkness" type="Node2D" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="Light2D" type="Light2D" parent="darkness"]
|
||||
position = Vector2( 208, 256 )
|
||||
scale = Vector2( 27, 10 )
|
||||
texture = ExtResource( 9 )
|
||||
mode = 1
|
||||
|
||||
[node name="deepspace" type="Sprite" parent="."]
|
||||
material = SubResource( 1 )
|
||||
|
@ -68,7 +76,6 @@ position = Vector2( 192, 384 )
|
|||
[node name="ControlComp" parent="objects" instance=ExtResource( 6 )]
|
||||
position = Vector2( 576, 256 )
|
||||
direction = 0
|
||||
computer_type = 0
|
||||
|
||||
[node name="CommsComp" parent="objects" instance=ExtResource( 6 )]
|
||||
position = Vector2( 576, 224 )
|
||||
|
|
Reference in a new issue