LuaEntity::set_recipe(recipe)
Posted: Mon Sep 18, 2017 6:00 pm
Same as http://lua-api.factorio.com/latest/LuaE ... y_settings , but with a recipe being passed to it instead of an entity. I currently have to do
to find out which items a recipe switch to tokens[3] "spits out" so that I can insert them back into the player. Just changing LuaEntity::recipe doesn't give me that info.
Code: Select all
local entity = game.surfaces["tas-surface"].create_entity{name = myplayer.selected.name, position = {0,0}, force="player", recipe=tokens[3]}
local items = myplayer.selected.copy_settings(entity)
entity.destroy()
if items then
for name, count in pairs(items) do
myplayer.insert{name=name, count=count}
end
end