vMenu icon indicating copy to clipboard operation
vMenu copied to clipboard

Add Event Trigger for Infinite Fuel Toggle

Open coleminer0112 opened this issue 2 years ago • 6 comments

Allows custom fuel resources to watch for infinite fuel in vMenu within other client-sided scripts.

Event name: "vMenu:InfiniteFuelToggled" Passes one arg, the boolean representing whether the box is checked or not

coleminer0112 avatar Dec 26 '21 17:12 coleminer0112

I'm pretty sure you also need to register the event, so people can just AddEventHandler to it in their script.

MichaelCoding25 avatar Dec 26 '21 17:12 MichaelCoding25

I'm pretty sure you also need to register the event, so people can just AddEventHandler to it in their script.

It doesn't require registering unless it's going across the Net, which it isn't - it is a client side only event

coleminer0112 avatar Dec 26 '21 19:12 coleminer0112

I have a suggestion for an additional change, that'd make this more useful, whenever the resource loads and it sets the original value form the saved preferences, it should trigger the event once so your other resource has a chance of knowing what the status is once a player joins and doesn't toggle it manually. Or exposing an export function that gets the current value.

TomGrobbe avatar May 05 '22 20:05 TomGrobbe

Other than that it's a useful feature

TomGrobbe avatar May 05 '22 20:05 TomGrobbe

Could you rebase your changes based on the latest development branch and resolve the conflicts please?

TomGrobbe avatar Mar 04 '23 17:03 TomGrobbe

I have a suggestion for an additional change, that'd make this more useful, whenever the resource loads and it sets the original value form the saved preferences, it should trigger the event once so your other resource has a chance of knowing what the status is once a player joins and doesn't toggle it manually. Or exposing an export function that gets the current value.

The current development version has no userDefault for this setting, so it may not be necessary to do an initial check!

Also, I rebased, but I am not a Git-master... so I am unsure why it is now 3 commits despite only the 1 change.

coleminer0112 avatar Mar 07 '23 22:03 coleminer0112