mt-mods / mt-mods/pipeworks

Add `remove_items2` and `can_remove2` as a clean replacements

Open
#165 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reason: tube.remove_items(pos, node, stack, dir, count, listname, i) and tube.can_remove(pos, node, stack, dir, listname, i) are currently flawed as they ..

  1. .. have arguments that are ordered differently to the inventory callback API provided by Luanti.
  2. .. have a superfluous node arg
  3. .. do not provide player information --> useful in can_remove

Request:

  • Implement and document tube.remove_items2(pos, listname, index, stack, player, dir) (where dir is additional)
  • tube.can_remove2 likewise.
  • The returned stack should be removed by pipeworks and not the callback. Compare with on_metadata_inventory_take, where this is already done well.

I also thought of extending fakeplayer with a field to indicate the pipeworks origin, such that allow_metadata_inventory_take could be used, however, then there's no direction information, which might be needed in some cases.

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 locating the existing tube.remove_items and tube.can_remove callbacks, then compare their argument handling with on_metadata_inventory_take. Implement and document the remove_items2 and can_remove2 interfaces described in the issue, including player and direction information. Done means the returned stack is removed by pipeworks rather than by the callback, with the documented signatures available to tube users.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.