StrangeLoopGames / EcoIssues

131 stars 21 forks source link

0.9 workorder should display available resources #15105

Closed elfl0rd closed 4 years ago

elfl0rd commented 4 years ago

изображение

what about "available resources"?

johnkslg commented 4 years ago

Requires more work that could cause performance issues. Or maybe @mirasrael has a good idea

elfl0rd commented 4 years ago

for me - fine solution if this tooltip use same technology as ingredient icon in recipe. Heavy calculation is not needed.

(But maybe text not "available" maybe something like "resources in available storages" is better)

mirasrael commented 4 years ago

Yes, tooltip only is enough.

johnkslg commented 4 years ago

@gzatravkin can you make this use whatever the ingredient tooltip does to calculate available resources (refactor to use the same code path too)

johnkslg commented 4 years ago

Make it say something like (x available in storage) after the other numbers, if there are stored ones around

SlayksWood commented 4 years ago

Nothing: image

mirasrael commented 4 years ago

Can collect total items and tag using this code

var availableItems = this.DefaultInventory.NonEmptyStacks.ToDict();
            var availableTags = new Dictionary<Tag, int>();
            foreach (var entry in availableItems)
            {
                foreach (var tag in Item.Get(entry.Key).Tags())
                {
                    availableTags.AddOrUpdate(tag, entry.Value, (oldVal, newVal) => oldVal + newVal);
                }
            }
mirasrael commented 4 years ago

Use something like this to describe ingredients

if (missingIngredient != null)
                    "[X:red] [Item] missing (Y total remaining)";
                else
                    "Y [Item] total remaining ([Z:yellow if Z < Y:green otherwise] available in storage)";
SlayksWood commented 4 years ago

Now I can't see how much I need. image

mirasrael commented 4 years ago

image image