JMOT.time

 1from JMOT import connect, extra
 2from typing import Literal
 3
 4_TIME_SIGNALS = {
 5    'time_since_launch':220,
 6    'total_time':221,
 7    'frame_delta_time':222,
 8    'warp_amount':223,
 9    'real_time':224,
10    'set_time_mode':40
11}
12
13def time_since_launch()->float:
14    '''Get the time since the current vessel's launch in seconds.'''
15    rec = connect._send_message(f"true<<{_TIME_SIGNALS['time_since_launch']}")
16    return rec[0]
17def total_time()->float:
18    '''Get the total time since the start of the game in seconds.'''
19    rec = connect._send_message(f"true<<{_TIME_SIGNALS['total_time']}")
20    return rec[0]
21def frame_delta_time()->float:
22    '''Get the time elapsed since the last frame in seconds.'''
23    rec = connect._send_message(f"true<<{_TIME_SIGNALS['frame_delta_time']}")
24    return rec[0]
25def warp_amount()->float:
26    '''Get the current time warp factor.'''
27    rec = connect._send_message(f"true<<{_TIME_SIGNALS['warp_amount']}")
28    return rec[0]
29def real_time()->float:
30    '''Get the current real time since create of the game in seconds.'''
31    rec = connect._send_message(f"true<<{_TIME_SIGNALS['real_time']}")
32    return rec[0]
33def set_time_mode(time_mode:Literal[-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13]):
34    '''
35    time_mode:the time mode of the vessel,\n
36        -1:0.05x\n
37        0:pause\n
38        1:normal\n
39        2:fast(10x)\n
40        3:25x\n
41        4:100x\n
42        5:500x\n
43        6:2500x\n
44        7:1W x\n
45        8:5W x\n
46        9:25W x\n
47        10:100W x\n
48        11:500W x\n
49        12:2500W x\n
50        13:1Y x
51    '''
52    ack = connect._send_message(f"false<<{_TIME_SIGNALS['set_time_mode']}<<{time_mode}")
53    connect._verify(ack)
def time_since_launch() -> float:
14def time_since_launch()->float:
15    '''Get the time since the current vessel's launch in seconds.'''
16    rec = connect._send_message(f"true<<{_TIME_SIGNALS['time_since_launch']}")
17    return rec[0]

Get the time since the current vessel's launch in seconds.

def total_time() -> float:
18def total_time()->float:
19    '''Get the total time since the start of the game in seconds.'''
20    rec = connect._send_message(f"true<<{_TIME_SIGNALS['total_time']}")
21    return rec[0]

Get the total time since the start of the game in seconds.

def frame_delta_time() -> float:
22def frame_delta_time()->float:
23    '''Get the time elapsed since the last frame in seconds.'''
24    rec = connect._send_message(f"true<<{_TIME_SIGNALS['frame_delta_time']}")
25    return rec[0]

Get the time elapsed since the last frame in seconds.

def warp_amount() -> float:
26def warp_amount()->float:
27    '''Get the current time warp factor.'''
28    rec = connect._send_message(f"true<<{_TIME_SIGNALS['warp_amount']}")
29    return rec[0]

Get the current time warp factor.

def real_time() -> float:
30def real_time()->float:
31    '''Get the current real time since create of the game in seconds.'''
32    rec = connect._send_message(f"true<<{_TIME_SIGNALS['real_time']}")
33    return rec[0]

Get the current real time since create of the game in seconds.

def set_time_mode(time_mode: Literal[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]):
34def set_time_mode(time_mode:Literal[-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13]):
35    '''
36    time_mode:the time mode of the vessel,\n
37        -1:0.05x\n
38        0:pause\n
39        1:normal\n
40        2:fast(10x)\n
41        3:25x\n
42        4:100x\n
43        5:500x\n
44        6:2500x\n
45        7:1W x\n
46        8:5W x\n
47        9:25W x\n
48        10:100W x\n
49        11:500W x\n
50        12:2500W x\n
51        13:1Y x
52    '''
53    ack = connect._send_message(f"false<<{_TIME_SIGNALS['set_time_mode']}<<{time_mode}")
54    connect._verify(ack)

time_mode:the time mode of the vessel,

-1:0.05x

0:pause

1:normal

2:fast(10x)

3:25x

4:100x

5:500x

6:2500x

7:1W x

8:5W x

9:25W x

10:100W x

11:500W x

12:2500W x

13:1Y x