Ting, blend and alpha params is identical.
Icon and mask (and its lighter than entity but in game ok lol)
Entity mask sample
Just locals
Code: Select all
local icon_base_path = "__PLORD__/graphics/icons/belts/"
local underground_belt_base_icon = icon_base_path .. "underground_belt.png"
local underground_belt_base_icon_mask = icon_base_path .. "underground_belt_mask.png"
local underground_belt_path = "__PLORD__/graphics/entity/belt_underground/"
local underground_belt_base_texture = "underground-belt-structure.png"
local underground_belt_base_texture_mask = "underground-belt-structure-mask.png"
local mask_alpha_base = 0.9
local tint_base = {r = 1, g = 1, b = 1}
Code: Select all
local function generate_underground_belt_texture(tint, blend, base_texture, base_texture_mask)
return
{
direction_in =
{
sheets =
{
{
filename = underground_belt_path .. base_texture,
priority = "extra-high",
width = 96,
height = 96,
y = 96,
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture,
priority = "extra-high",
width = 192,
height =192,
y = 192,
scale = 0.5
}
},
{
filename = underground_belt_path .. base_texture_mask,
priority = "extra-high",
width = 96,
height = 96,
y = 96,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture_mask,
priority = "extra-high",
width = 192,
height =192,
y = 192,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
scale = 0.5
}
}
}
},
direction_out =
{
sheets =
{
{
filename = underground_belt_path .. base_texture,
priority = "extra-high",
width = 96,
height = 96,
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture,
priority = "extra-high",
width = 192,
height = 192,
scale = 0.5
}
},
{
filename = underground_belt_path .. base_texture_mask,
priority = "extra-high",
width = 96,
height = 96,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture_mask,
priority = "extra-high",
width = 192,
height = 192,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
scale = 0.5
}
}
}
},
direction_in_side_loading =
{
sheets =
{
{
filename = underground_belt_path .. base_texture,
priority = "extra-high",
width = 96,
height = 96,
y = 96*3,
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture,
priority = "extra-high",
width = 192,
height = 192,
y = 192*3,
scale = 0.5
}
},
{
filename = underground_belt_path .. base_texture_mask,
priority = "extra-high",
width = 96,
height = 96,
y = 96*3,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture_mask,
priority = "extra-high",
width = 192,
height = 192,
y = 192*3,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
scale = 0.5
}
}
}
},
direction_out_side_loading =
{
sheets =
{
{
filename = underground_belt_path .. base_texture,
priority = "extra-high",
width = 96,
height = 96,
y = 96*2,
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture,
priority = "extra-high",
width = 192,
height = 192,
y = 192*2,
scale = 0.5
}
},
{
filename = underground_belt_path .. base_texture_mask,
priority = "extra-high",
width = 96,
height = 96,
y = 96*2,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
hr_version =
{
filename = underground_belt_path .. "hr-" .. base_texture_mask,
priority = "extra-high",
width = 192,
height = 192,
y = 192*2,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
scale = 0.5
}
}
}
},
back_patch =
{
sheet =
{
filename = "__base__/graphics/entity/fast-underground-belt/fast-underground-belt-structure-back-patch.png",
priority = "extra-high",
width = 96,
height = 96,
hr_version =
{
filename = "__base__/graphics/entity/fast-underground-belt/hr-fast-underground-belt-structure-back-patch.png",
priority = "extra-high",
width = 192,
height = 192,
scale = 0.5
}
}
},
front_patch =
{
sheet =
{
filename = "__base__/graphics/entity/fast-underground-belt/fast-underground-belt-structure-front-patch.png",
priority = "extra-high",
width = 96,
height = 96,
hr_version =
{
filename = "__base__/graphics/entity/fast-underground-belt/hr-fast-underground-belt-structure-front-patch.png",
priority = "extra-high",
width = 192,
height = 192,
scale = 0.5
}
}
}
}
end
Code: Select all
local function generate_belt_icon(tint, blend, base_icon, base_icon_mask)
return
{
{
icon = base_icon,
icon_size = 64,
icon_mipmaps = 4
},
{
icon = base_icon_mask,
icon_size = 64,
icon_mipmaps = 4,
tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
blend_mode = blend or "additive-soft",
}
}
end
Code: Select all
for e_name, entity in pairs(data.raw["underground-belt"]) do
if not e_name:find("wooden") then
if (e_name == "underground-belt") then tint = {r = 0.9, g = 0.77, b = 0.35} end
if (e_name == "fast-underground-belt") then tint = {r = 1, g = 0.25, b = 0.25} end
if (e_name == "express-underground-belt") then tint = {r = 0.4, g = 0.8, b = 0.9} end
if (e_name == "PLORD_underground_belt_green") then tint = {r = 0.3, g = 0.85, b = 0.35} end
if (e_name == "PLORD_underground_belt_orange") then tint = {r = 0.95, g = 0.65, b = 0.15}end
if (e_name == "PLORD_underground_belt_pink") then tint = {r = 0.9, g = 0.3, b = 0.65} end
if (e_name == "PLORD_underground_belt_purple") then tint = {r = 0.6, g = 0.35, b = 0.9}end
if (e_name == "PLORD_underground_belt_black") then tint = {r = 0.65, g = 0.65, b = 0.65} end
if (e_name == "PLORD_underground_belt_grey") then tint = {r = 0.55, g = 0.55, b = 0.55} end
if (e_name == "PLORD_underground_belt_white") then tint = {r = 0.9, g = 0.9, b = 0.9} end
entity.structure = generate_underground_belt_texture(tint, blend, underground_belt_base_texture, underground_belt_base_texture_mask)
entity.icons = generate_belt_icon(tint, blend, underground_belt_base_icon, underground_belt_base_icon_mask)
end
end
for e_name, item in pairs(data.raw["item"]) do
if e_name:find("underground") and e_name:find("belt") and not e_name:find("wooden") then
if (e_name == "underground-belt") then tint = {r = 0.9, g = 0.77, b = 0.35} end
if (e_name == "fast-underground-belt") then tint = {r = 1, g = 0.25, b = 0.25} end
if (e_name == "express-underground-belt") then tint = {r = 0.4, g = 0.8, b = 0.9} end
if (e_name == "PLORD_underground_belt_green") then tint = {r = 0.3, g = 0.85, b = 0.35} end
if (e_name == "PLORD_underground_belt_orange") then tint = {r = 0.95, g = 0.65, b = 0.15}end
if (e_name == "PLORD_underground_belt_pink") then tint = {r = 0.9, g = 0.3, b = 0.65} end
if (e_name == "PLORD_underground_belt_purple") then tint = {r = 0.6, g = 0.35, b = 0.9}end
if (e_name == "PLORD_underground_belt_black") then tint = {r = 0.25, g = 0.25, b = 0.25} end
if (e_name == "PLORD_underground_belt_grey") then tint = {r = 0.55, g = 0.55, b = 0.55} end
if (e_name == "PLORD_underground_belt_white") then tint = {r = 0.9, g = 0.9, b = 0.9} end
item.icons = generate_belt_icon(tint, blend, underground_belt_base_icon, underground_belt_base_icon_mask)
item.subgroup = "PLORD_underground_belts"
end
end