Skip to content

Commit

Permalink
v1.0.8
Browse files Browse the repository at this point in the history
- Updated to handle 0.19.2017 changes in translator method. Backwards compatible, should be no difference for older versions.
  • Loading branch information
Jaxe-Wilde committed Sep 5, 2018
1 parent eb869e4 commit bf5a880
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 44 deletions.
2 changes: 1 addition & 1 deletion About/ModSync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ModSyncNinjaData>
<ID>59f538ed-f86d-4506-a4a5-7e9faaa37508</ID>
<ModName>Pawn Rules</ModName>
<Version>v1.0.7</Version>
<Version>v1.0.8</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>Jaxe-Dev</Owner>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pawn Rules
![](https://img.shields.io/badge/Version-1.0.7-brightgreen.svg)
![](https://img.shields.io/badge/Version-1.0.8-brightgreen.svg)

Built for **RimWorld B19**\
Powered by **Harmony**\
Expand Down
2 changes: 1 addition & 1 deletion Source/Data/Lang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace PawnRules.Data
{
internal static class Lang
{
public static string Get(string key, params object[] args) => (Mod.Id + "." + key).Translate(args);
public static string Get(string key, params object[] args) => string.Format((Mod.Id + "." + key).Translate(), args);
}
}
2 changes: 1 addition & 1 deletion Source/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal class Mod : Verse.Mod
public const string Id = "PawnRules";
public const string Name = "Pawn Rules";
public const string Author = "Jaxe";
public const string Version = "1.0.7";
public const string Version = "1.0.8";

public static ModContentPack ContentPack { get; private set; }

Expand Down
36 changes: 0 additions & 36 deletions Source/Patch/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,41 +105,5 @@ public static Rect[] GetVGrid(this Rect self, float spacing, params float[] heig

return rects;
}
/*
public static Rect[] GetVGrid(this Rect self, float spacing, params float[] heights)
{
var unfixedCount = 0;
var currentY = self.y;
var fixedHeights = 0f;
var rects = new Rect[heights.Length];
foreach (var height in heights)
{
if (height > 0) { fixedHeights += height - (spacing * 2); }
else { unfixedCount++; }
}
var unfixedHeight = unfixedCount > 0 ? (self.height - fixedHeights) / unfixedCount : 0;
for (var index = 0; index < heights.Length; index++)
{
var height = heights[index];
float newHeight;
if (height > 0)
{
newHeight = height;
rects[index] = new Rect(self.x, currentY, self.width, newHeight);
}
else
{
newHeight = unfixedHeight;
rects[index] = new Rect(self.x, currentY, self.width, newHeight);
}
currentY += newHeight + spacing;
}
return rects;
}
*/
}
}
10 changes: 6 additions & 4 deletions Source/Patch/RimWorld_RelationsUtility_TryDevelopBondRelation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ namespace PawnRules.Patch
[HarmonyPatch(typeof(RelationsUtility), nameof(RelationsUtility.TryDevelopBondRelation))]
internal static class RimWorld_RelationsUtility_TryDevelopBondRelation
{
private static bool Prefix(Pawn humanlike, Pawn animal)
private static bool Prefix(ref bool __result, Pawn humanlike, Pawn animal)
{
if (!Registry.IsActive || (humanlike == null) || (animal == null) || !humanlike.CanHaveRules()) { return true; }

var rules = Registry.GetRules(humanlike);
if (rules == null) { return true; }
var restrictions = rules.GetRestriction(RestrictionType.Bonding);
return (restrictions == null) || restrictions.IsVoid || restrictions.Allows(animal.def);
var restriction = rules?.GetRestriction(RestrictionType.Bonding);
if ((restriction == null) || restriction.IsVoid || restriction.Allows(animal.def)) { return true; }

__result = false;
return false;
}
}
}

0 comments on commit bf5a880

Please sign in to comment.