How to get the direction of an item when placed.

Place to get help with not working mods / modding interface.
Post Reply
JoeSchmoe
Inserter
Inserter
Posts: 34
Joined: Thu May 08, 2014 4:06 pm
Contact:

How to get the direction of an item when placed.

Post by JoeSchmoe »

I want to create this http://imgur.com/xWUDOyF
So i started with a splitter, and I can place it; detect when an item-on-ground is inside it; and can teleport the item to some predefined offset ( 2 tiles down, 2 tiles right); so now if I knew what direction it was facing I could teleport it to the correct spot, but it seems like direction, orientation, and rotatable are nil when placed, and onplayerrotatedentity is only called once the item has already been placed.

Can anyone point me in the right direction?

Secondly I'm using game.findentitiesfiltered{area=s[2], name="item-on-ground"} inside ontick to find what items are inside it, is there some event such as oncollision? Instead of testing every tick, or every x ticks, if a function could be called on collision that might be a performance boost.

Thanks

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: How to get the direction of an item when placed.

Post by Choumiko »

you want to know the direction the splitter/swapper was placed right?

Have you tried using onbuiltentity as an event and event.createdentity.direction inside the function? I'm pretty sure it has at least the position, so if the direction is really nil you could still use game.findentitiesfiltered with the position.

Post Reply

Return to “Modding help”