Code: Select all
game.createentity{name="ghost", position=game.player.character.selected.position}
Code: Select all
game.createentity{name="ghost", position=game.player.character.selected.position}
Code: Select all
game.createentity{name="ghost", position=game.player.selected.position, innername="stone-furnace", force=game.player.force}
you can't, mainly because it's a ghost that will become an assembling machine, not just an assembling machine waiting to be built. Second, I'm not sure that you can set the recipe via code with Lua (you can read it just by accessing entity.recipe which corresponds to the ...force.recipes[recipe_name], but when trying to set it from console I see "LuaEntity::recipe is read only")...I could be wrong (or forgotten how) or it might be changed in an update so what you'd have to do to get the actual assembling machine entity would be to monitor the ghost entity until it was no longer valid and then use game.findentities(filtered) with the position of the old ghost (you'd have to save the position, and use an identifying type or name with filtered) to find the assembling machine that was built (assuming the ghost wasn't canceled in which case findentities(filtered) should return an empty table).DaveMcW wrote:The next question is, how do I set the recipe for a ghost assembling machine?