forked from erdelf/AlienRaces
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlienRaceMod.cs
More file actions
46 lines (38 loc) · 1.69 KB
/
AlienRaceMod.cs
File metadata and controls
46 lines (38 loc) · 1.69 KB
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
namespace AlienRace
{
using RimWorld;
using UnityEngine;
using Verse;
public class AlienRaceMod : Mod
{
public static AlienRaceSettings settings;
public override string SettingsCategory() => "Alien Race";
public AlienRaceMod(ModContentPack content) : base(content) =>
settings = this.GetSettings<AlienRaceSettings>();
public override void DoSettingsWindowContents(Rect inRect)
{
base.DoSettingsWindowContents(inRect);
Listing_Standard listingStandard = new Listing_Standard();
listingStandard.Begin(inRect);
listingStandard.CheckboxLabeled(label: "Use central melanin for factions", ref settings.centralMelanin, tooltip: "True: Pawns of the same factions will have more or less the same skin color.\nFalse: Skin color is not bound by factions.\nNote: Race authors may decide to override skin colors.");
listingStandard.End();
}
public override void WriteSettings()
{
base.WriteSettings();
settings.UpdateSettings();
}
}
public class AlienRaceSettings : ModSettings
{
public bool centralMelanin;
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref this.centralMelanin, label: "centralMelanin", defaultValue: false);
}
public void UpdateSettings() =>
((ThingDef_AlienRace)ThingDefOf.Human).alienRace.generalSettings.alienPartGenerator.colorChannels.Find(match: ccg => ccg.name == "skin").first =
this.centralMelanin ? null : new ColorGenerator_SkinColorMelanin { maxMelanin = 1f, minMelanin = 0f };
}
}