Space station crew ejected two times

Fixed Space & Rocketry
deagato [discord] · 1 year ago

Only group1 should be ejected (10 ppl), instead 20 ppl are ejected.

SpaceStation.CrewCapacity:34 

---- PRE  onNewDay()
CrewAssigned:34 
CrewCapacityLeft:0 
m_crewArrivals.Count:34
m_crewArrivals group:1 size:10 time_left:<1 day    <-- only these 10 ppl should be ejected
m_crewArrivals group:2 size:24 time_left:1yr,10m 

---- PRE  ejectCrew()
CrewAssigned:34 
CrewCapacityLeft:0 
m_crewArrivals.Count:24                            <-- 34-10=24, m_crewArrivals is already pruned before ejectCrew()
m_crewArrivals group:2 size:24 time_left:1yr,10m   <-- second group untouched with 24 ppl (this is correct)

---- POST ejectCrew()
CrewAssigned:24                                    <-- CrewAssigned != m_crewArrivals.Count
CrewCapacityLeft:10                                <-- also not true, we are down 20ppl
m_crewArrivals.Count:14                            <-- m_crewArrivals pruned a second time, from 34 to 24 to 14
m_crewArrivals group:2 size:14 time_left:1yr,10m   <-- second group wrongly ejected (down to 14 from 24ppl)

CrewAssigned is also indipendent from m_crewArrivals.Count, consider public int CrewAssigned => m_crewArrivals.Count;

The duplicated logic is just before ejectCrew call

Captain Filip Captain Filip · 1 year ago

You are absolutely right. I must have been high when I wrote it. CrewAssigned => m_crewArrivals.Count is also a good choice, I think this was from before when I tried to group arrival time + the number of arrivals, which was error-prone, so I discarded that but did not remove the duplicate state. Anyway, it will be fixed in the next patch. Thanks!

        while (m_crewArrivals.IsNotEmpty && m_crewArrivals.Peek().Value < kickIfArrivedBefore) {
            // Crew member is here for too long kick them out
            m_crewArrivals.Dequeue();
            crewKicked++;
        }
        if (crewKicked > 0) {
            m_notificationsManager.NotifyOnce(IdsCore.Notifications.SpaceStationCrewRotationFailed);
            ejectCrew(crewKicked);
        }

That did not make any sense, deque and then ejectCrew 😄

deagato [discord] · 1 year ago

Thanks.

I'll file separate issues for these but there are at least 3 other things about the space station the could be improved:

  • crew rotation is actually 21.5months
  • 24months-4threshold+15days for the launch. It's a waste for stable bases like mine, i did lower my SpaceStationProto.CREW_ROTATION_REQUEST_TIME to 1.5months
  • when the station crew size > rocket cargo size, arrivals timestamps are refreshed in a way that requires 2 rockets for a job that can be done (in some cases) with 1.1 rockets (for example 26 station crew, 24 rocket crew)
  • launch pad priorities are mostly useless since the buffer % threshold has priority (and they also have different capacities)

Closed as ✅ Fixed

5 Showing 1–3 of 3