private static float GetDistance(PlayerDistanceTracker tracker)
        {
            // If the object is null, ship hasn't exploded yet or radius is too small
            if (!RadiationUtils.isSurfaceRadiationActive())
            {
                return(tracker.distanceToPlayer);
            }

            // How deep the player is
            float playerDepth    = Math.Max(0, -Player.main.transform.position.y);
            float radiationDepth = RadiationUtils.getRadiationDepth();

            // If they are deeper than the radiation, return
            if (playerDepth > radiationDepth)
            {
                return(tracker.distanceToPlayer);
            }

            // When radiation is fixed, avoid a "long tail-off" near the surface
            if (RadiationUtils.isRadiationFixed())
            {
                if (radiationDepth <= 15)
                {
                    return(tracker.distanceToPlayer);
                }
            }

            // A % of how close they are to getting out of radiation
            float playerRadiationStrength = playerDepth / radiationDepth;

            //ErrorMessage.AddMessage("Player: " + playerDepth + "   RadDepth: " + radiationDepth + "   RadStr: " + playerRadiationStrength + "   Dist: " + Math.Min(tracker.distanceToPlayer, tracker.maxDistance * playerRadiationStrength));

            return(Math.Min(tracker.distanceToPlayer, tracker.maxDistance * playerRadiationStrength));
        }
Beispiel #2
0
        /**
         * Checks if player is currently prevented from picking up food items on the island.
         */
        private static bool GetPreventPickup(Transform transform)
        {
            // If we're always allowed island food, no need to trouble ourselves
            if (Config.ALWAYS.Equals(DeathRun.config.islandFood))
            {
                return(false);
            }

            // If player is underwater, or is in a base or escape pod. Return false
            if (transform.position.y <= -1 || Player.main.IsInsideWalkable())
            {
                return(false);
            }

            // If we're never allowed island food, then we're just never allowed it!
            if (Config.NEVER.Equals(DeathRun.config.islandFood))
            {
                return(true);
            }

            // If the radiation can't be checked, or the ship hasn't exploded
            if (LeakingRadiation.main == null || !CrashedShipExploder.main.IsExploded())
            {
                // Then it's before the ship exploded
                return(Config.AFTER.Equals(DeathRun.config.islandFood));
            }

            // If radiation is still active
            return(RadiationUtils.isSurfaceRadiationActive());
        }