Skip to content

Commit

Permalink
1.33a
Browse files Browse the repository at this point in the history
Symmerty loading bug fix
  • Loading branch information
SirDiazo committed Jul 10, 2015
1 parent 86dd366 commit aa25fa5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 17 deletions.
10 changes: 6 additions & 4 deletions AGExt/CommonMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public override void OnStart(StartState state)
public override void OnSave(ConfigNode node)
{
string ErrLine = "1";
//Debug.Log("AGX Saving Module");
//Debug.Log("AGX Saving Module start" + StaticData.CurrentVesselActions.Count());
try
{
node.RemoveNodes("ACTION");
Expand All @@ -373,8 +373,8 @@ public override void OnSave(ConfigNode node)
ErrLine = "2d";
//if (StaticData.CurrentVesselActions == null)
//{
// Debug.Log("AGX Partmodule Save CurrentVessels is null");
//}
// Debug.Log("AGX Partmodule Save CurrentVessels is null");
//}
//else
//{
// Debug.Log("AGX Partmodule Save CurrentVessels is not null");
Expand Down Expand Up @@ -438,6 +438,7 @@ public override void OnSave(ConfigNode node)
node.AddNode(holdStates);
}
//Debug.Log("AGX PartModule Save Okay"); //temporary
//Debug.Log("AGX Saving Module end" + StaticData.CurrentVesselActions.Count());
}
catch (Exception e)
{
Expand All @@ -447,7 +448,7 @@ public override void OnSave(ConfigNode node)

public override void OnLoad(ConfigNode node)
{
//Debug.Log("AGX Load Module");
//Debug.Log("AGX Load Module" + StaticData.CurrentVesselActions.Count());
string errLine = "1";
try
{
Expand Down Expand Up @@ -491,6 +492,7 @@ public override void OnLoad(ConfigNode node)
agxActionsThisPart.Add(AGextScenario.LoadAGXActionVer2(actionNode, this.part, false));
}
//.Log("AGX PartModule Load Okay"); //temporary
//Debug.Log("AGX Load Module End" + StaticData.CurrentVesselActions.Count());
}
catch(Exception e)
{
Expand Down
44 changes: 33 additions & 11 deletions AGExt/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public class AGXEditor : PartModule
bool showAllPartsList = false; //show list of all parts in group window?
List<string> showAllPartsListTitles; //list of all parts with actions to show in group window
KSPActionGroup KSPDefaultLastActionGroup = KSPActionGroup.Custom01;
public static bool disablePartAttaching = false; //disable part attaching feature when loading so non-symmetric actions are not made symmetric
//static Part partLastHighlight = null;
////static Color partHighlighLastColor;
//static Part.HighlightType partHighlightLastType;
Expand Down Expand Up @@ -556,7 +557,7 @@ public void Start()
//print("Loading now");
//EditorActionGroups.Instance.groupActionsList.AddValueChangedDelegate(OnGroupActionsListChange);
LoadFinished = true;
//Debug.Log("AGX Editor Start Okay");
//Debug.Log("AGX Editor Start Okay" + StaticData.CurrentVesselActions.Count());
}
catch (Exception e)
{
Expand All @@ -567,8 +568,13 @@ public void Start()

public void OnShipLoad(ShipConstruct ship ,CraftBrowser.LoadType loadType)
{

DetachedPartReset.Start(); //start timer so it fires even if no parts load
if (loadType == CraftBrowser.LoadType.Normal)
{
//Debug.Log("OnShipLoadFire!");
disablePartAttaching = true; //disable symmetric action loading
DetachedPartActions.Clear(); //onPartAttach fires before this point, need to get rid of the actions that adds to this list.
StaticData.CurrentVesselActions.Clear();
//EditorLoadFromFile();
EditorLoadFromNode();
Expand Down Expand Up @@ -724,7 +730,7 @@ public void onLeftButtonClick()

public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
{
//Debug.Log("Part attache fire!");
//Debug.Log("Part attache fire!" + StaticData.CurrentVesselActions.Count() + "||" + EditorLogic.fetch.FSMStarted);
string ErrLine = "1";
try
{
Expand Down Expand Up @@ -774,7 +780,10 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
//Debug.Log("part attached not detect");
}
ErrLine = "15";
DetachedPartActions.Add(agAct);
if (!disablePartAttaching)
{
DetachedPartActions.Add(agAct);
}
}
ErrLine = "16";
AttachAGXPart(host_target.host);
Expand All @@ -786,7 +795,10 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
foreach (AGXAction agAct in agxMod.agxActionsThisPart)
{
ErrLine = "19";
DetachedPartActions.Add(agAct);
if (!disablePartAttaching)
{
DetachedPartActions.Add(agAct);
}
if (!StaticData.CurrentVesselActions.Contains(agAct))
{
//print("adding action " + agAct.ba.guiName + agAct.group);
Expand All @@ -806,7 +818,7 @@ public void PartAttaching(GameEvents.HostTargetAction<Part, Part> host_target)
}
DetachedPartReset.Start();
//RefreshDefaultActionsList();

//Debug.Log("Part attache fire end!" + StaticData.CurrentVesselActions.Count());
}
catch (Exception e)
{
Expand All @@ -819,6 +831,7 @@ public void PartRemove(GameEvents.HostTargetAction<Part, Part> host_target)
string errLine = "1";
try
{
//.Log("AGX Part Remove Fire " + StaticData.CurrentVesselActions.Count());
errLine = "2";
UpdateAGXActionGroupNames();
errLine = "3";
Expand Down Expand Up @@ -850,6 +863,7 @@ public void PartRemove(GameEvents.HostTargetAction<Part, Part> host_target)
errLine = "13";
}
errLine = "14";
//Debug.Log("AGX Part Remove Fire " + StaticData.CurrentVesselActions.Count());
}
catch (Exception e)
{
Expand Down Expand Up @@ -1076,9 +1090,12 @@ public static void SetDefaultActionStatic(BaseAction ba, int group)
public static void ResetDetachedParts(object source, ElapsedEventArgs e)
{

//Debug.Log("AGX Detached parts start " + StaticData.CurrentVesselActions.Count());
disablePartAttaching = false;
DetachedPartReset.Stop();
foreach (AGXAction agAct in DetachedPartActions)
{
//Debug.Log("AGX DetachedPartActions " + DetachedPartActions.Count());
foreach (Part p in agAct.prt.symmetryCounterparts)
{
AGXAction actToAdd = AGextScenario.LoadAGXActionVer2(AGextScenario.SaveAGXActionVer2(agAct), p, false);
Expand All @@ -1092,7 +1109,7 @@ public static void ResetDetachedParts(object source, ElapsedEventArgs e)
}
DetachedPartActions.Clear();
EditorSaveToNode();

//Debug.Log("AGX Detached parts end " + StaticData.CurrentVesselActions.Count());
}

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

public void Update()
{


//Debug.Log("AGX Editor Update" + StaticData.CurrentVesselActions.Count() + "||" + EditorLogic.fetch.FSMStarted);
if (checkShipsExist)
{
if (checkShipsExistDelay >= 30)
Expand Down Expand Up @@ -3589,7 +3607,7 @@ public void Update()
//{
// print(p.name + " " + p.symmetryCounterparts.Count + " " + p.GetHashCode());
//}

//Debug.Log("AGX Editor Update end" + StaticData.CurrentVesselActions.Count());
// print("test " + FindObjectsOfType<EditorSubassemblyItem>().Count());
} //close Update()
//if(needToAddStockButton)
Expand Down Expand Up @@ -3695,7 +3713,7 @@ public void PrintPartPos()
}
public void MonitorDefaultActions()
{
//print("2a");
//print("AGX Monitor default start " + StaticData.CurrentVesselActions.Count());
KSPActionGroup KSPDefaultActionGroupThisFrame = KSPActionGroup.Custom01;
try //find which action group is selected in default ksp editor this pass
{
Expand All @@ -3712,7 +3730,7 @@ public void MonitorDefaultActions()

KSPDefaultActionGroupThisFrame = (KSPActionGroup)Enum.Parse(typeof(KSPActionGroup), grpText);
//print("Selected group " + KSPDefaultLastActionGroup);

}
catch
{
Expand Down Expand Up @@ -4001,6 +4019,7 @@ public void MonitorDefaultActions()
}
}
}
//print("AGX Monitor default end " + StaticData.CurrentVesselActions.Count());
}
catch (Exception e)
{
Expand Down Expand Up @@ -4065,7 +4084,7 @@ public static void EditorLoadFromFile()

public static void EditorLoadFromNode()
{
//print("LoadFromNode Called");
//print("LoadFromNode Called" + StaticData.CurrentVesselActions.Count());
string errLine = "1";
try
{
Expand Down Expand Up @@ -4246,6 +4265,7 @@ public static void EditorLoadFromNode()
//silently fail, if we hit this EditorLogic.sortedShipList is not valid
}
AGXRoot = EditorLogic.RootPart;
//print("LoadFromNode Called End" + StaticData.CurrentVesselActions.Count());
}


Expand Down Expand Up @@ -4350,6 +4370,7 @@ public static string SaveGroupNames(string str)

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

Expand All @@ -4363,6 +4384,7 @@ public void UpdateActionsListCheck()
StaticData.CurrentVesselActions = KnownGood;
RefreshDefaultActionsList();
ActionsListDirty = false;
//Debug.Log("AGX UpdateActions end " + StaticData.CurrentVesselActions.Count());
}

public void AGXResetPartsList() //clear selected parts list and populate with newly selected part(s)
Expand Down
2 changes: 1 addition & 1 deletion AGExt/Flight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ public void Start()
isDirectAction[i] = false;
}

Debug.Log("AGX Flight Started Okay"); //temporary
// Debug.Log("AGX Flight Started Okay"); //temporary
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion AGExt/Instantly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AGXMainMenu :PartModule
//abandoned module, no longer needed for key rebinding
public void Start()
{
print("AGExt Ver. 1.33 loaded");
print("AGExt Ver. 1.33a loaded");


}
Expand Down

0 comments on commit aa25fa5

Please sign in to comment.