ZenonSeth / logistica

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

Add MCL support #9

Closed ThePython10110 closed 7 months ago

ThePython10110 commented 7 months ago

This PR adds MineClone2/Mineclonia support. So far, I've done the itemstrings/crafting and sounds, but still need to update formspecs and a few other things (including node breakability). Most things seem to work, although I haven't tested everything.

ZenonSeth commented 7 months ago

Hey, thanks for your PR, and nice work! I saw the issue you raised a couple of months ago but sadly due to real life issues I've had no time to work on Logistica, and I also have never played any Mineclone or related derivatives. I can test this out this weekend and I can also work on this on top of your PR.

At a first glance, it looks pretty good - I have two minor points:

I'm curious, since I don't play MCL/etc. - what exactly needs to be updated for node breakability? Do MCL nodes not use the standard tool-based breakability (aka 'choppy', 'cracky', 'oddly_breakable_by_hand` ) ?

ThePython10110 commented 7 months ago
  1. I didn't think about i being so common, but it definitely is, so I'll change it.
  2. I will add a check for this.

MCL uses its own system to emulate Minecraft's breaking times. Basically, each node will have groups for tools it can be broken with (pickaxey, handy, axey, etc.), and each node also has its own hardness value, specified with _mcl_hardness in the definition. It's a bit more complicated than that, but that's basically how it works.

ZenonSeth commented 7 months ago

I haven't checked your formspec changes on Mineclone, but I noticed that for quite a few formspecs you've also increased the height, sometimes it's not noticeable, but on some it is, for example, this is the Mass Storage formspec:

image

Are these height changes because of Mineclone needing taller formspecs due to main player inv?

Maybe it's worth making the logistica.inv_width into a function logistica.formspec_size(w,h) that takes 2 params: width and height - and returns a string in the form of "w,h" where it can adjust both the width and height for Mineclone?

So for example, for the injector formspec instead of what you have now:

"size["..(logistica.inv_width + 2.7)..",9]" ..

it would be

"size["..logistica.formspec_size(10.7, 8.5).."]"..

where the 10.7, 8.5 were the original dimensions I had.

Would that work for Mineclone - a consistent adjustment on the original dimensions via that function? I also think that would look cleaner and be easier to adjust in the future if I add/modify any formspecs.

ThePython10110 commented 7 months ago

This is just because I decided to add the extra bit of separation between the hotbar and the rest of the inventory. I accidentally added 0.5 instead of 0.25 (and in some cases, I somehow did math wrong and added even more, such as the cobble gen). I'm working on that right now.

ThePython10110 commented 7 months ago

I can't figure out why the autocrafter formspec has black text in MCL. I thought maybe adding no_prepend[] to the lava furnace background might fix it, but it didn't. In fact, the button seems to be styled like MCL buttons, so it looks like `no_prepend may not even be working properly...

Edit: Never mind, I fixed it.

ThePython10110 commented 7 months ago

Anything else I need to do? I haven't tested everything yet, but I'm working on it.

ZenonSeth commented 7 months ago

Anything else I need to do? I haven't tested everything yet, but I'm working on it.

As far as MCL compat, I'm not sure, as I said, I have not played that game though I did download it, I will try to test it tomorrow. (sidenote: is there an equivalent in MCL of how unified_inv acts as a useful give inv for admin testing?). I think for most of MCL testing I would rely that you know what you're doing

What I want to do is double check all functionality on my MT test world for this on your fork, before merging this.

One thing I want to improve the formspec sizing to what I mentioned above - having a single function that takes a fixed size of w,h and adjusts it to MCL size where necessary. I am not a fan of the current way of randomly adding arbitrary numbers to the size. I will do that tomorrow as well and double check as much of it on MCL as I can.

ThePython10110 commented 7 months ago

The only thing I did with the formspec height was add a 0.25 extra space between the hotbar and the rest of the inventory, and updated the formspec size to match (and I fixed the formspec size after you pointed out that it was too much).

And there isn't really anything as good as Unified Inventory, but you can use /gamemode creative and /gamemode survival to switch between creative and survival mode.

ZenonSeth commented 7 months ago

I went ahead and did the formspec changes now - see the commit I pushed - basically it's just to make reading the formspec sizes easier for me at least: rather than thinking why 4 or 2 is being arbitrarily added to the width, this makes the size be obvious at a glance and it still adjusts it the same way as you did for MCL.

I'm done for today (it's 2315 here) - I will test this again tomorrow, in roughly 12hrs from this comment - and if i don't find any major issues, I can merge it.

Actually there is one minor issue I saw, not sure what is causing it:

ZenonSeth commented 7 months ago

OK, tested it on both MTG and MCL, the UI looks good, basic functionality is there, I think this is good to go.

Edit: last minute i decided to check digging - the reservoirs in MCL seem to be un-diggable with even a diamond pick, looking into it now. OK, they are not diggable in survival mode only - I'm unsure why, inspecting the node it seems to have the correct groups

ZenonSeth commented 7 months ago

@ThePython10110 So I spend an hour going through the MCL api docs and trying out a few things, but no success. The Reservoirs - all variants - empty/full and silverin/obsidian are not diggable in MCL in survival mode at all, even though inspecting the node shows they have the appropriate (as far as I can tell) groups set: image

I don't have more time to look into it right now, will come back to it later - I think this is important to fix before releasing this.

ThePython10110 commented 7 months ago

The problem was level = 1. In MCL, all tools are level 0, since you can use any tool to break any node (but it doesn't drop unless the tool is good enough).