63 lines
1.9 KiB
Lua
63 lines
1.9 KiB
Lua
local entity = table.deepcopy(data.raw["constant-combinator"]["constant-combinator"])
|
|
entity.name = "signal-exporter"
|
|
entity.minable.result = "signal-exporter"
|
|
|
|
local purple = { r = 0.6, g = 0.1, b = 0.9, a = 1.0 }
|
|
|
|
-- Recursively tints all layers of an animation definition, including any high-resolution versions.
|
|
local function apply_tint_recursively(animation)
|
|
if not animation then return end
|
|
|
|
if animation.layers then
|
|
for _, layer in ipairs(animation.layers) do
|
|
layer.tint = purple
|
|
end
|
|
end
|
|
|
|
if animation.hr_version then
|
|
apply_tint_recursively(animation.hr_version)
|
|
end
|
|
end
|
|
|
|
-- Tints an Animation4Way structure by applying a tint to each of the four directions.
|
|
local function tint_animation_4_way(animations)
|
|
if not animations then return end
|
|
for _, direction_animation in pairs(animations) do
|
|
apply_tint_recursively(direction_animation)
|
|
end
|
|
end
|
|
|
|
tint_animation_4_way(entity.sprites)
|
|
tint_animation_4_way(entity.activity_led_sprites)
|
|
|
|
if entity.activity_led_light then
|
|
entity.activity_led_light.color = purple
|
|
end
|
|
|
|
local item = table.deepcopy(data.raw["item"]["constant-combinator"])
|
|
item.name = "signal-exporter"
|
|
item.place_result = "signal-exporter"
|
|
item.order = "c[combinators]-z[signal-exporter]"
|
|
|
|
-- Replace the simple 'icon' with a tinted 'icons' table to color the UI icon.
|
|
item.icon = nil
|
|
item.icons = {
|
|
{
|
|
icon = "__base__/graphics/icons/constant-combinator.png",
|
|
icon_size = 64,
|
|
icon_mipmaps = 4,
|
|
tint = purple
|
|
}
|
|
}
|
|
|
|
local recipe = table.deepcopy(data.raw["recipe"]["constant-combinator"])
|
|
recipe.name = "signal-exporter"
|
|
recipe.result = "signal-exporter"
|
|
|
|
-- Unlock this recipe with the same technology that unlocks the vanilla constant combinator.
|
|
table.insert(data.raw.technology["circuit-network"].effects, {
|
|
type = "unlock-recipe",
|
|
recipe = "signal-exporter"
|
|
})
|
|
|
|
data:extend({entity, item, recipe}) |