fixed zone protect SAMs triggers, added online version check

This commit is contained in:
spencer-ki 2022-03-20 11:13:09 -07:00
parent e8dbd54475
commit 543a98c559
6 changed files with 22 additions and 5 deletions

View File

@ -67,7 +67,7 @@ def handle_exception(exc_type, exc_value, exc_traceback):
sys.excepthook = handle_exception
build = 1
maj_version = 1
minor_version = 1
version_string = str(maj_version) + "." + str(minor_version)
@ -345,12 +345,27 @@ class Window(QMainWindow, Ui_MainWindow):
def nextScenario(self):
self.scenario_comboBox.setCurrentIndex((self.scenario_comboBox.currentIndex() + 1))
def checkVersion(self):
try:
url = user_files_url + 'versions.yaml'
r = requests.get(url, allow_redirects=False)
v = yaml.safe_load(r.content)
print(v["build"])
avail_build = v["build"]
if avail_build > build:
msg = QMessageBox()
msg.setWindowTitle("Update Available")
msg.setText(v["description"])
x = msg.exec_()
except:
logger.error("Online version check failed.")
def loadOnlineContent(self):
url = user_files_url + 'directory.yaml'
r = requests.get(url, allow_redirects=False)
user_files = yaml.safe_load(r.content)
count = 0
#todo: try/catch/fail here
# Download scenarios files
os.chdir(directories.scenarios)
@ -403,6 +418,7 @@ if __name__ == "__main__":
win = Window()
# win.show()
# win.loadOnlineContent()
win.checkVersion()
qtmodern.styles.dark(app)

View File

@ -534,7 +534,7 @@ class Ui_MainWindow(object):
self.actionAll.setChecked(True)
self.actionAll.setObjectName("actionAll")
self.actionMultiplayer = QtWidgets.QAction(MainWindow)
self.actionMultiplayer.setCheckable(True)
self.actionMultiplayer.setCheckable(False)
self.actionMultiplayer.setObjectName("actionMultiplayer")
self.actionAll_2 = QtWidgets.QAction(MainWindow)
self.actionAll_2.setCheckable(True)

View File

@ -1327,7 +1327,7 @@ padding: 4px;</string>
</action>
<action name="actionMultiplayer">
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="text">
<string>Multiplayer</string>

View File

@ -65,8 +65,9 @@ def triggerSetup(rops, options):
if options["zone_protect_sams"]:
for index, zone_name in enumerate(rops.conflict_zones):
z_sams_trig = dcs.triggers.TriggerOnce(comment="Deactivate " + zone_name + " SAMs")
z_sams_trig.rules.append(dcs.condition.FlagEquals(game_flag, index + 1))
z_sams_trig.actions.append(dcs.action.DoScript(
dcs.action.String("Group.destroy(Group.getByName('" + zone_name + " Protection SAM'))")))
dcs.action.String("Group.destroy(Group.getByName('Static " + zone_name + " Protection SAM'))")))
rops.m.triggerrules.triggers.append(z_sams_trig)
# Zone FARPS always

Binary file not shown.