-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix convert issue with basic androids (broken UI and spam red errors)
- Loading branch information
1 parent
70fb30e
commit c59c24f
Showing
5 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
Source/Androids For RW1.3/Harmony/CompAbilityEffect_Convert_Patch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
2 changes: 1 addition & 1 deletion
2
Source/Androids For RW1.3/obj/Debug/Androids.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
77c806f5eae71f7d223f9756d0a4cf28132a2aa0 | ||
d7da2e9ea3b83f44eecbc38f9a2ff868febbd1ef |