linuxgurugamer

Members
  • Content count

    11,889
  • Joined

  • Last visited

Community Reputation

8,844 Excellent

About linuxgurugamer

Profile Information

  • Location At SpaceTux Industries HQ

Recent Profile Visitors

28,472 profile views
  1. linuxgurugamer

    [1.4.1] Decouple with Control v1.2

    Let me know when you've released it. This isn't something that I use, so I won't really be aware of the release.
  2. linuxgurugamer

    KSP doesn't open

    Ummm, would be helpful to know your OS. I know that on a Mac, I had a similar problem until I rebooted, turned out some OS updates were waiting to be fully installed and were causing the game to fail. Other than that, look in my sig for a link to a post which describes where the log files are and how to make them available. Regarding Steam, I'd suggest deleting KSP, then going into the folder where Steam installs KSP and deleting the entire directory, then reinstall
  3. linuxgurugamer

    [1.4.1] Decouple with Control v1.2

    I've submitted a PR to add a module so that StateFunding won't consider these parts as vessels. Until @cmheisel merges and releases it, you can get it from here: https://github.com/linuxgurugamer/ksp-decouple-with-control License is same as original (MIT) Once it is merged and released, i'll delete my repo
  4. linuxgurugamer

    [1.4.x] State Funding Continued - MM added as dependency

    New release, 0.6.16 Added recording of completed and failed contracts Added new field to indicate whether part is a disposable part, if it is, does not get counted in the destroyed vessels list Added MM script to add new module to all command parts Added code to remove callbacks when leaving scene or reverting Note: The mod now REQUIRES ModuleManager
  5. linuxgurugamer

    [1.4.1] Decouple with Control v1.2

    It would have to be a patch to his mod. It's a MM script, so I may just fork his repo, make the change and push it back to him for inclusion. @cmheisel Would you be willing to accept a PR with these changes?
  6. I've been doing some testing, and have been getting inconsistent results. I've created simple vessels (command pod + srb), launched them and let them crash, but the onCrash event isn't triggering. So, two questions: What triggers the onCrash event? Is there another way to identify when a vessel has been destroyed? Thanks in advance
  7. linuxgurugamer

    [1.4.1+] Dang It! Continued

    Add to github issue list, pls
  8. linuxgurugamer

    [1.4.1] Decouple with Control v1.2

    Actually, there IS another way which I'm implementing. I'm adding a module to StateFunding which is used to indicate whether the command part is disposable or not. It's being added to all parts via a MM script. The default is that parts are NOT disposable. This mod could easily add my module (or I could) so that all the parts modified by this are listed as disposable.
  9. Here you go. What this is doing is coordinating a hidden resource with a visible resource, so that when one is changed, the other will be updated. using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace IFILifeSupport { [KSPAddon(KSPAddon.Startup.Flight, false)] public class AddTransferListener : MonoBehaviour { public static EventData<UIPartActionResourceTransfer> onTransferSpawn = new EventData<UIPartActionResourceTransfer>("onTransferSpawn"); UIPartActionResourceTransfer t; private void Start() { Log.Info("Transfer.Start"); onTransferSpawn.Add(OnTransferSpawned); //This probably only needs to be attached once, but using AddOrGetComponent insures that you don't //end up with multiple copies of your listener UIPartActionController.Instance.resourceTransferItemPrefab.gameObject.AddOrGetComponent<TransferListener>(); } void OnDestroy() { Log.Info("Transfer.OnDestroy"); } void DisplayTransferInfo(UIPartActionResourceTransfer t, bool descend = false) { #if false Log.Info("\r\n\r\n DisplayTransferInfo, descend: " + descend); Log.Info("Transfer.OnTransferSpawned, transfer.lastUT: " + t.lastUT); Part p = t.Part; PartResource r = t.Resource; List<UIPartActionResourceTransfer> targets = t.Targets; if (t.Part != null) Log.Info("transfer.Part: " + t.Part.partInfo.title); if (t.Resource != null) Log.Info("Transfer.Resource: " + t.Resource.resourceName); Log.Info("Transfer.state: " + t.state); if (t.Part != null) { double m = r.maxAmount; Log.Info("Transfer rate: " + m + " per second"); } foreach (UIPartActionResourceTransfer t1 in targets) { Log.Info("t: " + t1); Log.Info("Transfer.Destination transfer.Part: " + t1.Part.partInfo.title); Log.Info("Transfer.Destination transfer.Resource: " + t1.Resource.resourceName); if (descend) DisplayTransferInfo(t1); } #endif } Part source; double maxRequested; string hiddenResource; bool transferInProgress = false; double lastUT; void GetTransferValues(UIPartActionResourceTransfer transfer) { maxRequested = 0; if (t.state == UIPartActionResourceTransfer.FlowState.In) { var r = t.Part.Resources[hiddenResource]; maxRequested += r.maxAmount; } if (t.state == UIPartActionResourceTransfer.FlowState.Out) source = t.Part; List<UIPartActionResourceTransfer> targets = t.Targets; foreach (UIPartActionResourceTransfer t1 in targets) { if (t1.state == UIPartActionResourceTransfer.FlowState.In) { var r = t1.Part.Resources[hiddenResource]; maxRequested += r.maxAmount; } if (t1.state == UIPartActionResourceTransfer.FlowState.Out) source = t1.Part; } lastUT = transfer.lastUT; maxRequested = maxRequested / 20; Log.Info("GetTransferValues, maxRequested/sec: " + maxRequested); Log.Info("GetTransferValues, source: " + source.partInfo.title); } private void OnTransferSpawned(UIPartActionResourceTransfer transfer) { Log.Info("OnTransferSpawned"); t = transfer; DisplayTransferInfo(t, true); //Add your own listeners to the in, out, and stop buttons transfer.flowInBtn.onClick.AddListener(OnInClick); transfer.flowOutBtn.onClick.AddListener(OnOutClick); transfer.flowStopBtn.onClick.AddListener(OnStopClick); } bool LifeSupportResource(string resource) { var b = IFI_Resources.DISPLAY_RESOURCES.Contains(resource); Log.Info("Transfer.LifesupportResource, res: " + resource); if (b) { hiddenResource = IFI_Resources.RESOURCES[IFI_Resources.DISPLAY_RESOURCES.IndexOf(resource)]; Log.Info("Transfer.LifeSupportResource, hiddenResource: " + hiddenResource); GetTransferValues(t); } return b; } private void OnInClick() { Log.Info("Transfer.OnInClick, transfer.lastUT: " + t.lastUT); DisplayTransferInfo(t, true); transferInProgress = LifeSupportResource(t.Resource.resourceName); } private void OnStopClick() { Log.Info("Transfer.OnStopClick, transfer.lastUT: " + t.lastUT); DisplayTransferInfo(t, true); transferInProgress = false; t.FlowStop(); } private void OnOutClick() { Log.Info("Transfer.OnOutClick, transfer.lastUT: " + t.lastUT); DisplayTransferInfo(t, true); transferInProgress = LifeSupportResource(t.Resource.resourceName); } void FixedUpdate() { if (transferInProgress && t != null && t.Resource != null && lastUT != t.lastUT && t.state != UIPartActionResourceTransfer.FlowState.None) { double timeSlice = t.lastUT - lastUT; Log.Info("timeSlice: " + timeSlice); double requestAmt = maxRequested * timeSlice; double totalTransferred = 0; // Get the available resources for transfer double availResForTransfer = source.RequestResource(hiddenResource, requestAmt, ResourceFlowMode.NO_FLOW); // now transfer the resources into the new parts. if (t.state == UIPartActionResourceTransfer.FlowState.In) { double percentageOfTotal = t.Part.Resources[hiddenResource].maxAmount / 20f * timeSlice / requestAmt; var amtToTransfer = -1 * availResForTransfer * percentageOfTotal; var transferredAmt = t.Part.RequestResource(hiddenResource, amtToTransfer, ResourceFlowMode.NO_FLOW); totalTransferred += transferredAmt; //Log.Info("Transfer 1, after: Part: " + t.Part.partInfo.title + ", amount: " + t.Part.Resources[hiddenResource].amount + ", transferred: " + totalTransferred); } List<UIPartActionResourceTransfer> targets = t.Targets; foreach (UIPartActionResourceTransfer t1 in targets) { if (t1.state == UIPartActionResourceTransfer.FlowState.In) { double percentageOfTotal = t1.Part.Resources[hiddenResource].maxAmount / 20f * timeSlice / requestAmt; var amtToTransfer = -1 * availResForTransfer * percentageOfTotal; var beforeAmt = t1.Part.Resources[hiddenResource].amount; Log.Info("Transfer 2, before, amount: " + t1.Part.Resources[hiddenResource].amount + ", transferred: " + totalTransferred); var transferredAmt = t1.Part.RequestResource(hiddenResource, amtToTransfer, ResourceFlowMode.NO_FLOW); totalTransferred += transferredAmt; //Log.Info("Transfer 2, after: amount: " + t1.Part.Resources[hiddenResource].amount + ", transferred: " + totalTransferred); var afterAmt = t1.Part.Resources[hiddenResource].amount; Log.Info("Transfer 2, after: amount: " + afterAmt + ", Logged transfer amt: " + transferredAmt + ", actual diff (after - before): " + (afterAmt - beforeAmt)); IFI_Resources.UpdatePartInfo(t1.Part); } } // Now return the unused resources Log.Info("Transfer Returning, availResources: " + availResForTransfer + ", total transferred: " + totalTransferred + ", returning: " + (availResForTransfer + totalTransferred).ToString()); Log.Info("Transfer, before returning avail resources, amount: " + source.Resources[hiddenResource].amount); source.RequestResource(hiddenResource, -1 * (availResForTransfer + totalTransferred), ResourceFlowMode.NO_FLOW); Log.Info("Transfer, after returning avail resources, amount: " + source.Resources[hiddenResource].amount); lastUT = t.lastUT; if (totalTransferred == 0) OnStopClick(); IFI_Resources.UpdatePartInfo(t.Part); foreach (UIPartActionResourceTransfer t1 in targets) IFI_Resources.UpdatePartInfo(t1.Part); Log.Info("Transfer --------------------------------------------------------------------------------------"); } else if (transferInProgress) { if (t != null) { if (t.Resource == null) Log.Info("Transfer t.Resource is null"); if (lastUT == t.lastUT) Log.Info("Transfer lastUT unchanged, Planetarium.GetUniversalTime: " + Planetarium.GetUniversalTime()); if (t.state == UIPartActionResourceTransfer.FlowState.None) Log.Info("Transfer t.state == UIPartActionResourceTransfer.FlowState.None"); } else Log.Info("t is null"); Log.Info("Transfer --------------------------------------------------------------------------------------"); } } } public class TransferListener : MonoBehaviour { private void Awake() { AddTransferListener.onTransferSpawn.Fire(gameObject.GetComponentInParent<UIPartActionResourceTransfer>()); } } }
  10. linuxgurugamer

    [1.4.x] State Funding Continued - MM added as dependency

    How about a way to flag a probecore as expendable? I'm not sure yet the best way to do this, but it should be doable. I can think of at least two ways to do it
  11. linuxgurugamer

    [1.4.x] State Funding Continued - MM added as dependency

    Just an FYI, the mod currently isn't recording anything about the contracts, I'll have to fix that
  12. linuxgurugamer

    [1.4.x] State Funding Continued - MM added as dependency

    First, the craft which kept remembering the lost missions, was that launched BEFORE or AFTER you installed the mod? Second, the contracts, were they accepted before or after you installed the mod?
  13. Ok, I found the problem. The name changes are important, thanks. But the NEEDS can stay as is, since the directory/folder the EPL mod is in has not been renamed. From the MM handbook: New release, 0.1.15.2 Updated EPL patches to reflect the new names for the workshop and convertor Thanks to @Critter79606 for pointing out that EPL had the names changed
  14. Log file has to be there. What OS are you running, and where did you look?
  15. Mind telling me what you are referring to? Filename would be helpful