Repository: pydcs/dcs (language: python)

Issue:
Remove Scene Objects doesn't work
It seems that the attribute "meters" is no longer an attribute for this action (in old missions it was, however it didn't make much sense, since the zone itself already has a radius). So new missions using this can't be parsed, since pydcs expects the attribute to be present.

```
Attempting to load mission file C:/Users/DCSServerUser/Saved Games/DCS.openbeta_server/Missions/MasterArms_Training_CA_FullMap_ClearWeather.miz
Traceback (most recent call last):
  File "main.py", line 33, in <module>
  File "dcs\mission.py", line 355, in load_file
  File "dcs\triggers.py", line 211, in load_from_dict
  File "dcs\triggers.py", line 116, in create_from_dict
  File "dcs\action.py", line 1724, in create_from_dict
KeyError: 'meters'
[6920] Failed to execute script 'main' due to unhandled exception!
```


Discussion / hints:

Fix patch:
diff --git a/dcs/action.py b/dcs/action.py
index 033d0fde..fb8b5437 100644
--- a/dcs/action.py
+++ b/dcs/action.py
@@ -1713,50 +1713,42 @@ class RemoveSceneObjectsMask(IntEnum):
 class RemoveSceneObjects(Action):
     predicate = "a_remove_scene_objects"
 
-    def __init__(self, objects_mask: RemoveSceneObjectsMask = RemoveSceneObjectsMask.ALL, zone="", meters=1000):
+    def __init__(self, objects_mask: RemoveSceneObjectsMask = RemoveSceneObjectsMask.ALL, zone=""):
         super(RemoveSceneObjects, self).__init__(RemoveSceneObjects.predicate)
         self.objects_mask = objects_mask
         self.params.append(self.objects_mask)
         self.zone = zone
         self.params.append(self.zone)
-        # Note : the parameter meters is in the DCS save file, but seems unused, and not editable from ME
-        self.meters = meters
-        self.params.append(self.meters)
 
     @classmethod
     def create_from_dict(cls, d, mission):
-        return cls(RemoveSceneObjectsMask(d["objects_mask"]), d["zone"], d["meters"])
+        return cls(RemoveSceneObjectsMask(d["objects_mask"]), d["zone"])
 
     def dict(self):
         d = super(RemoveSceneObjects, self).dict()
         d["objects_mask"] = self.objects_mask.value
         d["zone"] = self.zone
-        d["meters"] = self.meters
         return d
 
 
 class SceneryDestructionZone(Action):
     predicate = "a_scenery_destruction_zone"
 
-    def __init__(self, destruction_level=100, zone="", meters=1000):
+    def __init__(self, destruction_level=100, zone=""):
         super(SceneryDestructionZone, self).__init__(SceneryDestructionZone.predicate)
         self.destruction_level = destruction_level
         self.params.append(self.destruction_level)
         self.zone = zone
         self.params.append(self.zone)
-        # Note : the parameter meters is in the DCS save file, but seems unused, and not editable from ME
-        self.meters = meters
-        self.params.append(self.meters)
 
     @classmethod
     def create_from_dict(cls, d, mission):
-        return cls(d["destruction_level"], d["zone"], d["meters"])
+        return cls(d["destruction_level"], d["zone"])
 
     def dict(self):
         d = super(SceneryDestructionZone, self).dict()
         d["destruction_level"] = self.destruction_level
         d["zone"] = self.zone
-        d["meters"] = self.meters
         return d
 
 


Test patch:
diff --git a/tests/test_mission.py b/tests/test_mission.py
index f9c8f004..9e585b09 100644
--- a/tests/test_mission.py
+++ b/tests/test_mission.py
@@ -591,7 +591,6 @@ def test_create_scenery_destruction_zone(self):
         self.assertEqual(m2.terrain.__class__, dcs.terrain.Caucasus)
         self.assertTrue(type(m2.triggerrules.triggers[0].actions[0]) is dcs.action.SceneryDestructionZone)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].destruction_level, 95)
-        self.assertEqual(m2.triggerrules.triggers[0].actions[0].meters, 1000)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].zone, destruction_zone.id)
 
     def test_remove_trees_in_zone(self):
@@ -618,7 +617,6 @@ def test_remove_trees_in_zone(self):
         self.assertTrue(type(m2.triggerrules.triggers[0].actions[0]) is dcs.action.RemoveSceneObjects)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].objects_mask,
                          dcs.action.RemoveSceneObjectsMask.TREES_ONLY)
-        self.assertEqual(m2.triggerrules.triggers[0].actions[0].meters, 1000)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].zone, removal_zone.id)
 
     def test_remove_objects_in_zone(self):
@@ -645,7 +643,6 @@ def test_remove_objects_in_zone(self):
         self.assertTrue(type(m2.triggerrules.triggers[0].actions[0]) is dcs.action.RemoveSceneObjects)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].objects_mask,
                          dcs.action.RemoveSceneObjectsMask.OBJECTS_ONLY)
-        self.assertEqual(m2.triggerrules.triggers[0].actions[0].meters, 1000)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].zone, removal_zone.id)
 
     def test_remove_trees_and_objects_in_zone(self):
@@ -671,7 +668,6 @@ def test_remove_trees_and_objects_in_zone(self):
         self.assertEqual(m2.terrain.__class__, dcs.terrain.Caucasus)
         self.assertTrue(type(m2.triggerrules.triggers[0].actions[0]) is dcs.action.RemoveSceneObjects)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].objects_mask, dcs.action.RemoveSceneObjectsMask.ALL)
-        self.assertEqual(m2.triggerrules.triggers[0].actions[0].meters, 1000)
         self.assertEqual(m2.triggerrules.triggers[0].actions[0].zone, removal_zone.id)
 
     def test_bypass_triggers(self):