The code in question is this:
Code: Select all
local function onEntityAdded(entity)
if string.find(entity.name, "depot-placer", 1, true) then
local depot = global.depot
local type = string.match(entity.name, "%d+")
local render = entity.surface.create_entity({name = "depot-render-type-" .. type, position = entity.position, force = entity.force})
local storage = entity.surface.create_entity({name = "depot-type-" .. type, position = entity.position, force = entity.force})
local entry = {main = storage, placer = entity, render = render, type = type}
table.insert(depot.entries, entry)
end
end
I checked the obvious solution of a runaway loop; that is not in fact occurring (the function is only ever called once).
As for the freeze, memory usage is not continuously climbing, so it is not a runaway allocation. But one CPU core does get maxed out. The only way to recover is to use Task Manager to kill the process.
The log contains nothing of value, with the last line being related to the world loading, and nothing being printed after that.
This code is for the idea described here.