commit 59641de2d7e1efcac217a81f80c0ef6ca0823a89 Author: Nathaniel Cosford Date: Wed Jun 4 16:16:45 2025 +0930 Upload from upload_mods.ps1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f69e0d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,80 @@ +# Build and Object Folders +bin/ +obj/ + +# Nuget packages directory +packages/ + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.log +*.vspscc +*.vssscc +.builds + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper* + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help +UpgradeLog*.XML + +# Lightswitch +_Pvt_Extensions +GeneratedArtifacts +*.xap +ModelManifest.xml + +#Backup file +*.bak + +#zzzili +v15/ + diff --git a/CustomMuzzleFlash.csproj b/CustomMuzzleFlash.csproj new file mode 100644 index 0000000..3706c60 --- /dev/null +++ b/CustomMuzzleFlash.csproj @@ -0,0 +1,67 @@ + + + + + Debug + AnyCPU + {6B763422-D3CD-4136-9C64-E3D34B7A1FA8} + Library + Properties + CustomMuzzleFlash + CustomMuzzleFlash + v4.8 + 512 + true + + + true + full + false + .\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + .\ + TRACE + prompt + 4 + Off + + + + ..\0_TFP_Harmony\0Harmony.dll + False + + + ..\..\7DaysToDie_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\7DaysToDie_Data\Managed\LogLibrary.dll + False + + + + + + + + + + + + ..\..\7DaysToDie_Data\Managed\UnityEngine.dll + False + + + + + + + + + \ No newline at end of file diff --git a/CustomMuzzleFlash.dll b/CustomMuzzleFlash.dll new file mode 100644 index 0000000..eb5f9bd Binary files /dev/null and b/CustomMuzzleFlash.dll differ diff --git a/CustomMuzzleFlash.pdb b/CustomMuzzleFlash.pdb new file mode 100644 index 0000000..6857f77 Binary files /dev/null and b/CustomMuzzleFlash.pdb differ diff --git a/Harmony/Init.cs b/Harmony/Init.cs new file mode 100644 index 0000000..375ad52 --- /dev/null +++ b/Harmony/Init.cs @@ -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()); + } +} + diff --git a/Harmony/Patches.cs b/Harmony/Patches.cs new file mode 100644 index 0000000..aedf776 --- /dev/null +++ b/Harmony/Patches.cs @@ -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"]); + } + } +} \ No newline at end of file diff --git a/ModInfo.xml b/ModInfo.xml new file mode 100644 index 0000000..9bf2e5d --- /dev/null +++ b/ModInfo.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b8396ca --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("CustomMuzzleFlash")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CustomMuzzleFlash")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("6b763422-d3cd-4136-9c64-e3d34b7a1fa8")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]