minetest-mods / moreblocks

More Blocks
https://content.minetest.net/packages/Calinou/moreblocks/
zlib License
45 stars 65 forks source link

Cut items do not take on the color of the source block #127

Open VanessaE opened 6 years ago

VanessaE commented 6 years ago

Which is to say, if for example I put a node that's been colored red via the engine's "colored itemstacks" feature, assuming of course I've registered that node with the table saw, the cut objects produced by the saw all come out white.

If I had to guess, I'd say the saw is discarding the block's itemstack metadata when creating the cut items in the formspec. If I understand the feature correctly, you just need to copy the "palette_index" key from the source itemstack to the inventory items.

fluxionary commented 2 years ago

cut nodes cannot reflect the original node's color value when using paramtype2 = "color", because they must be rotatable/orient-able (paramtype2 = "facedir"). there is a paramtype2 = "colorfacedir", but this only supports 8 colors.

there's a number of ways to resolve this:

  1. register 32 variants of every shape so as to support cutting all possible colored nodes. i'm not certain how one could break up the palate to make this work right, but so far as i know, it's theoretically possible. however, you'd end up w/ 1550 new node ids for every such source node.
  2. register separate nodes for every possible facedir, and allow them to be colored. this results in only 1176 node ids (or possibly somewhat fewer, if you account for rotations that yield identical shapes).
  3. explicitly throw an error when someone tries to register a node with stairsplus which has paramtype2 = "color" (my preferred solution, and what i'm going with in https://github.com/minetest-mods/moreblocks/pull/191)
  4. deep and breaking changes to the fundamental data structures of the game