Skip to content

Commit

Permalink
Add subcore info to stats page
Browse files Browse the repository at this point in the history
  • Loading branch information
eth0net committed Mar 31, 2023
1 parent 814f803 commit 63960f3
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
Binary file modified Assemblies/SubcoreInfo.dll
Binary file not shown.
11 changes: 11 additions & 0 deletions Defs/Stats/StatCategories.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<StatCategoryDef>
<defName>SubcoreInfo</defName>
<label>SubcoreInfo</label>
<displayOrder>13</displayOrder>
<displayAllByDefault>true</displayAllByDefault>
</StatCategoryDef>

</Defs>
25 changes: 24 additions & 1 deletion Source/SubcoreInfo/Comps/CompPatternInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text;
using System.Collections.Generic;
using System.Text;
using Verse;

namespace SubcoreInfo.Comps
Expand Down Expand Up @@ -42,5 +43,27 @@ public override string CompInspectStringExtra()

return sb.ToString().TrimEnd();
}

public override IEnumerable<RimWorld.StatDrawEntry> SpecialDisplayStats()
{
if (SubcoreInfoSettings.showFullName)
{
yield return new RimWorld.StatDrawEntry(StatCategoryDefOf.SubcoreInfo, textName, PatternName?.ToStringFull ?? textUnknown, "The full name of the pawn scanned to make this subcore.", 40);
}
else
{
yield return new RimWorld.StatDrawEntry(StatCategoryDefOf.SubcoreInfo, textName, PatternName?.ToStringShort ?? textUnknown, "The short name of the pawn scanned to make this subcore.", 30);
}

if (SubcoreInfoSettings.showTitle)
{
yield return new RimWorld.StatDrawEntry(StatCategoryDefOf.SubcoreInfo, textTitle, TitleName ?? textUnknown, "The title of the pawn scanned to make this subcore.", 20);
}

if (SubcoreInfoSettings.showFaction)
{
yield return new RimWorld.StatDrawEntry(StatCategoryDefOf.SubcoreInfo, textFaction, FactionName ?? textUnknown, "The faction of the pawn scanned to make this subcore.", 10);
}
}
}
}
11 changes: 11 additions & 0 deletions Source/SubcoreInfo/StatCategoryDefOf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using RimWorld;

namespace SubcoreInfo
{
[DefOf]
public static class StatCategoryDefOf
{
[MayRequireBiotech]
public static StatCategoryDef SubcoreInfo;
}
}
1 change: 1 addition & 0 deletions Source/SubcoreInfo/SubcoreInfo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Comps\CompPatternBase.cs" />
<Compile Include="StatCategoryDefOf.cs" />
<Compile Include="SubcoreInfo.cs" />
<Compile Include="Comps\CompPatternInfo.cs" />
<Compile Include="Comps\CompMechInfo.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Source/SubcoreInfo/ThingDefOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace SubcoreInfo
{
[DefOf]
internal static class ThingDefOf
public static class ThingDefOf
{
[MayRequireBiotech]
public static ThingDef SubcoreSoftscanner;
Expand Down

0 comments on commit 63960f3

Please sign in to comment.