-
-
Notifications
You must be signed in to change notification settings - Fork 17
Storage Pools causes the "Take to best stockpile" option in crafting menus to break 1.5 #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same issue here also able to replicate on my end |
Here's how the new(est) rimfridge fork fixed the same issue: just-harry/rimworld-rimfridge-now-with-shelves@5b5ee14 In short, the |
Unfortunately, setting GroupingLabels doesn't fix it. No other storage mods like LWM use it, so it's not an issue with that property. |
The exception thrown shows that there is a null argument (dict key) being passed to private void FillOutputDropdownOptions(
ref List<FloatMenuOption> opts,
string prefix,
Action<ISlotGroup> selected)
{
List<SlotGroup> listInPriorityOrder = this.bill.billStack.billGiver.Map.haulDestinationManager.AllGroupsListInPriorityOrder;
Dialog_BillConfig.tmpGroups.ClearValueLists<string, ISlotGroup>();
for (int index = 0; index < listInPriorityOrder.Count; ++index)
{
SlotGroup slotGroup = listInPriorityOrder[index];
if (slotGroup.StorageGroup != null)
{
StorageGroup storageGroup = slotGroup.StorageGroup;
// First instance
if (!Dialog_BillConfig.tmpGroups.ContainsKey(storageGroup.GroupingLabel))
Dialog_BillConfig.tmpGroups.Add(storageGroup.GroupingLabel, new List<ISlotGroup>());
if (!Dialog_BillConfig.tmpGroups[storageGroup.GroupingLabel].Contains((ISlotGroup) slotGroup.StorageGroup))
Dialog_BillConfig.tmpGroups[storageGroup.GroupingLabel].Add((ISlotGroup) slotGroup.StorageGroup);
}
else if (!(slotGroup.parent is Building_Storage parent) || parent is IRenameable)
{
// Second instance
if (!Dialog_BillConfig.tmpGroups.ContainsKey(slotGroup.GroupingLabel))
Dialog_BillConfig.tmpGroups.Add(slotGroup.GroupingLabel, new List<ISlotGroup>());
Dialog_BillConfig.tmpGroups[slotGroup.GroupingLabel].Add((ISlotGroup) slotGroup);
}
}
foreach (KeyValuePair<string, List<ISlotGroup>> keyValuePair in (IEnumerable<KeyValuePair<string, List<ISlotGroup>>>) Dialog_BillConfig.tmpGroups.OrderBy<KeyValuePair<string, List<ISlotGroup>>, int>((Func<KeyValuePair<string, List<ISlotGroup>>, int>) (kvp => kvp.Value.Count <= 0 ? 0 : kvp.Value[0].GroupingOrder)))
{
KeyValuePair<string, List<ISlotGroup>> kvp = keyValuePair;
if (this.ShouldCollapseGroup(kvp.Key))
opts.Add(new FloatMenuOption(kvp.Key, (Action) (() =>
{
List<FloatMenuOption> floatMenuOptionList = new List<FloatMenuOption>();
this.FillSlotGroupOptions(kvp.Value, floatMenuOptionList, prefix, selected);
Find.WindowStack.Add((Window) new FloatMenu(floatMenuOptionList));
})));
}
foreach (KeyValuePair<string, List<ISlotGroup>> keyValuePair in (IEnumerable<KeyValuePair<string, List<ISlotGroup>>>) Dialog_BillConfig.tmpGroups.OrderBy<KeyValuePair<string, List<ISlotGroup>>, int>((Func<KeyValuePair<string, List<ISlotGroup>>, int>) (kvp => kvp.Value.Count <= 0 ? 0 : kvp.Value[0].GroupingOrder)))
{
if (!this.ShouldCollapseGroup(keyValuePair.Key))
this.FillSlotGroupOptions(keyValuePair.Value, opts, prefix, selected);
}
} What am I missing here? |
To preface this, I have very little experience in rimworld modding, especially when it comes to assemblies. Most other storage things in other rimworld mods are part of the I can't remember exactly what the behavior was in 1.4. Did the storage pool show up before as a haul destination? Regardless, stepping through the current behavior, it appears to correctly build and register a storage group since it's getting through the null check to see if |
Here's someone more qualified than me talking about the changes: lilwhitemouse/RimWorld-LWM.DeepStorage#151 (comment) Specifically demonstrates through the code that it's likely an issue in the assemblies that needs to be fixed. Also supports my theory that the c# assembly isn't currently written to expose the GroupingLabel property, leading to the null key check. |
Yeah, so we(player) can make a HarmonyPatch to fix that, like: [HarmonyPostfix]
[HarmonyPatch(typeof(Building_storagePool), nameof(Building_storagePool.GroupingLabel), MethodType.Getter)]
public static void GroupingLabelPatch(ref string __result)
{
__result = "GroupPlural".Translate();
} |
Storage Pools causes the "Take to best stockpile" option in crafting menus to break, preventing you from choosing any option from the drop down menu. Removing the storage pools allows the menus to work properly.
How to Reproduce:
Have RimAtomics installed on vanilla or with any mods.
place storage pool anywhere on the map.
Place crafting spot
Add any recipe
Select "details"
Select "Take to best stockpile"
that should throw this error:
Exception filling window for RimWorld.Dialog_BillConfig: System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary
2[TKey,TValue].FindEntry (TKey key) [0x00008] in <eae584ce26bc40229c1b1aa476bfa589>:0 at System.Collections.Generic.Dictionary
2[TKey,TValue].ContainsKey (TKey key) [0x00000] in :0at RimWorld.Dialog_BillConfig.FillOutputDropdownOptions (System.Collections.Generic.List
1[Verse.FloatMenuOption]& opts, System.String prefix, System.Action
1[T] selected) [0x000ed] in <957a20e0be784a65bc32cf449445b937>:0at RimWorld.Dialog_BillConfig.DoWindowContents (UnityEngine.Rect inRect) [0x00875] in <957a20e0be784a65bc32cf449445b937>:0
at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x001a6] in <957a20e0be784a65bc32cf449445b937>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.Window:InnerWindowOnGUI (int)
UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)
The text was updated successfully, but these errors were encountered: