Jump to content

Stavell

Members
  • Posts

    259
  • Joined

  • Last visited

Everything posted by Stavell

  1. Download link has been updated to VERSION 1.02 release. 6-11-2014 : Release VER 1.02 - IFILifesupportPlugin102.zip or GitHub IFI Life Support Releases or Project Page on curse Changes: Major Bug - if you had a kebal on eva and was focused on Vessel - very bad things would happen. from Kebal dieing with LS remaining upto the explosion of the current focused vessel. Code has been fixed and seems to work well again.
  2. Download link has been updated to VERSION 1.01 release. 6-10-2014 : Release VER 1.01 - IFILifesupportPlugin101.zip or GitHub IFI Life Support Releases or Project Page on curse Changes: Fixed bug where disabling life-support resource in Right Click menu would cause no LS to be used and system to stay active. Added LifeSupport to the structural fuselage as to have a way to add more LS to vessel. Added electric charge use to EVA. Tweaked resource use.
  3. Very nice been watching the progress for awhile now. Downloaded yesterday - and made 5 flights - this is my goto 3 man crew pod from now on. Great work.
  4. Download link has been updated to VERSION 0.005 beta release. 6-4-2014 : beta release VER 0.05 - IFILifesupportPlugin005.zip or at here GitHub IFI Life Support Releases Changes: Fixed Debug code. Added ElectricCharge to EVA. Made Headlamp on EVA use resources. Tweaked resource use. moved GameEvents declarations so not to duplicate calls during a event. My plan now is to test test test and make releases as bugs are fixed no more they once a week - unless the bug is a game killer.
  5. So has anyone messed with kerbalEVA and know about the headlamp. Trying to get the headlamp status but can't seem to get it to work. I found a gameobject headlamp and a bool lampOn Just can't figure out how to use them.....
  6. Tried on 2 different pc's it downloads the zip with ver 0.04 contents going to change zip name to include ver number.. ISP might be caching content name change should stop that if it's the case.
  7. Download link has been updated to VERSION 0.04 beta release. Changes: . Fixed EVA code so resources transfered correctly every time. . Updated my debug tracking code if you activate the Debug logging on any pod it is active on all IFI scripts until turned back off. and can be turned on or off on any controlled pod. In VER 0.05 I'm adding electric charge to EVA and charge usage if you have the headlamp on.
  8. I currently use edited part.cfg RCS radial and tanks to carry extra life support. Just make a copy of the part.cfg and remane the part and change the "MonoPropellant" to "LifeSupport" and ya have a extra LS storage.. I plan to have parts in the near future. the current alt click method of fuel transfer works for Life support too. Seems the Button commands are linked to if the craft is controlled. so the debug button only shows up if vessel is controlled (1 or more kerbals or a probe core on vessel)
  9. Download link has been updated to VERSION 0.03 beta release. Changes: . Fixed EVA code so partModule stays on Kerbal even if save/load game while on eva. . Fixed bug where Kerbal leaving pod would take double the resources and lose half. . Changed from using a config file to store persistence VAR's on vessels to VARs that are stored in persistence file . tweaked ElectricCharge consumption rate. .BUG #2 GitHub . Kerbal on EVA does not die when resources run out (FIXED)
  10. is that on all pods or a certain one? Seems to be working now (could have made a change already). Plan on releasing a new build Monday.
  11. Ok trying to figure out how when using PartLoader.getPartInfoByName to add your partmodules to stock parts in your plugin. you keep it from throwing NULL Reference exceptions on execution. I can get it to work by wrapping it in a try block - even though partmodule is loaded onto the part. the log still shows the code threw a exception. even trying some of your code in my project does not get rid of the exception. try { PartLoader.getPartInfoByName("kerbalEVA").partPrefab.AddModule("IFILifeSupportEVA"); Debug.Log(" IFI Preload ++Module++ Module Added"); } catch (Exception ex) { Debug.Log(" IFI Exception +addmodule+ " + ex.Message); } or this AvailablePart EVAmod = PartLoader.getPartInfoByName("kerbalEVA"); try { EVAmod.partPrefab.AddModule("IFILifeSupportEVA"); } catch (Exception ex) { Debug.Log(" IFI Exception +addmodule+ " + ex.Message); } Just figured since you mod works so well and dosen't throw exceptions you might be able to help Thank you.
  12. You are correct due to that parsing int spam in log I missed a null reference exception line. After using try and catch I found the problem. Which was simple as I surmised. Since a Kerbal on eva is a 1 part vessel. I did not need the for-next loop looking for multiple parts. which was copied from my code running on a pod for resource counts. removing that loop fixed the null reference.
  13. Released updated Plugin - I made a small change before initial release and it broke the EVA Resources. opps Fixed VER 0.02 uploaded.
  14. Still testing this but I guess I was a little vague atm only the ElectricCharge used by the LS System is consumed when not focused. So lights, SAS and other things do not ( and I not sure how I'm tracking solar or generator power ATM or if it will make a impact on the LS system. If I get it working with all I would happily separate code out.
  15. Added Beta release VER 0.01 of Plugin to main post. Added Source code link to GitHub.
  16. Each unit is 1 day for 1 kerbal (roughly as some kerbals seem to eat more when in a group ) ) I added the days remaining tag so you could see how long a vessel had with current crew on-board - it changes dynamically when you remove add crew to vessel( no matter if it is on a different part.) EDIT - I'm setting up a github repository now... the code works -- I just need to get the debug logging code under control so it doesn't spam the log files in release mode. and I'm adding a button to turn it back on on a pod - so if someone has a problem they can have it log so I can find the problem.
  17. Actually if you go on EVA from a single crew pod it would not be active since the kerbal is not in the pod. Really only means the electric charge would not be used. But for most purposes in testing it stays active the whole flight especially with multi crew capable pods
  18. Now I'm not a modeler so what I'd like to ask help with is the creation and design of the following models: 1.25 m diameter Life support Can/tank 2.5 m diameter Life support Can/tank and 2 different sized radial attached can/tanks. Thank You for looking
  19. RELEASED!! We have moved the Thread to the Add-on Release area of the forums this post is for achive purpuses only. Goto http://forum.kerbalspaceprogram.com/threads/92011-Part-Release-25-0-Interstellar-Flight-Inc-Kerbal-Life-Support-Mod for support and current release. WIP - IFI Life Support. 8-26-2014 : Release VER 1.08 - IFILifesupportPlugin108.zip or Project Page on curse Source available at GitHub Released Under GPL3 License. Bugs can be submitted in this thread or at GitHub. If plugin seems not to be working right you can enable Debugging log entries via the right click menu on any pod (recommended to be left off unless you are experiencing problems as it does spam the log file in this early release. I know that there are a few Life support mods in development. They are too intense for my tastes. SO I designed my own. GOALS with my plugin: Track life support use even when ships are not loaded into scene. Realistic Life Support values on use and weight. based on information from [URL="http://en.wikipedia.org/wiki/Life_support_system"]Life Support Systems at wiki.org[/URL] Low overhead and easy playability with KSP. Life support tracked and used on EVA. Use only one new resource to simulate LS use. Use Electric Charge while Life support is active. Currently the MOD is working with no game breaking bugs found yet. GPL3 License. Crew Pod Life Support: Eva Life Support: Current Working Features Kerbal going on Eva takes Life Support from pod/vessel. Boarding a pod returns unused Life support to pod/vessel. Running out of Life Support or Electric can kill crew. if outside kerbin atmosphere. Life Support and Electric is used even if not active vessel (electric code could be problem on unfocused vessel with solar panels(testing)). All stock pods have LS Resource and plugin installed using ModuleManager. Electric Charge on EVA - Used by Lifesupport system and if HeadLamp is on. To Do List: Test and Debug Code problems.( IN PROGRESS) Optimize working Code.(ALWAYS WORKING ON) Create Custom Parts for additional Life support storage.( First Part Added) Create ModuleManager file for third-party command pods. Add ElectricCharge to EVA(DONE) Add code to track time based on menu setting (Kerbin Day / Earth Day)(DONE) Add Science experiments based on LifeSupport use (In development) Plugin Operation Info Currently there are several Status LS system can be in: Inactive - No demand for LS and no resources consumed. Life Support tag for days / hours of LS remaining will read 0. Active - Demand for LS and resources consumed. Life Support tag for days / hours of LS remaining will read how long LS will last for whole vessel. Visor - Kerbal on EVA breathing outside air decreased Resource consumption . Life Support tag for days / hours of LS remaining will read how much LS remains once active again (fixing). Intake Air - Pod using air intakes to provide O2 to crew - decreased Resource consumption.Life Support tag for days / hours of LS remaining will read how much LS remains once active again CAUTION - Less than 2 days pod or 1 hour EVA of LS remaining. Life Support tag for days / hours of LS remaining will read how long LS will last for whole vessel. Warning! - LS or Electric Charge at 0. Kerbals will start dieing if immediate action not taken. Life Support tag for days / hours of LS remaining will read 0. Each unit of LifeSupport should provide 1 Kerbin Day of Life support for 1 Kerbal. Mod uses the time as set in settings menu so it will track 6 or 24 hour days depending on setting in main menu. Parts for system (Radial tanks has already been added - stacked tank is close to release) (Both will continued to be re-textured as time goes on)
  20. My EVA Code using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; using KSP.IO; using KSP; namespace IFILifeSupport { public class IFILifeSupportEVA : PartModule // Life Support Consumption Module for EVA { private PluginConfiguration cfg = PluginConfiguration.CreateForType<IFILifeSupportEVA>(); public bool initialized = false; private static double Rate_Per_Kerbal = 0.000046; // Per Second use based on Life support requirements from Life Support wiki private int IFITimer; // Used to track LS use on inactive eva'd kerbals private float IFICWLS = 5; // Used to track Kerbal death chance after life support runs out. // Right Click Info display for Part [KSPField(guiActive = true, guiName = "Life Support Pack Status", isPersistant = false)] public string lifeSupportStatus; [KSPField(guiActive = true, guiName = "Life Support ", guiUnits = " HOURS ", guiFormat = "F0", isPersistant = false)] public int displayRate; public override void OnLoad(ConfigNode node) { IFIDBLog(" OnLoad(): OnLoad Fired"); //if (initialized == true) //{ // cfg.load(); // Vessel active = part.vessel; // if (active) // { // string IFICfgLabel = "IFITimer" + active.id; // IFITimer = cfg.GetValue<int>(IFICfgLabel); // } //} } public override void OnSave(ConfigNode node) { base.OnSave(node); IFIDBLog(" OnSave() Fired"); Vessel active = part.vessel; if (active) { cfg.load(); IFITimer = Convert.ToInt32(Planetarium.fetch.time); IFIDBLog(" Init Eva Values"); string IFICfgLabel = "IFITimer" + active.id; cfg[IFICfgLabel] = IFITimer; IFICfgLabel = "IFIEVAPACK" + active.id; double EvaLSRem = IFIGetAllResources("LifeSupport"); cfg[IFICfgLabel] = EvaLSRem; IFICfgLabel = "IFIBool" + active.id; cfg[IFICfgLabel] = 1; cfg.save(); } } public override void OnInactive() // Called when part is destroyed { IFIDBLog(" EVA Inactive Fired"); base.OnInactive(); } public override void OnUpdate() { base.OnUpdate(); Vessel active = part.vessel; if (active.isEVA == true) { IFIDBLog(" EVA ACCESSED"); lifeSupportStatus = "Active"; displayRate = 4; if (!initialized) Initialize(); int TTtest = Convert.ToInt32(Planetarium.fetch.time) - IFITimer; double ResourceAval = IFIGetAllResources("LifeSupport"); displayRate = Convert.ToInt16(((ResourceAval / Rate_Per_Kerbal) / 60 / 60)); if (displayRate > 0 && displayRate < 1) { lifeSupportStatus = "CAUTION "; } else if (displayRate <= 0) { lifeSupportStatus = "Warning!"; } if (TTtest >= 180) // only consume resources every 3 mins try to control lag { double resourceRequest; double resourceReturn; resourceRequest = Rate_Per_Kerbal * TTtest;//* TimeWarp.deltaTime; not sure if timewarp is needed but need to check. resourceReturn = this.part.RequestResource("LifeSupport", resourceRequest); IFIDBLog(" resource Avalible == " + Convert.ToString(ResourceAval)); IFIDBLog(" LS Resource Return == " + Convert.ToString(resourceReturn)); if (ResourceAval < resourceRequest) { resourceRequest = ResourceAval; resourceReturn = this.part.RequestResource("LifeSupport", resourceRequest); } if (resourceReturn <= 0 ) { IFIDBLog(" Crew has no LS Remaining "); TimeWarp.SetRate(0, true); CrewTest(); // Check for crew death } IFITimer = Convert.ToInt32(Planetarium.fetch.time); if (active) { cfg.load(); IFITimer = Convert.ToInt32(Planetarium.fetch.time); IFIDBLog(" Init Eva Values"); string IFICfgLabel = "IFITimer" + active.id; cfg[IFICfgLabel] = IFITimer; IFICfgLabel = "IFIEVAPACK" + active.id; double EvaLSRem = IFIGetAllResources("LifeSupport"); cfg[IFICfgLabel] = EvaLSRem; IFICfgLabel = "IFIBool" + active.id; cfg[IFICfgLabel] = 1; cfg.save(); } } } } private void Initialize() { double EvaLSRem; cfg.load(); Vessel active = part.vessel; GameEvents.onCrewBoardVessel.Add(OnCrewBoardVessel); // resourceReturn = this.part.resor ("LifeSupport", resourceRequest); string IFICfgLabel = "IFIBool" + active.id; int IFIBool = cfg.GetValue<int>(IFICfgLabel); if (IFIBool == 1) { IFICfgLabel = "IFITimer" + active.id; IFITimer = cfg.GetValue<int>(IFICfgLabel); IFICfgLabel = "IFIEVAPACK" + active.id; EvaLSRem = cfg.GetValue<double>(IFICfgLabel); } else { IFITimer = Convert.ToInt32(Planetarium.fetch.time); IFIDBLog(" Init Eva Values"); IFICfgLabel = "IFITimer" + active.id; cfg[IFICfgLabel] = IFITimer; IFICfgLabel = "IFIEVAPACK" + active.id; cfg[IFICfgLabel] = Rate_Per_Kerbal * 60 * 60 * 4; EvaLSRem = Rate_Per_Kerbal * 60 * 60 * 4; IFICfgLabel = "IFIBool" + active.id; cfg[IFICfgLabel] = 1; cfg.save(); } ConfigNode node = new ConfigNode("RESOURCE"); node.AddValue("name", "LifeSupport"); node.AddValue("maxAmount", Rate_Per_Kerbal * 60 * 60 * 4); node.AddValue("amount", EvaLSRem); part.AddResource(node); initialized = true; IFIDBLog(" Init(): OnInit Fired"); } private void CrewTest() { float rand; ProtoCrewMember iCrew; for (int i = 0; i < part.protoModuleCrew.Count; i++) { rand = UnityEngine.Random.Range(0.0f, 100.0f); if (IFICWLS > rand) { iCrew = part.protoModuleCrew[i]; part.RemoveCrewmember(iCrew);// Remove crew from part iCrew.Die();// Kill crew after removal or death will reset to active. IFIDBLog("Kerbal Killed due to no LS - " + iCrew.name); } } IFICWLS += 5; // Increase chance of death on next check. } private double IFIGetAllResources(string IFIResource) { double IFIResourceAmt = 0.0; Vessel active = part.vessel; foreach (Part p in active.parts) { foreach (PartResource pr in p.Resources) { if (pr.resourceName.Equals(IFIResource)) { IFIResourceAmt += pr.amount; break; } } } return IFIResourceAmt; } private void OnCrewBoardVessel(GameEvents.FromToAction<Part, Part> action) { double IFIResourceAmt = 0.0; foreach (Part p in action.from.vessel.parts) { foreach (PartResource pr in p.Resources) { if (pr.resourceName.Equals("LifeSupport")) { IFIResourceAmt += pr.amount; break; } } } double resourceReturn = action.to.RequestResource("LifeSupport", 0.0 - IFIResourceAmt); Debug.Log("IFI Life Support Message: EVA - Ended - " + action.from.name + " Boarded Vessel"); } private void IFIDBLog(string IMessage) // Debug Strings to Log File { #if DEBUG Debug.Log("IFI Life Support Message: EVA -" + IMessage); #endif } } } When this code block is not commented out. if I send a Kerbal on eva then try and reboard. he stays on the ladder and a copy of him shows back up in the pod. Not sure what I'm missing but I'm sure it's simple. private void OnCrewBoardVessel(GameEvents.FromToAction<Part, Part> action) { double IFIResourceAmt = 0.0; foreach (Part p in action.from.vessel.parts) { foreach (PartResource pr in p.Resources) { if (pr.resourceName.Equals("LifeSupport")) { IFIResourceAmt += pr.amount; break; } } } double resourceReturn = action.to.RequestResource("LifeSupport", 0.0 - IFIResourceAmt); Debug.Log("IFI Life Support Message: EVA - Ended - " + action.from.name + " Boarded Vessel"); }
  21. Thanks sarbian. Actually the link in the sticky gave me a 404 error. Just what I was looking for.
  22. I'm looking for a complete list of commands variables available for plugin programming. did a lot of searches and all seem to always come back to Community_API_Documentation which is far from complete or up-to date. I want more info on KSPField (which I only found out about from seeing it in another projects source code) Thanks
  23. Was using warp helper. had 3days to a intercept. I set 3d in the warp helper and executed it. it warped for 12 days seems mechjeb has 24 hour days when kerbal is using 6 hour days.
×
×
  • Create New...