Skip to content

Commit

Permalink
Merge pull request #219 from linuxgurugamer/master
Browse files Browse the repository at this point in the history
Required updates to fix newly disallowed behaviour
  • Loading branch information
BobPalmer authored Dec 10, 2019
2 parents db607c0 + bbbe443 commit b39fe6d
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 25 deletions.
155 changes: 155 additions & 0 deletions Firespitter/Firespitter.csproj-LGG
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BFE97E64-BF01-48AF-81EE-6B2610076542}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Firespitter</RootNamespace>
<AssemblyName>Firespitter</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>false</RunCodeAnalysis>
<NoWarn>0649</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\Assembly*.dll">
<Private>False</Private>
</Reference>
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\UnityEngine*.dll">
<Private>False</Private>
</Reference>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="aero\FSbladeLiftSurface.cs" />
<Compile Include="aero\FSliftSurface.cs" />
<Compile Include="aero\FSwingBase.cs" />
<Compile Include="animation\FSanimateLooping.cs" />
<Compile Include="animation\FSmimickRotation.cs" />
<Compile Include="animation\FSslowtato.cs" />
<Compile Include="cockpit\AnalogCounter.cs" />
<Compile Include="cockpit\FSairSpeedIndicator.cs" />
<Compile Include="cockpit\FSaltimeterCounter.cs" />
<Compile Include="cockpit\FSartificialHorizon.cs" />
<Compile Include="cockpit\FSclimbRate.cs" />
<Compile Include="cockpit\FSfuelGauge.cs" />
<Compile Include="cockpit\FSkerbalPuppet.cs" />
<Compile Include="cockpit\FSmaintenanceCounter.cs" />
<Compile Include="cockpit\FSpitchIndicator.cs" />
<Compile Include="cockpit\FStachometer.cs" />
<Compile Include="customization\FSfuelSwitch.cs" />
<Compile Include="customization\FSmodularTank.cs" />
<Compile Include="engine\FS engine modules\FSengineBladed.cs" />
<Compile Include="engine\FSalternator.cs" />
<Compile Include="engine\FSresource.cs" />
<Compile Include="info\FSpartDirectionGuide.cs" />
<Compile Include="engine\Stock based modules\FSengineHover.cs" />
<Compile Include="engine\FSengineWrapper.cs" />
<Compile Include="engine\FSgroundParticles.cs" />
<None Include="unused\FSheliLiftEngine.cs" />
<Compile Include="engine\FS engine modules\FSengine.cs" />
<Compile Include="engine\FSpropellerTweak.cs" />
<Compile Include="customization\FSmeshSwitch.cs" />
<Compile Include="customization\FStextureSwitch2.cs" />
<Compile Include="tools\MeshCreator.cs" />
<Compile Include="tools\CompatabilityChecker.cs" />
<Compile Include="tools\FSversionCheck.cs" />
<None Include="unused\FShelicopterEngine.cs" />
<Compile Include="engine\FSparticleFX.cs" />
<Compile Include="engine\FSvelocityController.cs" />
<Compile Include="info\FSinputVisualizer.cs" />
<Compile Include="info\HelpPopup.cs" />
<Compile Include="tools\ShipHeading.cs" />
<Compile Include="engine\FSanimateThrottle.cs" />
<Compile Include="tools\FSgenericButtonHandler.cs" />
<Compile Include="tools\FSrandomNumberGenerator.cs" />
<Compile Include="tools\FStools.cs" />
<None Include="unused\transformTest.cs" />
<Compile Include="water\FSbuoyancy.cs" />
<Compile Include="info\FSdebugMessages.cs" />
<Compile Include="gui\FSGUIPopup.cs" />
<Compile Include="aero\FSairBrake.cs" />
<Compile Include="animation\FSanimateGeneric.cs" />
<Compile Include="unused\FSchangeControlDirection.cs" />
<Compile Include="engine\Stock based modules\FScopterThrottle.cs" />
<Compile Include="cockpit\FSActionGroupSwitch.cs" />
<Compile Include="animation\FSanimatedAirIntake.cs" />
<Compile Include="animation\FSanimateManually.cs" />
<Compile Include="tools\FSgenericButtonHandlerID.cs" />
<Compile Include="cockpit\FScameraToTV.cs" />
<Compile Include="engine\Stock based modules\FSengineHandCrank.cs" />
<Compile Include="engine\Stock based modules\FSengineMenuCleaner.cs" />
<Compile Include="wheel\FSexternalLandingGearControl.cs" />
<Compile Include="gui\FSGUIwindowID.cs" />
<Compile Include="engine\Stock based modules\FShoverThrottle.cs" />
<Compile Include="info\FSinfoPopup.cs" />
<Compile Include="cockpit\FSmonitorScript.cs" />
<Compile Include="tools\FSnodeLoader.cs" />
<None Include="unused\FSplaceStaticMesh.cs" />
<Compile Include="engine\FSplanePropellerSpinner.cs" />
<Compile Include="info\FSradarAltitude.cs" />
<None Include="unused\FSremoteControl.cs" />
<None Include="unused\FSresourceDial.cs" />
<Compile Include="water\FSrudder.cs" />
<Compile Include="engine\FSengineSounds.cs" />
<Compile Include="cockpit\FSswitchButtonHandler.cs" />
<Compile Include="engine\FSswitchEngineThrustTransform.cs" />
<Compile Include="cockpit\FSinternalPropRotator.cs" />
<Compile Include="cockpit\FSmonitorInterface.cs" />
<Compile Include="engine\Stock based modules\FSmultiAxisEngine.cs" />
<Compile Include="wheel\FSpartTurner.cs" />
<Compile Include="engine\Stock based modules\FSpropellerAtmosphericNerf.cs" />
<Compile Include="control\FSmoveCraftAtLaunch.cs" />
<Compile Include="customization\FStextureSwitch.cs" />
<Compile Include="control\FStrimAdjustment.cs" />
<Compile Include="wheel\FSwheel.cs" />
<Compile Include="aero\FSwing.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="engine\FSrotorTrim.cs" />
<Compile Include="engine\Stock based modules\FStailRotorThrust.cs" />
<Compile Include="engine\Stock based modules\FSthrottlePropSpinner.cs" />
<Compile Include="engine\Stock based modules\FSVTOLrotator.cs" />
<Compile Include="aero\FSwingletRangeAdjustment.cs" />
<Compile Include="wheel\FSwheelAlignment.cs" />
<Compile Include="wheel\WheelClass.cs" />
<Compile Include="wheel\WheelList.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Documentation.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
14 changes: 10 additions & 4 deletions Firespitter/cockpit/FScameraToTV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ public class FScameraToTV : InternalModule
//Vector3 originalPosition = new Vector3();
Quaternion originalRotation = new Quaternion();

// TODO: Compiler este Shader e usá-lo corretamente
public static Material normal = new Material(Shader.Find("Unlit/Texture") ?? Shader.Find("Standard"));
// TODO: Compiler este Shader e usá-lo corretamente
public static Material normal;

// TODO: Compiler este Shader e usá-lo corretamente
public static Material nightVision = new Material(Shader.Find("Nightvision") ?? Shader.Find("Standard"));
// TODO: Compiler este Shader e usá-lo corretamente
public static Material nightVision;

public void Awake()
{
normal = new Material(Shader.Find("Unlit/Texture") ?? Shader.Find("Standard"));
nightVision = new Material(Shader.Find("Nightvision") ?? Shader.Find("Standard"));
}

public void Start()
{
Expand Down
32 changes: 19 additions & 13 deletions Firespitter/engine/FSgroundParticles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Firespitter.engine
{
public class FSgroundParticles : PartModule
{
{
//TODO: look for engine and engine thrust

// The URL to the bitmap, no file extension, for the dust particle
Expand All @@ -19,7 +19,7 @@ public class FSgroundParticles : PartModule
private FSengineWrapper engine;

// a disc mesh will be created at runtime. Particles spawn inside this mesh on the ground
private GameObject washDisc = new GameObject();
private GameObject washDisc;

// how far off the ground you can be and still spawn dust particles
[KSPField]
Expand Down Expand Up @@ -48,7 +48,7 @@ public class FSgroundParticles : PartModule
public Vector4 particleColor1 = new Vector4(1.0f, 1.0f, 1.0f, 0.1f);
[KSPField]
public Vector4 particleColor2 = new Vector4(1.0f, 1.0f, 1.0f, 0.15f);
[KSPField]
[KSPField]
public Vector4 particleColor3 = new Vector4(1.0f, 1.0f, 1.0f, 0.2f);
[KSPField]
public Vector4 particleColor4 = new Vector4(1.0f, 1.0f, 1.0f, 0.05f);
Expand All @@ -61,6 +61,12 @@ public class FSgroundParticles : PartModule
//private Texture2D particleTexture;
//KSP 1.8

new void Awake()
{
base.Awake();
washDisc = new GameObject();
}

void Start()
{
if (!HighLogic.LoadedSceneIsFlight) return;
Expand All @@ -69,14 +75,14 @@ void Start()

// Create the mesh disc. Particles spawn inside this mesh on the ground
washDisc.transform.parent = transform;
meshFilter = washDisc.AddComponent<MeshFilter>();
meshFilter = washDisc.AddComponent<MeshFilter>();
meshFilter.mesh = MeshCreator.createDisc(emissionDiscSize, 100);


//KSP 1.8
// fetch the particle texture from KSP's Game Database
//particleTexture = GameDatabase.Instance.GetTexture(particleTextureName, false);

//if (particleTexture == null)
//{
// Debug.Log("FSgroundParticles: particle texture loading error");
Expand All @@ -86,7 +92,7 @@ void Start()
//{
// //Setting the values for the particle system. the animator is never doing anything exciting, all particle motion is handled in the late update code
// particleFX = new FSparticleFX(washDisc, particleTexture);

// // particles change color and alpha over time.
// particleFX.AnimatorColor0 = getColorFromV4(particleColor0);
// particleFX.AnimatorColor1 = getColorFromV4(particleColor1);
Expand Down Expand Up @@ -135,7 +141,7 @@ void Update()
// layer 15 is the landscap/buildine layer. parts are layer 10, ignore those. the runway should also be layer 15, but it's not registering properly...
if (hit[i].collider.gameObject.layer == 15)
{
washDisc.transform.position = hit[i].point + Vector3.up * 0.1f;
washDisc.transform.position = hit[i].point + Vector3.up * 0.1f;
distanceFromGround = hit[i].distance;
break;
}
Expand All @@ -153,7 +159,7 @@ void Update()
//Debug.Log("seaAltitude: " + seaAltitude);

// rotate the disc so it's horizontal (does not follow the terrain slope though. Maybe there is a terrain normal to look at, but it looks OK on hills as is)
washDisc.transform.LookAt(transform.position + vessel.upAxis, Vector3.forward);
washDisc.transform.LookAt(transform.position + vessel.upAxis, Vector3.forward);

// scale the emission amount based on distance from ground
currentDistance = Mathf.Clamp(distanceFromGround, 1f, maxDistance);
Expand All @@ -162,8 +168,8 @@ void Update()
if (engine != null)
{
if (engine.type == FSengineWrapper.EngineType.FSengine)
{
currentEmission *= engine.finalThrustNormalized * engine.fsengine.RPMnormalized;
{
currentEmission *= engine.finalThrustNormalized * engine.fsengine.RPMnormalized;
}
else
{
Expand All @@ -178,7 +184,7 @@ void Update()
//KSP 1.8
}

void LateUpdate()
void LateUpdate()
{
if (!HighLogic.LoadedSceneIsFlight) return;

Expand All @@ -205,6 +211,6 @@ void LateUpdate()
// // assign the array back to the emitter
// particleFX.pEmitter.particles = particles;
//KSP 1.8
}
}
}
}
}
8 changes: 7 additions & 1 deletion Firespitter/engine/Stock based modules/FSVTOLrotator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class FSVTOLrotator : PartModule
private List<float> availableAnglesList = new List<float>
{
};
Transform partTransform = new GameObject().transform;
Transform partTransform;
private FSpropellerAtmosphericNerf atmosphericNerf = new FSpropellerAtmosphericNerf();

FSGUIPopup popup;
Expand Down Expand Up @@ -221,6 +221,12 @@ public void buildAngleList()
if (availableAngles2.z != 0) availableAnglesList.Add(availableAngles2.z);
}

public override void OnAwake()
{
base.OnAwake();
partTransform = new GameObject().transform;
}

public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
Expand Down
26 changes: 19 additions & 7 deletions Firespitter/engine/Stock based modules/FSmultiAxisEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ namespace Firespitter.engine
private bool usePitch;
private bool useRoll;
private bool useYaw;
private Transform pitchTransform = new GameObject().transform;
private Transform rollTransform = new GameObject().transform;
private Transform yawTransform = new GameObject().transform;
private Transform gimbalTransform = new GameObject().transform;
private Transform pitchGimbalExtreme = new GameObject().transform;
private Transform rollGimbalExtreme = new GameObject().transform;
private Transform yawGimbalExtreme = new GameObject().transform;
private Transform pitchTransform;
private Transform rollTransform;
private Transform yawTransform;
private Transform gimbalTransform;
private Transform pitchGimbalExtreme;
private Transform rollGimbalExtreme;
private Transform yawGimbalExtreme;

private FSengineWrapper engine;

Expand Down Expand Up @@ -155,6 +155,18 @@ private void rotateParts(Vector3 rotation)
}
}

public override void OnAwake()
{
base.OnAwake();
pitchTransform = new GameObject().transform;
rollTransform = new GameObject().transform;
yawTransform = new GameObject().transform;
gimbalTransform = new GameObject().transform;
pitchGimbalExtreme = new GameObject().transform;
rollGimbalExtreme = new GameObject().transform;
yawGimbalExtreme = new GameObject().transform;
}

public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
Expand Down

0 comments on commit b39fe6d

Please sign in to comment.