minetest-mods / castle

A fork of Dan's fork old my old castle mod. :P
Other
5 stars 7 forks source link

[Plan] Convert mod to use param2-based coloring #31

Closed VanessaE closed 7 years ago

VanessaE commented 7 years ago

I was thinking the tapestries in this mod should be converted to use param2 coloring. Doing so won't decrease the number of textures, but it would reduce the number of registered nodes to just three (one per length of tapestry), and it would increase the number of available colors, as a side effect. Some colors would vary slightly in hue, saturation, or brightness compared to the default wool images that are currently used, but not enough to ruin the look.

This would get rid of most of the tapestries' crafting, in favor of placing one white-ish node and right-clicking punching it with dye to color it.

An LBM would be provided to convert static nodes to param2-based coloring

This would add a dependency on Unified Dyes, which provides the palette (in the mode I would use, 31 colors: red, orange, yellow, green, cyan, blue, violet, magenta, each in three shades, plus black, dark/medium/light grey, white, pink, and brown) and dye-handling code.

This is about the only mod left among those I use that could make use of param2-based coloring, but since I don't maintain it or have particular control over it, I wanted to first raise an issue and get opinions before I start writing any code.

A Minetest engine development build newer than 2017-01-23 would be needed for the colorization feature (0.4.15-stable will not work).

Examples of how it would be implemented in this particular mod are here:

How a node def would appear (note the paramtype2, palette, after_place_node, after_dig_node, and on_rightclick group entry): homedecor lighting.lua lines 485-503 The "fix rotation" function call at line 502 is defined here: homedecor init.lua lines 85-91 The conversion LBM: homedecor lighting.lua lines 655-700

Note that the lighting.lua file above has other somewhat-similar code to handle other kinds of nodes, but only the highlighted examples here would best apply to the tapestries.

VanessaE commented 7 years ago

Update: instead of right-clicking, Unified Dyes now [re]defines dyes to have an on_use, so the target node just needs to have "ud_param2_colorable" in its groups in order to be colored by Unified Dyes. The need for an after_dig_node callback is unchanged (its main job is to give you back the dye last used on the target node).

That's assuming my plan is acceptable.

VanessaE commented 7 years ago

668763b85bbf210a5c86991569e9d51cdd0340df