ExtremeTrader

Members
  • Content Count

    214
  • Joined

  • Last visited

Community Reputation

55 Excellent

About ExtremeTrader

  • Rank
    Spacecraft Engineer

Recent Profile Visitors

1,173 profile views
  1. 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
  2. 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
  3. 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?)
  4. 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!
  5. 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
  6. 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)
  7. I'm checking at OnStart which I thought came after OnLoad, but I could be wrong about that
  8. 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.
  9. 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.
  10. 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).
  11. 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?
  12. 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.
  13. 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) Produced 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 absolutely horrible 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) NYFAQTWPBAFIIDNITN (Not Yet Frequently Asked Questions That Would Probably Be Asked Frequently If I Did Not Include This NYFAQTWPBAFIIDNITN) Q: Why is this pre-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 (or at least not before July). I am also still thinking about what I would like this mod to become and how that fits with your expectations. I came up with the term pre-WIP to describe the current state of this project accurately. 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: GitHub or GitLab, probably. I'll put a link up when there is actual work in progress instead of this weird pre-WIP status nobody uses. Q: Roadmap? A: I may make one when this gets to the WIP phase. 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.
  14. 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:
  15. Absolutely true, I'll look at it in a month or two when I have some more spare time.