@@ -132,6 +132,7 @@ public class AGXEditor : PartModule
132
132
bool showAllPartsList = false ; //show list of all parts in group window?
133
133
List < string > showAllPartsListTitles ; //list of all parts with actions to show in group window
134
134
KSPActionGroup KSPDefaultLastActionGroup = KSPActionGroup . Custom01 ;
135
+ public static bool disablePartAttaching = false ; //disable part attaching feature when loading so non-symmetric actions are not made symmetric
135
136
//static Part partLastHighlight = null;
136
137
////static Color partHighlighLastColor;
137
138
//static Part.HighlightType partHighlightLastType;
@@ -556,7 +557,7 @@ public void Start()
556
557
//print("Loading now");
557
558
//EditorActionGroups.Instance.groupActionsList.AddValueChangedDelegate(OnGroupActionsListChange);
558
559
LoadFinished = true ;
559
- //Debug.Log("AGX Editor Start Okay");
560
+ //Debug.Log("AGX Editor Start Okay" + StaticData.CurrentVesselActions.Count() );
560
561
}
561
562
catch ( Exception e )
562
563
{
@@ -567,8 +568,13 @@ public void Start()
567
568
568
569
public void OnShipLoad ( ShipConstruct ship , CraftBrowser . LoadType loadType )
569
570
{
571
+
572
+ DetachedPartReset . Start ( ) ; //start timer so it fires even if no parts load
570
573
if ( loadType == CraftBrowser . LoadType . Normal )
571
574
{
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.
572
578
StaticData . CurrentVesselActions . Clear ( ) ;
573
579
//EditorLoadFromFile();
574
580
EditorLoadFromNode ( ) ;
@@ -724,7 +730,7 @@ public void onLeftButtonClick()
724
730
725
731
public void PartAttaching ( GameEvents . HostTargetAction < Part , Part > host_target )
726
732
{
727
- //Debug.Log("Part attache fire!");
733
+ //Debug.Log("Part attache fire!" + StaticData.CurrentVesselActions.Count() + "||" + EditorLogic.fetch.FSMStarted );
728
734
string ErrLine = "1" ;
729
735
try
730
736
{
@@ -774,7 +780,10 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
774
780
//Debug.Log("part attached not detect");
775
781
}
776
782
ErrLine = "15" ;
777
- DetachedPartActions . Add ( agAct ) ;
783
+ if ( ! disablePartAttaching )
784
+ {
785
+ DetachedPartActions . Add ( agAct ) ;
786
+ }
778
787
}
779
788
ErrLine = "16" ;
780
789
AttachAGXPart ( host_target . host ) ;
@@ -786,7 +795,10 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
786
795
foreach ( AGXAction agAct in agxMod . agxActionsThisPart )
787
796
{
788
797
ErrLine = "19" ;
789
- DetachedPartActions . Add ( agAct ) ;
798
+ if ( ! disablePartAttaching )
799
+ {
800
+ DetachedPartActions . Add ( agAct ) ;
801
+ }
790
802
if ( ! StaticData . CurrentVesselActions . Contains ( agAct ) )
791
803
{
792
804
//print("adding action " + agAct.ba.guiName + agAct.group);
@@ -806,7 +818,7 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
806
818
}
807
819
DetachedPartReset . Start ( ) ;
808
820
//RefreshDefaultActionsList();
809
-
821
+ //Debug.Log("Part attache fire end!" + StaticData.CurrentVesselActions.Count());
810
822
}
811
823
catch ( Exception e )
812
824
{
@@ -819,6 +831,7 @@ public void PartRemove(GameEvents.HostTargetAction<Part, Part> host_target)
819
831
string errLine = "1" ;
820
832
try
821
833
{
834
+ //.Log("AGX Part Remove Fire " + StaticData.CurrentVesselActions.Count());
822
835
errLine = "2" ;
823
836
UpdateAGXActionGroupNames ( ) ;
824
837
errLine = "3" ;
@@ -850,6 +863,7 @@ public void PartRemove(GameEvents.HostTargetAction<Part, Part> host_target)
850
863
errLine = "13" ;
851
864
}
852
865
errLine = "14" ;
866
+ //Debug.Log("AGX Part Remove Fire " + StaticData.CurrentVesselActions.Count());
853
867
}
854
868
catch ( Exception e )
855
869
{
@@ -1076,9 +1090,12 @@ public static void SetDefaultActionStatic(BaseAction ba, int group)
1076
1090
public static void ResetDetachedParts ( object source , ElapsedEventArgs e )
1077
1091
{
1078
1092
1093
+ //Debug.Log("AGX Detached parts start " + StaticData.CurrentVesselActions.Count());
1094
+ disablePartAttaching = false ;
1079
1095
DetachedPartReset . Stop ( ) ;
1080
1096
foreach ( AGXAction agAct in DetachedPartActions )
1081
1097
{
1098
+ //Debug.Log("AGX DetachedPartActions " + DetachedPartActions.Count());
1082
1099
foreach ( Part p in agAct . prt . symmetryCounterparts )
1083
1100
{
1084
1101
AGXAction actToAdd = AGextScenario . LoadAGXActionVer2 ( AGextScenario . SaveAGXActionVer2 ( agAct ) , p , false ) ;
@@ -1092,7 +1109,7 @@ public static void ResetDetachedParts(object source, ElapsedEventArgs e)
1092
1109
}
1093
1110
DetachedPartActions . Clear ( ) ;
1094
1111
EditorSaveToNode ( ) ;
1095
-
1112
+ //Debug.Log("AGX Detached parts end " + StaticData.CurrentVesselActions.Count());
1096
1113
}
1097
1114
1098
1115
//public void VesselChanged(ShipConstruct sc)
@@ -3460,7 +3477,8 @@ public static void LoadGroupNames(string LoadNames) //v2 done
3460
3477
3461
3478
public void Update ( )
3462
3479
{
3463
-
3480
+
3481
+ //Debug.Log("AGX Editor Update" + StaticData.CurrentVesselActions.Count() + "||" + EditorLogic.fetch.FSMStarted);
3464
3482
if ( checkShipsExist )
3465
3483
{
3466
3484
if ( checkShipsExistDelay >= 30 )
@@ -3589,7 +3607,7 @@ public void Update()
3589
3607
//{
3590
3608
// print(p.name + " " + p.symmetryCounterparts.Count + " " + p.GetHashCode());
3591
3609
//}
3592
-
3610
+ //Debug.Log("AGX Editor Update end" + StaticData.CurrentVesselActions.Count());
3593
3611
// print("test " + FindObjectsOfType<EditorSubassemblyItem>().Count());
3594
3612
} //close Update()
3595
3613
//if(needToAddStockButton)
@@ -3695,7 +3713,7 @@ public void PrintPartPos()
3695
3713
}
3696
3714
public void MonitorDefaultActions ( )
3697
3715
{
3698
- //print("2a" );
3716
+ //print("AGX Monitor default start " + StaticData.CurrentVesselActions.Count() );
3699
3717
KSPActionGroup KSPDefaultActionGroupThisFrame = KSPActionGroup . Custom01 ;
3700
3718
try //find which action group is selected in default ksp editor this pass
3701
3719
{
@@ -3712,7 +3730,7 @@ public void MonitorDefaultActions()
3712
3730
3713
3731
KSPDefaultActionGroupThisFrame = ( KSPActionGroup ) Enum . Parse ( typeof ( KSPActionGroup ) , grpText ) ;
3714
3732
//print("Selected group " + KSPDefaultLastActionGroup);
3715
-
3733
+
3716
3734
}
3717
3735
catch
3718
3736
{
@@ -4001,6 +4019,7 @@ public void MonitorDefaultActions()
4001
4019
}
4002
4020
}
4003
4021
}
4022
+ //print("AGX Monitor default end " + StaticData.CurrentVesselActions.Count());
4004
4023
}
4005
4024
catch ( Exception e )
4006
4025
{
@@ -4065,7 +4084,7 @@ public static void EditorLoadFromFile()
4065
4084
4066
4085
public static void EditorLoadFromNode ( )
4067
4086
{
4068
- //print("LoadFromNode Called");
4087
+ //print("LoadFromNode Called" + StaticData.CurrentVesselActions.Count() );
4069
4088
string errLine = "1" ;
4070
4089
try
4071
4090
{
@@ -4246,6 +4265,7 @@ public static void EditorLoadFromNode()
4246
4265
//silently fail, if we hit this EditorLogic.sortedShipList is not valid
4247
4266
}
4248
4267
AGXRoot = EditorLogic . RootPart ;
4268
+ //print("LoadFromNode Called End" + StaticData.CurrentVesselActions.Count());
4249
4269
}
4250
4270
4251
4271
@@ -4350,6 +4370,7 @@ public static string SaveGroupNames(string str)
4350
4370
4351
4371
public void UpdateActionsListCheck ( )
4352
4372
{
4373
+ //Debug.Log("AGX UpdateActions start " + StaticData.CurrentVesselActions.Count());
4353
4374
List < AGXAction > KnownGood = new List < AGXAction > ( ) ;
4354
4375
KnownGood = new List < AGXAction > ( ) ;
4355
4376
@@ -4363,6 +4384,7 @@ public void UpdateActionsListCheck()
4363
4384
StaticData . CurrentVesselActions = KnownGood ;
4364
4385
RefreshDefaultActionsList ( ) ;
4365
4386
ActionsListDirty = false ;
4387
+ //Debug.Log("AGX UpdateActions end " + StaticData.CurrentVesselActions.Count());
4366
4388
}
4367
4389
4368
4390
public void AGXResetPartsList ( ) //clear selected parts list and populate with newly selected part(s)
0 commit comments