diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2022-09-07 14:16:17 -0400 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2022-09-07 14:16:17 -0400 |
| commit | 366761197034a20d444282431e4a8edeb7882840 (patch) | |
| tree | 63d7b11eccbb499aef8f5afc3634945c63c14ff5 /scenes/environment | |
| parent | c232b92e2dde1277324d1f89d0e75ae641e4ac3b (diff) | |
whoops, fixed reorg
Diffstat (limited to 'scenes/environment')
| -rw-r--r-- | scenes/environment/CaptureFlag.gd | 84 | ||||
| -rw-r--r-- | scenes/environment/CaptureFlag.tscn | 93 | ||||
| -rw-r--r-- | scenes/environment/Water.tscn | 109 |
3 files changed, 0 insertions, 286 deletions
diff --git a/scenes/environment/CaptureFlag.gd b/scenes/environment/CaptureFlag.gd deleted file mode 100644 index 81a9fc5..0000000 --- a/scenes/environment/CaptureFlag.gd +++ /dev/null @@ -1,84 +0,0 @@ -extends Spatial - -onready var flag = $flag_mesh -const flag_high : float = 5.4 -const flag_low : float = 1.0 -var capture_speed : float = 1 - -var state = "IDLE_HIGH" #IDLE_HIGH, IDLE_LOW, CAPTURING, HOISTING. capturing cannot be blocked, hoisting can - -var teams_in_zone = [] -var foreign_in_zone = false -var team = "NONE" - -# Called when the node enters the scene tree for the first time. -func _ready(): - $flag_mesh/Label.text = team - -remotesync func update_text(text): - $flag_mesh/Label.text = text - -remote func update_position(height): - flag.transform.origin.y = height - -remotesync func capture(): - $flag_mesh/capture_audio.play() - -func _physics_process(delta): - if is_network_master(): - teams_in_zone = [] - foreign_in_zone = false - for body in $CaptureArea.get_overlapping_bodies(): - if body.is_in_group("player") and !(body.team in teams_in_zone): - if body.team != team: - foreign_in_zone = true - teams_in_zone.append(body.team) - if state == "IDLE_HIGH" and foreign_in_zone: - state = "CAPTURING" - if state == "CAPTURING" and !foreign_in_zone: - state = "IDLE_HIGH" - if state == "IDLE_LOW" and team in teams_in_zone: - state = "HOISTING" - if state == "HOISTING" and !(team in teams_in_zone): - state = "IDLE_LOW" - - if state == "CAPTURING": - if flag.transform.origin.y > flag_low: - flag.transform.origin.y -= delta * capture_speed - rpc("update_position",flag.transform.origin.y) - else: - flag.transform.origin.y = flag_low - state = "IDLE_LOW" - team = "NONE" - rpc("update_text",team) - if state == "IDLE_HIGH": - if flag.transform.origin.y <= flag_high: - flag.transform.origin.y += delta * capture_speed - rpc("update_position",flag.transform.origin.y) - if state == "IDLE_LOW": - if flag.transform.origin.y > flag_low: - flag.transform.origin.y -= delta * capture_speed - rpc("update_position",flag.transform.origin.y) - else: - team = "NONE" - rpc("update_text",team) - flag.transform.origin.y = flag_low - if team == "NONE" and len(teams_in_zone) == 1: - team = teams_in_zone[0] - rpc("update_text",team) - state = "HOISTING" - if state == "HOISTING": - if len(teams_in_zone) == 1: - flag.transform.origin.y += delta * capture_speed - rpc("update_position",flag.transform.origin.y) - if flag.transform.origin.y >= flag_high: - rpc("capture") - state = "IDLE_HIGH" - -func mp_init(init_info): - flag.transform.origin.y = init_info["height"] - team = init_info["team"] - $flag_mesh/Label.text = team - -func get_init_info(): #info necessary to replicate item - return {"height" : flag.transform.origin.y, "team" : team } diff --git a/scenes/environment/CaptureFlag.tscn b/scenes/environment/CaptureFlag.tscn deleted file mode 100644 index 1347f64..0000000 --- a/scenes/environment/CaptureFlag.tscn +++ /dev/null @@ -1,93 +0,0 @@ -[gd_scene load_steps=17 format=2] - -[ext_resource path="res://textures/conc_slabs01_c.png" type="Texture" id=1] -[ext_resource path="res://theming/FreeMono.otf" type="DynamicFontData" id=2] -[ext_resource path="res://scenes/environment/CaptureFlag.gd" type="Script" id=3] -[ext_resource path="res://sounds/capture.wav" type="AudioStream" id=4] - -[sub_resource type="CylinderShape" id=8] -height = 6.0 -radius = 0.05 - -[sub_resource type="ConvexPolygonShape" id=9] -points = PoolVector3Array( -1, -0.25, -1, -1, 0.25, -1, 1, -0.25, -1, -1, -0.25, 1, -1, 0.25, 1, 1, 0.25, -1, 1, -0.25, 1, 1, 0.25, 1 ) - -[sub_resource type="SpatialMaterial" id=1] -albedo_texture = ExtResource( 1 ) - -[sub_resource type="CubeMesh" id=2] -material = SubResource( 1 ) -size = Vector3( 2, 0.5, 2 ) - -[sub_resource type="OpenSimplexNoise" id=4] - -[sub_resource type="NoiseTexture" id=5] -width = 64 -height = 64 -seamless = true -noise = SubResource( 4 ) - -[sub_resource type="SpatialMaterial" id=6] -albedo_texture = SubResource( 5 ) - -[sub_resource type="CylinderMesh" id=7] -material = SubResource( 6 ) -top_radius = 0.05 -bottom_radius = 0.05 -height = 6.0 - -[sub_resource type="BoxShape" id=3] -extents = Vector3( 2, 2.24192, 2 ) - -[sub_resource type="SpatialMaterial" id=10] -params_cull_mode = 2 - -[sub_resource type="QuadMesh" id=11] -material = SubResource( 10 ) - -[sub_resource type="DynamicFont" id=12] -size = 32 -outline_size = 3 -font_data = ExtResource( 2 ) - -[node name="CaptureFlag" type="Spatial"] -script = ExtResource( 3 ) - -[node name="Collider" type="StaticBody" parent="."] - -[node name="CollisionShape" type="CollisionShape" parent="Collider"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0 ) -shape = SubResource( 8 ) - -[node name="CollisionShape2" type="CollisionShape" parent="Collider"] -shape = SubResource( 9 ) - -[node name="base_mesh" type="MeshInstance" parent="."] -mesh = SubResource( 2 ) - -[node name="pole_mesh" type="MeshInstance" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.97816, 0 ) -mesh = SubResource( 7 ) - -[node name="CaptureArea" type="Area" parent="."] -collision_layer = 32768 -collision_mask = 32768 - -[node name="CollisionShape" type="CollisionShape" parent="CaptureArea"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.46129, 0 ) -shape = SubResource( 3 ) - -[node name="flag_mesh" type="MeshInstance" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.512, 5.4, 0 ) -mesh = SubResource( 11 ) - -[node name="Label" type="Label3D" parent="flag_mesh"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.653017, 0 ) -billboard = 1 -font = SubResource( 12 ) - -[node name="capture_audio" type="AudioStreamPlayer3D" parent="flag_mesh"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.512, -0.014648, 0 ) -stream = ExtResource( 4 ) -attenuation_model = 3 -max_distance = 200.0 diff --git a/scenes/environment/Water.tscn b/scenes/environment/Water.tscn deleted file mode 100644 index 04410b1..0000000 --- a/scenes/environment/Water.tscn +++ /dev/null @@ -1,109 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://textures/WaterC.jpg" type="Texture" id=1] -[ext_resource path="res://textures/WaterA.jpg" type="Texture" id=2] - -[sub_resource type="QuadMesh" id=1] -size = Vector2( 2, 2 ) - -[sub_resource type="Shader" id=2] -code = "shader_type spatial; -render_mode world_vertex_coords, cull_disabled; - -uniform int ShaderID = 4; - -uniform vec4 Color : hint_color; -uniform vec4 BackgroundColor : hint_color; -uniform sampler2D Texture : hint_albedo; -uniform sampler2D BackgroundTexture : hint_albedo; -varying vec3 TriplanarPosistion; -varying vec3 PowerNormal; -uniform vec3 UVScale = vec3(1); -uniform vec3 UVOffset; -uniform float Transparent = 1.0; -uniform float Power = 0.0; -uniform vec4 EmissionColor : hint_color; - -void vertex() -{ - vec2 Pos = vec2(0); - Pos.x += TIME * 0.05; - TANGENT = vec3(0.0, 0.0, -1.0) * abs(NORMAL.x); - TANGENT += vec3(1.0, 0.0, 0.0) * abs(NORMAL.y); - TANGENT += vec3(1.0, 0.0, 0.0) * abs(NORMAL.z); - TANGENT = normalize(TANGENT); - BINORMAL = vec3(0.0, -1.0, 0.0) * abs(NORMAL.x); - BINORMAL += vec3(0.0, 0.0, 1.0) * abs(NORMAL.y); - BINORMAL += vec3(0.0, -1.0, 0.0) * abs(NORMAL.z); - BINORMAL = normalize(BINORMAL); - PowerNormal = pow(abs(NORMAL), vec3(1.0)); - PowerNormal /= dot(PowerNormal, vec3(1.0)); - TriplanarPosistion = VERTEX * UVScale + UVOffset;// + vec3(Pos.x, Pos.y, 0); - TriplanarPosistion *= vec3(1.0, -1.0, 1.0); -} - - -vec4 TriplanarTexture(sampler2D TSampler,vec3 TWeights,vec3 TTriplanarPosition) -{ - vec4 Sampler = vec4(0.0); - Sampler += texture(TSampler, TTriplanarPosition.xy) * TWeights.z; - Sampler += texture(TSampler, TTriplanarPosition.xz) * TWeights.y; - Sampler += texture(TSampler, TTriplanarPosition.zy * vec2(-1.0, 1.0)) * TWeights.x; - return Sampler; -} - - - -void fragment() -{ - vec3 NewOffset = vec3(0); - NewOffset.x = cos(TIME + TriplanarPosistion.x * 2.0) * 0.05; - NewOffset.z = cos(TIME + TriplanarPosistion.z) * 0.05; - - ALBEDO = TriplanarTexture(BackgroundTexture, PowerNormal, TriplanarPosistion + NewOffset).rgb * BackgroundColor.rgb; - ALBEDO += TriplanarTexture(Texture, PowerNormal, TriplanarPosistion + NewOffset * 5.1).rgb * Color.rgb; - EMISSION = ALBEDO * Power; - - float depth = texture(DEPTH_TEXTURE, SCREEN_UV).r; - depth = depth*2.0 - 1.0; - depth = PROJECTION_MATRIX[3][2] / (depth + PROJECTION_MATRIX[2][2]); - depth = depth + VERTEX.z; - depth = exp(-depth*0.05); - //depth *= 0.01; - ALPHA = clamp(1.0-depth, Transparent, 1.0); -} - - - - -" - -[sub_resource type="ShaderMaterial" id=3] -render_priority = -100 -shader = SubResource( 2 ) -shader_param/ShaderID = 4 -shader_param/Color = Color( 0.270588, 0.372549, 0.423529, 0.490196 ) -shader_param/BackgroundColor = Color( 0.560784, 0.560784, 0.560784, 1 ) -shader_param/UVScale = Vector3( 0.05, 0.05, 0.05 ) -shader_param/UVOffset = null -shader_param/Transparent = 0.4 -shader_param/Power = 0.2 -shader_param/EmissionColor = null -shader_param/Texture = ExtResource( 2 ) -shader_param/BackgroundTexture = ExtResource( 1 ) - -[sub_resource type="BoxShape" id=4] - -[node name="Water" type="Spatial"] - -[node name="MeshInstance" type="MeshInstance" parent="."] -transform = Transform( 1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0 ) -mesh = SubResource( 1 ) -material/0 = SubResource( 3 ) - -[node name="WaterArea" type="Area" parent="."] -collision_layer = 4 - -[node name="CollisionShape" type="CollisionShape" parent="WaterArea"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) -shape = SubResource( 4 ) |
