Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

de-duplicate chest code #123

Merged
merged 3 commits into from
Apr 11, 2024
Merged

de-duplicate chest code #123

merged 3 commits into from
Apr 11, 2024

Conversation

a-tour-ist
Copy link
Contributor

@a-tour-ist a-tour-ist commented Apr 5, 2024

@fluxionary already mentioned in #122 that the chest override code is behind mtg. While the specific bug mentioned there got fixed already, other long-fixed bugs from mtg, such as luanti-org/minetest_game#1884 still appear with the pipeworks version.

The approach of this PR consists of 2 parts:

  1. The override table for the chests is nearly always the same, mostly only changes in the tiles. So I made a general function to override any given chest to be compatible with pipeworks
  2. The splitstacks switch in the formspec:
    • mtg: since mtg opened the chest api (Make default.chest.register_chest() usable for other mods luanti-org/minetest_game#2127), it's no longer needed to duplicate the open chest code, making it much easier to maintain here. (Just dropping Ensure chests close properly luanti-org/minetest_game#2965 as another example that got missed here...)
    • hades: got a large chest update... Now all chests from hades connect to pipeworks. I also updated (copy-pasted) some formspec-creation code from there, so a texture error I get when opening a chest is now fixed.
    • mcl_barrels: that switch did not exist in the previous compat code, adding it would mean a lot of code duplication from there...
      I'd rather opt for a chatcommand/tool to control that value. This would also allow to drop a lot of the code for hades.

I tested everything I can imagine, I hope I missed nothing :-)

add pipeworks.override_chest() to make a existing chest connecting to pipeworks
fix crash with after_place_node() there
let mcl_barrels make use of the new function
@SwissalpS
Copy link
Contributor

ran this on a pandorabox-mods world. I didn't test the duplication part, mainly focused on optics and tube functions on technic chests and machines. No obvious errors found this way.

@BuckarooBanzay BuckarooBanzay added the enhancement New feature or request label Apr 11, 2024
@BuckarooBanzay
Copy link
Member

thanks 👍

@BuckarooBanzay BuckarooBanzay merged commit 1169cff into mt-mods:master Apr 11, 2024
1 check passed
@a-tour-ist a-tour-ist deleted the chests-rewrite branch April 22, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants