ZenonSeth / logistica

A Minetest item transport and storage mod
Other
1 stars 4 forks source link

Mineclonia checks for crafting table near player #16

Closed Ocraw closed 3 weeks ago

Ocraw commented 1 month ago

Breaking the crafting in logistica formspec, not sure if this is fixable in logistica itself.

https://codeberg.org/mineclonia/mineclonia/src/commit/e80905d861e9c59f2924afdcf490bb1211eb0f52/mods/HUD/mcl_inventory/init.lua#L183

ZenonSeth commented 1 month ago

Well that's unfortunate.

There is a way to "fix" this by giving the AP its own crafting inventory and implementing the crafting logic there, instead of re-using the player's inventory. But since it's not a small change, I'm not sure when I'll have the time to do the change and test it.

Ocraw commented 1 month ago

I'll give it a try but really just take it as no promises and little hopes, I just started with minetest.

ZenonSeth commented 3 weeks ago

Just an update: I had a go at this, and it works - in the sense that I can make a crafting grid in the AP's fake inventory, and it crafts. But it lacks many of the features the default crafting grid has (e.g. just clicking on the output item takes it by default, and immediately places a new copy of the output item (if enough input items remain) into the output slot. So it's nowhere near as easy to use. It also lacks the default shift+click the output slot to craft as many items as possible from the input stacks.

The problem is that these features aren't actually written using the Lua API (as far as I can tell) - and in fact, I believe they are unique non-API features hardcoded in the C++ code specifically for the "craft" and "craftpreview" inventory lists for each player.

So the current state of this:

  1. I will try to make a new release to at least give back basic remote crafting functionality in Mineclonia, but this is now more complicated because I want to keep the old behavior for non-Mineclonia games (since new behavior has fewer features as described above)

  2. In order to get fully-featured remote crafting grid functionality in Mineclonia, one of two things needs to happen. Either:

    1. I get the Minetest c++ team to expose these extra features via Lua API, or I go do it myself (I have done PRs to Minetest before). But either option is going to be very slow, because API changes take time, consideration, and if/when it finally gets changed, it will also force people using Logistica to use newer Minetest versions since I will be using the new APIs. This option is far less likely to happen, realistically speaking, in no small part due to the fact I don't have the time and energy to put the work behind this at the moment.
    2. I need to raise an issue in Mineclonia for them to change or add to their own API to effectively allow mods (like Logistica) to define exactly what a "crafting table" is for the purposes of checking if there is one nearby. This is much easier to do, but also will take time, and a minimum Mineclonia version (if/when their API is updated) - and I will then have to add multiple code checks to support old and new Mineclonia versions. This option is more likely to happen, realistically. Edit: I've raised an issue on Mineclonia here: https://codeberg.org/mineclonia/mineclonia/issues/1758

Bottom line though, I will aim to get an update to at least make the remote crafting usable by end of this weekend (while maintaining old, fully-featured crafting in non-Mineclonia games), but a proper fully-featured crafting grid in the Access Point won't be available for Mineclonia for a long time, possibly indefinitely if the Mineclonia devs are not open to adding/changing their API.

corarona commented 3 weeks ago

as posted on codeberg: this should actually be possible without mcla changing anything by just overwriting mcl_crafting_table.has_crafting_table and returning true depending in your own conditions.

I was however thinking we could also add a "crafting_table" group which it looks for by default so instead of rolling your own function you could just add your own node to that group.

(the 2nd option will ofc not be compatible to prior mcla versions).

ZenonSeth commented 3 weeks ago

Going to continue this discussion on codeberg, to keep it in one place there.

ZenonSeth commented 3 weeks ago

@Ocraw This should now be fixed in Release 1.2.8 https://github.com/ZenonSeth/logistica/releases/tag/1.2.8 - also available on ContentDB

Ocraw commented 3 weeks ago

Hey, great job! Vacation with limited internet at the moment, will take a look when possible. Edit: works like a charm!