-
Notifications
You must be signed in to change notification settings - Fork 1
/
StatPart_RatkinHarmTurret.cs
47 lines (40 loc) · 1.01 KB
/
StatPart_RatkinHarmTurret.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
37
38
39
40
41
42
43
44
45
46
47
using RimWorld;
using Verse;
namespace OberoniaAurea_Hyacinth;
public class StatPart_RatkinHarmTurret : StatPart
{
public float factor = 0.05f;
private bool applied;
[Unsaved]
GameComponent_Hyacinth hyacinthGameComp;
GameComponent_Hyacinth HyacinthGameComp => hyacinthGameComp ??= Hyacinth_Utility.HyacinthGameComp;
public override void TransformValue(StatRequest req, ref float val)
{
if (!req.HasThing)
{
return;
}
Thing thing = req.Thing;
if (!thing.Spawned)
{
return;
}
applied = HyacinthGameComp?.RatkinHarmTurretCheck(thing) ?? false;
if (applied)
{
val *= factor;
}
}
public override string ExplanationPart(StatRequest req)
{
if (!req.HasThing)
{
return null;
}
if (applied)
{
return "OA_ElectromagneticInterference".Translate(factor.ToStringPercent());
}
return null;
}
}