-
Notifications
You must be signed in to change notification settings - Fork 86
Description
I am trying to write a script that modifies a mission. I don't know how the original mission is created.
But I suspect some custom "scripts" are used to create the mission in addition to the ME.
In the original mission the "actions" section looks like this.
['actions']=
{
[3]=
{
['predicate']="a_do_script_file",
['file']="init",
},
[1]=
{
['predicate']="a_do_script_file",
['file']="mist",
},
[2]=
{
['predicate']="a_do_script_file",
['file']="main",
},
}, -- end of ["actions"]When I open this original mission in ME, it presents the "correct" order i.e. 1 mist, 2 main, 3 init.
But after I load and save this mission using pydcs, ME shows 1 init, 2 mist, 3 main. Note that it matches the order of appearance in the original file instead of their indices.
from the file saved with pydcs:
["actions"]=
{
[1]=
{
["file"]="init",
["predicate"]="a_do_script_file"
},
[2]=
{
["file"]="mist",
["predicate"]="a_do_script_file"
},
[3]=
{
["file"]="main",
["predicate"]="a_do_script_file"
}
},I solved this issue by changing the loop in TriggerRule.create_from_dict : from for a in actions: to for a in range(1, len(actions)+1): in my local copy of pydcs.
Judging from how it is saved in TriggerRule.dict, I suspect similar change is also necessary for the "rules" loop as well.
I can create a PR, if my approach above is a correct one.