Skip to content

Commit

Permalink
Load defs to static class
Browse files Browse the repository at this point in the history
  • Loading branch information
eth0net committed Mar 29, 2023
1 parent 85823b1 commit 867a463
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
Binary file modified Assemblies/SubcoreInfo.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions Source/SubcoreInfo/Harmony/Harmony_Building_SubcoreScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal static class Harmony_Building_SubcoreScanner_Tick
/// <returns></returns>
internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) => instructions.MethodReplacer(
AccessTools.Method(typeof(GenPlace), nameof(GenPlace.TryPlaceThing), new Type[] { typeof(Thing), typeof(IntVec3), typeof(Map), typeof(ThingPlaceMode), typeof(Action<Thing, int>), typeof(Predicate<IntVec3>), typeof(Rot4) }),
AccessTools.Method(typeof(Harmony_Building_SubcoreScanner_Tick), nameof(Harmony_Building_SubcoreScanner_Tick.TryUpdateAndPlaceSubcore))
AccessTools.Method(typeof(Harmony_Building_SubcoreScanner_Tick), nameof(TryUpdateAndPlaceSubcore))
);

/// <summary>
Expand All @@ -55,8 +55,8 @@ internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruct
{
ThingDef scannerDef = thing.def.defName switch
{
"SubcoreRegular" => ThingDef.Named("SubcoreSoftscanner"),
"SubcoreHigh" => ThingDef.Named("SubcoreRipscanner"),
"SubcoreRegular" => ThingDefOf.SubcoreSoftscanner,
"SubcoreHigh" => ThingDefOf.SubcoreRipscanner,
_ => null
};

Expand Down
1 change: 1 addition & 0 deletions Source/SubcoreInfo/SubcoreInfo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<Compile Include="Harmony\Harmony_Pawn.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SubcoreInfoSettings.cs" />
<Compile Include="ThingDefOf.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
15 changes: 15 additions & 0 deletions Source/SubcoreInfo/ThingDefOf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using RimWorld;
using Verse;

namespace SubcoreInfo
{
[DefOf]
internal static class ThingDefOf
{
[MayRequireBiotech]
public static ThingDef SubcoreSoftscanner;

[MayRequireBiotech]
public static ThingDef SubcoreRipscanner;
}
}

0 comments on commit 867a463

Please sign in to comment.