Ejemplo n.º 1
0
        public void SetCarAbilities(bool singleRaceStarted)
        {
            CarLogic car = G.Sys.PlayerManager_.Current_.playerData_.CarLogic_;

            try
            {
                RandoMap map = randoGame.maps[Game.LevelName];
                if (!singleRaceStarted)
                {
                    jumpShouldBeEnabled  = map.jumpEnabled;
                    wingsShouldBeEnabled = map.wingsEnabled;
                    jetsShouldBeEnabled  = map.jetsEnabled;
                }
                car.Boost_.AbilityEnabled_ = map.boostEnabled;
                car.Jump_.AbilityEnabled_  = jumpShouldBeEnabled;
                car.Wings_.AbilityEnabled_ = wingsShouldBeEnabled;
                car.Jets_.AbilityEnabled_  = jetsShouldBeEnabled;

                // Disable stock show scores so we can display our own thing.
                car.CarLogicLocal_.PlayerDataLocal_.EnableOrDisableShowScores(false);

                Console.WriteLine($"Jump {car.Jump_.AbilityEnabled_} - Wings {car.Wings_.AbilityEnabled_} - Jets {car.Jets_.AbilityEnabled_}");
            }
            catch (KeyNotFoundException)
            {
                // this should only ever happen on Credits or Destination Unknown, so just enable everything
                car.Boost_.AbilityEnabled_ = true;
                car.Jump_.AbilityEnabled_  = true;
                car.Wings_.AbilityEnabled_ = true;
                car.Jets_.AbilityEnabled_  = true;
            }

            car.GetComponent <LocalPlayerControlledCar>().showBackToResetWarning_ = false;
        }
        public static bool SetCorruptionEnabled(PlayerDataBase playerData, bool corruptionEnabled, ref WingCorruptionZone __instance)
        {
            if (Cheats.CheatHandler.Instance.Cheats.AlwaysEnableWings && corruptionEnabled)
            {
                Util.Logger.Instance.Log("[WingCorruptionZonePatch-SetCorruptionEnabled] Stopped a Wing Corruption Zone from disabling flight");
                return(false);
            }

            CarLogic    carLogic = playerData.CarLogic_;
            WingsGadget wings    = carLogic.Wings_;

            if (wings != null)
            {
                wings.SetAbilityEnabled(!corruptionEnabled, __instance.showAbilityAlert);
            }
            carLogic.GetComponent <CutPlaneShaderController>().CorruptionEffectActive_ = corruptionEnabled;

            return(false);
        }