Alex P Posted June 7, 2014 Share Posted June 7, 2014 This has probably been asked many times before, but this is a big thread. How can I make a right click menu appear when I right click on a part? Like with the fuel lines, when you right click you have a button to transfer fuel. I didn't find it on the wiki.Another question - is there any way for a fuel tank to hold different mixtures of fuel? For example, a fuel tank with a 1000 capacity could hold 500 oxidizer and 500 liquid fuel, or 1000 oxidizer with 0 liquid fuel, or other combinations. Engines could take different oxidizer/liquid fuel ratios, but it would change its isp.Thanks in advance. Quote Link to comment Share on other sites More sharing options...
stupid_chris Posted June 7, 2014 Share Posted June 7, 2014 This has probably been asked many times before, but this is a big thread. How can I make a right click menu appear when I right click on a part? Like with the fuel lines, when you right click you have a button to transfer fuel. I didn't find it on the wiki.Just use a [KSPEvent] attribute over a public void to create a part menu action, else, you can just display a field by having a KSPField where guiActive = true.Another question - is there any way for a fuel tank to hold different mixtures of fuel? For example, a fuel tank with a 1000 capacity could hold 500 oxidizer and 500 liquid fuel, or 1000 oxidizer with 0 liquid fuel, or other combinations. Engines could take different oxidizer/liquid fuel ratios, but it would change its isp.Thanks in advance.Not stock, but you could code that. I believe PParts/MFS/RealFuels does that. Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 8, 2014 Share Posted June 8, 2014 How can I know if the ship is in physical timewarp or not?I found TimeWarp.WarpMode, but I can only get high or low, which isn't very informative. Quote Link to comment Share on other sites More sharing options...
TriggerAu Posted June 8, 2014 Share Posted June 8, 2014 How can I know if the ship is in physical timewarp or not?I found TimeWarp.WarpMode, but I can only get high or low, which isn't very informative.you found it, if only there was documentation . Low is physwarp and High is the other one, and TimeWarp.CurrentRate gives you the multiplier. If you're going to affect the rate of warp in your plugin (ie. use SetRate) be careful how far it shifts in one step - if the step is too large, eg going from 10000000x to 10x in one go you can end up with floating point errors entering into orbits. Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 8, 2014 Share Posted June 8, 2014 you found it, if only there was documentation . Low is physwarp and High is the other oneOk cool. I suspected it was like this, I just wanted confirmation. Also thanks for the tip on setting it Quote Link to comment Share on other sites More sharing options...
notfirestorm Posted June 8, 2014 Share Posted June 8, 2014 A quick question on ScenarioModules & persistence. I'm looking into adding persistence to my mod, and was looking into ScenarioModule. I found it also extends from MonoBehavior, meaning it can also handle OnUpdate & OnFixedUpdate. However, I've noticed alot of the other plugins out there separate their game logic in a MonoBehavior, and their persistence in a different ScenarioModule.Is there a reason for this? If I were to do both game updates and saving/loading from the same class, will I be doing something that will summon the Kraken to destroy my Config nodes? Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 8, 2014 Share Posted June 8, 2014 Right now, I am handling my persistence using the OnLoad and OnSave of my part modules. However, I'm only doing part modules, so I don't know if it applies to your mod too.I followed the explanation they gave me here, and it's working without a flaw at the moment.I don't know if this is different for scenario modules and mono behaviours, though. Quote Link to comment Share on other sites More sharing options...
xEvilReeperx Posted June 8, 2014 Share Posted June 8, 2014 I found it also extends from MonoBehavior, meaning it can also handle OnUpdate & OnFixedUpdate. However, I've noticed alot of the other plugins out there separate their game logic in a MonoBehavior, and their persistence in a different ScenarioModule.Is there a reason for this?No, you can do your saving and loading in ScenarioModule without problems. You probably mean FixedUpdate and Update though. Quote Link to comment Share on other sites More sharing options...
notfirestorm Posted June 8, 2014 Share Posted June 8, 2014 No, you can do your saving and loading in ScenarioModule without problems. You probably mean FixedUpdate and Update though.The question is not whether I can save from ScenarioModule, but if I can do game update logic from there; all the examples I've seen only do loading & saving from their ScenarioModule. Ah well, might as well see if it will work the same way I see if my rockets will fly... with lots and lots of explosions.And yes, I do mean Update() and not OnUpdate(). Sorry, too used to PartModules (Interesting to note that even in the ScenarioModule, it will be Update() & FixedUpdate(), but OnLoad() & OnSave(). "I don't always think of being consistent, but when I do, I light up an SRB instead") Quote Link to comment Share on other sites More sharing options...
xEvilReeperx Posted June 8, 2014 Share Posted June 8, 2014 The question is not whether I can save from ScenarioModule, but if I can do game update logic from thereI guess I wasn't clear. Yes you can. The stock ScenarioModules all do this. Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 9, 2014 Share Posted June 9, 2014 Originally Posted by ThermalShark My problem has been solved (for now), but if wanted to drain 30 LiquidFuel from a tank, without ever affecting other parts, i could not use RequestResource because if the tank only had 20 LF, i would drain 10 from other parts. In that case the only option would be to directly modify PartResource.amount, right? (maybe disabling crossfeed could not be an option, because i could need to transfer unrelated resources through the part, or if i needed fuel lines to not be able to pump from the part.)And again, I don't think you want to do that unless it'S for a very specific type of thing where you absolutely need to do that and there's no other solution. You really don't want to be bypassing resource flow, because incidentally you might drain something that flow logic wouldn't allow and that's not always good.Hello chris, I am doing that very specific type of thing and there is no other solution. Just wandering if anybody has any answer to ThermalShark's question, because otherwise I'm just going to go and lock all teh things.(I'm simulating a leak in a tank, so of course I want to drain only from that tank bypassing flow. If no one knows of a more elegant solution, I'm just going to set the flow mode of the resource in the tank and call it a day) Quote Link to comment Share on other sites More sharing options...
NathanKell Posted June 10, 2014 Share Posted June 10, 2014 In this particular case it's justified IMO; for the same reason RF simulates boiloff by directly changing tank amounts. Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 10, 2014 Share Posted June 10, 2014 In this particular case it's justified IMO; for the same reason RF simulates boiloff by directly changing tank amounts.However, it only works when the engines are off: if you are consuming fuel and re-assign the amount, the consumption is actually reduced, and not increased.Re-assigning the amount is only correct if the leak is the only flow in the tank. Quote Link to comment Share on other sites More sharing options...
notfirestorm Posted June 10, 2014 Share Posted June 10, 2014 Question or Idea... if you're simulating a leak in a tank, why wouldn't you want to take fuel from the stack? In real life, if fuel is flowing from one tank to another before being sent to an engine, a leak in the middle tank won't prevent fuel from leaking from the first if it flows through that tank. As long as you're doing the request resource for stuff that is flow type of STACK_PRIORITY_SEARCH, it should only drain from that part or above. Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 10, 2014 Share Posted June 10, 2014 Question or Idea... if you're simulating a leak in a tank, why wouldn't you want to take fuel from the stack? In real life, if fuel is flowing from one tank to another before being sent to an engine, a leak in the middle tank won't prevent fuel from leaking from the first if it flows through that tank. As long as you're doing the request resource for stuff that is flow type of STACK_PRIORITY_SEARCH, it should only drain from that part or above.But it FEELS wrong :/ Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 10, 2014 Share Posted June 10, 2014 (edited) Hi again, sorry for the spamming.1) Is it possible to read/write a list in config nodes?It is, and it's very easy. Assuming that your config file (or config node) looks like this:MYMODULE{ mylist = value1 mylist = value2 ... mylist = valueN}then you can load all the values like this:List<string> myList = node.GetValues("mylist").ToList<string>();2) Is it possible to access the whole persistence file (read-only is fine too)? Edited June 11, 2014 by Ippo Posted the solution if others need it Quote Link to comment Share on other sites More sharing options...
Echo 8 ÉRÀ Posted June 11, 2014 Share Posted June 11, 2014 Would anyone happen to know how to port// C#GameEvents.onVesselWasModified.Add(this.OnVesselWasModified);to C++/CLI?I've tried the obvious// C++/CLIGameEvents::onVesselWasModified->Add(gcnew EventData<Vessel^>::OnEvent(this, &Events::OnVesselWasModified));but that results inerror C2664: 'void EventData<Vessel ^>::Add(EventData<Vessel ^>::OnEvent ^)' : cannot convert argument 1 from 'EventData<Vessel ^>::OnEvent ^' to 'EventData<Vessel ^>::OnEvent ^'I currently work around it by using reflection and calling Delegate::CreateDelegate, but it'd be nice to know if there is a cleaner way of doing it.Using VS2013 Professional Update 2. Quote Link to comment Share on other sites More sharing options...
stupid_chris Posted June 12, 2014 Share Posted June 12, 2014 2) Is it possible to access the whole persistence file (read-only is fine too)?I believe doing something like this would work:private string saveFolder{ get { return System.IO.Path.Combine(KSPUtil.ApplicationRootPath, "saves/" + HighLogic.fetch.GameSaveFolder); }}private ConfigNode persistence{ get { string path = System.IO.Path.Combine(saveFolder, "persistent.cfg"); return ConfigNode.Load(path).GetNode("GAME"); }}That would return the current persistence ConfigNode I believe. Quote Link to comment Share on other sites More sharing options...
problemecium Posted June 12, 2014 Share Posted June 12, 2014 (edited) 'nother quick question: If, hypothetically, I wanted to make my own engine exhaust effect, is there any kind of reference for how to do this? Any existing threads or documentation at all?Okay scratch that. I managed to dig up some information in the HotRockets thread. But now I have a NEW question: does anyone know if it's possible to make an engine that uses a LineRenderer in addition to or instead of a particle emitter? Because I want to make something like this: Edited June 12, 2014 by parameciumkid Quote Link to comment Share on other sites More sharing options...
NathanKell Posted June 12, 2014 Share Posted June 12, 2014 HotRockets thread in Dev. Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 12, 2014 Share Posted June 12, 2014 ...Thanks, I'll try ASAP. I thought that System.IO was forbidden though... Quote Link to comment Share on other sites More sharing options...
blizzy78 Posted June 12, 2014 Share Posted June 12, 2014 I thought that System.IO was forbidden though...Don't guess. Just try stuff and see if it works. Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 12, 2014 Share Posted June 12, 2014 (edited) Don't guess. Just try stuff and see if it works.It says so on the wiki: http://wiki.kerbalspaceprogram.com/wiki/Category:KSP.IO_NamespaceAll the classes used to provide filesystem I/O in KSP in lieu of System.IO, which is a Forbidden Namespace. Edited June 12, 2014 by Ippo I cannot into BBCode Quote Link to comment Share on other sites More sharing options...
xEvilReeperx Posted June 12, 2014 Share Posted June 12, 2014 Thanks, I'll try ASAP. I thought that System.IO was forbidden though...Old info, it was allowed again a couple versions back. What are you trying to access in the persistence file? It's better to avoid loading the entire thing whenever possible Quote Link to comment Share on other sites More sharing options...
Ippo Posted June 12, 2014 Share Posted June 12, 2014 Old info, it was allowed again a couple versions back. What are you trying to access in the persistence file? It's better to avoid loading the entire thing whenever possibleI did notice Anyway, I wanted to read in the full list of hired and applicant kerbals, but that was before I found out the proper way to get them using HighLogic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.