Mmmwelll,
I was playing fo2 and the hell they still didn't fix timeouts...
Then decided I'm gonna show how... (I still haven't done this on my prototype... will serve.)
Well so why are the timeouts freezing that way?...
The answer is that it is an engine's internal feature, it's not bad at all when you do the required work to make it work...
So the drugs are handled through critter time event.
For reference
https://github.com/wladimiiir/vault112/blob/master/Server/scripts/drugs.fos (but timeouts handling is missing)
formula to set timeout is (example for a psycho):
duration = DrugEffects[ index + TABLE_DURATION( stage ) ];
cr.TimeoutBase[ TO_PSYCHO ] = __FullSecond + ( duration * 60 );
By now engine handles timeout and freeze them when you are in turn based mode.
For an accurate timeout handling we need to pick chosen time events related to drugs and read all durations to update
chosen.TimeoutBase[*]
You'll usually do this into the function that terminate turn based mode... To read time event durations...
// DrugsIdentifiers from drugs.fos's defines
int[] identifiers;
uint[] indexes, duration, rates;
uint count = cr.GetTimeEvents( DrugsIdentifiers, identifiers, indexes, duration, rates );
for( uint i = 0; i < count; i++ )
Log( "identifiers:"+identifiers[i]+", indexes:"+indexes[i]+", duration:"+duration[i]+", rates:"+rates[i] );
Now you can easily update timeouts correctly...
Enjoy.