

Echo 8 ÉRÀ
Members-
Posts
60 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Echo 8 ÉRÀ
-
In that case, I personally would just tell people to just live with it. However, if I really wanted to do that I would: Make a list of all the fields I would need to read from a part.cfg to configure my partmodule At runtime, dynamically add the ModuleAnimateGeneric and ModuleGenerator partmodules to every part (via looping through PartLoader.LoadedPartsList[].partPrefab.Modules) which has added my new partmodule, while making sure I don't add duplicates Go through all the actions on the newly added partmodules and prevent them from showing up in the GUI. I think setting BaseAction.active = false should do the trick, not sure though Added a new KSPAction which does nothing but re-enable the disabled Toggle actions, fire them, then disable again Repeat the previous step for every other group of actions (Enable and Disable). There's probably more to it, but that's your job to find out, since this is your project and not mine.
-
The first hurdle in any project is knowing what you want to do. Until you can work that out, Hello World! examples are really the best thing we can advise you to follow. For example, my very first plugin was an animation partmodule. Sure, it was terrible, but I didn't care. I wanted a cargo bay on my shuttle, there wasn't any mods out there with a cargo bay for my shuttle, so come Hell or high water, I'm going to make a cargo bay for my shuttle. And thus, [Plugin][Part][0.16] Animated Cargo Bay was born. If you want to know what functions a plugin can use, open up the Object Browser. Basically anything that is public or protected is free for plugin makers to make use of.
-
Try Vessel.GetReferenceTransformPart() http://wiki.kerbalspaceprogram.com/wiki/Setting_up_Visual_Studio Basically the set up is (the wiki page neglects to mention changing the framework version): Create a C# Class Library project. Set to use the .Net 3.5 Framework. Add references to $(KSPFolder)\KSP_Data\Managed\UnityEngine.dll and $(KSPFolder)\KSP_Data\Managed\Assembly-CSharp.dll. What exactly do you want to achieve? Saying you want to combine the two can be taken in a number of different ways.
-
Where to start as a mod developer?
Echo 8 ÉRÀ replied to thermobaric's topic in KSP1 Gameplay Questions and Tutorials
http://docs.unity3d.com/Documentation/ScriptReference/index.html -
The stuff in the debug window gets printed out to %KSPFolder%\KSP.log as well, so in the event you can't work out how to keep the log window and your window open at the same time, there's always the option of checking the log file. The PDebug class has a bunch of static methods which print to the log.
-
Personally, if I were to be building my stuff on the command line, I would just write a batch file like this: SETLOCAL REM -- Naturally, change these paths to match your setup. SET KSPData=E:\Program Files\KSP\KSP_Data\Managed SET CompilerDir=C:\Windows\Microsoft.Net\Framework\v4.0.30319 REM -- If the source file has a space in its filename, surround the filename with double quotes. SET SourceFiles={Source File 1} {Source File 2} {etc.} REM -- Note the references to System.dll, System.Core.dll and mscorlib.dll that exist in your KSP folder. The /nostdlib REM -- and /noconfig flags stop the compiler from adding references to these automatically. If you didn't do that, the REM -- compiler would link in the .Net 4.0 version of DLLs and KSP doesn't like those. SET References="/r:%KSPData%\Assembly-CSharp.dll" "/r:%KSPData%\UnityEngine.dll" "/r:%KSPData%\mscorlib.dll" "/r:%KSPData%\System.dll" "/r:%KSPData%\System.Core.dll" REM -- Change MyPlugin.dll to whatever you want your DLL to be named. "%CompilerDir%\csc" /t:library /out:MyPlugin.dll /o /nostdlib /noconfig %References% %SourceFiles%
-
[Plugin][Part][0.16] Animated Cargo Bay
Echo 8 ÉRÀ replied to Echo 8 ÉRÀ's topic in KSP1 Mod Releases
Quick update: Got my new desktop, just need to finalize a few things before I can start working on this again. -
[Plugin][Part][0.16] Animated Cargo Bay
Echo 8 ÉRÀ replied to Echo 8 ÉRÀ's topic in KSP1 Mod Releases
Could you get me a link to what you mean? I saw your post after I made mine, so I edited in my reply at the end of mine so I wouldn't double post. Post 6. Alright. I picked the thumbnail because I though 1024x768 was a tad large to link directly. Habit from other forums. Pretty sure it does. I know at one point, I had my shuttle crash land in the ocean near the KSC and the main body survived the landing, but I don't know if the changes I made to the Part.cfgs since then would still allow it to float. -
[Plugin][Part][0.16] Animated Cargo Bay
Echo 8 ÉRÀ replied to Echo 8 ÉRÀ's topic in KSP1 Mod Releases
If they're only 0.5m in radius, they should already fit. The FL-T32 is 0.5m in radius and it fits fine: That's an earlier version of my models, but the only real difference is that the final version used quads for most of the faces. All the triangles made it harder for me to work out which triangle was for each face when I was trying to texture it If it helps, I can assure you that you can fit a radial decoupler in there + fuel tank on top in there, though you'll have to rotate it to face up. It's what I used to substitute for a satellite during testing. I tried to use the DynaSat L100, but it had a tendency to break open the ship when it deployed its solar panels before it cleared the cargo bay. Thanks. That's the plan. -
[Plugin][Part][0.16] Animated Cargo Bay
Echo 8 ÉRÀ replied to Echo 8 ÉRÀ's topic in KSP1 Mod Releases
I have a Mk3 bomb bay in the works, but right now, I haven't even started texturing it. 3D modelling just isn't my strong point, and I've been busy working on my partmodule library. I thought about that, but modelling a new cockpit seemed a bit beyond me. My current modelling process involves mathematically mapping out half my points in Excel... I know that close enough is close enough, but I'm a bit OCD about getting the walls a certain exact thickness Yep, that's one of the things I looked at in my initial planning. I figured that even if there isn't a cart small enough, someone would make it (at the time liltrak didn't exist yet). It's z, but you can change it in the Part.cfg, and due to how KSP loads data, the .craft file for each individual ship as well. 1) I completely forgot to mention the key in the post. I kept seeing the "activationKey = z" line in my documentation on CodePlex that I automatically assumed that I put it in there. 2) Limitation due to how I check for key presses. It only checks during OnUpdate(). To be fixed when I finish up v 0.4 of my partmodule library and have a fully featured animation partmodule. 3) Again, due to how it was implemented, the part has to be active before it can start checking for key presses. 4) I never EVA, so it never occured to me to check. I guess I'll have to account for that in Module_EE_UserEvent, since it also currently uses a simple Input.GetKeyDown() check in OnUpdate(). Might have to wait a bit though. My animation partmodule v2 is currently hitting a few self-inflicted difficulties due to some ambitious design goals. 5) I hadn't worked out how to use KSPEvents properly when I first made the part. In fact, the part started its life as a copy of LandingLeg1-2 with a new model. After that, I simply went about working out how to get it to animate independantly of landing gear. It's only at the end of its creation did I put any thought into even attempting to rectify its limitations, and my partmodule library is the result of that. 6) I hadn't considered multiple ship scenarios when I first produced that simple partmodule, due to running the game on a laptop that can barely handle a single ship. I have to regularly delete my save files to get rid of lag issues. My main reason for releasing this? To get reports from people who aren't me. Due to having developed it, I'm kind of blinkered, since I know how the parts are supposed to be used (for ex, why I zeroed the throttle and fired off the first stage without as much as an explanation in my video) and have a certain play style which prevented me from foreseeing some of the issues you mentioned. I do have my partmodule library marked as Alpha, after all. I don't know anyone well enough that I could get them to test stuff out for me before I release it to the general public, so it was a choice of releasing it with only my limited amounts of testing, or never to release it at all. The former results in feedback, the latter results in wasting the dozens of hours I've spent working on my partmodules and dozens more on the models (really, it took me over three days just to go from untextured floor model to what it is now. The roof only took a day or so due to streamlining my process a bit), for little more than the satisfaction that I managed to make an animated part. -
Since, I've been trying to launch satellites into space using SSTO spaceplanes, I've been frustrated with the lack of an animated cargo bay to hold the satellite in. As the adage goes, if you want something done, do it yourself, and so I present to the KSP community, an animated cargo bay: I have received permission from C7Studios to base my parts on his old Flight Pack for better stock part integration. Watch on YouTube to see the annotations - I wasn't comfortable narrating it by voice. SkyDrive Folder: https://skydrive.live.com/redir?resid=11CF26D6E58AF2E3!513 CodePlex Page for PartModule project: http://eeksppml.codeplex.com/ Contents (v 0.1) [table] [tr][td]Part name[/td][td]Description[/td][/tr] [tr][td]EE_Fuselage_Floor_Static[/td][td]A standard, non-animated cargo bay floor with two internal mounting points for 1m diameter parts[/td][/tr] [tr][td]EE_Fuselage_Roof_Bay[/td][td]An cargo bay roof with animated bay doors. Defaults to z to open/close, but can be changed via Part.cfg or a ship's .craft file[/td][/tr] [/table] [table] [tr][td]PartModule name[/td][td]Description[/td][/tr] [tr][td]ModuleAnimatedPart[/td][td]Module for invoking an animation in a PartTools created model on a key press. It will switch back and forth between playing the animation forwards and backwards. Fields string: animationName = {Animation Name} string: activationKey = {Unity.Input.GetKey() key name (http://docs.unity3d.com/Documentation/Manual/Input.html)} int: animationState = {Initial animation state: -2 for at the beginning, 2 at the end (to play animation backwards)} Example name = ModuleAnimatedPart animationName = RoofOpening activationKey = z animationState = -2 }MODULE {[/td][/tr] [/table] [table] [tr][td]Version[/td][td]Notes[/td][/tr] [tr][td]0.1[/td][td]Initial Release. Parts: Mk3 Fuselage-compatible Cargo Bay Floor, Static Mk3 Fuselage-compatible Cargo Bay Roof, Roof Bay Doors PartModules: ModuleAnimatedPart: Used to animate a part on a key press. Requires a PartTools model with an animation. [/td][/tr] [/table] Parts: [table] [tr][td]Go back through the current parts and think of shorter Titles, better descriptions and better categories[/td][td]In Planning[/td][/tr] [tr][td]Create a Mk3 Fuselage-compatible cargo bay floor with a ramp May need to drop if I can't work out how to detect collision with ground from a PartModule[/td][td]In Planning[/td][/tr] [tr][td]Create Mk3 Fuselage-compatible tail with a drop ramp May need to drop if I can't work out how to detect collision with ground from a PartModule[/td][td]In Planning[/td][/tr] [tr][td]Create Mk3 Fuselage-compatible tail with clamshell doors[/td][td]In Planning[/td][/tr] [/table] PartModules:[TABLE] [tr][td]Delete ModuleAnimatedPart and split its current functions into separate but more capable PartModules[/td][td]Pending[/td][/tr] [tr][td]Create replacement Animation PartModule which plays an animation from a list of animations based on additional data embedded in a KSPEvent. Also fires part-definable KSPEvents on animation start and completion.[/td][td]In Development[/td][/tr] [tr][td]Create a StackIcon PartModule which sets a part's stackicon properties from a list of states. State chosen from additional data embedded in a KSPEvent.[/td][td]In 0.2 Release of EE_KSPPML Module_EE_StackIcon is untested with symmetry groups & state changing[/td][/tr] [tr][td]Create a Controller PartModule which sets the buttons on a part's right-click menu. Each entry can have an associated keyboard mapping. Again, each entry will have a list of states which can be changed via KSPEvents[/td][td]In 0.3 Release of EE_KSPPML Module_EE_UserEvent lacks keyboard binding at this time[/td][/tr] [tr][td]Create a sound playing partmodule. It will have a list of available sounds to play, and is picked in a similar fashion to the animation PartModule.[/td][td]In Planning Module_EE_UserEvent lacks keyboard binding at this time[/td][/tr] [/table] Other[table] [tr][td]Create a CodePlex/SourceForge account and make a SVN/GIT repository.[/td][td]Done[/td][/tr] [tr][td]Create an icon for the plugin dll.[/td][td]In Planning[/td][/tr] [tr][td]Spice up this thread with logos and stuff.[/td][td]In Planning[/td][/tr] [tr][td]Make up a better name for my PartModule project and my series of parts. "Echo 8 ÉRÀ's KSP PartModule Library" (or EE_KSPPML) is a bit of a mouthful, and a tad boring.[/td][td]In Planning[/td][/tr] [/table] All assemblies and their source code is licensed under the Microsoft Reciprocal License (Ms-RL). The remainder of the work (aka the models, part.cfgs, etc.) is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
-
Oh it works. In fact, I use a variation of it for my workaround to Unity's idiosyncratic cloning behaviour: PartModuleBase.cs It may not actually use the method described earlier exactly, but the effect is more or less the same (static constructor being called during game load). KSP actually creates a prototype part for each Part.cfg during game load, and clones copies of it whenever you add that part in the VAB/SPH. It's that cloning process which had me tearing my hair out trying to work out why my code wasn't working. Curse you Unity Dev Team and your wierd cloning behaviour! It wouldn't be so bad if they used MemberwiseClone() or ICloneable. But no, they had to use some odd magic involving reflection, the SerializableAttribute, and a SerializeField attribute which only works on certain types and silently fails on unsupported ones.
-
Compiling Mumech
Echo 8 ÉRÀ replied to Nuke's topic in KSP1 C# Plugin Development Help and Support
Makes me glad I use Visual Studio (not Express). -
Compiling Mumech
Echo 8 ÉRÀ replied to Nuke's topic in KSP1 C# Plugin Development Help and Support
IIRC, the only difference between a 3.5 build and a 4.0 build is which assemblies your assembly references. Try building from the command line. The /nostdlib and /noconfig flags should be of some use. There's also the old workaround of using a series of method overloads: int Func(bool NonOptArg, int OptArg) { // do stuff } int Func(bool NonOptArg) { return Func(NonOptArg, 5); } -
Compiling Mumech
Echo 8 ÉRÀ replied to Nuke's topic in KSP1 C# Plugin Development Help and Support
Yes. C# didn't get optional arguments until the .Net 4.0 release (VS2010): MSDN: Named and Optional Arguments (C# Programming Guide) What you want to do, is to get a 4.0 compatible compiler and target the 3.5 framework. -
As I guessed, you're asking in the wrong section. You're looking for the Add-on Development subforum. If I had to guess, it's because you put '.3' instead of '0.3', but I'll leave that for you to test. Does PartModule.OnSave() even do anything? I can see it gets called, but it seems like it has no effect on a ship's .craft file or the main persistence file. EDIT: My Bad. I was assuming Node.SetValue creates a value if the key didn't already exist. Excellent, now I can have nice title-cased part.cfg entries while using 'm_' prefixes for private fields.
-
C7 has a tutorial video where he demonstrates how to get an animated model into Unity PartTools: http://kerbalspaceprogram.com/forum/showthread.php/11114-C7-Tutorials
-
Ok, even though I suspect you're trying to make a bog-standard engine and not something that requires you making a plugin, I'll bite. I have to point out the obvious: Are all your values in part.cfg in the right format? Like Vector2/3/4 fields have to be 2/3/4 float values separated by a comma and optional whitespace. Random Aside: If I delete all the empty overrides in my animation partmodule, the End Flight button that appears when you hit escape no longer works
-
Same. I don't even want to clean up the code in the fear that a change will cause it to blow up on me again. Discovered that early on. I just use strings and the occasional float now. Though recently, I've mainly worked on getting data from nested confignodes (it works if I don't rely on KSP to do it for me), so most of data is loaded via ConfigNode.GetValue() and converting the string into something else.
-
That's just a test PartModule I cooked up to try to narrow down what's going wrong with my PMs proper, so I can work out why my v1 animation PM works (it's literally a 132-line hackjob, including useless cruft and whitespace, to get my animated cargo bay working), while a much cleaner coded PM that does nothing but change the stackicon when it processes a KSPEvent, crashes half the time and does nothing the rest. The ActiveState field is just a representation of one of the variables from my other PMs. Test parts like that is how I discovered that IConfigNode KSPFields don't work (its Load and Save methods never gets called), that my partmodules sometimes forget the contents of fields (both marked with KSPField and not) between the call to OnLoad and going into the VAB, even when the code is highly similar between two different partmodules I have in development. Heck, at one point my animation partmodule had a similar freakout to that video depending on whether or not "public override void OnXXXX() { base.OnXXXX(); }" was commented out (can't remember which one it was). Ack, I'm rambling. Been having a frustrating day trying to work out when something is going wrong because of something I wrote or it's because of bugs in KSP's partmodule infrastructure (like the IConfigNode thing).
-
Can anyone tell me what the heck is wrong with this code? [KSPField] private string ActiveState; public override void OnActive() { base.OnActive(); Debug.Log("[Module_EE_Test] OnActive()"); } public override void OnInactive() { base.OnInactive(); Debug.Log("[Module_EE_Test] OnInactive()"); } /// <summary> /// Constructor style setup. /// Called in the Part\'s Awake method. /// The model may not be built by this point. /// </summary> public override void OnAwake() { base.OnActive(); Debug.Log("[Module_EE_Test] OnActive()"); } /// <summary> /// Called during the Part startup. /// StartState gives flag values of initial state /// </summary> public override void OnStart(StartState state) { base.OnStart(state); Debug.Log(string.Format("[Module_EE_Test] OnStart({0})", Enum.GetName(typeof(StartState), state))); Debug.Log(string.Format("[Module_EE_Test] ActiveState = \"{0}\"", ActiveState)); } /// <summary> /// Per-frame update /// Called ONLY when Part is ACTIVE! /// </summary> public override void OnUpdate() { base.OnUpdate(); Debug.Log("[Module_EE_Test] OnUpdate()"); } /// <summary> /// Per-physx-frame update /// Called ONLY when Part is ACTIVE! /// </summary> public override void OnFixedUpdate() { base.OnFixedUpdate(); Debug.Log("[Module_EE_Test] OnFixedUpdate()"); } /// <summary> /// Called when PartModule is asked to save its values. /// Can save additional data here. /// </summary> /// <param name='node'>The node to save in to</param> public override void OnSave(ConfigNode node) { base.OnSave(node); Debug.Log("[Module_EE_Test] OnSave([ConfigNode node])"); } /// <summary> /// Called when PartModule is asked to load its values. /// Can load additional data here. /// </summary> /// <param name='node'>The node to load from</param> public override void OnLoad(ConfigNode node) { base.OnLoad(node); Debug.Log("[Module_EE_Test] OnLoad([ConfigNode node])"); Debug.Log(string.Format("[Module_EE_Test] ActiveState = \"{0}\"", ActiveState)); } }public sealed class Module_EE_StackIcon: PartModule { MODULE { name = Module_EE_StackIcon ActiveState = Closed } It's not supposed to do anything but print a bunch of text to the console, but instead, it makes KSP throw a fit then crash: In addition to the game crashing when I detached the test part at the end, it seems like value of ActiveState is forgotten sometime between game load and entering the VAB.