first commit
This commit is contained in:
38
MxValheim/Patch/Ores.cs
Normal file
38
MxValheim/Patch/Ores.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
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.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user