Beispiel #1
0
        void CalcTransferRate()
        {
            double? dvDif;
            OrbitDB leftOrbit;

            if (!_selectedEntityLeft.Entity.HasDataBlob <OrbitDB>())
            {
                dvDif = Distance.AuToKm(OrbitMath.MeanOrbitalVelocityInAU(_selectedEntityRight.Entity.GetDataBlob <OrbitDB>()));
            }
            else
            {
                leftOrbit = _selectedEntityLeft.Entity.GetDataBlob <OrbitDB>();
                dvDif     = CargoTransferProcessor.CalcDVDifferenceKmPerSecond(leftOrbit, _selectedEntityRight.Entity.GetDataBlob <OrbitDB>());
            }
            if (dvDif == null)
            {
                _transferRate = 0;
            }
            else
            {
                var cargoDBLeft  = _selectedEntityLeft.Entity.GetDataBlob <CargoStorageDB>();
                var cargoDBRight = _selectedEntityRight.Entity.GetDataBlob <CargoStorageDB>();
                _dvMaxDiff    = Math.Max(cargoDBLeft.TransferRangeDv, cargoDBRight.TransferRangeDv);
                _dvDifference = (double)dvDif;
                _transferRate = CargoTransferProcessor.CalcTransferRate(_dvDifference,
                                                                        cargoDBLeft,
                                                                        cargoDBRight);
            }
        }
Beispiel #2
0
        void CalcTransferRate()
        {
            double? dvDif;
            OrbitDB leftOrbit;

            //TODO: the logic here has places where it's going to break, needs fixing.
            //I think I'm checking if it's a colony here?
            //but I'm not checking for NewtonMoveDB or OrbitUpdateOftenDB
            if (!_selectedEntityLeft.Entity.HasDataBlob <OrbitDB>())
            {
                dvDif = OrbitMath.MeanOrbitalVelocityInm(_selectedEntityRight.Entity.GetDataBlob <OrbitDB>());
            }
            else
            {
                leftOrbit = _selectedEntityLeft.Entity.GetDataBlob <OrbitDB>();
                dvDif     = CargoTransferProcessor.CalcDVDifference_m(_selectedEntityLeft.Entity, _selectedEntityRight.Entity);
            }

            if (dvDif == null)
            {
                _transferRate = 0;
            }
            else
            {
                var cargoDBLeft  = _selectedEntityLeft.Entity.GetDataBlob <VolumeStorageDB>();
                var cargoDBRight = _selectedEntityRight.Entity.GetDataBlob <VolumeStorageDB>();
                _dvMaxRangeDiff_ms = Math.Max(cargoDBLeft.TransferRangeDv_mps, cargoDBRight.TransferRangeDv_mps);
                _dvDifference_ms   = (double)dvDif;
                _transferRate      = CargoTransferProcessor.CalcTransferRate(_dvDifference_ms,
                                                                             cargoDBLeft,
                                                                             cargoDBRight);
            }
        }