This calculator helps determine the optimal resource output and energy requirements for an X4: Foundations station based on its components and production chains.
function calculateStationOutput() {
var mineralOre = parseFloat(document.getElementById("mineralOre").value);
var energyCredits = parseFloat(document.getElementById("energyCredits").value);
var solarPower = parseFloat(document.getElementById("solarPower").value);
var hydroTanks = parseFloat(document.getElementById("hydroTanks").value);
var siliconWafers = parseFloat(document.getElementById("siliconWafers").value);
var plasmaConducts = parseFloat(document.getElementById("plasmaConducts").value);
var waterIce = parseFloat(document.getElementById("waterIce").value);
var methane = parseFloat(document.getElementById("methane").value);
var fuelCells = parseFloat(document.getElementById("fuelCells").value);
var proteinPaste = parseFloat(document.getElementById("proteinPaste").value);
var medicinalGels = parseFloat(document.getElementById("medicinalGels").value);
var soybeans = parseFloat(document.getElementById("soybeans").value);
var spaceWeed = parseFloat(document.getElementById("spaceWeed").value);
var luxuryMuffins = parseFloat(document.getElementById("luxuryMuffins").value);
var nvidium = parseFloat(document.getElementById("nvidium").value);
var totalOutput = 0;
var totalEnergyCost = 0;
// Basic resource extraction and conversion
if (mineralOre > 0) {
totalOutput += mineralOre * 1.5; // Example: Basic ore processing yields 1.5 units of refined materials
totalEnergyCost += mineralOre * 0.2; // Example: Ore processing consumes 0.2 energy per unit
}
if (solarPower > 0) {
totalOutput += solarPower * 1; // Solar power can be directly used or sold
totalEnergyCost += solarPower * 0.1; // Station upkeep for solar panels
}
if (hydroTanks > 0) {
totalOutput += hydroTanks * 1.2; // Hydroponics yield more than basic ore
totalEnergyCost += hydroTanks * 0.3;
}
if (waterIce > 0) {
totalOutput += waterIce * 0.8; // Ice can be refined into water
totalEnergyCost += waterIce * 0.15;
}
if (methane > 0) {
totalOutput += methane * 1.1; // Methane can be refined into fuel
totalEnergyCost += methane * 0.25;
}
if (nvidium > 0) {
totalOutput += nvidium * 2.5; // Nvidium is a high-value resource
totalEnergyCost += nvidium * 0.5;
}
// Intermediate and advanced production chains
if (siliconWafers > 0) {
totalOutput += siliconWafers * 2; // Silicon wafers are used in advanced electronics
totalEnergyCost += siliconWafers * 0.4;
}
if (plasmaConducts > 0) {
totalOutput += plasmaConducts * 2.2; // Plasma conduits are for energy systems
totalEnergyCost += plasmaConducts * 0.45;
}
if (fuelCells > 0) {
totalOutput += fuelCells * 1.8; // Fuel cells are high-demand energy storage
totalEnergyCost += fuelCells * 0.35;
}
if (proteinPaste > 0) {
totalOutput += proteinPaste * 1.3; // Food production
totalEnergyCost += proteinPaste * 0.28;
}
if (medicinalGels > 0) {
totalOutput += medicinalGels * 1.6; // Medical supplies
totalEnergyCost += medicinalGels * 0.32;
}
if (soybeans > 0) {
totalOutput += soybeans * 1.1; // Base for food production
totalEnergyCost += soybeans * 0.22;
}
if (spaceWeed > 0) {
totalOutput += spaceWeed * 1.25; // Processed goods
totalEnergyCost += spaceWeed * 0.26;
}
if (luxuryMuffins > 0) {
totalOutput += luxuryMuffins * 2.5; // High-value luxury goods
totalEnergyCost += luxuryMuffins * 0.55;
}
// Energy Credits Calculation (Example: if energyCredits is the cost of producing 1 unit of something else)
// This is a placeholder for more complex interdependencies.
// For simplicity, let's assume energyCredits input represents the *selling price* of energy units.
var energyCreditRevenue = energyCredits * solarPower; // Example: Selling energy produced by solar panels
var netOutputValue = totalOutput – totalEnergyCost;
var resultHTML = "