I've been searching for events https://lua-api.factorio.com/latest/events.html related if the entity has specific number of items and i found the closest event is "on_player_fast_transferred" to what i'm after here,but the problem it's only fast transferred which i'm assuming is when the player puts/takes the items without actually open entity GUI.Also i've checked https://lua-api.factorio.com/latest/LuaEntity.html to make sure there's no extra events that can be in replace of "on_player_fast_transferred"
now here's the code that i haven't tested yet,you can treat it as an example of what i'm trying to do here
Code: Select all
global = global or {}
global.item_count = 0
script.on_event(defines.events.on_player_fast_transferred, function(event) --the problem here is this script Called when a player fast-transfers something to or from an entity,i need this script Only works if the player puts the items into the entity
global.item_count= global.item_count + 1
if global.item_count == 200 then
filename = "__base__/graphics/entity/lab/lab1.png", --i'm assuming this will update the sprite sheet of entity in this case lab to lab 1.png which the modder adds extra detail to the original lab, and i'm not sure if this actually works like that i think it needs an image load code which i haven't searched for yet
end
end, {
{filter = "type", type = "tool"},
{filter = "name", name = "automation-science-pack"},--all of this code should be called if the lab has 200 automation science packs
})
})
Thanks in Advance