Bug: yellow lamp but no trains assigned

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

Post Reply
wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Bug: yellow lamp but no trains assigned

Post by wvlad »

What could cause this?
Image

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Bug: yellow lamp but no trains assigned

Post by Optera »

This bug should have been fixed a few versions ago.
If you are still having it in 1.7.2 please enable debug logging and attach factorio-current.log.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Bug: yellow lamp but no trains assigned

Post by wvlad »

Yes, the latest version. I debugged it and discovered that there is no such train scheduled. I think that the lamp color is not changed or delivery not removed from stop personal list when delivery is removed without train reaching station like timeout.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Bug: yellow lamp but no trains assigned

Post by wvlad »

Just discovered that it's not an indication issue. Somehow (perhaps because of renaming with duplicating names) a lot of my stations had extra entries in stop.activeDeliveries. I fixed it by adding this to the end of UpdateStop

Code: Select all

    local name = stop.entity.backer_name
    local removed = false
    for i=#stop.activeDeliveries, 1, -1 do
        local d = global.Dispatcher.Deliveries[stop.activeDeliveries[i]]
        if (not d) or ((d.from~=name) and (d.to~=name)) then
            if message_level >= 1 then printmsg("Found missing delivery on station "..stop.entity.backer_name) end
            log("Found missing delivery on station "..stop.entity.backer_name)
            table.remove(stop.activeDeliveries,i)
            removed = true
        end
    end
    if removed and stop.errorCode == 0 then
      if #stop.activeDeliveries > 0 then
        setLamp(stopID, "yellow", #stop.activeDeliveries)
      else
        setLamp(stopID, "green", 1)
      end
    end
WIll you consider including it into the mod?

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Bug: yellow lamp but no trains assigned

Post by Optera »

I removed something similar to this in 1.6 since i couldn't find a way to reproduce orphaned stop.activeDeliveries.

Instead of adding an extra loop to each stop update I'm more curious on how exactly you managed to produce this state so i can prevent it in the first place.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Bug: yellow lamp but no trains assigned

Post by wvlad »

This code prints a message immediately in such cases so I will let you know if I see it after some action.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Bug: yellow lamp but no trains assigned

Post by Optera »

I forgot to mention, the original fail safe code is only commented out from lines 1356 to 1360. https://github.com/Yousei9/Logistic-Tra ... .lua#L1355

Post Reply

Return to “Logistic Train Network”