Jump to content

Tralfagar

Members
  • Posts

    78
  • Joined

  • Last visited

Everything posted by Tralfagar

  1. Personally, I like seeing other people compiling a mod I've worked on because I'm selfish and editing other people's toys is easier than making toys of my own. For waiting time, I'd feel comfortable waiting for a few days. Maybe a week if that's what feels right to you. It looks like GPLv3 (the licensing for the source code) is pretty permissive. Personally, I'd attribute credit to the previous OP (ethernet) and reply to the main topic with a link to your new thread. Just make sure it doesn't have the same name as the previous version to keep confusion at a minimum.
  2. I believe KSP keeps a list of the possible Kerbal types (i.e. Pilot/Engineer/Scientist) within the vanilla game that is used to generate new Kerbals (such as by KerbalRoster.GetNewKerbal(Crew). Using mods that add in additional types (such as RoverDude's USI collection or maculator's Colonists! mod), it looks like KSP updates the record of the possible types when rolling random Kerbals. That is, types such as Geologist or Quartermaster appear in addition to Pilot and Engineer. Does anyone know where that information would be stored and how to access it? The KerbalRoster and HighLogic classes don't have anything that is obvious. Some background regarding my application: I want to be able to convert Kerbals from one occupation to another, but I'm not sure what mods someone may or not be using. For example, I want to change a Scientist to something else. In vanilla, the only options would be Pilot/Engineer. But if there are mods present, something like Geologist would be available, so Pilot/Engineer/Geologist. I think there are two approaches, but I'm not sure which is best: 1) Create a Module Manager plugin to add/subtract classes called in a module. This options seems like more overhead for me but is definitely doable with what I presently know. 2) Implement the logic to check the available Kerbal traits in C# so I don't need to explicitly know what traits are being used (I can delegate it to an iterative loop). This seems like the more "correct" solution, but I'm not sure if it's possible. Thank you!
  3. The Civ Pop Mod Curse of rotating authors has struck again! I'd love to continue support for this mod but unfortunately I don't have the time to commit to it. Or sadly even playing KSP. Regarding the missing files (BackgroundGrowth.cs, UnloadedVessel.cs, and AssemblyInfo.cs), they are WIP classes/files I was testing some stuff in that I ended up scrapping. I couldn't figure out how to tell Monodevelop not to include them so I was trying to manually erase them. Guess I missed a spot in the .csproj file. A quick-n-dirty work around would be just create a blank class of the relevant name and recompile (targeting the correct .NET Framework version). If someone would like to continue this, I would be very grateful. I tried to make the license as permissive as possible and mark up the code so others could continue (and possibly learn) easily. I'm a mechanical/hardware engineer by day so I'll admit some of the code may not be up to coding standards...but I tried to keep it human-readable. Again, thank you to everyone who helped me with my first foray into modding! Some notes for anyone who wishes to continue this mod: You don't need to be a modding wizard. I'm certainly not. DebuggingClass in the .cs files is what I use to store the static variables (such as civilian class names, mod name, etc...). The myWindow object isn't called anywhere unless I'm debugging something. All of the art assets are in a folder together. I ran into trouble trying to catalog them into the appropriate folder. The Community Documentation is a godsend. Use it. Love it. Update it. FixedUpdate -> Unity's physics-update, does not require part to be in the active stage Update -> Unity's update. Does require part to be in the active stage The distinction between FixedUpdate and Update was initially lost on me and the cause of much frustration. Code should be human-readable and executable. When those conflict, err on the side of human-readable. Saving yourself 2 minutes writing can cause headaches down the line when you forget what that piece does. If you have any questions (CivilianSpawnGrowth can get a little gnarly), let me know. I'll try to answer.
  4. @Jiraiyah It will not grow via docking (immigration), but you can still grow via spawning without issue (but you will need a single "seed" Kerbal).
  5. @Jiraiyah, @Kerbas_ad_astra, The previous update (0.0.5) should make the game start-world agnostic. Github is calling my release Source Code. Not really sure why. Download it and there will be two folders inside: Source and GameData. Source has the source code, GameData has everything you would need for this mod (CRP, MM).
  6. Version 0.0.5 is up, with 1.2.0 compatibility. You can get it here. Background processing is still WIP; haven't had a lot of time to delve into it.
  7. @Jiraiyah no problem. USI can be a little complicated but not too bad. Just have to keep track of the moving parts. When I play with it, I find RoverDude's Wiki invaluable(if you're not already aware of it). If you find any problems, let me know so I can fix them.
  8. @Kerbas_ad_astra That's a great idea. I had no idea I could do that. I'll add it in when I'm able to work on the mod some more. Thank you! @Jiraiyah I think I got you. Out of the box, this mod doesn't include a life support system (but it does support them). So you could have Kerbals hanging around indefinitely and their number would only increase over time (up to crew capacity limit for Civilian quarters), similar to Jeb in my current sandbox game. As of yet, there is also no background processing on my side of crew growth, so who you send will be who arrives (and even when it is supported, no Kerbals will spawn without a "seed" Civilian). If you use USI Life Support, the 1.2 patch will have a few changes to the drills and such so that ISRU can be made closed-loop, using the USI modules to create Fertilizer. Otherwise, how are you keeping your current Kerbals alive with USILS? @richfiles I know what you mean. First it was Offworld Trading Company and now it's setting up events with BattleCON and making a character-select box. There are too many projects to do! That's a great idea for the upgrades, though! I saw it in the release notes but didn't consider the possibilities for this mod!
  9. @Jiraiyah the stations should be self-sufficient (or nearly so). It is about 16 supplies/Kerbal/Kerbal day, right? Right now, I believe I have the habs set up for 100 days at maximum capacity. I think the green houses are sized to keep up with a maximum of 50 or 60 Kerbals at the largest size per Greenhouse. You will still need to bring in either supplies or mulch + fertilizer but you should have plenty of time to do so (about 3-ish months). If you notice something off, let me know!
  10. @0111narwhalz Do you mean the .version file? In my tests, it seemed like that was ignored (I had set the minimum version to 2.2 and it loaded the plugin).
  11. My question for you guys isn't technical programming this time, but general mod-keeping. When do you guys release your 1.2-compatible versions? If you put it out before 1.2 officially drops, how do you keep issues between it and someone playing 1.1.3 from happening?
  12. Errors? What errors. My code is perfectly functional the first time, every time. It just tends to have some bonus, unexpected features that the compiler can't comprehend. Thank you! I didn't realize there was a version 1.2 forum. Time to do some reading on my lunch break!
  13. @JPLRepo I am actually the author. I just happen to be a very inexperienced author. I'll try recompiling when I get home tonight. I didn't see anything about .NET changing from 3.5, so to recompile for the latest KSP version, would there be anything else I need to do other than reference KSP 1.2's dll's (e.g. KSPUtil, KSP.UI, cSharpFirstPass, UnityEngine...)?
  14. Hey I'm trying to figure out what broke in my mod during the update to KSP 1.2.0 but I'm running into a wall. None of my part plugins seem to be loading. I've just downloaded the current version from GitHub (version 0.0.4) that I know works with 1.1.3. The only changes I've made are to the GameData/CivilianPopulationRevamp/CivilianPopulationRevamp.version and CRP.version files. In both, I've changed it to: { "NAME":"Civilian Population Revamp", "URL":"https://github.com/maanderson22/CivilianPopulationRevamp/releases", "DOWNLOAD":"https://github.com/maanderson22/CivilianPopulationRevamp/releases", "GITHUB":{ "USERNAME":"MAAnderson22", "REPOSITORY":"CivilianPopulationRevamp", "ALLOW_PRE_RELEASE":false }, "VERSION":{ "MAJOR":0, "MINOR":0, "PATCH":4, "BUILD":0 }, "KSP_VERSION":{ "MAJOR":1, "MINOR":2, "PATCH":0 }, "KSP_VERSION_MIN":{ "MAJOR":1, "MINOR":1, "PATCH":2 }, "KSP_VERSION_MAX":{ "MAJOR":1, "MINOR":2, "PATCH":5 } } Example of an error for a part (both are present in the part's .cfg file): [LOG 18:56:17.097] PartLoader: Compiling Part 'CivilianPopulationRevamp/Parts/DockingPorts/CivieDockingPort/civieDockingPort/civieDock' [ERR 18:56:17.102] Cannot find a PartModule of typename 'CivilianDockGrowth' [ERR 18:56:17.103] Cannot find a PartModule of typename 'KerbalRecruitment' Is this normal operation at this point (mods disabled for 1.2), or am I seeing something unique to my mod? Otherwise, does anyone have any ideas why this would happen?
  15. @DStaal Wow all that's stock? I've been "manually" editing the resource amounts using Part.RequestResource(string resourceName, float demand). Do you know which class that is in and/or some keywords/what it's called so I can look it up?
  16. Thank you for the quick reply. Now that you mention it, it makes sense that stock ISRU/mining would operate in the same way (why re-invent the wheel if you're the one who invented it to start with). But I don't understand how stock does it, either. Jumping into your code a little more, it looks like the ModuleLifeSupport class executes a supplyRecipe that you generated inside the class (instead of within a part's .cfg file). This is presumably why you don't need to use Part.RequestResource(string resourceName, float demand). Is that correct? However, I would expect that to only run if the part is on the active vessel; parts (and therefore part modules) are not active for inactive vessels. My hunch is that you are using the LifeSupportPersistance class to somehow store data between saves, and manipulating that data (which includes supplies info) while the crafts are unloaded. Then when the player loads a previously unloaded craft, you have some code somewhere that reconciles the craft's on-board resources with those in your class. Would that be right?
  17. How is US ILS adding/subtracting supplies from ships that are not focused? I'm trying to do something similar with Civilian Population, but for the life of me, I can't figure out how you're doing it. Going through the API, it looks like the ProtoPartResourceSnapshots properties are read only while the resourceRef field is not active when the part is not loaded. I can't find the appropriate file/section where that is being taken care of in your mod to see how you're getting around that. Thank you!
  18. @GalacticAC Right now, I'm just focusing on the plugin aspect. I have some experience in 3D modeling, but mostly for engineering applications, not exporting into a game system. If it is anything like learning the ins/outs of writing plugins for KSP, it's a lost more headache than I'm ready for right now. There are at least 1 of each size that will fit in the stock 2.5 m fairings IIRC. That said, if anyone reading this knows how to model and wants to do it, I'd hardly say no!
  19. Good to hear and I hope both of you enjoy it. Wanted to give an update on my progress (or lack thereof). I've been slowly working on this mod, but personal and professional life have been interfering, as well as my inexperience with C#. I found a proof-of-concept solution to a problem that had been bugging me for a while. Turns out strings and doubles aren't passed by reference directly, but if they are nested in a class, they can be. So background processing should be able to work without a problem as long as I can alter the values protoVessels/ResourceSnapshots. But unfortunately now I need to figure out how to program C# for KSP on Windows. Hopefully it's easier than on Linux. Ideally, I want to include the drill updates (above), and background processes for the KSP 1.2 version that will be coming out soon. Unless someone finds a game-breaking oversight, in which case I'll add whatever fixes I currently have done.
  20. @Smart Parts Wanter haha no I am most certainly not. This is my first time working with Git(and C#...and modding...and "theoretical" programming). To answer your question, no. Source can be discarded (I actually need to figure out how to separate the GameData and Source folders because I feel like I'm wasting bandwidth). It contains my source code which should not be used unless you want to take a look at the inner workings of the mod. Just in case you're new to modding KSP, you should have a folder within the KSP folder called GameData which if it's a new install will contain only a folder called "Squad". In my mod, I also have a folder called GameData. You'll take the contents of my GameData folder and drop them in KSP's GameData folder. So when you're done, it should contain "Squad", "CivilianPopulationRevamp", "Community Resource Pack", and "ModuleManager".
  21. @sarbian Thank you! Now I feel like a real dunce. Looking back, I'm trying to make my code more readable/less resource intensive. But I'm having trouble figuring out if what I want to do is possible in C#. It probably is, but I don't know the technical term for it. Right now, I am going through a list of each inactive vessel and selecting each that has one of my part modules. Form there, I cycle through each part to find the specific part implementing my mod. Then I use the part snapshot (another array nested in the above part) to obtain the resourceSnapshot. This is a lot of lists to go through in order to find something that should not be changing much (this section only runs on vessels that are unloaded). I would like to save that memory location in a new class so I can directly modify it without having to set up several nested foreach loops. In C/C++, I'd use pointers to keep that information and bundle them in a struct. From there, if I want to change the value, I need only pass the pointer a new value. So instead of this in the start AND update section of code: foreach (Vessel civilianVessel in listCivilianVessels) { bool appliedVesselChanges = false; var civilianPartSnapshots = civilianVessel.protoVessel.protoPartSnapshots; foreach (ProtoPartSnapshot civilianPartSnapshot in civilianPartSnapshots) { foreach (ProtoPartModuleSnapshot civilianPartSnapshotModule in civilianPartSnapshot.modules) { Debug.Log (debuggingClass.modName + civilianPartSnapshotModule.moduleName); if (civilianPartSnapshotModule.moduleName == "populationGrowthModifier" && !appliedVesselChanges) { var civilianResourceList = civilianPartSnapshot.resources; foreach (ProtoPartResourceSnapshot civilianResource in civilianResourceList) { //apply logic to increment resources here appliedVesselChanges = true; } } } } } The above would be run once to collect information and log it into an array of classes My code could look like this: public class myBackgroundClass { List<UnloadedVesselClass> listUnloadedVessels = new List<UnloadedVesselClass>(); OnStart(startState state) { //apply logic to find appropriate vessel resource, as above var snapshotResourceAmount//one of the variables I want to edit within the snapshot var newResourceInfo = new UnloadedVesselClass(snapshotResourceAmount); listUnloadedVessels.Add(newResourceInfo); } OnUpdate() { foreach(civilianVessel in listUnloadedVessels){ //Apply logic to increment resources here; i.e. civilianVesel.resourceAmount++ } } I've tried using the "ref" keyword, but it does not seem to work with Lists. When I try using an intermediate variable, I store the location of *that* variable instead of the member of the list. Does anyone have any ideas?
  22. @CraftyDwarf can you confirm that there is a folder in /GameData/CivilianPopulationRevamp/Parts/Hydroponics? And check the version in /GameData/CivilianPopulationRevamp/CivilianPopulationRevamp.version? I think you may have version 0.0.3 instead of 0.0.4.
  23. I have a method in a plugin I'm working on that will go through a list of vessels and return a list of vessels that implement my plugin. I've been trying to troubleshoot the problem and it looks like the list is not returning correctly. The list as Start() sees it has 0 elements, instead of the number of ships (2). I've added some log writes at different points. The code I am running: namespace CivilianPopulationRevamp { [KSPAddon (KSPAddon.Startup.Flight, false)] public class BackgroundGrowth : CivilianPopulationRegulator { List<Vessel> listCivilianVessels = new List<Vessel> (); public void Start () { Debug.Log (debuggingClass.modName + "Running OnStart in BackgroundGrowth!"); List<Vessel> listOfVessels = FlightGlobals.Vessels; listCivilianVessels = getCivilianVessels (listOfVessels); Debug.Log (debuggingClass.modName + listCivilianVessels.Count); foreach (Vessel civvieVessel in listCivilianVessels) { Debug.Log (debuggingClass.modName + civvieVessel.vesselName); } }//end start public List<Vessel> getCivilianVessels (List<Vessel> listOfVessels) { bool hasCivModule = false;//used to flag whether or not my plugin is on that craft List<Vessel> civilianDockList = new List<Vessel> ();//list of civilian vessels to be returned foreach (Vessel sumVes in listOfVessels) { hasCivModule = false; if (!sumVes.isActiveVessel && !sumVes.loaded) { var partSnapshots = sumVes.protoVessel.protoPartSnapshots; foreach (var partSnapshot in partSnapshots) { var protoPartModules = partSnapshot.modules; foreach (var protoPartModule in protoPartModules) { if (protoPartModule.moduleName == "CivilianDockGrowth") { hasCivModule = true; }//end if plugin name matches }//end foreach ProtoPartModuleSnapshot }//end foreach protoPartSnapshot }//end if vessel active if (hasCivModule) { listCivilianVessels.Add (sumVes); Debug.Log (debuggingClass.modName + "Added " + sumVes.vesselName + " to civilian list, implementing CivilianDockGrowth"); } }//end foreach Vessel return civilianDockList; }//end getCivilianVessels }//end class }//end namespace This returns the following in the KSP log: [LOG 17:08:25.604] [CivilianPop Revamp]Running OnStart in BackgroundGrowth! [LOG 17:08:25.605] [CivilianPop Revamp]Added Untitled Space Craft to civilian list, implementing CivilianDockGrowth [LOG 17:08:25.605] [CivilianPop Revamp]Added ActiveTestVessel1 to civilian list, implementing CivilianDockGrowth [LOG 17:08:25.605] [CivilianPop Revamp]0 [LOG 17:08:25.615] [CivilianPop Revamp]civieDock (Untitled Space Craft) is running OnStart()! Note: The last line is from another portion of code, meaning that the above Start() method has finished executing. Has anyone seen something similar to this? The searching I've done says that the above (return variable_name) is the correct way to return an object. Is there something I'm missing (like a need to return by reference)?
  24. @CraftyDwarf Thank you very much for the feedback! This is still definitely a work in progress. For your points: 1) I agree keeping Netherdyne will help keep parts more organized. During development, I used a new (temp) name to keep track of things but it looks like I missed a few. I'll have them reverted to Netherdyne in the next version. 2) I'm not sure what you mean. I'll check the configs on ExtraPlanetary Launchpads and USI. If you already have configs, I'd be happy to take a look at them! 3) What hydroponic models/concepts are you referring to? When I transferred the modules over, I moved the modules/resources into a TAC Life Support Module Manager config. Did I miss some? I haven't made any changes to the actual models/assets. In general, I would say expect an update with the above and background civilian growth within the next couple of days. The background processing is wrapping up. EDIT: My programming time this last week was essentially non-existent. Update is still coming but have to work around pre-existing obligations.
  25. @Deimos Rast Ah I see what you mean now. I took the extra resources (food, water, O2, CO2...) out by default because Stock doesn't make use of them as there's no stock life support. There's a MM config to add them back in if TACLS is installed and another to add say supplies/fertilizer if USILS is installed. It seemed more straightforward (aka easier) to add them once, than delete them every time I want to add a new life support mod. One thing I've gained from programming is an extreme dissatisfaction with copy/paste code. That said, I haven't played Stock in a *long* time other than testing this, so I'm flying by the seat of my pants here. If adding those resources makes a better game play experience, I can add them in. @ronnie4444 Thank you! But more than anything, it's other mod authors (namely @michaelhester07 and @rabidninjawombat) who deserve that praise. And (perhaps more importantly) @tomf for putting together the new API Documentation. Seriously, that's a godsend.
×
×
  • Create New...