![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_default_photo.png)
xEvilReeperx
Members-
Posts
894 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by xEvilReeperx
-
I've seen this before. It's a stock bug. While ScienceAlert does mess with the antenna, it's only to pass data to them (it actually creates a fake imaginary antenna to do this). Data is lost because ScienceAlert's magic transmitter is holding the queued data and waiting until stock finishes. If none of the stock antenna ever un-break and then you do something to change the game's state (like switch to an unloaded vessel or exit the scene), the data in queue is lost since ScienceAlert had no way to keep it at the time I wrote it. With per-vessel profiles I now can add this in a clean way, so I'll go ahead and do that for next version. If you can come up with a save that can consistently lock up the stock antennas, I'll have a look at fixing that too
-
You've always (well, that I've been here) been able to subclass Part but as far as I can tell the PARTDATA segment is new. If you were writing a Part subclass before, you'd also need a PartModule to deal with storing persistent data. I suspect PARTDATA was added to support CompoundPart... And yeah, you definitely don't want to replace every part instance with your own Custom parts only
-
Good find! Looks like it's a way for us to store persistent per-part data for custom (or config-modified) parts that doesn't necessarily require adding a PartModule. You subclass Part to use it: class PersistentPart : Part { public override void OnSave(ConfigNode node) { base.OnSave(node); node.AddValue("ThisValue", "That I saved"); } } PART { name = probeCoreSphereTest module = PersistentPart ... } [snip] attm = 0 modCost = 0 modMass = 0 modSize = (0.0, 0.0, 0.0) EVENTS { } ACTIONS { } PARTDATA { ThisValue = That I saved } [/snip] Data is also saved with .crafts from the editor (I checked) so that could be quite handy
-
MonoBehaviour has no method called OnSave(ConfigNode) for you to override. If you're trying to save things into the persistent file, the best way is to inherit from ScenarioModule instead of MonoBehaviour and replace the KSPAddon attribute with a KSPScenario attribute that specifies which scenes your scenario should run in. Then you can override OnLoad/OnSave to handle your persistent data.
-
There's a GameEvent that gets fired when the dialog appears: class YourAddon : MonoBehaviour { private void Start() { GameEvents.onVesselRecoveryProcessing.Add(RecoveryProcessingCallback); } private void OnDestroy() { GameEvents.onVesselRecoveryProcessing.Remove(RecoveryProcessingCallback); } void RecoveryProcessingCallback(ProtoVessel pv, MissionRecoveryDialog dlg, float recovery) { // access dlg here } }
-
Well, if it's a duplicate experiment id then all saves will be affected. I keep meaning to add a check against this kind of error since it's cropped up a few times in the past. There are still some inconsistencies in your log, though. I see exceptions being thrown before ScienceAlert has begun initializing, and then it somehow manages to get set up when I would expect a KeyNotFound to crash it almost immediately. Does everything in your save work without ScienceAlert installed? I would expect you to have some problems with running experiments in particular
-
It should. I wasn't able to reproduce your result with SA 1.8.4. Did you activate the surface sample through the ScienceAlert UI or through the kerbal? The exception you're seeing comes from having duplicate science experiment ids. Something really funny is going on in your save. ScienceAlert should fail almost immediately with an exception if that is in your log. Can I see the whole thing?
-
Hmmm ... I can't think of why that would be. Any chance you have a save that can replicate that? I'll add some more debugging options to the next version to help track things like this down. Edit: Are there any exceptions in the log (Alt+F2)? If something broke while exiting the vessel, that could explain this behaviour. If it happens again, try switching to the vessel and then back to the Kerbal. If that makes it start working again, get me the output_log and it should be easy to track down
-
Sorry about that. Fixed in 1.8.4
- 1,632 replies
-
- part count
- storage
-
(and 1 more)
Tagged with:
-
You needn't go quite that far... The info is still there to be hunted down: // RepairAvailablePartUrl(PartLoader.getPartInfoByName("mk1pod")); // Log.Normal("mk1pod url: " + PartLoader.getPartInfoByName("mk1pod").partUrl); // // mk1pod url: Squad/Parts/Command/mk1pod/mk1Pod/mk1pod // // note: not an error; there can be multiple parts defined in a config private void RepairAvailablePartUrl(AvailablePart ap) { var url = GameDatabase.Instance.GetConfigs("PART") .FirstOrDefault(u => u.name.Replace('_', '.') == ap.name); if (url == null) throw new System.IO.FileNotFoundException(); // repair missing name in config if desired if (!url.config.HasValue("name")) url.config.AddValue("name", url.name); ap.partUrl = url.url; } private string GetPartPath(AvailablePart ap) { if (string.IsNullOrEmpty(ap.partUrl)) RepairAvailablePartUrl(ap); var fileid = new UrlDir.UrlIdentifier(ap.partUrl); // note: we ignore the last bit of the url because it refers to the specific entry // in a config file. All we care about is the path to that file return fileid.urlSplit.Take(fileid.urlDepth).Aggregate((s1, s2) => s1 + "/" + s2); }
-
Applying gravity to a spawned object
xEvilReeperx replied to lo-fi's topic in KSP1 C# Plugin Development Help and Support
Are these temporary ground objects like scatter? If so (and so their ultimate position in world space doesn't matter like, say, a KSC building would) then you're complicating things KSP seems to adjust gravity properly and in the right direction for the current reference frame so you needn't do anything special: You'll note in my code that I didn't do anything to make the coins fall: I just create them, set an initial rotation and then let gravity do its work [KSPAddon(KSPAddon.Startup.Flight, false)] class GoldenShower : MonoBehaviour { private Rect _windowRect = new Rect(400, 400, 128f, 1f); private GameObject _coinPrefab; private const int ShowerCoinCount = 800; void Start() { _coinPrefab = GameObject.CreatePrimitive(PrimitiveType.Sphere); // note: comes with sphere collider _coinPrefab.transform.localScale = new Vector3(0.04f, 0.01f, 0.04f); // KSP/Diffuse apparently needs a texture, can't just set a color like regular Diffuse shader var goldTexture = new Texture2D(1, 1); goldTexture.SetPixels32(new Color32[] {XKCDColors.GoldenYellow}); goldTexture.Apply(); _coinPrefab.renderer.material = new Material(Shader.Find("KSP/Diffuse")) { mainTexture = goldTexture }; var rb = _coinPrefab.AddComponent<Rigidbody>(); rb.mass = 0.01f; rb.angularDrag = 5f; _coinPrefab.collider.material = new PhysicMaterial { frictionCombine = PhysicMaterialCombine.Maximum, bounceCombine = PhysicMaterialCombine.Minimum, bounciness = 0.45f, dynamicFriction = 0.05f, staticFriction = 0.25f }; _coinPrefab.SetActive(false); } void OnGUI() { _windowRect = KSPUtil.ClampRectToScreen(GUILayout.Window(123, _windowRect, DrawWindow, "Menu")); } private void DrawWindow(int winid) { GUILayout.BeginVertical(); GUILayout.Label(string.Format("Gravity: {0}", Physics.gravity.FString())); GUILayout.Label(string.Format("Accel: {0}", Physics.gravity.magnitude)); if (GUILayout.Button("Increase monetary wealth?")) StartCoroutine(CoinShower()); GUILayout.EndVertical(); GUI.DragWindow(); } private float Random360() { return UnityEngine.Random.Range(0f, 360f); } private System.Collections.IEnumerator CoinShower() { print("Let there be wealth!"); var vessel = FlightGlobals.ActiveVessel; float start = Time.realtimeSinceStartup; for (int i = 0; i < ShowerCoinCount; ++i) { var spawn = vessel.GetWorldPos3D() + FlightGlobals.upAxis * 20f; var coin = (GameObject)Instantiate(_coinPrefab, spawn + UnityEngine.Random.insideUnitSphere * 2f, Quaternion.Euler(new Vector3(Random360(), Random360(), Random360()))); coin.rigidbody.velocity = vessel.rigidbody.velocity; // else if in orbit, coins will miss // impart a bit of force to get it spinning coin.rigidbody.AddTorque(new Vector3(Random360() * 0.1f, Random360() * 0.1f, Random360() * 0.1f), ForceMode.Impulse); coin.SetActive(true); // we might need to spawn more than [fps] coins per second if we're to reach ShowerCoinCount in // two seconds // so delay here if we're ahead of schedule, otherwise continue dumping coins while ((Time.realtimeSinceStartup - start) / 2f <= (float) i / ShowerCoinCount) yield return 0; } print("Wealth complete"); } } -
Let us mod Kerbals and Buildings
xEvilReeperx replied to CaptainKipard's topic in KSP1 Suggestions & Development Discussion
They already can be, to some degree. There are some hardcoded limits that aren't fun to work around like what level complex you need for EVA, but otherwise it can be done. I'm working on something related now -
Corrupt Saved Game .90
xEvilReeperx replied to a topic in KSP1 Technical Support (PC, modded installs)
You fired a kerbal that has some progress data referencing him. It's a stock bug. Remove the ProgressTracking entry(ies) associated with the missing kerbals from your persistent file and you'll be able to load it again. For the OP's case specifically, find this: SCENARIO { name = ProgressTracking scene = 7, 8, 5 Progress { FirstLaunch { completed = 633.859999999713 } FirstCrewToSurvive { completed = 959.562220458626 crew { crews = Podwell Kerman } } AltitudeRecord { completed = 3828.91945434279 record = 70000 } ReachedSpace { completed = 3828.91945434279 vessel { name = SpaceShipOne flag = Squad/Flags/orbs } crew { crews = Jebediah Kerman } } Kerbin { reached = 909.942220458671 [COLOR="#FF0000"][B] Orbit { completed = 9661.42386849251 vessel { name = SpaceShipOne flag = Squad/Flags/orbs } crew { crews = Haldo Kerman } }[/B][/COLOR] Landing { completed = 909.942220458671 vessel { name = SpaceShipOne flag = Squad/Flags/orbs } crew { crews = Podwell Kerman } } Splashdown { completed = 1522.13197387609 } SurfaceEVA { completed = 925.482220458657 crew { crews = Podwell Kerman } } [COLOR="#FF0000"][B] ReturnFromOrbit { completed = 11567.5763685026 vessel { name = SpaceShipOne flag = Squad/Flags/orbs } crew { crews = Haldo Kerman } }[/B][/COLOR] } } } Look at Kerbal roster: ROSTER { KERBAL { name = Jebediah Kerman type = Crew [... etc] } You'll note Haldo Kerman no longer exists. Delete the sections marked in red to fix it and don't fire any other crew with progress tracking entries in the future -
Thanks for the report. It should be fixed in the new version (1.8.3) that I just released I've gone ahead and put ScienceAlert up on KerbalStuff for those that prefer to get it there. Other options (CKAN, Curse) will be available soon also. CKAN technically should work already but I'm fuzzy on the exact details on how to get updates out and I'm heading to bed in a few minutes so that'll be tomorrow's mission.
-
Where is my barn?
xEvilReeperx replied to Stickyhammy's topic in KSP1 Suggestions & Development Discussion
It sounds like there might be some value in a "build your own" space center instead of going with the preconstructed style we have now. I think it would be much more fun anyway -
I've seen this exact situation in FireCrew. If you fire a crew member that has any ProgressTracking entries, the ProgressTracking scenario will throw an exception when it tries to save because an entry that references that crew member (such as this KSPAchievements.CrewRecovery from the above log): [EXC 03:30:00.319] NullReferenceException: Object reference not set to an instance of an object KSPAchievements.CrewRef.Save (.ConfigNode node) KSPAchievements.CrewRecovery.OnSave (.ConfigNode node) ProgressNode.Save (.ConfigNode node) ProgressTree.Save (.ConfigNode node) ProgressTracking.OnSave (.ConfigNode node) ScenarioModule.Save (.ConfigNode node) ProtoScenarioModule..ctor (.ScenarioModule module) ScenarioRunner.GetUpdatedProtoModules () Game.Updated () FlightDriver+.MoveNext () is referencing a null ProtoCrewMember that doesn't exist in KerbalRoster. You'd have to dig into ProgressTracking and KSPAchievements looking for invalid entries to fix it.