public static void MonitorSeamothBatteryCount(SeaMoth thisSeaMoth)
        {
            EnergyMixin energyMixin = thisSeaMoth.gameObject.GetComponent <EnergyMixin>();

            if (energyMixin != null)
            {
                GameObject thisGameObject = energyMixin.GetBattery();

                if (thisGameObject != null)
                {
                    SeamothInfo.BatteryInSlot = 1;
                }
                else
                {
                    SeamothInfo.BatteryInSlot = 0;
                }
            }

            SeamothInfo.MainBatteryCount = 0;

            foreach (InventoryItem item in Inventory.main.container)
            {
                if (energyMixin.Filter(item))
                {
                    SeamothInfo.MainBatteryCount += 1;
                }
            }

            SeamothInfo.TotalBatteryCount = SeamothInfo.BatteryInSlot + SeamothInfo.MainBatteryCount;
        }
Exemple #2
0
        // As the normal spawn is suppressed, spawn default batteries afterwards
        private void SpawnDefaultBatteries(GameObject constructedObject, List <InteractiveChildObjectIdentifier> childIdentifiers)
        {
            Optional <EnergyMixin> opEnergy = Optional <EnergyMixin> .OfNullable(constructedObject.GetComponent <EnergyMixin>());

            if (opEnergy.IsPresent())
            {
                EnergyMixin mixin = opEnergy.Get();
                mixin.ReflectionSet("allowedToPlaySounds", false);
                mixin.SetBattery(mixin.defaultBattery, 1);
                mixin.ReflectionSet("allowedToPlaySounds", true);
            }
            foreach (InteractiveChildObjectIdentifier identifier in childIdentifiers)
            {
                Optional <GameObject> opChildGameObject = GuidHelper.GetObjectFrom(identifier.Guid);
                if (opChildGameObject.IsPresent())
                {
                    opChildGameObject.Get().AddComponent <NitroxEntity>();
                    Optional <EnergyMixin> opEnergyMixin = Optional <EnergyMixin> .OfNullable(opChildGameObject.Get().GetComponent <EnergyMixin>());

                    if (opEnergyMixin.IsPresent())
                    {
                        EnergyMixin mixin = opEnergyMixin.Get();
                        mixin.ReflectionSet("allowedToPlaySounds", false);
                        mixin.SetBattery(mixin.defaultBattery, 1);
                        mixin.ReflectionSet("allowedToPlaySounds", true);
                    }
                }
            }
        }
Exemple #3
0
        public static void NotifyHasBatteryPostfix(ref EnergyMixin __instance, InventoryItem item)
        {
            if (CbCore.PowerCellTechTypes.Count == 0)
            {
                return;
            }

            // For vehicles that show a battery model when one is equipped,
            // this will replicate the model for the normal Power Cell so it doesn't look empty

            // Null checks added on every step of the way
            TechType?itemInSlot = item?.item?.GetTechType();

            if (itemInSlot.HasValue && CbCore.PowerCellTechTypes.Contains(itemInSlot.Value))
            {
                IEnumerable <EnergyMixin.BatteryModels> batteryModels = __instance.batteryModels.Where((x) => x.techType == itemInSlot.Value);
                if (batteryModels.Any())
                {
                    batteryModels.First().model.SetActive(true);
                }
                else
                {
                    __instance.batteryModels[0].model.SetActive(true);
                }
            }

            // Perhaps later a more suiteable model could be added with a more appropriate skin.
            // This is functional for now.
        }
        public static void Postfix(EnergyMixin __instance, InventoryItem item)
        {
            if (item != null)
            {
                TechType techType = item.item.GetTechType();

                if (Main.abyssBatteries.Contains(techType))
                {
                    foreach (BatteryModels batteryModel in __instance.batteryModels)
                    {
                        if (batteryModel.techType == techType)
                        {
                            batteryModel.model.EnsureComponent <PulsatingBehaviour>();
                            return;
                        }
                    }

                    __instance.gameObject.EnsureComponent <PulsatingBehaviour>();
                    return;
                }
            }

            if (__instance.TryGetComponent(out PulsatingBehaviour pulsatingBehaviour))
            {
                GameObject.Destroy(pulsatingBehaviour);
            }
        }
 public static void Postfix(ref EnergyMixin __instance, InventoryItem item)
 {
     if (item?.item?.GetTechType() == SeraphimBatteryCore.EnzPowCelID || item?.item?.GetTechType() == SeraphimBatteryCore.KhaPowCelID)
     {
         __instance.batteryModels[0].model.SetActive(true);
     }
 }
        public static void RemoveRandomBattery()
        {
            PlayerTool[]       playerTools = Inventory.main.gameObject.GetAllComponentsInChildren <PlayerTool>();
            List <EnergyMixin> toolMixins  = new List <EnergyMixin>();

            foreach (PlayerTool playerTool in playerTools)
            {
                EnergyMixin toolEnergyMixin = playerTool.GetComponent <EnergyMixin>();

                // This is a tool, not something like a floater
                if (toolEnergyMixin != null && toolEnergyMixin.HasItem())
                {
                    toolMixins.Add(toolEnergyMixin);
                }
            }

            if (toolMixins.Count == 0)
            {
                // Prevent OutOfBounds errors
                return;
            }

            System.Random random      = new System.Random();
            int           randomMixin = random.Next(0, toolMixins.Count);
            EnergyMixin   energyMixin = toolMixins[randomMixin];

            InventoryItem storedBattery = energyMixin.batterySlot.storedItem;

            energyMixin.batterySlot.RemoveItem();
            Inventory.main.ForcePickup(storedBattery.item);
        }
        private void Start()
        {
            objectHelper = new ObjectHelper();

            thisSeamoth = GetComponent <SeaMoth>();
            liveMixin   = GetComponent <LiveMixin>();
            energyMixin = GetComponent <EnergyMixin>();

            shield_on_loop      = ScriptableObject.CreateInstance <FMODAsset>();
            shield_on_loop.name = "shield_on_loop";
            shield_on_loop.path = "event:/sub/cyclops/shield_on_loop";
            sfx              = gameObject.AddComponent <FMOD_CustomEmitter>();
            sfx.asset        = shield_on_loop;
            sfx.followParent = true;

            GameObject CyclopsPrefab = objectHelper.GetRootGameObject("Cyclops", "Cyclops-MainPrefab");

            SubRoot subRoot = CyclopsPrefab.GetComponent <SubRoot>();

            shieldFX = Instantiate(subRoot.shieldFX, transform);

            shieldFX.gameObject.SetActive(false);

            Utils.ZeroTransform(shieldFX.transform);

            shieldFX.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);

            thisSeamoth.onToggle             += OnToggle;
            thisSeamoth.modules.onAddItem    += OnAddItem;
            thisSeamoth.modules.onRemoveItem += OnRemoveItem;
        }
        public override float ModifyDamage(float damage, DamageType type)
        {
            float modifiedDamage = damage;

            if (bActive)
            {
                if (parentEnergy == null)
                {
                    parentEnergy = GetComponentInParent <EnergyMixin>();
                }

                if (parentEnergy == null)
                {
                    // Error state
                    return(damage);
                }

                float damageReduction   = damage * (1 - multiplier);
                float energyConsumption = damageReduction * fDamageToEnergyRatio;
                if (parentEnergy.ConsumeEnergy(energyConsumption))
                {
                    Log.LogDebug($"Hoverbike received {damage} damage, reduced by {damageReduction} costing {energyConsumption} energy");
                    modifiedDamage -= damageReduction;
                }
            }

            return(modifiedDamage);
        }
        public static void Postfix(EnergyMixin __instance, InventoryItem item)
        {
            if (item != null)
            {
                var techType = item.item.GetTechType();

                if (Main.unobtaniumBatteries.Contains(techType))
                {
                    foreach (var batteryModel in __instance.batteryModels)
                    {
                        if (batteryModel.techType != techType)
                        {
                            continue;
                        }
                        batteryModel.model.EnsureComponent <UnobtaniumBehaviour>();
                        return;
                    }

                    __instance.gameObject.EnsureComponent <UnobtaniumBehaviour>();
                    return;
                }
            }

            if (__instance.TryGetComponent(out UnobtaniumBehaviour infinityBehaviour))
            {
                Object.Destroy(infinityBehaviour);
            }
        }
        public void OnConsoleCommand_charge()
        {
            EnergyMixin energyMixin = Inventory.main.GetHeldTool().GetComponent <EnergyMixin>();

            energyMixin.ModifyCharge(energyMixin.capacity);
            ErrorMessage.AddMessage("Charged.");
        }
        public void OnHandHover(GUIHand hand)
        {
            HandReticle reticle = HandReticle.main;

            if (!reticle)
            {
                return;
            }

            EnergyMixin mixin = shark.energyInterface.sources[0];

            if (mixin.HasItem())
            {
                if (mixin.charge > 0f)
                {
                    isValidHandTarget = false;
                    reticle.SetInteractText("Ion Cube", $"{Mathf.Round(mixin.charge / mixin.capacity * 100f)}% Remaining", false, false, HandReticle.Hand.None);
                }
                else
                {
                    isValidHandTarget = true;
                    reticle.SetInteractText("Ion Cube", $"Click to remove", false, false, HandReticle.Hand.Left);
                }
            }
            else
            {
                isValidHandTarget = true;
                reticle.SetInteractText("Insert Ion Cube", false, HandReticle.Hand.Left);
            }
        }
Exemple #12
0
        public void RemoveItem(NitroxId ownerId, bool silent = false)
        {
            GameObject             owner   = NitroxIdentifier.RequireObjectFrom(ownerId);
            Optional <EnergyMixin> opMixin = Optional <EnergyMixin> .OfNullable(owner.GetComponent <EnergyMixin>());

            if (opMixin.IsPresent())
            {
                EnergyMixin mixin = opMixin.Get();
                StorageSlot slot  = (StorageSlot)mixin.ReflectionGet("batterySlot");

                // Suppress sound when silent is active
                // Will be used to suppress swap sound at the initialisation of the game
                bool allowedToPlaySounds = true;
                if (silent)
                {
                    allowedToPlaySounds = (bool)mixin.ReflectionGet("allowedToPlaySounds");
                    mixin.ReflectionSet("allowedToPlaySounds", !silent);
                }
                using (packetSender.Suppress <StorageSlotItemRemove>())
                {
                    slot.RemoveItem();
                }
                if (silent)
                {
                    mixin.ReflectionSet("allowedToPlaySounds", allowedToPlaySounds);
                }
            }
            else
            {
                Log.Error("Removing storage slot item: Could not find storage slot field on object " + owner.name);
            }
        }
        public void Awake()
        {
            seamoth         = gameObject.GetComponent <SeaMoth>();
            leftTorpedoSlot = seamoth.torpedoTubeLeft.transform;
            energyMixin     = seamoth.GetComponent <EnergyMixin>();

            var scannerPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Scanner").GetComponent <ScannerTool>();

            //ScannerTool scannerPrefab = CraftData.InstantiateFromPrefab(TechType.Scanner, false).GetComponent<ScannerTool>();
            scanSound     = Instantiate(scannerPrefab.scanSound, gameObject.transform);
            completeSound = Instantiate(scannerPrefab.completeSound, gameObject.transform);
            fxControl     = Instantiate(scannerPrefab.fxControl, gameObject.transform);
            scanBeam      = Instantiate(scannerPrefab.scanBeam, leftTorpedoSlot.transform);

            MeshRenderer[] renderers             = scannerPrefab.GetComponentsInChildren <MeshRenderer>(true);
            Renderer       instantiated_renderer = Instantiate(renderers[0]);

            scanCircuitTex = instantiated_renderer.materials[0].mainTexture;
            scanOrganicTex = instantiated_renderer.materials[2].mainTexture;

            //Destroy(instantiated_renderer);
            //Resources.UnloadAsset(scannerPrefab);

            scanBeam.transform.localScale    = new Vector3(1, 4, 1);
            scanBeam.transform.localRotation = new Quaternion(-0.7683826f, 0.1253118f, 0.0448633f, 0.6259971f);
        }
        public static void NotifyHasBatteryPostfix(ref EnergyMixin __instance, InventoryItem item)
        {
            if (CbCore.PowerCellItems.Count == 0)
            {
                return;
            }

            // For vehicles that show a battery model when one is equipped,
            // this will replicate the model for the normal Power Cell so it doesn't look empty

            // Null checks added on every step of the way
            TechType?itemInSlot = item?.item?.GetTechType();

            if (!itemInSlot.HasValue || itemInSlot.Value == TechType.None)
            {
                return; // Nothing here
            }
            TechType powerCellTechType      = itemInSlot.Value;
            bool     isKnownModdedPowerCell = CbCore.PowerCellItems.Find(pc => pc.TechType == powerCellTechType) != null;

            if (isKnownModdedPowerCell)
            {
                int modelToDisplay = 0; // If a matching model cannot be found, the standard PowerCell model will be used instead.
                for (int b = 0; b < __instance.batteryModels.Length; b++)
                {
                    if (__instance.batteryModels[b].techType == powerCellTechType)
                    {
                        modelToDisplay = b;
                        break;
                    }
                }

                __instance.batteryModels[modelToDisplay].model.SetActive(true);
            }
        }
        public static void AddEnergyTool(EnergyMixin __instance, ref float amount)
        {
            // Acid Battery is not chargeable by any method (e.g. Swim Charge Fins)
            if (!Config.NORMAL.Equals(DeathRun.config.batteryCosts))
            {
                var batt = __instance.GetBattery();
                if (batt != null)
                {
                    TechType t = CraftData.GetTechType(batt);
                    if (t == AcidBatteryCellBase.BatteryID)
                    {
                        amount = 0;
                        return;
                    }
                }
            }

            if (isTransformInRadiation(Player.main.transform))
            {
                if (Config.DEATHRUN.Equals(DeathRun.config.powerCosts) || Config.EXORBITANT.Equals(DeathRun.config.powerCosts))
                {
                    amount /= 4;
                }
                else if (Config.HARD.Equals(DeathRun.config.powerCosts))
                {
                    amount /= 2;
                }
            }
            else if (Config.DEATHRUN.Equals(DeathRun.config.powerCosts) || Config.EXORBITANT.Equals(DeathRun.config.powerCosts))
            {
                amount /= 2;
            }
        }
Exemple #16
0
        public static void StartPostfix(ref EnergyMixin __instance)
        {
            // This is necessary to allow the new batteries to be compatible with tools and vehicles

            if (!__instance.allowBatteryReplacement)
            {
                return; // Battery replacement not allowed - No need to make changes
            }
            if (CbCore.BatteryTechTypes.Count == 0)
            {
                return;
            }

            List <TechType> compatibleBatteries = __instance.compatibleBatteries;

            if (compatibleBatteries.Contains(TechType.Battery) &&
                !compatibleBatteries.Contains(CbCore.LastModdedBattery))
            {
                // If the regular Battery is compatible with this item, then modded batteries should also be compatible
                AddMissingTechTypesToList(compatibleBatteries, CbCore.BatteryTechTypes);
                return;
            }

            if (compatibleBatteries.Contains(TechType.PowerCell) &&
                !compatibleBatteries.Contains(CbCore.LastModdedPowerCell))
            {
                // If the regular Power Cell is compatible with this item, then modded power cells should also be compatible
                AddMissingTechTypesToList(compatibleBatteries, CbCore.PowerCellTechTypes);
            }
        }
Exemple #17
0
        public void SpawnDefaultBatteries(GameObject constructedObject, List <InteractiveChildObjectIdentifier> childIdentifiers)
        {
            Optional <EnergyMixin> opEnergy = Optional.OfNullable(constructedObject.GetComponent <EnergyMixin>());

            if (opEnergy.HasValue)
            {
                EnergyMixin mixin = opEnergy.Value;
                mixin.ReflectionSet("allowedToPlaySounds", false);
                mixin.SetBattery(mixin.defaultBattery, 1);
                mixin.ReflectionSet("allowedToPlaySounds", true);
            }

            foreach (InteractiveChildObjectIdentifier identifier in childIdentifiers)
            {
                Optional <GameObject> opChildGameObject = NitroxEntity.GetObjectFrom(identifier.Id);

                if (opChildGameObject.HasValue)
                {
                    Optional <EnergyMixin> opEnergyMixin = Optional.OfNullable(opChildGameObject.Value.GetComponent <EnergyMixin>());

                    if (opEnergyMixin.HasValue)
                    {
                        EnergyMixin mixin = opEnergyMixin.Value;
                        mixin.ReflectionSet("allowedToPlaySounds", false);
                        mixin.SetBattery(mixin.defaultBattery, 1);
                        mixin.ReflectionSet("allowedToPlaySounds", true);
                    }
                }
            }
        }
        public void Awake()
        {
            Main = this;

            seamoth     = gameObject.GetComponent <SeaMoth>();
            energyMixin = seamoth.GetComponent <EnergyMixin>();
            var repulsionCannonPrefab = Resources.Load <GameObject>("WorldEntities/Tools/RepulsionCannon").GetComponent <RepulsionCannon>();

            //RepulsionCannon repulsionCannonPrefab = CraftData.InstantiateFromPrefab(TechType.RepulsionCannon, false).GetComponent<RepulsionCannon>();
            shootSound = Instantiate(repulsionCannonPrefab.shootSound, seamoth.transform);
            //Destroy(repulsionCannonPrefab);

            loopingEmitter       = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
            loopingEmitter.asset = shootSound;

            var powerRelayPrefab = Resources.Load <GameObject>("Submarine/Build/PowerTransmitter").GetComponent <PowerFX>();

            //PowerFX powerRelayPrefab = CraftData.InstantiateFromPrefab(TechType.PowerTransmitter, false).GetComponent<PowerFX>();
            laserBeam = Instantiate(powerRelayPrefab.vfxPrefab, seamoth.transform);
            laserBeam.SetActive(false);
            //Destroy(powerRelayPrefab);

            lineRenderer                = laserBeam.GetComponent <LineRenderer>();
            lineRenderer.startWidth     = 0.4f;
            lineRenderer.endWidth       = 0.4f;
            lineRenderer.receiveShadows = false;
            lineRenderer.loop           = false;

            SetBeamColor();
        }
        public static bool Prefix(EnergyMixin __instance, bool __result, ref float amount)
        {
            float num = -__instance.ModifyCharge(-Math.Abs(amount * HCPSettings.Instance.HandToolsPowerDrainMultiplier));

            __result = num > 0f;
            return(false);
        }
Exemple #20
0
        public void RemoveItem(NitroxId ownerId, bool silent = false)
        {
            GameObject             owner   = NitroxEntity.RequireObjectFrom(ownerId);
            Optional <EnergyMixin> opMixin = Optional.OfNullable(owner.GetComponent <EnergyMixin>());

            if (opMixin.HasValue)
            {
                EnergyMixin mixin = opMixin.Value;
                StorageSlot slot  = mixin.batterySlot;

                // Suppress sound when silent is active
                // Will be used to suppress swap sound at the initialisation of the game
                bool allowedToPlaySounds = true;
                if (silent)
                {
                    allowedToPlaySounds       = mixin.allowedToPlaySounds;
                    mixin.allowedToPlaySounds = !silent;
                }
                using (packetSender.Suppress <StorageSlotItemRemove>())
                {
                    slot.RemoveItem();
                }
                if (silent)
                {
                    mixin.allowedToPlaySounds = allowedToPlaySounds;
                }
            }
            else
            {
                Log.Error("Removing storage slot item: Could not find storage slot field on object " + owner.name);
            }
        }
        public void OnHandClick(GUIHand hand)
        {
            EnergyMixin mixin = shark.energyInterface.sources[0];

            if (mixin.HasItem() && mixin.charge == 0f)
            {
                InventoryItem item = mixin.batterySlot.storedItem;

                mixin.batterySlot.RemoveItem();

                Destroy(item.item.gameObject);

                Pickupable ionCube = CraftData.InstantiateFromPrefab(Shark.depletedIonCube).GetComponent <Pickupable>();
                ionCube.transform.position = transform.position + transform.up;

                if (Player.main.HasInventoryRoom(ionCube))
                {
                    Inventory.main.Pickup(ionCube);
                }
            }

            if (!mixin.HasItem())
            {
                if (Inventory.main.GetPickupCount(TechType.PrecursorIonCrystal) >= 1)
                {
                    Inventory.main.container.RemoveItem(TechType.PrecursorIonCrystal);

                    Pickupable battery = CraftData.InstantiateFromPrefab(Shark.internalBattery).GetComponent <Pickupable>();

                    InventoryItem item = mixin.batterySlot.AddItem(battery);
                    mixin.NotifyHasBattery(item);
                }
            }
        }
        [HarmonyPostfix] // This will run right after the code of the chosen method
        public static void Postfix(ref EnergyMixin __instance)
        {
            // This is necessary to allow the new batteries to be compatible with tools and vehicles

            if (!__instance.allowBatteryReplacement)
            {
                return; // Battery replacement not allowed - No need to make changes
            }
            List <TechType> compatibleBatteries = __instance.compatibleBatteries;

            if (compatibleBatteries.Contains(TechType.Battery) &&
                !compatibleBatteries.Contains(DeepBatteryCellBase.BatteryID))
            {
                // If the regular Battery is compatible with this item,
                // the Deep Lithium Battery should also be compatible
                compatibleBatteries.Add(DeepBatteryCellBase.BatteryID);
                return;
            }

            if (compatibleBatteries.Contains(TechType.PowerCell) &&
                !compatibleBatteries.Contains(DeepBatteryCellBase.PowerCellID))
            {
                // If the regular Power Cell is compatible with this item,
                // the Deep Lithium Power Cell should also be compatible
                compatibleBatteries.Add(DeepBatteryCellBase.PowerCellID);
                return;
            }
        }
        public static void Postfix(ref EnergyMixin __instance, InventoryItem item)
        {
            // For vehicles that show a battery model when one is equipped,
            // this will replicate the model for the normal Power Cell so it doesn't look empty

            if (item?.item?.GetTechType() == AcidBatteryCellBase.PowerCellID)
            {
                __instance.batteryModels[0].model.SetActive(true);
            }
        }
        public override void Process(EnergyMixinValueChanged energyMixinPacket)
        {
            GameObject  target      = NitroxEntity.RequireObjectFrom(energyMixinPacket.Id);
            EnergyMixin energyMixin = target.RequireComponent <EnergyMixin>();

            using (packetSender.Suppress <EnergyMixinValueChanged>())
            {
                energyMixin.ModifyCharge(energyMixinPacket.Value - energyMixin.charge);
            }
        }
 private static void OnCraftEndPrefix(EnergyMixin __instance, TechType techType)
 {
     if (!Config.NORMAL.Equals(DeathRun.config.batteryCosts) && !GameModeUtils.IsOptionActive(GameModeOption.Creative))
     {
         if (techType != TechType.MapRoomCamera)
         {
             __instance.defaultBattery = 0;
         }
     }
 }
        public void Update()
        {
            EnergyMixin mixin = shark.energyInterface.sources[0];

            crystalMat.color = Color.Lerp(baseCol, lerpToCol, 1f - mixin.charge / mixin.capacity);
            crystalMat.SetColor("_SquaresColor", Color.Lerp(squareCol, lerpToCol, 1f - mixin.charge / mixin.capacity));
            crystalMat.SetColor("_DetailsColor", Color.Lerp(detailCol, lerpToCol, 1f - mixin.charge / mixin.capacity));
            crystalMat.SetFloat("_SquaresSpeed", Mathf.Lerp(squareSpeed, 0f, 1f - mixin.charge / mixin.capacity));
            crystalMat.SetVector("_NoiseSpeed", Vector4.Lerp(noiseSpeed, Vector4.zero, 1f - mixin.charge / mixin.capacity));
        }
        public void Awake()
        {
            this.Instance    = this;
            this.ThisVehicle = this.Instance.GetComponent <Vehicle>();
            this.EnergyMixin = this.ThisVehicle.GetComponent <EnergyMixin>();
            this.PlayerMain  = Player.main;
            BuilderTool builderPrefab = Resources.Load <GameObject>("WorldEntities/Tools/Builder").GetComponent <BuilderTool>();

            completeSound = Instantiate(builderPrefab.completeSound, this.gameObject.transform);
        }
Exemple #28
0
 public void Awake()
 {
     thisVehicle         = gameObject.GetComponent <Vehicle>();
     energyMixin         = thisVehicle.GetComponent <EnergyMixin>();
     weldSoundAsset      = ScriptableObject.CreateInstance <FMODAsset>();
     weldSoundAsset.path = "event:/tools/welder/weld_loop";
     weldSound           = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
     weldSound.asset     = weldSoundAsset;
     repairPerSec        = thisVehicle.liveMixin.maxHealth * 0.1f;
 }
 public void Awake()
 {
     exosuit                 = gameObject.GetComponent <Exosuit>();
     energyMixin             = exosuit.GetComponent <EnergyMixin>();
     scanSoundAsset          = ScriptableObject.CreateInstance <FMODAsset>();
     scanSoundAsset.path     = "event:/tools/scanner/scan_loop";
     scanSound               = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
     scanSound.asset         = scanSoundAsset;
     completeSoundAsset      = ScriptableObject.CreateInstance <FMODAsset>();
     completeSoundAsset.path = "event:/tools/scanner/scan_complete";
 }
Exemple #30
0
 public static void Postfix(EnergyMixin __instance, InventoryItem item)
 {
     if (item != null)
     {
         //For now only broadcast, if it is a vehicle
         if (__instance.gameObject.GetComponent <Vehicle>() || __instance.gameObject.GetComponentInParent <Vehicle>() || __instance.gameObject.GetComponentInParent <SubRoot>())
         {
             NitroxServiceLocator.LocateService <StorageSlots>().BroadcastItemAdd(item, __instance.gameObject);
         }
     }
 }