Open S-S-X opened 4 years ago
hmm, i thought the buildable_to = true
part should be enough to make them invisible for things like this, haven't check the tree-growing function yet, maybe it just checks for air
(which would be bad)
exactly as i thought: a hardcoded check for air
:disappointed:
void tree_trunk_placement(MMVManip &vmanip, v3f p0, TreeDef &tree_definition)
{
v3s16 p1 = v3s16(myround(p0.X), myround(p0.Y), myround(p0.Z));
if (!vmanip.m_area.contains(p1))
return;
u32 vi = vmanip.m_area.index(p1);
content_t current_node = vmanip.m_data[vi].getContent();
if (current_node != CONTENT_AIR && current_node != CONTENT_IGNORE
&& current_node != tree_definition.leavesnode.getContent()
&& current_node != tree_definition.leaves2node.getContent()
&& current_node != tree_definition.fruitnode.getContent())
return;
vmanip.m_data[vi] = tree_definition.trunknode;
}
The moretrees
mod calls minetest.spawn_tree()
which ends up calling this in the end.
I'm open for ideas... :shrug:
How does != op work with content_t? Maybe it is able to compare something like groups of something. Maybe... But if it can then maybe it is possible to inject airlight into one of 3 tree_definition nodes checked there. A bit hacky and probably not possible at all, they probably would not have leavesnode and leaves2node if that was possible...
Another possible idea, which is at least as hacky as first idea, would be to override moretrees.grow_* functions and before spawning tree remove all airlight nodes from area.
I can think of few more extremely hacky ways but not any good way to do it.
Ofc opening issue for mt engine to change behavior or to allow changing behavior somehow and then hoping for best. Or patching that part to add specific check for airlight node, if conten_t type easily allows maybe better straight buildable_to check.
edit. I did read some mt sources a bit and yeah content_t is just node id and nothing more, so no fancy operators for that and therefore probably cant affect anything there with just lua code. So I think best option, if anyone with some mt engine experience is interested in fixing this, would be to patch tree spawning code so that it allows replacing buildable_to stuff.
Not so good option would be to patch that tree_trunk_placement adding just airlight but that feels a bit too hacky and not really worth it.
Also I think fixing this with lua code also is not very good idea because it will either be partial workaround with still ugly results or slow inaccurate workaround or accurate but hard to maintain overly complex fragile code with tree def parsing and caching.
i might have found an elegant way to restore the light in the mars caves in https://github.com/pandorabox-io/planet_mars/commit/c7d5bcd6be255fc1438eea21654e62e4644f723c
i tried that some time ago with the param1
light data but couldn't get it to work back then, the trick was to light up a "column"-shaped region to let the light propagate somehow :shrug:.
Anyway: it worked on the caves i tried it on, if the /mars_lightup
command works elsewhere too then it could even make the airlights obsolete if it were executed automatically on dark areas...
Not very good picture about issue but still few airlights "visible":
But if there's airlight and tree tries to grow where airlight happens to be result is tree loses and airlight wins, players will see missing trunk parts (or leaves but missing parts of trunk are easier to notice).
Tree should replace airlight nodes.