Page 1 of 1

inserter pickup & drop position

Posted: Mon Sep 04, 2017 7:53 pm
by hreintke
I am trying to update the pickup and/or drop position of an inserter but the values do not change.

Statments f.e :

Code: Select all

if player.selected.type == "inserter" then'
  player.print("before"..player.selected.pickup_position.y)
  player.selected.pickup_position.y = player.selected.pickup_position.y -1  
  player.print("after"..player.selected.pickup_position.y)
end
I get the same value before and after

Do I need additional code to really update ?

Re: inserter pickup & drop position

Posted: Wed Sep 06, 2017 4:44 pm
by hreintke
Did some further testing and found that also the position of an entity is not really updated.

with : player.selected.position.x = player.selected.position.x +1

does not move the entity.

Any hint/help appreciated

Re: inserter pickup & drop position

Posted: Thu Sep 07, 2017 12:21 am
by Rseding91
position is a simple table with the keys x and y. It doesn't hold any reference to the actual thing after you read it.

For pickup/dropoff positions you have to re-assign the position: position = some-other-position. For entity positions you have to use teleport(new-position).

http://lua-api.factorio.com/latest/LuaE ... p_position
http://lua-api.factorio.com/latest/LuaC ... l.position
http://lua-api.factorio.com/latest/LuaC ... l.teleport