Giter VIP home page Giter VIP logo

Comments (6)

WJAtkin-2021 avatar WJAtkin-2021 commented on July 26, 2024

Same issue here also able to replicate on my end

from rimatomics.

solidDoWant avatar solidDoWant commented on July 26, 2024

Here's how the new(est) rimfridge fork fixed the same issue: just-harry/rimworld-rimfridge-now-with-shelves@5b5ee14

In short, the GroupingLabel property returns a null value.

from rimatomics.

NullSnapshot avatar NullSnapshot commented on July 26, 2024

Unfortunately, setting GroupingLabels doesn't fix it. No other storage mods like LWM use it, so it's not an issue with that property.

from rimatomics.

solidDoWant avatar solidDoWant commented on July 26, 2024

The exception thrown shows that there is a null argument (dict key) being passed to ContainsKey when called in RimWorld.Dialog_BillConfig.FillOutputDropdownOptions. There are two calls to ContainsKey in that function, both of which provide a group label as a key:

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?

from rimatomics.

NullSnapshot avatar NullSnapshot commented on July 26, 2024

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 Building_Storage thingClass, whereas the storage pool has the thingClass Rimatomics.Building_storagePool. I'm assuming the thingClass tag is probably (based on semantics) used to link the c# class instance that should be instantiated to an object when it's spawned.

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 slotGroup.StorageGroup exists in the first place, but is almost assuredly failing on the first ContainsKey since we can validate this happens with only a single storage pool. If that's the case, it's failing (I assume) because the assembly is failing to pass along a GroupingLabel in its registered storage group, regardless of if one is defined in the defs. I feel somewhat safe in saying that since I copied the exact behavior that the just-Harry did with rimFridge, including translation inject defs, and it still didn't work. I could of course also be blowing smoke since I haven't done any sort of heavy-duty modding like this in Rimworld before.

from rimatomics.

NullSnapshot avatar NullSnapshot commented on July 26, 2024

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.

from rimatomics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.