![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_default_photo.png)
jgjiscool
-
Posts
846 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Posts posted by jgjiscool
-
-
Yes. Per engine. Each engine has it\'s own window that will appear only in flight if you click on it.
-
*Thread Updated*
Observation of files completed... time to get to work...
-
Finally it will be possible! You will be able to shut down engines when you don\'t need them, and start them back up when you do... WITHOUT JUST STOPPING THE THRUST!!! Big Red Button Pressers presents to you:
Start-Stop Plugin
It\'s still a work in progress, but here it is so far:
Download Links:
https://dl.dropbox.com/u/59317800/BRBP_LFEControl.dll
This version hopefully works for 0.16. I haven\'t tested it so let me know if it works or not.
http://dl.dropbox.com/u/59317800/BRBP%20LFE%20Control%20Part%20Class%20Only.zip
This version creates a new part class that stops the override of the main engines. Use this if you use another plugin to control your engines or you don\'t want this ridiculous function on the other engines.
http://dl.dropbox.com/u/59317800/BRBP%20LFE%20Complete%20Override.zip
This version creates a complete override of the existing LiquidEngine part class giving Start-Stop functions to any engine. It does not appear to work with other plugins that take exclusive control of the engines.
License: Attribution-Noncommercial-Share Alike (BY-NC-SA)
using System;
using System.Collections.Generic;
/*
LIQUID ENGINE CONTROL PLUGIN
Created By: Jayson Grieve (jgjiscool)
Credit to: N3X15
Cephei
Description: This is the part for the budding plane engineers! It allows you to disable parts that you aren\'t using
and reactivate them later!
License: Creative Commons Attribution ShareAlike 3.0
*/
// The Separate Part Class has LiquidEngineControlONLY instead of LiquidEngine
public class LiquidEngine : Part
{
private Rect windowPos;
protected float inFL;
public float maxThrust = 200f;
public float fuelConsumption = 8f;
public float heatProduction = 370f;
public float gimbalRange = 2.5f;
public Vector3 thrustVector = Vector3.up;
public float minThrust;
public float gimbalAngleH;
public float gimbalAngleV;
protected Vector3 thrVector;
private RaycastHit hit;
public bool thrustVectoringCapable;
protected float thrust;
private FXGroup activeGroup;
private VInfoBox tempIndicator;
protected Part fuelSource;
protected Transform gimbal;
protected Quaternion initRot;
protected static int guiQueueSpot = 2;
private int myguiQueueSpot;
private void WindowGUI(int windowID)
{
GUI.DragWindow(new Rect(0, 0, 10000, 20));
GUIStyle mySty = new GUIStyle(GUI.skin.button);
mySty.normal.textColor = mySty.focused.textColor = Color.white;
mySty.hover.textColor = mySty.active.textColor = Color.yellow;
mySty.onNormal.textColor = mySty.onFocused.textColor = mySty.onHover.textColor = mySty.onActive.textColor = Color.green;
mySty.padding = new RectOffset(8, 8, 8, 8);
GUILayout.BeginVertical();
if (GUILayout.Button('Stop', mySty, GUILayout.ExpandWidth(true)))
{
this.deactivate();
}
if (GUILayout.Button('Start', mySty, GUILayout.ExpandWidth(true)))
{
this.force_activate();
}
if (GUILayout.Button('Close', mySty, GUILayout.ExpandWidth(true)))
{
RenderingManager.RemoveFromPostDrawQueue(myguiQueueSpot, new Callback(drawGUI));
}
GUILayout.EndVertical();
}
protected override void onCtrlUpd(FlightCtrlState ctrlState)
{
this.thrust = (this.maxThrust - this.minThrust) * ctrlState.mainThrottle + this.minThrust;
this.gimbalAngleH = ctrlState.yaw * this.gimbalRange;
this.gimbalAngleV = ctrlState.pitch * this.gimbalRange;
}
private void drawGUI()
{
GUI.skin = HighLogic.Skin;
windowPos = GUILayout.Window(1, windowPos, WindowGUI, 'Engine Control', GUILayout.MinWidth(150));
}
void OnMouseUpAsButton() {
if (inFL == 1f)
{
RenderingManager.AddToPostDrawQueue(myguiQueueSpot, new Callback(drawGUI));
}
}
protected override bool onPartActivate()
{
if ((UnityEngine.Object)this.fuelSource == (UnityEngine.Object)null)
{ this.deactivate(); inFL = 0; RenderingManager.RemoveFromPostDrawQueue(myguiQueueSpot, new Callback(drawGUI)); }
this.stackIcon.SetIconColor(XKCDColors.AcidGreen);
return true;
}
protected override void onActiveFixedUpdate()
{
if (fuelSource.GetType().Name == 'FuelTank')
{
}
else if ((this.parent.parent.name) == 'FuelTank')
{
if (this.parent.fuelCrossFeed == true)
{
this.fuelSource = this.parent.parent;
}
}
this.activeGroup.Power = Mathf.Max(Mathf.Min(this.thrust / (this.maxThrust * 0.5f), 1.75f), 0.5f);
if (!this.RequestFuel((Part)this, (float)((double)this.fuelConsumption * (double)Time.deltaTime * ((double)this.thrust / (double)this.maxThrust)), Part.getFuelReqId()) && !this.RequestFuel((Part)this, (float)((double)this.fuelConsumption * (double)Time.deltaTime * ((double)this.thrust / (double)this.maxThrust)), Part.getFuelReqId()))
{
this.deactivate();
}
else
{
this.thrVector = this.transform.rotation * this.thrustVector;
if (this.thrustVectoringCapable)
this.thrustVectoring();
if ((double)this.thrust > 0.0)
{
this.Rigidbody.AddForceAtPosition(this.thrVector * this.thrust, this.transform.position, ForceMode.Force);
Debug.DrawRay(this.transform.position + this.Rigidbody.velocity * Time.deltaTime, -this.thrVector, XKCDColors.RedOrange);
if (Physics.Raycast(this.transform.position, -this.thrVector, out this.hit, 10f, 524289) && (bool)((UnityEngine.Object)this.hit.collider.transform.root.GetComponent<Part>()))
{
MonoBehaviour.print((object)('Exhaust damage on ' + this.hit.collider.transform.root.gameObject.name));
this.hit.collider.transform.root.GetComponent<Part>().temperature += this.heatProduction * (this.thrust / this.maxThrust) * Time.deltaTime;
this.hit.rigidbody.AddForceAtPosition(-this.thrVector * this.thrust, this.hit.point, ForceMode.Force);
FlightLogger.ReportEvent(new EventReport(FlightEvents.SPLASHDAMAGE, (Part)this, this.hit.collider.transform.root.gameObject.name, this.name, 0, string.Empty));
}
}
LiquidEngine liquidengine = this;
double num = (double)liquidengine.temperature + (double)this.heatProduction * ((double)this.thrust / (double)this.maxThrust) * (double)Time.deltaTime;
liquidengine.temperature = (float)num;
if ((double)this.thrust == 0.0)
{
if (this.activeGroup.Active)
this.activeGroup.setActive(false);
}
else if (!this.activeGroup.Active)
this.activeGroup.setActive(true);
if ((double)this.temperature / (double)this.maxTemp >= 0.699999988079071)
{
if (this.tempIndicator == null)
{
this.tempIndicator = this.stackIcon.DisplayInfo();
XKCDColors.NextColorAlpha = 0.6f;
this.tempIndicator.SetMsgBgColor(XKCDColors.DarkRed);
this.tempIndicator.SetMsgTextColor(XKCDColors.OrangeYellow);
this.tempIndicator.SetMessage('Overheat!');
this.tempIndicator.SetProgressBarBgColor(XKCDColors.DarkRed);
this.tempIndicator.SetProgressBarColor(XKCDColors.OrangeYellow);
XKCDColors.NextColorAlpha = 1f;
}
this.tempIndicator.SetValue(this.temperature / this.maxTemp, 0.7f, 1f);
}
else
{
if (this.tempIndicator == null)
return;
this.stackIcon.RemoveInfo(this.tempIndicator);
this.tempIndicator = (VInfoBox)null;
}
}
}
protected void onDeactivate()
{
RenderingManager.RemoveFromPostDrawQueue(myguiQueueSpot, new Callback(drawGUI));
this.stackIcon.SetIconColor(XKCDColors.Blue);
this.stackIcon.ClearInfoBoxes();
this.tempIndicator = (VInfoBox)null;
}
protected override void onFlightStart()
{
inFL = 1f;
myguiQueueSpot = guiQueueSpot;
guiQueueSpot += 1;
this.activeGroup = this.findFxGroup('active');
this.gimbal = this.transform.FindChild('model').FindChild('obj_gimbal');
if ((UnityEngine.Object)this.gimbal != (UnityEngine.Object)null)
this.initRot = this.gimbal.localRotation;
this.fuelSource = this.parent;
}
protected override void onPartStart()
{
this.stackIcon.SetIcon(DefaultIcons.LIQUID_ENGINE);
print('Liquid Engine Control Plugin Part Loaded');
if ((windowPos.x == 0) && (windowPos.y == 0))
{
windowPos = new Rect(Screen.width / 2, Screen.height / 2, 10, 10);
}
}
protected override void onPartDestroy()
{
RenderingManager.RemoveFromPostDrawQueue(myguiQueueSpot, new Callback(drawGUI));
}
protected override void onDecouple(float breakForce)
{
inFL = 0;
this.deactivate();
RenderingManager.RemoveFromPostDrawQueue(myguiQueueSpot, new Callback(drawGUI));
}
private void thrustVectoring()
{
this.thrVector = Quaternion.AngleAxis(this.gimbalAngleV, this.localRoot.transform.right) * this.thrVector;
this.thrVector = Quaternion.AngleAxis(this.gimbalAngleH, this.localRoot.transform.forward) * this.thrVector;
using (List<GameObject>.Enumerator enumerator = this.activeGroup.fxEmitters.GetEnumerator())
{
while (enumerator.MoveNext())
enumerator.Current.transform.up = this.thrVector;
}
if (!((UnityEngine.Object)this.gimbal != (UnityEngine.Object)null))
return;
this.gimbal.localRotation = this.initRot * Quaternion.AngleAxis(this.gimbalAngleV, this.gimbal.InverseTransformDirection(this.localRoot.transform.right)) * Quaternion.AngleAxis(this.gimbalAngleH, this.gimbal.InverseTransformDirection(this.localRoot.transform.forward));
}
public override void OnDrawStats()
{
object[] objArray = new object[8];
int index1 = 0;
string str1 = 'Max Thrust: ';
objArray[index1] = (object)str1;
int index2 = 1;
objArray[index2] = (object)(ValueType)this.maxThrust;
int index3 = 2;
string str2 = '\nMin Thrust: ';
objArray[index3] = (object)str2;
int index4 = 3;
objArray[index4] = (object)(ValueType)this.minThrust;
int index5 = 4;
string str3 = '\nBurn rate: ';
objArray[index5] = (object)str3;
int index6 = 5;
objArray[index6] = (object)(ValueType)this.fuelConsumption;
int index7 = 6;
string str4 = '\nThrust Vectoring: ';
objArray[index7] = (object)str4;
int index8 = 7;
string str5 = !this.thrustVectoringCapable ? 'No' : 'Yes\nGimbal Range: ' + this.gimbalRange.ToString('0.0');
objArray[index8] = (object)str5;
string text = string.Concat(objArray);
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index9 = 0;
GUILayoutOption guiLayoutOption = GUILayout.ExpandHeight(true);
guiLayoutOptionArray[index9] = guiLayoutOption;
GUILayout.TextArea(text, guiLayoutOptionArray);
}
}using UnityEngine;
KNOWN ISSUES:
* Does not work with tri-couplers (FIXED) *
* Can not spawn multiple windows *
Good Luck Kerbalnauts!!!
P.s. DO NOT TRY TO OPEN MULTIPLE WINDOWS!!! CLOSE THEM BEFORE YOU OPEN ANOTHER ONE!!!
-
Clippy punches you up the next flight of stairs and as you try to escape, you run into a steel bar placed at groin level... You think 'Today has not been my luckiest...'
-
You run out of peanuts on level 58 so you climb to 59 to get some more.
-
Now you may be asking, how to create a projectile on the fly eh? Its going to be a little complicated because you need to create everything purely in script. But it can be done. You need to first create a 'GameObject' and attach to it everything that it requires. Such as a visual model, a physics collider and particle effects. Once you have built the game object, you can create clones of it with the 'Instantiate' command of unity.
Or I can export a prefab out of unity itself?
-
You climb the stairs to level 58 and then trip on a thin wire stretched across the stairwell door. This casues a mallet to fall on your head.
You wake up and you\'re on level 57... still.
-
... On level 56 (you can\'t go up any faster because of your fall on level 54) you decide to farm the concrete delusionally because the sundae you had on level 51 was drugged.
-
My first successful Mun landing was a failure!
I landed... on unlevel ground and disaster followed as the reentry stage fell off and all control was lost...
-
No I just thought it was literally 'Click Me!'
-
You find level 54. It\'s pitch black, and you trip on a carefully placed rake.
-
I can\'t see the images at school, and nothing happens if you click the 'Click Me!' marquee. SINCE I can\'t see the images and therefore can\'t judge them,
5 out of 10
-
7/10 I\'m not sure which planet that is, but it is pretty... And I\'m going to blow kerbals up there one day...
-
9/10 because of the terrified look.
-
So far all I have to use is the 'Decouple()' function...
-
Jokes
in The Lounge
What is red, has wheels and flies?
A dead bus
-
O_O Bring in Nuclear Electricity!!!
-
I wish I had it. But I think this thread is somewhat doomed now...
-
Nuclear rocket power could still be a good idea. It would overheat lots and you would have to create a power generator key set, but it could be effective (and deadly). *Gets a plugin idea*
-
8/10
It\'s black and white and I don\'t know who that is, but he looks smart.
-
Jokes
in The Lounge
Is it ok to revive an old topic? I\'d better.....thread......carefully.
Sorry.
I\'m just upset that I wanted to go to Norway but can\'t a-fjord it.....
HAHAHAHAHAHA!!! Of course you can revive it! I\'d forgotten all about it and I think everyone else did too! There are some crackup jokes in here! Welcome to the second life of the Jokes thread!
-
Would be handy if you could allow access to the key binding to change it, in a .cfg or something. Would that be difficult?
Hopefully not... If anyone else would like to help with the code, it would be good too. I reckon I could get it to read from the main CFG.
-
If it is possible, it should be triggered by a button other than T, R, ETC.
I was thinking of that... I\'ll see what I can do.
-
8/10 for the logo that resembles something relevant to you. Points lost for not including explosions in the background.
[PLUGIN,0.15.X,0.16] Start-Stop Engines V 0.1 (Alpha)
in KSP1 Mod Releases
Posted
Mmmmm. Haven\'t tested that, but it still may work. I\'ll figure it out anyway. BTW, the module actually DOES work, the engine code just isn\'t in it yet.