The Bug
- In an on_built_entity event callback: if entity.direction == defines.direction.west then entity.rotate{by_player=player_index} end
- Boot up a new sandbox save. Cheats on.
- Put a stack of belts AND the relevant underground into your inventory.
- Place 2 vertical belts side by side.
- With the cursor, start dragging a belt from right to left, starting to the right of the belt you placed. The script automatically rotates the belt from left (west) to up (north).
- Continue dragging all the way left across to place an underground belt.
- The script you place got called and successfully rotated the underground belt from west (12) to east (4)... but the underground belt is currently oriented WEST (not east!).
Expected Outcome
That belt should stay facing east.Included Test Mod
I am including a simple test mod with the following code, to make your life easier. Please run it with ONLY base and this mod.With this test mod, I did the above procedure, and got this result. Notice that the game log says it successfully rotated the 3rd belt AND the underground belt. The 3rd belt was properly rotated, but the underground was not.
Control experiments, with everything working as intended.
I also tested entity.health = 10 instead of entity.rotate, and the health reduction DOES persist properly. This indicates that the issue seems unique to rotation. Given how my main mod works, I'm fairly certain that this bug did not happen in previous versions of factorio. I could be wrong, but it likely started in the back-and-forth changing of belt dragging in the recent stable version(s) of factorio.