-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.cs
36 lines (32 loc) · 856 Bytes
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
namespace Grenade_Fix_Rearmed
{
[StaticConstructorOnStartup]
public static class Main
{
static Main()
{
//Find all explosive projectile weapons
IEnumerable<ThingDef> explosives = DefDatabase<ThingDef>.AllDefs.Where(def => def.Verbs.Exists(verb => verb.CausesExplosion));
#if DEBUG
Log.Message($"GrenadeFixRearmed :: Found {explosives.Count()} explosives.");
#endif
foreach (ThingDef thing in explosives)
{
foreach (VerbProperties verb in thing.Verbs)
{
if (verb.CausesExplosion)
{
verb.minRange = Mathf.Max(verb.minRange, verb.defaultProjectile.projectile.explosionRadius + 0.5f);
#if DEBUG
Log.Message($"GrenadeFixRearmed :: New '{verb.label}' minRange = {verb.minRange}");
#endif
}
}
}
}
}
}