minetest-mods / technic

Technic mod for Minetest
Other
146 stars 155 forks source link

Get rid of deprecated metadata #628

Closed cx384 closed 5 months ago

cx384 commented 6 months ago

This solves a part of #601

The deprecated metadata gets converted to a proper ItemStackMetaRef. All keys stay the same except for:

(For other keys e.g. mode, the key is special to the item and not universally used, which is not that problematic, I guess.)

There is now only one place left where metadata is used, the sorting function of techinc chests: https://github.com/minetest-mods/technic/blob/5826c2feaa5aea2ade07af93cfec05952470c17b/technic_chests/register.lua#L149-L150 However, I'm unsure how this should be changed. Getting the whole stack meta as a table and use the amount of keys or a serialized version to sort, may be an option, but I don't think it is justified performance-wise.

To do

This PR is a Ready for Review.

(Maybe change the techinc chests sorting function.)

How to test

  1. Start a game with the old version and get some tools, charge them up, change their modes, fill up some cans.
  2. Switch to the new version and see if the tools still work as expected.

I tested it, and didn't find any problem, but I'm not sure if I missed something.

Compatibility note

Other mods which directly accessed the item metadata of technic items will not work anymore.