From 7ed8521a7b23dd84d529317d5daf2c8de814e495 Mon Sep 17 00:00:00 2001 From: LeCloutPanda <53411604+LeCloutPanda@users.noreply.github.com> Date: Thu, 2 May 2024 05:47:50 +1000 Subject: [PATCH 1/2] Added/Updated Changed - IsUserInSeatedMode - IsUserInNoclipMode Added - AvatarRootSlot - FindGrabbableFromSlot --- .../ProtoFlux/Avatar/AvatarRootSlot.cs | 24 +++++++++++++++++++ .../Interaction/FindGrabbableFromSlot.cs | 19 +++++++++++++++ .../Users/Status/IsUserInNoclipNode.cs | 2 +- .../Users/Status/IsUserInSeatedMode.cs | 2 +- .../ProtoFlux/Utility/WriteToLogNode.cs | 2 +- 5 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs create mode 100644 ProjectObsidian/ProtoFlux/Interaction/FindGrabbableFromSlot.cs diff --git a/ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs b/ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs new file mode 100644 index 0000000..069c505 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using FrooxEngine; +using FrooxEngine.CommonAvatar; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Users.Avatar +{ + [ContinuouslyChanging] + [NodeCategory("Obsidian/Avatar")] + public class AvatarRootSlot : ObjectFunctionNode + { + public readonly ObjectInput User; + + protected override Slot Compute(ExecutionContext context) + { + User user = User.Evaluate(context); + Slot slot = user.Root.Slot; + List list = new List(); + slot.GetFirstDirectComponentsInChildren(list); + return user == null || list.Count == 0 ? null : list[0].Slot; + } + } +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/Interaction/FindGrabbableFromSlot.cs b/ProjectObsidian/ProtoFlux/Interaction/FindGrabbableFromSlot.cs new file mode 100644 index 0000000..2396f0e --- /dev/null +++ b/ProjectObsidian/ProtoFlux/Interaction/FindGrabbableFromSlot.cs @@ -0,0 +1,19 @@ +using FrooxEngine; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Interaction +{ + [ContinuouslyChanging] + [NodeCategory("Obsidian/Interaction")] + public class FindGrabbableFromSlot : ObjectFunctionNode + { + public readonly ObjectInput Slot; + + protected override IGrabbable Compute(ExecutionContext context) + { + Slot slot = Slot.Evaluate(context); + return slot == null ? null : slot.GetComponentInParents(); + } + } +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/Users/Status/IsUserInNoclipNode.cs b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInNoclipNode.cs index dfefc82..1c1b1c7 100644 --- a/ProjectObsidian/ProtoFlux/Users/Status/IsUserInNoclipNode.cs +++ b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInNoclipNode.cs @@ -6,7 +6,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Locomotion { [ContinuouslyChanging] - [NodeCategory("Obsidian/Locomotion")] + [NodeCategory("Obsidian/Users/Status")] public class IsUserInNoClipNode : ValueFunctionNode { public readonly ObjectInput User; diff --git a/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs index 6d905de..5974365 100644 --- a/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs +++ b/ProjectObsidian/ProtoFlux/Users/Status/IsUserInSeatedMode.cs @@ -6,7 +6,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Locomotion { [ContinuouslyChanging] - [NodeCategory("Obsidian/Locomotion")] + [NodeCategory("Obsidian/Users/Status")] public class IsUserInSeatedModeNode : ValueFunctionNode { public readonly ObjectInput User; diff --git a/ProjectObsidian/ProtoFlux/Utility/WriteToLogNode.cs b/ProjectObsidian/ProtoFlux/Utility/WriteToLogNode.cs index 6d2b38f..e813158 100644 --- a/ProjectObsidian/ProtoFlux/Utility/WriteToLogNode.cs +++ b/ProjectObsidian/ProtoFlux/Utility/WriteToLogNode.cs @@ -1,9 +1,9 @@ using Elements.Core; using FrooxEngine; using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; using System.Threading.Tasks; using FrooxEngine.ProtoFlux; +using ProtoFlux.Runtimes.Execution; namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Utility { From f0c47b2c9092a4057fb51c13de32d1acf3ac1c19 Mon Sep 17 00:00:00 2001 From: LeCloutPanda <53411604+LeCloutPanda@users.noreply.github.com> Date: Thu, 2 May 2024 05:59:23 +1000 Subject: [PATCH 2/2] Update AvatarRootSlot.cs Fixed a world crash bug... Oopsie daisy :) --- ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs b/ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs index 069c505..5877396 100644 --- a/ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs +++ b/ProjectObsidian/ProtoFlux/Avatar/AvatarRootSlot.cs @@ -15,10 +15,14 @@ public class AvatarRootSlot : ObjectFunctionNode protected override Slot Compute(ExecutionContext context) { User user = User.Evaluate(context); + if (user == null) return null; + Slot slot = user.Root.Slot; List list = new List(); slot.GetFirstDirectComponentsInChildren(list); - return user == null || list.Count == 0 ? null : list[0].Slot; + if (list.Count == 0) return null; + + return list[0].Slot; } } } \ No newline at end of file