mass commit of laziness

This commit is contained in:
NotAKidoS 2025-12-28 20:30:00 -06:00
parent ce992c70ee
commit 6d4fc549d9
167 changed files with 5471 additions and 675 deletions

View file

@ -0,0 +1,154 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.ContentClones;
using ABI_RC.Systems.GameEventSystem;
using ABI_RC.Systems.UI.UILib;
using ABI_RC.Systems.UI.UILib.UIObjects;
using ABI_RC.Systems.UI.UILib.UIObjects.Components;
using ABI.CCK.Components;
using MelonLoader;
namespace NAK.ShowPlayerInSelfMirror;
public class ShowPlayerInSelfMirrorMod : MelonMod
{
public override void OnInitializeMelon()
{
PlayerPlayerMirror.Initialize();
}
}
/// <summary>
/// Manages adding/removing player clones to/from the personal mirror via the Player Select Page.
/// </summary>
public static class PlayerPlayerMirror
{
private static readonly Dictionary<string, ContentCloneManager.CloneData> _clonedPlayers = new();
private static Category _ourCategory;
private static ToggleButton _toggle;
public static void Initialize()
{
_ourCategory = QuickMenuAPI.PlayerSelectPage.AddCategory("Show Player In Self Mirror");
_toggle = _ourCategory.AddToggle(
"Add To Self Mirrors",
"Should this player be shown in your self mirrors?",
false
);
_toggle.OnValueUpdated += OnToggleChanged;
QuickMenuAPI.OnPlayerSelected += OnPlayerSelected;
CVRGameEventSystem.Avatar.OnRemoteAvatarClear.AddListener(OnRemoteAvatarCleared);
CVRGameEventSystem.Avatar.OnRemoteAvatarLoad.AddListener(OnRemoteAvatarLoad);
CVRGameEventSystem.Player.OnLeaveEntity.AddListener(OnRemotePlayerLeave);
}
private static void OnToggleChanged(bool value)
{
string playerId = QuickMenuAPI.SelectedPlayerID;
if (string.IsNullOrEmpty(playerId))
return;
if (value)
{
if (!_clonedPlayers.TryAdd(playerId, null))
return;
if (CVRPlayerManager.Instance.TryGetPlayerBase(playerId, out PlayerBase player))
{
if (!TryCreateClone(playerId, player))
{
_clonedPlayers.Remove(playerId);
_toggle.ToggleValue = false;
}
}
}
else
{
RemoveAndForgetClone(playerId);
}
}
private static void OnPlayerSelected(object _, string playerId)
{
// If this is us, hide the category entirely
if (playerId == MetaPort.Instance.ownerId)
{
_ourCategory.Hidden = true;
return;
}
// Show the category for other players
_ourCategory.Hidden = false;
bool enabled = _clonedPlayers.ContainsKey(playerId);
_toggle.ToggleValue = enabled;
}
private static void OnRemoteAvatarCleared(CVRPlayerEntity playerEntity, CVRAvatar _)
{
string playerId = playerEntity.Uuid;
if (!_clonedPlayers.TryGetValue(playerId, out ContentCloneManager.CloneData clone))
return;
if (clone != null)
{
ContentCloneManager.DestroyClone(clone);
_clonedPlayers[playerId] = null;
}
}
private static void OnRemoteAvatarLoad(CVRPlayerEntity playerEntity, CVRAvatar _)
{
string playerId = playerEntity.Uuid;
if (!_clonedPlayers.ContainsKey(playerId))
return;
if (!CVRPlayerManager.Instance.TryGetPlayerBase(playerId, out PlayerBase player))
return;
TryCreateClone(playerId, player);
}
private static void OnRemotePlayerLeave(CVRPlayerEntity playerEntity)
{
string playerId = playerEntity.Uuid;
RemoveAndForgetClone(playerId);
}
private static bool TryCreateClone(string playerId, PlayerBase player)
{
if (!player.AvatarObject)
return false;
if (_clonedPlayers.TryGetValue(playerId, out ContentCloneManager.CloneData existing)
&& existing is { IsDestroyed: false })
return true;
ContentCloneManager.CloneData clone = ContentCloneManager.CreateClone(
player.AvatarObject,
ContentCloneManager.CloneOptions.ExtensionOfPlayer
);
if (clone == null)
return false;
_clonedPlayers[playerId] = clone;
return true;
}
private static void RemoveAndForgetClone(string playerId)
{
if (_clonedPlayers.TryGetValue(playerId, out ContentCloneManager.CloneData clone))
{
if (clone != null)
ContentCloneManager.DestroyClone(clone);
}
_clonedPlayers.Remove(playerId);
}
}

View file

@ -0,0 +1,32 @@
using MelonLoader;
using NAK.ShowPlayerInSelfMirror.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.ShowPlayerInSelfMirror))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.ShowPlayerInSelfMirror))]
[assembly: MelonInfo(
typeof(NAK.ShowPlayerInSelfMirror.ShowPlayerInSelfMirrorMod),
nameof(NAK.ShowPlayerInSelfMirror),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ShowPlayerInSelfMirror"
)]
[assembly: MelonGame("ChilloutVR", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
[assembly: MelonAuthorColor(255, 158, 21, 32)] // red
[assembly: HarmonyDontPatchAll]
namespace NAK.ShowPlayerInSelfMirror.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,16 @@
# ShowPlayerInSelfMirror
Adds an option in the Quick Menu selected player page to show the target player's avatar in your self mirror.
Probably useful for only showing specific people in your mirror while in a puddle of many.
---
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> This mod is an independent creation not affiliated with, supported by, or approved by Alpha Blend Interactive.
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>PlayerCloneAttachment</RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\playercloneattachment.assets" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,23 @@
{
"_id": -1,
"name": "ShowPlayerInSelfMirror",
"modversion": "1.0.0",
"gameversion": "2025r181",
"loaderversion": "0.7.2",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Adds an option in the Quick Menu selected player page to show the target player's avatar in your self mirror.\n\nProbably useful for only showing specific people in your mirror while in a puddle of many.",
"searchtags": [
"player",
"mirror",
"clone",
"show"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r48/ShowPlayerInSelfMirror.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ShowPlayerInSelfMirror/",
"changelog": "- Initial release",
"embedcolor": "#f61963"
}