mirror of
https://github.com/norohind/EDMC-FCTracker.git
synced 2025-06-07 10:43:00 +03:00
CarrierJump missing workaround refactor
This commit is contained in:
parent
9e79815fba
commit
e47ba96e71
14
load.py
14
load.py
@ -3,7 +3,6 @@ import functools
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import threading
|
import threading
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
@ -32,7 +31,6 @@ class This:
|
|||||||
For holding global variables
|
For holding global variables
|
||||||
"""
|
"""
|
||||||
|
|
||||||
music_flag_1: bool = False
|
|
||||||
webhooks_overrided_name: tk.StringVar
|
webhooks_overrided_name: tk.StringVar
|
||||||
webhooks_urls: list[tk.StringVar]
|
webhooks_urls: list[tk.StringVar]
|
||||||
|
|
||||||
@ -290,19 +288,23 @@ def journal_entry_decorator(func: callable) -> callable:
|
|||||||
The decorator aimed to solve problem with missing CarrierJump event.
|
The decorator aimed to solve problem with missing CarrierJump event.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
music_flag_1 = False
|
||||||
|
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def decorated(cmdr, is_beta, system, station, entry, state):
|
def decorated(cmdr, is_beta, system, station, entry, state):
|
||||||
|
nonlocal music_flag_1
|
||||||
|
|
||||||
event: str = entry['event']
|
event: str = entry['event']
|
||||||
if event == 'Music' and entry.get('MusicTrack') == 'NoInGameMusic':
|
if event == 'Music' and entry.get('MusicTrack') == 'NoInGameMusic':
|
||||||
this.music_flag_1 = True
|
music_flag_1 = True
|
||||||
|
|
||||||
elif event == 'Location' and this.music_flag_1:
|
elif event == 'Location' and music_flag_1:
|
||||||
entry['event'] = 'CarrierJump'
|
entry['event'] = 'CarrierJump'
|
||||||
this.music_flag_1 = False
|
music_flag_1 = False
|
||||||
logger.info(f'Generating synthetic CarrierJump')
|
logger.info(f'Generating synthetic CarrierJump')
|
||||||
|
|
||||||
elif event.lower() == 'shutdown' or event in ('Location', 'LoadGame', 'CarrierJump'):
|
elif event.lower() == 'shutdown' or event in ('Location', 'LoadGame', 'CarrierJump'):
|
||||||
this.music_flag_1 = False
|
music_flag_1 = False
|
||||||
|
|
||||||
return func(cmdr, is_beta, system, station, entry, state)
|
return func(cmdr, is_beta, system, station, entry, state)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user