-
Posts
611 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Warezcrawler
-
VAB/SPH
-
Hi. Does anyone know if it is possible to make engines receive a balance amount of intakeair, so that flameout is symmetric?
-
[1.3.0] Kerbal Engineer Redux 1.1.3.0 (2017-05-28)
Warezcrawler replied to cybutek's topic in KSP1 Mod Releases
just restore the entire settings library, that usually works for my. The custom tabs are in the file "SectionLibrary.xml". -
KSP 1.2.2 GameEvents Extension
Warezcrawler replied to JPLRepo's topic in KSP1 C# Plugin Development Help and Support
a question. Is it only addins (i.e. monobehaviour) type plugins where events are relevant, or could you create an event in a partsModule, for when some specific action is taken or something? I'm asking as I cannot figure out the implications of having events being created by multiple modules..... -
@Diazo and @DMagic Thanks for your advice! After a lot of messing around I think I got it to work. I ended up going about it like DMagic suggested. I anybody out there needs the answer, I'll try and sum it up. //Initializing the objects MAG = part.FindModuleImplementing<ModuleAnimationGroup>(); //Finding the ModuleAnimationGroup Anim = part.FindModelAnimator(MAG.deployAnimationName); //Finding the Animation then in my event I use invoke to make sure I check when the animation is finished //Getting the lenght of the animation. I add 0.1 to get on the other side of the animation. try { AnimLength = Anim.clip.length + 0.1f; } catch { AnimLength = 1f; } //I'm unsure if it might in some cases not exist, so I use a try statement //Then I invoke my update of the converter modules when it is expected to be finished Invoke("ModuleAnimationGroupEventInvoke", AnimLength); I have my invoke call itself until the animation is finished with a very small interval. private void ModuleAnimationGroupEventInvoke() { //Here I use the ".isPlaying" boolean of the animation to check if it is finished, and ready to be updated if (Anim.isPlaying == false) { Debug.Log("'ModuleAnimationGroupEventInvoke': not deployed"); updateConverter(silentUpdate: true); //reset invoke counter _InvokeCounter = 0; } else { //If no ready, I recall the invoke shortly again until update could be performed if (_InvokeCounter < 60) { Invoke("ModuleAnimationGroupEventInvoke", 0.01f); _InvokeCounter++; } else { _InvokeCounter = 0; } } } In this way I was able to take control over the converter modules, even with the "ModuleAnimationGroup" module present. It's not absolutely pretty, but it works. My invoke usually don't reinvoke so far.
-
I created a MultiModeConverter module, which enables switching converter setup instead of having multiple converters or multiple converter module in a single converter that can run simultaneously. Now I've run into an issue. The module seems to work just fine most of the time, but I ran into an issue when the converter has the "ModuleAnimationGroup". I cloned and modified the Karbonite "KA-2500 Particle Collector", which has this animation, and each time it is activated, it automatically activates all converters at the same time.... MODULE { name = ModuleAnimationGroup deployAnimationName = Deploy activeAnimationName = moduleType = Collector } So my questions are. How do I in my plugin disable the behavior of "activating all the converters" when deploying the part - if this is at all possible.... alternatively how do I detect if the animation is finished, then I can invoke my oversteering after that, and regain control. alternatively how do I detect how long the animation takes (which seem to be the basis of invoking this change), then I can invoke my oversteering after that, and regain control. alternative 2+3 are not optimal, but acceptable. Maybe there is an alternative I haven't considered yet? Currently I have hardcoded my plugin to update 2 sec after the module is activate (hence after animation finishes), it works, but is not pretty.
-
[1.9.*] GTIndustries (Updated 04-02-2020)
Warezcrawler replied to Warezcrawler's topic in KSP1 Mod Releases
I've updated GTI Utilities to version 1.2. I've made several tweaks to MultiModeConverter module. Change Log: MultiModeConverter: Fixed bug where all actions where available on every converter for assignment, even though only one can operate at any one time. MultiModeConverter: Added toggle actions MultiModeConverter: Added setting for where on screen the message regarding new converter should be shown. Option: UPPER_CENTER, UPPER_RIGHT, UPPER_LEFT or LOWER_CENTER (e.g. messagePosition = LOWER_CENTER ) MultiModeConverter: Added actions for specific selection of converters, so there are now 12 available. (If more are needed, simply request them. They are easy enough to add, but cannot be done procedurally). Added more ConfigNode methods to the utilities. (no gameplay impact yet)- 94 replies
-
Well now I'm not sure either. I must have had some kind of typo which I have removed at some point, because it is working now. I will update in the answer. Thanks very much for your help NOTE: I tested specifically on the trailing spaces and that was not the issue.
- 17 replies
-
I have only one thing to say....... I must have done something wrong I will recreate your example on my end, and then when it works I will try and incorporate it into what I have done so far. Your comment of trailing space will definitely be taken into consideration. Thanks for all your time mr. D. I will post my findings, but I don't know if I have the time today....
- 17 replies
-
[1.9.*] GTIndustries (Updated 04-02-2020)
Warezcrawler replied to Warezcrawler's topic in KSP1 Mod Releases
@Nansuchao I did some research on implementing throttle dependent ISP and found the Squad already did that with 1.2. also see I also found a thread which regards this topic and I did some testing. I haven't figured out exactly how it works yet. But I do not think I will implement this is as it is already supported directly in moduleEngines.- 94 replies
-
- 2
-
I've looked through what he does, and I do actually not think he actually get them loaded that way.... Here he declares the curves, and we can easily think they are indeed loaded there. https://github.com/ChrisAdderley/NearFuturePropulsion/blob/21cbf5fd6018e042b1a372bf10d62f4fc47a860d/Source/VariableIspEngine.cs#L25-L29 Here he sets the curves based on the engines he is manipulating https://github.com/ChrisAdderley/NearFuturePropulsion/blob/21cbf5fd6018e042b1a372bf10d62f4fc47a860d/Source/VariableIspEngine.cs#L310-L311 Here he sets some curves that look a lot like the same ones https://github.com/ChrisAdderley/NearFuturePropulsion/blob/21cbf5fd6018e042b1a372bf10d62f4fc47a860d/Source/VariableIspEngine.cs#L167-L173 I did retest just now, and got the same result as before. The curves does not seem to be loaded by [KSPField(isPersistant = false)] public FloatCurve ThrottleISPCurve = new FloatCurve(); I can have misinterpreted the near future code, but to me it does not seem to work there either. His does just seem to populate them later in the code, and then his mod probably runs as it should.
- 17 replies
-
I did try it (though I did not have the "= new FloatCurve()" part in the declaration), but I agree with you when reading the Near Future reference. It seems he does indeed loads them that simply. I will try that again, as that is very much preferred. But nothing is so bad that it is not good for something. I did find out how I could read the original configuration. And every day you learn something new is a good day. Thanks.
- 17 replies
-
@Diazo I have found out some more because of your hints see this post for the stadard way of getting a FloatCurve from cfg configuration Alternate method I found that in the object "PartLoader" we have access for all parts and their confignodes. So if we have a custom module, then we can do as follows ConfigNode myConfigNode = new ConfigNode(); for (int i = 0; i < PartLoader.Instance.loadedParts.Count; i++) { if (this.part.name == PartLoader.Instance.loadedParts[i].name) { myConfigNode = PartLoader.Instance.loadedParts[i].partConfig; break; } } Now "myConfigNode" have the PART confignode incl. all details, which we can then work on. In "PartLoader.Instance.loadedParts.partUrl" we have access to the current path, which can be used with ConfigNode EntirePartCFG = GameDatabase.Instance.GetConfigNode("MyModFolder/part"); //note that file extensions don't come in, this would find the file at GameData\MyModFolder\part.cfg as a confignode as you pointed me to. I don't know if any of this was new to you, but I wanted to share in case it was, because it might help. I'm not done however, because I have not worked much with ConfigNodes, I still need to figure out how to take the part and find the relevant module and in turn the relevant subNode/floatcurve. For this I will dig into google and other mods that uses confignode an see if I can piece it together. But when I have figured that out I guess it is as simple as combining this with @sarbian's hint curve.Load(someAnimationCurveNode) I think this means me question is now answered. We did not find an simple stock way, but a way we have. Thanks for all your help.
- 17 replies
-
- 1
-
Yes... Sorry, I forgot to include the when I put in my code snip MODULE { name = GTI_MultiModeEngineFX engineID = Ion_Normal;Ion_HV;Ion_OD GUIengineID = Normal;High Velocity;Overdrive ThrottleISPCurve //Throttle % Multiplier { key = 0 2 key = 1 1 } debugMode = true availableInFlight = true availableInEditor = true } I'm currently experimenting with the gamedatabase as you suggested. It does seem to have a life of it own, but I'll keep at it. And I will see if there is something interesting in ProtoPart, thanks for that suggestion.
- 17 replies
-
Well as far as my tests show, doing this yields an empty floatcurve I was so confident this was the hint, but I don't think so. I did this //C# plugin [KSPField] public FloatCurve ThrottleISPCurve; public override void OnLoad(ConfigNode node) { Debug.Log("ThrottleISPCurve.maxTime\n" + ThrottleISPCurve.maxTime); Debug.Log("ThrottleISPCurve.minTime\n" + ThrottleISPCurve.minTime); Debug.Log("ThrottleISPCurve.Curve.keys.ToString()\n" + ThrottleISPCurve.Curve.keys.ToString()); Debug.Log("Print Keys from KeyFrame"); foreach (Keyframe k in ThrottleISPCurve.Curve.keys) { Debug.Log("k.time: " + k.time); Debug.Log("k.value: " + k.value); Debug.Log("k.inTangent: " + k.inTangent); Debug.Log("k.outTangent: " + k.outTangent); Debug.Log("k.tangentMode: " + k.tangentMode); } } LOG Result [LOG 14:36:48.949] ThrottleISPCurve.maxTime -3.402823E+38 [LOG 14:36:48.949] ThrottleISPCurve.minTime 3.402823E+38 [LOG 14:36:48.949] ThrottleISPCurve.Curve.keys.ToString() UnityEngine.Keyframe[] [LOG 14:36:48.949] Print Keys from KeyFrame I think I have to look further into using confignode for this. But I do not like having to reference a specific cfg file. Is there really no way of accessing the "prefab" (isn't that what they call it) where KSP stores the settings it is using, incl. all non persisted informations. This trick is great, thank you very much for that one. I must say it was like searching for a needle in a haystack without knowing which haystack I was looking in.... This helps a lot!
- 17 replies
-
Adventures in using minThrust
Warezcrawler replied to Kerbas_ad_astra's topic in KSP1 Mod Development
@JPLRepo I've tried to mess around with useThrottleIspCurve throttleIspCurve throttleIspCurveAtmStrength And I just cannot figure out what the real ingame result is. Maybe you can help out with a couple of examples. Maybe we could start with considering an engine in vacuum only. Let say I want to make an engine which run at the "atmosphereCurve"s setting of vacuum when throttle is at 100%, and increase linearly towards 10x efficiency when throttle goes to zero. My guess would be settings something like this atmosphereCurve { key = 0 5200 //Vacuum ISP for 100% throttle key = 1 100 key = 1.2 0.001 } useThrottleIspCurve = True throttleIspCurve { key = 0 10 key = 1 1 } throttleIspCurveAtmStrength //I still don't understand this curve, so I try to get it to be neutral in this example { 100 1 1 1 0 1 } This does however not yield the result I would expect, I actually cannot figure what it exactly does... Engine still says its ISP is 5200 all the time. KER does calculate that the ISP is increased, but not nearly by 10x. -
Thanks for the answer Diazo. I want to load the configuration of the part which is not in the persistent file, find my module and load the exact part I was missing, in this instance it is the floatcurve. If that means loading directly from the file, then how do I do that? How do I find the file? And how do I load the relevant part? Are we absolutely sure squad does not have a standard way, like KSPField to load such things? While I'm still not 100% sure how to use confignode to read and write to the persistent file, I have found lot's of examples and think I can figure that out. However, I'm not actually trying to read and write to that in this instance, I just pointed out, that the "OnLoad" that passes the node, does not hold the parts configuration, but only the persisted part, and that I not usable in this instance. Just to try and be clearer. I am creating a module which has a floatcurve. The floatcurve is to be configured in the module (cfg) of the part. I have no way of knowing beforehand which parts have my module or which floatcurve is configured. (Just as is the case for ModuleEnginesFX). So basic question is still. How do I get the floatcurve into the code. somePart { someModule { someAnimationCurve { key = 0 320 key = 1 280 key = 6 0.001 } } } Pieces of the puzzle from above answers (hopefully ,ore to come) When the floatcurve node is aquired it is loaded into the floatcurve by a simple Load statement. curve.Load(someAnimationCurveNode)
- 17 replies
-
So after a lot of trials and errors with config node, I think the question is (if there are no standard KSPField type)... How do you load configurations which are in the CFG files for e.g. an engine (GameData\MyMod\myCFGfile.cfg) that are not persisted in the save file. As far as I can discern, the node in the "OnLoad" is only the node of the module which is persisted in the save file.
- 17 replies
-
Thanks for the reply. But how do I get the "someAnimationCurveNode" loaded into the code in the first place. Is that some specific KSPField type? Or am I forced into using confignode directly. If the last thing is the case, then how do I get that specific node from my module "someModule"?
- 17 replies
-
I did some searching around regarding AnimationCurve's, and found some good things. However, what I did not find, was anywhere that explains the easiest way to come from the keys in the cfg file someModule { someAnimationCurve { key = 0 320 key = 1 280 key = 6 0.001 } } reading that in C# (plugin) into an AnimationCurve object FloatCurve curve = new FloatCurve(); curve.add(0,320); curve.add(1,280) curve.add(6,0.001); So what is the most efficient way to populate AnimationCurve from the cfg file format we know in KSP? other related question reference: for answer see and
- 17 replies
-
- 1
-
[1.3.0] Kerbal Engineer Redux 1.1.3.0 (2017-05-28)
Warezcrawler replied to cybutek's topic in KSP1 Mod Releases
I was talking about flight. I just tested the SPH since you ask, and there I have no reaction from KER - This was expected based on the code fragment you showed me earlier where KER tests based on stock multimode module. In the SPH mechjeb2 does seem to get the calculations right as it did in space. I haven't double checked it's calculations as such, but it does change when I switch engine modes - and in the expected direction based on the ISP changes. This seem to be linked to the fact that MJ is testing on the activation status of the engine directly. -
Doing mat operations with MM, is it possible to use fractions? I currently have the following. %totalCap = #$RESOURCE[LiquidFuel]/maxAmount$ @totalCap += #$RESOURCE[Oxidizer]/maxAmount$ %LFORE = #$totalCap$ @LFORE *= 3 @LFORE /= 5.7 %ORELF = #$totalCap$ @ORELF *= 2.7 @ORELF /= 5.7 Is it possible to do something like %totalCap = #$RESOURCE[LiquidFuel]/maxAmount$ @totalCap += #$RESOURCE[Oxidizer]/maxAmount$ %LFORE = #$totalCap$ @LFORE *= 3/5.7 %ORELF = #$totalCap$ @ORELF *= 2.7/5.7 I ask, because not all fractions are simple decimal figures, and the first MM syntax quickly becomes very long.