daid / EmptyEpsilon

Open source bridge simulator. Build with the SeriousProton engine.
https://daid.github.io/EmptyEpsilon/
GNU General Public License v2.0
531 stars 181 forks source link

[suggestion] - new hardware event for game shutdown. #614

Closed gwaland closed 5 years ago

gwaland commented 5 years ago

I've been trying to figure out a good way to do this but my lackluster c++ skills are obviously failing me in wrapping my head around the event system for hardware.

What I'm looking for is an event or trigger the get called before engine->shutdown() is called which will let me set something like this in the hardware.ini:

[event] trigger = Shutdown target = Livingroom value = [0],[0],[0],[0]

This way when the game exits I can have it clean up the settings of my DMX/SACN/hardware lights to allow for a more clean shutdown of the game.

Fouindor commented 5 years ago

I have not tested DMX yet so this may not be applicable. But maybe you can use the HasShip condition, so you can shut off the light when you don't have a ship.

So maybe something like :

[state]
condition = HasShip == 0 
target = Livingroom
value = [0],[0],[0],[0]
daid commented 5 years ago

Getting a shutdown event is actually pretty difficult, as everything is being shut down and closed, so even if the hardware subsystem gets an event for this, it's difficult to ensure that this update is actually send to hardware, without causing a shutdown delay.