[Mod] Unified Dyes [20170620][unifieddyes]

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

Updates: dropped support for the old 89 color palette as it's long since been made obsolete by the 256-color one. In the process, the getpaletteidx() and register_color_craft() calls now require the string "split" to call for that palette, instead of boolean true.

Also, the airbrush now checks the palette that's used on the node you right-clicked on, and alters the color selector to highlight only the colors you can use on that node (with a button to show all colors, if desired). Naturally, it prevents you from selecting a color the node can't accept, unless you "Show All" and select + accept while in that screen.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Chiantos
Member
Posts: 377
Joined: Sun Jan 15, 2017 09:04

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Chiantos » Post

Deleted message
Last edited by Chiantos on Mon Sep 30, 2019 05:34, edited 1 time in total.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

Chiantos wrote:Hello, Vanessa
_ Can i use "facedir" and "color" with paramtype2 ? With "on_place = minetest.rotate_node" ?
No, you cannot directly. The closest you can get is either the split palette mode with paramtype2 = "colorfacedir" (197 colors, see the cut stairs/slopes/et. al in Colored Woods), or the wallmounted palette with paramtype2 = "colorwallmounted" (32 colors, see Ilights or Home Decor). This is a limitation in how the Minetest engine stores color info, sorry.

If you want, you can limit a mod to just certain colors, as long as they're in a compatible palette, as in cheapie's Unified Mesecons mod. In there, she uses split/colorfacedir mode, but trimmed to about 30 colors (well, after I expanded it ;-) ).

- Can i use Api for disabled modify Colors when rotate ? Only modify color with airbrush ?

- When i use airbrush for Paint a rotate'node, node reset to default position ...

Can i modify Colors rotate'node with airbrush and disabled move to default position ?
I don't understand these questions entirely, but: the airbrush is strictly for changing the color of a node. If the node is rotateable because it has paramtype2="colorfacedir" (or "colorwallmounted"), the airbrush will not change the node's orientation. If the orientation changes, that means you're misusing Unified Dyes' API somehow.

Also in your sample code, you've still got some old API calls: unifieddyes.recolor_on_place() and the corresponding after_dig. Those do nothing today - they're empty stub functions to prevent old mods crashing.
Please review the current API doc.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Chiantos
Member
Posts: 377
Joined: Sun Jan 15, 2017 09:04

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Chiantos » Post

Deleted message
Last edited by Chiantos on Mon Sep 30, 2019 05:34, edited 1 time in total.

Jat
Member
Posts: 229
Joined: Fri Nov 11, 2011 16:15

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Jat » Post

Tweak for craft "split", add faint and light.
https://github.com/Jat15/unifieddyes/co ... 42cff19676

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

You're using the wrong repo - Unified Dyes is on Gitlab. Merged your commit there. Thanks :-)
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Jat
Member
Posts: 229
Joined: Fri Nov 11, 2011 16:15

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Jat » Post

Image
Problem colour with "unifieddyes_palette_extended.png" if in "default:sand".or "default:dersert_sand"...
Last edited by Jat on Fri Oct 12, 2018 17:19, edited 1 time in total.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

Update your Minetest engine. That bug has long since been fixed.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Jat
Member
Posts: 229
Joined: Fri Nov 11, 2011 16:15

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Jat » Post

Code: Select all

minetest.override_item(default:sand, {
	on_construct = unifieddyes.on_construct,
	palette = "unifieddyes_palette_extended.png",
	paramtype2 = "color",
	airbrush_replacement_node = "colored_block:sand",
	groups = {ud_param2_colorable = 1,...},
})
I use 0.4.17.1
No problem with "colorfacedir" or "colorwallmounted".

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

Oh I know what it is.

You can't just directly add those settings to an old node definition, because a node that's never had prior orientation or color info defaults to 0 for its param2 value, which corresponds to a shade of pink in the extended palette (while the other two have 0 set to white). Most existing nodes in most will be like that.

I suggest you create your own colorized sand nodes with the proper node def settings, and use them as the outputs for color/dye recipes, with the default sand nodes as inputs. Use those same custom nodes as "replacement" nodes for the airbrush.

Now, if you actually want to colorize an entire landscape:

Override the sand nodes' textures in favor of high-contrast B&W versions, and set up a run-only-once LBM to properly set param2 so that they have the correct color. As a rough guess, you probably need "full" amber at 50% saturation for desert sand (which is a param2 value of 123 I think), and perhaps "faint" amber for regular sand (a param2value of 3). I suggest setting some metadata in each node that you can check inside the LBM to prevent altering them again (i.e. in case the LBM runs again on nodes that have already been fixed).
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Jat
Member
Posts: 229
Joined: Fri Nov 11, 2011 16:15

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Jat » Post

I use :

Code: Select all

minetest.register_lbm({
	name = ":colored_block:"..mod[index].."_"..TypeDeBlock[index].."_".."extended",
	label = "Convert",
	run_at_every_load = false,
	nodenames = mod[index]..":"..TypeDeBlock[index],
	action = function(pos, node)
		minetest.swap_node(pos, {name = node.name, param2 = 240})
		minetest.get_meta(pos):set_int("palette_index", 240)
	end
})

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

That looks about right.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by ThorfinnS » Post

Another I've been meaning to get around to.

Code: Select all

2019-06-14 17:00:56: WARNING[Main]: TextureSource::getPalette(): the specified palette image "unifieddyes_palette_extended.png" is larger than 256 pixels, using the first 256.
sfan5's latest build. 5.1.0, I think.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

Ignore that. It's harmless.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Nordal
Member
Posts: 157
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Nordal » Post

I love addi's darkage mod with the colorable "darkage:glass".
Unfortunately coloring the glass does not work, though unifieddyes installed.
Somewhere I read the reason has something to do with the support by unifieddyes.
I do not know what this really means. Could you please make unifieddyes support addi's darkage?
This would be great!!
Adrido maintains the mod now, I think.
The glass.lua file link is https://github.com/adrido/darkage/blob/master/glass.lua.
Tell me if I can help somehow. I suppose, the node definitions in "glass.lua" are not according to the unifieddyes api anymore.
I'm using version 5.0.1

A second question: Is there any way to get all recipes listed, in order to avoid conflicts inventing new recipes for an own mod?
CFS - still widely unknown

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

From a quick look, that mod uses the old version of the Unified Dyes API (from some point before colored itemstacks were a thing, probably Minetest 0.4.16 or thereabouts), which has since changed. That's probably why it isn't working.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Nordal
Member
Posts: 157
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Nordal » Post

The solution then would be to rewrite the affected parts according to the new Unified Dyes API.
That means every code enclosed in the condition:

Code: Select all

if minetest.get_modpath("unifieddyes") then
...
end
Is that right?
CFS - still widely unknown

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

That part is correct, yes. But make sure you have unifieddyes in the mod optional depends, as well.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Nordal
Member
Posts: 157
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Nordal » Post

But make sure you have unifieddyes in the mod optional depends, as well.
Thank you, it's already in dependencies.txt.

I'll try to fix darkage's glass.lua in accordance with the Unified Dyes API.
May I'll ask you to have a look on code snippet to make sure it's not completely wrong before I continue. :)
Unifieddyes is awesome. Just have to make it work with darkage glass.
CFS - still widely unknown

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

Have fun :-) Also, a look at doyousketch2's stained glass mod, that may give you something to model your code against: https://github.com/andersje/stained_glass
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Nordal
Member
Posts: 157
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Nordal » Post

Thank you :-). Also for the example's link.
CFS - still widely unknown

Nordal
Member
Posts: 157
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Nordal » Post

If I follow the example you give, I have to make an extra mod (darkagestainedglass or something like that), and use

Code: Select all

minetest.override_item("darkage:darkage_glow_glass", {
(here concerning the glow part) if I understand right.

But I want the stained glass functionality to stay within the darkage mod. So rewrote its glass.lua
I wrote the following:

Code: Select all

--[[
		Colorizable Milk Glass Variants, depending on unifieddyes mod

		]]

if minetest.get_modpath("unifieddyes") then

	--[[ Rhombus Milk Glass ]]

	minetest.register_node("darkage:milk_glass", {
		description = "Milky Medieval Glass (Good for colorization)",
		drawtype = "glasslike",
		tiles = {"darkage_milk_glass.png"},
		use_texture_alpha=true,
		paramtype = "light",
		paramtype2 = "color",
		palette = "unifieddyes_palette_extended.png",
		sunlight_propagates = true,
		groups = {cracky = 3, oddly_breakable_by_hand = 3, not_cuttable=1, ud_param2_colorable = 1},
        on_construct = unifieddyes.on_construct,
		sounds = default.node_sound_glass_defaults()
	})

	minetest.register_craft({
		output = "darkage:milk_glass",
		type = "shapeless",
		recipe = {"darkage:glass", "dye:white"}
	})

    unifieddyes.register_color_craft({  [b]line 174[/b]
        output = "darkage:milk_glass",
        palette = "extended",
        neutral_node = "",
        recipe = {
                 "NEUTRAL_NODE",
                 "MAIN_DYE"
        }
    })

    -- Recycling
	minetest.register_craft({
		output = "darkage:glass 1",
		recipe = {{"darkage:milk_glass"}}
	})

end --unifieddyes condition
The same goes for round and square glass.

Now if I run minetest, I get this error message, that I can't solve (terminal copy):

Code: Select all

2019-07-06 17:37:19: ACTION[Main]:  ---- Dark Age Version 1.3 is Loading! ---- 
2019-07-06 17:37:19: ERROR[Main]: ModError: Failed to load and run script from /home/roland/minetest-5.0.1/bin/../mods/darkage/init.lua:
2019-07-06 17:37:19: ERROR[Main]: Invalid crafting recipe (output="darkage:milk_glass 1 0 "\u0001palette_index\u00020\u0003"")
2019-07-06 17:37:19: ERROR[Main]: stack traceback:
2019-07-06 17:37:19: ERROR[Main]: 	[C]: in function 'register_craft'
2019-07-06 17:37:19: ERROR[Main]: 	...e/roland/minetest-5.0.1/bin/../mods/unifieddyes/init.lua:287: in function 'register_c'
2019-07-06 17:37:19: ERROR[Main]: 	...e/roland/minetest-5.0.1/bin/../mods/unifieddyes/init.lua:317: in function 'register_color_craft'
2019-07-06 17:37:19: ERROR[Main]: 	...d/minetest-5.0.1/bin/../mods/darkage/glass_rewritten.lua:174: in main chunk
2019-07-06 17:37:19: ERROR[Main]: 	[C]: in function 'dofile'
2019-07-06 17:37:19: ERROR[Main]: 	/home/roland/minetest-5.0.1/bin/../mods/darkage/init.lua:12: in main chunk
2019-07-06 17:37:19: ERROR[Main]: Check debug.txt for details.
debug.txt says the same. Do you know what is going wrong?
CFS - still widely unknown

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

I'm not sure, offhand... Could you insert print(dump(newrecipe)) at line 266 of unifieddyes init.lua, run, let it crash again, and paste the result?

Also are you sure that's actually Minetest 5.0.1? (i.e. not just the folder name)
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Nordal
Member
Posts: 157
Joined: Mon Jul 30, 2018 15:46
GitHub: Nordall

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by Nordal » Post

Could you insert print(dump(newrecipe)) at line 266 of unifieddyes init.lua, run, let it crash again, and paste the result?

Code: Select all

	local newrecipe = minetest.deserialize(recipe)
    print(dump(newrecipe))  -- line 266
	local coutput = craft.output or ""
Result is unfortunately the same. Pasted debug.txt this time, but error info remains the same on every output:

Code: Select all

-------------
  Separator
-------------

2019-07-07 07:56:18: WARNING[Main]: Mod name conflict detected: "farming"
2019-07-07 07:56:18: WARNING[Main]: Will not load: /home/roland/minetest-5.0.1/bin/../games/minetest_game/mods/farming
2019-07-07 07:56:18: WARNING[Main]: Overridden by: /home/roland/minetest-5.0.1/bin/../mods/farming
2019-07-07 07:56:18: ACTION[Main]: hb.register_hudbar: health
2019-07-07 07:56:18: ACTION[Main]: hb.register_hudbar: breath
2019-07-07 07:56:18: ACTION[Main]: New font registered in font_api: metro.
2019-07-07 07:56:18: ACTION[Main]: [Mod] Soft Leaves [v0.1.0] loaded.
2019-07-07 07:56:19: ACTION[Main]: New font registered in font_api: tinycurs.
2019-07-07 07:56:19: ACTION[Main]: hb.register_hudbar: armor
2019-07-07 07:56:19: WARNING[Main]: 3d_armor_ip: Mod loaded but unused.
2019-07-07 07:56:19: ACTION[Main]: hb.register_hudbar: thirst
2019-07-07 07:56:19: ACTION[Main]:  ---- Dark Age Version 1.3 is Loading! ---- 
2019-07-07 07:56:19: ERROR[Main]: ModError: Failed to load and run script from /home/roland/minetest-5.0.1/bin/../mods/darkage/init.lua:
2019-07-07 07:56:19: ERROR[Main]: Invalid crafting recipe (output="darkage:milk_glass 1 0 "\u0001palette_index\u00020\u0003"")
2019-07-07 07:56:19: ERROR[Main]: stack traceback:
2019-07-07 07:56:19: ERROR[Main]: 	[C]: in function 'register_craft'
2019-07-07 07:56:19: ERROR[Main]: 	...e/roland/minetest-5.0.1/bin/../mods/unifieddyes/init.lua:287: in function 'register_c'
2019-07-07 07:56:19: ERROR[Main]: 	...e/roland/minetest-5.0.1/bin/../mods/unifieddyes/init.lua:317: in function 'register_color_craft'
2019-07-07 07:56:19: ERROR[Main]: 	...d/minetest-5.0.1/bin/../mods/darkage/glass_rewritten.lua:174: in main chunk
2019-07-07 07:56:19: ERROR[Main]: 	[C]: in function 'dofile'
2019-07-07 07:56:19: ERROR[Main]: 	/home/roland/minetest-5.0.1/bin/../mods/darkage/init.lua:12: in main chunk
2019-07-07 07:56:19: ERROR[Main]: Check debug.txt for details.
2019-07-07 07:56:19: ACTION[Main]: Server: Shutting down
2019-07-07 07:56:33: ERROR[Main]: Please choose a name!
Also are you sure that's actually Minetest 5.0.1? (i.e. not just the folder name)
If the CREDITS tab of the minetest main form show's the correct version then I installed 5.0.1.
CFS - still widely unknown

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [Mod] Unified Dyes [20170620][unifieddyes]

by VanessaE » Post

There should have been a dump of all of the recipes that were being created by that helper function (which would be a *lot* if you have lots of Unified Dyes compatible mods), with the last one printed being the one that triggered the error.

That there isn't anything printed, means the code you changed (to add that print() call) is not the code that's being run by Minetest. Maybe you forgot to copy the altered mod to the right place, or you have two copies placed where Minetest can find them (i.e. in two different modpacks).
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests