mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Will now append the date and time in the Pretense savefile, mitigating risks of missions script errors when trying to load a savefile from a previously generated mission.
This commit is contained in:
@@ -5,6 +5,7 @@ import os
|
|||||||
import random
|
import random
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Optional
|
from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
@@ -848,6 +849,12 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
|
|
||||||
trigger = TriggerStart(comment="Pretense init")
|
trigger = TriggerStart(comment="Pretense init")
|
||||||
|
|
||||||
|
now = datetime.now()
|
||||||
|
date_time = now.strftime("%Y-%d-%mT%H_%M_%S")
|
||||||
|
lua_string_savefile = (
|
||||||
|
f"local savefile = 'pretense_retribution_{date_time}.json'"
|
||||||
|
)
|
||||||
|
|
||||||
init_header_file = open("./resources/plugins/pretense/init_header.lua", "r")
|
init_header_file = open("./resources/plugins/pretense/init_header.lua", "r")
|
||||||
init_header = init_header_file.read()
|
init_header = init_header_file.read()
|
||||||
|
|
||||||
@@ -1001,7 +1008,8 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
init_footer = init_footer_file.read()
|
init_footer = init_footer_file.read()
|
||||||
|
|
||||||
lua_string = (
|
lua_string = (
|
||||||
init_header
|
lua_string_savefile
|
||||||
|
+ init_header
|
||||||
+ lua_string_zones
|
+ lua_string_zones
|
||||||
+ lua_string_connman
|
+ lua_string_connman
|
||||||
+ init_body_1
|
+ init_body_1
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
local savefile = 'pretense_1.1.json'
|
if lfs then
|
||||||
if lfs then
|
|
||||||
local dir = lfs.writedir()..'Missions/Saves/'
|
local dir = lfs.writedir()..'Missions/Saves/'
|
||||||
lfs.mkdir(dir)
|
lfs.mkdir(dir)
|
||||||
savefile = dir..savefile
|
savefile = dir..savefile
|
||||||
|
|||||||
Reference in New Issue
Block a user