コード例 #1
0
        public StrobedVehicle(Vehicle veh, Pattern pattern)
        {
            Vehicle = veh;
            Pattern = pattern;
            stagesCount = Pattern.Stages.Length;

            LeftHeadlight = new StrobedLight(this, VehicleLight.LeftHeadlight);
            RightHeadlight = new StrobedLight(this, VehicleLight.RightHeadlight);

            LeftTailLight = new StrobedLight(this, VehicleLight.LeftTailLight);
            RightTailLight = new StrobedLight(this, VehicleLight.RightTailLight);

            LeftBrakeLight = new StrobedLight(this, VehicleLight.LeftBrakeLight);
            RightBrakeLight = new StrobedLight(this, VehicleLight.RightBrakeLight);

            // with custom siren settings RPH fails to obtain the Vehicle's EmergencyLighting, if so don't disable the headlight and tail lights sequences
            EmergencyLighting defaultEmergencyLighting = Vehicle.DefaultEmergencyLighting;

            if (defaultEmergencyLighting == null)
            {
                defaultEmergencyLighting = Vehicle.EmergencyLighting;

                if (defaultEmergencyLighting == null)
                {
                    defaultEmergencyLighting = Vehicle.Model.EmergencyLighting;
                }
            }

            if (defaultEmergencyLighting != null)
            {
                Vehicle.EmergencyLightingOverride = defaultEmergencyLighting.Clone();
                Vehicle.EmergencyLightingOverride.RightHeadLightSequenceRaw = 0;
                Vehicle.EmergencyLightingOverride.RightTailLightSequenceRaw = 0;
                Vehicle.EmergencyLightingOverride.LeftHeadLightSequenceRaw = 0;
                Vehicle.EmergencyLightingOverride.LeftTailLightSequenceRaw = 0;
                disabledHeadTailLightsSequences = true;
            }
            else
            {
                disabledHeadTailLightsSequences = false;
            }
        }
コード例 #2
0
        public override void Update()
        {
            isPlayerInVehicle = Game.LocalPlayer.Character.IsInVehicle(Vehicle, false);
            
            base.Update();

            prevManuallyActive = manuallyActive;
            prevManualDisable = manualDisable;

            if (isPlayerInVehicle)
            {
                if (Control.Toggle.IsJustPressed())
                {
                    if(active)
                        manualDisable = !manualDisable;
                    else
                        manuallyActive = !manuallyActive;
                }
            }

            if (manuallyActive != prevManuallyActive)
                SetActive(manuallyActive);
            else if (manualDisable != prevManualDisable)
                SetActive(!manualDisable);

            if (Control.SwitchPattern.IsJustPressed())
            {
                int newIndex = currentPatternIndex + 1;
                if (newIndex >= Patterns.Length)
                    newIndex = 0;

                Pattern = Patterns[newIndex];
                Game.DisplaySubtitle($"~b~[Emergency Strobes]~s~ Switching to pattern ~y~{Pattern.Name}~s~");
                if (Settings.PlaySwitchSounds)
                    Settings.SwitchSound.Play();
            }
        }
コード例 #3
0
 private static bool ShouldEnableVehicleBrakeLightsForStage(Pattern.Stage stage)
 {
     PatternStageType t = stage.Type;
     if ((t & PatternStageType.LeftTailLight) == PatternStageType.LeftTailLight ||
        (t & PatternStageType.RightTailLight) == PatternStageType.RightTailLight ||
        (t & PatternStageType.LeftBrakeLight) == PatternStageType.LeftBrakeLight ||
        (t & PatternStageType.RightBrakeLight) == PatternStageType.RightBrakeLight)
         return true;
     return false;
 }
コード例 #4
0
 public PlayerStrobedVehicle(Vehicle veh, Pattern[] patterns) : base(veh, patterns[0])
 {
     Patterns = patterns;
     currentPatternIndex = 0;
 }