Example #1
0
 protected new void Start()
 {
     base.Start();
     vessel = this.GetComponent <Vessel>();
     VesselModuleStaticData.AddVesselModuleToList(this);         //register this module with the VSM manager
     VSMStart();                                                 //run start code in all VSM modules
     InternalLoadCall(VesselModuleStaticData.GetSaveNode(this)); //always want to run load code after Start() to load data
 }
Example #2
0
 private void GameSaveTrigger(ConfigNode node) //called on GameSave event, refresh all data from loaded vessels and save to .sfs
 {
     //need to call save routines here
     if (node.HasNode("VMSNode"))     //note that we do not load data at this point, our data storage is static so we know what's in the save file is old, invalid data
     {
         node.RemoveNodes("VMSNode"); //should only ever be on VMSnode in a file, remove all nodes to error trap it
     }
     node.AddNode(VesselModuleStaticData.SaveRoutine());
 }
Example #3
0
        public void InternalSaveCall() //internal use only, do not use, background code to Save data
        {
            ConfigNode toSaveA = VesselModuleStaticData.GetSaveNode(this);

            if (toSaveA.name == "Empty") //if vessel not yet in file, returns an Empty config node. Have to apply vessel ID identifier before saving
            {
                toSaveA.name = this.vessel.id.ToString();
            }
            toSaveA = VSMSave(VesselModuleStaticData.GetSaveNode(this)); //call VSMSave here for the actual OnSave call, this is where the data actually gets saved
            VesselModuleStaticData.SaveNodeData(this, toSaveA);          //this writes to Static data, no need for return on method
        }
Example #4
0
        private void GameLoadTrigger(ConfigNode node) //load data from .sfs file and then refresh any already loaded vessels, may be no vessels loaded depending on race conditions
        {
            VesselModuleStaticData.ClearData();
            ConfigNode vmNode = new ConfigNode("VMSNode");

            if (node.HasNode("VMSNode"))
            {
                vmNode = node.GetNode("VMSNode");
            }
            VesselModuleStaticData.LoadRoutine(vmNode); //load data into static data module, okay to pass empty node
            VesselModuleStaticData.RefreshVesselData(); //refresh data in any VesselModuleSave that have already loaded somehow
        }
Example #5
0
 private void VesselRecoverTrigger(ProtoVessel vsl, bool b)
 {
     Debug.Log("GameEvent.VesselRecovertrigger");
     VesselModuleStaticData.KillVessel(vsl.vesselID.ToString());
 }
Example #6
0
 private void VesselDestroyTrigger(Vessel vsl)
 {
     Debug.Log("GameEvent.VesselDestroyTrigger");
     VesselModuleStaticData.KillVessel(vsl.id.ToString());
 }
Example #7
0
 protected void OnDestroy() //this module is being destoroyed
 {
     VSMDestroy();
     VesselModuleStaticData.RemoveVesselModuleFromList(this);
 }
Example #8
0
 private void VesselRecoverTrigger(ProtoVessel vsl, bool b)
 {
     VesselModuleStaticData.KillVessel(vsl.vesselID.ToString());
 }
Example #9
0
 private void VesselDestroyTrigger(Vessel vsl)
 {
     VesselModuleStaticData.KillVessel(vsl.id.ToString());
 }