[v1.0.1-1.0.5] Inventory Sort Order

A place to post your add ons and ideas for them

Moderator: Moderator

Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#31 Post by Zizzo »

v1o is a small QoL tweak for those who also use the infusion patches in my Utility Supplies addon. Previously, infusion patches were simply sorted by tier, which left speed patches interleaved with higher-tier healing patches. Now we sort by type before tier: clearing patches (only one tier, unless you're making them via tinkers) come before healing patches, which come before speed patches.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#32 Post by Zizzo »

In fiddling around with mecharachnids recently, I was reminded afresh that this addon only improves the inventory sort order for the player. Granted, you might not spend enough time working with your golem's inventory for the lack of improved sorting to be noticeable enough to be annoying, but it occurs to me that stores could also benefit, since they use ActorInventory under the hood. (Admittedly, since most stores only stock one category of objects, this might not be as noticeable, but I'm fairly certain their default sort isn't always getting tier ordering right, and the lost merchant store would definitely benefit.)

So, do people think this would be worth it?
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#33 Post by Zizzo »

Well, no one objected, so that's going out as v2. Note that in an existing game, you'll have to trigger an inventory sort to see the change. For sidekicks like the golem, picking up or dropping something while controlling the golem should do it; for stores, buying or selling something should do it.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#34 Post by Zizzo »

Got a suggestion from over in the Ideas forum:
ledtim wrote:1. Give tinker attachments and demon seeds slot based categories. Like instead of all of them being simply categorized as "tinker" or "demon seed", make them like "tinker-body". So they can be sorted in a meaningful way.
Now, we already sort demon seeds, :mrgreen: but not tinkers, which we can fix. The sort order for demon seeds is attachment slot → demon tier → demon type → demon level, most of which don't apply to tinkers. So I figured I'd ask first: does anyone have any preferences for sort order for tinkers? Attachment slot will probably be first; after that, do we want, for instance, all razor edges grouped together and all crystal edges grouped together (which we're currently not doing)? Ooh, that could apply to salves too; I've noticed before that if you have, say, two healing salves of different tiers, they probably won't be next to each other, since we only sort by tier.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#35 Post by Zizzo »

No one expressed a preference, so I went ahead and did the grouping by tinker type. That's going out as v2a.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#36 Post by Zizzo »

So I was working on another adon, and I wanted it to have it control the sort order of certain items in inventory, and for various reasons I didn't want to hardcode that handling in this addon. Having already set the precedent in Talent Point Planner for adding hooks that other addons can use to influence our behavior, I decided to go the same route here.

To that end, v2c now defines hooks "InvOrder:sortWithinType" and "InvOrder:sortWithinSubtype", called from our overloaded Actor:sortInven() while sorting your inventory. If you're an addon developer and your addon adds new objects, and you want those new objects to be sorted in a particular order by the inventory sorter, you can bind to these hooks to give the algorithm some help. Documentation is included in the addon .teaa.

Other than that, no change in functionality; everything else should sort in the same order it used to (or if it doesn't, let me know. :wink: )
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#37 Post by Zizzo »

This seems like the best place to implement GokuderaElPsyCongro's requested feature. :wink: v2d adds a new game option, "[ZOmnibus] | Sort inventory by pickup time", which does pretty much what it says. You can sort most recently picked up first or least recently picked up first, or disable it (the default). Your starting inventory will be treated as least recently picked up, as will things like quest rewards that are placed directly into your inventory; We Apologize for the Inconvenience.™ (If that's a problem, you should be able to fix it by just dropping the quest reward and picking it back up to assign it a pickup time.)
"Blessed are the yeeks, for they shall inherit Arda..."

GokuderaElPsyCongro
Yeek
Posts: 11
Joined: Sat Feb 12, 2022 7:15 am

Re: [v1.0.1-1.0.5] Inventory Sort Order

#38 Post by GokuderaElPsyCongro »

Thank you so much Zizzo :D That will be outstanding QoL for me

GokuderaElPsyCongro
Yeek
Posts: 11
Joined: Sat Feb 12, 2022 7:15 am

Re: [v1.0.1-1.0.5] Inventory Sort Order

#39 Post by GokuderaElPsyCongro »

Zizzo wrote: Mon Sep 09, 2024 2:23 am Your starting inventory will be treated as least recently picked up, as will things like quest rewards that are placed directly into your inventory
Seems that when (auto)picking up all items from a stack, the last item from the stack (the lowest in the list in the message log) is always placed at the bottom of non starting items. Other items are sorted fine. Picking other items afterwards correctly resorts the old item of the bottom, replacing it with the new one just picked up. Here are a screenshot of the message log and of the inventory screen.
I also disabled the basegame option to sort items per tier which clashed with the sorting from Inventory Sort Order

Edit: It's not an annoying bug, I'll probably just remember to check the bottom of the list when applicable

Zizzo
Sher'Tul Godslayer
Posts: 2520
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.0.1-1.0.5] Inventory Sort Order

#40 Post by Zizzo »

GokuderaElPsyCongro wrote: Wed Sep 11, 2024 10:37 pm Seems that when (auto)picking up all items from a stack, the last item from the stack (the lowest in the list in the message log) is always placed at the bottom of non starting items. Other items are sorted fine. Picking other items afterwards correctly resorts the old item of the bottom, replacing it with the new one just picked up.
We Apologize for the Delay;™ was finally able to reproduce your reported bug (almost by accident…). [sound F/X: source diving] …well, @#$%. Turns out that ActorInventory:pickupFloor() sorts inventory after picking up an object, but before it calls the on_pickup_object() callback where we annotate the picked-up object with its pickup time, so it gets treated like starting inventory for sorting purposes, just as you observed.

Hmm, instead of trying to be clever about it, I think we'll just do another sort pass on inventory once we get control back. That's going out as v2d.1; We Apologize for the Inconvenience.™ :oops:

(On a side note, it turns out that things bought from stores are also put directly into inventory and so don't get a pick-up time; we add a note about that in the game option description.)
"Blessed are the yeeks, for they shall inherit Arda..."

GokuderaElPsyCongro
Yeek
Posts: 11
Joined: Sat Feb 12, 2022 7:15 am

Re: [v1.0.1-1.0.5] Inventory Sort Order

#41 Post by GokuderaElPsyCongro »

Thank you Zizzo, works like a charm! Haha no apologizes needed I've been greatly enjoying your mods sir

Post Reply