-
Notifications
You must be signed in to change notification settings - Fork 2
/
PlanetHelper.cs
42 lines (37 loc) · 1.43 KB
/
PlanetHelper.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
using Planetbase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Tahvohck_Mods
{
public static class PlanetHelper
{
public static ResourceType Metal = ResourceTypeList.find<Metal>();
public static ResourceType Bioplastic = ResourceTypeList.find<Bioplastic>();
public static ResourceType MedicalSupplies = ResourceTypeList.find<MedicalSupplies>();
public static Specialization Carrier = SpecializationList.find<Carrier>();
public static Specialization Constructor = SpecializationList.find<Constructor>();
public static void AddStartingResource(this Planet p, ResourceType t, int amount)
{
try {
(p.GetType()
.GetField("mStartingResources", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(p) as ResourceAmounts)
.add(t, amount);
} catch {
}
}
public static void AddStartingSpecialization(this Planet p, Specialization spec, int amount)
{
try {
(p.GetType()
.GetField("mStartingSpecializations", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(p) as List<SpecializationCount>)
.Add(new SpecializationCount(spec, amount));
} catch {
}
}
}
}