diff --git a/godot/.vs/Hurrmmm/v17/.suo b/godot/.vs/Hurrmmm/v17/.suo new file mode 100644 index 0000000..f62e480 Binary files /dev/null and b/godot/.vs/Hurrmmm/v17/.suo differ diff --git a/godot/Backup/Hurrmmm.sln b/godot/Backup/Hurrmmm.sln new file mode 100644 index 0000000..082e355 --- /dev/null +++ b/godot/Backup/Hurrmmm.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hurrmmm", "Hurrmmm.csproj", "{BD45A87E-5242-45B0-9A55-8B809F4BB443}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal diff --git a/godot/Hurrmmm.csproj b/godot/Hurrmmm.csproj new file mode 100644 index 0000000..e25452c --- /dev/null +++ b/godot/Hurrmmm.csproj @@ -0,0 +1,6 @@ + + + net6.0 + true + + \ No newline at end of file diff --git a/godot/Hurrmmm.sln b/godot/Hurrmmm.sln new file mode 100644 index 0000000..565be6a --- /dev/null +++ b/godot/Hurrmmm.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hurrmmm", "Hurrmmm.csproj", "{BD45A87E-5242-45B0-9A55-8B809F4BB443}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {BD45A87E-5242-45B0-9A55-8B809F4BB443}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {87544EC1-9C6D-4DF7-891E-89088A6D794E} + EndGlobalSection +EndGlobal diff --git a/godot/TAS_system/TAS_System.cs b/godot/TAS_system/TAS_System.cs new file mode 100644 index 0000000..dee5c1b --- /dev/null +++ b/godot/TAS_system/TAS_System.cs @@ -0,0 +1,129 @@ +using Godot; +using System; + +public partial class TAS_System : Node +{ + private double _frameLength = 0.1; + private bool _isIncrementingFrames = false; + private double _timeSinceLastFrame; + private int _currentFrame = 0; + private int _lastAdvancedFrame = 0; + + public double FrameLength + { + get { return this._frameLength; } + set { this._frameLength = value; } + } + + public bool IsIncrementingFrames + { + get { return this._isIncrementingFrames; } + private set { this._isIncrementingFrames = value; } + } + + private double TimeSinceLastFrame + { + get { return this._timeSinceLastFrame; } + set { this._timeSinceLastFrame = value; } + } + + public int CurrentFrame + { + get { return this._currentFrame; } + private set { this._currentFrame = value; } + } + + /// + /// The last frame that can be advanced to. This will + /// only be greater than CurrentFrame after the player + /// regresses frames, and will be equal to CurrentFrame + /// when the player has just done an action. + /// + /// + public int LastAdvancedFrame + { + get { return this._lastAdvancedFrame; } + private set { this._lastAdvancedFrame = value; } + } + + /// + /// Signal is emitted whenever the current frame is incremented. + /// + /// + [Signal] + public delegate void FrameIncrementedEventHandler(int newFrame); + + [Signal] + public delegate void FramesAdvancedEventHandler(int startFrame, int endFrame); + + [Signal] + public delegate void FramesRegressedEventHandler(int startFrame, int endFrame); + + + public void StartIncrementingFrames() + { + this.IsIncrementingFrames = true; + } + + public void StopIncrementingFrames() + { + this.IsIncrementingFrames = false; + } + + public void ResetFrameCount() + { + this.CurrentFrame = 0; + this.LastAdvancedFrame = 0; + } + + // Returns how many frames it could successfully advance + public int Advance(int numFrames) + { + int newFrame = Math.Min(this.CurrentFrame + numFrames, this.LastAdvancedFrame); + int framesAdvanced = newFrame - this.CurrentFrame; + EmitSignal(SignalName.FramesAdvanced, this.CurrentFrame, newFrame); + this.CurrentFrame = newFrame; + return framesAdvanced; + } + + // Returns how many frames it could successfully regress + public int Regress(int numFrames) + { + int newFrame = Math.Max(this.CurrentFrame - numFrames, 0); + int framesRegressed = newFrame - this.CurrentFrame; + EmitSignal(SignalName.FramesRegressed, this.CurrentFrame, newFrame); + this.CurrentFrame = newFrame; + return framesRegressed; + } + + /// + /// Gets rid of advanced frames. + /// + public void DiscardAdvancedFrames() + { + this.LastAdvancedFrame = this.CurrentFrame; + } + + public override void _PhysicsProcess(double delta) + { + if (this.IsIncrementingFrames) + { + this.TimeSinceLastFrame += delta; + if (this.TimeSinceLastFrame >= this.FrameLength) + { + this.CurrentFrame++; + EmitSignal(SignalName.FrameIncremented, this.CurrentFrame); + this.TimeSinceLastFrame = 0 + (this.TimeSinceLastFrame - this.FrameLength); + } + } + + // GD.Print(CurrentFrame); + } + + // public void Test() + // { + // GD.Print("test123"); + + // // EmitSignal(SignalName.TestSignal, "test456"); + // } +} diff --git a/godot/TAS_system/TAS_System.tscn b/godot/TAS_system/TAS_System.tscn new file mode 100644 index 0000000..237cfd8 --- /dev/null +++ b/godot/TAS_system/TAS_System.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://x6yhkj1f7yg1"] + +[ext_resource type="Script" path="res://TAS_system/TAS_System.cs" id="1_4s6ry"] + +[node name="TAS_System" type="Node"] +script = ExtResource("1_4s6ry") diff --git a/godot/TAS_system/TASable.cs b/godot/TAS_system/TASable.cs new file mode 100644 index 0000000..c3a5716 --- /dev/null +++ b/godot/TAS_system/TASable.cs @@ -0,0 +1,33 @@ +using Godot; +using System; +using System.Globalization; + +public partial class TASable : Node +{ + Node3D _parent; + + public override void _Ready() + { + this._parent = this.GetParent(); + TAS_System TAS = GetNode("/root/TAS_System"); + + TAS.FrameIncremented += this.OnFrameIncremented; + TAS.FramesAdvanced += this.OnFramesAdvanced; + TAS.FramesRegressed += this.OnFramesRegressed; + } + + public virtual void OnFrameIncremented(int newFrame) + { + GD.Print($"Frame advanced to {newFrame}, called from node {_parent.Name}"); + } + + public virtual void OnFramesAdvanced(int startFrame, int endFrame) + { + GD.Print($"Frames advanced from {startFrame} to {endFrame}, called from node {_parent.Name}"); + } + + public virtual void OnFramesRegressed(int startFrame, int endFrame) + { + GD.Print($"Frames regressed from {startFrame} to {endFrame}, called from node {_parent.Name}"); + } +} diff --git a/godot/TAS_system/is_TASable.tscn b/godot/TAS_system/is_TASable.tscn new file mode 100644 index 0000000..abb062b --- /dev/null +++ b/godot/TAS_system/is_TASable.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://bjhii55pagkb5"] + +[ext_resource type="Script" path="res://TAS_system/TASable.cs" id="1_uqel0"] + +[node name="is_TASable" type="Node"] +script = ExtResource("1_uqel0") diff --git a/godot/UpgradeLog.htm b/godot/UpgradeLog.htm new file mode 100644 index 0000000..87498ff --- /dev/null +++ b/godot/UpgradeLog.htm @@ -0,0 +1,275 @@ + + + + Migration Report +

+ Migration Report - Hurrmmm

\ No newline at end of file diff --git a/godot/control_scheme/is_targetable.gd b/godot/control_scheme/is_targetable.gd index a2d6718..071ba9e 100644 --- a/godot/control_scheme/is_targetable.gd +++ b/godot/control_scheme/is_targetable.gd @@ -12,7 +12,7 @@ func make_target(): func unmake_target(): walk_meshes_post_order(self.get_parent(), unchange_all_materials) -func walk_meshes_post_order(parent: Node3D, f: Callable): +func walk_meshes_post_order(parent: Node, f: Callable): for child in parent.get_children(): walk_meshes_post_order(child, f) if parent is MeshInstance3D: diff --git a/godot/control_scheme/is_targetable.tscn b/godot/control_scheme/is_targetable.tscn index ab49342..bcca6a8 100644 --- a/godot/control_scheme/is_targetable.tscn +++ b/godot/control_scheme/is_targetable.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=2 format=3 uid="uid://w6cldokq87k0"] +[gd_scene load_steps=2 format=3 uid="uid://cbp8c4kpmr0hk"] [ext_resource type="Script" path="res://control_scheme/is_targetable.gd" id="1_108lw"] diff --git a/godot/project.godot b/godot/project.godot index 2647583..fb38d03 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -11,12 +11,14 @@ config_version=5 [application] config/name="Hurrmmm" -config/features=PackedStringArray("4.1", "Forward Plus") +run/main_scene="res://tests/TAS_system/TAS_test_001.tscn" +config/features=PackedStringArray("4.1", "C#", "Forward Plus") config/icon="res://icon.svg" [autoload] ControllerEventBus="*res://controller_event_bus.gd" +TAS_System="*res://TAS_system/TAS_System.tscn" [dotnet] diff --git a/godot/tests/TAS_system/TAS_test_001.cs b/godot/tests/TAS_system/TAS_test_001.cs new file mode 100644 index 0000000..1d323ed --- /dev/null +++ b/godot/tests/TAS_system/TAS_test_001.cs @@ -0,0 +1,29 @@ +using Godot; +using System; + +public partial class TAS_test_001 : Node +{ + + public override void _Ready() + { + // Called every time the node is added to the scene. + // Initialization here. + GD.Print("Hello from C# to Godot :)"); + + TAS_System TAS = GetNode("/root/TAS_System"); + + TAS.FrameLength = 1.5; + + TAS.StartIncrementingFrames(); + + // TAS.FrameIncremented += (x) => GD.Print(x); + + // TAS.Test(); + } + + private void Test2(string testStr2) + { + + } + +} diff --git a/godot/tests/TAS_system/TAS_test_001.tscn b/godot/tests/TAS_system/TAS_test_001.tscn new file mode 100644 index 0000000..5afd062 --- /dev/null +++ b/godot/tests/TAS_system/TAS_test_001.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://bbml0d2v4lf78"] + +[ext_resource type="Script" path="res://tests/TAS_system/TAS_test_001.cs" id="1_0ap5j"] + +[node name="TAS_test_001" type="Node3D"] +script = ExtResource("1_0ap5j") diff --git a/godot/tests/TAS_system/TAS_test_002.tscn b/godot/tests/TAS_system/TAS_test_002.tscn new file mode 100644 index 0000000..3bea4db --- /dev/null +++ b/godot/tests/TAS_system/TAS_test_002.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=7 format=3 uid="uid://by3rnp88l4plx"] + +[ext_resource type="PackedScene" uid="uid://bua7f25rpewkp" path="res://small_room.glb" id="1_bo0jp"] +[ext_resource type="PackedScene" uid="uid://cbp8c4kpmr0hk" path="res://control_scheme/is_targetable.tscn" id="2_d7v5s"] +[ext_resource type="PackedScene" uid="uid://drmb4sitb74fx" path="res://control_scheme/controller.tscn" id="3_0hshv"] +[ext_resource type="PackedScene" uid="uid://bjhii55pagkb5" path="res://TAS_system/is_TASable.tscn" id="3_srlbt"] +[ext_resource type="Script" path="res://tests/TAS_system/TAS_test_001.cs" id="5_0ber1"] + +[sub_resource type="Environment" id="Environment_f0m14"] +ambient_light_source = 2 +ambient_light_color = Color(1, 1, 1, 1) +ambient_light_energy = 0.5 + +[node name="small_room" instance=ExtResource("1_bo0jp")] + +[node name="is_TASable" parent="table" index="0" instance=ExtResource("3_srlbt")] + +[node name="is_targetable" parent="grape" index="0" node_paths=PackedStringArray("attached_to") instance=ExtResource("2_d7v5s")] +attached_to = NodePath("..") + +[node name="is_TASable" parent="grape" index="1" instance=ExtResource("3_srlbt")] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="." index="3"] +environment = SubResource("Environment_f0m14") + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment" index="0"] +transform = Transform3D(1, 0, 0, 0, 0.933762, 0.357895, 0, -0.357895, 0.933762, 0, 1.43864, 1.81738) + +[node name="controller" parent="." index="4" node_paths=PackedStringArray("camera", "initial_target") instance=ExtResource("3_0hshv")] +camera = NodePath("Camera3D") +initial_target = NodePath("../grape") + +[node name="Camera3D" type="Camera3D" parent="controller" index="1"] + +[node name="TAS_test_001" type="Node" parent="." index="6"] +script = ExtResource("5_0ber1") diff --git a/godot/tests/control_scheme/test_basic_controls.tscn b/godot/tests/control_scheme/test_basic_controls.tscn index 903d29d..f21b02d 100644 --- a/godot/tests/control_scheme/test_basic_controls.tscn +++ b/godot/tests/control_scheme/test_basic_controls.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://bua7f25rpewkp" path="res://small_room.glb" id="1_2ticn"] [ext_resource type="PackedScene" uid="uid://drmb4sitb74fx" path="res://control_scheme/controller.tscn" id="2_dcvuq"] -[ext_resource type="PackedScene" uid="uid://w6cldokq87k0" path="res://control_scheme/is_targetable.tscn" id="2_y2131"] +[ext_resource type="PackedScene" uid="uid://cbp8c4kpmr0hk" path="res://control_scheme/is_targetable.tscn" id="2_y2131"] [sub_resource type="Environment" id="Environment_f0m14"] ambient_light_source = 2