diff --git a/ProtoFlux/Interaction/FindGrabbableFromSlot.cs b/ProtoFlux/Interaction/FindGrabbableFromSlot.cs new file mode 100644 index 0000000..ee40b6f --- /dev/null +++ b/ProtoFlux/Interaction/FindGrabbableFromSlot.cs @@ -0,0 +1,19 @@ +using FrooxEngine; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Users.Avatar +{ + [ContinuouslyChanging] + [NodeCategory("ProtoFlux/Obsidian/Avatar")] + 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/ProtoFlux/Slots/CreateEmptySlot.cs b/ProtoFlux/Slots/CreateEmptySlot.cs new file mode 100644 index 0000000..4767bfd --- /dev/null +++ b/ProtoFlux/Slots/CreateEmptySlot.cs @@ -0,0 +1,33 @@ +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Users.Avatar +{ + [ContinuouslyChanging] + [NodeCategory("ProtoFlux/Obsidian/Slots")] + public class CreateEmptySlot : ActionBreakableFlowNode + { + public readonly ObjectInput Parent; + public readonly ObjectInput Name; + public readonly ObjectInput Tag; + public readonly ValueInput Persistent; + public readonly ValueInput Active; + + public readonly ObjectOutput Slot; + + protected override bool Do(FrooxEngineContext context) + { + Slot slot = context.LocalUser.LocalUserSpace.AddSlot(); + slot.Parent = Parent.Evaluate(context); + slot.Name = Name.Evaluate(context); + slot.Tag = Tag.Evaluate(context); + slot.PersistentSelf = Persistent.Evaluate(context); + slot.ActiveSelf = Active.Evaluate(context); + + Slot.Write(slot, context); + return true; + } + } +} \ No newline at end of file diff --git a/ProtoFlux/Users/Avatar/AvatarRootSlot.cs b/ProtoFlux/Users/Avatar/AvatarRootSlot.cs new file mode 100644 index 0000000..e186e32 --- /dev/null +++ b/ProtoFlux/Users/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.Users.Avatar +{ + [ContinuouslyChanging] + [NodeCategory("ProtoFlux/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/ProtoFlux/Users/Status/IsUserInSeatedMode.cs b/ProtoFlux/Users/Status/IsUserInSeatedMode.cs index 8ecd617..eadbbd9 100644 --- a/ProtoFlux/Users/Status/IsUserInSeatedMode.cs +++ b/ProtoFlux/Users/Status/IsUserInSeatedMode.cs @@ -2,10 +2,10 @@ using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -namespace FrooxEngine.ProtoFlux.Locomotion +namespace FrooxEngine.ProtoFlux.Status { [ContinuouslyChanging] - [NodeCategory("ProtoFlux/Obsidian/Locomotion")] + [NodeCategory("ProtoFlux/Obsidian/Status")] public class IsUserInSeatedModeNode : ValueFunctionNode { public readonly ObjectInput User;