Compare commits

...

2 Commits

Author SHA1 Message Date
Spencer Killen 6d491f60c7
a 2023-11-12 13:53:03 -07:00
Spencer Killen 3fbdf2ded0
a 2023-11-12 13:52:55 -07:00
9 changed files with 184 additions and 12 deletions

28
godot/UI/TAS UI/TAS UI.gd Normal file
View File

@ -0,0 +1,28 @@
extends Control
func _input(event):
var f: Callable
if event.is_pressed():
f = press
else:
f = release
if event.is_action("regress"):
f.call($FrameButtons/RegressButton)
elif event.is_action("advance"):
f.call($FrameButtons/AdvanceButton)
elif event.is_action("increment"):
if TAS_System.IsIncrementingFrames:
f.call($TASButtons/StopIncrementButton)
else:
f.call($TASButtons/StartIncrementButton)
func press(btn: Button):
btn.button_pressed = true
btn.pressed.emit()
btn.button_down.emit()
func release(btn: Button):
btn.button_pressed = false
btn.button_up.emit()

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://b1uf31ed6h0ir"] [gd_scene load_steps=9 format=3 uid="uid://b1uf31ed6h0ir"]
[ext_resource type="Script" path="res://UI/TAS UI/CurrentFrameLabel.cs" id="1_27u4w"] [ext_resource type="Script" path="res://UI/TAS UI/CurrentFrameLabel.cs" id="1_27u4w"]
[ext_resource type="Script" path="res://UI/TAS UI/TAS UI.gd" id="1_ytl0x"]
[ext_resource type="Script" path="res://UI/TAS UI/RegressButton.cs" id="2_fhmsa"] [ext_resource type="Script" path="res://UI/TAS UI/RegressButton.cs" id="2_fhmsa"]
[ext_resource type="Script" path="res://UI/TAS UI/Label2.gd" id="2_otida"] [ext_resource type="Script" path="res://UI/TAS UI/Label2.gd" id="2_otida"]
[ext_resource type="Script" path="res://UI/TAS UI/AdvanceButton.cs" id="3_0ti6q"] [ext_resource type="Script" path="res://UI/TAS UI/AdvanceButton.cs" id="3_0ti6q"]
@ -16,8 +17,10 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 2 mouse_filter = 2
script = ExtResource("1_ytl0x")
[node name="DEBUG" type="Control" parent="."] [node name="DEBUG" type="Control" parent="."]
visible = false
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -51,6 +54,7 @@ text = "Current Frame: 0"
script = ExtResource("2_otida") script = ExtResource("2_otida")
[node name="FrameButtons" type="Control" parent="."] [node name="FrameButtons" type="Control" parent="."]
visible = false
layout_mode = 1 layout_mode = 1
anchors_preset = 7 anchors_preset = 7
anchor_left = 0.5 anchor_left = 0.5
@ -69,6 +73,7 @@ anchors_preset = -1
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_vertical = 2 grow_vertical = 2
focus_mode = 0
text = "Regress" text = "Regress"
script = ExtResource("2_fhmsa") script = ExtResource("2_fhmsa")
@ -79,11 +84,13 @@ anchor_left = 0.5
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_vertical = 2 grow_vertical = 2
focus_mode = 0
disabled = true disabled = true
text = "Advance" text = "Advance"
script = ExtResource("3_0ti6q") script = ExtResource("3_0ti6q")
[node name="TASButtons" type="Control" parent="."] [node name="TASButtons" type="Control" parent="."]
visible = false
layout_mode = 1 layout_mode = 1
anchors_preset = 3 anchors_preset = 3
anchor_left = 1.0 anchor_left = 1.0
@ -101,6 +108,7 @@ anchors_preset = 10
anchor_right = 1.0 anchor_right = 1.0
offset_bottom = 31.0 offset_bottom = 31.0
grow_horizontal = 2 grow_horizontal = 2
focus_mode = 0
text = "Stop Increment" text = "Stop Increment"
script = ExtResource("4_4gd4c") script = ExtResource("4_4gd4c")
@ -114,6 +122,7 @@ offset_top = -15.5
offset_bottom = 15.5 offset_bottom = 15.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
focus_mode = 0
text = "Start Increment" text = "Start Increment"
script = ExtResource("5_5af83") script = ExtResource("5_5af83")
@ -126,5 +135,6 @@ anchor_bottom = 1.0
offset_top = -31.0 offset_top = -31.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 0 grow_vertical = 0
focus_mode = 0
text = "Reset Frames" text = "Reset Frames"
script = ExtResource("6_nwwkv") script = ExtResource("6_nwwkv")

View File

@ -4,6 +4,7 @@ extends Node3D
@export var initial_target: Node3D @export var initial_target: Node3D
var target: Targetable = null var target: Targetable = null
@export var sensitivity := 0.01 @export var sensitivity := 0.01
@export var controller_sensitivity := 0.04
@export var charge_time := 1.7 @export var charge_time := 1.7
@export var min_charge := 0.2 @export var min_charge := 0.2
@ -61,6 +62,10 @@ func _input(event):
$NoChargesSound.play() $NoChargesSound.play()
func _process(_delta): func _process(_delta):
if target.get_billiard().can_hit:
set_strobe(strobe_amount)
else:
set_strobe(0.0)
transform.origin = target.global_position transform.origin = target.global_position
%camera_spot.look_at(target.global_position) %camera_spot.look_at(target.global_position)
if not camera_tweening: if not camera_tweening:
@ -72,10 +77,12 @@ func _process(_delta):
if (camera.global_position - %camera_spot.global_position).length() <= epsilon and (camera.global_rotation - %camera_spot.global_rotation).length() <= epsilon: if (camera.global_position - %camera_spot.global_position).length() <= epsilon and (camera.global_rotation - %camera_spot.global_rotation).length() <= epsilon:
camera_tweening = false camera_tweening = false
if get_charge() >= 1.0: if get_charge() >= 1.0:
cancel_charge() cancel_charge()
var look := Input.get_vector("look_left", "look_right", "loop_up", "look_down")
rotate_view(look*controller_sensitivity)
func cancel_charge(): func cancel_charge():
%radial_ui.set_charge(0.0) %radial_ui.set_charge(0.0)
%ChargeSound.stop() %ChargeSound.stop()
@ -119,6 +126,7 @@ func rotate_view(amount: Vector2):
func set_target(node: Node3D, should_create_tween=true): func set_target(node: Node3D, should_create_tween=true):
camera_tweening = should_create_tween camera_tweening = should_create_tween
$AnimationPlayer.seek(0)
var ntarget = Targetable.is_targetable(node) var ntarget = Targetable.is_targetable(node)
var billiard = ntarget.get_billiard() var billiard = ntarget.get_billiard()
@ -130,3 +138,7 @@ func set_target(node: Node3D, should_create_tween=true):
target.unmake_target() target.unmake_target()
ntarget.make_target() ntarget.make_target()
target = ntarget target = ntarget
@export var strobe_amount: float = 0.0
func set_strobe(c: float):
target.set_strobe(c)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://drmb4sitb74fx"] [gd_scene load_steps=8 format=3 uid="uid://drmb4sitb74fx"]
[ext_resource type="Script" path="res://control_scheme/controller.gd" id="1_h3pjb"] [ext_resource type="Script" path="res://control_scheme/controller.gd" id="1_h3pjb"]
[ext_resource type="PackedScene" uid="uid://p2n48c8st55d" path="res://control_scheme/radial_ui.tscn" id="2_qidcb"] [ext_resource type="PackedScene" uid="uid://p2n48c8st55d" path="res://control_scheme/radial_ui.tscn" id="2_qidcb"]
@ -6,6 +6,27 @@
[ext_resource type="AudioStream" uid="uid://c5v6c6x05lqg3" path="res://audio/billiard-clack.wav" id="4_12r5s"] [ext_resource type="AudioStream" uid="uid://c5v6c6x05lqg3" path="res://audio/billiard-clack.wav" id="4_12r5s"]
[ext_resource type="AudioStream" uid="uid://bg07vavc0duo5" path="res://audio/error.mp3" id="5_l6rvw"] [ext_resource type="AudioStream" uid="uid://bg07vavc0duo5" path="res://audio/error.mp3" id="5_l6rvw"]
[sub_resource type="Animation" id="Animation_p1nwe"]
resource_name = "highlight_target"
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:strobe_amount")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [0.0, 0.3, 0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_e1dcv"]
_data = {
"highlight_target": SubResource("Animation_p1nwe")
}
[node name="controller" type="Node3D"] [node name="controller" type="Node3D"]
top_level = true top_level = true
script = ExtResource("1_h3pjb") script = ExtResource("1_h3pjb")
@ -30,3 +51,9 @@ stream = ExtResource("4_12r5s")
[node name="NoChargesSound" type="AudioStreamPlayer" parent="."] [node name="NoChargesSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("5_l6rvw") stream = ExtResource("5_l6rvw")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "highlight_target"
libraries = {
"": SubResource("AnimationLibrary_e1dcv")
}

View File

@ -24,10 +24,10 @@ func walk_meshes_post_order(parent: Node, f: Callable):
func change_all_materials(mesh: MeshInstance3D): func change_all_materials(mesh: MeshInstance3D):
for i in range(mesh.get_surface_override_material_count()): for i in range(mesh.get_surface_override_material_count()):
var original_mat: BaseMaterial3D = mesh.get_active_material(i) var original_mat: BaseMaterial3D = mesh.get_active_material(i)
var layer0 = original_mat.duplicate() var layer0: BaseMaterial3D = original_mat.duplicate()
var layer1 = preload("control_target_overlay.material").duplicate() var layer1: ShaderMaterial = preload("control_target_overlay.material").duplicate()
# Non-occlused # Non-occlused
var layer2 = original_mat.duplicate() var layer2: BaseMaterial3D = original_mat.duplicate()
layer0.next_pass = layer1 layer0.next_pass = layer1
layer1.next_pass = layer2 layer1.next_pass = layer2
@ -46,11 +46,30 @@ func change_all_materials(mesh: MeshInstance3D):
mesh.set_surface_override_material(i, layer0) mesh.set_surface_override_material(i, layer0)
func unchange_all_materials(mesh: MeshInstance3D): func unchange_all_materials(mesh: MeshInstance3D):
for i in range(mesh.get_surface_override_material_count()): for i in range(mesh.get_surface_override_material_count()):
var mat := mesh.get_active_material(i) var mat := mesh.get_active_material(i)
var layer2: StandardMaterial3D = mat.next_pass.next_pass var layer2: StandardMaterial3D = mat.next_pass.next_pass
mesh.set_surface_override_material(i, layer2)
layer2.transparency = BaseMaterial3D.TRANSPARENCY_DISABLED layer2.transparency = BaseMaterial3D.TRANSPARENCY_DISABLED
layer2.depth_draw_mode = BaseMaterial3D.DEPTH_DRAW_OPAQUE_ONLY layer2.depth_draw_mode = BaseMaterial3D.DEPTH_DRAW_OPAQUE_ONLY
layer2.emission_enabled = false
layer2.emission = Color(1.0, 1.0, 1.0)
mesh.set_surface_override_material(i, layer2.duplicate())
func set_strobe(color: float):
walk_meshes_post_order(self.get_parent(), set_mesh_strobe.bind(color))
func set_mesh_strobe(mesh: MeshInstance3D, color: float):
for i in range(mesh.get_surface_override_material_count()):
var mat := mesh.get_active_material(i)
var layer0: BaseMaterial3D = mat
var layer1: ShaderMaterial = mat.next_pass
var layer2: BaseMaterial3D = mat.next_pass.next_pass
layer0.emission_enabled = true
layer2.emission_enabled = true
layer0.emission_energy_multiplier = color
layer2.emission_energy_multiplier = color
layer0.emission = Color(1.0, 0.0, 0.0)
layer2.emission = Color(1.0, 0.0, 0.0)

21
godot/license Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Brandon Davis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -25,8 +25,6 @@ func frames_reset():
can_hit_history = Dictionary() can_hit_history = Dictionary()
can_hit_history[0] = can_hit can_hit_history[0] = can_hit
func hit(impulse: Vector3, power: float): func hit(impulse: Vector3, power: float):
apply_central_impulse(impulse * lerp(power_min, power_max, power)) apply_central_impulse(impulse * lerp(power_min, power_max, power))

View File

@ -41,6 +41,56 @@ ui_cancel={
charge={ charge={
"deadzone": 0.0, "deadzone": 0.0,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
]
}
advance={
"deadzone": 0.0,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
]
}
increment={
"deadzone": 0.0,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
]
}
regress={
"deadzone": 0.0,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
]
}
loop_up={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
]
}
look_right={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
]
}
look_down={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
]
}
look_left={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
] ]
} }
@ -50,3 +100,10 @@ charge={
3d/default_angular_damp=5.0 3d/default_angular_damp=5.0
3d/time_before_sleep=0.1 3d/time_before_sleep=0.1
3d/solver/solver_iterations=128 3d/solver/solver_iterations=128
[rendering]
anti_aliasing/quality/msaa_2d=3
anti_aliasing/quality/msaa_3d=3
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_taa=true

View File

@ -29,7 +29,7 @@ shader_parameter/darken_curve = SubResource("GradientTexture1D_kxwvs")
ambient_light_source = 2 ambient_light_source = 2
ambient_light_color = Color(1, 1, 1, 1) ambient_light_color = Color(1, 1, 1, 1)
glow_normalized = true glow_normalized = true
glow_bloom = 0.32 glow_bloom = 1.0
volumetric_fog_enabled = true volumetric_fog_enabled = true
volumetric_fog_density = 0.4 volumetric_fog_density = 0.4
volumetric_fog_emission = Color(0.462745, 0.866667, 1, 1) volumetric_fog_emission = Color(0.462745, 0.866667, 1, 1)