void addKerbal(ProtoCrewMember pcm) { KerbalExt ext = new KerbalExt(); ext.NewKerbal(pcm); SetExt(pcm, ext); }
void onProtoCrewMemberSave(GameEvents.FromToAction <ProtoCrewMember, ConfigNode> action) { ProtoCrewMember pcm = action.from; //Debug.LogFormat ("[KerbalStats] saving ext for {0}", pcm.name); ConfigNode node = action.to; ConfigNode kerbalExt = node.AddNode("KerbalExt"); if (kerbals != null) { //Debug.Log (" from kerbals"); // The check shouldn't be necessary, but sometimes name changes // slip through the cracks (FIXME there is an event as of KSP // 1.3 which I need to add). The next load should take care of // the missing ext data. if (kerbals.ContainsKey(pcm.name)) { kerbals[pcm.name].Save(kerbalExt); } } else if (loading_kerbals != null) { //Debug.Log (" from loading_kerbals"); } else { //Debug.Log (" from the ether"); KerbalExt ext = new KerbalExt(); ext.NewKerbal(pcm); ext.Save(kerbalExt); } }