Jump to content

mattssheep4

Members
  • Posts

    143
  • Joined

  • Last visited

Posts posted by mattssheep4

  1. Short recording attached of me trying things. Particulalry, in the Site Name field, you can't have two capital letters in a row, nor can you use numbers. 

    Some hotkeys, like periods, still activate when typing, so you can see at 1:12 that timewarp activates. I would expect that any and all hotkeys that conflict with characters would be disabled when typing.

    Also I've had trouble with controlling the kerbals after hitting OK. My testing indicates it has to do with timewarp being active when you hit the OK button.

     

    Playing on Windows 10

    RTX 3070ti

    i5-6500

    KSP 2 v 0.1.1.0.21572 (patch 1)

    EDIT: I forgot to check before posting, there are a couple other reports that deal with the same issue:

     

  2. @linuxgurugamerI found out the root issue after taking a look at the code and doing some testing. (I'd put this in an issue on github but apparently you've got it set so the public can't access the issues tab.) 
    It boils down to two issues:
    1. There are references to KSP_Log, which I finally found in your SpaceTuxLibrary mod, in the StationExperiment file. 

    2. The StationExperiment class is derived from ModuleScienceExperiment, which requires the Assembly-CSharp.dll as a reference.

    One or both of these issues caused the StationExperiment module to not be recognized as a PartModule, and since that PartModule was referenced in the cfg files for the experiments, they became unusable.

    I would put in a pull request, but I don't want to screw with your workflow, which is different from mine.

  3. You can use KSPFields to display extra data in the existing right click menu. Alternatively you could have a button that brings up a custom UI. I would recommend the former though.

    On 9/23/2021 at 6:02 PM, se5a said:

    I realize a lot of this could be figured out by trial and error, but it takes wwwwwaaaay too long to restart ksp to easily figure it out.  (I assume there's no way to hot reload a mod right?)

    I went ahead and deleted most of the part files from my dev install, that combined with an SSD makes my load time less than a minute.

  4. On 9/17/2021 at 3:20 PM, se5a said:

    but for that I need the exhaust velocity (Isp), and burn rate for the active vessel, how do I get those?

    Get a reference to your vessel, then do something like this:
     

    // Get ref to your vessel, and subsequnetly a ref to the engine. 
    // You probably want to use FindPartModulesImplementing<ModuleEngines>() instead, to get all engines, but for this example
    // I'm going with this.
    ModuleEngines engine = vessel.FindPartModuleImplementing<ModuleEngines>();
      
    // The realIsp value may not be the right one to use. There's several fields with Isp in the name which may be applicable, 
    // you'll have to do some testing.
    float ISP = engine.realIsp;
      
    // You'll have to figure out how to use each propellant individually. This just shows how to get them.
    foreach (Propellant prop in engine.propellants)
    {
        // iirc the ratio is basically propellant use per second. 
        //There may be other values in the ModuleEngine that have to do with this instead.
    	float usagePerSecond = prop.ratio;
    }

     

  5. How might I find the resource concentration for resources in an atmosphere? E.g. on kerbin, what are the values for intakeAir? Is that purely a check for hasOxygen followed by a pressure/speed calculation, or is the quantity something that can be modified?

     

    EDIT:
    After several hours spent trawling the documentation, I got it figured out. For anyone else wondering how on kerbin to find those values:

    ResourceCache cache = ResourceCache.Instance;
    // These are lists of all applicable resources.
    cache.GlobalResources 
    cache.PlanetaryResources
    cache.BiomeResources

     

  6. Guys I don't see why people are always either "Yes, this or that feature should be in the game" or "No, it shouldn't". KSP 1 has done pretty good with customization settings to allow players to choose how they want to play. E.g. the commnet can be turned on or off depending on player preference. There's no doubt in my mind that if a construction time feature is added, it will be optional. As such, I can't honestly say that I care if it's in the game, since if it's not, someone will probably make a mod for it, and people who want that feature will install the mod.

  7. On 12/19/2016 at 11:49 PM, Diazo said:

    In your project, add a reference to UnityEngine.dll, UnityEngine.UI.dll

    I'm getting an error saying that these two files are already referenced (presumably from Unity already). Should I remove them and replace with the ones from the KSP folder?

    EDIT:
    I've got things mostly working (I think?), but there is no logging happening in the console. In ksp.log, there's this line which is confusing me:

    Quote

    [LOG 10:28:46.210] [AddonLoader]: Instantiating addon 'ContractDefs' from assembly 'MyMod'

    There's no reference to ContractDefs in my code, anyone know what gives?

    Edit 2:
    Started from scratch a few times... oddly enough, the last iteration showed a similar problem as what I've seen consistently in my attempts to mod KSP, where I can access KSP assets but can't reference MonoBehaviour. I was trawling through many threads on the forums to figure it out, and when I looked back at my IDE, there were no more errors. I'm flabbergasted, but pleased. I will try again, to try to hammer down the exact process, and share when I have it.

    Edit 3:
    As promised, a detailed walk-through of a repeatable mod dev setup. I'm using KSP 1.9, but I'm pretty sure 1.8 used the same unity version, so it should work for 1.8.x as well. I'm also using Visual Studio 2017 on Windows 10, though afaik the VS version matters less.

    Moving on:
    Start Visual Studio. Close any open projects, and create a new project as shown in the image:

    (NOTE: I tested a few different options here, including .NET Standard and .NET Core class libraries, which did NOT work. Though I admit, I wasn't keeping very good track of what I had and hadn't tried when I was testing those options, so feel free to try them at your own risk.)

    85lxdu7.png

    I suggest the location to be somewhere near you KSP dev folder, but it doesn't need to be. 

    .NET 4.0 is required, and .NET 4.5 is recommended for 1.8+, per the wiki

    Hit OK, and VS will create the project. For some reason, I had to close VS and open the solution (.sln) file by double click because VS kept saying it was still building the project, but it obviously had finished. Regardless, once you have your project open and set up, you then need to select references. I've seen a few different variations on what dll's need referenced. After a lot of experimentation, it seems that the *minimum* to reference are:

    - UnityEngine.CoreModule.dll

    - Assembly-CSharp.dll

    Side note: I was shocked to find that UnityEngine.dll is *not* a requirement for the basic script in the OP, but you will need it to do a lot of things.

    To add them, click on the Project tab, then Add Reference, then browse. Navigate to your KSP directory/KSP_x64_data/Managed folder, and select the above files:

    4hpIMlT.png

    (You can see how much testing I did in that pic with different versions, etc... to find that only those two little dlls are necessary)

    Once you have your references, you should be good to go from the OP and other posts in the Add-On subforum.

    Hope this helps other beginner modders! 

    As an aside, learning Unity outside of a mod dev environment is really helpful for modding. I've been using Unity for a couple years now, mostly just for messing around with building my own small games, but because of that I'm very confident in actually coding KSP mods - it was just setting up the environment that was tripping me up for so long.

     

    Edit 4: I guess I should mention a bit about compiling - once you're ready to compile and test your code, it's useful (imo) to point your build directory to your mod's folder. Then hit build, and go to your mod folder. You'll have to delete all the other files the IDE generates, you only need YourMod.dll for the game to do its thing. Unfortunately that's something you''ll have to do every time you build it. I haven't tested it, but its possible they won't hurt anything being there for testing, but imo its best to test as closely to release as possible.

  8. On 7/19/2013 at 7:06 PM, KSK said:

     

    Quite a number of he crowd had been half expecting something like this. Even so, the passion and the conviction in Jeb's voice was enough to send a shiver down their spines. Jeb paused again, blinking hard.

    Going through this again, now that it's complete. Just reading this part of Chapter 9 gave me the shivers.

  9. On 12/19/2016 at 11:49 PM, Diazo said:

    Note that ConfigNodes are very dumb.

    If you GetValue('Key5") when Key5 doesn't exist, KSP throws a Null Reference Exception and stop running your code.

    If you AddValue("Key1","Value1") when the node already has a Key1 present it will add a second Key1 value to the node instead of updating the existing value.

    You can SetValue("Key1","Value1") instead to update an existing Key1 value, but if Key1 doesn't exist, it will Null Reference and stop running your code.

    Any chance this will be fixed someday?

    Yeah... on further reflection, its probably better this way

×
×
  • Create New...