[Solved] Help changing entity image for custom arithmetic combinator
Posted: Tue Apr 17, 2018 11:25 am
I'm working on my first mod for Factorio and I have most of it working in game now. It's a new combinator that takes the first item signal it finds from an attached circuit wire and outputs the stack size of that item.
The only thing left before submitting to the mod portal is the sprite of the entity in-game. I have made a new image to differentiate it from other combinators but I don't have a clue how to get the game to use my image instead of the default arithmetic combinator sprite. Here is the code for the item, entity and recipe.
I hope someone can give me some insight into this issue.
The only thing left before submitting to the mod portal is the sprite of the entity in-game. I have made a new image to differentiate it from other combinators but I don't have a clue how to get the game to use my image instead of the default arithmetic combinator sprite. Here is the code for the item, entity and recipe.
Code: Select all
function copyPrototype(type, name, newName)
if not data.raw[type][name] then
error("type " .. type .. " " .. name .. " doesn't exist")
end
local p = table.deepcopy(data.raw[type][name])
p.name = newName
if p.minable and p.minable.result then
p.minable.result = newName
end
if p.place_result then
p.place_result = newName
end
if p.result then
p.result = newName
end
if p.results then
for _, result in pairs(p.results) do
if result.name == name then
result.name = newName
end
end
end
return p
end
local item = copyPrototype("item", "arithmetic-combinator", "stack-size-combinator")
item.icon = "__StackSizeCombinator__/graphics/icons/stack-size-combinator.png"
item.order = "c[combinators]-d[stack-size-combinator]"
local entity = copyPrototype("arithmetic-combinator", "arithmetic-combinator", "stack-size-combinator")
entity.icon = "__StackSizeCombinator__/graphics/icons/stack-size-combinator.png"
entity.sprites.north.filename = "__StackSizeCombinator__/graphics/entity/stack-size-combinator.png"
entity.sprites.east.filename = "__StackSizeCombinator__/graphics/entity/stack-size-combinator.png"
entity.sprites.south.filename = "__StackSizeCombinator__/graphics/entity/stack-size-combinator.png"
entity.sprites.west.filename = "__StackSizeCombinator__/graphics/entity/stack-size-combinator.png"
local recipe = copyPrototype("recipe", "arithmetic-combinator", "stack-size-combinator")
recipe.enabled = true
data:extend(
{
item,
entity,
recipe
}
)