Skip to content

Commit

Permalink
2.0b
Browse files Browse the repository at this point in the history
-Fix bug where some parts couldn't be selected in flight mode.
  • Loading branch information
SirDiazo committed May 29, 2016
1 parent 541fd65 commit 7b90455
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 70 deletions.
12 changes: 6 additions & 6 deletions AGExt/CommonMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ public static ConfigNode LoadBaseConfigNode()
{
ConfigNode tempNode = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Diazo/AGExt/AGExt.settings");
nodeLoad = tempNode.GetNode("AGExtConfig");
Debug.Log("AGX case 1 " + nodeLoad.ToString());
//Debug.Log("AGX case 1 " + nodeLoad.ToString());
}
else if (System.IO.File.Exists(KSPUtil.ApplicationRootPath + "GameData/Diazo/AGExt/AGext.cfg"))
{
ConfigNode tempNode = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Diazo/AGExt/AGext.cfg");
nodeLoad = tempNode.GetNode("AGExtConfig");
System.IO.File.Delete(KSPUtil.ApplicationRootPath + "GameData/Diazo/AGExt/AGext.cfg");
Debug.Log("AGX case 2 " + nodeLoad.ToString());
}
else
{
Debug.Log("AGX case 3 " + nodeLoad.ToString());
//Debug.Log("AGX case 2 " + nodeLoad.ToString());
}
//else
//{
// //Debug.Log("AGX case 3 " + nodeLoad.ToString());
//}

//nodeLoad = GameDatabase.Instance.GetConfigNode("Diazo/AGExt/AGExt/AGExtConfig");
//if (nodeLoad == null)
Expand Down
127 changes: 64 additions & 63 deletions AGExt/Flight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4401,26 +4401,27 @@ public void LoadDefaultActionGroups()
}
public Part SelectPartUnderMouse()
{
FlightCamera CamTest = new FlightCamera();
CamTest = FlightCamera.fetch;
Ray ray = CamTest.mainCamera.ScreenPointToRay(Input.mousePosition);
LayerMask RayMask = new LayerMask();
RayMask = 1 << 0;
RaycastHit hit;
if (Physics.Raycast(ray, out hit, Mathf.Infinity, RayMask))
{
Part hitPart = (Part)UIPartActionController.GetComponentUpwards("Part", hit.collider.gameObject); //how to find small parts that are "inside" the large part they are attached to.
if (FlightGlobals.ActiveVessel.parts.Contains(hitPart))
{
return hitPart;
}
else
{
return null;
}
//return FlightGlobals.ActiveVessel.Parts.Find(p => p.gameObject == hit.transform.gameObject);
}
return null;
//FlightCamera CamTest = new FlightCamera();
//CamTest = FlightCamera.fetch;
//Ray ray = CamTest.mainCamera.ScreenPointToRay(Input.mousePosition);
//LayerMask RayMask = new LayerMask();
//RayMask = 1 << 0;
//RaycastHit hit;
//if (Physics.Raycast(ray, out hit, Mathf.Infinity, RayMask))
//{
// Part hitPart = (Part)UIPartActionController.GetComponentUpwards("Part", hit.collider.gameObject); //how to find small parts that are "inside" the large part they are attached to.
// if (FlightGlobals.ActiveVessel.parts.Contains(hitPart))
// {
// return hitPart;
// }
// else
// {
// return null;
// }
// //return FlightGlobals.ActiveVessel.Parts.Find(p => p.gameObject == hit.transform.gameObject);
//}
//return null;
return Mouse.HoveredPart;
}

public bool CheckMouseOver()
Expand Down Expand Up @@ -4719,15 +4720,15 @@ public void Update()
errLine = "7d";
//note we generally do not save data here, all saving of data is done by the GUI buttons to the ModuleAGX partmodule directly in flight mode
ModuleAGX rootAGX = null;
Debug.Log("AGX " + FlightGlobals.ActiveVessel.vesselType.ToString());
//Debug.Log("AGX " + FlightGlobals.ActiveVessel.vesselType.ToString());
if (FlightGlobals.ActiveVessel.rootPart.Modules.Contains("KerbalEVA") || FlightGlobals.ActiveVessel.vesselType==VesselType.Flag) //kerbals have no actions so...
{
Debug.Log("AGX oddball");
//Debug.Log("AGX oddball");
foreach(Part p in FlightGlobals.ActiveVessel.Parts)
{
if(!p.Modules.Contains("ModuleAGX"))
{
Debug.Log("AGX AGXModule being added");
//Debug.Log("AGX AGXModule being added");
rootAGX = (ModuleAGX)p.AddModule("ModuleAGX");
}
}
Expand Down Expand Up @@ -5820,50 +5821,50 @@ public void FixedUpdate()
}
}

public void PrintPartActs()
{
try
{
//print("crew " + FlightGlobals.ActiveVessel.GetVesselCrew().Count);
foreach (Part p in FlightGlobals.ActiveVessel.parts)
{
foreach (ModuleEnginesFX eng in p.Modules.OfType<ModuleEnginesFX>())
{
foreach (BaseAction ba in eng.Actions)
{
print(p.name + " " + ba.name + " " + ba.guiName);
}
}
foreach (ModuleGimbal gim in p.Modules.OfType<ModuleGimbal>())
{
print(p.name + " " + gim.gimbalLock);
}
}
//public void PrintPartActs()
//{
// try
// {
// //print("crew " + FlightGlobals.ActiveVessel.GetVesselCrew().Count);
// foreach (Part p in FlightGlobals.ActiveVessel.parts)
// {
// foreach (ModuleEnginesFX eng in p.Modules.OfType<ModuleEnginesFX>())
// {
// foreach (BaseAction ba in eng.Actions)
// {
// print(p.name + " " + ba.name + " " + ba.guiName);
// }
// }
// foreach (ModuleGimbal gim in p.Modules.OfType<ModuleGimbal>())
// {
// print(p.name + " " + gim.gimbalLock);
// }
// }


}
catch
{
print("Print fail!");
}
}
// }
// catch
// {
// print("Print fail!");
// }
//}

public void PrintPartPos()
{
print("begin update pos " + StaticData.CurrentVesselActions.Count);
try
{
foreach (Part p in FlightGlobals.ActiveVessel.Parts)
{
print(p.name);
//public void PrintPartPos()
//{
// print("begin update pos " + StaticData.CurrentVesselActions.Count);
// try
// {
// foreach (Part p in FlightGlobals.ActiveVessel.Parts)
// {
// print(p.name);

}
}
catch
{
print("Print fail on pos!");
}
}
// }
// }
// catch
// {
// print("Print fail on pos!");
// }
//}

public void partDead(Part p)
{
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. 2.0a loaded");
print("AGExt Ver. 2.0b loaded");


}
Expand Down

0 comments on commit 7b90455

Please sign in to comment.