Skip to content

Commit

Permalink
v1.1.7 adds an option that makes walkable cells standable
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Jul 13, 2019
1 parent 23cd238 commit 0cf4839
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 7 deletions.
5 changes: 4 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<ModMetaData>
<name>SameSpot</name>
<author>Andreas Pardeike</author>
<targetVersion>1.0.0</targetVersion>
<supportedVersions>
<li>0.19</li>
<li>1.0</li>
</supportedVersions>
<description>Allows multiple colonists to be drafted at the same location

Powered by Harmony Patch Library
Expand Down
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>net.pardeike.rimworld.mod.samespot</identifier>
<version>1.1.6.0</version>
<version>1.1.7.0</version>
<targetVersions>
<li>0.19.0</li>
<li>1.0.0</li>
Expand Down
2 changes: 1 addition & 1 deletion About/ModSync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModSyncNinjaData>
<ID>da39eefe-71cc-4419-a91c-884eb1c6ea39</ID>
<ModName>SameSpot</ModName>
<Version>1.1.6.0</Version>
<Version>1.1.7.0</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>pardeike</Owner>
Expand Down
Binary file modified Assemblies/SameSpot.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Source/CrossPromotion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ static void ContentPart(Rect mainRect, float leftColumn, ModMetaData mod, Page_M

var outRect = new Rect(0f, 0f, leftColumn, mainRect.height);
var width = outRect.width - 20f;
var imageRect = new Rect(0f, 0f, width, width * mod.previewImage.height / mod.previewImage.width);
var imageRect = new Rect(0f, 0f, width, width * mod.PreviewImage.height / mod.PreviewImage.width);
var textRect = new Rect(0f, 24f + 10f + imageRect.height, width, Text.CalcHeight(description, width));
var innerRect = new Rect(0f, 0f, width, imageRect.height + 20f + 8f + 10f + textRect.height);
Widgets.BeginScrollView(outRect, ref leftScroll, innerRect, true);
GUI.DrawTexture(imageRect, mod.previewImage, ScaleMode.ScaleToFit);
GUI.DrawTexture(imageRect, mod.PreviewImage, ScaleMode.ScaleToFit);
var widgetRow = new WidgetRow(imageRect.xMax, imageRect.yMax + 8f, UIDirection.LeftThenDown, width, 8f);
if (isLocalFile == false)
{
Expand Down
19 changes: 19 additions & 0 deletions Source/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public static class Main

public static bool CustomStandable(this IntVec3 c, Map map)
{
if (SameSpotMod.Settings.walkableMode)
return map.pathGrid.Walkable(c);

var edifice = c.GetEdifice(map);
return edifice == null || (edifice as Building_Door) != null;
}
Expand Down Expand Up @@ -83,6 +86,22 @@ static void Postfix()
}
}

[HarmonyPatch(typeof(GenGrid))]
[HarmonyPatch("Standable")]
static class GenGrid_Standable_Patch
{
[HarmonyPriority(10000)]
static bool Prefix(IntVec3 c, Map map, ref bool __result)
{
if (SameSpotMod.Settings.walkableMode)
{
__result = map.pathGrid.Walkable(c);
return false;
}
return true;
}
}

[HarmonyPatch(typeof(PawnUtility))]
[HarmonyPatch("PawnBlockingPathAt")]
static class PawnUtility_PawnBlockingPathAt_Patch
Expand Down
4 changes: 2 additions & 2 deletions Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.6.0")]
[assembly: AssemblyFileVersion("1.1.6.0")]
[assembly: AssemblyVersion("1.1.7.0")]
[assembly: AssemblyFileVersion("1.1.7.0")]
3 changes: 3 additions & 0 deletions Source/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ public class SameSpotModSettings : ModSettings
{
public bool enableDragDrop = true;
public bool hardcoreMode = false;
public bool walkableMode = false;

public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref enableDragDrop, "enableDragDrop", true);
Scribe_Values.Look(ref hardcoreMode, "hardcoreMode", false);
Scribe_Values.Look(ref walkableMode, "walkableMode", false);
}

public void DoWindowContents(Rect inRect)
Expand All @@ -22,6 +24,7 @@ public void DoWindowContents(Rect inRect)
list.Gap(12f);
list.CheckboxLabeled("Enable Drag'n Drop", ref enableDragDrop);
list.CheckboxLabeled("SameSpot also for enemies", ref hardcoreMode);
list.CheckboxLabeled("Make walkable also standable", ref walkableMode);
list.End();
}
}
Expand Down

0 comments on commit 0cf4839

Please sign in to comment.