mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Default overrides fix (#3307)
This PR makes sure that the Payload tab of the Edit Flight window shows the correct property values (with `default_overrides` applied in the aircraft YAML). It looks like the issue only affects an obscure parameter on F14s (INS reference alignment stored) so may not have been noticed until now.
This commit is contained in:
parent
ff2bd3f815
commit
48ae55bdc2
@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, replace as dataclasses_replace
|
||||
from functools import cache, cached_property
|
||||
from pathlib import Path
|
||||
from typing import Any, ClassVar, Dict, Iterator, Optional, TYPE_CHECKING, Type
|
||||
@ -400,6 +400,12 @@ class AircraftType(UnitType[Type[FlyingType]]):
|
||||
for k in config:
|
||||
if k in aircraft.property_defaults:
|
||||
aircraft.property_defaults[k] = config[k]
|
||||
# In addition to setting the property_defaults, we have to set the "default" property in the
|
||||
# value of aircraft.properties for the key, as this is used in parts of the codebase to get
|
||||
# the default value.
|
||||
aircraft.properties[k] = dataclasses_replace(
|
||||
aircraft.properties[k], default=config[k]
|
||||
)
|
||||
else:
|
||||
logging.warning(
|
||||
f"'{aircraft.id}' attempted to set default prop '{k}' that does not exist"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user