mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2026-02-04 09:06:10 +00:00
mass commit of laziness
This commit is contained in:
parent
ce992c70ee
commit
6d4fc549d9
167 changed files with 5471 additions and 675 deletions
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk" />
|
||||
109
.Deprecated/BufferParticleFixer/Main.cs
Normal file
109
.Deprecated/BufferParticleFixer/Main.cs
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
using System.Reflection;
|
||||
using ABI_RC.Core.Networking.API.Responses;
|
||||
using ABI_RC.Core.Util.AssetFiltering;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.BufferParticleFixer;
|
||||
|
||||
public class BufferParticleFixerMod : MelonMod
|
||||
{
|
||||
private static MelonLogger.Instance Logger;
|
||||
|
||||
private static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(nameof(BufferParticleFixer));
|
||||
|
||||
private static readonly MelonPreferences_Entry<bool> EntryFixBufferParticles =
|
||||
Category.CreateEntry(
|
||||
identifier: "fix_buffer_particles",
|
||||
true,
|
||||
display_name: "Fix Buffer Particles",
|
||||
description: "Should the mod attempt to fix buffer particles by modifying their lifetime and sub-emitter settings?");
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
|
||||
HarmonyInstance.Patch(
|
||||
typeof(SharedFilter).GetMethod(nameof(SharedFilter.ProcessParticleComponent),
|
||||
BindingFlags.Public | BindingFlags.Static),
|
||||
postfix: new HarmonyMethod(typeof(BufferParticleFixerMod).GetMethod(nameof(OnProcessParticleComponent),
|
||||
BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
}
|
||||
|
||||
private static void OnProcessParticleComponent(
|
||||
string collectionId,
|
||||
Component particleComponent,
|
||||
bool physicsCollision,
|
||||
CompatibilityVersions compatibilityVersion)
|
||||
{
|
||||
if (particleComponent is not ParticleSystem particleSystem)
|
||||
return;
|
||||
|
||||
if (!EntryFixBufferParticles.Value)
|
||||
return;
|
||||
|
||||
// Logger.Msg($"Processing particle system on collection '{collectionId}'.");
|
||||
|
||||
if (!IsLikelyBufferParticle(particleSystem))
|
||||
return;
|
||||
|
||||
Logger.Msg($"Detected likely buffer particle system '{particleSystem.name}' on collection '{collectionId}'. Applying fix...");
|
||||
|
||||
// Set start lifetime to 1000
|
||||
// All sub-emitters to "Spawn on Birth"
|
||||
// https://x.com/hfcRedddd/status/1696914565919813679
|
||||
|
||||
ParticleSystem.MainModule mainModule = particleSystem.main;
|
||||
|
||||
mainModule.startLifetime = 1f;
|
||||
|
||||
for (int i = 0; i < particleSystem.subEmitters.subEmittersCount; i++)
|
||||
{
|
||||
ParticleSystem subEmitter = particleSystem.subEmitters.GetSubEmitterSystem(i);
|
||||
if (subEmitter) particleSystem.subEmitters.SetSubEmitterType(i, ParticleSystemSubEmitterType.Birth);
|
||||
}
|
||||
}
|
||||
|
||||
// https://x.com/hfcRedddd/status/1696913727415537807
|
||||
private static bool IsLikelyBufferParticle(ParticleSystem ps)
|
||||
{
|
||||
// Check if the sub-emitters are children of the particle system
|
||||
Transform psTransform = ps.transform;
|
||||
|
||||
bool hasSubEmitterNotChild = false;
|
||||
|
||||
ParticleSystem.SubEmittersModule subEmitters = ps.subEmitters;
|
||||
int subEmitterCount = subEmitters.subEmittersCount;
|
||||
|
||||
for (int i = 0; i < subEmitterCount; i++)
|
||||
{
|
||||
ParticleSystem subEmitter = subEmitters.GetSubEmitterSystem(i);
|
||||
|
||||
// Skip null sub-emitters
|
||||
if (!subEmitter)
|
||||
{
|
||||
Logger.Warning($"Particle system '{ps.name}' has a null sub-emitter at index {i}.");
|
||||
continue;
|
||||
}
|
||||
|
||||
// If any sub-emitter is not a child of the particle system, it's likely a buffer particle.
|
||||
// This setup is also what shits into our logs...
|
||||
if (!subEmitter.transform.IsChildOf(psTransform))
|
||||
hasSubEmitterNotChild = true;
|
||||
}
|
||||
|
||||
if (hasSubEmitterNotChild)
|
||||
{
|
||||
// Buffer particles have very short lifetimes
|
||||
if (!(ps.main.startLifetime.constant > 0.05f))
|
||||
return true;
|
||||
|
||||
Logger.Msg($"A potential buffer particle system '{ps.name}' has a start lifetime of {ps.main.startLifetime.constant}, which is longer than expected.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
32
.Deprecated/BufferParticleFixer/Properties/AssemblyInfo.cs
Normal file
32
.Deprecated/BufferParticleFixer/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using MelonLoader;
|
||||
using NAK.BufferParticleFixer.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.BufferParticleFixer))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.BufferParticleFixer))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.BufferParticleFixer.BufferParticleFixerMod),
|
||||
nameof(NAK.BufferParticleFixer),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/BufferParticleFixer"
|
||||
)]
|
||||
|
||||
[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.BufferParticleFixer.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
||||
14
.Deprecated/BufferParticleFixer/README.md
Normal file
14
.Deprecated/BufferParticleFixer/README.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# SearchWithSpacesFix
|
||||
|
||||
Fixes search terms that use spaces.
|
||||
|
||||
---
|
||||
|
||||
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.
|
||||
23
.Deprecated/BufferParticleFixer/format.json
Normal file
23
.Deprecated/BufferParticleFixer/format.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"_id": -1,
|
||||
"name": "SearchWithSpacesFix",
|
||||
"modversion": "1.0.0",
|
||||
"gameversion": "2024r177",
|
||||
"loaderversion": "0.6.1",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Fixes search terms that include spaces.",
|
||||
"searchtags": [
|
||||
"search",
|
||||
"spaces",
|
||||
"fix",
|
||||
"meow"
|
||||
],
|
||||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r42/SearchWithSpacesFix.dll",
|
||||
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/SearchWithSpacesFix/",
|
||||
"changelog": "- Initial release",
|
||||
"embedcolor": "#f61963"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue