Skip to content

Conversation

@j-r
Copy link
Contributor

@j-r j-r commented Nov 22, 2025

Use vector.new/copy/offset as appropriate and replace deprecated use of vector.new by vector.copy.

Background

While doing their redstone rewrite Mineclonia decided to make aggressive use of the vector metatable and assume that it is present when positions are passed to standard callbacks (see https://codeberg.org/mineclonia/mineclonia/issues/3820). This worked out surprisingly well and it seems feasible to update mods that don't always provide the metatable. Digtron already uses vector.new in some places and this PR consistently replaces all manually created position vectors with the appropriate vector constructor.

Testing

There should be no change in digtron behavior.

Use vector.new/copy/offset as appropriate and replace deprecated use of
vector.new by vector.copy.
@j-r
Copy link
Contributor Author

j-r commented Nov 25, 2025

Added a commit that adds a message when run on old Luanti or MTG versions as well as adding polyfills, and a 2nd one with min_minetest_version.

I was quite happy with these until I noticed that fakelib is already using vector.copy. Aargh:-)

I think I'll mostly remove the polyfill commit and just keep the message (upgraded to an error) after testing for vector.copy and default.set_inventory_action_loggers and merge with the min version commit. This should also fix the luacheck problem.

@j-r j-r force-pushed the vector branch 2 times, most recently from 371ec26 to 438b894 Compare November 25, 2025 20:34
But provide fallback to run with default mods that don't have
set_inventory_action_loggers.
@j-r
Copy link
Contributor Author

j-r commented Nov 25, 2025

This seems to be ready now. It errors out if Luanti is too old, but falls back with warning if default mod doesn't have set_inventory_action_loggers (it might be some compatibility layer instead of MTG, after all).

@j-r j-r requested a review from SmallJoker November 25, 2025 20:40
Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you for the adjustments.
Will merge in a few days unless there are objections.

@SmallJoker SmallJoker merged commit 0a4ae97 into minetest-mods:master Nov 29, 2025
1 check passed
@j-r j-r deleted the vector branch November 29, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants