1) While developing RePrint mod (make it possible to reroll blueprints in telepad) I've faced with a strange situation when after altering ` .SetReshufflingState(true);` for each container `Reshuffle` method being called only for `CharacterContainer`s and not for `CarePackageContainer`s ... so nothing happens when I click on "Reroll" above `CarePackageContainer`s
2) Also seems like `Reroll` btn tooltip copypasted from `CharacterContainer` once
P.S. I do understand that seems like Reshuffle is never used for CarePackageContainer in original game, but we need this in the community mod so could you please fix it?
Steps to Reproduce
[HarmonyPatch(typeof(ImmigrantScreen), "Initialize")] public class ImmigrantScreenInitializePatch { // Enable Reshuffle button for containers public static bool Prefix(Telepad telepad, ImmigrantScreen __instance) { // this.InitializeContainers() var initializeContainers = typeof(ImmigrantScreen).GetMethod("InitializeContainers", BindingFlags.NonPublic | BindingFlags.Instance); if (initializeContainers != null) initializeContainers.Invoke(__instance, null); var containers = (List<ITelepadDeliverableContainer>)Traverse.Create(__instance).Field( "containers").GetValue(); foreach (var container in containers) { switch (container) { case CharacterContainer characterContainer when characterContainer != null: characterContainer.SetReshufflingState(true); Debug.Log("called characterContainer.SetReshufflingState(true)"); break; case CarePackageContainer carePackageContainer when carePackageContainer != null: // todo: for some reason reshuffle for care packages doesn't work carePackageContainer.SetReshufflingState(true); Debug.Log("called carePackageContainer.SetReshufflingState(true)"); break; } } Traverse.Create(__instance).Field("telepad").SetValue(telepad); return false; // skip the original method call } }
[HarmonyPatch(typeof(CharacterContainer), "Reshuffle")] public class CharacterContainerReshufflePatch { public static void Postfix(CharacterContainer __instance) { Debug.Log("called CharacterContainerReshufflePatch.Postfix"); } } [HarmonyPatch(typeof(CarePackageContainer), "Reshuffle")] public class CarePackageContainerReshufflePatch { public static void Postfix(CarePackageContainer __instance) { Debug.Log("called CarePackageContainerReshufflePatch.Postfix"); }
}
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now