mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Temporary Workaround for weapon save compat
Adds a temporary workaround for save game loading when weapon data got removed and can not be updated anymore. This can lead to some unexpected behaviour especially when generating the next turn miz as pydcs will most likely crash. This could be solved by just changing the loadout (not tested yet)
This commit is contained in:
parent
26f3bf5827
commit
d23b1fbb2c
@ -52,8 +52,13 @@ class Weapon:
|
||||
|
||||
def __setstate__(self, state: dict[str, Any]) -> None:
|
||||
# Update any existing models with new data on load.
|
||||
updated = Weapon.with_clsid(state["clsid"])
|
||||
state.update(updated.__dict__)
|
||||
try:
|
||||
updated = Weapon.with_clsid(state["clsid"])
|
||||
state.update(updated.__dict__)
|
||||
except KeyError:
|
||||
logging.exception(
|
||||
f'CLSID {state["clsid"]} is not available anymore. This could potentially lead to some unexpected results when generating the next turn miz. To solve this issue it is recommended to update the loadout of all affected flights.'
|
||||
)
|
||||
self.__dict__.update(state)
|
||||
|
||||
@classmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user