mt-mods / mt-mods/pipeworks

Add support for MineClone `container` groups

Open
#96 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
20
Forks
31
Avg merge
1m
Merged PRs (30d)
9

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading MineClone's GROUPS.md and tracing Pipeworks' use of minetest.registered_items and minetest.override_item. Implement handling for the listed container group values, including inventory callbacks and the relevant placement, rotation, digging, and node-timer behavior without destructive overrides. Done means compatible container groups are supported without requiring MineClone mods.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.