Files
MxValheim/MxValheim/Patch/Ores.cs
2026-01-28 20:05:17 -05:00

39 lines
1.1 KiB
C#

using BepInEx;
using HarmonyLib;
using System.Collections.Generic;
using UnityEngine;
namespace MxValheim.Patch
{
public class Ores
{
[HarmonyPatch(typeof(DropTable), nameof(DropTable.GetDropList), new[] { typeof(int) })]
static class DropTable_Patch
{
static void Postfix(ref List<GameObject> __result)
{
if (__result == null || __result.Count == 0) return;
int countToAdd = MxValheimMod.Config_OreMultiplier.Value - 1;
if (countToAdd <= 0) return;
List<GameObject> extraDrops = new List<GameObject>();
foreach (var item in __result)
{
string name = item.name.ToLower();
if (name.Contains("ore") || name.Contains("scrap"))
{
for (int i = 0; i < countToAdd; i++)
{
extraDrops.Add(item);
}
}
}
__result.AddRange(extraDrops);
}
}
}
}