Jump to content

Custom staging icons, how to?


Recommended Posts

Alright, I'm trying to work on a new parachute part module. It will have to show up in staging and the documentation on how to do this is rather low to non existent.

For now, the best two sources I had for this is the Wiki and a piece of code Majiir dug up for me.

For now, the code I have to load up the part in the staging list is this:

namespace stupid_chris
{
public class RealChuteModule : PartModule
{
public override void OnStart(PartModule.StartState state)
{
Staging.CreateIcon(this.part);
this.part.inStageIndex = Staging.CurrentStage;
this.part.stackIcon.SetIcon(DefaultIcons.PARACHUTES);
this.part.stackIconGrouping = StackIconGrouping.SAME_MODULE;

}
}
}

What this does for now is only loading up a blank square in the staging list:

7t08frt.png

So that's half the way there. My question is twofold:

1. Now that's it loading there, how do I actually assign it an image rather than having a blank square, my current code doesn't seem to do it. (I also tried "this.part.stackIcon.iconImage = DefaultIcons.PARACHUTES;")

2. When I delete the part, the staging icon stays there, couldn't get it to disappear upon part deletion, anyone has headers on to how to do that? Edit: on that, I noticed a "RemoveIcon()" method but couldn't get it to work.

Edited by stupid_chris
Link to comment
Share on other sites

  • 4 weeks later...

To dredge this up a bit (hope it's not too much of a necro, only a month), I have a similar question. That works for using one of the stock icons, but is there still a way to do a fully custom icon? The wiki's method doesn't seem to work. According to that, this is approximately what I should have in OnStart:

this.part.stackIcon.SetIcon(this.part, "icons.png", 0, 0);

Despite having a correctly laid out icons.png. I even tried placing the file in both the part folder and the PluginData folder, as recommended on the wiki, but neither shows anything. I feel like this may have changed since it was written. Anyone?

Link to comment
Share on other sites

Yep, I've tried all 3 different locations that have been suggested for completeness, KSP/PluginData/icons.png, KSP/GameData/NearFuture/PluginData/icons.png and KSP/GameData/NearFuture/PluginData/NearFuture/icons.png. No luck with any of them!

Link to comment
Share on other sites

Yeah, looks like it unfortunately. I have tried... many things with no success now, so I'll just make do with a fuel tank symbol or something. No nuclear trefoil for me :(.

You can always try messaging C7 or HarvesteR about it. From what Mu told me, hey are the people to speak to concerning staging. They might help you.

Link to comment
Share on other sites

  • 1 month later...
You can always try messaging C7 or HarvesteR about it. From what Mu told me, hey are the people to speak to concerning staging. They might help you.

Hi!

Any news here. I ran into the same problem as Nerta. The custom icon is just empty if I set it with setIcon.

Link to comment
Share on other sites

  • 3 weeks later...

Hopefully this isn't too much of a necro, but I had a thought.

If custom staging icons aren't possible then what icons are already built into the game? I know about the parachute, SRB, liquid engine, command pod, and radial/stack decoupler icons. Are there others though? I know that KSP used to have dozens of staging icons which were used for just about anything. Are those icons are still in the game resources somewhere, unused and gathering dust?

If so I'll have to figure out some way to find them. None of the existing icons would be suitable for the timer part I'm trying to get working.

Link to comment
Share on other sites

Hopefully this isn't too much of a necro, but I had a thought.

If custom staging icons aren't possible then what icons are already built into the game? I know about the parachute, SRB, liquid engine, command pod, and radial/stack decoupler icons. Are there others though? I know that KSP used to have dozens of staging icons which were used for just about anything. Are those icons are still in the game resources somewhere, unused and gathering dust?

If so I'll have to figure out some way to find them. None of the existing icons would be suitable for the timer part I'm trying to get working.

Yes, look at the DefaultIcons enum. Just find the one you want in that list, and do this.part.stagingIcon = "ICON"; Where ICON is the enum member you want, string form.

Link to comment
Share on other sites

Yes, look at the DefaultIcons enum. Just find the one you want in that list, and do this.part.stagingIcon = "ICON"; Where ICON is the enum member you want, string form.

Fantastic. Thanks. That's exactly what I was looking for. It's going to be something of a pain to figure out what each icon actually looks like since I'll have to keep reloading KSP, but at least now I know the names.

Link to comment
Share on other sites

Fantastic. Thanks. That's exactly what I was looking for. It's going to be something of a pain to figure out what each icon actually looks like since I'll have to keep reloading KSP, but at least now I know the names.

I believe you can do it from the part config. Just create a bunch of dumb/empty parts and stick the line stagingIcon = ICON in them. I believe this will set them correctly.

Link to comment
Share on other sites

  • 1 year later...
[quote name='stupid_chris']Yes, look at the DefaultIcons enum. Just find the one you want in that list, and do this.part.stagingIcon = "ICON"; Where ICON is the enum member you want, string form.[/QUOTE]
Can you tell me where are "default staging icons" located.Thank you
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...