Page 1 of 1

[0.10.3] Teleport() resets orientation of some entities...

Posted: Mon Jul 14, 2014 11:48 am
by Dark
...and breaks the others. While it may be intended for reasons unknown, it certainly hinders the modding.

Teleport() resets orientation/direction of some entities (car, player), if someone wanted to reset the entity's orientation he would either set it explicitly or recreate the entity.

Another problem is that teleport would do strange things to other entities, inserts after teleporting off-grid look like abomination, I guess it should snap entities to the grid unless that have "off-grid" flag, like createentity() does. But it workaround-able by recreating said inserter.

Writable "orientation" property of entities that support precise orientation control is an alternative to fixing teleport in case of car/player.
Right now it's not exactly easy to set car's orientation to precise 0.23611 and place that car in a set position with great precision without functional teleport or writable "orientation".

Re: [0.10.3] Teleport() resets orientation of some entities.

Posted: Mon Jul 14, 2014 6:00 pm
by ThaPear
Teleport does indeed do strange things. Some more examples:
- ItemStacks stop being affected by transport belts.
- Trains only teleport when standing still and snap back to their old location when they start moving.

Re: [0.10.3] Teleport() resets orientation of some entities.

Posted: Mon Jul 14, 2014 11:39 pm
by JamesOFarrell
Teleport does not update network connections either. If you teleport a power pole or a roboport it will remain connected as it if was still in its original position. This is also true for things that draw power, If you teleport an electric furnace to a point outside the power network it will remain connected to the original power source.

Re: [0.10.3] Teleport() resets orientation of some entities.

Posted: Fri Jul 18, 2014 8:30 am
by slpwnd
Bug that teleport resets entity orientation will be fixed in 0.10.4. In 0.10.4 it will also be possibel to change the car orientation manually via the existing Lua API (i.e. car.orientation = 0.21). The rest (oddities when using it for electric pole, etc.) is bit more tricky to fix for now.

Details: Teleport is a very old function not used that much in the actual Factorio code. At the moment it is used only for internal code in the inserter (to teleport the item into inserter hand). Originally it was designed to teleport the player to a starting location after he died (we had that). It should be safe to use with simple entities but things that require non-trivial interaction with its environment (i.e. roboport, electric network members) will just not work (do strange stuff) as @JamesOFarrell correctly mentioned. We will look into this, but for now it is rather a minor issue.

Re: [0.10.3] Teleport() resets orientation of some entities.

Posted: Fri Jul 18, 2014 8:49 am
by Dark
slpwnd wrote:Bug that teleport resets entity orientation will be fixed in 0.10.4. In 0.10.4 it will also be possibel to change the car orientation manually via the existing Lua API (i.e. car.orientation = 0.21).
Thanks, I can throw away my per-tick rotation code then :)