private static double calculateBasic(AvailablePart part) { Double mass = PartConfigLoader.GetProperty(part, PartConfigLoader.MASS); Double cost = part.cost; Double crashTolerance = PartConfigLoader.GetProperty(part, PartConfigLoader.CRASH_TOLERANCE); Double maxTemp = PartConfigLoader.GetProperty(part, PartConfigLoader.TEMP); Double capacity = PartConfigLoader.GetProperty(part, PartConfigLoader.CREW_CAPACITY); ConfigNode electricResource = PartConfigLoader.GetResource(part, PartConfigLoader.ELECTRIC_CHARGE); Double electricCharge = PartConfigLoader.GetProperty(electricResource, PartConfigLoader.AMOUNT); ConfigNode monopropelantResource = PartConfigLoader.GetResource(part, PartConfigLoader.MONOPROPELANT); Double monopropelant = monopropelantResource != null?PartConfigLoader.GetProperty(monopropelantResource, PartConfigLoader.AMOUNT) : 0; double sum = cost * COST_FACTOR; sum += MASS_BASE - mass * MASS_FACTOR; sum += crashTolerance * CRASH_TOLERANCE_FACTOR; sum += maxTemp * TEMP_FACTOR; sum += capacity * CREW_CAPACITY_FACTOR; sum += electricCharge * ELECTRIC_CHARGE_FACTOR; sum += monopropelant * MONOPROPELANT_FACTOR; Log.log("Basic: " + sum); return(sum); }
private static double calculateXenon(AvailablePart part) { ConfigNode xenonResource = PartConfigLoader.GetResource(part, PartConfigLoader.XENON); double xenon = xenonResource != null?PartConfigLoader.GetProperty(xenonResource, PartConfigLoader.AMOUNT) : 0; return(xenonResource != null ? XENON_BASE + xenon * XENON_FACTOR : 0); }
private static double calculateOre(AvailablePart part) { ConfigNode oreResource = PartConfigLoader.GetResource(part, PartConfigLoader.ORE); double ore = oreResource != null?PartConfigLoader.GetProperty(oreResource, PartConfigLoader.MAX_AMOUNT) : 0; return(oreResource != null ? ORE_BASE + ore * ORE_FACTOR : 0); }
private static double calculateMonopropelant(AvailablePart part) { ConfigNode monopropelantResource = PartConfigLoader.GetResource(part, PartConfigLoader.MONOPROPELANT); double monopropelant = monopropelantResource != null?PartConfigLoader.GetProperty(monopropelantResource, PartConfigLoader.AMOUNT) : 0; return(monopropelant * MONOPROPELANT_FACTOR); }
private static double calculateLiquidFuel(AvailablePart part) { ConfigNode liquidFuelResource = PartConfigLoader.GetResource(part, PartConfigLoader.LIQUID_FUEL); ConfigNode oxiderResource = PartConfigLoader.GetResource(part, PartConfigLoader.OXIDER); double liquidFuel = liquidFuelResource != null?PartConfigLoader.GetProperty(liquidFuelResource, PartConfigLoader.AMOUNT) : 0; double oxider = oxiderResource != null?PartConfigLoader.GetProperty(oxiderResource, PartConfigLoader.AMOUNT) : 0; return(liquidFuel * LIQUID_FUEL_FACTOR + oxider * OXIDER_FACTOR); }
private static double calculateScienceContainerModule(AvailablePart part) { ConfigNode module = PartConfigLoader.GetScienceContainerModule(part); if (module == null) { return(0); } double sum = SCIENCE_CONTAINER_FACTOR * PartConfigLoader.GetProperty(module, PartConfigLoader.STORAGE_RANGE); Log.log("Science container: " + sum); return(sum); }
private static double calculateSASModule(AvailablePart part) { ConfigNode module = PartConfigLoader.GetSASModule(part); if (module == null) { return(0); } double sum = SAS_LEVEL_FACTOR * PartConfigLoader.GetProperty(module, PartConfigLoader.SAS_LEVEL); Log.log("SAS: " + sum); return(sum); }
private static double calculateBasic(AvailablePart part) { Double mass = PartConfigLoader.GetProperty(part, PartConfigLoader.MASS); Double cost = part.cost; Double crashTolerance = PartConfigLoader.GetProperty(part, PartConfigLoader.CRASH_TOLERANCE); Double maxTemp = PartConfigLoader.GetProperty(part, PartConfigLoader.TEMP); double sum = cost * COST_FACTOR; sum += MASS_BASE - mass * MASS_FACTOR; sum += crashTolerance * CRASH_TOLERANCE_FACTOR; sum += maxTemp * TEMP_FACTOR; Log.log("Basic: " + sum); return(sum); }
private static double calculateReactionWheelModule(AvailablePart part) { ConfigNode module = PartConfigLoader.GetReactionWheelModule(part); if (module == null) { return(0); } Double torke = PartConfigLoader.GetProperty(module, PartConfigLoader.TORKE); ConfigNode electric = PartConfigLoader.GetResource(module, PartConfigLoader.ELECTRIC_CHARGE); Double electricCharge = electric == null ? 0 : PartConfigLoader.GetProperty(electric, PartConfigLoader.RATE); Double sum = TORKE_FACTOR * torke; sum += electricCharge > 0 ? CHARGE_RATE_REACTION_WHEEL_BASE - CHARGE_RATE_REACTION_WHEEL_FACTOR * electricCharge : 0; Log.log("ReactionWheel: " + sum); return(sum); }
private static double calculateCommandModule(AvailablePart part) { ConfigNode commandModule = PartConfigLoader.GetCommandModule(part); Log.log("Command Module: " + commandModule); if (commandModule == null) { return(0); } Double minCrew = PartConfigLoader.GetProperty(commandModule, PartConfigLoader.MINUMUN_CREW); Log.log("Minimun Crew: " + minCrew); bool hasHibernation = PartConfigLoader.GetBooleanProperty(commandModule, PartConfigLoader.HAS_HIBERNATION); Log.log("Has Hibernation: " + hasHibernation); bool hasHibernationMultiplier = PartConfigLoader.HasProperty(commandModule, PartConfigLoader.HIBERNATION_MULTIPLIER); Log.log("Has Hibernation Multiplier: " + hasHibernationMultiplier); ConfigNode chargeResource = PartConfigLoader.GetResource(commandModule, PartConfigLoader.ELECTRIC_CHARGE); Double chargeRate = chargeResource != null?PartConfigLoader.GetProperty(chargeResource, PartConfigLoader.RATE) : 1; double sum = 0; if (minCrew < 1) { sum += MIN_CREW_COMMAND_BASE; } if (!hasHibernation) { return(sum); } sum += CHARGE_RATE_COMMAND_BASE - CHARGE_RATE_COMMAND_FACTOR * chargeRate; double hibernationMultiplier = hasHibernationMultiplier ? PartConfigLoader.GetProperty(commandModule, PartConfigLoader.HIBERNATION_MULTIPLIER) : 0.5; sum += HIBERNATION_COMMAND_BASE - HIBERNATION_COMMAND_FACTOR * hibernationMultiplier; Log.log("Command: " + sum); return(sum); }
private static double calculateProbeControlPointModule(AvailablePart part) { ConfigNode module = PartConfigLoader.GetProbeControlPointModule(part); if (module == null) { return(0); } double sum = PROBE_CONTROL_POINT_MODULE_BASE - PROBE_CONTROL_POINT_FACTOR * PartConfigLoader.GetProperty(module, PartConfigLoader.MINUMUN_CREW); Log.log("Probe control point: " + sum); return(sum); }