Exemple #1
0
 private static bool TryCreateModParticleParams(Fabricator fabricator)
 {
     if (modParticlesParams != null)
     {
         return(true);
     }
     try
     {
         var sparksL = ((GameObject)sparksLFieldInfo.GetValue(fabricator)).GetComponent <ParticleSystem>();
         originParticlesParams = new ParticleSystemParameters()
         {
             startColor = sparksL.main.startColor
         };
         modParticlesParams = new ParticleSystemParameters()
         {
             startColor = Config.BeamAlphaColor
         };
         return(true);
     }
     catch (Exception e)
     {
         Logger.Log(Logger.Level.Error, null, e);
         return(false);
     }
 }
        /// <summary>
        /// Gets the UI Controls for this fabricator.
        /// </summary>
        /// <returns>Array of controls that make up the steps to feed the fabricator data.</returns>
        public override Control[] GetControls()
        {
            if (null == this.controls)
            {
                this.step1            = new ClickThrough.BrowsePathStep();
                this.step1.Fabricator = this.fabricator;
                this.step1.Changed   += this.StepProperty_Changed;

                this.step2            = new ClickThrough.PickEntryStep();
                this.step2.Fabricator = this.fabricator;
                this.step2.Changed   += this.StepProperty_Changed;

                this.step3            = new ClickThrough.PackageInfoStep();
                this.step3.Fabricator = this.fabricator;
                this.step3.Changed   += this.StepProperty_Changed;

                this.step4            = new ClickThrough.FeedStep();
                this.step4.Fabricator = this.fabricator;
                this.step4.Changed   += this.StepProperty_Changed;

                this.step5            = new ClickThrough.UpdateInfoStep();
                this.step5.Fabricator = this.fabricator;
                this.step5.Changed   += this.StepProperty_Changed;

                this.step6            = new ClickThrough.BuildStep();
                this.step6.Fabricator = this.fabricator;

                this.controls = new Control[] { this.step1, this.step2, this.step3, this.step4, this.step5, this.step6 };
            }

            return(this.controls);
        }
        /// <summary>
        /// Gets the UI Controls for this fabricator.
        /// </summary>
        /// <returns>Array of controls that make up the steps to feed the fabricator data.</returns>
        public override Control[] GetControls()
        {
            if (null == this.controls)
            {
                this.step1 = new ClickThrough.BrowsePathStep();
                this.step1.Fabricator = this.fabricator;
                this.step1.Changed += this.StepProperty_Changed;

                this.step2 = new ClickThrough.PickEntryStep();
                this.step2.Fabricator = this.fabricator;
                this.step2.Changed += this.StepProperty_Changed;

                this.step3 = new ClickThrough.PackageInfoStep();
                this.step3.Fabricator = this.fabricator;
                this.step3.Changed += this.StepProperty_Changed;

                this.step4 = new ClickThrough.FeedStep();
                this.step4.Fabricator = this.fabricator;
                this.step4.Changed += this.StepProperty_Changed;

                this.step5 = new ClickThrough.UpdateInfoStep();
                this.step5.Fabricator = this.fabricator;
                this.step5.Changed += this.StepProperty_Changed;

                this.step6 = new ClickThrough.BuildStep();
                this.step6.Fabricator = this.fabricator;

                this.controls = new Control[] { this.step1, this.step2, this.step3, this.step4, this.step5, this.step6 };
            }

            return this.controls;
        }
Exemple #4
0
        private GameObject CreateNewEscapePod(EscapePodModel model)
        {
            SURPRESS_ESCAPE_POD_AWAKE_METHOD = true;

            GameObject escapePod;

            if (model.Guid == myEscapePodGuid)
            {
                escapePod = EscapePod.main.gameObject;
            }
            else
            {
                escapePod = UnityEngine.Object.Instantiate(EscapePod.main.gameObject);
            }

            escapePod.transform.position = model.Location;

            StorageContainer storageContainer = escapePod.RequireComponentInChildren <StorageContainer>();

            GuidHelper.SetNewGuid(storageContainer.gameObject, model.StorageContainerGuid);

            MedicalCabinet medicalCabinet = escapePod.RequireComponentInChildren <MedicalCabinet>();

            GuidHelper.SetNewGuid(medicalCabinet.gameObject, model.MedicalFabricatorGuid);

            Fabricator fabricator = escapePod.RequireComponentInChildren <Fabricator>();

            GuidHelper.SetNewGuid(fabricator.gameObject, model.FabricatorGuid);

            Radio radio = escapePod.RequireComponentInChildren <Radio>();

            GuidHelper.SetNewGuid(radio.gameObject, model.RadioGuid);

            return(escapePod);
        }
Exemple #5
0
        public override void Process(FabricatorBeginCrafting packet)
        {
            Optional <GameObject> opGameObject = GuidHelper.GetObjectFrom(packet.FabricatorGuid);

            if (opGameObject.IsEmpty())
            {
                Console.WriteLine("Could not find fabricator from guid " + packet.FabricatorGuid);
                return;
            }

            GameObject gameObject = opGameObject.Get();
            Fabricator fabricator = gameObject.GetComponentInChildren <Fabricator>(true);

            if (fabricator == null)
            {
                Console.WriteLine("Game object did not have a Fabricator component!");
                return;
            }

            Optional <TechType> opTechType = ApiHelper.TechType(packet.TechType);

            if (opTechType.IsEmpty())
            {
                Console.WriteLine("Trying to build unknown tech type: " + packet.TechType + " - ignoring.");
                return;
            }

            TechType techType      = opTechType.Get();
            float    buildDuration = packet.Duration + 0.2f; // small increase to prevent this player from swiping item from remote player

            FieldInfo    logic        = typeof(Crafter).GetField("_logic", BindingFlags.Instance | BindingFlags.NonPublic);
            CrafterLogic crafterLogic = (CrafterLogic)logic.GetValue(fabricator);

            crafterLogic.Craft(techType, buildDuration);
        }
Exemple #6
0
 new void Awake()
 {
     gm         = GeneralManager.GetInstance();
     bb         = BreadBoard.GetInstance();
     cp         = CircuitPool.GetInstance();
     fabricator = Fabricator.GetInstance();
 }
Exemple #7
0
        public static bool Prefix(Fabricator __instance)
        {
            var fbColor   = __instance.GetAllComponentsInChildren <SkinnedMeshRenderer>();
            var mats      = __instance.ghost.GetAllComponentsInChildren <SkinnedMeshRenderer>();
            var moonColor = __instance.GetAllComponentsInChildren <SkinnedMeshRenderer>();

            foreach (var fabricatorColor in fbColor)
            {
                if (fabricatorColor.name.Contains("fabricator_01"))
                {
                    fabricatorColor.material.color = new Color32(Convert.ToByte(Config.fabricatorValue), Convert.ToByte(Config.fabricatorgValue), Convert.ToByte(Config.fabricatorbValue), 1);
                }
                foreach (var mat in mats)
                {
                    mat.material.color = new Color32(Convert.ToByte(Config.fabricatorValue), Convert.ToByte(Config.fabricatorgValue), Convert.ToByte(Config.fabricatorbValue), 1);
                }
                foreach (var moonfabricatorColor in moonColor)
                {
                    if (moonfabricatorColor.name.Contains("submarine_fabricator_02"))
                    {
                        moonfabricatorColor.material.color = new Color32(Convert.ToByte(Config.fabricatorValue), Convert.ToByte(Config.fabricatorgValue), Convert.ToByte(Config.fabricatorbValue), 1);
                    }
                }
            }



            return(true);
        }
Exemple #8
0
        /// <summary>
        /// Opens a click through file.
        /// </summary>
        /// <param name="sender">Control that sent the open request.</param>
        internal void Open(object sender)
        {
            DialogResult result = this.openFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string filePath = this.openFileDialog.FileName;
                string extensionNamespace;
                try
                {
                    using (XmlTextReader xml = new XmlTextReader(filePath))
                    {
                        xml.MoveToContent();
                        extensionNamespace = xml.NamespaceURI;

                        foreach (ClickThroughUIExtension extension in this.Extensions)
                        {
                            Fabricator f = extension.Fabricator;
                            if (f.Namespace == extensionNamespace)
                            {
                                this.ShowWorkPage(this, extension);
                                f.Open(filePath);
                                break;
                            }
                        }
                    }
                }
                finally
                {
                }
            }
        }
Exemple #9
0
 new void Awake()
 {
     breadBoard     = BreadBoard.GetInstance();
     raycastManager = RaycastManager.GetInstance();
     fabricator     = Fabricator.GetInstance();
     circuitPool    = CircuitPool.GetInstance();
 }
Exemple #10
0
 private static void SetFabricatorLightColor(Fabricator fabricator, Color color)
 {
     try
     {
         fabricator.fabLight.color = color;
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
Exemple #11
0
 private static void SetFabricatorLightColor(Fabricator fabricator, Color color)
 {
     try
     {
         fabricator.fabLight.color = color;
     }
     catch (Exception e) { Logger.Log(Logger.Level.Error, null, e); }
 }
Exemple #12
0
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        go.AddOrGet <DropAllWorkable>();
        Prioritizable.AddRef(go);
        go.AddOrGet <BuildingComplete>().isManuallyOperated = false;
        Fabricator fabricator = go.AddOrGet <Fabricator>();

        BuildingTemplates.CreateFabricatorStorage(go, fabricator);
    }
        public void TestFrame()
        {
            Agent agent  = new Hacker();
            Agent framer = new Fabricator();

            agent.Frame(framer);
            Assert.IsTrue(agent.WasFramed);
            Assert.IsTrue(agent.Visitors.Contains(framer.Codename));
        }
Exemple #14
0
 private static void SetFabricatorBeamsMaterial(Fabricator fabricator, Material material)
 {
     try
     {
         fabricator.leftBeam.GetComponent <Renderer>().material  = material;
         fabricator.rightBeam.GetComponent <Renderer>().material = material;
     }
     catch (Exception e) { Logger.Log(Logger.Level.Error, null, e); }
 }
Exemple #15
0
        public static bool Prefix(Fabricator __instance)
        {
            var ghostModel = __instance.ghost.GetAllComponentsInChildren <CrafterGhostModel>();

            foreach (var model in ghostModel)
            {
                ErrorMessage.AddWarning($"ghostModel is {model.ghostMaterials}");
            }
            return(true);
        }
Exemple #16
0
        public GameObject CreateNewEscapePod(EscapePodModel model)
        {
            SURPRESS_ESCAPE_POD_AWAKE_METHOD = true;

            GameObject escapePod;

            if (model.Id == MyEscapePodId)
            {
                escapePod = EscapePod.main.gameObject;
            }
            else
            {
                escapePod = Object.Instantiate(EscapePod.main.gameObject);
                NitroxEntity.SetNewId(escapePod, model.Id);
            }

            escapePod.transform.position = model.Location.ToUnity();

            StorageContainer storageContainer = escapePod.RequireComponentInChildren <StorageContainer>();

            using (packetSender.Suppress <ItemContainerRemove>())
            {
                storageContainer.container.Clear();
            }

            NitroxEntity.SetNewId(storageContainer.gameObject, model.StorageContainerId);

            MedicalCabinet medicalCabinet = escapePod.RequireComponentInChildren <MedicalCabinet>();

            NitroxEntity.SetNewId(medicalCabinet.gameObject, model.MedicalFabricatorId);

            Fabricator fabricator = escapePod.RequireComponentInChildren <Fabricator>();

            NitroxEntity.SetNewId(fabricator.gameObject, model.FabricatorId);

            Radio radio = escapePod.RequireComponentInChildren <Radio>();

            NitroxEntity.SetNewId(radio.gameObject, model.RadioId);

            DamageEscapePod(model.Damaged, model.RadioDamaged);
            FixStartMethods(escapePod);

            // Start() isn't executed for the EscapePod, why? Idk, maybe because it's a scene...
            MultiplayerCinematicReference reference = escapePod.AddComponent <MultiplayerCinematicReference>();

            foreach (PlayerCinematicController controller in escapePod.GetComponentsInChildren <PlayerCinematicController>())
            {
                reference.AddController(controller);
            }

            SURPRESS_ESCAPE_POD_AWAKE_METHOD = false;

            return(escapePod);
        }
Exemple #17
0
 private static void SetFabricatorParticlesParams(Fabricator fabricator, ParticleSystemParameters @params)
 {
     try
     {
         var sparksL = ((GameObject)sparksLFieldInfo.GetValue(fabricator)).GetComponent <ParticleSystem>();
         var sparksR = ((GameObject)sparksRFieldInfo.GetValue(fabricator)).GetComponent <ParticleSystem>();
         @params.Apply(sparksL);
         @params.Apply(sparksR);
     }
     catch (Exception e) { Logger.Log(Logger.Level.Error, null, e); }
 }
    private void Refresh()
    {
        List <ToggleInfo> list = new List <ToggleInfo>();

        foreach (Fabricator item in Components.Fabricators.Items)
        {
            Fabricator  fabricator = item;
            KSelectable component  = fabricator.GetComponent <KSelectable>();
            list.Add(new ToggleInfo(component.GetName(), fabricator, Action.NumActions));
        }
        Setup(list);
    }
        public override void Process(FabricatorBeginCrafting packet)
        {
            GameObject gameObject = GuidHelper.RequireObjectFrom(packet.FabricatorGuid);
            Fabricator fabricator = gameObject.RequireComponentInChildren <Fabricator>(true);

            float buildDuration = packet.Duration + 0.2f; // small increase to prevent this player from swiping item from remote player

            FieldInfo    logic        = typeof(Crafter).GetField("_logic", BindingFlags.Instance | BindingFlags.NonPublic);
            CrafterLogic crafterLogic = (CrafterLogic)logic.GetValue(fabricator);

            crafterLogic.Craft(packet.TechType, buildDuration);
        }
        public void TestReset()
        {
            Agent agent     = new Hacker();
            Agent protector = new Medic();
            Agent blocker   = new Saboteur();
            Agent framer    = new Fabricator();
            Agent killer    = new Android();

            string name     = agent.Name;
            string codename = agent.Codename;
            Gender gender   = agent.Gender;

            agent.Reset();
            Assert.AreEqual(name, agent.Name);
            Assert.AreEqual(codename, agent.Codename);
            Assert.AreEqual(gender, agent.Gender);

            agent.Visit(protector);
            agent.Reset();
            Assert.IsNotNull(agent.Visitors);
            Assert.AreEqual(0, agent.Visitors.Count);

            agent.Target   = protector;
            agent.IsActing = true;
            agent.Reset();
            Assert.IsNull(agent.Target);
            Assert.IsFalse(agent.IsActing);

            agent.Protect(protector);
            agent.Reset();
            Assert.IsFalse(agent.IsProtected);
            Assert.IsNull(agent.Protector);

            agent.Block(blocker);
            agent.Reset();
            Assert.IsFalse(agent.IsBlocked);
            Assert.IsNull(agent.Blocker);

            agent.Frame(framer);
            agent.Reset();
            Assert.IsFalse(agent.WasFramed);

            agent.Attack(killer);
            agent.Reset();
            Assert.IsFalse(agent.WasAttacked);
            Assert.IsFalse(agent.WasKilled);
            Assert.IsFalse(agent.IsActive);
            Assert.IsNotNull(agent.Killer);
        }
Exemple #21
0
 public static void Revert(Fabricator fabricator)
 {
     if (BeamMaterial.original)
     {
         SetFabricatorBeamsMaterial(fabricator, BeamMaterial.original);
     }
     if (originParticlesParams != null)
     {
         SetFabricatorParticlesParams(fabricator, originParticlesParams);
     }
     if (originLightColor != null)
     {
         SetFabricatorLightColor(fabricator, originLightColor.Value);
     }
 }
Exemple #22
0
 public static void Modify(Fabricator fabricator)
 {
     if (BeamMaterial.custom)
     {
         SetFabricatorBeamsMaterial(fabricator, BeamMaterial.custom);
     }
     if (TryCreateModParticleParams(fabricator))
     {
         SetFabricatorParticlesParams(fabricator, modParticlesParams);
     }
     if (TryCreateModLightColor(fabricator))
     {
         SetFabricatorLightColor(fabricator, modLightColor.Value);
     }
 }
Exemple #23
0
        public static void FabricatorStart(Fabricator fabricator, TechType tech, float duration)
        {
            if (Multiplayer.main.blocked)
            {
                return;
            }

            var res = new ClientFabricatorStart();

            res.fabricatorGuid = GuidHelper.Get(fabricator.gameObject);
            res.tech           = tech;
            res.duration       = duration;

            Multiplayer.main.Send(res);
        }
Exemple #24
0
    public void SystemFailure()
    {
        int failure = random.Next(100);

        if (failure > failureRate - GetNode <Fabricator>("../Fabricator").failureReduction)
        {
            switch (random.Next(3))
            {
            case 0:
                Fabricator fabricator = GetNode <Fabricator>("../Fabricator");
                fabricator.Broken();
                fabricator.ChangeEfficiency(-0.2f);
                GD.Print("Fabricator Broken");
                break;

            case 1:
                Replicator replicator = GetNode <Replicator>("../Replicator");
                replicator.Broken();
                replicator.ChangeEfficiency(-0.2f);
                GD.Print("Replicator Broken");
                break;

            case 2:
                Scoop scoop = GetNode <Scoop>("../Scoop");
                scoop.Broken();
                scoop.ChangeEfficiency(-0.2f);
                GD.Print("Scoop Broken");
                break;

            case 3:
                Generator generator = GetNode <Generator>("../Generator");
                generator.Broken();
                generator.ChangeEfficiency(-0.2f);
                GD.Print("Generator Broken");
                GetTree().CallGroup("MainSystems", "Disabled");
                break;

            default:
                break;
            }
        }
        else
        {
            GD.Print("No System Failure This Tick");
        }
    }
Exemple #25
0
        public GameObject CreateNewEscapePod(EscapePodModel model)
        {
            SURPRESS_ESCAPE_POD_AWAKE_METHOD = true;

            GameObject escapePod;

            if (model.Id == MyEscapePodId)
            {
                escapePod = EscapePod.main.gameObject;
            }
            else
            {
                escapePod = Object.Instantiate(EscapePod.main.gameObject);
                NitroxEntity.SetNewId(escapePod, model.Id);
            }

            escapePod.transform.position = model.Location.ToUnity();

            StorageContainer storageContainer = escapePod.RequireComponentInChildren <StorageContainer>();

            using (packetSender.Suppress <ItemContainerRemove>())
            {
                storageContainer.container.Clear();
            }

            NitroxEntity.SetNewId(storageContainer.gameObject, model.StorageContainerId);

            MedicalCabinet medicalCabinet = escapePod.RequireComponentInChildren <MedicalCabinet>();

            NitroxEntity.SetNewId(medicalCabinet.gameObject, model.MedicalFabricatorId);

            Fabricator fabricator = escapePod.RequireComponentInChildren <Fabricator>();

            NitroxEntity.SetNewId(fabricator.gameObject, model.FabricatorId);

            Radio radio = escapePod.RequireComponentInChildren <Radio>();

            NitroxEntity.SetNewId(radio.gameObject, model.RadioId);

            DamageEscapePod(model.Damaged, model.RadioDamaged);
            FixStartMethods(escapePod);

            SURPRESS_ESCAPE_POD_AWAKE_METHOD = false;

            return(escapePod);
        }
        /// <summary>
        /// Populates the welcome page with the list of extensions.
        /// </summary>
        /// <param name="extensions">Array of fabricators to display in welcome page.</param>
        internal void AddExtensions(ClickThroughUIExtension[] extensions)
        {
            this.SuspendLayout();
            this.extensionComboBox.SuspendLayout();

            this.extensionComboBox.Items.Clear();
            for (int i = 0; i < extensions.Length; ++i)
            {
                Fabricator f = extensions[i].Fabricator;
                this.extensionComboBox.Items.Add(f.Title);
            }

            this.extensionComboBox.Tag = extensions;

            this.extensionComboBox.ResumeLayout(false);
            this.ResumeLayout(true);
        }
Exemple #27
0
 private static bool TryCreateModLightColor(Fabricator fabricator)
 {
     if (originLightColor != null)
     {
         return(true);
     }
     try
     {
         originLightColor = fabricator.fabLight.color;
         modLightColor    = Config.BeamColor;
         return(true);
     }
     catch (Exception e)
     {
         Logger.Log(Logger.Level.Error, null, e);
         return(false);
     }
 }
Exemple #28
0
        static bool Prefix(Fabricator __instance, Worker worker, List <Fabricator.UserOrder> ___userOrders, List <Fabricator.MachineOrder> ___machineOrders)
        {
            if (!Main.enabled)
            {
                return(true);
            }

            if (___userOrders.Count > 1)
            {
                var machineOrder = ___machineOrders[0];
                if (!machineOrder.parentOrder.infinite)
                {
                    ___userOrders.Remove(machineOrder.parentOrder);
                    ___userOrders.Insert(0, machineOrder.parentOrder);
                }
            }

            return(true);
        }
Exemple #29
0
        public GameObject CreateNewEscapePod(EscapePodModel model)
        {
            SURPRESS_ESCAPE_POD_AWAKE_METHOD = true;

            GameObject escapePod;

            if (model.Guid == MyEscapePodGuid)
            {
                escapePod = EscapePod.main.gameObject;
            }
            else
            {
                escapePod = Object.Instantiate(EscapePod.main.gameObject);
            }

            escapePod.transform.position = model.Location;


            StorageContainer storageContainer = escapePod.RequireComponentInChildren <StorageContainer>();

            using (packetSender.Suppress <ItemContainerRemove>())
            {
                storageContainer.container.Clear();
            }

            GuidHelper.SetNewGuid(storageContainer.gameObject, model.StorageContainerGuid);

            MedicalCabinet medicalCabinet = escapePod.RequireComponentInChildren <MedicalCabinet>();

            GuidHelper.SetNewGuid(medicalCabinet.gameObject, model.MedicalFabricatorGuid);

            Fabricator fabricator = escapePod.RequireComponentInChildren <Fabricator>();

            GuidHelper.SetNewGuid(fabricator.gameObject, model.FabricatorGuid);

            Radio radio = escapePod.RequireComponentInChildren <Radio>();

            GuidHelper.SetNewGuid(radio.gameObject, model.RadioGuid);

            return(escapePod);
        }
Exemple #30
0
        private static void Postfix(Fabricator __instance, Worker worker)
        {
            Debug.Log(" === AlternateOrdersMod2a Postfix === ");
            try
            {
                FieldInfo userOrders_ = AccessTools.Field(typeof(Fabricator), "userOrders");
                //FieldInfo operational_ = AccessTools.Field(typeof(Fabricator), "operational");
                FieldInfo isCancellingOrder_ = AccessTools.Field(typeof(Fabricator), "isCancellingOrder");
                FieldInfo machineOrders_     = AccessTools.Field(typeof(Fabricator), "machineOrders");
                //MethodInfo AlreadyMachineQueued = AccessTools.Method(typeof(Fabricator), "AlreadyMachineQueued", new Type[] { typeof(Fabricator.UserOrder) });
                //MethodInfo CompleteOrder = AccessTools.Method(typeof(Fabricator), "CompleteOrder", new Type[] { typeof(Fabricator.UserOrder) });
                //MethodInfo UpdateOrderQueue = AccessTools.Method(typeof(Fabricator), "UpdateOrderQueue", new Type[] { typeof(bool) });
                //MethodInfo OnCompleteWork = AccessTools.Method(typeof(Workable), "OnCompleteWork", new Type[] { typeof(Worker) });

                List <Fabricator.UserOrder> userOrders = (List <Fabricator.UserOrder>)userOrders_.GetValue(__instance);
                //Operational operational = (Operational)operational_.GetValue(__instance);
                bool isCancellingOrder = (bool)isCancellingOrder_.GetValue(__instance);
                List <Fabricator.MachineOrder> machineOrders = (List <Fabricator.MachineOrder>)machineOrders_.GetValue(__instance);


                if (!isCancellingOrder)
                {
                    if (machineOrders.Count > 0)
                    {
                        Fabricator.MachineOrder machineOrder = machineOrders[0];
                        if (machineOrder.parentOrder.infinite)
                        {
                            Fabricator.UserOrder last = userOrders[0];
                            userOrders.RemoveAt(0);
                            userOrders.Add(last);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Log(ex);
                Debug.Log(ex.StackTrace);
            }
        }
Exemple #31
0
        private GameObject CreateNewEscapePod(EscapePodModel model)
        {
            SURPRESS_ESCAPE_POD_AWAKE_METHOD = true;

            GameObject escapePod;

            if (model.Guid == myEscapePodGuid)
            {
                escapePod = EscapePod.main.gameObject;
            }
            else
            {
                escapePod = UnityEngine.Object.Instantiate(EscapePod.main.gameObject);
            }

            escapePod.transform.position = ApiHelper.Vector3(model.Location);

            StorageContainer storageContainer = escapePod.GetComponentInChildren <StorageContainer>();

            Validate.NotNull(storageContainer, "StorageContainer can not be null");
            GuidHelper.SetNewGuid(storageContainer.gameObject, model.StorageContainerGuid);

            MedicalCabinet medicalCabinet = escapePod.GetComponentInChildren <MedicalCabinet>();

            Validate.NotNull(medicalCabinet, "medicalCabinet can not be null");
            GuidHelper.SetNewGuid(medicalCabinet.gameObject, model.MedicalFabricatorGuid);

            Fabricator fabricator = escapePod.GetComponentInChildren <Fabricator>();

            Validate.NotNull(fabricator, "fabricator can not be null");
            GuidHelper.SetNewGuid(fabricator.gameObject, model.FabricatorGuid);

            Radio radio = escapePod.GetComponentInChildren <Radio>();

            Validate.NotNull(radio, "radio can not be null");
            GuidHelper.SetNewGuid(radio.gameObject, model.RadioGuid);

            return(escapePod);
        }