This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
odyssey-old/Actors/Objects/ElectricSocket/ElectricSocket.tscn

65 lines
1.7 KiB
Text
Raw Permalink Normal View History

2020-07-08 12:30:46 +00:00
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Graphics/tgstation/socket.png" type="Texture" id=1]
[ext_resource path="res://Actors/Objects/ElectricSocket/ElectricSocket.gd" type="Script" id=2]
2020-07-08 22:12:14 +00:00
[sub_resource type="Shader" id=1]
2020-07-08 12:30:46 +00:00
code = "shader_type canvas_item;
render_mode blend_mix;
uniform vec4 cable_color: hint_color;
void fragment() {
vec4 col = texture(TEXTURE, UV);
if (col.r/col.g > 2.) {
2020-07-08 22:12:14 +00:00
if (length(cable_color) == 0.) {
if (UV.y > 0.6 && UV.y < 0.85) {
if (int(UV.x * 200.) % 12 > 4) {
col.rgb = vec3(0.94, 0.08, 0.08) * length(col.rgb);
} else {
col.rgb = vec3(0.04, 0.58, 0.98) * length(col.rgb);
}
} else {
if (int(UV.y * 200.) % 12 > 4) {
col.rgb = vec3(0.94, 0.08, 0.08) * length(col.rgb);
} else {
col.rgb = vec3(0.04, 0.58, 0.98) * length(col.rgb);
}
}
} else {
col.rgb = cable_color.rgb * length(col.rgb);
}
2020-07-08 12:30:46 +00:00
}
COLOR = col;
}"
custom_defines = ""
2020-07-08 22:12:14 +00:00
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/cable_color = Color( 0, 0, 0, 0 )
2020-07-08 12:30:46 +00:00
2020-07-08 22:12:14 +00:00
[sub_resource type="CircleShape2D" id=3]
2020-07-08 12:30:46 +00:00
radius = 12.0
[node name="ElectricSocket" type="Area2D"]
z_index = -8
2020-07-08 12:30:46 +00:00
collision_layer = 4
collision_mask = 2147483652
script = ExtResource( 2 )
2020-07-08 22:12:14 +00:00
direction = 2
2020-07-08 12:30:46 +00:00
source_color = Color( 0.937255, 0.0823529, 0.0823529, 1 )
sink_color = Color( 0.0901961, 0.533333, 0.960784, 1 )
2020-07-08 22:12:14 +00:00
bidirectional_color = Color( 0, 0, 0, 0 )
flow = 2
2020-07-08 12:30:46 +00:00
[node name="socket" type="Sprite" parent="."]
2020-07-08 22:12:14 +00:00
material = SubResource( 2 )
2020-07-08 12:30:46 +00:00
texture = ExtResource( 1 )
centered = false
region_enabled = true
2020-07-08 22:12:14 +00:00
region_rect = Rect2( 32, 0, 32, 32 )
2020-07-08 12:30:46 +00:00
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 16, 16 )
2020-07-08 22:12:14 +00:00
shape = SubResource( 3 )