Jump to content

xEvilReeperx

Members
  • Posts

    894
  • Joined

  • Last visited

Everything posted by xEvilReeperx

  1. That's a good question. I can get my PartModule to show in there (along with being able to edit some of the text, which you can apply formatting tags to) by implementing IModuleInfo. ModuleGimbal doesn't seem to do this and somehow still appears in there, so there must be another way as well
  2. It looks like you can hide what's displayed by messing with AvailablePart.moduleInfos, although the AddAnAction PartModule from above doesn't seem to appear in that list anyway
  3. Sorry for delayed response, somehow this post slipped by me It looks like PartModule BaseActions are recreated after the prefab gets copied. Sadly, this means you'll have to modify every single spawned instance instead of the general set-and-forget solution you were looking for: [KSPAddon(KSPAddon.Startup.MainMenu, true)] class EditPodModules : MonoBehaviour { void Start() { PartLoader.getPartInfoByName("mk1pod").partPrefab.AddModule("AddAnAction"); } } class AddAnAction : PartModule { public override void OnAwake() { Log.Normal("AddAnAction running"); var exp = GetComponent<ModuleScienceExperiment>(); exp.Actions.Add(new BaseAction(exp.Actions, "HWAct", new BaseActionDelegate(TestMethod), new KSPAction("HWTestGUI"))); exp.Actions.ForEach(ba => Log.Normal("Instance part action: {0}", ba.guiName)); } void TestMethod(KSPActionParam p) { print("TestMethod"); } }
  4. Could you be more specific? FireCrew doesn't actually delete anything. Instead, Kerbals are marked as dead (whether they be fired or retired) and then prevented from showing up in the astronaut complex GUI. Your output_log would be most helpful
  5. The part itself should have the info you need (Part.protoModuleCrew)
  6. I haven't tested anything, but my money would be that whatever logic happens when the kerbal gets out of the seat isn't happening when the joint between kerbal and seat is broken. You end up with presumably a separate (but not commandable; no ModuleCommand) Vessel that ends up auto-classified as debris. It might be as simple as adding a PartModule that's aware of the command seat status of the Kerbal and calling something like KerbalEVA.OnDeboardSeat() when MonoBehaviour.OnJointBreak occurs
  7. This is a symptom of duplicate science experiment definitions. Config(EXPERIMENT_DEFINITION) SCANsat/Resources/ScienceDefs/EXPERIMENT_DEFINITION ... Config(EXPERIMENT_DEFINITION) SCANsat-master/SCANassets/Resources/ScienceDefs/EXPERIMENT_DEFINITION You seem to have downloaded the SCANsat source archive and installed it alongside another (correct) copy of SCANsat. Remove that one (delete the entirety of SCANsat-master folder in GameData) unless you have a particular reason to have installed it
  8. There isn't a "default" ModuleScienceExperiment, for example. There are ModuleScienceExperiments, pre-loaded with relevant data (from ConfigNodes like you'd expect), already attached to the part prefab. Here's what one looks like: [LOG 01:26:25.837] DebugTools, mk1pod has components: [LOG 01:26:25.838] DebugTools, ...c: UnityEngine.Transform [LOG 01:26:25.838] DebugTools, ...c: Part [LOG 01:26:25.839] DebugTools, ...c: ModuleCommand [LOG 01:26:25.839] DebugTools, ...c: PartResource [LOG 01:26:25.840] DebugTools, ...c: ModuleSAS [LOG 01:26:25.841] DebugTools, ...c: ModuleReactionWheel [LOG 01:26:25.841] DebugTools, ...c: ModuleScienceExperiment [LOG 01:26:25.842] DebugTools, ...c: ModuleScienceContainer [LOG 01:26:25.842] DebugTools, ...c: PartResource [LOG 01:26:25.843] DebugTools, ...c: FlagDecal [LOG 01:26:25.843] DebugTools, ...c: ModuleTripLogger [LOG 01:26:25.844] DebugTools, --->model has components: [LOG 01:26:25.844] DebugTools, ......c: UnityEngine.Transform [LOG 01:26:25.845] DebugTools, ------>capsule has components: [LOG 01:26:25.846] DebugTools, .........c: UnityEngine.Transform [LOG 01:26:25.846] DebugTools, .........c: UnityEngine.MeshFilter [LOG 01:26:25.847] DebugTools, .........c: UnityEngine.MeshRenderer [LOG 01:26:25.847] DebugTools, --------->collider has components: [LOG 01:26:25.848] DebugTools, ............c: UnityEngine.Transform [LOG 01:26:25.848] DebugTools, ............c: UnityEngine.MeshCollider [LOG 01:26:25.849] DebugTools, --------->flagTransform has components: [LOG 01:26:25.850] DebugTools, ............c: UnityEngine.Transform [LOG 01:26:25.850] DebugTools, ............c: UnityEngine.MeshFilter [LOG 01:26:25.851] DebugTools, ............c: UnityEngine.MeshRenderer [LOG 01:26:25.851] DebugTools, --------->hatch has components: [LOG 01:26:25.852] DebugTools, ............c: UnityEngine.Transform [LOG 01:26:25.852] DebugTools, ............c: UnityEngine.MeshFilter [LOG 01:26:25.853] DebugTools, ............c: UnityEngine.MeshRenderer [LOG 01:26:25.854] DebugTools, --------->rung has components: [LOG 01:26:25.854] DebugTools, ............c: UnityEngine.Transform [LOG 01:26:25.855] DebugTools, ............c: UnityEngine.MeshFilter [LOG 01:26:25.855] DebugTools, ............c: UnityEngine.MeshRenderer [LOG 01:26:25.856] DebugTools, --------->rung has components: [LOG 01:26:25.856] DebugTools, ............c: UnityEngine.Transform [LOG 01:26:25.857] DebugTools, ............c: UnityEngine.MeshFilter [LOG 01:26:25.858] DebugTools, ............c: UnityEngine.MeshRenderer [LOG 01:26:25.859] DebugTools, --------->window has components: [LOG 01:26:25.860] DebugTools, ............c: UnityEngine.Transform [LOG 01:26:25.860] DebugTools, ............c: UnityEngine.MeshFilter [LOG 01:26:25.861] DebugTools, ............c: UnityEngine.MeshRenderer [LOG 01:26:25.862] DebugTools, ------>ladder has components: [LOG 01:26:25.862] DebugTools, .........c: UnityEngine.Transform [LOG 01:26:25.863] DebugTools, .........c: UnityEngine.CapsuleCollider [LOG 01:26:25.863] DebugTools, ------>airlock has components: [LOG 01:26:25.864] DebugTools, .........c: UnityEngine.Transform [LOG 01:26:25.864] DebugTools, .........c: UnityEngine.CapsuleCollider (this being from) [KSPAddon(KSPAddon.Startup.MainMenu, true)] class PrefabDump : MonoBehaviour { void Start() { var ap = PartLoader.getPartInfoByName("mk1pod"); ap.partPrefab.gameObject.PrintComponents(); } } When a part is spawned, this whole GameObject gets cloned. If you were to destroy the ModuleScienceExperiment on this GO in the main menu, no mk1pods would be able to produce crew reports any more, whether they were loaded from a save game or created fresh. I think you're still sunk, though. I had a look around and couldn't find a way to create a brand-new BaseAction without using reflection
  9. If you're only hiding it in the editor, that's pretty straightforward: just grab the list and remove items/reorder it. This snippet alphabetizes part actions and hides any called "Toggle" [KSPAddon(KSPAddon.Startup.EditorAny, false)] class ToggleBegone : MonoBehaviour { void Start() { EditorActionGroups.Instance.partActionList.AddValueChangedDelegate(ReorderList); } void OnDestroy() { // assuming it's necessary anyway EditorActionGroups.Instance.partActionList.RemoveValueChangedDelegate(ReorderList); } void ReorderList(IUIObject obj) { Log.Debug("Alphabetizing"); // Note: there are at least three types of UIListItems in this list: // 1) the "title" entry, always first index, looks based off of 2) except named ActionPartTitle // 2) "ActionPart" with a EditorActionPartItem component linking back to the relevant action // 3) "ActionPartReset" which contains a EditorActionPartReset component. Always last, only appears // if at least one action in the list was assigned to a group List<IUIListObject> items = new List<IUIListObject>(); var partActions = EditorActionGroups.Instance.partActionList; while (partActions.Count > 1) { if (partActions.GetItem(1).gameObject.GetComponent<EditorActionPartReset>() != null) break; items.Add(partActions.GetItem(1)); partActions.RemoveItem(1, false, false); } List<IUIListObject> goodItems = new List<IUIListObject>(); items.ForEach(lo => { if (lo.gameObject.GetComponent<EditorActionPartItem>().evt.guiName != "Toggle") goodItems.Add(lo); else GameObject.Destroy(lo.gameObject); }); goodItems = items.OrderBy(o => o.gameObject.GetComponent<EditorActionPartItem>().evt.guiName).ToList(); for (int i = 0; i < goodItems.Count; ++i) partActions.InsertItem(goodItems[i], 1 + i); } }
  10. Any chance you have enabled SCANsat integration? If so, experiments with results that vary by biome will be ignored unless you have the relevant biome data scanned already.
  11. It's cloned (as part of the part prefab) and then any persistent data gets copied into its fields. I'm not sure it would work in your case; if that action list gets re-created during the second part (say, if it were being loaded from a save to map its actions to an action group*) then any changes you made to the prefab one wouldn't take. It's worth a try anyhow. *I don't know for certain this is how it works. I've never worked with BaseAction
  12. There is, it's just been slightly complicated with the addition of strategies. Here's what AlignedCurrencyFormatter uses: float dryCost = 0f; float fuelCost = 0f; float total = EditorLogic.fetch.ship.GetShipCosts(out dryCost, out fuelCost); // player might have a strategy active which increases/decreases total ship cost var cm = CurrencyModifierQuery.RunQuery(TransactionReasons.VesselRollout, total, 0f, 0f); total += cm.GetEffectDelta(Currency.Funds); // it's not a multiplier, it's the difference between current and modified total Another clever option might be to create your own strategy that's temporarily applied in the editor. I have zero experience with that, though
  13. GetAudioClip just searches the GameDatabase of already-loaded audio clips. Your first problem is that your file won't be in GameDatabase; it only loads ogg and wav. The second is that GetAudioClip wants a path relative to GameData, so if your file is in "(KSPROOT)/GameData/Akustik/MyFile.ogg", you should pass "Akustik/MyFile" in to get it
  14. Thanks. Newly-spawned asteroids were what lead to my code and it seems they lead me to a wrong assumption
  15. You could store your name in Part.customPartData and have a KSPAddon behaviour add PartModules on the fly in-scene. Otherwise, adding your PartModule to every prefab and having it destroy itself immediately in flight if it doesn't have a name is probably the way to go
  16. That torpedoes my theory, then. It's possible Squad is iterating over the GameDatabase model list and deactivating stuff themselves. Unlikely, but you could easily test it by detaching your static object model (specifically, the GO you get from GameDatabase.GetModel[in]) from its parent and possibly replacing its entry in GameDatabase.databaseModel with some fake GameObject (don't forget to DontDestroyOnLoad the fake one)
  17. What does this line return when the problem appears?: Debug.Log("KK: .activeInHierarchy is " + obj.gameObject.activeInHierarchy);
  18. That might be a band-aid. Assuming StaticObject obj is a parent GO of a hierarchy of same-static related components like meshes, I'd be wondering how the sub-GOs got disabled in the first place. You need only disable the parent to disable all children
  19. GameObject.SetActive will not enable children if they've been disabled (activeSelf == false). The GetComponentsInChildren method you used won't return inactive components. That's probably why you think they vanished. Use the overload version
  20. Mod authors already have this power. There's nothing Squad needs to do. I guess they could require mod authors to write down what they want others to be able to do with their work, put that info in a file and require that file to be distributed with every mod I suppose. There may be some sarcasm in that last sentence
  21. Steps in how, exactly? Squad already requires you to distribute a license which defines to others what can be done with a mod/project. You can't be outraged at a fork of your mod if every single copy that you distribute has text that specifically says you're okay with this happening. The correct way to prevent forks is not to allow them if you don't want them happening, or else alter the license text so that any fork has receive permission instead. It's not complicated
  22. All right, I've been able to stay out of recent threads but now I've had enough. The people who are threatening users need to stop. This started as a nice healthy discussion but like several other recent threads we're beginning to see people of a certain viewpoint issue threats to people of the other viewpoint, while at the same time mentioning things like "toxic community", "what it deserves", "social contract" and other ironic statements. If you tell everyone they can borrow your crayons but then you slap the hand of the first kid who tries, it's not him that's being impolite. Your example is precisely why this entire argument is so ridiculous to me. You need to change your crayon license to "please ask me if you can borrow my crayons" instead and then there's no problem, you see? It's not logical to be upset about it otherwise
  23. That's because GetComponentsInChildren only returns active components. Use the overload instead GameObject model = GameDatabase.Instance.GetModel(...); MeshFilter[] meshFilters = model.GetComponentsInChildren<MeshFilter>(true);
  24. Do you mean combine all of the meshes into a single MeshFilter on one GameObject? Many parts in the game are composed of many MeshFilters. You can find a particular portion by looking for GameObjects in the model hierarchy that have the name you're looking for
×
×
  • Create New...