Flohhhhh / ultimate-lighting-controller

An all-in-one lighting controller for Non-ELS vehicles in FiveM
https://docs.dwnstr.com/ulc/overview
Other
42 stars 14 forks source link

Add: Smart stage controls #32

Open Flohhhhh opened 3 months ago

Flohhhhh commented 3 months ago

Currently, standard stage systems don't fully work properly.

Consider example:

Button 1 = Stage 1 Button 2 = Stage 2 Button 3 = Stage 3

This works as expected with Stage 3 enabling all 3 buttons etc.

The issue is that pressing Button 1 while in Stage 3 doesn't behave as expected. It shuts off all 3 buttons since stage 1 is already enabled in Stage 3, it wants to turn it off.

Solution could be to keep track of the current "stage" based on configuration, check if a button is a stage, and only disable it if the stage is the current stage, otherwise just trigger it's offExtras, oppositeExtras, etc.

Flohhhhh commented 3 months ago

I think this is fixed? https://github.com/user-attachments/assets/8fe95e18-01f1-4d24-a653-dced8300db46

Flohhhhh commented 3 months ago

It's mostly working, just need to test.

One key concern would be what happens when other features try to use buttons that are stages.

Once tested, the plan is to add functionality for stage upgrade and downgrade buttons.

Update: Testing with Horn Extras it works fine, only the extra itself is toggled and no stage things are happening All "setStage" calls are set to extraOnly in horn extras

Need to check if any other features use stage changes with propagation to the additional extras

Update: upon checking, every feature uses extraOnly during stage changes, should not encounter any issues there.

Flohhhhh commented 2 months ago

config changes:

  stages = {
    --useStages = true,
    --stageKeys = {1, 2, 3}
  },

need to add warnings too