All added prototypes are exact deep copies of the original small-lamp. Everything works as expected, only:
My modded item, when crafted, shows an additional "Yield" attribute in the inventory UI on mouse over, however the original small-lamp doesn't show "Yield" in the UI.
I even logged the item prototype (both the original and my cloned and modified one) using serpent to compare them. I can't really see any differences apart from the expected ones, like place_result and name. The modding API docs also don't show a dedicated yield property at the code level, so it must come from something else in the UI.
The only idea I have left is that I'm cloning the wrong base prototype for the lamp, maybe? I used table.deepcopy on data.raw["item"]["small-lamp"] - is this maybe the wrong item?
This is my specific code:
Code: Select all
local prototype = table.deepcopy(data.raw['item']['small-lamp'])
prototype.name = "solar-appliances-solar-lamp-item"
prototype.place_result = "solar-appliances-solar-lamp-entity"
log(serpent.block(prototype))
log(serpent.block(data.raw['item']['small-lamp']))
data: extend({prototype})
Code: Select all
local prototype = table.deepcopy(data.raw['recipe']['small-lamp'])
prototype.name = "solar-appliances-solar-lamp-recipe"
prototype.localised_name = { "recipe-name.solar-appliances-solar-lamp" }
prototype.enabled = true
prototype.results = {
{ type = "item", name = "solar-appliances-solar-lamp-item", amount = 1 },
}
prototype.main_product = nil
prototype.result_count = nil
table.insert(prototype.ingredients, { type = "item", name = "solar-panel", amount = 1 })
table.insert(prototype.ingredients, { type = "item", name = "battery", amount = 2 })
log(serpent.block(prototype))
log(serpent.block(data.raw['recipe']['small-lamp']))
data:extend({ prototype })
Code: Select all
local prototype = table.deepcopy(data.raw['lamp']['small-lamp'])
prototype.name = "solar-appliances-solar-lamp-entity"
prototype.energy_source = { type = "void" }
prototype.localised_name = { "entity-name.solar-appliances-solar-lamp" }
if prototype.minable then
prototype.minable.result = "solar-appliances-solar-lamp-item"
end
log(serpent.block(prototype))
log(serpent.block(data.raw['lamp']['small-lamp']))
data:extend({ prototype })
Thanks in advance!