[0.11.10] setblueprintentities and diagonal rails

This subforum contains all the issues which we already resolved.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3730
Joined: Tue May 13, 2014 11:06 am
Contact:

[0.11.10] setblueprintentities and diagonal rails

Post by DaveMcW »

setblueprintentities() messes up all diagonal straight rails.

If you input direction=1, the blueprint has direction=7.
If you input direction=3, the blueprint has direction=5.
If you input direction=5, the blueprint has direction=7.
If you input direction=7, the blueprint has direction=5.


Steps to reproduce:
1. Put a working blueprint in the first slot of your toolbar.
2. Run this command:

Code: Select all

/c game.player.getinventory(1).getitemstack(1).setblueprintentities({{direction=1,position={y=1,x=-3},name="straight-rail",entitynumber=1},{direction=7,position={y=1,x=3},name="straight-rail",entitynumber=2},{direction=5,position={y=1,x=-1},name="straight-rail",entitynumber=3},{direction=3,position={y=1,x=1},name="straight-rail",entitynumber=4}})
It should look like this:
rail-good.jpg
rail-good.jpg (77.54 KiB) Viewed 1359 times
But it ends up like this:
rail-bad.jpg
rail-bad.jpg (72.44 KiB) Viewed 1359 times
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.11.10] setblueprintentities and diagonal rails

Post by Choumiko »

After reading that report i remembered this (from the rail layer mod):

Code: Select all

-- fix for 0.10.12 as direction of diagonal track different for placed entity and direction asked in createentity
        if railDirection % 2 == 1 then
            railDirection = (railDirection + 2 * (railDirection % 2)) % 8
        end
    local canplace = game.canplaceentity{name = railType, position = {X, Y}, direction = railDirection}
    if canplace then
        game.createentity{name = railType, position = {X, Y}, direction = railDirection, force = game.forces.player}
Seems like this has been around for a while but unreported.
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.11.10] setblueprintentities and diagonal rails

Post by kovarex »

Thanks for the report, it is now fixed for 0.11.11
0.11.11 changelog wrote: Fixed that the rail direction were messed up when building rails from script.
The mechanism, that changes the rail direction based on the position is still used for manual building, to allow the user to build diagonal rails without having to switch direction after every piece.
Post Reply

Return to “Resolved Problems and Bugs”