diff --git a/1.3/Assemblies/0MultiplayerAPI.dll b/1.3/Assemblies/0MultiplayerAPI.dll
new file mode 100644
index 0000000..38b8a0e
Binary files /dev/null and b/1.3/Assemblies/0MultiplayerAPI.dll differ
diff --git a/1.3/Assemblies/AchtungMod.dll b/1.3/Assemblies/AchtungMod.dll
new file mode 100644
index 0000000..98d0fae
Binary files /dev/null and b/1.3/Assemblies/AchtungMod.dll differ
diff --git a/About/About.xml b/About/About.xml
index 518ec8a..221e414 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -6,6 +6,7 @@
1.0
1.1
1.2
+ 1.3
diff --git a/About/Manifest.xml b/About/Manifest.xml
index ea5fc0c..9e237cf 100644
--- a/About/Manifest.xml
+++ b/About/Manifest.xml
@@ -1,11 +1,12 @@
net.pardeike.rimworld.mod.achtung
- 3.1.7.0
+ 3.2.0.0
1.0.0
1.1.0
1.2.0
+ 1.3.0
diff --git a/LoadFolders.xml b/LoadFolders.xml
index b3acbd9..003cb97 100644
--- a/LoadFolders.xml
+++ b/LoadFolders.xml
@@ -7,4 +7,8 @@
/
1.2
+
+ /
+ 1.3
+
\ No newline at end of file
diff --git a/Source/Achtung.csproj b/Source/Achtung.csproj
index 70c4a03..b946023 100644
--- a/Source/Achtung.csproj
+++ b/Source/Achtung.csproj
@@ -7,10 +7,10 @@
net472
8.0
x64
- ..\1.2\Assemblies\
+ ..\1.3\Assemblies\
true
false
- 3.1.7.0
+ 3.2.0.0
© July, 2016
@@ -23,15 +23,15 @@
true
- RW12;TRACE;DEBUG
+ RW12;RW13;TRACE;DEBUG
false
portable
true
-
-
+
+
all
@@ -75,7 +75,7 @@ if not errorlevel 1 (
ModBuilder XMLPut -file "$(SolutionDir)About\Manifest.xml" -xpath /Manifest/version -value "{{$(MSBuildProjectName)-version}}"
)
if defined INSTALL_MOD (
- "%INSTALL_MOD%" "$(Configuration)" "$(SolutionDir)" "$(MSBuildProjectName)" "1.1 1.2 About Assemblies Languages Textures" "LoadFolders.xml"
+ "%INSTALL_MOD%" "$(Configuration)" "$(SolutionDir)" "$(MSBuildProjectName)" "1.1 1.2 1.3 About Assemblies Languages Textures" "LoadFolders.xml"
)
Brrainz
diff --git a/Source/Colonist.cs b/Source/Colonist.cs
index 74b9f31..7aec1d8 100644
--- a/Source/Colonist.cs
+++ b/Source/Colonist.cs
@@ -30,7 +30,7 @@ public IntVec3 UpdateOrderPos(Vector3 pos)
if (AchtungLoader.IsSameSpotInstalled)
{
- if (cell.Standable(pawn.Map) && pawn.CanReach(cell, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn))
+ if (cell.Standable(pawn.Map) && ReachabilityUtility.CanReach(pawn, cell, PathEndMode.OnCell, Danger.Deadly))
{
designation = cell.ToVector3Shifted();
designation.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn);
@@ -58,4 +58,4 @@ public void OrderTo(Vector3 pos)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Source/CrossPromotion.cs b/Source/CrossPromotion.cs
index 8589d30..e7a3e1a 100644
--- a/Source/CrossPromotion.cs
+++ b/Source/CrossPromotion.cs
@@ -68,6 +68,7 @@ static void Page_ModsConfig_PostClose_Postfix()
static void WorkshopItems_Notify_Subscribed_Postfix(PublishedFileId_t pfid)
{
var longID = pfid.m_PublishedFileId;
+
if (subscribingMods.Contains(longID) == false)
return;
_ = subscribingMods.Remove(longID);
@@ -80,6 +81,7 @@ static void WorkshopItems_Notify_Subscribed_Postfix(PublishedFileId_t pfid)
ModsConfig.SetActive(mod, true);
ModsConfig.Save();
+
Find.WindowStack.Add(new MiniDialog(mod.Name + " added"));
});
}
@@ -91,16 +93,20 @@ static void WorkshopItems_Notify_Subscribed_Postfix(PublishedFileId_t pfid)
static IEnumerable Page_ModsConfig_DoWindowContents_Transpiler(IEnumerable instructions, ILGenerator generator)
{
var list = instructions.ToList();
+
var beginGroupIndicies = list
.Select((instr, idx) => new Pair(idx, instr))
.Where(pair => pair.Second.operand is MethodInfo mi && mi == m_BeginGroup)
.Select(pair => pair.First).ToArray();
+
var endGroupIndicies = list
.Select((instr, idx) => new Pair(idx, instr))
.Where(pair => pair.Second.operand is MethodInfo mi && mi == m_EndGroup)
.Select(pair => pair.First).ToArray();
+
if (beginGroupIndicies.Length != 2 || endGroupIndicies.Length != 2)
return instructions;
+
var iBegin = beginGroupIndicies[1] - 1;
var iEnd = endGroupIndicies[0];
@@ -121,8 +127,7 @@ static IEnumerable Page_ModsConfig_DoWindowContents_Transpiler(
internal static string ModPreviewPath(ulong modID)
{
var dir = Path.GetTempPath() + "BrrainzMods" + Path.DirectorySeparatorChar;
- if (Directory.Exists(dir) == false)
- _ = Directory.CreateDirectory(dir);
+ if (Directory.Exists(dir) == false) _ = Directory.CreateDirectory(dir);
return dir + modID + "-preview.jpg";
}
@@ -146,12 +151,15 @@ internal static Texture2D PreviewForMod(ulong modID)
{
if (previewTextures.TryGetValue(modID, out var texture))
return texture;
+
var path = ModPreviewPath(modID);
if (File.Exists(path) == false)
return null;
+
texture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
if (texture.LoadImage(SafeRead(path)))
previewTextures[modID] = texture;
+
return texture;
}
@@ -189,51 +197,49 @@ public static void FetchPromotionMods()
return;
var rimworldID = SteamUtils.GetAppID();
- unchecked
- {
- var aID = new AccountID_t((uint)userID);
- var itemQuery = SteamUGC.CreateQueryUserUGCRequest(aID,
+ var aID = new AccountID_t(unchecked((uint)userID));
+
+ var itemQuery = SteamUGC.CreateQueryUserUGCRequest(aID,
EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_UsableInGame,
- EUserUGCListSortOrder.k_EUserUGCListSortOrder_VoteScoreDesc, rimworldID, rimworldID,
- 1);
- _ = SteamUGC.SetReturnLongDescription(itemQuery, true);
- _ = SteamUGC.SetRankedByTrendDays(itemQuery, 7);
- AsyncUserModsQuery(itemQuery, (result, failure) =>
- {
- for (uint i = 0; i < result.m_unNumResultsReturned; i++)
- if (SteamUGC.GetQueryUGCResult(result.m_handle, i, out var mod))
- if (promotionMods.Any(m => m.m_nPublishedFileId.m_PublishedFileId == mod.m_nPublishedFileId.m_PublishedFileId) == false)
- {
- promotionMods.Add(mod);
- var modID = mod.m_nPublishedFileId.m_PublishedFileId;
+ EUserUGCListSortOrder.k_EUserUGCListSortOrder_VoteScoreDesc, rimworldID, rimworldID, 1);
- var path = ModPreviewPath(modID);
- if (File.Exists(path) == false || new FileInfo(path).Length != mod.m_nPreviewFileSize)
- {
- AsyncDownloadQuery(mod.m_hPreviewFile, path, (result2, failure2) =>
- {
- if (File.Exists(path))
- {
- if (previewTextures.ContainsKey(modID))
- _ = previewTextures.Remove(modID);
- }
- });
- }
+ _ = SteamUGC.SetReturnLongDescription(itemQuery, true);
+ _ = SteamUGC.SetRankedByTrendDays(itemQuery, 7);
- UpdateVotingStatus(modID, (result2, failure2) =>
+ AsyncUserModsQuery(itemQuery, (result, failure) =>
+ {
+ for (var i = (uint)0; i < result.m_unNumResultsReturned; i++)
+ if (SteamUGC.GetQueryUGCResult(result.m_handle, i, out var mod))
+ if (promotionMods.Any(m => m.m_nPublishedFileId.m_PublishedFileId == mod.m_nPublishedFileId.m_PublishedFileId) == false)
+ {
+ promotionMods.Add(mod);
+ var modID = mod.m_nPublishedFileId.m_PublishedFileId;
+
+ var path = ModPreviewPath(modID);
+ if (File.Exists(path) == false || new FileInfo(path).Length != mod.m_nPreviewFileSize)
+ {
+ AsyncDownloadQuery(mod.m_hPreviewFile, path, (result2, failure2) =>
{
- allVoteStati[modID] = (result2.m_eResult == EResult.k_EResultOK) ? result2.m_bVotedUp : (bool?)null;
+ if (File.Exists(path))
+ {
+ if (previewTextures.ContainsKey(modID))
+ _ = previewTextures.Remove(modID);
+ }
});
}
- });
- }
+
+ UpdateVotingStatus(modID, (result2, failure2) =>
+ {
+ allVoteStati[modID] = (result2.m_eResult == EResult.k_EResultOK) ? result2.m_bVotedUp : (bool?)null;
+ });
+ }
+ });
}
}
[StaticConstructorOnStartup]
internal class PromotionLayout
{
- static readonly AccessTools.FieldRef ref_steamAuthor = AccessTools.FieldRefAccess("steamAuthor");
internal static bool Promotion(Rect mainRect, Page_ModsConfig page)
{
if (SteamManager.Initialized == false)
@@ -241,7 +247,7 @@ internal static bool Promotion(Rect mainRect, Page_ModsConfig page)
var mod = page.selectedMod;
if (mod == null
- || ref_steamAuthor(mod.GetWorkshopItemHook()).m_SteamID != CrossPromotion.userID
+ || mod.GetWorkshopItemHook().steamAuthor.m_SteamID != CrossPromotion.userID
|| CrossPromotion.promotionMods.Count == 0)
return false;
@@ -249,6 +255,7 @@ internal static bool Promotion(Rect mainRect, Page_ModsConfig page)
var rightColumn = mainRect.width - leftColumn - 10f;
GUI.BeginGroup(mainRect);
+
try
{
ContentPart(mainRect, leftColumn, mod, page);
@@ -259,6 +266,7 @@ internal static bool Promotion(Rect mainRect, Page_ModsConfig page)
GUI.EndGroup();
return false;
}
+
GUI.EndGroup();
return true;
}
@@ -289,7 +297,8 @@ static void ContentPart(Rect mainRect, float leftColumn, ModMetaData mod, Page_M
{
CrossPromotion.allVoteStati[promoMod.m_nPublishedFileId.m_PublishedFileId] = (result2.m_eResult == EResult.k_EResultOK) ? result2.m_bVotedUp : (bool?)null;
});
- }).Start();
+ })
+ .Start();
}
var description = thisMod.m_rgchDescription;
@@ -301,6 +310,7 @@ static void ContentPart(Rect mainRect, float leftColumn, ModMetaData mod, Page_M
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);
var widgetRow = new WidgetRow(imageRect.xMax, imageRect.yMax + 8f, UIDirection.LeftThenDown, width, 8f);
@@ -308,14 +318,15 @@ static void ContentPart(Rect mainRect, float leftColumn, ModMetaData mod, Page_M
{
if (widgetRow.ButtonText("Unsubscribe".Translate(), null, true, true))
{
- Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmUnsubscribe".Translate(mod.Name), delegate
+ Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmUnsubscribe".Translate(mod.Name), () =>
{
mod.enabled = false;
new Thread(() =>
{
- _ = AccessTools.Method(typeof(Workshop), "Unsubscribe").Invoke(null, new object[] { mod });
- _ = AccessTools.Method(typeof(Page_ModsConfig), "Notify_SteamItemUnsubscribed").Invoke(page, new object[] { mainModID });
- }).Start();
+ Workshop.Unsubscribe(mod);
+ page.Notify_SteamItemUnsubscribed(new PublishedFileId_t(mainModID));
+ })
+ .Start();
}, true, null));
}
}
@@ -328,10 +339,7 @@ static void ContentPart(Rect mainRect, float leftColumn, ModMetaData mod, Page_M
{
widgetRow = new WidgetRow(imageRect.xMin, imageRect.yMax + 8f, UIDirection.RightThenDown, width, 8f);
if (widgetRow.ButtonText("Upload", null, true, true))
- Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSteamWorkshopUpload".Translate(), delegate
- {
- _ = AccessTools.Method(typeof(Workshop), "Upload").Invoke(null, new object[] { mod });
- }, true, null));
+ Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSteamWorkshopUpload".Translate(), () => Workshop.Upload(mod), true, null));
}
Widgets.Label(textRect, description);
@@ -346,7 +354,7 @@ static void PromotionPart(Rect mainRect, float leftColumn, float rightColumn, Mo
var headerHeight = 30f;
var headerRect = new Rect(leftColumn + 10f, -4f, rightColumn - 20f, headerHeight);
Text.Anchor = TextAnchor.UpperCenter;
- Widgets.Label(headerRect, "Mods of " + mod.Author.Replace("Andreas Pardeike", "Brrainz") + ":".Truncate(headerRect.width, null));
+ Widgets.Label(headerRect, "Mods of " + mod.AuthorsString.Replace("Andreas Pardeike", "Brrainz") + ":".Truncate(headerRect.width, null));
Text.Anchor = TextAnchor.UpperLeft;
var outRect = new Rect(leftColumn + 10f, headerHeight - 4f, rightColumn, mainRect.height - (headerHeight - 4f));
@@ -366,6 +374,7 @@ static void PromotionPart(Rect mainRect, float leftColumn, float rightColumn, Mo
if (height > 0)
height += 10f;
+
var preview = CrossPromotion.PreviewForMod(promoMod.m_nPublishedFileId.m_PublishedFileId);
if (preview != null)
{
@@ -424,7 +433,7 @@ void actionButtonAction()
{
if (isSubbed || isLocalFile)
{
- var orderedMods = (IEnumerable)AccessTools.Method(typeof(Page_ModsConfig), "ModsInListOrder").Invoke(page, Array.Empty