コード例 #1
0
        static void Postfix(Exosuit __instance)
        {
            __instance.GetComponentsInChildren <VFXVolumetricLight>().ForEach(x => x.RestoreVolume());
            var customLights = __instance.GetComponent <ExosuitCustomLight>();

            customLights.isPilotMode = false;
        }
コード例 #2
0
 static void Postfix(Exosuit __instance, bool docked)
 {
     if (docked)
     {
         __instance.GetComponent <ExosuitCustomLight>().SetLightsActive(false);
     }
 }
コード例 #3
0
        static void Postfix(Exosuit __instance)
        {
            __instance.GetComponentsInChildren <VFXVolumetricLight>().ForEach(x => x.DisableVolume());
            var customLights = __instance.GetComponent <ExosuitCustomLight>();

            customLights.isPilotMode = true;
            Exosuit_Start_Patch.currentExosuitCustomLight = customLights;
            Exosuit_UpdateUIText_Patch.BuildToggleLightText();
        }
コード例 #4
0
        internal static void Postfix(Exosuit __instance)
        {
            if (__instance.GetComponent <SlotExtender>() == null)
            {
                __instance.gameObject.AddComponent <SlotExtender>();

                Debug.Log($"[SlotExtender] Added component to instance: {__instance.name} ID: {__instance.GetInstanceID()}");
            }
        }
コード例 #5
0
        internal static void UpgradeExosuit(Exosuit exosuit, bool announce = false)
        {
            bool isUpgradedExosuit = exosuit.GetComponent <TechTag>().type == ExosuitMk2.TechTypeID;

            if (!isUpgradedExosuit)
            {
                return; // This is a normal Prawn Suit. Do not upgrade.
            }
            OverrideCrushDepth(exosuit.crushDamage, 800f, announce);
        }
コード例 #6
0
 static void Postfix(Exosuit __instance, bool docked)
 {
     if (docked)
     {
         var exosuitCustomLight = __instance.GetComponent <ExosuitCustomLight>();
         if (exosuitCustomLight != null)
         {
             exosuitCustomLight.SetLightsActive(false);
         }
     }
 }
コード例 #7
0
 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";
 }
コード例 #8
0
        static void Postfix(Exosuit __instance)
        {
            var exoToggleLights = __instance.GetComponent <ExosuitCustomLight>();

            if (exoToggleLights == null)
            {
                exoToggleLights = __instance.gameObject.AddComponent <ExosuitCustomLight>();
            }
            exoToggleLights.SetLightsActive(false);
            currentExosuitCustomLight = exoToggleLights;
            Exosuit_UpdateUIText_Patch.BuildToggleLightText();
        }
コード例 #9
0
        internal static bool Prefix(ref Exosuit __instance, ref string __result)
        {
            var techType = __instance.GetComponent <TechTag>().type;

            if (techType == ExosuitMk2.TechTypeID)
            {
                __result = "PRAWN SUIT MK2";
                return(false);
            }

            return(true);
        }
コード例 #10
0
ファイル: Main.cs プロジェクト: MSIDoc/SennaSubnauticaPlugins
 static void Postfix(Exosuit __instance, int slotID, TechType techType, bool added)
 {
     if (techType == ScannerModule.TechTypeID)
     {
         if (added)
         {
             if (__instance.GetComponent <ScannerModuleExosuit>() == null)
             {
                 __instance.gameObject.AddComponent <ScannerModuleExosuit>();
                 Debug.Log($"[ScannerModule] Added component to instance: {__instance.name} ID: {__instance.GetInstanceID()}");
             }
             else
             {
                 __instance.GetComponent <ScannerModuleExosuit>().enabled = true;
             }
         }
         else
         {
             __instance.GetComponent <ScannerModuleExosuit>().enabled = false;
         }
     }
 }
コード例 #11
0
        private static void Postfix(Exosuit __instance)
        {
            Logger.Log("Exosuit Awake");
            var toggleLights       = __instance.GetComponent <ToggleLights>();
            var seamothPrefab      = Resources.Load <GameObject>("WorldEntities/Tools/SeaMoth");
            var toggleLightsPrefab = seamothPrefab.GetComponent <SeaMoth>().toggleLights;

            if (toggleLights == null)
            {
                toggleLights = ModUtils.CopyComponent(toggleLightsPrefab, __instance.gameObject);
            }
            else
            {
                toggleLights.lightsOnSound   = toggleLightsPrefab.lightsOnSound;
                toggleLights.lightsOffSound  = toggleLightsPrefab.lightsOffSound;
                toggleLights.onSound         = toggleLightsPrefab.onSound;
                toggleLights.offSound        = toggleLightsPrefab.offSound;
                toggleLights.energyPerSecond = toggleLightsPrefab.energyPerSecond;
            }

            toggleLights.lightsParent = __instance.transform.Find("lights_parent").gameObject;
            toggleLights.energyMixin  = __instance.GetComponent <EnergyMixin>();
        }
コード例 #12
0
        private static void Postfix(Exosuit __instance)
        {
            var toggleLights = __instance.GetComponent <ToggleLights>();

            if (toggleLights != null)
            {
                if (Mod.config.PrawnsuitLightsUseEnergy)
                {
                    toggleLights.UpdateLightEnergy();
                }

                if (__instance.GetPilotingMode() && GameInput.GetButtonDown(Exosuit_UpdateUIText_Patch.lightsBinding) && !(Player.main.GetPDA().isOpen || !AvatarInputHandler.main.IsEnabled()))
                {
                    toggleLights.SetLightsActive(!toggleLights.lightsActive);
                }
            }
        }
コード例 #13
0
        private static void Postfix(Exosuit __instance)
        {
            var toggleLights = __instance.GetComponent <ToggleLights>();

            if (toggleLights != null)
            {
                if (Mod.config.PrawnsuitLightsUseEnergy)
                {
                    toggleLights.UpdateLightEnergy();
                }

                if (__instance.GetPilotingMode() && GameInput.GetButtonDown(GameInput.Button.Deconstruct))
                {
                    toggleLights.SetLightsActive(!toggleLights.lightsActive);
                }
            }
        }
コード例 #14
0
        static void refresh(Exosuit exosuit)
        {
            if (exosuit == null)
            {
                return;
            }

            DealDamageOnImpact damage = exosuit.GetComponent <DealDamageOnImpact>();

            damage.mirroredSelfDamage        = Main.config.collisionSelfDamage.enabled;
            damage.speedMinimumForSelfDamage = Main.config.collisionSelfDamage.speedMinimumForDamage;

            int armorCount = exosuit.modules.GetCount(TechType.VehicleArmorPlating);

            damage.mirroredSelfDamageFraction =
                Main.config.collisionSelfDamage.mirroredSelfDamageFraction * Mathf.Pow(0.5f, armorCount);

            $"CollisionSelfDamage: {damage.mirroredSelfDamage} {damage.speedMinimumForSelfDamage} {damage.mirroredSelfDamageFraction}".logDbg();
        }
コード例 #15
0
        static void refresh(Exosuit exosuit)
        {
            if (!exosuit)
            {
                return;
            }

            var damage = exosuit.GetComponent <DealDamageOnImpact>();

            damage.mirroredSelfDamage        = Main.config.collisionSelfDamage.enabled;
            damage.speedMinimumForSelfDamage = Main.config.collisionSelfDamage.speedMinimumForDamage;

#if GAME_SN // BZ doesn't have TechType.VehicleArmorPlating
            float damageReduction = Mathf.Pow(0.5f, exosuit.modules.GetCount(TechType.VehicleArmorPlating));
#elif GAME_BZ
            float damageReduction = 1.0f;
#endif
            damage.mirroredSelfDamageFraction = Main.config.collisionSelfDamage.mirroredSelfDamageFraction * damageReduction;

            $"CollisionSelfDamage: {damage.mirroredSelfDamage} {damage.speedMinimumForSelfDamage} {damage.mirroredSelfDamageFraction}".logDbg();
        }
コード例 #16
0
        private static void Postfix(Exosuit __instance)
        {
            bool   hasPropCannon   = Exosuit_rightArm.GetValue(__instance) is ExosuitPropulsionArm || Exosuit_leftArm.GetValue(__instance) is ExosuitPropulsionArm;
            var    toggleLights    = __instance.GetComponent <ToggleLights>();
            string lightsString    = LanguageCache.GetButtonFormat((!toggleLights.lightsActive) ? "Lights On (<color=#ADF8FFFF>{0}</color>)" : "Lights Off (<color=#ADF8FFFF>{0}</color>)", lightsBinding);
            string exitString      = string.Join("\n", ((string)Exosuit_uiStringPrimary.GetValue(__instance)).Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Take(1).ToArray());
            var    primaryString   = string.Join("\n", ((string)Exosuit_uiStringPrimary.GetValue(__instance)).Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Skip(1).ToArray()) + System.Environment.NewLine + lightsString;
            var    secondaryString = string.Empty;

            if (hasPropCannon)
            {
                lightsBinding   = GameInput.Button.Deconstruct;
                secondaryString = exitString;
            }
            else
            {
                lightsBinding = GameInput.Button.AltTool;
                primaryString = primaryString + System.Environment.NewLine + exitString;
            }
            HandReticle.main.SetUseTextRaw(primaryString, secondaryString);
        }
コード例 #17
0
        public bool PlasmaShoot(GameObject bullet, Transform siloTransform)
        {
            PlasmaBullet plasmaBullet = bullet.GetComponent <PlasmaBullet>();

            Transform aimingTransform = Player.main.camRoot.GetAimingTransform();

            Rigidbody rb = gameObject.GetComponentInParent <Rigidbody>();

            Vector3 rhs = (!(rb != null)) ? Vector3.zero : rb.velocity;

            float speed = Vector3.Dot(aimingTransform.forward, rhs);

            plasmaBullet.Shoot(siloTransform.position, aimingTransform.rotation, speed, -1f);

            audioSource.Play();

            animator.SetBool("use_tool", true);

            Exosuit.GetComponent <EnergyInterface>().ConsumeEnergy(energyCosumption);

            return(true);
        }
コード例 #18
0
        public void Awake()
        {
            thisExosuit     = GetComponent <Exosuit>();
            energyMixin     = thisExosuit.GetComponent <EnergyMixin>();
            handReticleMain = HandReticle.main;

            scan_loop       = ScriptableObject.CreateInstance <FMODAsset>();
            scan_loop.name  = "scan_loop";
            scan_loop.path  = "event:/tools/scanner/scan_loop";
            scanSound       = gameObject.AddComponent <FMOD_CustomLoopingEmitter>();
            scanSound.asset = scan_loop;

            completeSound      = ScriptableObject.CreateInstance <FMODAsset>();
            completeSound.name = "scan_complete";
            completeSound.path = "event:/tools/scanner/scan_complete";

            thisExosuit.onToggle             += OnToggle;
            thisExosuit.modules.onAddItem    += OnAddItem;
            thisExosuit.modules.onRemoveItem += OnRemoveItem;

            Player.main.playerMotorModeChanged.AddHandler(this, new Event <Player.MotorMode> .HandleFunction(OnPlayerMotorModeChanged));

            moduleCount = thisExosuit.modules.GetCount(ScannerModulePrefab.TechTypeID);
        }
コード例 #19
0
        public void FixedUpdate()
        {
            if (hook.attached)
            {
                grapplingLoopSound.Play();

                Vector3 value     = hook.transform.position - front.position;
                Vector3 a         = Vector3.Normalize(value);
                float   magnitude = value.magnitude;

                if (magnitude > 1f)
                {
                    if (!IsUnderwater() && Exosuit.transform.position.y + 0.2f >= grapplingStartPos.y)
                    {
                        a.y = Mathf.Min(a.y, 0f);
                    }

                    Exosuit.GetComponent <Rigidbody>().AddForce(a * exosuitGrapplingAccel, ForceMode.Acceleration);
                    hook.GetComponent <Rigidbody>().AddForce(-a * 400f, ForceMode.Force);
                }

                rope.SetIsHooked();
            }
            else if (hook.flying)
            {
                if ((hook.transform.position - front.position).magnitude > maxDistance)
                {
                    ResetHook();
                }
                grapplingLoopSound.Play();
            }
            else
            {
                grapplingLoopSound.Stop();
            }
        }
コード例 #20
0
 static void Postfix(Exosuit __instance) => __instance.GetComponent <PrawnSonarControl>()?.setPlayerInside(false);
コード例 #21
0
        public void OnShoot()
        {
            EnergyInterface energyInterface = exosuit.GetComponent <EnergyInterface>();

            energyInterface.GetValues(out float charge, out float capacity);

            if (charge > 0f)
            {
                float d = Mathf.Clamp01(charge / 4f);

                Vector3 forward  = MainCamera.camera.transform.forward;
                Vector3 position = MainCamera.camera.transform.position;

                int hits = UWE.Utils.SpherecastIntoSharedBuffer(position, 1f, forward, 35f, ~(1 << LayerMask.NameToLayer("Player")), QueryTriggerInteraction.UseGlobal);

                float targetMass = 0f;

                for (int i = 0; i < hits; i++)
                {
                    RaycastHit raycastHit = UWE.Utils.sharedHitBuffer[i];

                    Vector3 point = raycastHit.point;

                    float magnitude = (position - point).magnitude;

                    float d2 = 1f - Mathf.Clamp01((magnitude - 1f) / 35f);

                    GameObject targetObject = UWE.Utils.GetEntityRoot(raycastHit.collider.gameObject);

                    if (targetObject == null)
                    {
                        targetObject = raycastHit.collider.gameObject;
                    }

                    Rigidbody component = targetObject.GetComponent <Rigidbody>();

                    if (component != null)
                    {
                        targetMass += component.mass;

                        bool flag = true;

                        targetObject.GetComponents(iammo);

                        for (int j = 0; j < iammo.Count; j++)
                        {
                            if (!iammo[j].GetAllowedToShoot())
                            {
                                flag = false;
                                break;
                            }
                        }

                        iammo.Clear();

                        if (flag && !(raycastHit.collider is MeshCollider) && (targetObject.GetComponent <Pickupable>() != null || targetObject.GetComponent <Living>() != null || (component.mass <= 2600f && UWE.Utils.GetAABBVolume(targetObject) <= 800f)))
                        {
                            float   d3       = 1f + component.mass * 0.005f;
                            Vector3 velocity = forward * d2 * d * 140f / d3;
                            ShootObject(component, velocity);
                        }
                    }
                }

                energyInterface.ConsumeEnergy(4f);

                fxControl.Play();

                callBubblesFX = true;

                Utils.PlayFMODAsset(shootSound, transform, 20f);
            }
        }