Skip to content

Commit

Permalink
Fixed HAR compat, added published field
Browse files Browse the repository at this point in the history
  • Loading branch information
ISOR3X committed Apr 12, 2024
1 parent 16ea287 commit cc6a9c2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<li>1.5</li>
</supportedVersions>
<packageId>ISOREX.PawnEditor</packageId>
<modVersion>0.9.0</modVersion>
<modVersion>1.0.0</modVersion>
<modDependencies>
<li>
<packageId>brrainz.harmony</packageId>
Expand Down
1 change: 1 addition & 0 deletions About/PublishedFileId.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3219801790
Binary file modified Assemblies/PawnEditor.dll
Binary file not shown.
12 changes: 6 additions & 6 deletions Source/PawnEditor/ModCompat/HARCompat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static class HARCompat
private static Func<ThingDef, ThingDef, bool> canWear;
private static Func<ThingDef, ThingDef, bool> canEquip;
private static Func<TraitDef, Pawn, int, bool> canGetTrait;
private static Func<GeneDef, ThingDef, bool> canHaveGene;
private static Func<GeneDef, ThingDef, bool, bool> canHaveGene;
private static Func<XenotypeDef, ThingDef, bool> canUseXenotype;

public static string Name = "Humanoid Alien Races";
Expand All @@ -53,14 +53,14 @@ public static void Activate()

styleSettings = AccessTools.FieldRefAccess<object>(alienSettings, "styleSettings");
isValidStyle = AccessTools.Method(AccessTools.TypeByName("AlienRace.StyleSettings"), "IsValidStyle")
.CreateDelegateCasting<Func<object, StyleItemDef, Pawn, bool, bool>>();
.CreateDelegateCasting<Func<object, StyleItemDef, Pawn, bool, bool>>();

var raceRestrictionSettings = AccessTools.TypeByName("AlienRace.RaceRestrictionSettings");
canWear = AccessTools.Method(raceRestrictionSettings, "CanWear").CreateDelegate<Func<ThingDef, ThingDef, bool>>();
canEquip = AccessTools.Method(raceRestrictionSettings, "CanEquip").CreateDelegate<Func<ThingDef, ThingDef, bool>>();
canGetTrait = AccessTools.Method(raceRestrictionSettings, "CanGetTrait", new[] { typeof(TraitDef), typeof(Pawn), typeof(int) })
.CreateDelegate<Func<TraitDef, Pawn, int, bool>>();
canHaveGene = AccessTools.Method(raceRestrictionSettings, "CanHaveGene").CreateDelegate<Func<GeneDef, ThingDef, bool>>();
.CreateDelegate<Func<TraitDef, Pawn, int, bool>>();
canHaveGene = AccessTools.Method(raceRestrictionSettings, "CanHaveGene").CreateDelegate<Func<GeneDef, ThingDef, bool, bool>>();
canUseXenotype = AccessTools.Method(raceRestrictionSettings, "CanUseXenotype").CreateDelegate<Func<XenotypeDef, ThingDef, bool>>();
}

Expand Down Expand Up @@ -109,6 +109,6 @@ public static bool AllowStyleItem(StyleItemDef item, Pawn pawn)
public static bool CanWear(ThingDef apparel, Pawn pawn) => canWear(apparel, pawn.def);
public static bool CanEquip(ThingDef weapon, Pawn pawn) => canEquip(weapon, pawn.def);
public static bool CanGetTrait(ListingMenu_Trait.TraitInfo trait, Pawn pawn) => canGetTrait(trait.Trait.def, pawn, trait.Trait.degree);
public static bool CanHaveGene(GeneDef gene, Pawn pawn) => canHaveGene(gene, pawn.def);
public static bool CanHaveGene(GeneDef gene, Pawn pawn) => canHaveGene(gene, pawn.def, false);
public static bool CanUseXenotype(XenotypeDef xenotype, Pawn pawn) => canUseXenotype(xenotype, pawn.def);
}
}

0 comments on commit cc6a9c2

Please sign in to comment.