ASTExtension: Fixed ClearAvatar patch not being prefix

This commit is contained in:
NotAKidoS 2024-07-03 01:33:56 -05:00
parent b37d49647e
commit 6930807665
6 changed files with 54 additions and 58 deletions

View file

@ -1,36 +1,37 @@
using NAK.PropLoadingHexagon.Components;
using UnityEngine;
namespace NAK.PropLoadingHexagon.Integrations;
public static class TheClapperIntegration
{
public static void Init()
{
PropLoadingHexagonMod.OnPropPlaceholderCreated += (placeholder) =>
{
if (placeholder.TryGetComponent(out LoadingHexagonController loadingHexagon))
ClappableLoadingHex.Create(loadingHexagon);
};
}
}
public class ClappableLoadingHex : Kafe.TheClapper.Clappable
{
private LoadingHexagonController _loadingHexagon;
public override void OnClapped(Vector3 clappablePosition)
{
if (_loadingHexagon == null) return;
_loadingHexagon.IsLoadingCanceled = true;
Kafe.TheClapper.TheClapper.EmitParticles(clappablePosition, new Color(1f, 1f, 0f), 2f); // why this internal
}
public static void Create(LoadingHexagonController loadingHexagon)
{
GameObject target = loadingHexagon.transform.GetChild(0).gameObject;
if (!target.gameObject.TryGetComponent(out ClappableLoadingHex clappableHexagon))
clappableHexagon = target.AddComponent<ClappableLoadingHex>();
clappableHexagon._loadingHexagon = loadingHexagon;
}
}
// using NAK.PropLoadingHexagon.Components;
// using UnityEngine;
//
// namespace NAK.PropLoadingHexagon.Integrations;
//
// // ReSharper disable once ClassNeverInstantiated.Global
// public class TheClapperIntegration
// {
// public static void Init()
// {
// PropLoadingHexagonMod.OnPropPlaceholderCreated += (placeholder) =>
// {
// if (placeholder.TryGetComponent(out LoadingHexagonController loadingHexagon))
// ClappableLoadingHex.Create(loadingHexagon);
// };
// }
// }
//
// public class ClappableLoadingHex : Kafe.TheClapper.Clappable
// {
// private LoadingHexagonController _loadingHexagon;
//
// public override void OnClapped(Vector3 clappablePosition)
// {
// if (_loadingHexagon == null) return;
// _loadingHexagon.IsLoadingCanceled = true;
// Kafe.TheClapper.TheClapper.EmitParticles(clappablePosition, new Color(1f, 1f, 0f), 2f); // why this internal
// }
//
// public static void Create(LoadingHexagonController loadingHexagon)
// {
// GameObject target = loadingHexagon.transform.GetChild(0).gameObject;
// if (!target.gameObject.TryGetComponent(out ClappableLoadingHex clappableHexagon))
// clappableHexagon = target.AddComponent<ClappableLoadingHex>();
// clappableHexagon._loadingHexagon = loadingHexagon;
// }
// }