Skip to content

Commit

Permalink
Showing 12 changed files with 497 additions and 83 deletions.
Binary file modified GameData/RP-0/Plugins/RP0.dll
Binary file not shown.
Binary file modified GameData/RP-0/Plugins/RP0KCTBinder.dll
Binary file not shown.
6 changes: 6 additions & 0 deletions GameData/RP-0/Plugins/temp.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TRAININGTIMES
{
Capusles = 1
mk1pod = Capsules
Capsules_Mission = 0.25
}
54 changes: 48 additions & 6 deletions Source/Crew/ActiveCourse.cs
Original file line number Diff line number Diff line change
@@ -73,8 +73,37 @@ public void FromConfigNode(ConfigNode node)

public bool MeetsStudentReqs(ProtoCrewMember student)
{
return (student.type == (ProtoCrewMember.KerbalType.Crew) && (seatMax <= 0 || Students.Count < seatMax) && !student.inactive && student.rosterStatus == ProtoCrewMember.RosterStatus.Available && student.experienceLevel >= minLevel &&
student.experienceLevel <= maxLevel && (classes.Length == 0 || classes.Contains(student.trait)) && !Students.Contains(student));
if (!((student.type == (ProtoCrewMember.KerbalType.Crew) && (seatMax <= 0 || Students.Count < seatMax) && !student.inactive && student.rosterStatus == ProtoCrewMember.RosterStatus.Available && student.experienceLevel >= minLevel &&
student.experienceLevel <= maxLevel && (classes.Length == 0 || classes.Contains(student.trait)) && !Students.Contains(student))))
return false;
if (preReqs != null)
{
int pCount = preReqs.GetLength(0);
if (pCount > 0)
{
for (int i = pCount; i-- > 0;)
pChecker[i] = true;

int needCount = pCount;

for (int entryIdx = student.flightLog.Count; entryIdx-- > 0 && needCount > 0;)
{
FlightLog.Entry e = student.flightLog.Entries[entryIdx];

for (int preIdx = pCount; preIdx-- > 0;)
{
if (pChecker[preIdx] && (e.type == preReqs[preIdx, 0] && (string.IsNullOrEmpty(preReqs[preIdx, 1]) || e.target == preReqs[preIdx, 1])))
{
pChecker[preIdx] = false;
--needCount;
}
}
}
if (needCount > 0)
return false;
}
}
return true;
}
public void AddStudent(ProtoCrewMember student)
{
@@ -112,12 +141,10 @@ public bool ProgressTime(double curT)
return false;
if (!Completed)
{
UnityEngine.Debug.Log("Course " + id + " applying " + curT);
elapsedTime = curT - startTime;
Completed = curT > startTime + time;
Completed = curT > startTime + GetTime(Students);
if (Completed) //we finished the course!
{
UnityEngine.Debug.Log("Course " + id + " COMPLETE");
CompleteCourse();
}
}
@@ -141,11 +168,26 @@ public void CompleteCourse()
if (RewardLog != null)
{
student.flightLog.AddFlight();
CrewHandler.TrainingExpiration exp = null;
if (expiration > 0d)
{
exp = new CrewHandler.TrainingExpiration();
exp.pcmName = student.name;
exp.expiration = expiration;
if (expirationUseStupid)
exp.expiration *= (1.5d - student.stupidity);
}

foreach (ConfigNode.Value v in RewardLog.values)
{
string[] s = v.value.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
student.flightLog.AddEntry(s[0], s.Length == 1 ? null : s[1]);
if (expiration > 0d)
exp.entries.Add(s[0]);
}

if (expiration > 0d)
CrewHandler.Instance.AddExpiration(exp);
}
}
}
@@ -172,7 +214,7 @@ public bool StartCourse()
Started = true;

foreach (ProtoCrewMember student in Students)
student.SetInactive(time + 1d);
student.SetInactive(GetTime(Students) + 1d);

return true;
//fire an event
39 changes: 36 additions & 3 deletions Source/Crew/CourseTemplate.cs
Original file line number Diff line number Diff line change
@@ -18,17 +18,22 @@ public class CourseTemplate
public bool Available = true; //Whether the course is currently being offered

public string[] activePreReqs = { }; //prereqs that must not be expired
public string[] preReqs = { }; //prereqs that must be taken, but can be expired
public string[,] preReqs = { }; //prereqs that must be taken, but can be expired
public bool[] pChecker = { }; // prereq checker;
public string[] conflicts = { }; //course IDs that cannot be taken while this course is not expired

public double time = 0; //how much time the course takes (in seconds)
public bool timeUseStupid = false;
public bool required = false; //whether the course is required for the kerbal to be usable
public RepeatMode repeatable = RepeatMode.NEVER; //whether the course can be repeated

public string[] classes = { }; //which classes can take this course (empty == all)
public int minLevel = 0; //minimum kerbal level required to take the course
public int maxLevel = 99; //max kerbal level allowed to take the course

public double expiration = 0d;
public bool expirationUseStupid = false;

public int seatMax = -1; //maximum number of kerbals allowed in the course at once
public int seatMin = 0; //minimum number of kerbals required to start the course

@@ -75,7 +80,23 @@ public void PopulateFromSourceNode(ConfigNode source = null)

tmpStr = source.GetValue("preReqs");
if (!string.IsNullOrEmpty(tmpStr))
preReqs = tmpStr.Split(',');
{
string[] split1 = tmpStr.Split(',');
int iC = split1.Length;
preReqs = new string[iC, 2];
pChecker = new bool[iC];

for (int i = 0; i < iC; ++i)
{
string[] split2 = split1[i].Split(':');
preReqs[i, 0] = split2[0];
if (split2.Length > 1)
preReqs[i, 1] = split2[1];
else
preReqs[i, 1] = string.Empty;
}

}

tmpStr = source.GetValue("conflicts");
if (!string.IsNullOrEmpty(tmpStr))
@@ -123,7 +144,7 @@ public void PopulateFromSourceNode(ConfigNode source = null)
logStr += "\nID: " + id;
logStr += "\nName: " + name;
logStr += "\nAvailable: " + Available;
logStr += "\nprereqs: " + preReqs.Length;
logStr += "\nprereqs: " + preReqs.GetLength(0);
logStr += "\ntime: " + time;
logStr += "\nrepeatable: " + repeatable;
logStr += "\nXP: " + rewardXP;
@@ -134,5 +155,17 @@ public void PopulateFromSourceNode(ConfigNode source = null)
UnityEngine.Debug.Log(logStr);*/
}

public double GetTime(List<ProtoCrewMember> students)
{
if (students == null || !timeUseStupid)
return time;

double maxStupid = 0d;
foreach (ProtoCrewMember pcm in students)
maxStupid = Math.Max(pcm.stupidity, maxStupid);

return time * (0.5d + maxStupid);
}
}
}
199 changes: 180 additions & 19 deletions Source/Crew/CrewHandler.cs
Original file line number Diff line number Diff line change
@@ -11,6 +11,55 @@ namespace RP0.Crew
[KSPScenario(ScenarioCreationOptions.AddToAllGames, new GameScenes[] { GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.SPACECENTER, GameScenes.TRACKSTATION })]
public class CrewHandler : ScenarioModule
{
#region TrainingExpiration

public class TrainingExpiration : IConfigNode
{
public string pcmName;

public List<string> entries = new List<string>();

public double expiration;

public TrainingExpiration() { }

public TrainingExpiration(ConfigNode node)
{
Load(node);
}

public void Load(ConfigNode node)
{
foreach (ConfigNode.Value v in node.values)
{
switch (v.name)
{
case "pcmName":
pcmName = v.value;
break;
case "expiration":
double.TryParse(v.value, out expiration);
break;

default:
case "entry":
entries.Add(v.value);
break;
}
}
}

public void Save(ConfigNode node)
{
node.AddValue("pcmName", pcmName);
node.AddValue("expiration", expiration);
foreach (string s in entries)
node.AddValue("entry", s);
}
}

#endregion

#region Fields

protected Dictionary<string, double> kerbalRetireTimes = new Dictionary<string, double>();
@@ -19,6 +68,8 @@ public class CrewHandler : ScenarioModule

protected static HashSet<string> toRemove = new HashSet<string>();

protected List<TrainingExpiration> expireTimes = new List<TrainingExpiration>();

protected bool inAC = false;

protected KSP.UI.Screens.AstronautComplex astronautComplex = null;
@@ -39,6 +90,8 @@ public class CrewHandler : ScenarioModule
public List<CourseTemplate> CourseTemplates = new List<CourseTemplate>();
public List<CourseTemplate> OfferedCourses = new List<CourseTemplate>();
public List<ActiveCourse> ActiveCourses = new List<ActiveCourse>();
protected HashSet<string> partSynsHandled = new HashSet<string>();
protected TrainingDatabase trainingDatabase = new TrainingDatabase();

public FSGUI fsGUI = new FSGUI();

@@ -85,12 +138,30 @@ public override void OnLoad(ConfigNode node)
base.OnLoad(node);

kerbalRetireTimes.Clear();
foreach (ConfigNode.Value v in node.GetNode("RETIRETIMES").values)
kerbalRetireTimes[v.name] = double.Parse(v.value);
ConfigNode n = node.GetNode("RETIRETIMES");
if (n != null)
{
foreach (ConfigNode.Value v in n.values)
kerbalRetireTimes[v.name] = double.Parse(v.value);
}

retirees.Clear();
foreach (ConfigNode.Value v in node.GetNode("RETIREES").values)
retirees.Add(v.value);
n = node.GetNode("RETIREES");
if (n != null)
{
foreach (ConfigNode.Value v in n.values)
retirees.Add(v.value);
}

expireTimes.Clear();
n = node.GetNode("EXPIRATIONS");
if (n != null)
{
foreach (ConfigNode eN in n.nodes)
{
expireTimes.Add(new TrainingExpiration(eN));
}
}

ConfigNode FSData = node.GetNode("FlightSchoolData");

@@ -110,6 +181,8 @@ public override void OnLoad(ConfigNode node)
Debug.LogException(ex);
}
}

TrainingDatabase.Initialize();
}

public override void OnSave(ConfigNode node)
@@ -124,6 +197,10 @@ public override void OnSave(ConfigNode node)
foreach (string s in retirees)
n.AddValue("retiree", s);

n = node.AddNode("EXPIRATIONS");
foreach (TrainingExpiration e in expireTimes)
e.Save(n.AddNode("Expiration"));

ConfigNode FSData = new ConfigNode("FlightSchoolData");
//save all the active courses
foreach (ActiveCourse course in ActiveCourses)
@@ -230,6 +307,34 @@ public void Update()
ActiveCourses.RemoveAt(i);
}
}

for (int i = expireTimes.Count; i-- > 0;)
{
TrainingExpiration e = expireTimes[i];
if (time > e.expiration)
{
ProtoCrewMember pcm = HighLogic.CurrentGame.CrewRoster[e.pcmName];
if (pcm != null)
{
for (int j = pcm.flightLog.Entries.Count; j-- > 0;)
{
int eC = e.entries.Count;
if (eC == 0)
break;

for (int k = eC; k-- > 0;)
{
if (pcm.flightLog[j].type == e.entries[k])
{
pcm.flightLog[j].type = "expired_" + pcm.flightLog[j].type;
e.entries.RemoveAt(k);
}
}
}
}
expireTimes.RemoveAt(i);
}
}
}

// UI fixing
@@ -311,6 +416,15 @@ public void OnDestroy()

#endregion

#region Interfaces

public void AddExpiration(TrainingExpiration e)
{
expireTimes.Add(e);
}

#endregion

#region Methods

protected void ACSpawn()
@@ -532,7 +646,7 @@ protected void FindAllCourseConfigs()
Debug.Log("[FS] Found " + CourseTemplates.Count + " courses.");
//fire an event to let other mods add their configs
}

protected void GenerateOfferedCourses() //somehow provide some variable options here?
{
//convert the saved configs to course offerings
@@ -550,7 +664,12 @@ protected void GenerateOfferedCourses() //somehow provide some variable options
{
if (ResearchAndDevelopment.PartModelPurchased(ap))
{
OfferedCourses.Add(GenerateCourseForPart(ap));
string name = TrainingDatabase.SynonymReplace(ap.name);
if (!partSynsHandled.Contains(ap.name))
{
partSynsHandled.Add(name);
AddPartCourses(ap);
}
}
}
}
@@ -559,28 +678,70 @@ protected void GenerateOfferedCourses() //somehow provide some variable options
//fire an event to let other mods add available courses (where they can pass variables through then)
}

protected CourseTemplate GenerateCourseForPart(AvailablePart ap)
protected void AddPartCourses(AvailablePart ap)
{
GenerateCourseProf(ap);
GenerateCourseMission(ap);
}

protected void GenerateCourseProf(AvailablePart ap)
{
ConfigNode n = new ConfigNode("FS_COURSE");
{
n.AddValue("id", "prof_" + ap.name);
n.AddValue("name", ap.title);
n.AddValue("time", 3600d + EntryCostStorage.GetCost(ap.name) * 5177d);

ConfigNode r = n.AddNode("REWARD");
r.AddValue("XPAmt", "1");
ConfigNode l = r.AddNode("FLIGHTLOG");
l.AddValue("0", "TRAINING_proficiency," + ap.name);
}
string name = TrainingDatabase.SynonymReplace(ap.name);

n.AddValue("id", "prof_" + name);
n.AddValue("name", "Proficiency: " + name);
n.AddValue("time", 1d + (TrainingDatabase.GetTime(name) * 86400d));
n.AddValue("expiration", 4d * 86400d * 365d);
n.AddValue("expirationUseStupid", true);

ConfigNode r = n.AddNode("REWARD");
r.AddValue("XPAmt", "1");
ConfigNode l = r.AddNode("FLIGHTLOG");
l.AddValue("0", "TRAINING_proficiency," + name);

CourseTemplate c = new CourseTemplate(n);
c.PopulateFromSourceNode();
OfferedCourses.Add(c);

ConfigNode n2 = n.CreateCopy();
n2.SetValue("id", "profR_" + name);
n2.SetValue("name", "Refresher: " + name);
n2.SetValue("time", 1d + TrainingDatabase.GetTime(name) * 86400d * 0.25d);
n2.AddValue("preReqs", "expired_TRAINING_proficiency:" + name);
r = n2.GetNode("REWARD");
r.SetValue("XPAmt", "0");

c = new CourseTemplate(n2);
c.PopulateFromSourceNode();
OfferedCourses.Add(c);
}

protected void GenerateCourseMission(AvailablePart ap)
{
ConfigNode n = new ConfigNode("FS_COURSE");
string name = TrainingDatabase.SynonymReplace(ap.name);

n.AddValue("id", "msn_" + name);
n.AddValue("name", "Mission: " + name);
n.AddValue("time", 1d + TrainingDatabase.GetTime(name + "_Mission") * 86400d);
n.AddValue("seatMax", ap.partPrefab.CrewCapacity * 2);
n.AddValue("expiration", 120d * 86400d);

return c;
n.AddValue("preReqs", "TRAINING_proficiency:" + name);

ConfigNode r = n.AddNode("REWARD");
ConfigNode l = r.AddNode("FLIGHTLOG");
l.AddValue("0", "TRAINING_mission," + name);

CourseTemplate c = new CourseTemplate(n);
c.PopulateFromSourceNode();
OfferedCourses.Add(c);
}

protected void onPartPurchased(AvailablePart ap)
{
OfferedCourses.Add(GenerateCourseForPart(ap));
AddPartCourses(ap);
}

#endregion
10 changes: 5 additions & 5 deletions Source/Crew/FSGUI.cs
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ protected void DrawMainGUI(int windowID)

GUILayout.BeginVertical(GUILayout.Width(250)); //offered/active list
int oldStatus = offeredActiveToolbar;
offeredActiveToolbar = GUILayout.Toolbar(offeredActiveToolbar, new string[] { "Proficiencies", "Active Training" });
offeredActiveToolbar = GUILayout.Toolbar(offeredActiveToolbar, new string[] { "Training Offered", "Active Training" });
if (offeredActiveToolbar != oldStatus)
{
selectedCourse = null;
@@ -76,7 +76,7 @@ protected void DrawMainGUI(int windowID)

GUILayout.Label(selectedCourse.description);

GUILayout.Label("Course length: " + KSPUtil.PrintDateDelta(selectedCourse.time, true));
GUILayout.Label("Course ends: " + KSPUtil.PrintDate(selectedCourse.GetTime(selectedCourse.Students) + Planetarium.GetUniversalTime(), true));

//select the kerbals. Two lists, the current Students and the available ones
GUILayout.BeginHorizontal();
@@ -149,9 +149,9 @@ protected void DrawMainGUI(int windowID)
GUILayout.EndHorizontal();

GUILayout.Label(selectedCourse.description);

GUILayout.Label("Time remaining: "+KSPUtil.PrintDateDelta(selectedCourse.time-selectedCourse.elapsedTime, true));
GUILayout.Label(Math.Round(100*selectedCourse.elapsedTime/selectedCourse.time, 1) + "% complete");
double t = selectedCourse.GetTime(selectedCourse.Students);
GUILayout.Label("End date: "+KSPUtil.PrintDate(t + selectedCourse.startTime, true));
GUILayout.Label(Math.Round(100*selectedCourse.elapsedTime/t, 1) + "% complete");

//scroll list of all students
GUILayout.Label("Students:");
143 changes: 143 additions & 0 deletions Source/Crew/TrainingDatabase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace RP0.Crew
{
public class TrainingDatabase
{
public class TrainingHolder
{
#region Fields

public string name;

public double days = 0;

public List<string> children = new List<string>();

#endregion

#region Constructors

public TrainingHolder(string name, string val)
{
this.name = name;

double tmp;
string[] split = val.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in split)
{
if (double.TryParse(s, out tmp))
days += tmp;
else
children.Add(s);
}
}

#endregion

#region Methods

public double GetTime()
{
double c = days;

foreach (string s in children)
c += TrainingDatabase._GetTime(s);

return c;
}

#endregion
}

#region Fields

protected static Dictionary<string, TrainingHolder> holders = null;

protected static HashSet<string> unlockPathTracker = new HashSet<string>();

#endregion

#region Setup

public TrainingDatabase()
{
Initialize();
}
public static void Initialize()
{
if (holders == null)
holders = new Dictionary<string, TrainingHolder>();

FillHolders();
}

protected static void FillHolders()
{
holders.Clear();

foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("TRAININGTIMES"))
{
foreach (ConfigNode.Value v in node.values)
{
TrainingHolder p = new TrainingHolder(v.name, v.value);
holders[p.name] = p;
}
}
}
#endregion

#region Interface

public static double GetTime(string name)
{
ClearTracker();
return _GetTime(name);
}
protected static double _GetTime(string name)
{
if (unlockPathTracker.Contains(name))
{
/*string msg = "[TrainingDatabase]: Circular reference on " + name;
foreach (string s in unlockPathTracker)
msg += "\n" + s;
Debug.LogError(msg);*/
return 0;
}

unlockPathTracker.Add(name);

TrainingHolder h;
if (holders.TryGetValue(name, out h))
return h.GetTime();

return 0d;
}

public static string SynonymReplace(string name)
{
TrainingHolder h;
if (holders.TryGetValue(name, out h))
{
if (h.children.Count == 1)
{
return h.children[0];
}
}
return name;
}


public static void ClearTracker()
{
unlockPathTracker.Clear();
}

#endregion
}
}
19 changes: 17 additions & 2 deletions Source/KCTBinderModule.cs
Original file line number Diff line number Diff line change
@@ -33,11 +33,26 @@ public static bool CheckCrewForPart(ProtoCrewMember pcm, string partName)
if (EntryCostStorage.GetCost(partName) == 1)
return true;

partName = Crew.TrainingDatabase.SynonymReplace(partName);

int lastFlight = pcm.flightLog.Last().flight;
bool lacksMission = true;
for (int i = pcm.flightLog.Entries.Count; i-- > 0;)
{
FlightLog.Entry e = pcm.flightLog.Entries[i];
if (e.type == "TRAINING_proficiency" && e.target == partName)
return true;
if (lacksMission)
{
if (e.flight < lastFlight)
return false;

if (e.type == "TRAINING_mission" && e.target == partName)
lacksMission = false;
}
else
{
if (e.type == "TRAINING_proficiency" && e.target == partName)
return true;
}
}
return false;
}
105 changes: 57 additions & 48 deletions Source/LoadingScreenChanger.cs
Original file line number Diff line number Diff line change
@@ -35,71 +35,80 @@ protected void Update()
if (LoadingScreen.Instance.Screens.Count < 2)
return;

Debug.Log("[RP-0]: Replacing loading screens.");
try
{

LoadingScreen.LoadingScreenState origState = LoadingScreen.Instance.Screens[1];
Debug.Log("[RP-0]: Replacing loading screens.");

List<Texture2D> textures = new List<Texture2D>();
DirectoryInfo di = new DirectoryInfo(KSPUtil.ApplicationRootPath + "GameData/RP-0/PluginData/Screens");
foreach (FileInfo fi in di.GetFiles())
{
if (fi.FullName.ToLowerInvariant().EndsWith(".dds"))
LoadingScreen.LoadingScreenState origState = LoadingScreen.Instance.Screens[1];

List<Texture2D> textures = new List<Texture2D>();

DirectoryInfo di = new DirectoryInfo(KSPUtil.ApplicationRootPath + "GameData/RP-0/PluginData/Screens");
foreach (FileInfo fi in di.GetFiles())
{
Debug.Log("Loading " + fi.FullName);
try
{
Texture2D t = LoadDDS(fi.FullName);
if (t != null)
textures.Add(t);
}
catch (Exception e)
if (fi.FullName.ToLowerInvariant().EndsWith(".dds"))
{
Debug.LogError("[RP-0]: Exception loading " + fi.FullName + ":\n" + e);
Debug.Log("Loading " + fi.FullName);
try
{
Texture2D t = LoadDDS(fi.FullName);
if (t != null)
textures.Add(t);
}
catch (Exception e)
{
Debug.LogError("[RP-0]: Exception loading " + fi.FullName + ":\n" + e);
}
}
}
}
int tC = textures.Count;
float screenTime = Mathf.Round(240f / (float)tC);
System.Random random = new System.Random();
if (tC > 0)
{
for (int i = tC - 1; i-- > 0;)
int tC = textures.Count;
float screenTime = Mathf.Round(240f / (float)tC);
System.Random random = new System.Random();
if (tC > 0)
{
int idx = random.Next(0, textures.Count);
LoadingScreen.LoadingScreenState state = new LoadingScreen.LoadingScreenState();
state.fadeInTime = origState.fadeInTime;
state.fadeOutTime = origState.fadeOutTime;
state.displayTime = screenTime;
state.tips = origState.tips;
state.tipTime = origState.tipTime;
state.screens = new Texture2D[] { textures[idx] };
for (int i = tC - 1; i-- > 0;)
{
int idx = random.Next(0, textures.Count);
LoadingScreen.LoadingScreenState state = new LoadingScreen.LoadingScreenState();
state.fadeInTime = origState.fadeInTime;
state.fadeOutTime = origState.fadeOutTime;
state.displayTime = screenTime;
state.tips = origState.tips;
state.tipTime = origState.tipTime;
state.screens = new Texture2D[] { textures[idx] };

LoadingScreen.Instance.Screens.Add(state);
LoadingScreen.Instance.Screens.Add(state);

textures.RemoveAt(idx);
textures.RemoveAt(idx);

LoadingScreen.Instance.loaders.Add(LoadingScreen.Instance.gameObject.AddComponent<DummyLoadingSystem>());
}
LoadingScreen.Instance.loaders.Add(LoadingScreen.Instance.gameObject.AddComponent<DummyLoadingSystem>());
}

origState.screens = new Texture2D[] { textures[0] };
origState.displayTime = screenTime;
origState.screens = new Texture2D[] { textures[0] };
origState.displayTime = screenTime;

LoadingScreen.Instance.Screens[LoadingScreen.Instance.Screens.Count - 1].displayTime = 2400f;
LoadingScreen.Instance.Screens[LoadingScreen.Instance.Screens.Count - 1].displayTime = 2400f;

string msgStr = "[RP-0]: Loading screens replaced.";
string msgStr = "[RP-0]: Loading screens replaced.";

Debug.Log(msgStr);
}
else
{
Debug.LogError("[RP-0]: No screens found in RP-0/PluginData/Screens!");
}
Debug.Log(msgStr);
}
else
{
Debug.LogError("[RP-0]: No screens found in RP-0/PluginData/Screens!");
}

// Try to jigger the unity random thing.
// Try to jigger the unity random thing.

for (int i = (int)((new System.Random()).NextDouble() * 100d); i-- > 0;)
for (int i = (int)((new System.Random()).NextDouble() * 100d); i-- > 0;)
{
UnityEngine.Random.Range(0, 10);
}
}
catch (Exception e)
{
UnityEngine.Random.Range(0, 10);
Debug.LogError("Patching failed: " + e);
}

GameObject.Destroy(this);
1 change: 1 addition & 0 deletions Source/RP0.csproj
Original file line number Diff line number Diff line change
@@ -50,6 +50,7 @@
<ItemGroup>
<Compile Include="Crew\ActiveCourse.cs" />
<Compile Include="Crew\CourseTemplate.cs" />
<Compile Include="Crew\TrainingDatabase.cs" />
<Compile Include="Crew\FSGUI.cs" />
<Compile Include="EntryCostStorage.cs" />
<Compile Include="Maintenance\MaintenanceHandler.cs" />
4 changes: 4 additions & 0 deletions Source/Tooling/ToolingDatabase.cs
Original file line number Diff line number Diff line change
@@ -185,6 +185,10 @@ public static bool UnlockTooling(string type, float diam, float len)
public static void Load(ConfigNode node)
{
toolings.Clear();

if (node == null)
return;

foreach (ConfigNode c in node.GetNodes("TYPE"))
{
string type = c.GetValue("type");

0 comments on commit 2135827

Please sign in to comment.