-
Posts
2,077 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Diazo
-
I'd need some more code to tell you what my correct answer would be, but I'd look at casting the type of the list. By that I mean, write the function to accept a type of List<newBaseClassMember>, then in each inherited class, cast the List<extendingClass1Member> back to List<newBaseClassMember> when calling the method. Alternatively, define the list in the base class then just use it in the inherited classes. There are other ways of handling this, but without seeing how newBaseClass and the extendingClasses are going to define stuff I can't tell you which method I would prefer using. On the FixedUpdate() question, I don't think it matters. Unity (and so KSP) only calls the FixedUpdate methods on instances of the class that exist. If there are no instances of the newBaseClass object, the FixedUpdate method in that class will never run even if it exists. Hope that helps, D.
-
Version 1.2a Download here. -Fix ModuleWheelBrake actions (was causing a cascade error that caused all actions set by this mod to fail.) -Show/Hide window in Flight mode on F2 now. Alright, it's amazing what looking at stuff when not fighting to not fall asleep at the keyboard. Some fixes to some pretty basic errors here but things should be good now. @Deimos Rast The RemoteTech thing was a red herring caused by posting past my bedtime last night. Issue is resolved now though, let me know if anything else comes up. @drtedastro The issue I fixed for Deimos Rast was probably also affecting you and explains some of the confusion we were having. Please let me know how things go for you. D.
-
@Deimos Rast Looks like Remotetech changed something in the KSP 1.1 update. Grabbed the latest official release and installed in my dev environment and immediately both this mod and AGX started spewing errors. I'll look into it tomorrow, but for now it looks like RemoteTech flat out breaks my action group related mods. D.
-
VesselModules, docking, undocking, and you
Diazo replied to MOARdV's topic in KSP1 C# Plugin Development Help and Support
That's annoying to say the least, it drastically reduces their usefulness. I see there's a VesselModuleManager class. I don't recall a Manager class for any of the other classes we work with. I wonder if something's gone screwy in there? Still, not something I think we can deal with though so we'll have to see what happens. D. -
There is no youtube video that I am aware of, but I'll try and get an Imgur album up or something later today. In text form the steps are: 1) Build your ship 2) Switch to the Action Group editor mode and click the ModActs button to open the window. 3) Select the part you want to assign an action to, in your case an Evelron, it will be marked with a purple circle. (Or multiple will if they were placed in symmetry. 4) In the ModActions window, click the "ClickToSelect" button, pick the CtrlSurface option and it will auto-fill with the Pitch On action as that one is first. You can click on the Pitch button to switch between Pitch/Roll/Yaw and the On button to switch between On/Off/Toggle. There are multiple actions on the part so you can add as many actions as you want. The text box on the left is for text entry, this text string is what will show as the action's name in step 5 and you can type whatever you want in here. 5) Go back to the Action Group Editor, this part works the same as stock KSP, you should just see new actions in the part's list that you added in step 4 and you can add them to an action group at this point. 6) To confirm everything worked, launch to flight mode open the evelron's right-click menu, activating the action group will change the evelron's status in the right-click menu in real-time so you can confirm everything works on the runway without having to take off an test. Hope that helps, D.
-
Alright, the files look correct. However, are you opening up the ModActions window and actually assigning the action to the part? (It's the window with 1/P.On/CtrlSuft/Pitch/P.On in the picture in my previous post.) It's a two step process to use ModActions. First you have to select the part and choose the actions you want to assign to that part. Once you've done that only those specific actions will show in the available actions list in the action group editor for you to assign to an action group. ModActions is up to 100 actions total at this point, I can't assign all those actions to all parts as 100 more KSPAction objects on every part on every vessel would be quite the processing load. So this mod makes only a few dynamically assignable action slots on each part, but this means they start hidden without an action assigned until you open the ModActions window and assign an action to that action slot. D.
-
Alright, in that case can you please: -Check you also have ModuleManager.dll in your GameData directory. -Check that ModActions.dll and all the *.actions files live at GameData\Diazo\ModActions\ModActions.dll. -Go into the editor to try to assign an action, then quit the game and get me a copy of the output_log.txt file. -Are other actions working? Such as wheels or the science lab? At this point we need to figure out what is different on your installation then mine. D.
-
No, I don't know how you would go about that. I made that comment because I know that the ShipConstruct is the object type that the editor serializes to the .craft file and that the ProtoVessel object is what the .craft gets loaded into that flight mode then converts into an actual vessel. In theory you can hook into this stuff but I've never tried. On the triggering a function on save in the edtior, I don't know the current details, in older KSP versions (before the GUI overhaul) I actually had to hook into the buttons and their OnClick() events to trigger on a save event in the editor. One catch is that it doesn't always save to the NamedCraft.craft file, when you go to the pad via the Launch button, the editor saves to the AutoSave.craft file and loads from that on the pad, not from NamedCraft.craft file. If you can hook the ShipConstruct, KSP will take care of that for you, but if you are writing to your own data file based on Ship Name, you'll have to account for that. As you mention you do have a partModule, it is much simpler simply to use it for this. Even for calling the function on a save event, add that code to your partModule's OnSave method that KSP calls for you. As long as it has code to make sure it only runs once per save event (as multiple partModules would call the function multiple times for the same save event) that is probably a better way to go. D.
-
@Ziw How do you make sure your root part gets your PartModule without simply adding it to every part in the game? Because my mods deal with craft control, I added it to all parts with ModuleCommand instead of using the root part. Between the fact that almost any part type can be your root part, and the ability to change the root part, I don't find using the "root part" a reliable way of dealing with this. D.
-
The answer to my best of my knowledge is no. I delayed answering because I was hoping someone else would have a different answer but it looks like not. The core issue is that there is no "vessel" object, let alone an instance of the actual Vessel class in the editor. The only possibility I can think of is hooking into the ShipConstruct config node when a save happens and then reading those values back from the ProtoVessel object when a vessel is first launched somehow. I don't have a clue how you'd go about that however. In all my mods I just added a partModule to use as data storage so I've never actually though about this question before. D.
-
It's something I have to do in the .dll file. Even just in the stock parts, there is no standardization across the different partModules, then every mod developer does things their own way as well so each action has to be custom coded. It doesn't take long, it's only 4 or 5 lines of code per action I have to add, but the action is hardcoded in the .dll file. D.
-
You'll have to update your references. In KSP 1,1 the Vector3D class moved from Assembly-CSharp to the KSUtil reference. You're still telling it to look in the old location. All the .dll files in the KSP_Managed folders are KSP version specific, you need to compile against the .dlls from the KSP version you are trying to run them in. D.
-
Okay, the fundamental error you are making is that TWR is not tied to speed, it is tied to acceleration. So a TWR value of 1 means "cancel gravity's pull" and will maintain your current speed. If that speed is +50m/s going up, a TWR of 1 will maintain that +50m/s velocity. How I deal with this in my mod is I don't set the throttle based on my current altitude relative to target, I calculate the velocity I should be going for how far away I am from my target altitude and my available thrust, then set the throttle relative to that velocity. On the max thrust, you have to check the thrustCurve value. My code for this is: TWR1MaxThrust += (double)((TWR1EngineModule.maxFuelFlow * TWR1EngineModule.g * TWR1EngineModule.atmosphereCurve.Evaluate((float)(TWR1EngineModule.vessel.staticPressurekPa * PhysicsGlobals.KpaToAtmospheres)) * TWR1EngineModule.thrustPercentage / 100F) * offsetMultiplier); //add engine thrust to MaxThrust MaxThrust is the max thrust available from the engine. EngineModule is the reference to the ModuleEngine I am working with. I multiply by the .thrustPercentage in case the engine has been thrust limited in the part's right-click menu and offsetMultiplier is how I account for how far off vertical the engine is angled. Hope that helps, D.
-
parts list form vessel in editor
Diazo replied to JediMasterSterling1's topic in KSP1 C# Plugin Development Help and Support
EditorLogic.sortedShipList Note that when you first load into the editor and no parts have been placed trying to call this method will generate a nullRef that you'll have to error trap. D. -
Add new data field to craft file
Diazo replied to linuxgurugamer's topic in KSP1 C# Plugin Development Help and Support
Weird, it looks like the post with the 1.1 patch notes got nuked (or maybe just hidden) when they removed the KSP 1.1 specific subforums after the experimentals was over. Here is my original post where I noticed it, the pasted line I'm quoting was a copy-paste from those patch notes. But as I said, I haven't actually used this functionality so I don't know any further details. D. -
Bare Bones GUI
Diazo replied to JediMasterSterling1's topic in KSP1 C# Plugin Development Help and Support
At a quick glance, things look right. I've never used the BeginGroup method, I use the Window method instead though. Having said that, can you stick a Debug.Log inside your PopulationManagemenGUI method just to make sure the method is being called correctly? D. edit: If you are okay switching to the GUI.Window method, I use it here: https://github.com/SirDiazo/TWR1/blob/master/TWR1/TWR1.cs#L393 to generate this window: The linked code creates two windows, this picture is the first one at line 397. -
Okay, now I'm unclear as to what is happening on the available action groups. First, there should no longer be an AGExt.cfg file present, it has been replaced by the AGExt.settings file. If an AGExt.cfg file is present, AGExt will try to rename it to AGExt.settings to keep your saved settings from the older version. This means that if for some reason both AGExt.cfg and AGExt.settings are present, it will load AGExt.cfg, use those settings, then overwrite the AGExt.settings file with the values from the AGExt.cfg file. After this is will delete the AGExt.cfg file so it uses the AGExt.settings file the next time you load the game. Next, on the actions groups, what is supposed to happen in the editor is for the available action groups to match stock if Override is set to 0. If Override is set to 1, all action groups should be available at all times. So with Override set to zero, at VAB/SPH level 1, no action groups are available in the editor. At level 2, just the named groups and at level 3 all groups are available. The wildcard is flight mode because there is no facility level I check the level of both buildings and use the highest. So if the VAB is level 1 (no groups available) and the SPH is level 2 (named groups available), named groups will be available to all vessels in flight mode, even rockets launched from the VAB. Once a vessel is launched I have no way of telling if it came from the VAB or the SPH so I just use the highest unlocked level of either building. Hope that clears some things up. D.
- 1,353 replies
-
- 1
-
- edit actions
- actions
-
(and 1 more)
Tagged with:
-
Add new data field to craft file
Diazo replied to linuxgurugamer's topic in KSP1 C# Plugin Development Help and Support
No, VesselModule is automatically instantiated on the vessel object in flight, I do not believe it exists in the editor. You could check the ShipContruct to see if something comes over, but the last time I worked with VesselModule was before KSP 1.1 and at the time they couldn't save data. It's in the KSP 1.1 patch notes specifically that VesselModules can now save data so that functionality has been added, but the specifics would require testing. D. -
Add new data field to craft file
Diazo replied to linuxgurugamer's topic in KSP1 C# Plugin Development Help and Support
No, not without hooking in the GameSave/Load events and parsing the entire save file. However, as of KSP 1.1, the VesselModule class does save data and it is created on a 1 per vessel basis, that might work? D. -
I've done pretty much exactly this for my Vertical Velocity mod and I have 2 questions. First, how are you calculating the thrustAvailable variable? Second, especially at low altitudes, this is going to be very coarse in it's throttle control. Target alt = 10m, current alt = 20m, difference of 10m but your calculation will see a factor of 2 for your throttle. Target alt = 100m, current alt = 110m, difference of 10m, but your calculation will see a factor of 1.1 for your throttle for the same 10m absolute distance. You need to make the throttle relative to the distance to your target, your current absolute altitude shouldn't be in there. D.
-
Okay, bit of a different question, but how would you go about triggering code to run when the size (such as a KAS crane playing out cable, or swinging out an IR arm) of a vessel changes? Note that I'm specifically looking for how to do this when the parts on the ship don't change. The second, simpler, question is how do I get the size of a vessel in flight mode? D.
-
@Deimos Rast When you first updated to 2.0a (or newer), it was supposed to automatically copy over your settings from the AGExt.cfg file to the AGExt.settings file. However it looks like something went screwy with that on Linux. I don't have access to a Linux box so I can only test Windows and it looks like the file operations may be different. On the EVA thing, can you try this AGExt.dll file please? It adds a check on Kerbal reboarding that should prevent the issue you are seeing. This assumes that the Kerbal is the actual issue however, if the issue is a mod changing vessel settings on a docking operation that only happens when it's a Kerbal as one of the vessels docking, the issue may still exist. D.
- 1,353 replies
-
- edit actions
- actions
-
(and 1 more)
Tagged with: