public void DoGlitch() { glitchEvents.ResetExecution(); doGlitch = true; }
public override void Process() { if (_isDead) { Vehicle.FuelLevel = 0; if (_lightsOn) { Vehicle.SetLightsMode(LightsMode.AlwaysOn); Vehicle.SetLightsBrightness(_lightsBrightness); } } if (Mods.Reactor != ReactorType.Nuclear && _firstTimeTravel) { if (_isDead) { Stop(); } _firstTimeTravel = false; } if (Game.GameTime < _nextCheck || !_firstTimeTravel || !Vehicle.IsVisible) { return; } if (Vehicle.Speed == 0 && !_isDead && !IsFueled) { var random = Utils.Random.NextDouble(); if (random > 0.75) { Vehicle.GetLightsState(out _lightsOn, out _highbeamsOn); if (_highbeamsOn) { Vehicle.AreHighBeamsOn = false; } _lightsBrightness = 1; timedEventManager.ClearEvents(); int _timeStart = 0; int _timeEnd = _timeStart + 99; for (int i = 0; i < 3; i++) { timedEventManager.Add(0, 0, _timeStart, 0, 0, _timeEnd); timedEventManager.Last.SetFloat(1, 0.1f); timedEventManager.Last.OnExecute += Last_OnExecute; _timeStart = _timeEnd + 1; _timeEnd = _timeStart + 99; } for (int i = 0; i < 3; i++) { timedEventManager.Add(0, 0, _timeStart, 0, 0, _timeEnd); timedEventManager.Last.SetFloat(1, 0.1f); timedEventManager.Last.OnExecute += Last_OnExecute; _timeStart = _timeEnd + 1; _timeEnd = _timeStart + 199; } for (int i = 0; i < 3; i++) { timedEventManager.Add(0, 0, _timeStart, 0, 0, _timeEnd); timedEventManager.Last.SetFloat(1, 0.1f); timedEventManager.Last.OnExecute += Last_OnExecute; _timeStart = _timeEnd + 1; _timeEnd = _timeStart + 99; } _isDead = true; } else { _nextCheck = Game.GameTime + 1000; return; } } if (_isDead) { if (!ModSettings.EngineStallEvent) { Stop(); Vehicle.FuelLevel = _deloreanMaxFuelLevel; Vehicle.IsEngineRunning = true; _nextCheck = Game.GameTime + 10000; return; } if ((Game.IsControlPressed(GTA.Control.VehicleAccelerate) || Game.IsControlPressed(GTA.Control.VehicleBrake)) && Main.PlayerVehicle == Vehicle) { if (timedEventManager.AllExecuted()) { timedEventManager.ResetExecution(); } timedEventManager.RunEvents(); if (!_isRestarting) { _restarter.Play(); _restartAt = Game.GameTime + Utils.Random.Next(3000, 10000); _isRestarting = true; } if (Game.GameTime > _restartAt) { Stop(); Vehicle.FuelLevel = _deloreanMaxFuelLevel; Vehicle.IsEngineRunning = true; _nextCheck = Game.GameTime + 10000; return; } } else { _lightsBrightness = 1; timedEventManager.ResetExecution(); _isRestarting = false; _restarter.Stop(); } } _nextCheck = Game.GameTime + 100; }