Skip to content

Commit

Permalink
Mend: Add power toogle
Browse files Browse the repository at this point in the history
  • Loading branch information
notfood committed Aug 30, 2018
1 parent ecfc190 commit 189c0fe
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
Binary file modified Assemblies/MendAndRecycle.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions Languages/English/Keyed/mendandrecycle_Languages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<!-- Settings -->
<mendrecycle.RequiresFuel>Requires Fuel</mendrecycle.RequiresFuel>
<mendrecycle.RequiresFuelTooltip>Does the mending table need mending kits? (Needs restart)</mendrecycle.RequiresFuelTooltip>
<mendrecycle.RequiresPower>Requires Power</mendrecycle.RequiresPower>
<mendrecycle.RequiresPowerTooltip>Does the mending table require power? (Needs restart)</mendrecycle.RequiresPowerTooltip>

<mendrecycle.FailChances>Fail Chance for Item Quality (0% to 100%)</mendrecycle.FailChances>
<mendrecycle.PreIndustrial>Pre-Industial Colony Tech Level</mendrecycle.PreIndustrial>
Expand Down
8 changes: 8 additions & 0 deletions Source/MendAndRecycleMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ static void Inject()
if (!Settings.requiresFuel) {
RemoveFuel();
}
if (!Settings.requiresPower)
{
RemovePower();
}

SortApparelsInComplexity();
}
Expand All @@ -41,6 +45,10 @@ static void RemoveFuel() {
LocalDefOf.Recipe.MakeMendingKit.recipeUsers.Clear();
LocalDefOf.Thing.TableMending.comps.RemoveAll(p => p.GetType() == typeof(CompProperties_Refuelable));
}
static void RemovePower()
{
LocalDefOf.Thing.TableMending.comps.RemoveAll(p => p.GetType() == typeof(CompProperties_Power));
}

static void SortApparelsInComplexity() {
// select and group ThingDefs by complexity
Expand Down
3 changes: 3 additions & 0 deletions Source/ResourceBank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public static class ResourceBank

public static readonly string RequiresFuel = "mendrecycle.RequiresFuel".Translate();
public static readonly string RequiresFuelTooltip = "mendrecycle.RequiresFuelTooltip".Translate();
public static readonly string RequiresPower = "mendrecycle.RequiresPower".Translate();
public static readonly string RequiresPowerTooltip = "mendrecycle.RequiresPowerTooltip".Translate();

public static readonly string FailChances = "mendrecycle.FailChances".Translate();
public static readonly string PreIndustrial = "mendrecycle.PreIndustrial".Translate();
public static readonly string PostIndustrial = "mendrecycle.PostIndustrial".Translate();
Expand Down
3 changes: 3 additions & 0 deletions Source/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class Settings : ModSettings
static readonly int[] DEFAULT_POST_INDUSTRIAL_FAIL_CHANCE;

public static bool requiresFuel;
public static bool requiresPower;

static Settings()
{
Expand Down Expand Up @@ -53,6 +54,7 @@ public override void ExposeData()
base.ExposeData();

Scribe_Values.Look(ref requiresFuel, "mendrecycle.fuel", true, true);
Scribe_Values.Look(ref requiresPower, "mendrecycle.power", true, true);

Scribe_Deep.Look(ref TechLevelRangeUtil.PreIndustrial, "mendrecycle.PreIndustrial");
Scribe_Deep.Look(ref TechLevelRangeUtil.PostIndustrial, "mendrecycle.PostIndustrial");
Expand Down Expand Up @@ -80,6 +82,7 @@ public static void DoSettingsWindowContents(Rect rect)

l.Begin(rect);
l.CheckboxLabeled(ResourceBank.RequiresFuel, ref requiresFuel, ResourceBank.RequiresFuelTooltip);
l.CheckboxLabeled(ResourceBank.RequiresPower, ref requiresPower, ResourceBank.RequiresPowerTooltip);
l.Gap(6);

l.Label(ResourceBank.FailChances);
Expand Down

0 comments on commit 189c0fe

Please sign in to comment.