Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Killface1980 committed Jan 3, 2018
1 parent 99e5a02 commit 51ca993
Show file tree
Hide file tree
Showing 28 changed files with 1,252 additions and 1,300 deletions.
Binary file modified Assemblies/0KillfaceTools.dll
Binary file not shown.
Binary file modified Assemblies/Outfitter.dll
Binary file not shown.
21 changes: 9 additions & 12 deletions Source/Outfitter/ApparelEntry.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
// ReSharper disable StyleCop.SA1307

using System.Collections.Generic;
using RimWorld;

namespace Outfitter
{
using System.Collections.Generic;

using RimWorld;

public class ApparelEntry
{
public HashSet<StatDef> equippedOffsets;

public HashSet<StatDef> infusedOffsets;

public HashSet<StatDef> statBases;
public HashSet<StatDef> EquippedOffsets;
public HashSet<StatDef> InfusedOffsets;
public HashSet<StatDef> StatBases;

public ApparelEntry()
{
this.equippedOffsets = new HashSet<StatDef>();
this.infusedOffsets = new HashSet<StatDef>();
this.statBases = new HashSet<StatDef>();
this.EquippedOffsets = new HashSet<StatDef>();
this.InfusedOffsets = new HashSet<StatDef>();
this.StatBases = new HashSet<StatDef>();
}
}
}
186 changes: 90 additions & 96 deletions Source/Outfitter/ApparelStatCache.cs

Large diffs are not rendered by default.

743 changes: 381 additions & 362 deletions Source/Outfitter/ApparelStatsHelper.cs

Large diffs are not rendered by default.

21 changes: 9 additions & 12 deletions Source/Outfitter/Cache.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
namespace Outfitter
{
using System;
using System.Collections.Generic;
using System.Linq;

using JetBrains.Annotations;

using RimWorld;

using Verse;
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using RimWorld;
using Verse;

namespace Outfitter
{
public static class Cache
{
// ReSharper disable once FieldCanBeMadeReadOnly.Global
Expand All @@ -22,7 +19,7 @@ public static float GetEquippedStatValue([NotNull] this Apparel apparel, Pawn pa
float baseStat = pawn.def.statBases.GetStatValueFromList(stat, stat.defaultBaseValue);
float equippedStatValue = apparel.def.equippedStatOffsets.GetStatOffsetFromList(stat);

if (!ApparelStatCache.specialStats.Contains(stat) && Math.Abs(baseStat) > 0f)
if (!ApparelStatCache.SpecialStats.Contains(stat) && Math.Abs(baseStat) > 0f)
{
return ((baseStat + equippedStatValue) / baseStat) - 1;
}
Expand Down
27 changes: 10 additions & 17 deletions Source/Outfitter/Controller.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq;
using JetBrains.Annotations;
using RimWorld;
using UnityEngine;
using Verse;

namespace Outfitter
{
using JetBrains.Annotations;

using RimWorld;

using UnityEngine;

using Verse;

class Controller : Mod
{
public Controller(ModContentPack content)
: base(content)
{
settings = this.GetSettings<Settings>();
Settings = this.GetSettings<Settings>();

}
public static Settings settings;
public static Settings Settings;

public override void DoSettingsWindowContents(Rect inRect)
{
settings.DoWindowContents(inRect);
Settings.DoWindowContents(inRect);
}

[NotNull]
Expand All @@ -37,7 +30,7 @@ public override string SettingsCategory()
public override void WriteSettings()
{
base.WriteSettings();
settings.Write();
Settings.Write();

if (Current.ProgramState == ProgramState.Playing)
{
Expand All @@ -61,7 +54,7 @@ public override void WriteSettings()
BodyPartRecord rightEye = head.parts.FirstOrDefault(x => x.def == BodyPartDefOf.RightEye);
BodyPartRecord jaw = head.parts.FirstOrDefault(x => x.def == BodyPartDefOf.Jaw);

if (settings.UseEyes)
if (Settings.UseEyes)
{
leftEye?.groups.Remove(BodyPartGroupDefOf.FullHead);
rightEye?.groups.Remove(BodyPartGroupDefOf.FullHead);
Expand Down
4 changes: 2 additions & 2 deletions Source/Outfitter/Enums/MainJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ public enum MainJob
{
Anything,

Soldier00Close_Combat,
Soldier00CloseCombat,

Soldier00Ranged_Combat,
Soldier00RangedCombat,

Artist,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace Outfitter.Filter
{
using RimWorld;

using Verse;
using RimWorld;
using Verse;

namespace Outfitter.Filter
{
public class SpecialThingFilterWorker_DeadmansApparel : SpecialThingFilterWorker
{
public override bool CanEverMatch(ThingDef def)
Expand Down
47 changes: 25 additions & 22 deletions Source/Outfitter/GameComponent_Outfitter.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
namespace Outfitter
{
using System;
using System.Collections.Generic;
using System.Linq;

using JetBrains.Annotations;

using RimWorld;

using Verse;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using RimWorld;
using Verse;

namespace Outfitter
{
public class GameComponent_Outfitter : GameComponent
{
private readonly Game _game;

[NotNull]
public List<SaveablePawn> PawnCache = new List<SaveablePawn>();

Expand All @@ -22,7 +20,8 @@ public GameComponent_Outfitter()
// ReSharper disable once UnusedMember.Global
public GameComponent_Outfitter(Game game)
{
if (Controller.settings.UseEyes)
this._game = game;
if (Controller.Settings.UseEyes)
{
foreach (BodyDef bodyDef in DefDatabase<BodyDef>.AllDefsListForReading)
{
Expand Down Expand Up @@ -56,23 +55,27 @@ public GameComponent_Outfitter(Game game)
foreach (ThingDef def in DefDatabase<ThingDef>.AllDefsListForReading.Where(
td => td.category == ThingCategory.Pawn && td.race.Humanlike))
{
if (def.inspectorTabs == null)
// if (def.inspectorTabs == null)
// {
// def.inspectorTabs = new List<Type>();
// }
//
// if (def.inspectorTabsResolved == null)
// {
// def.inspectorTabsResolved = new List<InspectTabBase>();
// }
if (def.inspectorTabs == null || def.inspectorTabsResolved == null)
{
def.inspectorTabs = new List<Type>();
}

if (def.inspectorTabsResolved == null)
{
def.inspectorTabsResolved = new List<InspectTabBase>();
return;
}

if (def.inspectorTabs.Contains(typeof(ITab_Pawn_Outfitter)))
if (def.inspectorTabs.Contains(typeof(Tab_Pawn_Outfitter)))
{
return;
}

def.inspectorTabs.Add(typeof(ITab_Pawn_Outfitter));
def.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(ITab_Pawn_Outfitter)));
def.inspectorTabs.Add(typeof(Tab_Pawn_Outfitter));
def.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(Tab_Pawn_Outfitter)));
}
}

Expand Down
32 changes: 9 additions & 23 deletions Source/Outfitter/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@
// public override string ModIdentifier { get { return "Outfitter"; } }
// }

using System.Collections.Generic;
using System.Linq;
using System.Reflection;

using Harmony;

using Outfitter;
using Outfitter.TabPatch;

using RimWorld;

using Verse;
using Verse.AI;

// ReSharper disable InconsistentNaming

[StaticConstructorOnStartup]
internal static class HarmonyPatches
Expand All @@ -30,8 +26,7 @@ static HarmonyPatches()
harmony.Patch(
AccessTools.Method(typeof(PawnGraphicSet), nameof(PawnGraphicSet.ResolveApparelGraphics)),
null,
new HarmonyMethod(typeof(HarmonyPatches), nameof(ResolveApparelGraphics_Postfix)),
null);
new HarmonyMethod(typeof(HarmonyPatches), nameof(ResolveApparelGraphics_Postfix)));

// harmony.Patch(
// AccessTools.Method(typeof(InspectPaneUtility), "DoTabs"),
Expand All @@ -57,12 +52,12 @@ static HarmonyPatches()

harmony.Patch(
AccessTools.Method(typeof(ITab_Bills), "FillTab"),
new HarmonyMethod(typeof(ITab_Bills_Patch), nameof(ITab_Bills_Patch.FillTab_Prefix)),
new HarmonyMethod(typeof(Tab_Bills_Patch), nameof(Tab_Bills_Patch.FillTab_Prefix)),
null);

harmony.Patch(
AccessTools.Method(typeof(ITab_Bills), "TabUpdate"),
new HarmonyMethod(typeof(ITab_Bills_Patch), nameof(ITab_Bills_Patch.TabUpdate_Prefix)),
new HarmonyMethod(typeof(Tab_Bills_Patch), nameof(Tab_Bills_Patch.TabUpdate_Prefix)),
null);

// harmony.Patch(
Expand All @@ -80,18 +75,6 @@ static HarmonyPatches()
"Outfitter successfully completed " + harmony.GetPatchedMethods().Count() + " patches with harmony.");
}

private static void LogJobActivities(
ThinkNode_JobGiver __instance,
ThinkResult __result,
Pawn pawn,
JobIssueParams jobParams)
{
// if (__result.Job.def.driverClass.)
// {
// __result.Job.
// }
}

private static void ResolveApparelGraphics_Postfix(PawnGraphicSet __instance)
{
__instance.apparelGraphics = __instance.apparelGraphics
Expand All @@ -103,6 +86,9 @@ private static void UpdatePriorities(Pawn_WorkSettings __instance)
FieldInfo fieldInfo =
typeof(Pawn_WorkSettings).GetField("pawn", BindingFlags.NonPublic | BindingFlags.Instance);
Pawn pawn = (Pawn)fieldInfo?.GetValue(__instance);
pawn.GetSaveablePawn().ForceStatUpdate = true;
if (pawn != null)
{
pawn.GetSaveablePawn().ForceStatUpdate = true;
}
}
}
Loading

0 comments on commit 51ca993

Please sign in to comment.