public TCDHandler(TimeCircuits circuits) : base(circuits) { destinationSlot = new TCDSlot("red", GUI, circuits); destinationSlot.SetVisible(false); presentSlot = new TCDSlot("green", GUI, circuits); presentSlot.SetVisible(false); previousSlot = new TCDSlot("yellow", GUI, circuits); previousSlot.SetVisible(false); beep = circuits.AudioEngine.Create("general/timeCircuits/beep.wav", Presets.Interior); fluxCapacitor = circuits.AudioEngine.Create("general/fluxCapacitor.wav", Presets.InteriorLoop); fluxCapacitor.Volume = 0.1f; fluxCapacitor.MinimumDistance = 0.5f; beep.MinimumDistance = 0.3f; fluxCapacitor.SourceBone = "flux_capacitor"; beep.SourceBone = "bttf_tcd_green"; tickingDiodes = new AnimateProp(circuits.Delorean, ModelHandler.TickingDiodes, Vector3.Zero, Vector3.Zero); tickingDiodesOff = new AnimateProp(circuits.Delorean, ModelHandler.TickingDiodesOff, Vector3.Zero, Vector3.Zero); tickingDiodesOff.SpawnProp(); TimeCircuits.OnTimeCircuitsToggle += OnTimeCircuitsToggle; TimeCircuits.OnDestinationDateChange += OnDestinationDateChange; TimeCircuits.OnScaleformPriority += OnScaleformPriority; TimeCircuits.OnTimeTravel += OnTimeTravel; TimeCircuits.OnTimeTravelComplete += OnTimeTravelComplete; int _time = 0; for (int i = 0; i < 7; i++) { glitchEvents.Add(0, 0, _time, 0, 0, _time + 499); glitchEvents.Last.OnExecute += Blank_OnExecute; _time += 500; glitchEvents.Add(0, 0, _time, 0, 0, _time + 199); glitchEvents.Last.OnExecute += RandomDate_OnExecute; _time += 200; glitchEvents.Add(0, 0, _time, 0, 0, _time + 499); glitchEvents.Last.OnExecute += ErrorDate_OnExecute; _time += 500; } }
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; }