コード例 #1
0
        public static bool Prefix(ExosuitGrapplingArm __instance, GrapplingHook ___hook)
        {
            Exosuit componentInParent = __instance.GetComponentInParent <Exosuit>();

            if (componentInParent != null)
            {
                if (!componentInParent.GetPilotingMode())
                {
                    // We suppress this method if it is called from another player pilot, so we can use our own implementation
                    // See: ExosuitModuleEvents.UseGrapplingarm -> onHit Section
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
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);
                }
            }
        }
コード例 #3
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);
                }
            }
        }
コード例 #4
0
        new public void OnHit()
        {
            Exosuit componentInParent = base.GetComponentInParent <Exosuit>();

            if (componentInParent.CanPilot() && componentInParent.GetPilotingMode())
            {
                Vector3    position   = default;
                GameObject gameObject = null;
                Vector3    vector;
                UWE.Utils.TraceFPSTargetPosition(componentInParent.gameObject, 6.5f, ref gameObject, ref position, out vector, true);
                if (gameObject == null)
                {
                    InteractionVolumeUser component = Player.main.gameObject.GetComponent <InteractionVolumeUser>();
                    if (component != null && component.GetMostRecent() != null)
                    {
                        gameObject = component.GetMostRecent().gameObject;
                    }
                }
                if (gameObject)
                {
                    LiveMixin liveMixin = gameObject.FindAncestor <LiveMixin>();
                    if (liveMixin)
                    {
                        liveMixin.IsAlive();
                        liveMixin.TakeDamage(50f, position, DamageType.Normal, null);
                        // Originally the change was from Normal to Electrical, but there should be a Normal component and an Electrical.
                        // Without a Normal component to the damage, Eye Jellies (to use one example) give no f***s about being twatted in the eye with a Lightning Claw.
                        // That's not right; even if the electrical damage does nothing for them, it's a chunk of heavy metal being propelled at high speed by precision hydraulics.
                        Log.LogDebug($"ExosuitLightningClaw: inflicting Electrical damage on target {gameObject.ToString()}");
                        liveMixin.TakeDamage(30f, position, DamageType.Electrical, null);                         // Animals treat this as over 1000 damage when deciding whether to flee or not.
                        // Curiously, Snow Stalkers appear to give no f***s about any sort of damage, and will continue pursuing until you either get beyond their
                        // "bollocks to this" range, or until they are dead.
                        global::Utils.PlayFMODAsset(base.hitFishSound, this.front, 50f);
                    }
                    else
                    {
                        global::Utils.PlayFMODAsset(base.hitTerrainSound, this.front, 50f);
                    }
                    VFXSurface component2 = gameObject.GetComponent <VFXSurface>();
                    Vector3    euler      = MainCameraControl.main.transform.eulerAngles + new Vector3(300f, 90f, 0f);
                    VFXSurfaceTypeManager.main.Play(component2, base.vfxEventType, position, Quaternion.Euler(euler), componentInParent.gameObject.transform);
                    gameObject.SendMessage("BashHit", this, SendMessageOptions.DontRequireReceiver);
                }
            }
        }
コード例 #5
0
        public static void Postfix(Exosuit __instance)
        {
            if (__instance.GetPilotingMode())
            {
                var pda = PDA_Awake_Patch.Pda;

                //Access the ugprade
                foreach (var button in QPatch.UpgradeButtons)
                {
                    if (GameInput.GetButtonDown(button))
                    {
                        if (pda != null && pda.isOpen)
                        {
                            pda.Close();
                        }
                        else
                        {
                            __instance.upgradesInput.OpenFromExternal();
                        }
                        return;
                    }
                }

                //Access my storage
                foreach (var button in QPatch.StorageButtons)
                {
                    if (GameInput.GetButtonDown(button))
                    {
                        if (pda != null && pda.isOpen)
                        {
                            pda.Close();
                        }
                        else
                        {
                            __instance.storageContainer.Open();
                        }
                        return;
                    }
                }
            }
        }
コード例 #6
0
        public void OnHit()
        {
            if (Exosuit.CanPilot() && Exosuit.GetPilotingMode())
            {
                Vector3    position     = default(Vector3);
                GameObject targetObject = null;

                UWE.Utils.TraceFPSTargetPosition(Exosuit.gameObject, 6.5f, ref targetObject, ref position, true);

                if (targetObject == null)
                {
                    InteractionVolumeUser component = Player.main.gameObject.GetComponent <InteractionVolumeUser>();
                    if (component != null && component.GetMostRecent() != null)
                    {
                        targetObject = component.GetMostRecent().gameObject;
                    }
                }
                if (targetObject)
                {
                    LiveMixin liveMixin = targetObject.FindAncestor <LiveMixin>();
                    if (liveMixin)
                    {
                        bool flag = liveMixin.IsAlive();
                        liveMixin.TakeDamage(50f, position, DamageType.Normal, null);
                        Utils.PlayFMODAsset(hitFishSound, front, 50f);
                    }
                    else
                    {
                        Utils.PlayFMODAsset(hitTerrainSound, front, 50f);
                    }
                    VFXSurface component2 = targetObject.GetComponent <VFXSurface>();
                    Vector3    euler      = MainCameraControl.main.transform.eulerAngles + new Vector3(300f, 90f, 0f);
                    VFXSurfaceTypeManager.main.Play(component2, vfxEventType, position, Quaternion.Euler(euler), Exosuit.gameObject.transform);
                    targetObject.SendMessage("BashHit", this, SendMessageOptions.DontRequireReceiver);
                }
            }
        }
コード例 #7
0
        public void OnHit()
        {
            if (Exosuit.CanPilot() && Exosuit.GetPilotingMode())
            {
                Vector3    pos       = Vector3.zero;
                GameObject hitObject = null;
                drillTarget = null;

                UWE.Utils.TraceFPSTargetPosition(Exosuit.gameObject, attackDist, ref hitObject, ref pos, true);

                if (hitObject == null)
                {
                    InteractionVolumeUser component = Player.main.gameObject.GetComponent <InteractionVolumeUser>();

                    if (component != null && component.GetMostRecent() != null)
                    {
                        hitObject = component.GetMostRecent().gameObject;
                    }
                }
                if (hitObject && drilling)
                {
                    var drillable = hitObject.FindAncestor <Drillable>();

                    loopHit.Play();

                    if (drillable)
                    {
                        drillable.OnDrill(fxSpawnPoint.position, Exosuit, out GameObject gameObject2);

                        if (!gameObject2)
                        {
                            StopEffects();
                        }

                        drillTarget = gameObject2;

                        if (fxControl.emitters[0].fxPS != null && !fxControl.emitters[0].fxPS.emission.enabled)
                        {
                            fxControl.Play(0);
                        }
                    }
                    else
                    {
                        LiveMixin liveMixin = hitObject.FindAncestor <LiveMixin>();

                        if (liveMixin)
                        {
                            bool flag = liveMixin.IsAlive();
                            liveMixin.TakeDamage(4f, pos, DamageType.Drill, null);
                            drillTarget = hitObject;
                        }

                        VFXSurface component2 = hitObject.GetComponent <VFXSurface>();

                        if (drillFXinstance == null)
                        {
                            drillFXinstance = VFXSurfaceTypeManager.main.Play(component2, vfxEventType, fxSpawnPoint.position, fxSpawnPoint.rotation, fxSpawnPoint);
                        }
                        else if (component2 != null && prevSurfaceType != component2.surfaceType)
                        {
                            VFXLateTimeParticles component3 = drillFXinstance.GetComponent <VFXLateTimeParticles>();
                            component3.Stop();
                            Destroy(drillFXinstance.gameObject, 1.6f);
                            drillFXinstance = VFXSurfaceTypeManager.main.Play(component2, vfxEventType, fxSpawnPoint.position, fxSpawnPoint.rotation, fxSpawnPoint);
                            prevSurfaceType = component2.surfaceType;
                        }

                        hitObject.SendMessage("BashHit", this, SendMessageOptions.DontRequireReceiver);
                    }
                }
                else
                {
                    StopEffects();
                }
            }
        }