Skip to content

Add support for MineClone container groups #96

Open
@ThePython10110

Description

@ThePython10110

Pipeworks should support MineClone's container groups. This would make it compatible with any containers that support MineClone's hoppers (and therefore most mods that support MineClone).

Formspecs should be overridden manually if they are going to be overridden.

From MineClone's GROUPS.md:

  • container: Node is a container which physically stores items within and has at least 1 inventory
    • container=2: Has one inventory with list name "main". Items can be placed and taken freely
    • container=3: Same as container=2, but shulker boxes can not be inserted
    • container=4: Furnace-like, has lists "src", "fuel" and "dst".
      It is expected that this also reacts on on_timer;
      the node timer must be started from other mods when they add into "src" or "fuel"
    • container=5: Left part of a 2-part horizontal connected container. Both parts have a "main" inventory
      list. Both inventories are considered to belong together. This is used for large chests.
    • container=6: Same as above, but for the right part.
    • container=7: Has inventory list "main", no movement allowed
    • container=1: Other/unspecified container type

You could do this fairly easily, something like this:

for name, def in pairs(minetest.registered_items) do
    local container = def.groups.container
        if container == 2 or container == 3 then
            minetest.override_item(name,
                tube = {
                    -- check allow_metadata_inventory_put/take/move functions
                    -- insert/remove from main
                }
            )
        elseif container == 4 then
            minetest.override_item(name,
                tube = {
                    -- check allow_metadata_inventory_put/take/move functions
                    -- insert into src from the top and fuel from side (?), remove from dst
                    -- Looking at things, it seems like fuel usually goes into the top with Pipeworks, although with hoppers it goes into the side. So I don't know.
                    -- start node timer
                }
            )
        elseif container == 5 or container == 6 then
            minetest.override_item(name,
                tube = {
                    -- check allow_metadata_inventory_put/take/move functions
                    -- insert into main or other side's main
                }
            )
        end
    end
end

It doesn't even depend on any MineClone mods. Also, it should override the groups and after_place/on_rotate/after_dig functions (in a non-destructive way, of course), but I didn't bother to type all that in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions