Space station crew ejected due to "missing" supplies

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

You can see that the station has an healthy buffer of supplies\parts\chips.
(One rocket is preparing to launch to refill the station with a new crew)

See below for details.

image.jpg

Rare case where this.CrewAssigned * this.Data.CrewSuppliesPerMemberPerDay is exactly the value of m_crewSuppliesLeftToSpend.

This is the decompiled SpaceStation.onNewDay() so we can talk about the same things.

if (this.CrewAssigned > 0 && this.m_crewSuppliesBuffer.HasValue)
{
    ProductBuffer value = this.m_crewSuppliesBuffer.Value;
    Fix64 fix = this.CrewAssigned * this.Data.CrewSuppliesPerMemberPerDay;

    //----------------------------------
    // 0.173494338989258(fix) - 0.173494338989258(this.m_crewSuppliesLeftToSpend) = 0
    //----------------------------------
    Quantity quantity3 = (fix - this.m_crewSuppliesLeftToSpend).Max(Fix64.Zero).ToIntCeiled().Quantity();

    //----------------------------------
    // 0(quantity3) is not positive, SKIP
    //----------------------------------
    if (quantity3.IsPositive)
    {
        Quantity quantity4 = value.RemoveAsMuchAs(quantity3);
        this.m_crewSuppliesLeftToSpend += quantity4.Value;
        if (quantity4.IsPositive)
            this.m_productsManager.ProductDestroyed(value.Product, quantity4, DestroyReason.General);
    }

    //----------------------------------
    // 0.173494338989258(this.m_crewSuppliesLeftToSpend) - 0.173494338989258(fix) = 0
    //----------------------------------
    this.m_crewSuppliesLeftToSpend -= fix;

    //----------------------------------
    // 0(this.m_crewSuppliesLeftToSpend) is not positive
    // EJECT EJECT EJECT
    //----------------------------------
    if (this.m_crewSuppliesLeftToSpend.IsNotPositive)
    {
        this.m_crewSuppliesLeftToSpend = Fix64.Zero;
        this.ejectCrew(null);
        this.m_notificationsManager.NotifyOnce(IdsCore.Notifications.SpaceStationNoCrewSupplies);
    }
}
CrewAssigned:26 fix:0.173494338989258 m_crewSuppliesLeftToSpend:0.693977355957031 m_crewSuppliesBuffer:129xProduct_CrewSupplies
CrewAssigned:26 fix:0.173494338989258 m_crewSuppliesLeftToSpend:0.520483016967773 m_crewSuppliesBuffer:129xProduct_CrewSupplies
CrewAssigned:26 fix:0.173494338989258 m_crewSuppliesLeftToSpend:0.346988677978516 m_crewSuppliesBuffer:129xProduct_CrewSupplies
CrewAssigned:26 fix:0.173494338989258 m_crewSuppliesLeftToSpend:0.173494338989258 m_crewSuppliesBuffer:129xProduct_CrewSupplies
CrewAssigned:26 fix:0.173494338989258 m_crewSuppliesLeftToSpend:0                 m_crewSuppliesBuffer:129xProduct_CrewSupplies
CrewAssigned:0  fix:0                 m_crewSuppliesLeftToSpend:0                 m_crewSuppliesBuffer:129xProduct_CrewSupplies

Closed as ✅ Fixed

6 Showing 1–2 of 2