Code: Select all
game.createentity {name = "basic-transport-belt", position = ent.position, direction = ent.direction, force = ent.force}
Code: Select all
game.createentity {name = "basic-transport-belt", position = ent.position, direction = ent.direction, force = ent.force}
Code: Select all
local buildEntity = {name = "basic-transport-belt", position = ent.position}
local player = game.player
--Make sure the player has nothing on the cursor
local cursorStackBackup = player.cursorstack
player.cursorstack = nil
--Set the mouse position
local oldPosition = player.cursorposition
player.cursorposition = game.real2screenposition({buildEntity.position.x, buildEntity.position.y})
player.cursorstack = {name = buildEntity.name, count = 1}
player.buildfromcursor()
--Return to the old location of the mouse and set the cursorstack again
player.cursorposition = oldPosition
player.cursorstack = cursorStackBackup