Reassure previous nil behaviour for tiles #12659
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The mod
dumpnodes
which is included with minetestmapper has brokenwith 5.6.0 when run with
bike
mod, due to changes in 18fbc03 whichdefines a tiles table for all nodes by default, where previously a nil
was returned if a nil was given. Restore previous behaviour so mods do
not break.
Summary
Fix compatibility with mods that expect tiles to be
nil
if they registered their items withtiles = nil
It removes the entries from the item defaults that were re-added in 18fbc03
Consider this the issue report as well. I saw fit to write the whole PR rather than worry about reporting the issue first.
This is a maintenance item that I hope will be in 5.6.1
The long-winded version
The mod
dumpnodes
which is included with minetestmapper has broken with 5.6.0 when run withbike
mod, due to changes in 18fbc03 which defines a tiles table for all nodes by default, where previously a nil was returned if a nil was given.This problem was hard to trace and I used
git bisect
to find it. I am worried that it may be the cause of hard-to-understand bugs in other mods and that this may not be the only mod affected. A guarantee that nil in leads to nil out seems sensible to me, especially given that most other table properties do not have default values with the exceptions ofwield_scale
,post_effect_color
andselection_box
. Surely the fewer defaults necessary the better as well.The reasoning of code clean-up of obselete code seems sound at first, but the implementation was wrong. In particular, in 2b500d, celeron55 commented:
However, now that those obsolete features are gone, since they were deprecated in fd1135c, (
git describe
d as0.4.dev-20120606-11-gfd1135c7a
, i.e. in 2012 BEFORE the release of 0.4), empires have risen and fallen, and mods are much more used to a nil value than an empty table value.Here is the registration used in
bike
:To do
This PR is a Work in Progress, needing only a regression test, which I am unsure how to do correctly. It seems possible to register item definitions from C++ inside src/unittest but not to call them with the filler values eventually used in
minetest.register_node
, and I'm not sure to what extent we are meant to call into the Lua API from C++.How to test
dumpnodes
from minetestmapperbike
from Hume2's GitLabbike
anddumpnodes
enabled./dumpnodes
nil
tiles, not an empty table.