Skip to content

Commit aa25fa5

Browse files
committed
1.33a
Symmerty loading bug fix
1 parent 86dd366 commit aa25fa5

File tree

4 files changed

+41
-17
lines changed

4 files changed

+41
-17
lines changed

AGExt/CommonMethods.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public override void OnStart(StartState state)
352352
public override void OnSave(ConfigNode node)
353353
{
354354
string ErrLine = "1";
355-
//Debug.Log("AGX Saving Module");
355+
//Debug.Log("AGX Saving Module start" + StaticData.CurrentVesselActions.Count());
356356
try
357357
{
358358
node.RemoveNodes("ACTION");
@@ -373,8 +373,8 @@ public override void OnSave(ConfigNode node)
373373
ErrLine = "2d";
374374
//if (StaticData.CurrentVesselActions == null)
375375
//{
376-
// Debug.Log("AGX Partmodule Save CurrentVessels is null");
377-
//}
376+
// Debug.Log("AGX Partmodule Save CurrentVessels is null");
377+
//}
378378
//else
379379
//{
380380
// Debug.Log("AGX Partmodule Save CurrentVessels is not null");
@@ -438,6 +438,7 @@ public override void OnSave(ConfigNode node)
438438
node.AddNode(holdStates);
439439
}
440440
//Debug.Log("AGX PartModule Save Okay"); //temporary
441+
//Debug.Log("AGX Saving Module end" + StaticData.CurrentVesselActions.Count());
441442
}
442443
catch (Exception e)
443444
{
@@ -447,7 +448,7 @@ public override void OnSave(ConfigNode node)
447448

448449
public override void OnLoad(ConfigNode node)
449450
{
450-
//Debug.Log("AGX Load Module");
451+
//Debug.Log("AGX Load Module" + StaticData.CurrentVesselActions.Count());
451452
string errLine = "1";
452453
try
453454
{
@@ -491,6 +492,7 @@ public override void OnLoad(ConfigNode node)
491492
agxActionsThisPart.Add(AGextScenario.LoadAGXActionVer2(actionNode, this.part, false));
492493
}
493494
//.Log("AGX PartModule Load Okay"); //temporary
495+
//Debug.Log("AGX Load Module End" + StaticData.CurrentVesselActions.Count());
494496
}
495497
catch(Exception e)
496498
{

AGExt/Editor.cs

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ public class AGXEditor : PartModule
132132
bool showAllPartsList = false; //show list of all parts in group window?
133133
List<string> showAllPartsListTitles; //list of all parts with actions to show in group window
134134
KSPActionGroup KSPDefaultLastActionGroup = KSPActionGroup.Custom01;
135+
public static bool disablePartAttaching = false; //disable part attaching feature when loading so non-symmetric actions are not made symmetric
135136
//static Part partLastHighlight = null;
136137
////static Color partHighlighLastColor;
137138
//static Part.HighlightType partHighlightLastType;
@@ -556,7 +557,7 @@ public void Start()
556557
//print("Loading now");
557558
//EditorActionGroups.Instance.groupActionsList.AddValueChangedDelegate(OnGroupActionsListChange);
558559
LoadFinished = true;
559-
//Debug.Log("AGX Editor Start Okay");
560+
//Debug.Log("AGX Editor Start Okay" + StaticData.CurrentVesselActions.Count());
560561
}
561562
catch (Exception e)
562563
{
@@ -567,8 +568,13 @@ public void Start()
567568

568569
public void OnShipLoad(ShipConstruct ship ,CraftBrowser.LoadType loadType)
569570
{
571+
572+
DetachedPartReset.Start(); //start timer so it fires even if no parts load
570573
if (loadType == CraftBrowser.LoadType.Normal)
571574
{
575+
//Debug.Log("OnShipLoadFire!");
576+
disablePartAttaching = true; //disable symmetric action loading
577+
DetachedPartActions.Clear(); //onPartAttach fires before this point, need to get rid of the actions that adds to this list.
572578
StaticData.CurrentVesselActions.Clear();
573579
//EditorLoadFromFile();
574580
EditorLoadFromNode();
@@ -724,7 +730,7 @@ public void onLeftButtonClick()
724730

725731
public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
726732
{
727-
//Debug.Log("Part attache fire!");
733+
//Debug.Log("Part attache fire!" + StaticData.CurrentVesselActions.Count() + "||" + EditorLogic.fetch.FSMStarted);
728734
string ErrLine = "1";
729735
try
730736
{
@@ -774,7 +780,10 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
774780
//Debug.Log("part attached not detect");
775781
}
776782
ErrLine = "15";
777-
DetachedPartActions.Add(agAct);
783+
if (!disablePartAttaching)
784+
{
785+
DetachedPartActions.Add(agAct);
786+
}
778787
}
779788
ErrLine = "16";
780789
AttachAGXPart(host_target.host);
@@ -786,7 +795,10 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
786795
foreach (AGXAction agAct in agxMod.agxActionsThisPart)
787796
{
788797
ErrLine = "19";
789-
DetachedPartActions.Add(agAct);
798+
if (!disablePartAttaching)
799+
{
800+
DetachedPartActions.Add(agAct);
801+
}
790802
if (!StaticData.CurrentVesselActions.Contains(agAct))
791803
{
792804
//print("adding action " + agAct.ba.guiName + agAct.group);
@@ -806,7 +818,7 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
806818
}
807819
DetachedPartReset.Start();
808820
//RefreshDefaultActionsList();
809-
821+
//Debug.Log("Part attache fire end!" + StaticData.CurrentVesselActions.Count());
810822
}
811823
catch (Exception e)
812824
{
@@ -819,6 +831,7 @@ public void PartRemove(GameEvents.HostTargetAction<Part, Part> host_target)
819831
string errLine = "1";
820832
try
821833
{
834+
//.Log("AGX Part Remove Fire " + StaticData.CurrentVesselActions.Count());
822835
errLine = "2";
823836
UpdateAGXActionGroupNames();
824837
errLine = "3";
@@ -850,6 +863,7 @@ public void PartRemove(GameEvents.HostTargetAction<Part, Part> host_target)
850863
errLine = "13";
851864
}
852865
errLine = "14";
866+
//Debug.Log("AGX Part Remove Fire " + StaticData.CurrentVesselActions.Count());
853867
}
854868
catch (Exception e)
855869
{
@@ -1076,9 +1090,12 @@ public static void SetDefaultActionStatic(BaseAction ba, int group)
10761090
public static void ResetDetachedParts(object source, ElapsedEventArgs e)
10771091
{
10781092

1093+
//Debug.Log("AGX Detached parts start " + StaticData.CurrentVesselActions.Count());
1094+
disablePartAttaching = false;
10791095
DetachedPartReset.Stop();
10801096
foreach (AGXAction agAct in DetachedPartActions)
10811097
{
1098+
//Debug.Log("AGX DetachedPartActions " + DetachedPartActions.Count());
10821099
foreach (Part p in agAct.prt.symmetryCounterparts)
10831100
{
10841101
AGXAction actToAdd = AGextScenario.LoadAGXActionVer2(AGextScenario.SaveAGXActionVer2(agAct), p, false);
@@ -1092,7 +1109,7 @@ public static void ResetDetachedParts(object source, ElapsedEventArgs e)
10921109
}
10931110
DetachedPartActions.Clear();
10941111
EditorSaveToNode();
1095-
1112+
//Debug.Log("AGX Detached parts end " + StaticData.CurrentVesselActions.Count());
10961113
}
10971114

10981115
//public void VesselChanged(ShipConstruct sc)
@@ -3460,7 +3477,8 @@ public static void LoadGroupNames(string LoadNames) //v2 done
34603477

34613478
public void Update()
34623479
{
3463-
3480+
3481+
//Debug.Log("AGX Editor Update" + StaticData.CurrentVesselActions.Count() + "||" + EditorLogic.fetch.FSMStarted);
34643482
if (checkShipsExist)
34653483
{
34663484
if (checkShipsExistDelay >= 30)
@@ -3589,7 +3607,7 @@ public void Update()
35893607
//{
35903608
// print(p.name + " " + p.symmetryCounterparts.Count + " " + p.GetHashCode());
35913609
//}
3592-
3610+
//Debug.Log("AGX Editor Update end" + StaticData.CurrentVesselActions.Count());
35933611
// print("test " + FindObjectsOfType<EditorSubassemblyItem>().Count());
35943612
} //close Update()
35953613
//if(needToAddStockButton)
@@ -3695,7 +3713,7 @@ public void PrintPartPos()
36953713
}
36963714
public void MonitorDefaultActions()
36973715
{
3698-
//print("2a");
3716+
//print("AGX Monitor default start " + StaticData.CurrentVesselActions.Count());
36993717
KSPActionGroup KSPDefaultActionGroupThisFrame = KSPActionGroup.Custom01;
37003718
try //find which action group is selected in default ksp editor this pass
37013719
{
@@ -3712,7 +3730,7 @@ public void MonitorDefaultActions()
37123730

37133731
KSPDefaultActionGroupThisFrame = (KSPActionGroup)Enum.Parse(typeof(KSPActionGroup), grpText);
37143732
//print("Selected group " + KSPDefaultLastActionGroup);
3715-
3733+
37163734
}
37173735
catch
37183736
{
@@ -4001,6 +4019,7 @@ public void MonitorDefaultActions()
40014019
}
40024020
}
40034021
}
4022+
//print("AGX Monitor default end " + StaticData.CurrentVesselActions.Count());
40044023
}
40054024
catch (Exception e)
40064025
{
@@ -4065,7 +4084,7 @@ public static void EditorLoadFromFile()
40654084

40664085
public static void EditorLoadFromNode()
40674086
{
4068-
//print("LoadFromNode Called");
4087+
//print("LoadFromNode Called" + StaticData.CurrentVesselActions.Count());
40694088
string errLine = "1";
40704089
try
40714090
{
@@ -4246,6 +4265,7 @@ public static void EditorLoadFromNode()
42464265
//silently fail, if we hit this EditorLogic.sortedShipList is not valid
42474266
}
42484267
AGXRoot = EditorLogic.RootPart;
4268+
//print("LoadFromNode Called End" + StaticData.CurrentVesselActions.Count());
42494269
}
42504270

42514271

@@ -4350,6 +4370,7 @@ public static string SaveGroupNames(string str)
43504370

43514371
public void UpdateActionsListCheck()
43524372
{
4373+
//Debug.Log("AGX UpdateActions start " + StaticData.CurrentVesselActions.Count());
43534374
List<AGXAction> KnownGood = new List<AGXAction>();
43544375
KnownGood = new List<AGXAction>();
43554376

@@ -4363,6 +4384,7 @@ public void UpdateActionsListCheck()
43634384
StaticData.CurrentVesselActions = KnownGood;
43644385
RefreshDefaultActionsList();
43654386
ActionsListDirty = false;
4387+
//Debug.Log("AGX UpdateActions end " + StaticData.CurrentVesselActions.Count());
43664388
}
43674389

43684390
public void AGXResetPartsList() //clear selected parts list and populate with newly selected part(s)

AGExt/Flight.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public void Start()
621621
isDirectAction[i] = false;
622622
}
623623

624-
Debug.Log("AGX Flight Started Okay"); //temporary
624+
// Debug.Log("AGX Flight Started Okay"); //temporary
625625
}
626626
catch (Exception e)
627627
{

AGExt/Instantly.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class AGXMainMenu :PartModule
1313
//abandoned module, no longer needed for key rebinding
1414
public void Start()
1515
{
16-
print("AGExt Ver. 1.33 loaded");
16+
print("AGExt Ver. 1.33a loaded");
1717

1818

1919
}

0 commit comments

Comments
 (0)