Inventory Trash Slot


A trash slot for easy deletion of unwanted items.

Utilities
3 hours ago
2.0
36
Character Storage Cheats

i I'm impressed

10 hours ago
(updated 10 hours ago)

I've been using this mod as a trash slot for a while, so when I saw your mod today, I thought I'd provide an idea to distinguish it from previous mods by allowing the user to retain their last deleted item, like you can in Terraria. But I'm delighted to see you've already done it!

Some ideas for improvement/polish:

  • Zoom in the thumbnail a bit, I couldn't tell that the Trash slot had an item inside.
  • Changelogs are usually written in reverse order with the newest update first.
  • Look into how to use localised strings.
  • Show the Trash slot on "container" GUIs too.
  • Either reduce the padding around the slot, or provide a way to collapse the GUI via a button. Right now it sticks out a little bit.
  • Or perhaps a "per-player" setting to move the Trash slot to the top-level HUD, instead of being relative.
  • Use sprite-button's quality property to show the item's quality.
  • Play the item's pickup/drop sound when you place it into / take it out of the Trash slot.
  • You may want to use elem_tooltip with type = "item-with-quality" to give the item a tooltip, but it won't show correct durability for some items.
  • A keybind (unbound by default) to delete one stack of items from the inventory, although I don't know a precise way to tell which stack is being hovered.

EDIT: You can do inventory sounds like this:

player.play_sound{path = "item-pick/inserter"}
player.play_sound{path = "item-drop/inserter"}
9 hours ago

Thanks so much, I really appreciate feedback, I don't think I can detect the hovered item but I could delete the item stack on the cursor, I'll look into it. Anyway these are great suggestions and I'll start working on them soon.

8 hours ago
(updated 5 hours ago)

Yes, I quickly learned to appreciate the value of good feedback when I started modding, so I'm happy to return the favour. :)

Here's another mod I was thinking of. This one has a keybind to show/hide the Trash button.

I have another suggestion for you, but this one is a bit more challenging so you may want to leave it for last: An extensible item denylist.

Here's a good example of how to do this in valves-lib; you'd declare something like this in data.lua:

data:extend{
    {
        type = "mod-data",
        name = "inventory-trash-slot",
        data = {
            denylist = { }
        }
    },
}

Other mods can depend on you and add items they don't want to be deleted like so:

data.raw["mod-data"]["inventory-trash-slot"].data.denylist["cube-ultradense-utility-cube"] = true

In your control.lua runtime code, you can access this list via:

prototypes.mod_data["inventory-trash-slot"].data.denylist

The primary example is Ultracube if you hadn't guessed, which must not be deleted or duplicated under any circumstance.

EDIT: You may also be interested in using styles if you plan on making more GUI mods, but you can probably get away with not using them for this one.

5 hours ago

That's an interesting concept but seems quite ambitious, I am using the vanilla styles currently but I haven't prototyped any custom ones.

New response