diff --git a/CommunityBugFixCollection/CommunityBugFixCollection.csproj b/CommunityBugFixCollection/CommunityBugFixCollection.csproj index e4c2a2e..b067fac 100644 --- a/CommunityBugFixCollection/CommunityBugFixCollection.csproj +++ b/CommunityBugFixCollection/CommunityBugFixCollection.csproj @@ -10,7 +10,7 @@ True CommunityBugFixCollection Component Selector Additions - Banane9 + Banane9; Nytra 0.7.0-beta This MonkeyLoader mod for Resonite overhauls the Component Selector / Protoflux Node Selector to have a search, as well as favorites and recents categories. README.md diff --git a/CommunityBugFixCollection/Contributors.cs b/CommunityBugFixCollection/Contributors.cs index 29a3212..949e3e1 100644 --- a/CommunityBugFixCollection/Contributors.cs +++ b/CommunityBugFixCollection/Contributors.cs @@ -7,6 +7,8 @@ namespace CommunityBugFixCollection { internal static class Contributors { - public static string[] Banane9 => ["Banane9"]; + public static string[] Banane9 { get; } = ["Banane9"]; + + public static string[] Nytra { get; } = ["Nytra"]; } } \ No newline at end of file diff --git a/CommunityBugFixCollection/UserInspectorsAsNonHost.cs b/CommunityBugFixCollection/UserInspectorsAsNonHost.cs new file mode 100644 index 0000000..8dd44f6 --- /dev/null +++ b/CommunityBugFixCollection/UserInspectorsAsNonHost.cs @@ -0,0 +1,41 @@ +using FrooxEngine; +using FrooxEngine.UIX; +using HarmonyLib; +using MonkeyLoader.Resonite; +using System; +using System.Collections.Generic; +using System.Text; + +namespace CommunityBugFixCollection +{ + [HarmonyPatch(typeof(UserInspector), "OnAttach")] + [HarmonyPatchCategory(nameof(UserInspectorAsNonHost))] + internal class UserInspectorAsNonHost : ResoniteMonkey + { + public override IEnumerable Authors => Contributors.Nytra; + + public override bool CanBeDisabled => true; + + private static void Postfix(UserInspector __instance) + { + if (!Enabled || __instance.World.IsAuthority) + return; + + // Wait a bit to see if anything gets generated by the host + __instance.RunInSeconds(2, () => + { + // Check if any items were generated, just in case this gets fixed in the future + if (__instance._userListContentRoot.Target.ChildrenCount != 0) + return; + + foreach (var user in __instance.World.AllUsers) + { + var slot = __instance._userListContentRoot.Target.AddSlot("User"); + slot.PersistentSelf = false; + slot.AttachComponent().PaddingTop.Value = 4f; + slot.AttachComponent().Setup(user); + } + }); + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index 2149153..7865f52 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,5 @@ just disable them in the settings in the meantime. * Tools derived from `BrushTool` not firing *OnDequipped* events (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/723) * It not being possible to import multiple audio clips at once (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/737) * URLs to text files or Resonite Packages failing to import instead of appearing as a hyperlink (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/785) +* UserInspectors not listing existing users in the session for non-host users (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1964) * Animators updating all associated fields every frame while enabled but not playing (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/3480) \ No newline at end of file