I want to replace some images
Posted: Sat Mar 22, 2025 4:51 pm
I want to replace fish related sprites (items, achievemnts, technologies) with new ones. I tried to do it myself for 2 hours but failed to write a code. What is wrong in here? Game doesnt show any errors after installing. And images are still not replaced.
require("global")
for set in each(data.raw.item, data.raw.achievement, data.raw.technology, data.raw.recipe) do
for old, new in pairs({
["/so-long-and-thanks-for-all-the-fish.png"] = "achievement/so-long-and-thanks-for-all-the-fish.png",
["/todays-fish-is-trout-a-la-creme.png"] = "achievement/todays-fish-is-trout-a-la-creme.png",
["/fish.png"] = "icons/fish.png",
["/fish-entity.png"] = "icons/fish-entity.png",
["/fish-breeding.png"] = "icons/fish-breeding.png",
["/fish-breeding.png"] = "technology/fish-breeding.png",
}) do
for key, value in wherehas(set, "achievement", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.achievement, "with", "__lamia-lost-lullaby__/graphics/achievement/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/achievement/" .. new
for key, value in wherehas(set, "icon", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.icon, "with", "__lamia-lost-lullaby__/graphics/icons/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/icons/" .. new
for key, value in wherehas(set, "technology", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.technology, "with", "__lamia-lost-lullaby__/graphics/technology/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/technology/" .. new
end
end
end
end
end
require("global")
for set in each(data.raw.item, data.raw.achievement, data.raw.technology, data.raw.recipe) do
for old, new in pairs({
["/so-long-and-thanks-for-all-the-fish.png"] = "achievement/so-long-and-thanks-for-all-the-fish.png",
["/todays-fish-is-trout-a-la-creme.png"] = "achievement/todays-fish-is-trout-a-la-creme.png",
["/fish.png"] = "icons/fish.png",
["/fish-entity.png"] = "icons/fish-entity.png",
["/fish-breeding.png"] = "icons/fish-breeding.png",
["/fish-breeding.png"] = "technology/fish-breeding.png",
}) do
for key, value in wherehas(set, "achievement", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.achievement, "with", "__lamia-lost-lullaby__/graphics/achievement/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/achievement/" .. new
for key, value in wherehas(set, "icon", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.icon, "with", "__lamia-lost-lullaby__/graphics/icons/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/icons/" .. new
for key, value in wherehas(set, "technology", escape_pattern(old)) do
print("Replacing", value.type, value.name, value.technology, "with", "__lamia-lost-lullaby__/graphics/technology/" .. new)
value.icon = "__lamia-lost-lullaby__/graphics/technology/" .. new
end
end
end
end
end