Skip to content

Commit

Permalink
Merge branch 'master' into Clayell-expected-days
Browse files Browse the repository at this point in the history
  • Loading branch information
Clayell authored Jul 13, 2024
2 parents 7eadbe0 + 3512de9 commit bdb3ef0
Show file tree
Hide file tree
Showing 30 changed files with 425 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CONTRACT_TYPE
group = CommApp


description = <b>Program: Early Commercial Applications<br>Type: <color=green>Required</color></b><br><br>Now that you've demonstrated the ability of satellites to relay communications via one-off launches, it's time to create a network of them to provide full coverage of the Earth.<br><br>Launch a 4-satellite communication network where the satellites are sufficiently dispersed and in high enough orbits to provide near-complete coverage of the Earth's surface.<br><br><b><color=white>NOTE: You may choose only the 3-satellite or 4-satellite contract.</color></b><br><br><b><color=yellow>NOTE: The satellites will be destroyed upon completion of the contract. This simulates transfer of the payload back to the customer.</color>
description = <b>Program: Early Commercial Applications<br>Type: <color=green>Required</color></b><br><br>Now that you've demonstrated the ability of satellites to relay communications via one-off launches, it's time to create a network of them to provide full coverage of the Earth.<br><br>Launch a 3-satellite communication network where the satellites are sufficiently dispersed and in high enough orbits to provide near-complete coverage of the Earth's surface.<br><br><b><color=white>NOTE: You may choose only the 3-satellite or 4-satellite contract.</color></b><br><br><b><color=yellow>NOTE: The satellites will be destroyed upon completion of the contract. This simulates transfer of the payload back to the customer.</color>
synopsis = Launch a 3 satellite Communications Network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CONTRACT_TYPE
title = Commercial Communications Satellite (Early)
group = CommApp

description = <b>Program: Early Commercial Applications<br>Type: <color=blue>Optional</color></b><br><br>Now that satellite communications technology has been proven, launch more capable satellites to expand communication coverage further around Earth. Every major Telecom now wants their own satellite capabilities tailored to their specific needs. Launch new communications satellites with the required specifications into the specified orbits.<br><br><b><color=yellow>NOTE: The satellite will be destroyed upon completion of the contract. This simulates transfer of the payload back to the customer.</color><br><br>The reward of this contract will slowly increase over time but will be reset to 0 after each completion.<br><b>Current reward is at @rewardFactorPercent % of its nominal value. Elapsed/Expected Days: @elapsedDays / @RP0:expectedDays_EarlyComSat<br>Number of Contracts Completed: @index / unlimited</b>
description = <b>Program: Early Commercial Applications<br>Type: <color=blue>Optional</color></b><br><br>Now that satellite communications technology has been proven, we need to launch more capable satellites to expand communication coverage further around Earth. Every major Telecom wants their own satellite capabilities tailored to their specific needs. Launch new communications satellites with the required specifications into the specified orbits.<br><br><b><color=yellow>NOTE: The satellite will be destroyed upon completion of the contract. This simulates transfer of the payload back to the customer.</color><br><br>The reward of this contract will slowly increase over time but will be reset to 0 after each completion.<br><b>Current reward is at @rewardFactorPercent % of its nominal value. Elapsed/Expected Days: @elapsedDays / @RP0:expectedDays_EarlyComSat<br>Number of Contracts Completed: @index / unlimited</b>
genericDescription = Put a satellite with the required amount of communications satellite payload into the desired orbit.

synopsis = Launch a Communications Satellite for a customer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CONTRACT_TYPE
advanceFunds = 0
rewardFunds = 0
rewardScience = 0
rewardReputation = Round(55 * Pow(@EarlyMolniya/ReachOrbit/minPeA / 6000000, 0.5) * Pow((@EarlyMolniya/HasComSatPayload/minQuantity / 325), 0.5) * @rewardFactor, 1)
rewardReputation = Round(55 * Pow(@EarlyMolniya/ReachOrbit/minPeA / 6000000, 0.5) * Pow(((@EarlyMolniya/HasComSatPayload/minQuantity * 10) / 325), 0.5) * @rewardFactor, 1) // pretend to have 10x the payload to make the reward line up with comsat repeatable, which requires about the same tonnage to orbit
failureReputation = 0 // was @rewardReputation
failureFunds = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CONTRACT_TYPE
group = CommApp
agent = Federation Aeronautique Internationale

description = <b>Program: Early Commercial Applications<br><b>Type: <color=green>Required</color></b><br><br>A Molniya orbit is a type of highly elliptical orbit with an inclination of 63.4 degrees, an argument of perigee of -90 degrees, and an orbital period of one half of a sidereal day. This keeps the satellite mostly to the northern hemisphere of the Earth. Place a satellite into a Molniya orbit.<br><br>There will be an orbit showing in the map view and tracking station. You do not have to place the satellite into this orbit, but it is instead meant to show you where your perigee and apogee should approximately be located, but more importantly, it shows the proper shape of the orbit.<br><br>Historical example: Molniya 1-1 (1,600kg, Molniya)<br><br><b><color=yellow>NOTE: The satellite will be destroyed upon completion of the contract. This simulates transfer of the payload back to the customer.</color>
description = <b>Program: Early Commercial Applications<br><b>Type: <color=green>Required</color></b><br><br>A Molniya orbit is a type of highly elliptical orbit with an inclination of 63.4 degrees, an argument of perigee of -90 (270) degrees, and an orbital period of one half of a sidereal day. This keeps the satellite mostly to the northern hemisphere of the Earth. Place a satellite into a Molniya orbit.<br><br>There will be an orbit showing in the map view and tracking station. You do not have to place the satellite into this orbit, but it is instead meant to show you where your perigee and apogee should approximately be located, but more importantly, it shows the proper shape of the orbit.<br><br>Historical example: Molniya 1-1 (1,600kg, Molniya)<br><br><b><color=yellow>NOTE: The satellite will be destroyed upon completion of the contract. This simulates transfer of the payload back to the customer.</color>

synopsis = Launch a satellite into a Molniya orbit

Expand Down
11 changes: 1 addition & 10 deletions GameData/RP-1/Craft Files/SPH/Supersonic Jet Trainer.craft
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ PART
isEnabled = True
_enabled = True
TxPower = 30
TechLevel = 10
TechLevel = 0
AMWTemp = 0
antennaDiameter = 0
referenceGain = 1.5
Expand All @@ -1465,15 +1465,6 @@ PART
}
UPGRADESAPPLIED
{
upgrade = commsTL1
upgrade = commsTL2
upgrade = commsTL3
upgrade = commsTL4
upgrade = commsTL5
upgrade = commsTL6
upgrade = commsTL7
upgrade = commsTL8
upgrade = commsTL9
}
}
MODULE
Expand Down
14 changes: 7 additions & 7 deletions GameData/RP-1/CustomBarnKit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
}
@TRACKING
{
@levels = 10
@upgradesVisual = 1, 1, 2, 2, 2, 3, 3, 3, 3, 3
@upgrades = 50000, 50000, 50000, 100000, 175000, 100000, 150000, 1000000, 300000, 300000
@levels = 11
@upgradesVisual = 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3
@upgrades = 50000, 50000, 50000, 100000, 175000, 100000, 150000, 1000000, 300000, 300000, 300000
@unlockedSpaceObjectDiscovery = 8
@orbitDisplayMode = 2, 3, 3, 3, 3, 3, 3, 3, 3, 3
@patchesAheadLimit = 0, 1, 2, 3, 4, 4, 4, 4, 4, 4
@trackedObjectLimit = 0, 1, 2, 3, 4, 5, 6, 8, 10, -1
@DSNRange = 4.2047e11, 8.4093e11, 1.3329e12, 4.2652e12, 1.3649e13, 4.0946e13, 1.1465e14, 3.6688e14, 5.1363e14, 8.9885e14
@orbitDisplayMode = 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
@patchesAheadLimit = 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4
@trackedObjectLimit = 0, 1, 2, 3, 4, 5, 6, 8, 10, -1, -1
@DSNRange = 4.2047e11, 8.4093e11, 1.3329e12, 4.2652e12, 1.3649e13, 4.0946e13, 1.1465e14, 3.6688e14, 5.1363e14, 8.9885e14, 8.9885e14
@DSNRangeCurve
{
key = 0 0 0 1
Expand Down
2 changes: 1 addition & 1 deletion GameData/RP-1/Programs/Programs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ RP0_PROGRAM
name = CrewedOrbitEarly
isHSF = true
title = Crewed Orbit
description = Sending machines to space as a proxy for human beings was never the final goal. This program requires you to safely put astronauts into orbit and return them to the Earth, proving that humanity can survive in the most hostile environment nature has given us the opportunity to explore.
description = Sending machines to space as a proxy for human beings was never the final goal. This program requires you to safely put astronauts into orbit and return them to the Earth, proving that humanity can survive in the most hostile environment nature has given us the opportunity to explore. You will need to upgrade your Astronaut Complex to level three so you can train your astronauts for the rigors of spaceflight. Make sure you start to train your crew about a year before you launch.
requirementsPrettyText = Complete one of the Early Satellites Programs
objectivesPrettyText = Complete the program by putting an astronaut into orbit and returning them.
nominalDurationYears = 4
Expand Down
4 changes: 0 additions & 4 deletions GameData/RP-1/Science/BodyScienceParams.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
{
%ScienceValues
{
//high enough for LLO to be inside it, and for impact missions to transmit before crashing
//low enough to be appreciably harder than a simple flyby.
%spaceAltitudeThreshold = 150000

%landedDataValue = 3.0
%inSpaceLowDataValue = 2.0
%inSpaceHighDataValue = 1.5
Expand Down
6 changes: 6 additions & 0 deletions GameData/RP-1/Tree/CommsTechlevels.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
%techRequired = efficientComms
%description = More general improvements. Idle power: 11.7 watts. NOTE: You must purchase this upgrade here before you can use it.
}
@PARTUPGRADE[commsTL10]:FOR[RP-0]
{
%level = 10
%techRequired = modernComms
%description = More general improvements. Arraying of 32-meter antennas improves Ka-band performance. Idle power: 9.5 watts. NOTE: You must purchase this upgrade here before you can use it.
}
@PARTUPGRADE[commsTL*]:FOR[RP-0]
{
%title = #Comms Tech Level $level$
Expand Down
1 change: 1 addition & 0 deletions GameData/RP-1/Tree/EntryCostModifiers.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ ENTRYCOSTMODS
commsTL7 = 200000, commsTL6 // X-band
commsTL8 = 100000, commsTL7
commsTL9 = 300000, commsTL8 // K-band
commsTL10 = 100000, commsTL9
// Omni
commsOmniLevel1 = 0
Expand Down
61 changes: 58 additions & 3 deletions GameData/RP-1/Tree/TREE-Parts.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25759,7 +25759,7 @@
%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-phased-array-1]:FOR[xxxRP0]
@PART[nfex-antenna-feeder-direct-1]:FOR[xxxRP0]
{
%TechRequired = interplanetaryComms
%cost = 10
Expand All @@ -25769,10 +25769,21 @@

%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-phased-array-1]:FOR[xxxRP0]
{
%TechRequired = improvedComms
%cost = 10
%entryCost = 1000
RP0conf = true
@description ^=:$: <b><color=green>From Near Future Exploration mod</color></b>

%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-phased-array-2]:FOR[xxxRP0]
{
%TechRequired = interplanetaryComms
%TechRequired = improvedComms
%cost = 10
%entryCost = 1000
RP0conf = true
Expand All @@ -25783,7 +25794,18 @@
}
@PART[nfex-antenna-phased-array-3]:FOR[xxxRP0]
{
%TechRequired = interplanetaryComms
%TechRequired = improvedComms
%cost = 10
%entryCost = 1000
RP0conf = true
@description ^=:$: <b><color=green>From Near Future Exploration mod</color></b>

%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-phased-single-3]:FOR[xxxRP0]
{
%TechRequired = improvedComms
%cost = 10
%entryCost = 1000
RP0conf = true
Expand Down Expand Up @@ -25890,6 +25912,39 @@

%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-rover-2]:FOR[xxxRP0]
{
%TechRequired = unlockParts
%cost = 10
%entryCost = 1000
RP0conf = true
@description ^=:$: <b><color=green>From Near Future Exploration mod</color></b>

%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-rover-3]:FOR[xxxRP0]
{
%TechRequired = improvedComms
%cost = 10
%entryCost = 1000
RP0conf = true
@description ^=:$: <b><color=green>From Near Future Exploration mod</color></b>

%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-static-mini-1]:FOR[xxxRP0]
{
%TechRequired = interplanetaryComms
%cost = 10
%entryCost = 1000
RP0conf = true
@description ^=:$: <b><color=green>From Near Future Exploration mod</color></b>

%MODULE[ModuleTagList] { tag = Instruments }

}
@PART[nfex-antenna-top-dish-1]:FOR[xxxRP0]
{
Expand Down
2 changes: 0 additions & 2 deletions RP-1.netkan
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ depends:
suppress_recommendations: true
- name: RealSolarSystem
suppress_recommendations: true
- name: MagiCore
suppress_recommendations: true
- name: ClickThroughBlocker
suppress_recommendations: true
- name: ToolbarController
Expand Down
2 changes: 1 addition & 1 deletion Source/RP0/Harmony/KSCSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static void Postfix_SetSite(ConfigNode KSC, bool __result)
{
if (__result && SpaceCenterManagement.Instance != null)
{
SpaceCenterManagement.Instance.SetActiveKSC(KSC.name);
SpaceCenterManagement.Instance.SetActiveKSC(KSC.GetValue("name"));
}
}
}
Expand Down
65 changes: 65 additions & 0 deletions Source/RP0/ModIntegrations/KSCSwitcherInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using System.Linq;
using System.Reflection;

namespace RP0
{
public static class KSCSwitcherInterop
{
private static bool? _isKSCSwitcherInstalled = null;
private static FieldInfo _fiKSCSwInstance;
private static FieldInfo _fiKSCSwSites;
private static FieldInfo _fiKSCSwLastSite;
private static FieldInfo _fiKSCSwDefaultSite;

public const string LegacyDefaultKscId = "Stock";
public const string DefaultKscId = "us_cape_canaveral";

public static bool IsKSCSwitcherInstalled
{
get
{
if (!_isKSCSwitcherInstalled.HasValue)
{
Assembly a = AssemblyLoader.loadedAssemblies.FirstOrDefault(la => string.Equals(la.name, "KSCSwitcher", StringComparison.OrdinalIgnoreCase))?.assembly;
_isKSCSwitcherInstalled = a != null;
if (_isKSCSwitcherInstalled.Value)
{
Type t = a.GetType("regexKSP.KSCLoader");
_fiKSCSwInstance = t?.GetField("instance", BindingFlags.Public | BindingFlags.Static);
_fiKSCSwSites = t?.GetField("Sites", BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);

t = a.GetType("regexKSP.KSCSiteManager");
_fiKSCSwLastSite = t?.GetField("lastSite", BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
_fiKSCSwDefaultSite = t?.GetField("defaultSite", BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);

if (_fiKSCSwInstance == null || _fiKSCSwSites == null || _fiKSCSwLastSite == null || _fiKSCSwDefaultSite == null)
{
RP0Debug.LogError("Failed to bind to KSCSwitcher");
_isKSCSwitcherInstalled = false;
}
}
}
return _isKSCSwitcherInstalled.Value;
}
}

public static string GetActiveRSSKSC()
{
if (!IsKSCSwitcherInstalled) return null;

// get the LastKSC.KSCLoader.instance object
// check the Sites object (KSCSiteManager) for the lastSite, if "" then get defaultSite

object loaderInstance = _fiKSCSwInstance.GetValue(null);
if (loaderInstance == null)
return null;
object sites = _fiKSCSwSites.GetValue(loaderInstance);
string lastSite = _fiKSCSwLastSite.GetValue(sites) as string;

if (lastSite == string.Empty)
lastSite = _fiKSCSwDefaultSite.GetValue(sites) as string;
return lastSite;
}
}
}
1 change: 1 addition & 0 deletions Source/RP0/RP0.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<Compile Include="ConfigurableStart\Utilities.cs" />
<Compile Include="Harmony\FlightInputHandler.cs" />
<Compile Include="Harmony\ModuleRCS.cs" />
<Compile Include="ModIntegrations\KSCSwitcherInterop.cs" />
<Compile Include="ModIntegrations\TFInterop.cs" />
<Compile Include="Singletons\LeaderNotifications.cs" />
<Compile Include="SpaceCenter\Projects\HireStaffProject.cs" />
Expand Down
13 changes: 7 additions & 6 deletions Source/RP0/SpaceCenter/LaunchComplex/LaunchComplex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,13 @@ public int LaunchPadCount

public bool IsEmpty => LCType == LaunchComplexType.Hangar && BuildList.Count == 0 && Warehouse.Count == 0 && Engineers == 0 && LCData.StartingHangar.Compare(this);

public bool IsActive => BuildList.Count > 0 || GetAllLCOps().Any(op => !op.IsComplete());
public bool CanDismantle => BuildList.Count == 0 && Warehouse.Count == 0 &&
!Recon_Rollout.Any(r => r.RRType != ReconRolloutProject.RolloutReconType.Reconditioning) &&
VesselRepairs.Count == 0;
public bool CanModifyButton => BuildList.Count == 0 && Warehouse.Count == 0 && Recon_Rollout.Count == 0 && VesselRepairs.Count == 0;
public bool CanModifyReal => Recon_Rollout.Count == 0 && VesselRepairs.Count == 0;
public bool IsActive => BuildList.Count > 0 || GetAllLCOps().Any(op => !op.IsComplete() && op.KeepsLCActive);
public bool CanDismantle => CanModifyButton;
public bool CanModifyButton => BuildList.Count == 0 && Warehouse.Count == 0 &&
!Recon_Rollout.Any(r => r.RRType != ReconRolloutProject.RolloutReconType.Reconditioning) &&
VesselRepairs.Count == 0;
public bool CanModifyReal => !Recon_Rollout.Any(r => r.RRType != ReconRolloutProject.RolloutReconType.Reconditioning) &&
VesselRepairs.Count == 0;
public bool CanIntegrate => ProjectBPTotal == 0d;

private double _projectBPTotal = -1d;
Expand Down
1 change: 0 additions & 1 deletion Source/RP0/SpaceCenter/Projects/LCConstructionProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ private void ReassignEngineers(LaunchComplex lc)
if (engToAssign > 0)
{
KCTUtilities.ChangeEngineers(lc, engToAssign);
lc.RecalculateBuildRates();
}
}
}
Expand Down
17 changes: 8 additions & 9 deletions Source/RP0/SpaceCenter/Projects/LCOpsProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public abstract class LCOpsProject : ConfigNodePersistenceBase, ISpaceCenterProj

public abstract TransactionReasonsRP0 TransactionReason { get; }
protected abstract TransactionReasonsRP0 transactionReasonTime { get; }
public abstract bool KeepsLCActive { get; }

public VesselProject AssociatedVP => KCTUtilities.FindVPByID(LC, AssociatedIdAsGuid);

Expand Down Expand Up @@ -96,7 +97,7 @@ protected double GetBaseBuildRate()
return _buildRate;
}

protected double CalculateBuildRate(int delta)
protected virtual double CalculateBuildRate(int delta)
{
double rate;
if (IsCapped)
Expand Down Expand Up @@ -150,17 +151,15 @@ public double GetTimeLeft()

private double TimeLeftWithEfficiencyIncrease(double timeLeft)
{
if (LC.Efficiency == LCEfficiency.MaxEfficiency)
if (LC.Efficiency == LCEfficiency.MaxEfficiency || timeLeft < 86400d || LC.Engineers == 0)
return timeLeft;

if (timeLeft > 86400d)
double bpDivRate = timeLeft * LC.Efficiency;
double newEff = LC.Efficiency;
double portion = LC.Engineers / (double)LC.MaxEngineers;
for (int i = 0; i < 4; ++i)
{
double newEff = LC.Efficiency;
double portion = LC.Engineers / (double)LC.MaxEngineers;
for (int i = 0; i < 4; ++i)
{
timeLeft = (timeLeft * newEff) / LC.EfficiencySource.PredictWeightedEfficiency(timeLeft, portion, out newEff, LC.Efficiency);
}
timeLeft = bpDivRate / LC.EfficiencySource.PredictWeightedEfficiency(timeLeft, portion, out newEff, LC.Efficiency);
}
return timeLeft;
}
Expand Down
Loading

0 comments on commit bdb3ef0

Please sign in to comment.