xEvilReeperx
Members-
Posts
894 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by xEvilReeperx
-
It's a fairly simple mod and there have been a number of requests to update it despite the stock functionality, so consider it added to my todo list now
-
Looks like it might be related to Win64 or something bad has happened to your save file. The UpgradeableFacilities ScenarioModule is throwing an exception when it loads which wrecks the remaining ScenarioModule load sequence, preventing ScienceAlert's ProfileManager from ever initializing. ScienceAlert ends up waiting for it indefinitely. Related section: [EXC 20:59:27.601] NullReferenceException: Object reference not set to an instance of an object ScenarioUpgradeableFacilities.getInitialState (.ConfigNode node) ScenarioUpgradeableFacilities.OnLoad (.ConfigNode node) ScenarioModule.Load (.ConfigNode node) ScenarioRunner.AddModule (.ConfigNode node) ProtoScenarioModule.Load (.ScenarioRunner host) ScenarioRunner+ .MoveNext () If this is caused by Win64 then using the 32 bit version should work. I'll add a timeout in the next version so ScienceAlert will stop silently failing when this happens
-
Yep. That's what the option does: instead of just telling you whenever you found science in a new biome (or in the case of the "display biome" option, which biome you're presently in), you need to have mapped that area of the planet to receive any alerts for biome-dependent reports. Reports that aren't biome sensitive aren't affected. If you have any ideas on improving it, let me know
-
It's possible. Does your log show anything suspicious? Any kind of exception with ScienceAlert in its stack trace would be bad. Also make sure your filter settings aren't preventing alerts; for instance, when you manually deployed did you get max value? If not and your filter is set to "unresearched", that would be another possible explanation
-
Perfect application for a coroutine: [RequireComponent(typeof(AudioSource))] public class AirlockPressure : PartModule { [KSPField(guiName = "Pressure", isPersistant = false, guiActiveEditor = true, guiActive = true, guiUnits = "kPsa")] private int Pressure = 100; public string mySoundFile = "Depressurise/PressureChange"; // notice [b]no extension[/b] void Start() { audio.clip = GameDatabase.Instance.GetAudioClip(mySoundFile); } [KSPEvent(guiActive = true, guiName = "Depressurise")] public void ActivateEvent() { ScreenMessages.PostScreenMessage("Depressurising", 5.0f, ScreenMessageStyle.UPPER_CENTER); Events["ActivateEvent"].active = false; StartCoroutine(Depressurize()); } private System.Collections.IEnumerator Depressurize() { audio.Play(); for (int i = Pressure - 1; i >= 0; i--) { Pressure = i; yield return new WaitForSeconds(2f); } } }
-
You can use GameEvents.onCrewOnEva or inspect launchID note: code lacks error checking [KSPAddon(KSPAddon.Startup.Flight, false)] public class EvaMothership : MonoBehaviour { void Start() { GameEvents.onCrewOnEva.Add(GoingEva); } void OnDestroy() { GameEvents.onCrewOnEva.Remove(GoingEva); } void GoingEva(GameEvents.FromToAction<Part, Part> parts) { print(parts.to.protoModuleCrew.First().name + " got out of " + parts.from.vessel.vesselName); } void OnGUI() { var v = FlightGlobals.ActiveVessel; // note: cache this in real code instead of being wasteful if (v != null) if (v.isEVA) { var mothership = FlightGlobals.Vessels.FirstOrDefault(vessel => { if (vessel.loaded) return vessel.rootPart.launchID == v.rootPart.launchID; else return vessel.protoVessel.protoPartSnapshots[vessel.protoVessel.rootIndex].launchID == v.rootPart.launchID; }); GUI.Label(new Rect(300f, 300f, 200f, 32f), "Mothership: " + (mothership != null ? mothership.vesselName : "<not found>")); } } }
-
Refresh Part menu to show new KSPField
xEvilReeperx replied to Diazo's topic in KSP1 C# Plugin Development Help and Support
As long as you're not running it every frame, you'll be okay. High part count ships shouldn't matter that much; it's a matter of searching ~18,000 items for a 1 part ship versus maybe ~18,900-~20,000 for a fairly large ship. The problem comes when somebody uses it in an Update(): 11.5ms is enough to take a game running at 50 fps down to 31 fps all for the sake of a little button -
Refresh Part menu to show new KSPField
xEvilReeperx replied to Diazo's topic in KSP1 C# Plugin Development Help and Support
Just to clarify: mine doesn't hook into a window method, it does what yours does (.displayDirty = true). It just avoids using the very slow FindObjectsOfType (11.5ms per call on my machine) method by keeping a static list of active windows. Might be the paranoid C++ programmer in me in this case though -
OnDraw is really MonoBehaviour.OnGUI The difference is that OnGUI might be called multiple times in a frame for each event while Update will be called once per frame. If you want to use Event.current, OnGUI is the right place (Event.current is otherwise null). Otherwise you'd need to use Input which, for this particular problem, is not as straightforward. I'd say you've got it right as-is Edit: sniped by Crzyrndm
-
GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); Simple, complete PartModule example: public class PartQuality : PartModule, IPartCostModifier { private float _multiplier = 1f; [UI_Label(controlEnabled = true)] public string Quality; [KSPEvent(guiName = "Quality ++", guiActive = false, guiActiveEditor = true)] public void QualityIncrease() { AdjustMultiplier(0.1f * UnityEngine.Random.Range(0.5f, 1f)); } [KSPEvent(guiName = "Quality --", guiActive = false, guiActiveEditor = true)] public void QualityDecrease() { AdjustMultiplier(-0.1f * UnityEngine.Random.Range(0.5f, 1f)); } private void AdjustMultiplier(float delta) { _multiplier = Mathf.Clamp(_multiplier + delta, 0f, 2f); if (_multiplier > 1.2f) Quality = "Great"; else if (_multiplier > 0.9f) Quality = "Average"; else if (_multiplier > 0.7f) Quality = "Not good"; else if (_multiplier > 0.4f) Quality = "Hazardous"; else Quality = "Fire QA team"; Quality = string.Format("{0:P2} - {1}", _multiplier, Quality); GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); } public float GetModuleCost(float defaultCost) { return _multiplier * defaultCost; } }
-
It does this already. Are you re-running the goo experiment before the first has completed its animation? ScienceAlert is looking at the module's state which doesn't change until that finishes. I'm confident I can fix it, just want to verify that this is your issue Do you mean you've already done it and you're getting an alert? Gravity test in sun high orbit is a valid experiment (at least in stock)
-
[0.25] Aligned/Formatted Currency Indicator
xEvilReeperx replied to xEvilReeperx's topic in KSP1 Mod Releases
I have it mostly updated. Squad did something new with the tumbler-style widget mask that's causing a portion of the UI to become invisible with that style. I wanted to fix that before releasing