Example #1
0
        public void Activate()
        {
            spin                      = gameObject.FindChild("Blade Parent").EnsureComponent <TurbineSpin>();
            powerSource               = gameObject.EnsureComponent <PowerSource>();
            powerSource.maxPower      = QPatch.config.MaxPower;
            relay                     = gameObject.EnsureComponent <PowerRelay>();
            relay.internalPowerSource = powerSource;
            relay.dontConnectToRelays = false;
            relay.maxOutboundDistance = 50;
            //relay.powerSystemPreviewPrefab = Resources.Load<GameObject>("Base/Ghosts/PowerSystemPreview.prefab");

            if (relayPrefab != null)
            {
                PowerFX yourPowerFX = gameObject.AddComponent <PowerFX>();

                yourPowerFX.vfxPrefab   = relayPrefab.powerFX.vfxPrefab;
                yourPowerFX.attachPoint = gameObject.transform;
                relay.powerFX           = yourPowerFX;
            }

#if SUBNAUTICA
            Resources.UnloadAsset(powerRelay);
#endif
            relay.UpdateConnection();

            if (QPatch.config.TurbineMakesNoise)
            {
                SetupAudio();
            }
            Logger.Log(Logger.Level.Debug, $"WindTurbine.Activate: end");
        }
Example #2
0
        public void Activate()
        {
            spin                      = gameObject.FindChild("Blade Parent").AddComponent <TurbineSpin>();
            powerSource               = gameObject.AddComponent <PowerSource>();
            powerSource.maxPower      = QPatch.config.MaxPower;
            relay                     = gameObject.AddComponent <PowerRelay>();
            relay.internalPowerSource = powerSource;
            relay.dontConnectToRelays = false;
            relay.maxOutboundDistance = 50;

            PowerFX    yourPowerFX = gameObject.AddComponent <PowerFX>();
            PowerRelay powerRelay  = CraftData.GetPrefabForTechType(TechType.SolarPanel).GetComponent <PowerRelay>();

            yourPowerFX.vfxPrefab   = powerRelay.powerFX.vfxPrefab;
            yourPowerFX.attachPoint = gameObject.transform;
            relay.powerFX           = yourPowerFX;

            Resources.UnloadAsset(powerRelay);
            relay.UpdateConnection();

            if (QPatch.config.TurbineMakesNoise)
            {
                SetupAudio();
            }
        }