Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:16:45 +09:30
commit 59641de2d7
8 changed files with 235 additions and 0 deletions

16
Harmony/Init.cs Normal file
View File

@@ -0,0 +1,16 @@
using System.Reflection;
public class CustomMuzzleFlashInit : IModApi
{
private static bool inited = false;
public void InitMod(Mod _modInstance)
{
if (inited)
return;
inited = true;
Log.Out(" Loading Patch: " + GetType());
var harmony = new HarmonyLib.Harmony(GetType().ToString());
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
}

27
Harmony/Patches.cs Normal file
View File

@@ -0,0 +1,27 @@
using HarmonyLib;
[HarmonyPatch]
class MuzzlePatch
{
[HarmonyPatch(typeof(ItemActionAttack), nameof(ItemActionAttack.ReadFrom))]
[HarmonyPostfix]
private static void Postfix_ReadFrom_ItemActionAttack(DynamicProperties _props)
{
if (_props.Values.ContainsKey("Particles_muzzle_fire") && !ParticleEffect.IsAvailable(_props.Values["Particles_muzzle_fire"]))
{
ParticleEffect.LoadAsset(_props.Values["Particles_muzzle_fire"]);
}
if (_props.Values.ContainsKey("Particles_muzzle_fire_fpv") && !ParticleEffect.IsAvailable(_props.Values["Particles_muzzle_fire_fpv"]))
{
ParticleEffect.LoadAsset(_props.Values["Particles_muzzle_fire_fpv"]);
}
if (_props.Values.ContainsKey("Particles_muzzle_smoke") && !ParticleEffect.IsAvailable(_props.Values["Particles_muzzle_smoke"]))
{
ParticleEffect.LoadAsset(_props.Values["Particles_muzzle_smoke"]);
}
if (_props.Values.ContainsKey("Particles_muzzle_smoke_fpv") && !ParticleEffect.IsAvailable(_props.Values["Particles_muzzle_smoke_fpv"]))
{
ParticleEffect.LoadAsset(_props.Values["Particles_muzzle_smoke_fpv"]);
}
}
}