Skip to content

Commit

Permalink
Fix convert issue with basic androids (broken UI and spam red errors)
Browse files Browse the repository at this point in the history
  • Loading branch information
aRandomKiwi committed Jul 31, 2021
1 parent 70fb30e commit c59c24f
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
Binary file modified 1.3/Assemblies/AndroidTiers.dll
Binary file not shown.
1 change: 1 addition & 0 deletions Source/Androids For RW1.3/Androids.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
<Compile Include="Extensions\StringBuilderExtensions.cs" />
<Compile Include="Harmony\Alert_RoyalNoAcceptableFood_Patch.cs" />
<Compile Include="Harmony\Alert_ColonistNeedsRescuing_Patch.cs" />
<Compile Include="Harmony\CompAbilityEffect_Convert_Patch.cs" />
<Compile Include="Harmony\InteractionWorker_ConvertIdeoAttempt_Patch.cs" />
<Compile Include="Harmony\InteractionWorker_RecruitAttempt_Patch.cs" />
<Compile Include="Harmony\InteractionWorker_EnslaveAttempt_Patch.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Verse;
using Verse.AI;
using Verse.AI.Group;
using HarmonyLib;
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using System;
using UnityEngine;

namespace MOARANDROIDS
{
/*
* Prevent broky UI when trying to convert a basic android
*/
internal class CompAbilityEffect_Convert_Patch
{
[HarmonyPatch(typeof(CompAbilityEffect_Convert), "ExtraLabelMouseAttachment")]
public class CompAbilityEffect_Convert_ExtraLabelMouseAttachment_Patch
{
[HarmonyPrefix]
public static bool Prefix(LocalTargetInfo target, ref string __result)
{
if(target != null && target.Pawn != null && target.Pawn.IsBasicAndroidTier())
{
__result = null;
return false;
}
return true;
}
}

[HarmonyPatch(typeof(CompAbilityEffect_Convert), "Valid")]
public class CompAbilityEffect_Convert_Valid_Patch
{
[HarmonyPrefix]
public static bool Prefix(LocalTargetInfo target, ref bool __result)
{
if (target != null && target.Pawn != null && target.Pawn.IsBasicAndroidTier())
{
__result = false;
return false;
}
return true;
}
}

[HarmonyPatch(typeof(CompAbilityEffect_Convert), "Apply")]
public class CompAbilityEffect_Convert_Apply_Patch
{
[HarmonyPrefix]
public static bool Prefix(LocalTargetInfo target, LocalTargetInfo dest)
{
if (target != null && target.Pawn != null && target.Pawn.IsBasicAndroidTier())
{
return false;
}
return true;
}
}
}
}
Binary file modified Source/Androids For RW1.3/obj/Debug/AndroidTiers.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
77c806f5eae71f7d223f9756d0a4cf28132a2aa0
d7da2e9ea3b83f44eecbc38f9a2ff868febbd1ef

0 comments on commit c59c24f

Please sign in to comment.