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

63 lines
1.7 KiB
Plaintext

[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]
[sub_resource type="Shader" id=1]
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.) {
if (length(cable_color) == 0.) {
if (UV.y > 0.6 && UV.y < 0.85) {
if (mod(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 (mod(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);
}
}
COLOR = col;
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/cable_color = Color( 0, 0, 0, 0 )
[sub_resource type="CircleShape2D" id=3]
radius = 12.0
[node name="ElectricSocket" type="Area2D"]
collision_layer = 4
collision_mask = 2147483652
script = ExtResource( 2 )
direction = 2
source_color = Color( 0.937255, 0.0823529, 0.0823529, 1 )
sink_color = Color( 0.0901961, 0.533333, 0.960784, 1 )
bidirectional_color = Color( 0, 0, 0, 0 )
flow = 2
[node name="socket" type="Sprite" parent="."]
material = SubResource( 2 )
texture = ExtResource( 1 )
centered = false
region_enabled = true
region_rect = Rect2( 32, 0, 32, 32 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 16, 16 )
shape = SubResource( 3 )