Skip to content

Instantly share code, notes, and snippets.

@Sans3108
Last active January 23, 2025 03:08
Show Gist options
  • Save Sans3108/702d7653a0be0a49ad15acea5787af61 to your computer and use it in GitHub Desktop.
Save Sans3108/702d7653a0be0a49ad15acea5787af61 to your computer and use it in GitHub Desktop.
// Utils
type Quality = 'Normal' | 'Uncommon' | 'Rare' | 'Epic' | 'Legendary';
const ThrusterConsumption: Record<Quality, number> = {
Normal: 120,
Uncommon: 156,
Rare: 192,
Epic: 228,
Legendary: 300
};
const PumpSpeed: Record<Quality, number> = {
Normal: 1200,
Uncommon: 1560,
Rare: 1920,
Epic: 2280,
Legendary: 3000
};
// Options
const pumpQuality: Quality = 'Rare';
const thrusterQuality: Quality = 'Rare';
const thrusterCount = 17;
const desiredLoad = 0.75;
// Calculation
const thrusterRate = ThrusterConsumption[thrusterQuality];
const totalConsumption = thrusterCount * thrusterRate * desiredLoad;
const pumpRate = PumpSpeed[pumpQuality];
const pumpsNeeded = Math.floor(totalConsumption / pumpRate);
const leftoverConsumption = totalConsumption % pumpRate;
const pumpUnitsPerTick = pumpRate / 60;
const activeTicks = leftoverConsumption / pumpUnitsPerTick;
console.log(`
To sustain ${thrusterCount}x ${thrusterQuality} Thruster @ ${desiredLoad * 100}% load:
- Total consumption: ${totalConsumption.toFixed(1)} fluid/s
- Pumps required: ${pumpsNeeded}x ${pumpQuality} Pump
- Extra ${pumpQuality} Pump active for: ${activeTicks.toFixed(1)} ticks
`);
@Sans3108
Copy link
Author

Small program that figures out how many pumps and how much fluid you need for your space platform thrusters in Factorio: Space Age

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment