Пример #1
0
        private void Register()
        {
            if (_prefab != null)
            {
                var meshRenderers = _prefab.GetComponentsInChildren <MeshRenderer>();

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = _prefab.GetComponentsInChildren <Renderer>(true);
                SkyApplier skyApplier = _prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = _prefab.EnsureComponent <Constructable>();
                constructable.allowedOnWall    = true;
                constructable.allowedOnGround  = false;
                constructable.allowedInSub     = true;
                constructable.allowedInBase    = true;
                constructable.allowedOnCeiling = false;
                constructable.allowedOutside   = false;
                constructable.model            = _prefab.FindChild("model");
                constructable.techType         = TechType;

                GameObjectHelpers.AddConstructableBounds(_prefab, new Vector3(0.4528692f, 0.6682342f, 0.03642998f),
                                                         new Vector3(0, -0.02660185f, 0.05301314f));
            }
        }
Пример #2
0
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_prefab);

                prefab.name = this.PrefabFileName;

                //var ping = prefab.EnsureComponent<PingInstance>();
                //ping.origin = prefab.transform;
                //ping.pingType = PingType.Signal;


                var center = new Vector3(0f, 1.433978f, 0f);
                var size   = new Vector3(2.274896f, 2.727271f, 2.069269f);
                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
Пример #3
0
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_gameObjectKit);

                if (SetKitLabel(prefab))
                {
                    prefab.name = this.PrefabFileName;

                    PrefabIdentifier prefabID = prefab.EnsureComponent <PrefabIdentifier>();

                    prefabID.ClassId = this.ClassID;

                    var techTag = prefab.EnsureComponent <TechTag>();
                    techTag.type = TechType;

                    var center = new Vector3(0f, 0.2518765f, 0f);
                    var size   = new Vector3(0.5021304f, 0.5062426f, 0.5044461f);

                    GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                    //Add the FCSTechFabricatorTag component
                    prefab.AddComponent <FCSTechFabricatorTag>();

                    return(prefab);
                }
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(null);
        }
Пример #4
0
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_prefab);
                prefab.name = this.PrefabFileName;

                var center = new Vector3(0f, 0.2518765f, 0f);
                var size   = new Vector3(0.5021304f, 0.5062426f, 0.5044461f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                //Add the FCSTechFabricatorTag component
                prefab.AddComponent <FCSTechFabricatorTag>();

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Global;

                prefab.AddComponent <GaspodManager>();
                prefab.AddComponent <GaspodCollectorController>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(null);
        }
        public override GameObject GetGameObject()
        {
            GameObject prefab = null;

            try
            {
                prefab = GameObject.Instantiate(_prefab);

                var container2 = GameObject.Instantiate(CreateStorage());
                container2.name             = "StorageContainerUnit";
                container2.transform.parent = prefab.transform;

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.EnsureComponent <Constructable>();
                constructable.allowedOnWall           = false;
                constructable.allowedOnGround         = true;
                constructable.allowedInSub            = false;
                constructable.allowedInBase           = false;
                constructable.allowedOnCeiling        = false;
                constructable.allowedOutside          = true;
                constructable.model                   = prefab.FindChild("model");
                constructable.techType                = TechType;
                constructable.rotationEnabled         = true;
                constructable.allowedOnConstructables = Player.main.GetDepth() > 1;

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Global;

                //var beacon = prefab.AddComponent<Beacon>();

                //beacon.label = "DeepDriller";

                var center = new Vector3(0f, 1.579518f, 0f);
                var size   = new Vector3(2.669801f, 2.776958f, 2.464836f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                //prefab.AddComponent<MonoClassTest>();
                prefab.AddComponent <PrefabIdentifier>().ClassId = this.ClassID;
                prefab.AddComponent <FMOD_CustomLoopingEmitter>();
                prefab.AddComponent <ExStorageDepotController>();
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(prefab);
        }
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_prefab);

                GameObjectHelpers.AddConstructableBounds(prefab, _bSize, _bCenter);

                var model = prefab.FindChild("model");

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;
                //========== Allows the building animation and material colors ==========//

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Far;

                // Add constructible
                var constructable = prefab.AddComponent <Constructable>();

                constructable.allowedOutside          = true;
                constructable.allowedInBase           = true;
                constructable.allowedOnGround         = true;
                constructable.allowedOnWall           = false;
                constructable.rotationEnabled         = true;
                constructable.allowedOnCeiling        = false;
                constructable.allowedInSub            = true;
                constructable.allowedOnConstructables = false;
                constructable.model    = model;
                constructable.techType = TechType;

                var light = prefab.GetComponentInChildren <Light>();

                var lightR = prefab.AddComponent <RegistredLightSource>();
                lightR.hostLight = light;

                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = ClassID;

                AddBubbles(prefab);
                AddVaporBlast(prefab);

                prefab.AddComponent <TechTag>().type = TechType;
                prefab.AddComponent <HydroHarvController>();
                //Apply the glass shader here because of autosort lockers for some reason doesnt like it.
                MaterialHelpers.ApplyGlassShaderTemplate(prefab, "_glass", Mod.ModName);
                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
Пример #7
0
        public override GameObject GetGameObject()
        {
            GameObject prefab = null;

            try
            {
                prefab = GameObject.Instantiate(_prefab);

                var meshRenderers = prefab.GetComponentsInChildren <MeshRenderer>();

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.EnsureComponent <Constructable>();
                constructable.allowedOnWall    = false;
                constructable.allowedOnGround  = true;
                constructable.allowedInSub     = false;
                constructable.allowedInBase    = false;
                constructable.allowedOnCeiling = false;
                constructable.allowedOutside   = true;
                constructable.model            = prefab.FindChild("model");
                constructable.techType         = TechType;
                constructable.rotationEnabled  = true;

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Global;

                //var beacon = prefab.AddComponent<Beacon>();


                var center = new Vector3(0, 3.048428f, 0);
                var size   = new Vector3(4.821606f, 3.35228f, 4.941598f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                //beacon.label = "DeepDriller";
                //prefab.AddComponent<LiveMixin>();
                prefab.AddComponent <PrefabIdentifier>().ClassId = this.ClassID;
                prefab.AddComponent <FMOD_CustomLoopingEmitter>();
                prefab.AddComponent <FCSDeepDrillerController>();
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(prefab);
        }
Пример #8
0
        public override GameObject GetGameObject()
        {
            GameObject prefab = null;

            try
            {
                prefab = GameObject.Instantiate <GameObject>(_prefab);

                //========== Allows the building animation and material colors ==========//
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = prefab.GetComponentsInChildren <Renderer>();
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.EnsureComponent <Constructable>();
                constructable.allowedOnWall        = false;
                constructable.allowedOnGround      = true;
                constructable.allowedInSub         = false;
                constructable.allowedInBase        = false;
                constructable.allowedOnCeiling     = false;
                constructable.allowedOutside       = true;
                constructable.model                = prefab.FindChild("model");
                constructable.techType             = TechType;
                constructable.rotationEnabled      = true;
                constructable.forceUpright         = true;
                constructable.placeDefaultDistance = 10f;

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Global;

                //var beacon = prefab.AddComponent<Beacon>();


                var center = new Vector3(0, 3.106274f, 0);
                var size   = new Vector3(6.85554f, 6.670462f, 7.002856f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                //beacon.label = "DeepDriller";
                //prefab.AddComponent<LiveMixin>();
                prefab.AddComponent <PrefabIdentifier>().ClassId = this.ClassID;
                prefab.AddComponent <TechTag>().type             = TechTypeID;
                prefab.AddComponent <FMOD_CustomLoopingEmitter>();
                prefab.AddComponent <FCSDeepDrillerController>();
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(prefab);
        }
Пример #9
0
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_Prefab);

                //========== Allows the building animation and material colors ==========//

                Shader     shader  = Shader.Find("MarmosetUBER");
                Renderer[] renders = prefab.GetComponentsInChildren <Renderer>();
                foreach (Renderer renderer in renders)
                {
                    renderer.material.shader = shader;
                }

                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renders;
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.EnsureComponent <Constructable>();
                constructable.allowedOnWall    = false;
                constructable.allowedOnGround  = true;
                constructable.allowedInSub     = true;
                constructable.allowedInBase    = true;
                constructable.allowedOnCeiling = false;
                constructable.allowedOutside   = false;
                constructable.rotationEnabled  = true;
                constructable.model            = prefab.FindChild("model");
                constructable.techType         = TechType;

                //Get the Size and Center of a box ow collision around the mesh that will be used as bounds
                var center = new Vector3(0.05496028f, 1.019654f, 0.05290359f);
                var size   = new Vector3(0.9710827f, 1.908406f, 0.4202727f);

                //Create or get the constructable bounds
                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                var techTag = prefab.EnsureComponent <TechTag>();
                techTag.type = TechType;

                prefab.EnsureComponent <PrefabIdentifier>().ClassId = this.ClassID;
                prefab.EnsureComponent <AnimationManager>();
                prefab.EnsureComponent <ARSolutionsSeaBreezeController>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
        public override GameObject GetGameObject()
        {
            GameObject prefab = GameObject.Instantiate(_prefab);

            //========== Allows the building animation and material colors ==========//

            Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
            SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();

            skyApplier.renderers = renderers;
            skyApplier.anchorSky = Skies.Auto;

            //========== Allows the building animation and material colors ==========//


            QuickLogger.Debug("Adding Constructible");

            // Add constructible
            var constructable = prefab.EnsureComponent <Constructable>();

            constructable.allowedOnWall    = true;
            constructable.allowedOnGround  = false;
            constructable.allowedInSub     = true;
            constructable.allowedInBase    = true;
            constructable.allowedOnCeiling = false;
            constructable.allowedOutside   = false;
            constructable.model            = prefab.FindChild("model");
            constructable.techType         = TechType;

            // Add constructible bounds

            var center = new Vector3(0.2078698f, -0.04198265f, 0.2626062f);
            var size   = new Vector3(1.412603f, 1.45706f, 0.4747875f);

            GameObjectHelpers.AddConstructableBounds(prefab, size, center);

            QuickLogger.Debug("GetOrAdd TechTag");
            // Allows the object to be saved into the game
            //by setting the TechTag and the PrefabIdentifier
            prefab.EnsureComponent <TechTag>().type = this.TechType;

            QuickLogger.Debug("GetOrAdd PrefabIdentifier");

            prefab.EnsureComponent <PrefabIdentifier>().ClassId = this.ClassID;

            QuickLogger.Debug("Add GameObject CustomBatteryController");

            prefab.EnsureComponent <FCSPowerStorageDisplay>();

            prefab.EnsureComponent <FCSPowerStorageController>();

            QuickLogger.Debug("Made GameObject");

            return(prefab);
        }
Пример #11
0
        internal void Register()
        {
            HydroponicHarvestersModelPrefab.GetPrefabs();

            _prefab = HydroponicHarvestersModelPrefab.BottlePrefab;

            if (_prefab == null)
            {
                QuickLogger.Error("FloraKleen prefab is null");
                return;
            }

            GameObjectHelpers.AddConstructableBounds(_prefab, new Vector3(0.1969692f, 0.25098f, 0.1916926f), new Vector3(0, -0.01675579f, 0));

            QuickLogger.Debug("Added Constructable Bounds");

            //Make the rigid body isKinematic so it doesnt shake the cyclops
            var rb = _prefab.AddComponent <Rigidbody>();

            rb.isKinematic = true;
            QuickLogger.Debug("Added Rigid Body");



            // Make the object drop slowly in water
            var wf = _prefab.EnsureComponent <WorldForces>();

            wf.underwaterGravity = 0;
            wf.underwaterDrag    = 10f;
            wf.enabled           = true;
            QuickLogger.Debug("Ensuring World Forces");

            // Add fabricating animation
            var fabricatingA = _prefab.EnsureComponent <VFXFabricating>();

            fabricatingA.localMinY   = -0.1f;
            fabricatingA.localMaxY   = 0.6f;
            fabricatingA.posOffset   = new Vector3(0f, 0f, 0f);
            fabricatingA.eulerOffset = new Vector3(0f, 0f, 0f);
            fabricatingA.scaleFactor = 1.0f;
            QuickLogger.Debug("Ensuring VFXFabricating");

            //// Set proper shaders (for crafting animation)
            var renderer = _prefab.GetComponentInChildren <Renderer>();

            QuickLogger.Debug("Getting Renderer");

            // Update sky applier
            var applier = _prefab.EnsureComponent <SkyApplier>();

            applier.renderers = new Renderer[] { renderer };
            applier.anchorSky = Skies.Auto;
            QuickLogger.Debug("Ensuring SkyApplier");
        }
Пример #12
0
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(DSSModelPrefab.FloorMountRackPrefab);

                var size   = new Vector3(0.5399321f, 0.9509504f, 0.5594633f);
                var center = new Vector3(0f, 0.5926822f, 0f);
                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                var model = prefab.FindChild("model");

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;
                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.AddComponent <Constructable>();

                constructable.allowedOutside          = false;
                constructable.allowedInBase           = true;
                constructable.allowedOnGround         = true;
                constructable.allowedOnWall           = false;
                constructable.rotationEnabled         = true;
                constructable.allowedOnCeiling        = false;
                constructable.allowedInSub            = true;
                constructable.allowedOnConstructables = false;
                constructable.model    = model;
                constructable.techType = TechType;

                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = ClassID;

                prefab.AddComponent <TechTag>().type = TechType;
                prefab.AddComponent <DSSRackController>();

                //Apply the glass shader here because of autosort lockers for some reason doesnt like it.
                MaterialHelpers.ApplyGlassShaderTemplate(prefab, "_glass", Mod.ModName);
                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(DSSModelPrefab.ItemDisplayPrefab);

                var size   = new Vector3(0.6082662f, 0.8234746f, 0.2771493f);
                var center = new Vector3(0f, -0.003837466f, 0.1747157f);
                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                var model = prefab.FindChild("model");

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;
                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.AddComponent <Constructable>();

                constructable.allowedOutside          = false;
                constructable.allowedInBase           = true;
                constructable.allowedOnGround         = false;
                constructable.allowedOnWall           = true;
                constructable.rotationEnabled         = false;
                constructable.allowedOnCeiling        = false;
                constructable.allowedInSub            = true;
                constructable.allowedOnConstructables = false;
                constructable.model    = model;
                constructable.techType = TechType;

                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = ClassID;

                prefab.AddComponent <TechTag>().type = TechType;
                prefab.AddComponent <DSSItemDisplayController>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
        public override GameObject GetGameObject()
        {
            GameObject prefab = null;

            try
            {
                prefab = GameObject.Instantiate(_Prefab);

                var meshRenderers = prefab.GetComponentsInChildren <MeshRenderer>();

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.EnsureComponent <Constructable>();
                constructable.allowedOnWall    = false;
                constructable.allowedOnGround  = true;
                constructable.allowedInSub     = true;
                constructable.allowedInBase    = true;
                constructable.allowedOnCeiling = false;
                constructable.allowedOutside   = false;
                constructable.model            = prefab.FindChild("model");
                constructable.techType         = TechType;
                constructable.rotationEnabled  = true;

                var center = new Vector3(0.04392624f, 1.421124f, 0f);
                var size   = new Vector3(2.401972f, 2.700523f, 2.280661f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                prefab.EnsureComponent <PrefabIdentifier>().ClassId = this.ClassID;
                prefab.AddComponent <FMOD_CustomLoopingEmitter>();
                prefab.EnsureComponent <AMMiniMedBayController>();
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(prefab);
        }
        public override GameObject GetGameObject()
        {
            try
            {
                var        prefab       = GameObject.Instantiate(_Prefab);
                GameObject consoleModel = prefab.FindChild("model");

                // Update sky applier
                SkyApplier skyApplier = prefab.AddComponent <SkyApplier>();
                skyApplier.renderers = consoleModel.GetComponentsInChildren <MeshRenderer>();
                skyApplier.anchorSky = Skies.Auto;

                //Add the constructable component to the prefab
                Constructable constructable = prefab.AddComponent <Constructable>();

                constructable.allowedInBase           = true;  // Only allowed in Base
                constructable.allowedInSub            = false; // Not allowed in Cyclops
                constructable.allowedOutside          = false;
                constructable.allowedOnCeiling        = false;
                constructable.allowedOnGround         = false; // Only on ground
                constructable.allowedOnWall           = true;
                constructable.allowedOnConstructables = false;
                constructable.controlModelState       = true;
                constructable.rotationEnabled         = false;
                constructable.techType = this.TechType;
                constructable.model    = consoleModel;

                var center = new Vector3(-0.006649137f, 0f, 0.1839597f);
                var size   = new Vector3(2.706617f, 1.698831f, 0.3483825f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                //Add the prefabIdentifier
                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = this.ClassID;
                prefab.EnsureComponent <AIPowerCellSocketAnimator>();
                prefab.EnsureComponent <AIPowerCellSocketPowerManager>();
                prefab.EnsureComponent <AIPowerCellSocketController>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error <AIPowerCellSocketBuildable>(e.Message);
                return(null);
            }
        }
Пример #16
0
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_prefab);

                prefab.name = this.PrefabFileName;


                var center = new Vector3(0.003585503f, 0.08162725f, 0.2536881f);
                var size   = new Vector3(0.9551572f, 1.22244f, 0.4737879f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);
                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
        public override GameObject GetGameObject()
        {
            GameObject prefab = null;

            try
            {
                prefab = GameObject.Instantiate(_prefab);

                var size   = new Vector3(1.217227f, 1.23226f, 0.5353913f);
                var center = new Vector3(0f, 0.1884735f, 0.2995481f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                prefab.name = this.PrefabFileName;
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(prefab);
        }
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_prefab);
                prefab.name = this.PrefabFileName;

                var center = new Vector3(0f, 0.2518765f, 0f);
                var size   = new Vector3(0.5021304f, 0.5062426f, 0.5044461f);

                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                //Add the FCSTechFabricatorTag component
                prefab.AddComponent <FCSTechFabricatorTag>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(null);
        }
        public override GameObject GetGameObject()
        {
            SubRoot currentSub = Player.main.currentSub;

            if (currentSub != null)
            {
                QuickLogger.Debug($"Current Sub = {currentSub.GetInstanceID()}", true);

                var manager = ShippingTargetManager.FindManager(currentSub);

                QuickLogger.Debug($"Manager {manager}", true);

                if (manager != null && manager.ShippingTargets.Count >= ShippingTargetManager.MaxShippingContainers)
                {
                    ErrorMessage.AddMessage(Language.main.Get(OverLimitKey));
                    return(null);
                }
            }
            else
            {
                QuickLogger.Debug($"Current Sub is null");
            }
            var        prefab       = GameObject.Instantiate(_Prefab);
            GameObject consoleModel = prefab.FindChild("model");

            // Update sky applier
            SkyApplier skyApplier = prefab.AddComponent <SkyApplier>();

            skyApplier.renderers = consoleModel.GetComponentsInChildren <MeshRenderer>();
            skyApplier.anchorSky = Skies.Auto;

            //Add the constructable component to the prefab
            Constructable constructable = prefab.AddComponent <Constructable>();

            constructable.allowedInBase           = true; // Only allowed in Base
            constructable.allowedInSub            = true; // Not allowed in Cyclops
            constructable.allowedOutside          = false;
            constructable.allowedOnCeiling        = false;
            constructable.allowedOnGround         = true; // Only on ground
            constructable.allowedOnWall           = false;
            constructable.allowedOnConstructables = false;
            constructable.controlModelState       = true;
            constructable.rotationEnabled         = true;
            constructable.techType = this.TechType;
            constructable.model    = consoleModel;

            var center = new Vector3(0f, 1.022878f, 0.3840232f);       // Y reduced to allow tube fitting
            var size   = new Vector3(1.63731f, 1.920672f, 0.8025026f); // Y reduced to allow tube fitting

            GameObjectHelpers.AddConstructableBounds(prefab, size, center);

            prefab.EnsureComponent <AlterraShippingTransferHandler>();

            prefab.EnsureComponent <AlterraShippingDisplay>();

            prefab.EnsureComponent <AlterraShippingAnimator>();

            prefab.EnsureComponent <AlterraShippingTarget>();

            //Add the prefabIdentifier
            PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();

            prefabID.ClassId = this.ClassID;

            return(prefab);
        }
        public override GameObject GetGameObject()
        {
            try
            {
                if (DSSModelPrefab.GetPrefabs())
                {
                    var prefab = GameObject.Instantiate(DSSModelPrefab.ServerPrefab);

                    prefab.name = this.PrefabFileName;

                    PrefabIdentifier prefabID = prefab.EnsureComponent <PrefabIdentifier>();
                    prefabID.ClassId = this.ClassID;

                    var techTag = prefab.EnsureComponent <TechTag>();
                    techTag.type = TechType;

                    var center = new Vector3(0f, 0.06423706f, 0.01254272f);
                    var size   = new Vector3(0.3725086f, 0.06717008f, 0.4063118f);

                    GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                    //Make the rigid body isKinematic so it doesnt shake the cyclops
                    var rb = prefab.AddComponent <Rigidbody>();
                    rb.isKinematic = true;

                    // Set collider
                    var collider = prefab.GetComponentInChildren <Collider>();
                    collider.enabled   = true;
                    collider.isTrigger = true;

                    QuickLogger.Debug("Collider");

                    // Make the object drop slowly in water
                    var wf = prefab.EnsureComponent <WorldForces>();
                    wf.underwaterGravity = 0;
                    wf.underwaterDrag    = 10f;
                    wf.enabled           = true;

                    // Add fabricating animation
                    var fabricatingA = prefab.EnsureComponent <VFXFabricating>();
                    fabricatingA.localMinY   = -0.1f;
                    fabricatingA.localMaxY   = 0.6f;
                    fabricatingA.posOffset   = new Vector3(0f, 0f, 0f);
                    fabricatingA.eulerOffset = new Vector3(0f, 0f, 0f);
                    fabricatingA.scaleFactor = 1.0f;

                    //// Set proper shaders (for crafting animation)
                    var renderer = prefab.GetComponentInChildren <Renderer>();


                    // Update sky applier
                    var applier = prefab.EnsureComponent <SkyApplier>();
                    applier.renderers = new Renderer[] { renderer };
                    applier.anchorSky = Skies.Auto;

                    // We can pick this item
                    var pickupable = prefab.EnsureComponent <Pickupable>();
                    pickupable.isPickupable = true;
                    pickupable.randomizeRotationWhenDropped = true;

                    //Allow this kit to be placed on surfaces in these situations
                    var placeTool = prefab.EnsureComponent <PlaceTool>();
                    placeTool.allowedInBase          = true;
                    placeTool.allowedOnBase          = false;
                    placeTool.allowedOnCeiling       = false;
                    placeTool.allowedOnConstructable = true;
                    placeTool.allowedOnGround        = true;
                    placeTool.allowedOnRigidBody     = true;
                    placeTool.allowedOnWalls         = false;
                    placeTool.allowedOutside         = false;
                    placeTool.rotationEnabled        = true;
                    placeTool.enabled              = true;
                    placeTool.hasAnimations        = false;
                    placeTool.hasBashAnimation     = false;
                    placeTool.hasFirstUseAnimation = false;
                    placeTool.mainCollider         = collider;
                    placeTool.pickupable           = pickupable;
                    placeTool.drawTime             = 0.5f;
                    placeTool.dropTime             = 1;
                    placeTool.holsterTime          = 0.35f;
                    prefab.AddComponent <FCSFilteredStorage>();
                    prefab.AddComponent <DSSServerController>();

                    //Add the FCSTechFabricatorTag component
                    prefab.AddComponent <FCSTechFabricatorTag>();

                    return(prefab);
                }
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }
            return(null);
        }
        public override GameObject GetGameObject()
        {
            try
            {
                if (GetPrefabs())
                {
                    var prefab = GameObject.Instantiate(Prefab);

                    DisableUpgradesMeshes(prefab);

                    //Scale the object
                    prefab.transform.localScale += new Vector3(0.24f, 0.24f, 0.24f);

                    var size   = new Vector3(0.5268422f, 1.300237f, 0.3058454f);
                    var center = new Vector3(-0.001188397f, 0.2168427f, 0.1745552f);

                    GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                    var model = prefab.FindChild("model");

                    //========== Allows the building animation and material colors ==========//
                    Shader     shader     = Shader.Find("MarmosetUBER");
                    Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                    SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                    skyApplier.renderers = renderers;
                    skyApplier.anchorSky = Skies.Auto;
                    //========== Allows the building animation and material colors ==========//

                    // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                    var lwe = prefab.AddComponent <LargeWorldEntity>();
                    lwe.cellLevel = LargeWorldEntity.CellLevel.Far;

                    // Add constructible
                    var constructable = prefab.AddComponent <Constructable>();

                    constructable.allowedOutside          = false;
                    constructable.allowedInBase           = false;
                    constructable.allowedOnGround         = false;
                    constructable.allowedOnWall           = true;
                    constructable.rotationEnabled         = false;
                    constructable.allowedOnCeiling        = false;
                    constructable.allowedInSub            = true;
                    constructable.allowedOnConstructables = false;
                    constructable.model    = model;
                    constructable.techType = TechType;

                    PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                    prefabID.ClassId = ClassID;

                    prefab.AddComponent <CUCDisplayManager>();
                    prefab.AddComponent <CUCController>();
                    return(prefab);
                }
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(null);
        }
        public override GameObject GetGameObject()
        {
            try
            {
                QuickLogger.Debug("Making GameObject");

                QuickLogger.Debug("Instantiate GameObject");

                var prefab = GameObject.Instantiate(_Prefab);

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Far;

                var model = prefab.FindChild("model");

                SkyApplier skyApplier = prefab.AddComponent <SkyApplier>();
                skyApplier.renderers = model.GetComponentsInChildren <MeshRenderer>();
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                QuickLogger.Debug("Adding Constructible");

                // Add constructible
                var constructable = prefab.AddComponent <Constructable>();
                constructable.allowedOnWall           = false;
                constructable.allowedOnGround         = true;
                constructable.allowedInSub            = false;
                constructable.allowedInBase           = false;
                constructable.allowedOnCeiling        = false;
                constructable.allowedOutside          = true;
                constructable.model                   = model;
                constructable.rotationEnabled         = true;
                constructable.allowedOnConstructables = false;
                constructable.techType                = TechType;

                var center = new Vector3(0f, 2.970485f, 0f);
                var size   = new Vector3(4.03422f, 5.701298f, 3.179399f);
                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = this.ClassID;

                var lm = prefab.AddComponent <LiveMixin>();
                lm.data = CustomLiveMixinData.Get();

                prefab.AddComponent <TechTag>().type = TechType;

                prefab.AddComponent <BeaconController>();

                prefab.AddComponent <AIJetStreamT242Display>();

                prefab.AddComponent <AIJetStreamT242PowerManager>();

                prefab.AddComponent <AIJetStreamT242HealthManager>();

                prefab.AddComponent <AIJetStreamT242AnimationManager>();

                prefab.AddComponent <AIJetStreamT242Controller>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
        internal void Register()
        {
            HydroponicHarvestersModelPrefab.GetPrefabs();

            _prefab = HydroponicHarvestersModelPrefab.BottlePrefab;

            if (_prefab == null)
            {
                QuickLogger.Error("FloraKleen prefab is null");
                return;
            }

            GameObjectHelpers.AddConstructableBounds(_prefab, new Vector3(0.1969692f, 0.25098f, 0.1916926f), new Vector3(0, -0.01675579f, 0));

            QuickLogger.Debug("Added Constructable Bounds");

            //Make the rigid body isKinematic so it doesnt shake the cyclops
            var rb = _prefab.AddComponent <Rigidbody>();

            rb.isKinematic = true;
            QuickLogger.Debug("Added Rigid Body");

            // Set collider
            var collider = _prefab.GetComponentInChildren <Collider>();

            collider.enabled   = true;
            collider.isTrigger = true;
            QuickLogger.Debug("Added Getting Collider");


            // Make the object drop slowly in water
            var wf = _prefab.EnsureComponent <WorldForces>();

            wf.underwaterGravity = 0;
            wf.underwaterDrag    = 10f;
            wf.enabled           = true;
            QuickLogger.Debug("Ensuring World Forces");


            // Add fabricating animation
            var fabricatingA = _prefab.EnsureComponent <VFXFabricating>();

            fabricatingA.localMinY   = -0.1f;
            fabricatingA.localMaxY   = 0.6f;
            fabricatingA.posOffset   = new Vector3(0f, 0f, 0f);
            fabricatingA.eulerOffset = new Vector3(0f, 0f, 0f);
            fabricatingA.scaleFactor = 1.0f;
            QuickLogger.Debug("Ensuring VFXFabricating");

            //// Set proper shaders (for crafting animation)
            var renderer = _prefab.GetComponentInChildren <Renderer>();

            QuickLogger.Debug("Getting Renderer");

            // Update sky applier
            var applier = _prefab.EnsureComponent <SkyApplier>();

            applier.renderers = new Renderer[] { renderer };
            applier.anchorSky = Skies.Auto;
            QuickLogger.Debug("Ensuring SkyApplier");

            // We can pick this item
            var pickupable = _prefab.EnsureComponent <Pickupable>();

            pickupable.isPickupable = true;
            pickupable.randomizeRotationWhenDropped = true;
            QuickLogger.Debug("Ensuring Pickupable");

            //Allow this kit to be placed on surfaces in these situations
            var placeTool = _prefab.EnsureComponent <PlaceTool>();

            placeTool.allowedInBase          = true;
            placeTool.allowedOnBase          = false;
            placeTool.allowedOnCeiling       = false;
            placeTool.allowedOnConstructable = true;
            placeTool.allowedOnGround        = true;
            placeTool.allowedOnRigidBody     = true;
            placeTool.allowedOnWalls         = false;
            placeTool.allowedOutside         = false;
            placeTool.rotationEnabled        = true;
            placeTool.enabled              = true;
            placeTool.hasAnimations        = false;
            placeTool.hasBashAnimation     = false;
            placeTool.hasFirstUseAnimation = false;
            placeTool.mainCollider         = collider;
            placeTool.pickupable           = pickupable;
            placeTool.drawTime             = 0.5f;
            placeTool.dropTime             = 1;
            placeTool.holsterTime          = 0.35f;
            QuickLogger.Debug("Ensuring PlaceTool");
        }
        public override GameObject GetGameObject()
        {
            try
            {
                var prefab = GameObject.Instantiate(_prefab);

                if (QPatch.Configuration.Config.UseCustomBoundingBox)
                {
                    var center = QPatch.Configuration.Config.BoundingCenter;
                    var size   = QPatch.Configuration.Config.BoundingSize;
                    GameObjectHelpers.AddConstructableBounds(prefab, size.ToVector3(), center.ToVector3());
                }

                var model = prefab.FindChild("model");

                //========== Allows the building animation and material colors ==========//
                Shader     shader     = Shader.Find("MarmosetUBER");
                Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = renderers;
                skyApplier.anchorSky = Skies.Auto;

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Far;

                //========== Allows the building animation and material colors ==========//

                // Add constructible
                var constructable = prefab.AddComponent <Constructable>();

                constructable.allowedOutside          = QPatch.Configuration.Config.AllowedOutside;
                constructable.allowedInBase           = QPatch.Configuration.Config.AllowedInBase;
                constructable.allowedOnGround         = QPatch.Configuration.Config.AllowedOnGround;
                constructable.allowedOnWall           = QPatch.Configuration.Config.AllowedOnWall;
                constructable.rotationEnabled         = QPatch.Configuration.Config.RotationEnabled;
                constructable.allowedOnCeiling        = QPatch.Configuration.Config.AllowedOnCeiling;
                constructable.allowedInSub            = QPatch.Configuration.Config.AllowedInSub;
                constructable.allowedOnConstructables = QPatch.Configuration.Config.AllowedOnConstructables;

                constructable.placeMaxDistance     = QPatch.Configuration.Config.PlaceMaxDistance;     //7f;
                constructable.placeMinDistance     = QPatch.Configuration.Config.PlaceMinDistance;     //5f;
                constructable.placeDefaultDistance = QPatch.Configuration.Config.PlaceDefaultDistance; //6f;
                constructable.model    = model;
                constructable.techType = TechType;

                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = ClassID;
                MaterialHelpers.AddNewBubbles(prefab, new Vector3(0.722f, 1.03f, 0.775f), new Vector3(270f, 266f, 0f));
                MaterialHelpers.AddNewBubbles(prefab, new Vector3(0.826f, 1.03f, -0.715f), new Vector3(270f, 266f, 0f));
                MaterialHelpers.AddNewBubbles(prefab, new Vector3(-0.796f, 1.03f, -0.828f), new Vector3(270f, 266f, 0f));
                MaterialHelpers.AddNewBubbles(prefab, new Vector3(-0.801f, 1.03f, 0.711f), new Vector3(270f, 266f, 0f));
                prefab.AddComponent <TechTag>().type = TechType;
                prefab.AddComponent <FCSDemoController>();

                //Add the FCSTechFabricatorTag component
                MaterialHelpers.ApplyGlassShaderTemplate(prefab, "_glass", Mod.ModName);
                prefab.AddComponent <FCSTechFabricatorTag>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }
Пример #25
0
        public override GameObject GetGameObject()
        {
            try
            {
                if (GetPrefabs())
                {
                    var prefab = GameObject.Instantiate(Prefab);

                    //Scale the object
                    prefab.transform.localScale += new Vector3(0.24f, 0.24f, 0.24f);

                    var size   = new Vector3(2.493512f, 1.875936f, 1.439421f);
                    var center = new Vector3(0.07963049f, 1.088284f, 0f);

                    GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                    var model = prefab.FindChild("model");

                    //========== Allows the building animation and material colors ==========//
                    Shader     shader     = Shader.Find("MarmosetUBER");
                    Renderer[] renderers  = prefab.GetComponentsInChildren <Renderer>();
                    SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                    skyApplier.renderers = renderers;
                    skyApplier.anchorSky = Skies.Auto;
                    //========== Allows the building animation and material colors ==========//

                    // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                    var lwe = prefab.AddComponent <LargeWorldEntity>();
                    lwe.cellLevel = LargeWorldEntity.CellLevel.Far;

                    // Add constructible
                    var constructable = prefab.AddComponent <Constructable>();

                    constructable.allowedOutside          = true;
                    constructable.allowedInBase           = true;
                    constructable.allowedOnGround         = true;
                    constructable.allowedOnWall           = false;
                    constructable.rotationEnabled         = true;
                    constructable.allowedOnCeiling        = false;
                    constructable.allowedInSub            = false;
                    constructable.allowedOnConstructables = false;
                    constructable.model    = model;
                    constructable.techType = TechType;



                    PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                    prefabID.ClassId = ClassID;

                    //AddBubbles(prefab);

                    PowerRelay solarPowerRelay = CraftData.GetPrefabForTechType(TechType.SolarPanel).GetComponent <PowerRelay>();

                    var ps = prefab.AddComponent <PowerSource>();
                    ps.maxPower = 500f;

                    var pFX = prefab.AddComponent <PowerFX>();
                    pFX.vfxPrefab   = solarPowerRelay.powerFX.vfxPrefab;
                    pFX.attachPoint = prefab.transform;

                    var pr = prefab.AddComponent <PowerRelay>();
                    pr.powerFX             = pFX;
                    pr.maxOutboundDistance = 15;
                    pr.internalPowerSource = ps;

                    prefab.AddComponent <TechTag>().type = TechType;
                    prefab.AddComponent <AlterraGenController>();


                    Resources.UnloadAsset(solarPowerRelay);

                    //Apply the glass shader here because of autosort lockers for some reason doesnt like it.
                    MaterialHelpers.ApplyGlassShaderTemplate(prefab, "_glass", Mod.ModName);
                    return(prefab);
                }
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(null);
        }
        public override GameObject GetGameObject()
        {
            GameObject prefab = null;

            try
            {
                QuickLogger.Debug("Making GameObject");

                QuickLogger.Debug("Instantiate GameObject");

                prefab = GameObject.Instantiate(_prefab);

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Far;

                var model = prefab.FindChild("model");

                Shader     shader    = Shader.Find("MarmosetUBER");
                Renderer[] renderers = prefab.GetComponentsInChildren <Renderer>();
                foreach (Renderer renderer in renderers)
                {
                    renderer.material.shader = shader;
                }

                SkyApplier skyApplier = prefab.EnsureComponent <SkyApplier>();
                skyApplier.renderers = model.GetComponentsInChildren <MeshRenderer>();
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                QuickLogger.Debug("Adding Constructible");

                // Add constructible
                var constructable = prefab.EnsureComponent <Constructable>();
                constructable.allowedOnWall    = true;
                constructable.allowedOnGround  = false;
                constructable.allowedInSub     = false;
                constructable.allowedInBase    = true;
                constructable.allowedOnCeiling = false;
                constructable.allowedOutside   = false;
                constructable.model            = prefab.FindChild("model");
                constructable.rotationEnabled  = false;
                constructable.techType         = TechType;

                var center = new Vector3(0.06065065f, 0.02289772f, 0.06869301f);
                var size   = new Vector3(2.071494f, 1.235519f, 0.1364295f);
                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                prefab.EnsureComponent <AIMarineMonitorController>();

                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = this.ClassID;
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
            }

            return(prefab);
        }