1
0
Fork 0

Update stem images and automatically colorize them

This commit is contained in:
Wuzzy 2017-07-21 19:47:20 +02:00
parent dacb06579c
commit d3dbedd199
24 changed files with 35 additions and 6 deletions

View File

@ -60,6 +60,10 @@ local stem_drop = {
-- Growing unconnected stems
local startcolor = { r = 0x2E , g = 0x9D, b = 0x2E }
local endcolor = { r = 0xFF , g = 0xA8, b = 0x00 }
for s=1,7 do
local h = s / 8
local doc = s == 1
@ -68,6 +72,7 @@ for s=1,7 do
entry_name = "Premature Melon Stem"
longdesc = "Melon stems grow on farmland in 8 stages. On hydrated farmland, the growth is a bit quicker. Mature melon stems are able to grow melons."
end
local colorstring = mcl_farming:stem_color(startcolor, endcolor, s, 8)
minetest.register_node("mcl_farming:melontige_"..s, {
description = string.format("Premature Melon Stem (Stage %d)", s),
_doc_items_create_entry = doc,
@ -78,7 +83,7 @@ for s=1,7 do
drawtype = "plantlike",
sunlight_propagates = true,
drop = stem_drop,
tiles = {"mcl_farming_melontige_"..s..".png"},
tiles = {"([combine:16x16:0,"..((8-s)*2).."=mcl_farming_melon_stem_disconnected.png)^[colorize:"..colorstring..":127"},
selection_box = {
type = "fixed",
fixed = {
@ -96,14 +101,14 @@ local stem_def = {
description = "Mature Melon Stem",
_doc_items_create_entry = true,
_doc_items_longdesc = "A mature melon stem attempts to grow a melon at one of its four adjacent blocks. A melon can only grow on top of farmland, dirt, or a grass block. When a melon is next to a melon stem, the melon stem immediately bends and connects to the melon. While connected, a melon stem can't grow another melon. As soon all melons around the stem have been removed, it loses the connection and is ready to grow another melon.",
tiles = {"mcl_farming_melontige_8.png"},
tiles = {"mcl_farming_melon_stem_disconnected.png^[colorize:#FFA800:127"},
}
-- Register stem growth
mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 30, 5)
-- Register actual melon, connected stems and stem-to-melon growth
mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 25, 15, "mcl_farming_melon_stem_connected.png")
mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 25, 15, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127")
-- Items and crafting
minetest.register_craftitem("mcl_farming:melon_item", {

View File

@ -34,6 +34,9 @@ local stem_drop = {
-- Unconnected immature stem
local startcolor = { r = 0x2E , g = 0x9D, b = 0x2E }
local endcolor = { r = 0xFF , g = 0xA8, b = 0x00 }
for s=1,7 do
local h = s / 8
local doc = s == 1
@ -42,6 +45,7 @@ for s=1,7 do
entry_name = "Premature Pumpkin Stem"
longdesc = "Pumpkin stems grow on farmland in 8 stages. On hydrated farmland, the growth is a bit quicker. Mature pumpkin stems are able to grow pumpkins."
end
local colorstring = mcl_farming:stem_color(startcolor, endcolor, s, 8)
minetest.register_node("mcl_farming:pumpkin_"..s, {
description = string.format("Premature Pumpkin Stem (Stage %d)", s),
_doc_items_entry_name = entry_name,
@ -52,7 +56,7 @@ for s=1,7 do
drawtype = "plantlike",
sunlight_propagates = true,
drop = stem_drop,
tiles = {"mcl_farming_pumpkintige_"..s..".png"},
tiles = {"([combine:16x16:0,"..((8-s)*2).."=mcl_farming_pumpkin_stem_disconnected.png)^[colorize:"..colorstring..":127"},
selection_box = {
type = "fixed",
fixed = {
@ -69,7 +73,7 @@ end
local stem_def = {
description = "Mature Pumpkin Stem",
_doc_items_longdesc = "A mature pumpkin stem attempts to grow a pumpkin at one of its four adjacent blocks. A pumpkin can only grow on top of farmland, dirt or a grass block. When a pumpkin is next to a pumpkin stem, the pumpkin stem immediately bends and connects to the pumpkin. A connected pumpkin stem can't grow another pumpkin. As soon all pumpkins around the stem have been removed, it loses the connection and is ready to grow another pumpkin.",
tiles = {"mcl_farming_pumpkintige_8.png"},
tiles = {"mcl_farming_pumpkin_stem_disconnected.png^[colorize:#FFA800:127"},
}
-- Template for pumpkin
@ -90,7 +94,7 @@ local pumpkin_base_def = {
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5)
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin_face", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png",
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin_face", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127",
function(pos)
-- Attempt to spawn iron golem or snow golem
mobs_mc.tools.check_iron_golem_summon(pos)

View File

@ -363,3 +363,19 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
})
end
-- Used for growing gourd stems. Returns the intermediate color between startcolor and endcolor at a step
-- * startcolor: ColorSpec in table form for the stem in its lowest growing stage
-- * endcolor: ColorSpec in table form for the stem in its final growing stage
-- * step: The nth growth step. Counting starts at 1
-- * step_count: The number of total growth steps
function mcl_farming:stem_color(startcolor, endcolor, step, step_count)
local color = {}
local function get_component(startt, endd, step, step_count)
return math.floor(math.max(0, math.min(255, (startt + (((step-1)/step_count) * endd)))))
end
color.r = get_component(startcolor.r, endcolor.r, step, step_count)
color.g = get_component(startcolor.g, endcolor.g, step, step_count)
color.b = get_component(startcolor.b, endcolor.b, step, step_count)
local colorstring = string.format("#%02X%02X%02X", color.r, color.g, color.b)
return colorstring
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

View File

@ -813,3 +813,7 @@ Source path,Source file,Target path,Target file,xs,ys,xl,yl,xt,yt
/assets/minecraft/textures/blocks,redstone_dust_dot.png,/mods/ITEMS/REDSTONE/mesecons/textures,redstone_redstone_dust_dot.png,,,,,,
/assets/minecraft/textures/blocks,redstone_dust_line0.png,/mods/ITEMS/REDSTONE/mesecons/textures,redstone_redstone_dust_line0.png,,,,,,
/assets/minecraft/textures/blocks,redstone_dust_line1.png,/mods/ITEMS/REDSTONE/mesecons/textures,redstone_redstone_dust_line1.png,,,,,,
/assets/minecraft/textures/blocks,pumpkin_stem_connected.png,/mods/ITEMS/mcl_farming/textures,mcl_farming_pumpkin_stem_connected.png,,,,,,
/assets/minecraft/textures/blocks,melon_stem_connected.png,/mods/ITEMS/mcl_farming/textures,mcl_farming_melon_stem_connected.png,,,,,,
/assets/minecraft/textures/blocks,pumpkin_stem_disconnected.png,/mods/ITEMS/mcl_farming/textures,mcl_farming_pumpkin_stem_disconnected.png,,,,,,
/assets/minecraft/textures/blocks,melon_stem_disconnected.png,/mods/ITEMS/mcl_farming/textures,mcl_farming_melon_stem_disconnected.png,,,,,,

1 Source path Source file Target path Target file xs ys xl yl xt yt
813 /assets/minecraft/textures/blocks redstone_dust_dot.png /mods/ITEMS/REDSTONE/mesecons/textures redstone_redstone_dust_dot.png
814 /assets/minecraft/textures/blocks redstone_dust_line0.png /mods/ITEMS/REDSTONE/mesecons/textures redstone_redstone_dust_line0.png
815 /assets/minecraft/textures/blocks redstone_dust_line1.png /mods/ITEMS/REDSTONE/mesecons/textures redstone_redstone_dust_line1.png
816 /assets/minecraft/textures/blocks pumpkin_stem_connected.png /mods/ITEMS/mcl_farming/textures mcl_farming_pumpkin_stem_connected.png
817 /assets/minecraft/textures/blocks melon_stem_connected.png /mods/ITEMS/mcl_farming/textures mcl_farming_melon_stem_connected.png
818 /assets/minecraft/textures/blocks pumpkin_stem_disconnected.png /mods/ITEMS/mcl_farming/textures mcl_farming_pumpkin_stem_disconnected.png
819 /assets/minecraft/textures/blocks melon_stem_disconnected.png /mods/ITEMS/mcl_farming/textures mcl_farming_melon_stem_disconnected.png