diff --git a/.vs/Firespitter/v15/Server/sqlite3/storage.ide b/.vs/Firespitter/v15/Server/sqlite3/storage.ide index b073a65c..e0e46c05 100644 Binary files a/.vs/Firespitter/v15/Server/sqlite3/storage.ide and b/.vs/Firespitter/v15/Server/sqlite3/storage.ide differ diff --git a/Firespitter/Firespitter.csproj b/Firespitter/Firespitter.csproj index b931dd2b..3a7c577c 100644 --- a/Firespitter/Firespitter.csproj +++ b/Firespitter/Firespitter.csproj @@ -9,7 +9,7 @@ Properties Firespitter Firespitter - v3.5 + v4.0 512 @@ -27,7 +27,7 @@ pdbonly true - bin\Release\ + ..\..\..\KSP_DEV\GameData\Firespitter\Plugins\ TRACE prompt 4 @@ -53,10 +53,50 @@ ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.dll False + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.AudioModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.IMGUIModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.InputLegacyModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.InputModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.PhysicsModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll + False + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.UI.dll False + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.UIModule.dll + False + + + ..\..\..\KSP_DEV\KSP_x64_Data\Managed\UnityEngine.VehiclesModule.dll + False + diff --git a/Firespitter/Firespitter.csproj-LGG b/Firespitter/Firespitter.csproj-LGG new file mode 100644 index 00000000..f58a95dc --- /dev/null +++ b/Firespitter/Firespitter.csproj-LGG @@ -0,0 +1,155 @@ + + + + + Debug + AnyCPU + {BFE97E64-BF01-48AF-81EE-6B2610076542} + Library + Properties + Firespitter + Firespitter + v4.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + 0649 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + False + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Firespitter/cockpit/FScameraToTV.cs b/Firespitter/cockpit/FScameraToTV.cs index 9991d2d6..c5391868 100644 --- a/Firespitter/cockpit/FScameraToTV.cs +++ b/Firespitter/cockpit/FScameraToTV.cs @@ -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() { diff --git a/Firespitter/customization/FSfuelSwitch.cs b/Firespitter/customization/FSfuelSwitch.cs index 3c9d8979..70f5eb7b 100644 --- a/Firespitter/customization/FSfuelSwitch.cs +++ b/Firespitter/customization/FSfuelSwitch.cs @@ -168,10 +168,11 @@ private void assignResourcesToPart(bool calledByPlayer) if (tweakableUI == null) { - tweakableUI = Tools.FindActionWindow(part); + tweakableUI = UIPartActionController.Instance.GetItem(part); } if (tweakableUI != null) { + tweakableUI.CreatePartList(true); tweakableUI.displayDirty = true; } else diff --git a/Firespitter/engine/FSgroundParticles.cs b/Firespitter/engine/FSgroundParticles.cs index 33a7e037..1443cfaf 100644 --- a/Firespitter/engine/FSgroundParticles.cs +++ b/Firespitter/engine/FSgroundParticles.cs @@ -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 @@ -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] @@ -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); @@ -56,8 +56,16 @@ public class FSgroundParticles : PartModule private MeshFilter meshFilter; // a class which contains mesh emitter, animator and renderer, assigned to a GameObject - private FSparticleFX particleFX; - private Texture2D particleTexture; + //KSP 1.8 + //private FSparticleFX particleFX; + //private Texture2D particleTexture; + //KSP 1.8 + + new void Awake() + { + base.Awake(); + washDisc = new GameObject(); + } void Start() { @@ -67,47 +75,49 @@ void Start() // Create the mesh disc. Particles spawn inside this mesh on the ground washDisc.transform.parent = transform; - meshFilter = washDisc.AddComponent(); + meshFilter = washDisc.AddComponent(); 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"); - // it should use the default particle in this case, or just some pink crap maybe - } - else - { - //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); - particleFX.AnimatorColor2 = getColorFromV4(particleColor2); - particleFX.AnimatorColor3 = getColorFromV4(particleColor3); - particleFX.AnimatorColor4 = getColorFromV4(particleColor4); - - particleFX.EmitterMinSize = particleSize.x; - particleFX.EmitterMaxSize = particleSize.y; - particleFX.EmitterMinEnergy = particleEnergy.x; - particleFX.EmitterMaxEnergy = particleEnergy.y; - particleFX.EmitterMinEmission = 0f; - particleFX.EmitterMaxEmission = 0f; - particleFX.AnimatorSizeGrow = particleSizeGrow; - - particleFX.EmitterLocalVelocity = new Vector3(0f, 0f, 0f); - particleFX.EmitterRndVelocity = new Vector3(0f, 0f, 0f); - // creates the emitters etc and assigns the above values - particleFX.setupFXValues(); - - //particleFX.pEmitter.rndRotation = true; - - // Can't turn on Interpolate Triangles on the emitter, casue it's not exposed to code. REALLY?!? WHY? - } + //particleTexture = GameDatabase.Instance.GetTexture(particleTextureName, false); + //if (particleTexture == null) + //{ + // Debug.Log("FSgroundParticles: particle texture loading error"); + // // it should use the default particle in this case, or just some pink crap maybe + //} + //else + //{ + // //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); + // particleFX.AnimatorColor2 = getColorFromV4(particleColor2); + // particleFX.AnimatorColor3 = getColorFromV4(particleColor3); + // particleFX.AnimatorColor4 = getColorFromV4(particleColor4); + + // particleFX.EmitterMinSize = particleSize.x; + // particleFX.EmitterMaxSize = particleSize.y; + // particleFX.EmitterMinEnergy = particleEnergy.x; + // particleFX.EmitterMaxEnergy = particleEnergy.y; + // particleFX.EmitterMinEmission = 0f; + // particleFX.EmitterMaxEmission = 0f; + // particleFX.AnimatorSizeGrow = particleSizeGrow; + + // particleFX.EmitterLocalVelocity = new Vector3(0f, 0f, 0f); + // particleFX.EmitterRndVelocity = new Vector3(0f, 0f, 0f); + // // creates the emitters etc and assigns the above values + // particleFX.setupFXValues(); + + // //particleFX.pEmitter.rndRotation = true; + + // // Can't turn on Interpolate Triangles on the emitter, casue it's not exposed to code. REALLY?!? WHY? + //} + //KSP 1.8 thrustTransform = part.FindModelTransform(thrustTransformName); } @@ -131,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; } @@ -149,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); @@ -158,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 { @@ -168,35 +178,39 @@ void Update() } currentEmission = Mathf.Clamp(currentEmission, 0f, emission); - particleFX.pEmitter.minEmission = currentEmission; - particleFX.pEmitter.maxEmission = currentEmission; + //KSP 1.8 + //particleFX.pEmitter.minEmission = currentEmission; + //particleFX.pEmitter.maxEmission = currentEmission; + //KSP 1.8 } void LateUpdate() { if (!HighLogic.LoadedSceneIsFlight) return; - // to change particles you first have to get the array, modify it, then feed the whole thing back to the emitter - Particle[] particles = particleFX.pEmitter.particles; - - for (int i = 0; i < particles.Length; i++) - { - // Oh hey, you can't access Interpolate Triangles on mesh emitters, so I have to this junk! Fuck you, whoever made the old Unity particle system. - // if a new particle has a very high energy, it means it's a newly created one. Move it! - if (particles[i].energy > particles[i].startEnergy - (Time.deltaTime * 1.1f)) - { - //particles spawn on the outer points of the disc. move it a random amount towrds the center to distribute the spawning. a high number of outer points makes it look OK without exra sideways randomness. - particles[i].position = Vector3.Lerp(particles[i].position, washDisc.transform.position, UnityEngine.Random.value); - } - - // The position of the current particle relative to the disc center - Vector3 offset = washDisc.transform.position - particles[i].position; - // Repel the particles. The closer a particle is to the disc center, the faster it moves away from it. - particles[i].position -= offset.normalized * 0.01f * Mathf.Clamp((maxDistance - currentDistance) - offset.magnitude, 1f, 15f); - } - - // assign the array back to the emitter - particleFX.pEmitter.particles = particles; + //KSP 1.8 + // // to change particles you first have to get the array, modify it, then feed the whole thing back to the emitter + // Particle[] particles = particleFX.pEmitter.particles; + + // for (int i = 0; i < particles.Length; i++) + // { + // // Oh hey, you can't access Interpolate Triangles on mesh emitters, so I have to this junk! Fuck you, whoever made the old Unity particle system. + // // if a new particle has a very high energy, it means it's a newly created one. Move it! + // if (particles[i].energy > particles[i].startEnergy - (Time.deltaTime * 1.1f)) + // { + // //particles spawn on the outer points of the disc. move it a random amount towrds the center to distribute the spawning. a high number of outer points makes it look OK without exra sideways randomness. + // particles[i].position = Vector3.Lerp(particles[i].position, washDisc.transform.position, UnityEngine.Random.value); + // } + + // // The position of the current particle relative to the disc center + // Vector3 offset = washDisc.transform.position - particles[i].position; + // // Repel the particles. The closer a particle is to the disc center, the faster it moves away from it. + // particles[i].position -= offset.normalized * 0.01f * Mathf.Clamp((maxDistance - currentDistance) - offset.magnitude, 1f, 15f); + // } + + // // assign the array back to the emitter + // particleFX.pEmitter.particles = particles; + //KSP 1.8 } } } \ No newline at end of file diff --git a/Firespitter/engine/FSparticleFX.cs b/Firespitter/engine/FSparticleFX.cs index 265351aa..6cce79aa 100644 --- a/Firespitter/engine/FSparticleFX.cs +++ b/Firespitter/engine/FSparticleFX.cs @@ -2,107 +2,108 @@ namespace Firespitter { + //RBP - Deprecating this due to particle system changes. public class FSparticleFX { - public GameObject gameObject; - public GameObject parentObject; - public Texture particleTexture; - public bool useLocalSpaceVelocityHack = false; + //public GameObject gameObject; + //public GameObject parentObject; + //public Texture particleTexture; + //public bool useLocalSpaceVelocityHack = false; - public ParticleEmitter pEmitter; - public ParticleRenderer pRenderer; - public ParticleAnimator pAnimator; + //public ParticleEmitter pEmitter; + //public ParticleRenderer pRenderer; + //public ParticleAnimator pAnimator; - private bool componentsAdded = false; + //private bool componentsAdded = false; - #region component variables + //#region component variables - public string RendererShader = "Particles/Alpha Blended"; + //public string RendererShader = "Particles/Alpha Blended"; - public float EmitterMinSize = 0.1f; - public float EmitterMaxSize = 0.2f; - public float EmitterMinEnergy = 0.1f; - public float EmitterMaxEnergy = 0.8f; - public float EmitterMinEmission = 120f; - public float EmitterMaxEmission = 160f; - public Vector3 EmitterLocalVelocity = new Vector3(0f, 0f, 1f); - public Vector3 EmitterRndVelocity = new Vector3(0f, 0.1f, 0.1f); - public bool EmitterUseWorldSpace = true; - public bool EmitterRandomRotation = true; + //public float EmitterMinSize = 0.1f; + //public float EmitterMaxSize = 0.2f; + //public float EmitterMinEnergy = 0.1f; + //public float EmitterMaxEnergy = 0.8f; + //public float EmitterMinEmission = 120f; + //public float EmitterMaxEmission = 160f; + //public Vector3 EmitterLocalVelocity = new Vector3(0f, 0f, 1f); + //public Vector3 EmitterRndVelocity = new Vector3(0f, 0.1f, 0.1f); + //public bool EmitterUseWorldSpace = true; + //public bool EmitterRandomRotation = true; - public bool AnimatorDoesAnimateColor = true; + //public bool AnimatorDoesAnimateColor = true; - public Color AnimatorColor0 = new Color(0.2f, 0.2f, 0.2f, 0.1f); - public Color AnimatorColor1 = new Color(0.3f, 0.3f, 0.3f, 0.1f); - public Color AnimatorColor2 = new Color(0.5f, 0.5f, 0.5f, 0.09f); - public Color AnimatorColor3 = new Color(0.8f, 0.8f, 0.8f, 0.07f); - public Color AnimatorColor4 = new Color(1f, 1f, 1f, 0.05f); - - public float AnimatorSizeGrow = 0.5f; - - #endregion - - public FSparticleFX(GameObject _gameObject, Texture2D _particleTexture) - { - gameObject = _gameObject; - particleTexture = _particleTexture; - } - - private void addComponents() - { - pEmitter = gameObject.AddComponent(); - pRenderer = gameObject.AddComponent(); - pAnimator = gameObject.AddComponent(); - } + //public Color AnimatorColor0 = new Color(0.2f, 0.2f, 0.2f, 0.1f); + //public Color AnimatorColor1 = new Color(0.3f, 0.3f, 0.3f, 0.1f); + //public Color AnimatorColor2 = new Color(0.5f, 0.5f, 0.5f, 0.09f); + //public Color AnimatorColor3 = new Color(0.8f, 0.8f, 0.8f, 0.07f); + //public Color AnimatorColor4 = new Color(1f, 1f, 1f, 0.05f); + + //public float AnimatorSizeGrow = 0.5f; + + //#endregion + + //public FSparticleFX(GameObject _gameObject, Texture2D _particleTexture) + //{ + // gameObject = _gameObject; + // particleTexture = _particleTexture; + //} + + //private void addComponents() + //{ + // pEmitter = gameObject.AddComponent(); + // pRenderer = gameObject.AddComponent(); + // pAnimator = gameObject.AddComponent(); + //} - public void setupFXValues() - { - if (!componentsAdded) - { - addComponents(); - componentsAdded = true; - } - pRenderer.materials = new Material[1]; - pRenderer.materials[0].shader = Shader.Find(RendererShader); - pRenderer.materials[0].mainTexture = particleTexture; - - pEmitter.minSize = EmitterMinSize; - pEmitter.maxSize = EmitterMaxSize; - pEmitter.minEnergy = EmitterMinEnergy; - pEmitter.maxEnergy = EmitterMaxEnergy; - pEmitter.minEmission = EmitterMinEmission; - pEmitter.maxEmission = EmitterMaxEmission; - pEmitter.localVelocity = EmitterLocalVelocity; - pEmitter.rndVelocity = EmitterRndVelocity; - pEmitter.useWorldSpace = EmitterUseWorldSpace; - - pAnimator.doesAnimateColor = AnimatorDoesAnimateColor; - - Color[] colorAnimation = pAnimator.colorAnimation; - colorAnimation[0] = AnimatorColor0; - colorAnimation[1] = AnimatorColor1; - colorAnimation[2] = AnimatorColor2; - colorAnimation[3] = AnimatorColor3; - colorAnimation[4] = AnimatorColor4; - pAnimator.colorAnimation = colorAnimation; - - pAnimator.sizeGrow = AnimatorSizeGrow; - } + //public void setupFXValues() + //{ + // if (!componentsAdded) + // { + // addComponents(); + // componentsAdded = true; + // } + // pRenderer.materials = new Material[1]; + // pRenderer.materials[0].shader = Shader.Find(RendererShader); + // pRenderer.materials[0].mainTexture = particleTexture; + + // pEmitter.minSize = EmitterMinSize; + // pEmitter.maxSize = EmitterMaxSize; + // pEmitter.minEnergy = EmitterMinEnergy; + // pEmitter.maxEnergy = EmitterMaxEnergy; + // pEmitter.minEmission = EmitterMinEmission; + // pEmitter.maxEmission = EmitterMaxEmission; + // pEmitter.localVelocity = EmitterLocalVelocity; + // pEmitter.rndVelocity = EmitterRndVelocity; + // pEmitter.useWorldSpace = EmitterUseWorldSpace; + + // pAnimator.doesAnimateColor = AnimatorDoesAnimateColor; + + // Color[] colorAnimation = pAnimator.colorAnimation; + // colorAnimation[0] = AnimatorColor0; + // colorAnimation[1] = AnimatorColor1; + // colorAnimation[2] = AnimatorColor2; + // colorAnimation[3] = AnimatorColor3; + // colorAnimation[4] = AnimatorColor4; + // pAnimator.colorAnimation = colorAnimation; + + // pAnimator.sizeGrow = AnimatorSizeGrow; + //} - public void updateFX() - { + //public void updateFX() + //{ - if (useLocalSpaceVelocityHack) - { - //float velMagnitude = parentObject.GetComponent().velocity.magnitude; - float fxSpeed = Vector3.Dot(gameObject.transform.forward, parentObject.GetComponent().velocity); - if (fxSpeed > 0f) - fxSpeed = 0; - pEmitter.localVelocity = new Vector3(0f, 0f, 1f + (-fxSpeed * 0.1f)); - //pEmitter.maxEmission = pEmitter.minEmission + (velMagnitude * 3); - } - } + // if (useLocalSpaceVelocityHack) + // { + // //float velMagnitude = parentObject.GetComponent().velocity.magnitude; + // float fxSpeed = Vector3.Dot(gameObject.transform.forward, parentObject.GetComponent().velocity); + // if (fxSpeed > 0f) + // fxSpeed = 0; + // pEmitter.localVelocity = new Vector3(0f, 0f, 1f + (-fxSpeed * 0.1f)); + // //pEmitter.maxEmission = pEmitter.minEmission + (velMagnitude * 3); + // } + //} } } diff --git a/Firespitter/engine/FSvelocityController.cs b/Firespitter/engine/FSvelocityController.cs index 56403679..36795c20 100644 --- a/Firespitter/engine/FSvelocityController.cs +++ b/Firespitter/engine/FSvelocityController.cs @@ -34,7 +34,9 @@ public class FSvelocityController : PartModule Transform[] transformArray; private bool transformsFound = false; private Vector3 velocityDirection = new Vector3(0f, 0f, 0f); - private Firespitter.FSparticleFX[] particleFX; + //KSP 1.8 + //private Firespitter.FSparticleFX[] particleFX; + //KSP 1.8 private Texture2D particleTexture; private Vector3 finalThrust = new Vector3(0f, 0f, 0f); @@ -50,7 +52,9 @@ public override void OnStart(PartModule.StartState state) if (transformArray.Length > 0) { transformsFound = true; - particleFX = new Firespitter.FSparticleFX[transformArray.Length]; + //KSP 1.8 + //particleFX = new Firespitter.FSparticleFX[transformArray.Length]; + //KSP 1.8 } else { @@ -64,16 +68,18 @@ public override void OnStart(PartModule.StartState state) particleTexture = GameDatabase.Instance.GetTexture(particleTextureName, false); if (particleTexture != null) { - for (int i = 0; i < particleFX.Length; i++) - { - particleFX[i] = new Firespitter.FSparticleFX(transformArray[i].gameObject, particleTexture); - particleFX[i].EmitterLocalVelocity = EmitterLocalVelocity; - //Debug.Log("KTvelocityController: particle texture found: " + particleTextureName); - particleFX[i].setupFXValues(); - particleFX[i].pEmitter.minEmission = 0f; - particleFX[i].pEmitter.maxEmission = 0f; - particleFX[i].pEmitter.useWorldSpace = false; - } + //KSP 1.8 + //for (int i = 0; i < particleFX.Length; i++) + //{ + // particleFX[i] = new Firespitter.FSparticleFX(transformArray[i].gameObject, particleTexture); + // particleFX[i].EmitterLocalVelocity = EmitterLocalVelocity; + // //Debug.Log("KTvelocityController: particle texture found: " + particleTextureName); + // particleFX[i].setupFXValues(); + // particleFX[i].pEmitter.minEmission = 0f; + // particleFX[i].pEmitter.maxEmission = 0f; + // particleFX[i].pEmitter.useWorldSpace = false; + //} + //KSP 1.8 } else { @@ -111,11 +117,13 @@ public override void OnFixedUpdate() thrustUsed = 0f; if (thrustUsed > 0f) part.gameObject.GetComponent().AddForceAtPosition(finalThrust, t.transform.position); - if (useFX) - { - particleFX[i].pEmitter.minEmission = defaultEmitterMinEmission * thrustUsed; - particleFX[i].pEmitter.maxEmission = defaultEmitterMaxEmission * thrustUsed; - } + //KSP 1.8 + //if (useFX) + //{ + // particleFX[i].pEmitter.minEmission = defaultEmitterMinEmission * thrustUsed; + // particleFX[i].pEmitter.maxEmission = defaultEmitterMaxEmission * thrustUsed; + //} + //KSP 1.8 i++; } } diff --git a/Firespitter/engine/Stock based modules/FSVTOLrotator.cs b/Firespitter/engine/Stock based modules/FSVTOLrotator.cs index 76a1bd11..fe60607d 100644 --- a/Firespitter/engine/Stock based modules/FSVTOLrotator.cs +++ b/Firespitter/engine/Stock based modules/FSVTOLrotator.cs @@ -31,7 +31,7 @@ public class FSVTOLrotator : PartModule private List availableAnglesList = new List { }; - Transform partTransform = new GameObject().transform; + Transform partTransform; private FSpropellerAtmosphericNerf atmosphericNerf = new FSpropellerAtmosphericNerf(); FSGUIPopup popup; @@ -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); diff --git a/Firespitter/engine/Stock based modules/FSmultiAxisEngine.cs b/Firespitter/engine/Stock based modules/FSmultiAxisEngine.cs index dfb96038..6e48bb0f 100644 --- a/Firespitter/engine/Stock based modules/FSmultiAxisEngine.cs +++ b/Firespitter/engine/Stock based modules/FSmultiAxisEngine.cs @@ -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; @@ -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); diff --git a/Firespitter/wheel/FSwheel.cs b/Firespitter/wheel/FSwheel.cs index e1e70fd3..2d64da97 100644 --- a/Firespitter/wheel/FSwheel.cs +++ b/Firespitter/wheel/FSwheel.cs @@ -701,28 +701,30 @@ public override void OnStart(PartModule.StartState state) } else { - for (int i = 0; i < wheelList.wheels.Count; i++) - { - wheelList.wheels[i].smokeFX = new Firespitter.FSparticleFX(wheelList.wheels[i].fxLocation, smokeFXtexture); - wheelList.wheels[i].smokeFX.AnimatorColor0 = new Color(1.0f, 1.0f, 1.0f, 0.8f); - wheelList.wheels[i].smokeFX.AnimatorColor1 = new Color(1.0f, 1.0f, 1.0f, 0.5f); - wheelList.wheels[i].smokeFX.AnimatorColor2 = new Color(1.0f, 1.0f, 1.0f, 0.2f); - wheelList.wheels[i].smokeFX.AnimatorColor3 = new Color(1.0f, 1.0f, 1.0f, 0.1f); - wheelList.wheels[i].smokeFX.AnimatorColor4 = new Color(1.0f, 1.0f, 1.0f, 0.0f); - - wheelList.wheels[i].smokeFX.EmitterMinSize = 0.3f; - wheelList.wheels[i].smokeFX.EmitterMaxSize = 0.5f; - wheelList.wheels[i].smokeFX.EmitterMinEnergy = 0.1f; - wheelList.wheels[i].smokeFX.EmitterMaxEnergy = 0.3f; - wheelList.wheels[i].smokeFX.EmitterMinEmission = 0f; - wheelList.wheels[i].smokeFX.EmitterMaxEmission = 0f; - wheelList.wheels[i].smokeFX.AnimatorSizeGrow = 0.1f; + //for (int i = 0; i < wheelList.wheels.Count; i++) + //{ + //KSP 1.8 + //wheelList.wheels[i].smokeFX = new Firespitter.FSparticleFX(wheelList.wheels[i].fxLocation, smokeFXtexture); + //wheelList.wheels[i].smokeFX.AnimatorColor0 = new Color(1.0f, 1.0f, 1.0f, 0.8f); + //wheelList.wheels[i].smokeFX.AnimatorColor1 = new Color(1.0f, 1.0f, 1.0f, 0.5f); + //wheelList.wheels[i].smokeFX.AnimatorColor2 = new Color(1.0f, 1.0f, 1.0f, 0.2f); + //wheelList.wheels[i].smokeFX.AnimatorColor3 = new Color(1.0f, 1.0f, 1.0f, 0.1f); + //wheelList.wheels[i].smokeFX.AnimatorColor4 = new Color(1.0f, 1.0f, 1.0f, 0.0f); + + //wheelList.wheels[i].smokeFX.EmitterMinSize = 0.3f; + //wheelList.wheels[i].smokeFX.EmitterMaxSize = 0.5f; + //wheelList.wheels[i].smokeFX.EmitterMinEnergy = 0.1f; + //wheelList.wheels[i].smokeFX.EmitterMaxEnergy = 0.3f; + //wheelList.wheels[i].smokeFX.EmitterMinEmission = 0f; + //wheelList.wheels[i].smokeFX.EmitterMaxEmission = 0f; + //wheelList.wheels[i].smokeFX.AnimatorSizeGrow = 0.1f; - wheelList.wheels[i].smokeFX.setupFXValues(); + //wheelList.wheels[i].smokeFX.setupFXValues(); + //KSP 1.8 } + //} } } - } - + #endregion } @@ -1063,40 +1065,42 @@ private void fireScreechEffect(int wheelNumber, float deltaRPM) private void updateScreechEffect(int wheelNumber) { - if (wheelList.wheels[wheelNumber].screechCountdown > 0f) - { + //KSP 1.8 + //if (wheelList.wheels[wheelNumber].screechCountdown > 0f) + //{ // emit particles - if (wheelList.wheels[wheelNumber].wheelCollider.isGrounded) - { - if (useCustomParticleFX) - { - wheelList.wheels[wheelNumber].smokeFX.pEmitter.minEmission = particleEmissionRate * fxLevel; - wheelList.wheels[wheelNumber].smokeFX.pEmitter.maxEmission = particleEmissionRate * fxLevel; - } - else - { - part.Effect("tireSmoke", fxLevel); - } - } - else - { - if (useCustomParticleFX) - { - wheelList.wheels[wheelNumber].smokeFX.pEmitter.minEmission = 0f; - wheelList.wheels[wheelNumber].smokeFX.pEmitter.maxEmission = 0f; - } - } - //smokeFX - wheelList.wheels[wheelNumber].screechCountdown -= TimeWarp.deltaTime; - } - else - { - if (useCustomParticleFX) - { - wheelList.wheels[wheelNumber].smokeFX.pEmitter.minEmission = 0f; - wheelList.wheels[wheelNumber].smokeFX.pEmitter.maxEmission = 0f; - } - } + //if (wheelList.wheels[wheelNumber].wheelCollider.isGrounded) + //{ + // if (useCustomParticleFX) + // { + // wheelList.wheels[wheelNumber].smokeFX.pEmitter.minEmission = particleEmissionRate * fxLevel; + // wheelList.wheels[wheelNumber].smokeFX.pEmitter.maxEmission = particleEmissionRate * fxLevel; + // } + // else + // { + // part.Effect("tireSmoke", fxLevel); + // } + //} + //else + //{ + // if (useCustomParticleFX) + // { + // wheelList.wheels[wheelNumber].smokeFX.pEmitter.minEmission = 0f; + // wheelList.wheels[wheelNumber].smokeFX.pEmitter.maxEmission = 0f; + // } + //} + ////smokeFX + //wheelList.wheels[wheelNumber].screechCountdown -= TimeWarp.deltaTime; + //} + //else + //{ + // if (useCustomParticleFX) + // { + // wheelList.wheels[wheelNumber].smokeFX.pEmitter.minEmission = 0f; + // wheelList.wheels[wheelNumber].smokeFX.pEmitter.maxEmission = 0f; + // } + //} + //KSP 1.8 } public void OnGUI() diff --git a/For release/Firespitter/Firespitter.version b/For release/Firespitter/Firespitter.version index 97fe7824..c094ab6e 100644 --- a/For release/Firespitter/Firespitter.version +++ b/For release/Firespitter/Firespitter.version @@ -3,22 +3,22 @@ "URL": "https://raw.githubusercontent.com/snjo/Firespitter/master/For%20release/Firespitter/Firespitter.version", "VERSION": { "MAJOR": 7, - "MINOR": 12, + "MINOR": 15, "PATCH": 0 }, "KSP_VERSION":{ "MAJOR":1, - "MINOR":6, + "MINOR":8, "PATCH":0 }, "KSP_VERSION_MIN":{ "MAJOR":1, - "MINOR":6, + "MINOR":8, "PATCH":0 }, "KSP_VERSION_MAX":{ "MAJOR":1, - "MINOR":6, + "MINOR":8, "PATCH":9 } } diff --git a/For release/Firespitter/Plugins/Firespitter.dll b/For release/Firespitter/Plugins/Firespitter.dll index 8b773483..9af40d96 100644 Binary files a/For release/Firespitter/Plugins/Firespitter.dll and b/For release/Firespitter/Plugins/Firespitter.dll differ diff --git a/For release/Firespitter/Plugins/Firespitter.pdb b/For release/Firespitter/Plugins/Firespitter.pdb index ee4c8095..adf6c2a0 100644 Binary files a/For release/Firespitter/Plugins/Firespitter.pdb and b/For release/Firespitter/Plugins/Firespitter.pdb differ