Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dcs/unitgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ def __init__(self, _id, name=None, start_time=0):
self.uncontrolled = False
self.radio_set = False
self.task = "CAS"
self.password = None
self.units = [] # type: List[FlyingUnit]
self.nav_target_points = [] # type: List[NavTargetPoint]

Expand Down Expand Up @@ -363,6 +364,10 @@ def load_from_dict(self, d: Dict[str, Any], terrain: Terrain) -> None:
self.modulation = d.get("modulation")
self.communication = d.get("communication", False)
self.uncontrolled = d["uncontrolled"]
try:
self.password = d["password"]
except KeyError:
self.password = None
Comment on lines +367 to +370
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace by self.password = d.get("password") ?

self.radio_set = d.get("radioSet", False)
self.nav_target_points = []
for n in d.get("NavTargetPoints", []):
Expand Down Expand Up @@ -528,6 +533,8 @@ def dict(self):
d["modulation"] = self.modulation
d["communication"] = self.communication
d["uncontrolled"] = self.uncontrolled
if self.password is not None:
d["password"] = self.password
d["radioSet"] = self.radio_set

if self.nav_target_points:
Expand Down