Potential Mod - workshop inventory display

Hi everyone,

I have a mod. It makes it so that when you open a workshop and select an item to craft, the mod displays how many of that item you have already.

Is there any interest for this mod being available either on steamworkshop and/or here on the forum?

:merry:

3 Likes

That… sounds amazing.

I’d have to see a screenshot, but this seems like the sort of feature I could easily see fitting in the main game during this last push.

Here are a couple screenshots (they’re older screenshots, but the idea is there)

(note the "Inventory" tab to the right of the "Recipes" and "Orders" tabs)
3 Likes

hey, that looks nice :smiley:
to be honest i was thinking if it would be something needed or not or usefull at all but now i see it i like it :grin:

I would use this myself all the time. Heads up, though: I’m modifying the workshop menu as part of an optimization pass, so if you’re relying on its current inventory tracker, that won’t be there anymore in the next release.

3 Likes

I do use an inventory tracker, the same one that the “Town Overview”'s “Inventory” tab uses.

radiant.call_obj('stonehearth.inventory', 'get_item_tracker_command', 'stonehearth:basic_inventory_tracker')
    .done(function (response) {
        self.workshopInventoryDisplayData.basicInventoryTrace = new StonehearthDataTrace(response.tracker, self.workshopInventoryDisplayData.itemTraces)
            .progress(function (response) {
//....

@max99x, this tracker reports talisman items, like cook’s spoon, as non-iconic form when they are sitting in the stockpile.

I use this check to see if it is “iconic” form of the item, then if it is NOT an iconic, then count it as “deployed”/“placed”:

var isIconic = false;
if (item.canonical_uri && item.canonical_uri.__self != item.uri.__self) {
    isIconic = true;

is there a better way to determine if a talisman is in stock, rather than equipped/used/placed?

Let me know if you need any further information.

:merry:

1 Like

Is that specific to the talismans? Are item.canonical_uri and item.uri simply strings that don’t have a .__self property so that ends up being a null comparison?

yes, it seems to just be the talismans. I’ll check to see if those two properties are plain strings. Thanks for the suggestion.

Edit: Yes, for talismans, the item.canonical_uri property doesn’t exist, so talismans are always non-iconic by my checking code.

If you create your own like that it’s fine. The change is only that StonehearthTeamCrafterView no longer uses one itself so you can’t share the one it used to have.

I use this check to see if it is “iconic” form of the item

“Iconic” is not always a synonym for “item”. You probably want App.catalog.getCatalogData(uri).is_item.

1 Like

Thanks for your help, @max99x & @paulthegreat.

I’ve put the mod up on the steam workshop and here on the forum:

:merry:

1 Like

Is it possible to add 3rd counter to show amount of items required to finish buildings?

1 Like

@Nikolay, I like your idea. I’ll investigate, but it sounds tough :merry:

@max99x,

App.catalog.getCatalogData(uri) did help. Thanks you.

If I have a uri and/or the CatalogData for a talisman like stonehearth:trapper:talisman, is there a good way to match it to the item version that the trapper equips?

For example, if I have the trapper talisman, stonehearth:trapper:talisman, the result I want is stonehearth:trapper:knife.

:merry:

The two are not really related at the technical level. The latter is just the default weapon of the Trapper class (and that class has no other weapons). If you really want to count them, I’d just count citizens with that job.

1 Like

Thank you for the reply, @max99x.

I want to count them so that when the user selects a talisman recipe, then the mod can show how many are equipped.

Do you reckon that looking up all jobs and mapping the "talisman_uri" to the "equipment.mainhand" would be a dependable solution?

Talismans have a unique one-to-one relationship with professions, so I’d just look at the number of each job to determine how many of that talisman is equipped. You don’t need to look at individual hearthling entities and their equipment.

3 Likes