Jump to content

asdfCYBER

Members
  • Posts

    225
  • Joined

  • Last visited

Everything posted by asdfCYBER

  1. Honestly? Nothing has happened since my last post. Turns out that if universities think students have more time, they'll just give more deadlines... Also modding hasn't exactly been a priority anyway. Maybe I should add another year to that calendar
  2. Quick update: university has cost more time than I originally thought. Now that I have to watch lectures from home however, I have three more hours each day I'd otherwise spend commuting, hopefully that means more modding time. Right now I'm learning how to use Harmony to change stock UI (if at all possible) - the plan B I'd rather not use is simply drawing another UI on top of the old one.
  3. Current progress: I have replaced the experiment UI. The buttons currently don't do anything (except that they all close the window), but the save button will save the data to a storage module based on module priority, and the transmit button will probably require DMagic's Science Relay mod or large sections of it (and have the data value decrease over distance based on antenna properties) in the future. Here's a picture of the old UI and my UI side by side: I will probably change the title and description to the style on the left, but I'm very happy with how it looks (especially since this is the first UI I made for KSP and had to endure a good deal of unity and textmeshpro weirdness - thanks a lot @DMagic for your UI tutorial!). One thing I'm not totally sure of is the transmit icon - I made two versions and am currently using the most stockalike, but the other might blend in better with my other new icons: Please tell me which one y'all like better Edit: there's also a github repo now, and a roadmap.
  4. I'm trying to follow DMagic's UI tutorial, and I am currently trying to get my head around interfaces - and buttons. I can call any public function with OnClick(), but I'm not sure how to send that event to the KSP assembly. What I've thought of are setting some variable to a certain value and checking every once in a while through the interface if that variable has changed, and calling a GameEvent which gets picked up by the other assembly (I'm not sure if that's possible). Would either of these methods work, or is there a better way to do this?
  5. I'd like my name changed from ExtremeTrader to asdfCYBER please, I'm neither extreme nor a trader and I use asdfCYBER everywhere now. Thanks!
  6. I'm having the exact same problem. Before I try to recreate what you did, can you confirm your assets work in KSP? (edit: I'm not making KSPedia entries but GUIs, though if one works I assume the rest does as well)
  7. Yes, I'm planning to use the science lab as a data-to-science converter. There is no need for science-to-data, instead the whole standard science system will be ignored (experiments now collect data). I'm not sure if I want the research to take time, I don't want to add too much of a grind. I might make it optional at a later stage in development, right now I'm trying to get the basis up and running (replacing the techtree will probably be the most difficult, and I need to reinvent multiple GUIs which will be very timeconsuming)
  8. After getting stuck on one very specific bit of the mod, I have now actually started doing things. That makes this mod a WIP now! So far, I implemented a partmodule that intercepts science reports and one that stores the results, next step is to make a GUI for those reports
  9. Hi all, I would like to figure out how much science something returns from a certain location if the experiment was recovered or transmitted using these objects: ScienceData data and ScienceExperiment experiment. I know that data.subjectID gives me a string experimentID@location, and experiment.baseValue and experiment.scienceCap are the base values, but I do not know how to calculate the science at a location with these. Does someone here know? (edit: of course I could test all experiments at all locations and hardcode a solution, but I'm looking for a simple algorithm or api call) edit2: probably solved, just discovered that the ResearchAndDevelopment class has a bunch of science value related methods like ResearchAndDevelopment.GetScienceValue(dataAmount, scienceSubject) edit3: So here's my next question I haven't been able to figure out: I have a confignode CONTAINED_DATA in which an unknown amount of entries (of the form subjectID:dataAmount) are stored, which looks like this: CONTAINED_DATA { atmosphereAnalysis@KerbinFlyingLowShores = 200 atmosphereAnalysis@KerbinSrfLandedLaunchPad = 200 asdf = 42 } I have been trying to get my code to add these entries to a dictionary called containedData by looping over the nodes in CONTAINED_DATA: foreach (ConfigNode dataNodeKey in dataNode.GetNodes()) { string key = dataNodeKey.ToString(); float value = float.Parse(dataNode.GetValue(key)); containedData.Add(key, value); Debug.Log(key + " was added to the dictionary"); } However, nothing gets added to this dictionary and the log mentions nothing about added keys. I have also tried looping over dataNode.nodes and returning a bunch of objects, which all seem to be empty. Here is the log with comments: [LOG 22:28:57.178] OnLoad called //the onload method is called in my partmodule [LOG 22:28:57.178] MODULE //the node is dumped to the log { name = ModuleDataContainer isEnabled = True stagingEnabled = True EVENTS { } ACTIONS { } CONTAINED_DATA //the node (called dataNode in the code) where various entries are stored, which are not known in advance { atmosphereAnalysis@KerbinFlyingLowShores = 200 atmosphereAnalysis@KerbinSrfLandedLaunchPad = 200 asdf = 42 } UPGRADESAPPLIED { } } [LOG 22:28:57.178] GetNodes: ConfigNode[] //dataNode.GetNodes().ToString() returns what seems to be an empty list of confignodes [LOG 22:28:57.178] nodes.tostring: ConfigNode+ConfigNodeList //dataNode.nodes.ToString() returns something I can't decipher [LOG 22:28:57.178] Values: System.String[] //dataNode.GetValues().ToString() returns what seems to be an empty list of strings [LOG 22:28:57.178] This really should work: 200 //directy accessing an entry does work but is not usable when entries are unknown [LOG 22:28:57.178] containedData is empty //nothing got added to the dictionary [LOG 22:28:57.178] OnLoad finished What can I loop over to add the entries to my dictionary and how? edit4: I created a workaround so that key and value are stored separately (which is a lot less practical), but I still hope there is a solution for key = value entries with unknown keys
  10. You can do this using ModuleManager (you already have it installed if you have RO+RSS). If you want to edit engines you can make a new .cfg in your gamedata folder and use this (I haven't tested it): @MODULE[ModuleEngines] { @PROPELLANT[MonoPropellant] { @name = otherMonopropGas } } for RCS, something like this should work: @MODULE[ModuleRCSFX] { @resourceName = otherMonopropGas } Of course, you need to make sure that your otherMonopropGas is actually defined in a resourcedefinition cfg somewhere, but if you change it to one of the real fuels resources you don't need to think about that. I suggest that you practice writing MM patches, they can be very useful. Some syntax explanation can be found here: https://github.com/sarbian/ModuleManager/wiki/Module-Manager-Syntax
  11. That does make sense, but it's not set as out or ref or even optional (https://kerbalspaceprogram.com/api/class_comm_net_1_1_comm_network.html#ab3c35970caed4e281ded1612770acdfe). When I try to use CommNetwork as a type visual studio mostly flips out and breaks control loops for some reason (edit: your code doesn't give errors however, not sure what happened). edit 2: threw your code in a method and found this in the log: [ERR 16:35:03.203] Module ResourceTransceiver threw during OnUpdate: System.NullReferenceException: Object reference not set to an instance of an object at CommNet.CommNetwork.FindPath (CommNet.CommNode start, CommNet.CommPath path, CommNet.CommNode end) [0x00000] in <filename unknown>:0 at ResourceBeamer.ResourceHandler.somemethod (.Vessel vessel1, .Vessel vessel2) [0x00000] in <filename unknown>:0 at ResourceBeamer.ResourceTransceiver.OnUpdate () [0x00000] in <filename unknown>:0 at Part.ModulesOnUpdate () [0x00000] in <filename unknown>:0 I'm pretty sure that's a nullref about the path being null, I don't know how to get a path though
  12. Is there a way to check if there is a CommNet path between two vessels that are not necessarily connected to Home, and get the total distance and signal strength? I can't find anything of use here in the CommNet classes and I wouldn't know how to make this myself. Edit: seems like asking this improved my chances of finding the right thing, because I think override void CommNet.CommNetwork.CreateShortestPathTree(CommNode start, CommNode end) or override bool FindPath(CommNode start, CommPath path, CommNode end) might be what I was looking for, though I don't understand how to use these (getting a path from a pathtree that is not returned? find the best path when I don't have a path? findpath returns bool instead of path?)
  13. Nothing. I feel like [KSPField()] is the way to go, but everything I try ends up in the part not being loaded . When using KSPField, OnLoad and OnSave should not be necessary so I will try removing those. I tried adding [KSPModule("Resource Transceiver")] too, but that did not do anything about the error. Edit: I commented out OnLoad and OnSave, now everything outputs LiquidFuel as it should, and it shows up in the .craft file too. Thanks for the help!
  14. This is all of my code currently: using UnityEngine; namespace ResourceTeleporter { public class ResourceTransceiver : PartModule { public string ResourceName { get; set; } /// <summary>Load resource from config</summary> public override void OnLoad(ConfigNode node) { ResourceName = node.GetValue("resource"); Debug.Log("[RT] OnLoad " + ResourceName); } /// <summary>Get resourceID from name</summary> public int GetResourceID(string ResourceName) { PartResourceDefinition Resource = PartResourceLibrary.Instance.GetDefinition(ResourceName); return Resource.id; } /// <summary>Get resources in the vessel this part is part of</summary> public double GetVesselResourceAmount(int ResourceID) { this.vessel.GetConnectedResourceTotals(ResourceID, out double amount, out double maxAmount); Debug.LogWarning("[RT] Current vessel resources: " + amount + " (max: " + maxAmount + ")"); return amount; } public override void OnStart(StartState state) { Debug.Log("[RT] OnStart " + ResourceName); } public override void OnUpdate() { Debug.Log("[RT] OnUpdate " + ResourceName); } } } This returns (plus some relevant bits): [LOG 10:54:19.149] PartLoader: Compiling Part 'Squad/Parts/Utility/rcsBlockRV-105_v2/rcsBlockRV-105/RCSBlock_v2' //ksp startup [LOG 10:54:19.158] [RT] OnLoad LiquidFuel //the only time it works correctly [LOG 10:55:09.555] [RT] OnStart //editor [LOG 10:55:11.314] RCSBlock.v2 added to ship - part count: 4 //the part I attached the module to [LOG 10:55:22.462] Loading ship from file: C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program/KSP_x64_Data/../saves/default/Ships/VAB/Auto-Saved Ship.craft [LOG 10:55:22.462] [UIMasterController]: HideUI [LOG 10:55:22.491] [RT] OnLoad //switch from editor to flight [LOG 10:55:25.946] [RT] OnStart //flight, gets spammed for every update so I just pasted one here [LOG 10:55:26.259] [RT] OnUpdate //flight ResourceTransceiver.ResourceName gets reset on scene switches apparently (it doesn't even get overridden like on the editor->flight switch, there is no OnLoad between startup and editor). It probably should have a KSPField property, I'm going to test that now. edit: added [KSPField(isPersistant = true)] in the line before ResourceName, part did not compile (same thing with just [KSPField()]): [LOG 11:17:09.478] PartLoader: Compiling Part 'Squad/Parts/Utility/rcsBlockRV-105_v2/rcsBlockRV-105/RCSBlock_v2' [EXC 11:17:09.488] MissingMethodException: No constructor found for BaseField::.ctor(KSPField, System.Reflection.MonoProperty, ResourceTeleporter.ResourceTransceiver) System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) System.Activator.CreateInstance (System.Type type, System.Object[] args) BaseFieldList`2[R,K].CreateList (System.Object instance) BaseFieldList.CreateList (System.Object instance) BaseFieldList`2[R,K]..ctor (System.Object host, Boolean ignoreUIControl) BaseFieldList`2[R,K]..ctor (System.Object host) BaseFieldList..ctor (UnityEngine.Object host) PartModule.ModularSetup () PartModule.Awake () UnityEngine.GameObject:AddComponent(Type) Part:AddModule(String, Boolean) Part:AddModule(ConfigNode, Boolean) PartLoader:ParsePart(UrlConfig, ConfigNode) <CompileParts>c__Iterator1:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) [ERR 11:17:09.488] PartLoader: Encountered exception during compilation. System.NullReferenceException: Object reference not set to an instance of an object at PartModule.Load (.ConfigNode node) [0x00000] in <filename unknown>:0 at Part.AddModule (.ConfigNode node, Boolean forceAwake) [0x00000] in <filename unknown>:0 at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0 at PartLoader+<CompileParts>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0 [ERR 11:17:09.489] PartCompiler: Cannot compile part I could store ResourceName in a different class perhaps
  15. It still doesn't, Debug.Log("[RT] onupdate " + ResourceName) only yields a spam of the string bit just like OnStart. I'll try reverse engineering another mod. Edit: InterstellarFuelSwitch seems to call another method on load which puts inputs in variables that can be read in other scopes: Dictionaries and lists are too complicated for what I want, but I'll try the anothermethod-method tomorrow (2300 pm here)
  16. I'm checking at OnStart which I thought came after OnLoad, but I could be wrong about that
  17. Yes, I tried that, but when I try to Debug.Log it is null (node.GetValue("resource") returns "LiquidFuel" as it should). I'm pretty new to C# and oop in general, so I might be making some dumb mistake.
  18. Hello modders, do any of you happen to know how to make the string ResourceName available for other methods? I have tried to use OnLoad(ConfigNode node, out string ResourceName) and public string ResourceName { get; set; } but to no avail.
  19. If you look at the schematic at the top of the first post, you can see a 'Data' resource I want to implement. I would like to move this resource from one vessel to another while one or both are on rails (from a probe to a lab, for instance). Your plugin beams energy (not sure if it was electric charge or thermal power) in that way, but I can't figure out if this can be modified to use any arbitrary resource. If it can, that would save me some time. If not, I'll write my own system from scratch (and maybe release it as a standalone tool for everyone who wants to teleport resources).
  20. As far as I can see you are suggesting to combine option 2a and 3 from this braindump. If I can get one type of data to work then multiple would be a matter of copy-pasting, so it's certainly possible. The problem I see with this however is that multiple data types would need to be implemented, and that reduces the data processing step to nothing more than a grind. I chose for the universal data type because irl an experiment isn't purely one field of science: it can be interpreted in different ways and combined with other data. It's the processing step that determines what kind of science it is - whether the scientists chose to write a report concerning the biology, the physics or the chemistry (just to name a few major fields). I am planning on applying multipliers for different types of science depending on the lab location and situation (chemistry should get a multiplier smaller than 1 if the lab is in orbit for example, since fluids and powders get messy really quick). I may change my opinion in the future but I don't think having multiple types of data is a good idea. I'd say the stock system is worse than this, since that lacks the processing step and throws all experiments on one big science pile with which you can unlock anything. If you want to unlock technologies purely based on the experience of the player, option 2b from the braindump linked above would be a good idea. The problem with 2b is that it deprives the player of the freedom they have, even more than other possible science systems ("no, you can't build that interstellar mothership, you have to achieve a velocity of mach 5 at sea level and plant a flag on Dres first"). I'm planning to support the stock tech tree and the Community Tech Tree and include a default config for everything else. I may look at supporting ETT after release (assuming this ever gets there). Thanks for the suggestions! I have been trying to reverse engineer the MicrowavePowerReceiver and MicrowavePowerTransmitter from your WarpPlugin.dll, but the lack of comments and documentation aren't really helping. Do you happen to know if those functions would be usable for resources other than electric charge (like data) @FreeThinker?
  21. True, I have been looking at the documentation yesterday but found no api for adding other science-like resources or editing the R&D lab at this level, so that probably means I need to write my own system from the ground up. I'm currently thinking about detecting science experiments and converting stored science to stored data, but editing R&D will be the hardest part. I'm not planning on different kinds of data to avoid having to carry all kinds of experiments around, only at the processing step multiply science types will be made. Maybe power requirements and data loss should be directly related to the total distance the data has to travel through the commnet to the lab, basically forcing labs or return capsules at remote locations.
  22. In order to make science less unrealistic and more challenging, I present to you the Science Elaboration System (original discussion thread here). This mod aims to make the road from experiment to parts more challenging, adding gameplay, without making things too grindy. A chart comparing the current science system to the Science Elaboration System (C)(TM)(SCIENCE!) Overview Planned features (subject to change): Multiple science types (at least one for every major category like aero, engines, science, structural, etc) Technology nodes and building upgrades need one or more of these science types to unlock (cost tweakable in settings) Science can be made by processing data in science labs (processing is slow and can be sped up by using high-tech labs or multiple cheaper labs) Processed science has to be transmitted or transported to the R&D lab (much like the current system but with more shiny buttons to press) Data is gained by science instruments, science multipliers are now data multipliers Lab efficiency: higher-tier labs need less data per science and work faster, but require far more power Lab bonus efficiency: research lab location (atmospheric planet or not, orbiting or not, etc) affects science production, relevant science types will get a production bonus or penalty Fast labs and large setups require serious power supplies (more than a single solar panel), perhaps detect mods like Near Future Electrical/Solar and Interstellar and adjust requirements Entry-level research lab with terrible efficiency. Support for science mods if feasible, include default configuration file Lots of options to disable or tweak parts you don't like Things I'd like your opinion on and may or may not be included (you can consider these more like statements rather than planned features, please react!): Data decays over time unless stored in a powered lab Data is a resource and can not be transmitted, but it can be moved in the way traditional science can (this requires you to bring a mobile research lab or a return rocket and will probably make things a lot harder, but maybe too hard. Maybe a inefficient autonomous lab is an idea?) Higher tier science types require lower tier science types as an ingredient Whatever feasible features you can come up with! Meta-research: faster and more efficient research for unlocked science labs Metadata: gain bonus data (unlock with research and strategies) NYFAQTWPBAFIIDNITN (Not Yet Frequently Asked Questions That Would Probably Be Asked Frequently If I Did Not Include This NYFAQTWPBAFIIDNITN) Q: Why is this WIP? A: This is the first major mod I'm making, and I need to figure out the Unity and KSP API, learn C# (I'm already familiar with C and have recompiled mods in the past), and likely reverse engineer other projects before I can start making my own stuff. As I am a physics university student, I barely have spare time, so this will take a while. Please do not expect (rapid) development. I am also still thinking about what I would like this mod to become and how that fits with your expectations. Q: Why do you want me to give you opinions? A: I value your input! You might see things from different perspectives and allow this mod to become better than the Science Elaboration System mod in the parallel universe where I didn't want your opinions! Q: Where will you be pushing code 'n stuff to? A: To this repo: https://github.com/asdfCYBER/Science-Elaboration-System. I tend to delay commits a lot though, so don't worry if there hasn't been a commit in a month. Q: Roadmap? A: https://github.com/asdfCYBER/Science-Elaboration-System/projects/1 Q: NOOOO DONT IMPLUMENT DIS STUPID FEETURE!!!(one)(eleven) A: ...that's not a question. I can't please everyone but I will try to add configuration settings so you can play the way you like. Downloads Heh, you can put a reminder on your calendar for next year or something.
  23. Interesting, when I get home I'll dust off one of the older ksp versions residing on my hard disk and take a look, but I think the contract system is a bit of a messy way to implement this (for instance, implementation with the achievements mod would be better imho). I'll just dump one of my internal brainstorms here (wall of text incoming): Science System Elaborations can be done in (as far as I can see) these different ways: 1. Experiments in different biomes/planets and/or situations give different science types that can be used in R&D 2a. Using parts in a certain way unlocks better parts of the same kind (like @5thHorseman's mod) 2b. Achievements unlock better parts related to the achievement 3. Experiments give data (pre-science), and process it in a variety of machines (or machines in different biomes) that need power or other resources 4. Artifacts can be found on planets and can be processed in machines for traditional science (edit: like the flying saucer stuff @DStaal linked above) I think option 3 is the most viable and fun way to elaborate science, but I'd like to hear your opinions on this. My reasoning behind this is that option 4 is too static in my opinion and is hard to implement unless Kerbal Konstructs is used, option 1 would give problems in early game but does give the most incentive to explore. Option 2 does not give this at all (2a) or very limited (2b). Option 3 however is the most flexible (both in terms of options and in terms of user playstyles) and feasable in early game. So I made a chart of option 3 in comparison with the current system: 1: Can be a normal resource (minimal modding required) or a replacement for science in the sense that it can be picked up by kerbals, transferred to other parts and transmitted. 2: I think using the existing science labs for this is the way to go, but at least an entry-type machine is needed for very early game as the first lab isn't available at start and probably shouldn't be. 3: Not useful to think about in this stage, but I'm planning to have at least science types for each major part category. While I was braindumping I thought about how building upgrade would fit very well in a research overhaul as in the real world technologies lead to more advanced buildings. I'm not sure whether this should cost raw science or if a technology should be required. but that can be explored at a later stage if this resonates with the community at all. I would like this mod to have at least the following features: Experiments give data instead of science Different technologies need different science types Different science types can be made by processing data in science labs at certain settings (only one type can be made at a time, if you want multiple you will need high-tech labs or many cheaper labs) Lab efficiency: higher-tier labs need less data per science, but require far more power Fast labs and large setups require serious power supplies (> a solar panel and a battery), perhaps detect mods like Near Future Electrical/Solar and Interstellar and adjust requirements Orbital labs have different research speeds from base labs, same thing for bases on atmospheric and non-atmospheric bodies Science multipliers are now data multipliers Mod-friendly and support for most existing mods if feasable (I remember a mod with larger labs that would fit perfectly, anything that introduces more science should have at least a default data config) As far as I can see (maybe an experienced modder can see more) these are the modding challenges: Changing science to data for all science producing things and the science multipliers, might have to define my own module for the latter if I use data as a resource Changing science to multiple science versions (probably placeholders at first as a proof of concept) in the techtree Changing labs from science enhancing to converting data+power to science (a converter config module is probably the easiest, but a gui with production sliders (10% this, 40% that, rest disabled to conserve power) is neater) Lab efficiencies should be trivial Lab location speed differences may need their own module too Changing technology requirements Changing gui and code to multiple science types instead of one (probably the most difficult part) Mod support (trivial with modulemanager) I'll probably make a development thread SOONTM for this because I like this idea more the more I think about it. Just don't expect quick development. EDIT 2: there is now a development thread where you can ask questions and suggest features:
×
×
  • Create New...