Jump to content

feels like CarePackageContainer.reshuffleButton click bind is broken

  • Branch: Live Branch Version: Linux Pending

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 :wilson_smile: 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(

        foreach (var container in containers)
            switch (container)
                case CharacterContainer characterContainer when characterContainer != null:
                    Debug.Log("called characterContainer.SetReshufflingState(true)");
                case CarePackageContainer carePackageContainer when carePackageContainer != null:
                    // todo: for some reason reshuffle for care packages doesn't work
                    Debug.Log("called carePackageContainer.SetReshufflingState(true)");


        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");


User Feedback

    .SetValue((System.Action) (() =>
        Debug.Log("carePackageContainer reshuffle button was clicked");
        var reshuffle = typeof(CarePackageContainer).GetMethod("Reshuffle", BindingFlags.NonPublic | BindingFlags.Instance);
        var reshuffleParams = new object[] {false};
        if (reshuffle != null) {
            Debug.Log("CarePackageContainer.Reshuffle method was triggered");
            reshuffle.Invoke(carePackageContainer, reshuffleParams);

I've resolved this issue via manually patched `reshuffleButton.onClick` binding :wilson_cool:

Ok thanks @madzohan , Klei Entertainment appreciated your efforts :wickerbottomthanks::wilson_goodjob:


Edited by madzohan
  • Like 1

Share this comment

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...