JPLRepo Posted June 28, 2021 Share Posted June 28, 2021 Modders Notes the Dev team have thrown together for 1.12.0. We upgraded the project to Unity 2019.4.18f1 LTS to position KSP on a long term support version of Unity. This should not have any major impact on mods. API documentation can be found here. Wheels and Landing Legs changes ModuleWheelBase.useNewFrictionModel by default is false. Which means all wheels and landing legs using this module will use the old behaviour/logic by default. Set it to true in the part.cfg file to use the new friction model. ModuleWheelSuspension.useDistributedMass by default is false. Which means all wheels and landing legs using this module will use the old behaviour/logic by default for suspension processing. Set it to true in the part.cfg file to use the new friction model. ModuleWheelSteering.autoSteeringAdjust by default is false. Which means all wheels and landing legs using this module will use the old behaviour/logic by default for steering processing. Set it to true in the part.cfg file to use the new friction model. Refer to the Wheels Devblog for more information about the functional changes that were made to wheels and landing legs. Maneuver Tool The maneuver tool app has been designed in such a way to allow modders to easily add additional maneuver types to the app. To do this you will need to create your own mod c# class that inherits class TransferTypeBase - Base class for the transfer types. The Manuever Tool app on startup finds all classes based on this base class and adds them into it’s maneuver type list. Refer to the API documentation for the abstract methods your class has to implement. Additionally you must implement your own data class for your transfer type. Use this class as the base and assign to currentSelectedTransfer: TransferDataBase - Base class for the TransferData for each transfer type. This class inherits AppUI_Data class that allows you to define UI fields for your transfer that will appear in the center part of the manuever tool UI. See the section below called “Generic UI framework” on how to define your UI fields. You will also want to assign your dataChangedCAllback and calculationStateChangedCallback. Additionally you can use the following base class to define your own data class for the top slide out section of the maneuver tool app: TransferDataTopDataBase - Base class for the TransferDataTop for each transfer type. This class also inherits from AppUI_Data class. Another important class is ManeuverToolUIFrame. This manages the UI for the Manuever Tool App and has a number of useful methods. Refer to the API documentation. AlarmClock App The Alarm Clock follows a similar idea to most moddable things in KSP. The fundamental building blocks are: AlarmClockScenario: The scenario module that runs and manages the alarms AlarmTypeBase: The abstract class that all alarm types inherit from I won’t go into all the specifics here as the API help should cover many of these things, but here’s some key pointers. The scenario maintains the list of alarms and persists them into the save file. AddAlarm, RemoveAlarm, GetNextAlarm, etc help you manage the alarm list.There are GameEvents for changes to the list as well. There is currently no “GetAllAlarms” method - Triggers apologies - this will be fixed You define the input fields you want by attributing fields or properties with AppUI_Control types. These fields/properties can then be used in the AlarmType class to define the time for the alarm and any other behaviour. An example here is AppUI_InputDateTime which will give you a datetime input when creating/editing an alarm. Some key fields/overrides in the alarm type include: id - the persistent identifier for an alarm GetDefaultTitle() - the string that will be the title of a new alarm iconURL - a gamedatabase path to the icon to use in the drop downs and lists - the default ones are 64x64 pngs ut - the time of the alarm in universal time RequiresVessel() - when true the alarm will only be available in the UI to add when a vessel can be selected CanSetAlarm(AlarmUIDisplayMode displayMode) - lets you control when the inputs are valid in add and edit mode to save changes OnInputPanelUpdate(AlarmUIDisplayMode displayMode) - called in the Monobehavior update loop by the app for each alarm when it is displayed in the app OnScenarioUpdate - called in the Monobehavior update loop by the scenario when the alarm is in the list. Here’s an example of a very simple alarm type that will let you set a date public class AlarmTypeTest : AlarmTypeBase { [AppUI_InputDateTime(guiName = "Alarm Date", datetimeMode = AppUIMemberDateTime.DateTimeModes.date)] public double alarmDate; public AlarmTypeTest() { iconURL = "TriggerTech/TestMod/AlarmIcons/DavesTest"; } public override bool CanSetAlarm(AlarmUIDisplayMode displayMode) { return true; } public override string GetDefaultTitle() { return "Daves Test Alarm"; } public override bool RequiresVessel() { return false; } public override void OnUIEndInitialization(AlarmUIDisplayMode displayMode) { if(displayMode == AlarmUIDisplayMode.Add) { alarmDate = Planetarium.GetUniversalTime() + 600; } AppUIMemberDateTime m = (AppUIMemberDateTime)uiPanel.GetControl("alarmDate"); m.DatetimeMode = AppUIMemberDateTime.DateTimeModes.date; } public override void OnInputPanelUpdate(AlarmUIDisplayMode displayMode) { ut = alarmDate; } } Generic UI framework The key driver for this system is the idea of moddable inputs to applications for various moddable functions. The fundamental idea being that in a UI you can place a panel that has a vertical layout group and an AppUIPanel component, call Setup with a data class and it will present the user with an editable section of UI that correlates to the data inputs. It edits the data class and the code can then use the edited object directly. Steps to use it: Create a “panel” in your UI that will hold the input fields. Create a class that holds the inputs (inherits class AppUI_Data). Apply the attributes to the fields that are for input within the class. “Setup” the panel at the right time in code. Classes of interest AppUI_Data - this is your data class which can use attributes on fields to create UI controls. The following UI controls can be used as attributes on your fields in your AppUI_Data class.: AppUIMemberDataTime AppUIMemberDropdown AppUIMemberDropdownMultiLine AppUIMemberHeading AppUIMemberInput AppUIMemberInputFloat AppUIMemberLabel AppUIMemberLabelList AppUIMemberRadioBool AppUIMmeberSliderFloat AppUIMemberSliderFloatMultiLine AppuiMemberToggleBool File Folder Browser Craft files are still stored as text in .craft files. The thumbnail naming convention has changed, but otherwise the thumbnail itself is generated no differently. The search classes don’t have any exposed methods that can be used to actually do anything aside from literally starting and stopping a search using whatever information is in the search input text field. The folder-action confirmation dialog for deleting and creating folders can be created and passed callbacks that are fired when the indicated action is confirmed. The folder browser doesn’t use any config files that could be modified. Public methods and properties include querying if the currently selected folder is a player-craft or stock-craft folder, and querying if the currently displayed folder structure is for the VAB or SPH. Folder highlighting can be overridden using a craft’s file-path, and folder highlight overrides can also be turned off. Also exposed is a method for updating folder file-counts for all folders as well as for a specific folder. Properties are exposed that return the local machine’s file path for the stock craft folder, the expansion directory folders, and the mission craft folders Lights We added the ability to disable and enable the Color Picker of the lights - use the KSPField disableColorPicker in the part.cfg file. Also if one light has more than one transform you can control it with the same Module light. You can do this by defining one or more LIGHT submodes within the ModuleLight node in your part.cfg file. Eg: MODULE { name = ModuleLight …. (normal ModuleLight fields) LIGHT { lightName = light1 lightR = 1.0 lightG = 1.0 lightB = 1.0 flareRendererName = flare1 } LIGHT { lightName = light2 lightR = 1.0 lightG = 1.0 lightB = 1.0 flareRendererName = flare2 } } Docking Port rotations. Docking port parts are now able to do an alignment rotation once they are docked. In order to make a dock being able to rotate, you need to configure them so: canRotate: set to True, when this rotating feature should be available to this part rotationTransformName: Name of the transform of the model that will rotate. maxMotorOutput: this is used for the electric charge resource consumption calculations. set this according to the part’s design guidelines RESOURCE definition: this one should be the same for all docking ports that use this rotating feature. This is used to specify which resource is consumed by doing the rotation These other KSPFields are optionally available to configure as well: rotationAxis: The rotation axis, defaulted to the z axis. This is necessary as some docks might have a different rotation axis. Can be "X", "X-", "Y", "Y-" or "Z", "Z-" traverseVelocity: The traverse speed (in deg/s for rotational motion) hardMinMaxLimits: The angle range that's defined by the physical limits of the part model and/or the part's designer. The default values are -15, 15. A player must not be able to set an angle beyond this range. This is a Vector2 so, could be defined as “-15, 15“, for example. efficiency: Servo efficiency (1 = 100%) baseResourceConsumptionRate: Base resource consumption on motor output when the servo is moving referenceConsumptionVelocity: The transform velocity (angular or positional) at which the resource consumption is 1 x the baseResourceConsumptionRate New Slim Suit ID Maps ksp_slimsuit_uv_map.zip ksp_1-12_suit_idmap.zip Other misc modding changes Failed reflection calls to incompatible or otherwise invalid mods are now handled, so they don't stop the game from loading. Custom suits now show the corresponding icon in all relevant screens. These have to be provided by the mod, the game will not generate them. Added an additional useCustomThreshold field to ModuleOrbitalSurveyor. Setting it to true will allow the module to recalculate the minimum and maximum altitudes beyond the stock values. When multiple versions of the same assembly are present, KSP now makes sure only the most recent one is loaded. It’s still a good idea to encourage people not to do this, to avoid clutter. Tuned the logic to calculate space object resource percentages based on the lowRange and highRange values, preventing space objects from always having > 80% resources regardless of the range values. Added a GameEvent for revert to launch that returns the current FlightState. Quote Link to comment Share on other sites More sharing options...
Beale Posted June 28, 2021 Share Posted June 28, 2021 (edited) @JPLRepoFollowing a few wobble-reports, should it still be possible to autostrut between non-rotating docking ports? Chasing up if there's some flag in the new updated docking port module class that I've misunderstood. Thanks very much for the info! Edited June 28, 2021 by Beale Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted June 28, 2021 Author Share Posted June 28, 2021 3 hours ago, Beale said: @JPLRepoFollowing a few wobble-reports, should it still be possible to autostrut between non-rotating docking ports? Chasing up if there's some flag in the new updated docking port module class that I've misunderstood. Thanks very much for the info! You can't currently. But, wait for the patch. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted June 29, 2021 Share Posted June 29, 2021 22 hours ago, JPLRepo said: When multiple versions of the same assembly are present, KSP now makes sure only the most recent one is loaded. It’s still a good idea to encourage people not to do this, to avoid clutter. How does it determine which is the most recent one? Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted June 29, 2021 Author Share Posted June 29, 2021 37 minutes ago, linuxgurugamer said: How does it determine which is the most recent one? The file version info version number stored in the file. Using https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.fileversioninfo.getversioninfo?view=netframework-4.6 Quote Link to comment Share on other sites More sharing options...
R-T-B Posted June 29, 2021 Share Posted June 29, 2021 @JPLRepo The KSP stock alarm currently uses hardcoded constants for the length of a month and the length of a year. Some modders would like the ability to change these values. Are there plans to provide a variable setter to do so? Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted June 30, 2021 Author Share Posted June 30, 2021 On 6/30/2021 at 4:55 AM, R-T-B said: @JPLRepo The KSP stock alarm currently uses hardcoded constants for the length of a month and the length of a year. Some modders would like the ability to change these values. Are there plans to provide a variable setter to do so? Will see what we can do. Quote Link to comment Share on other sites More sharing options...
R-T-B Posted July 1, 2021 Share Posted July 1, 2021 On 6/30/2021 at 3:44 PM, JPLRepo said: Will see what we can do. I really appreciate it. All we really need is a variable and a setter. The rest is fine as it stands. Quote Link to comment Share on other sites More sharing options...
DirtyFace83 Posted July 6, 2021 Share Posted July 6, 2021 (edited) What is the suitType for the new slim suits? I am referring to this value in the cfg file: suitType = Vintage suitType = Default suitType = Future suitType = Slim Lucky guesses I suppose Was a bit of a pain to have to load the game, assign a suit, switch to another screen in game, go back to main menu, and then look at the persistence file, but the above are the correct values for those of us looking to make new suits. Edited July 8, 2021 by DirtyFace83 Quote Link to comment Share on other sites More sharing options...
basic.syntax Posted July 7, 2021 Share Posted July 7, 2021 I've been working on some flag variant textures in the past few days, and noticed the change from 256x160 (ugh, postage stamp size, you won't be missed) to 512x256 resolution - more pixel headroom for stock. (But a modder/player can feel free to go higher, if they want. I was tempted to "necro" the 1.10 modder's notes thread, which had questions like this about changes to flag art ) The 1.6:1 aspect ratio of original flags (256x160) is supported after the change, old flag image files looked the same - nice. But, if that's the case: Why was flag texture aspect ratio increased to 2:1 (512x256), if internally the textures are processed 1.6:1 (410x256)? All of the stock art was stretched to fit the new image dimensions; internally the image is squeezed back down, so that the new flag textures display properly in-game, on the flag parts. Does one of these flag parts - or other object in the game - use those textures as-is, without squeezing them horizontally? Was the change made, for a future plan? Squad could save a tiny bit of disk space if all stock flag textures were re-rendered at 410x256, which would have the added benefit of not looking stretched, while looking at the raw files in the folder This is also a note to players/modders: no need to stretch your art. The next problem I face is due to the internal processing of image files for display: compression. What looks like a solid color in your PNG or JPG might not look that way in-game, and show harsh color change boundary artifacts: blotches, jaggies. I've spent many hours recently, cleaning things up. (The stock flags could use some pixel attention to clean them up and reduce artifacts, but there's an easier path to take, to help all of us: ) Squad please consider supporting DDS format, for flags. I tried dropping a DDS in the folder, but it was ignored The format is supported by other mod-friendly objects. With it, you know what you are getting in-game. Quote Link to comment Share on other sites More sharing options...
DirtyFace83 Posted July 8, 2021 Share Posted July 8, 2021 14 hours ago, basic.syntax said: Squad please consider supporting DDS format, for flags. DDS is already supported for flags. I've been using DTX5 with generated mipmaps and the folder structure might have to be a "GameData/NotSquadFolder/Flags". I've never tried adding flags directly to "GameData/Squad/Flags", so I can't comment on that. Unless I have misunderstood what you mean? Quote Link to comment Share on other sites More sharing options...
basic.syntax Posted July 8, 2021 Share Posted July 8, 2021 2 hours ago, DirtyFace83 said: DDS is already supported for flags. I've been using DTX5 with generated mipmaps and the folder structure might have to be a "GameData/NotSquadFolder/Flags". I've never tried adding flags directly to "GameData/Squad/Flags", so I can't comment on that. Unless I have misunderstood what you mean? I've read your thread - nice work! The Conformal Decals mod supports DDS. I've not tried it yet. I started independently adapting some art for mission emblems, and one thing led to another. I'm hoping this request to Squad to enhance the Stock experience isn't too far out of scope for a future update. It never hurts to ask - politely Quote Link to comment Share on other sites More sharing options...
Dr. Kerbal Posted July 15, 2021 Share Posted July 15, 2021 The code for the planets haven't changed right? I am currently working on a planet mod but I just want to confirm if the code has changed or not. It still the same from the guide right? Quote Link to comment Share on other sites More sharing options...
artwhaley Posted August 7, 2021 Share Posted August 7, 2021 On 6/28/2021 at 12:35 AM, JPLRepo said: There is currently no “GetAllAlarms” method - Triggers apologies - this will be fixed I was sort of figuring this would come in the 1.12.2 patch, but it doesn't seem to have, unless I'm missing it? Any update on this? Thank you! Quote Link to comment Share on other sites More sharing options...
jrodriguez Posted September 4, 2021 Share Posted September 4, 2021 On 6/29/2021 at 6:21 AM, JPLRepo said: The file version info version number stored in the file. Using https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.fileversioninfo.getversioninfo?view=netframework-4.6 What happens if the assembly has no readable version? I'm having an issue with my OCISLY mod which uses gRPC. KSP gets stuck loading the DLLs reading that versions Quote Link to comment Share on other sites More sharing options...
TheShadow1138 Posted September 4, 2021 Share Posted September 4, 2021 Is there an ETA on when the API Documentation will be available again? The site has been saying that it's undergoing maintenance for over a day now. Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted September 7, 2021 Author Share Posted September 7, 2021 On 9/5/2021 at 5:46 AM, TheShadow1138 said: Is there an ETA on when the API Documentation will be available again? The site has been saying that it's undergoing maintenance for over a day now. Sorry missed this one. Have passed it on to tech support. Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted September 8, 2021 Author Share Posted September 8, 2021 On 9/5/2021 at 5:46 AM, TheShadow1138 said: Is there an ETA on when the API Documentation will be available again? The site has been saying that it's undergoing maintenance for over a day now. Should now be fixed. Quote Link to comment Share on other sites More sharing options...
TheShadow1138 Posted September 8, 2021 Share Posted September 8, 2021 1 hour ago, JPLRepo said: Should now be fixed. it is. Everything is working aging. Thanks! Quote Link to comment Share on other sites More sharing options...
jrodriguez Posted September 11, 2021 Share Posted September 11, 2021 On 9/4/2021 at 8:20 PM, jrodriguez said: What happens if the assembly has no readable version? I'm having an issue with my OCISLY mod which uses gRPC. KSP gets stuck loading the DLLs reading that versions I will answer myself in case any mod developers are reading the thread. If your mod depends on a 3rd party assembly that has no version, KSP will get stuck during loading. The easiest way to avoid the issue is to patch the 3rd party assembly adding a version number with Visual Studio. 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.