-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add node texture variants #13811
base: master
Are you sure you want to change the base?
Add node texture variants #13811
Conversation
According to this: https://irc.minetest.net/minetest-dev/2023-01-08#i_6046142 it seems that there is nothing left to be done. Am I right? |
Would it be possible to add weights for each variant? |
What do you mean by it? |
So that one texture is more likely to appear than another, for example. Like, |
So, I understand now. This uses the node param2 value to choose the texture. So if the mod author wants to make some texture more common, he only needs to reflect in on_construct callback or/and in the mapgen generation code. |
a7e1b70
to
e1375ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here Github frustrates me again, as it refuses to expand the C++ diffs. :(
I left comments in the code.
Maybe it should be made clear if you need to override the same set of properties in each variant, or if it is allowed to e. g. add an overlay tile only to variants 3 and 6.
So, It should be documented now as well. There is probably a bug in |
Documentation updates are satisfying.
I wonder if item metadata needs to have both palette_index and variant.
Probably yes, because in non-nodes they can be independent.
I got the whole patch now, and have no further comments.
…---
I don’t want to put a requirement on this pull request—but I got the idea that
`description` should be variant-able.
Then you can use one node definition for all colors of wool, with each color
having the appropriate description, without manually creating item drops.
(And with the configurable bitfield, it also works with colorfacedir. :) )
|
Yeah, the per-player-per-nodedef variant offset is a cool idea.
Finally allows to make nodes visible only to certain players, like
ParticleSource.playername can do it for particles.
The “barriers” of Minecraft, which are only visible while wielding a barrier,
can be implemented this way.
Honestly I do not think it _needs_ to be included in this pull request.
But if it is included, it seems the documentation in lua_api.md is still
missing.
(I would also like this on the clientside modding API, for responsiveness.)
|
*lightbulbgoeson* Ah, the variant offset explains why the API currently allows
to define a higher variant count than can be accessed from the param2
bitfield. :)
|
@doxygen-spammer |
Nice!
|
It would indeed fix the first issue but not the second one. ABMs and LBMs do more stuff than simply swapping textures. Sometimes you want to remove the node completely, move the nodes or maybe spawn a structure. Not being able to change ABMs/LBMs after they are created makes them inflexible while hitting performance. |
@sfence rebase needed |
it is possible to do it that way. However, it will probably be a controversial solution because it can result in many metadata reading during rendering. |
b3ed6c6
to
e57b43a
Compare
Once I get some time later I’ll test this out again. |
Ok. So after some playing around I made a node that uses player:set_node_visual in an on_construct function, and it seems that it force closes mt (unless I made a mistake in the function), but here's what I get in the debug log.
|
@sfence rebase needed |
…nd needed logic around it to allow game to set variant_offset
It's a little late, and maybe I'm the only one who thinks this way, but wouldn't it be way better to put this feature into the tile definition instead of polluting the node definition table even more. This way, you would also avoid problems with future tile features. tiles = {{
name = "mod_grass1.png",
color="green",
variants = {"mod_grass2.png", {name = "mod_grass3.png"}, {name = "mod_grass4.png", color="red"}},
}} I like this feature very much, but I don't like how the API looks like. |
@sfence rebase needed |
wouldn't it be way better to put this feature into the
tile definition
instead of polluting the node definition table even more.
I think it would be more pollution if node variants are expanded to cover
sounds, description, etc.
Otherwise it would seem better to me, at least slightly better.
|
I get where you're coming from, but being able to override arbitrary node def fields with param2 is nonsense. Also, for a feature to occupy such a limited resource like param2 bits, you need sufficient use cases. It is not worth maintaining useless features that nobody uses. Edit: |
Feel free to wait for my review before rebasing. |
This is the adoption of #12928. Closes #9193
I have rebased the original @TurkeyMcMac code and tested it.
It looks to be working without some artifact on my Linux.
To do
This PR is Ready for Review.
How to test
There are test nodes in the developer test game. They can be used to test.
There is also the command
/node_visual
which allows to changevariant_offset
for the wanted node.Example of command:
/node_visual testnodes:variant_color variant_offset 2