Jump to content

Rhidian

Members
  • Posts

    71
  • Joined

  • Last visited

Everything posted by Rhidian

  1. Science Redefined v.0.5 [WIP] Because Science is what Careers are based off of Author: Rhidian License: All Rights Reserved (will likely change when this is no longer a WIP) Description: Science Redefined is a mod that changes (somewhat slightly) the mechanics of how Science is obtained. The plugin itself changes a few things about Science 1) Science Decay is no more. Instead of each successive Science report being worth less and less, the science value of each report is constant up until the Science cap for the particular experiment/biome is reached 2) The Mobile Science Lab now passively increases the data amount (and therefore the scientific value) collected by experiments. So instead of collecting 40 science worth of data, you could be collecting 60 instead (Untested so far): The science cap for experiments/biomes should be increasing as you progress through the scientific part of the tech tree. The config file in this mod is meant to be used with ModuleManager to increase the Science Data cap across the board, allowing experiments to be repeated more times before hitting the wall. Combined with the above plugin changes, the mod aims to make gathering science easier and less boring. As this is a WIP (and a first release of the code at that), there are major balance changes that needs to be made. Additionally, compatibility with other mods is unknown at the moment, but since this mod extends and adds functionality to the ModuleScienceExperiment class, any other mods that change that could have a conflict. Version 0.5 Changes: Removed Science Decay for experiments See the difference between these two pictures taken within the same career mode by successive flights? Download Link (Source code is included in the ZIP) Please feel free to suggest ideas on how to make the Science system better.
  2. Works beautifully. Turns out other parts of my cfg files were preventing me from noticing the effect earlier, but now its all good.
  3. Is there a way to use ModuleManager to replace the name (and in turn the class) of a PartModule? I'm wanting to replace all instances of ModuleScienceExperiment with my own class ModuleResearchExperiment which extends ModuleScienceExperiment. Here is what I have tried: @PART[*]:HAS[@MODULE[ModuleScienceExperiment]] { @MODULE[*].HAS[#name[ModuleScienceExperiment] { @name = ModuleResearchExperiment } } But I believe the key problem is that by the time ModuleManager does its thing, the names are already set in stone (or so I think).
  4. TechRequired = start entryCost = 50 cost = 800 The key being the "TechRequired = start" line, with 'start' being the name of the Tech node you want the part to be unlocked on. It just has to be on it's own line in the same scope of where the Part's name is (usually near the top). Edit: This being located in the Part's "part.cfg" file.
  5. It has been a long journey, but I have finally figured out how to change the Base Value of an experiment via the presence of a Science Lab successfully. public class ModuleResearchExperiment : ModuleScienceExperiment { [KSPField(isPersistant = true)] public bool beenBoosted = false; protected ScienceExperiment boostExperiment = null; public void initializeExperiment() { boostExperiment = new ScienceExperiment(); ConfigNode sNode = new ConfigNode(); ResearchAndDevelopment.GetExperiment(this.experimentID).Save(sNode); //Copies values from original experiment to the internal experiment boostExperiment.Load(sNode); Debug.Log("Initialized Successfully"); Debug.Log("Testing: " + boostExperiment.experimentTitle); this.experiment = boostExperiment; Debug.Log("Transferred successfully"); beenBoosted = false; } new public void DeployExperiment() { //If it is the first time deploying the experiment, initialize it if (boostExperiment == null) { initializeExperiment(); } Debug.Log("Experiment has been deployed"); requestBoost(); base.DeployExperiment(); } new public void ResetExperiment() { Debug.Log("Experiment has been resetted"); initializeExperiment(); base.ResetExperiment(); // this.resetBoost(); } public void requestBoost() { //If this hasn't been boosted already if (!this.beenBoosted) { Vessel v = FlightGlobals.ActiveVessel; List<ModuleScienceLab> labs = v.FindPartModulesImplementing<ModuleScienceLab>(); float boost = 1.0f; foreach (ModuleScienceLab lab in labs) { if (lab.dataTransmissionBoost > boost) { boost = lab.dataTransmissionBoost; } } if (boost > 1.0f) { //The "this.experiment" that is being changes should be the boostExperiment this.experiment.baseValue = this.experiment.baseValue * boost; beenBoosted = true; } } } } The key to the whole problem is the Science Experiment module itself, which houses the information that is used to generate the science reports. However, a big problem I encountered was that changing the "this.experiment.baseValue" directly changed it for *all* experiments of the same type, which got out of hand fast with multiple Experiment modules on-board. And so my solution is for each PartModule to house it's own individualized ScienceExperiment (which is a copy of the original), so that any changes to its baseValue is compartmentalized. With this hurdle being overcome, I am much closer to getting a WIP version out on the main Add-On Development forum where the focus would be on balancing the changes I make. But before that, is there anything else I could/should do to change the Science data collection mechanics?
  6. FlightGlobals.currentMainBody.BiomeMap.GetAtt(FlightGlobals.currentMainBody.position.x, FlightGlobals.currentMainBody.position.y).name The position needs to be worked out mind you. The X and Y of the Launchpad gives me the Ice Cap as the name, but I'm sure it will be clearer when you figure out what the Latitude and Longitude is of your current location. I've also discovered the answer to my own question regarding the GameEvents. public override void OnStart(PartModule.StartState state) { base.OnStart(state); GameEvents.onPartActionUICreate.Add(someEvent); } public void someEvent(Part p){ Debug.Log("This event occurred"); }
  7. Is there a way to tell through code when a Science Lab (or whatever is making use of the Science Lab's transmission boost variable) has finished processing some ScienceData? Secondary Question: How do you add a method to GameEvents? Say I'm wanting to do something like this: public class ModuleResearchExperiment : ModuleScienceExperiment { public override void OnStart(PartModule.StartState state) { base.OnStart(state); GameEvents.onPartActionUICreate.Add(someEvent) } public void someEvent(){ Debug.Log("This event occurred"); } } How would I go about supplying the correct argument to add to the GameEvents queue?
  8. I think ResearchAndDevelopment gets initialized when reaching the SpaceCenter after it detects that there are no researched Tech Nodes (presumably it unlocks the start node when it initializes). Depending on how your injection works, I would suggest loading the biomes on the Flight scene or sometime after the player visits the Space Center the first time. As for your actual question, ResearchAndDevelopment appears to have an Initialize function, but I'm not sure where the arguement for it's initialization comes from.
  9. I think that I am going to have to give up on changing the baseValue via the Science Lab. I don't know where the base values are stored midflight and I don't know how to determine/modify the Lab's data boosting function. I'll just settle with the Science Lab's experiment resetting ability and the massive transmission boost that I'll give it later. Which means I'll move onto my next goal, which is to make it so that upon successful recovery of a vessel that performed an experiment, that experiment's data entropy is reduced (ie you can repeat the experiment again with less of a penalty). I've noticed that the 'data entropy' as I've termed it is located within the persistence save file under the specific experiment report. So the question I have is how could I access/overwrite the information in that file, and how can I determine if the craft that has performed an experiment has been successfully recovered? Edit: I just had a Eureka moment (that still needs to be tested). Would it be possible to use ModuleScienceExperiment's GetData function and change the baseValues for the experiment directly? Like if during the experiment's DeployExperiment function I checked to see if there is a functioning Lab on the vessel, and if so, increase the baseValues by iterating through the GetData array? Edit: Or there is no data stored in the experiment at the time that the experiment is deployed. Which means if I want to modify the data, it would have to be after it's been collected. To this end, I think it should be possible to add one of those actions to the Lab Module to iterate through the data and increase the data value. So how would I go about creating one of those actions like that which says "Process Lab Data" when there is data to be processed?
  10. Fiddling around with the code a bit, I believe I need to modify the ProcessData function. However, it appears to be an Interface (IEnumerator) or returns an Interface, so I'm not sure how to modify it (specifically, the callback argument). Edit: Or it's not the ProcessData that I need to modify. Nothing is printed out into the console when I Process the lab data. public class ModuleLabBooster : ModuleScienceLab { new public System.Collections.IEnumerator ProcessData(ScienceData data, Callback<ScienceData> onComplete) { Debug.Log("Processing the Data"); Debug.Log("Moonstone Cannon, FIRE!!!!"); return base.ProcessData(data, onComplete); } //This Event is fired when the "Process Data" button on the actual module itself is pressed new public void ProcessScienceDataEvent() { Debug.Log("Processing Event"); base.ProcessScienceDataEvent(); } } Edit #2: Now that I've thought about it, I think what I'm wanting to change is the ModuleScienceExperiment. From what I can tell, that is what actually stores the data and calls for the Lab to do its thing. However, making a PartModule that inherits the ModuleScienceExperiment and using that on a Science part leads to a NullReferenceError for some reason. Edit #3: After testing a lot more code, I have narrowed down the cause of what processes the Lab Boost to being outside of the ModuleScienceLab class itself. ScienceUtil supplies a boost value to whatever is eventually submitting the Report to ResearchAndDevelopment. My guess as to what actually uses the Lab boost? Or in other words, an RDReportListItemContainer object, which happens to have all of the variables at hand. The question is whether I can manipulate what goes on behind that box somehow. Any ideas?
  11. I have never said that the Map couldn't be used. That's the biggest misconception of this challenge I believe, one I have been trying to clear up over and over. I'm not going to expect someone to get to another planet without referencing the map at all. I do expect people to reference the map at least once inbetween locations, make a node to get information about their desired trajectory, etc. The question though is how well can you leave these steps out. As for the scoring, yes, it can be improved. The assumptions that I made when determining the scoring were: 1. The player would look at the map at least once when transitioning from one orbit to another. 2. Nodes would be used to allow the person to know where they should be going, though actually pulling off the maneuver without guidance from the node would be worth more (ie use the mission clock to know when you reach the estimated node time, then look at the map a 2nd time to confirm your trajectory after the maneuver). 3. Should a player use multiple craft, pulling off the docking maneuver would usually require using the map to align trajectories. In my example, I escaped Kerbin's SOI without using the map. After confirming with the Orbit/altitude change that I was orbiting Kerbol, *then* I opened the map to try and plot a course towards Eve (which I didn't have enough fuel for). I made the node, looked at the time requirement, closed the node (and the map), and tried warping to the estimated mission time. I overshot the time, tried to initiate the retrograde burn, and eventually checked the map when near the lower limits of my fuel tank. Now, if I had used the node fully without looking at the mission clock at all (assuming I had the fuel to pull off the maneuver), my trajectory would have been more efficient. If I used Map mode to adjust the trajectory I ended up with to actually intercept Eve, that would have been fine, except it would still cost me points for doing so. The point of the challenge isn't to abandon the Map completely, it's to see how well you can do when not taking advantage of the map. Now, the scoring system does need to be changed somehow. So how would you change it?
  12. My attempt at the challenge: My score: Orbit Kerbin: +200 Orbit Kerbol: +200 Open Map: -25 Create a Maneuver Node: -5 Open Map: -25 Total: 345 points ----- By the way, doing the entire thing while looking at the map kind of defeats the whole point of the Challenge. So there shall be a new rule: the Map can only be used while at 1x speed.
  13. A clarification of the Map: 1. You may use the Map. I know it would be practically impossible to get to another system without the Map. However, every time you open the Map screen, you have to deduct 25 points from your score. 2. While the Map is open, you may *create* a Maneuver node. You can glean information from it like what time it would take to reach a certain point, how much delta V you would need, as well as the estimated trajectory path. Each node created loses you 5 points. 3. If you leave the Node intact and actually use it when flying with the NavBall open, you deduct a further 20points from the score. If you keep the Map view open while doing so (to see what your orbit eventually ends up being), you lose another 70 points from the score. I'm not asking the impossible here. I know I wouldn't be able to do this without opening the Map at all. This challenge is about trying to minimize something that is commonly used during all flights, and the more you can go without the Map, the better. I believe making the node to another orbit path, and calculating when/where you reach the time and speed to use without using the actual Node guidance is the best way to rack up points. Regarding Infinite Fuel, just remember, if you use it, your score is reduced by 80% (as well as by 500 points beforehand). If your pre-penalty score is 5500, it would go to 5000 first, and then end up being 1000 points. I may end up with a separate leader board for it if the option ends up getting incredibly awesome scores somehow, though I think the big challenge would still be on actually getting to all of the planets when minimizing Map usage. I have allowed multiple crafts to be launched in this challenge (and reward bonuses for successfully refuelling) for those wanting to aim for the all planets bonuses without Infinite fuel. Edit: You can use them, so long as they don't provide information only visible from the Map. Notably this would be information about your Apoapsis/Periapsis and Orbital trajectories.
  14. Edit: Requesting the topic be deleted. My first challenge submission has been poorly thought out, though thanks to this topic I now have a better idea of what a good version of this challenge would be (ie limiting the scope greatly). Thanks. Challenge: Off the Grid How well can you fly without the Map?
  15. After much trial and error, I have managed to figure out how to achieve my first goal. [KSPAddon(KSPAddon.Startup.Flight,false)] public class ScienceRedefined : MonoBehaviour { public void Start() { Vessel craft = FlightGlobals.ActiveVessel; List<Part> parts = craft.parts; foreach (Part p in parts) { float modDataScalar = 0.0f; if (p.name.Contains("mk1pod")) modDataScalar = 2.0f; List<ModuleScienceExperiment> mods = p.FindModulesImplementing<ModuleScienceExperiment>(); foreach (ModuleScienceExperiment m in mods) { m.xmitDataScalar += modDataScalar; } } } } As long as the scienceCap is bigger than the baseValue, the above code will let the first command pod in Career boost the Science value by up to 200% (for a total value of 300%) through transmission. So now for my next goal: How would I make it so that the Science Lab (module) boosts the baseValue of the Scientific data instead of the Transmission value? Right now I'm thinking of making a Part Module that inherits the ModuleScienceLab class, and somehow manipulating the ScienceData values that pass through it, but I'm not sure where I could get the ScienceData to manipulate.
  16. I am making my first plugin (read: I'm a complete newbie at this), and I'm not sure where to start when trying to modify Science experiments. For now, my first goal is this: Making the transmit data of a science experiment (like Crew or Eva reports) be worth more than the non-transmitted data. I am thinking that ModuleScienceExperiment would be the correct class to inherit in this case, and I think that ResearchAndDevelopment can be used somehow, but other than that I'm not sure how I can get started on accomplishing my first goal.
  17. I figured out how to do change the Experiment definitions without changing anything else. @EXPERIMENT_DEFINITION[*]:HAS[#id[crewReport]] { @baseValue = 50 @scienceCap = 50 }
  18. While in free fall near a planet or moon, jettison off some sort of payload that has at least some sepatrons for a speed boost and a parachute (set to deploy). Then the challenge is to try to hit the payload in midair after the parachute on the payload deploys. Bonus points for starting at higher altitudes and/or using a shallower angle for the initial separation.
  19. I'm getting my feet wet with just doing cfg editing for now, and I have a question regarding the Science Experiments. I'm wanting to change the baseValue for a science experiment (for example, Crew Report), and I'm not sure how to directly override the value in the ScienceDefs.cfg. I have tried using @EXPERIMENT_DEFINITION[crewReport] within my own .cfg file, yet it doesn't appear to work. I have managed to get somewhat close to what I'm looking for by creating my own Experiment (ie a near copy of the entire Crew Report definition) and changing the basic Command cockpit to referencing my experiment instead, but I am hopeful there is a way to directly change the Crew Report fields without directly changing the ScienceDefs.cfg itself.
×
×
  • Create New...