inserter pickup & drop position

Place to get help with not working mods / modding interface.
Post Reply
hreintke
Fast Inserter
Fast Inserter
Posts: 115
Joined: Mon Sep 04, 2017 6:52 pm
Contact:

inserter pickup & drop position

Post 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 ?

hreintke
Fast Inserter
Fast Inserter
Posts: 115
Joined: Mon Sep 04, 2017 6:52 pm
Contact:

Re: inserter pickup & drop position

Post 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

Rseding91
Factorio Staff
Factorio Staff
Posts: 13247
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: inserter pickup & drop position

Post 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
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding help”