Programming Question Making a module-file for a spacecraft

Pinguinboy

50.000 years old lifeform
Joined
Aug 12, 2008
Messages
219
Reaction score
0
Points
0
Location
Mare Infinitus; 55 Cancri
Website
www.facebook.com
Hello, I was wondering how to make a module-file for a spacecraft that you can't select from the scenario-editor. Well, I searched on Orbiter Hangar, but I found no tutorials for it.
So, does someone know how to make these module-files for a spacecraft?

P.S: Sorry if there was already a thread like this, I'm not very much online here ;)
 

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
55
Points
63
Location
Vancouver, BC
check the addon development board - there are tutorials stickied in there :thumbup:
 

orb

O-F Administrator,
Administrator
Joined
Oct 30, 2009
Messages
14,023
Reaction score
0
Points
0
I was wondering how to make a module-file for a spacecraft that you can't select from the scenario-editor.

I don't know if you find a tutorial that will tell you how to hide a vessel from the scenario editor.

You can hide a vessel from gaining focus, but it still will be visible in the scenario editor, by adding this to its configuration file:
Code:
EnableFocus = FALSE
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,349
Reaction score
20
Points
0
Website
orbit.medphys.ucl.ac.uk
You can't hide vessels from being listed by the scenario editor, but you can prevent a vessel type from being listed in the editor's "new vessel" page by setting
Code:
EditorCreate = FALSE
in the def file.
 

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
55
Points
63
Location
Vancouver, BC
could one not have further vessels "hidden" inside a single module? - it would be useful for spawning debris and such... although i figure there's probably a better way of doing that, no?
 

orb

O-F Administrator,
Administrator
Joined
Oct 30, 2009
Messages
14,023
Reaction score
0
Points
0
could one not have further vessels "hidden" inside a single module?
There is a way of doing it from a plug-in module, but it requires hooking the oapiGetVesselCount and oapiGetVesselByIndex, that will return the count decreased by the number of hidden vessels via API, and a vessel's object handle with appropriately changed index (array of vessels wouldn't be changed at all, but it would be filtered out of hidden vessels by changed oapiGetVesselByIndex function). The used by Orbiter internal count and array of vessels wouldn't be changed, because Orbiter doesn't use these API functions internally, but those arrays and counters are accessed directly.
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,283
Reaction score
17
Points
0
Location
Florida
could one not have further vessels "hidden" inside a single module? - it would be useful for spawning debris and such... although i figure there's probably a better way of doing that, no?

Do you mean more then one vessel from a single module? You can create some generic debris.dll, then simply change the mesh in the cfg file. Or have that debris.dll pick a random mesh and scale accordingly. For the orbDamage module (unreleased) when a vessel breaks, I create debris pieces and set their size so that their sum would equal the size of the broken vessel. I have one wreck.dll that picks a random debris mesh, and scales it according to its size.

OR:

You can define multiple vessel classes in your module, then check the classname of the vessel being created:

Code:
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
	char cname[512];
       // oapiGetVesselInterface will return NULL at this point, so do this
	strcpy(cname, VESSEL(hvessel).GetClassName());
	if ( !strnicmp(cname, "ShuttlePB", 9))
		return new ShuttlePB(hvessel, flightmodel);
	else
		return new EmptyPB(hvessel, flightmodel);
	return 0;
}

cfg file for EmptyPB:

Code:
; === Configuration file for vessel class EmptyPB ===
ClassName = EmptyPB
Module = ShuttlePB
 
Last edited:

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
55
Points
63
Location
Vancouver, BC
wait did you say "orbDamage"? :blink:

i can see this going violently off-topic from here on :hail: :cheers:
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,283
Reaction score
17
Points
0
Location
Florida
Aye. See the attachment. Every time I try to release something like this, you have violent reactions with other add-ons. Last release crashed with the DGIV when you would crash a DGIV to the ground. I was puzzled for a while because DGIV was in the ignore list of the module so it shouldn't be affected in any way. Then I realized that the whole bunch of wreck vessels that are created upon the crash weren't in the ignore list...So the module automatically gave them a generic damage profile (as defined in the cfg) because global damage was enabled. Fun. This one should be fine though. I added some more classes to the ignore list (DGIV creates a lot of different vessels upon a crash), but even so I see some of my debris pieces upon the crash...
 

Attachments

  • orbdamagev2_2.zip
    457.3 KB · Views: 4
Top