IMS2  Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
IMS_ModuleFunction_Thruster Class Reference

Modulefunction that defines a basic thruster. More...

Inheritance diagram for IMS_ModuleFunction_Thruster:
IMS_ModuleFunction_Base EventHandler

Public Member Functions

 IMS_ModuleFunction_Thruster (IMS_ModuleFunctionData_Thruster *_data, IMS_Module *_module, bool creategui)
 
virtual void PostLoad ()
 called on SimStart, after LoadState() but before AddFunctionToVessel() More...
 
virtual void SaveState (FILEHANDLE scn)
 overload to save modulefunction specific stuff to scenario. More...
 
virtual void AddFunctionToVessel (IMS2 *vessel)
 Everything that needs to be done when the modulefunction is removed from a vessel should be implemented in an overload of this function. More...
 
virtual void RemoveFunctionFromVessel (IMS2 *vessel)
 Everything that needs to be done when the module is removed from a vessel should be implemented in an overload of this function. More...
 
virtual void PreStep (double simdt, IMS2 *vessel)
 gets called at every clbkPreStep of the containing vessel. More...
 
virtual GUI_ModuleFunction_BaseGetGui ()
 returns the GUI of this module function, or NULL if this module function doesn't have a user interface. More...
 
virtual void AddExhaustsToVessel ()
 adds all exhausts of the thruster to the vessel
 
virtual void RemoveExhaustsFromVessel ()
 Removes all exhausts of the thruster from the vessel.
 
virtual void SetThrusterMode (int modeidx)
 sets the thruster mode of the thruster. More...
 
virtual void SetThrusterGroup (int thrustergroup)
 Sets the thrusters control group. More...
 
IMS_ModuleFunctionData_ThrusterGetData ()
 
- Public Member Functions inherited from IMS_ModuleFunction_Base
 IMS_ModuleFunction_Base (IMS_ModuleFunctionData_Base *_data, IMS_Module *_module, FUNCTIONTYPE _type)
 Constructor. More...
 
void LoadState (FILEHANDLE scn)
 Sends every scenario line concerning this modulefunction function to processScenarioLine(). More...
 
virtual double GetMass ()
 Returns the current modulefunctions mass. More...
 
IMS_ModuleGetModule ()
 
- Public Member Functions inherited from EventHandler
void ConnectToMyEventGenerator (EventSink *sink, EVENTPIPE pipe)
 connects an EventSink to the EventGenerator of this in the appropriate pipe. More...
 
void ConnectToMyEventSink (EventSink *sink, EVENTPIPE pipe)
 Connects an EventSink on this to the passed event sink. More...
 
void ConnectMySinkToYourNode (EventNode *node, EVENTPIPE pipe)
 Connects an EventSink on this to the passed EventNode, no matter whether generator or another sink. More...
 
EVENTHANDLERTYPE GetEventHandlerType ()
 Returns the EVENTHANDLERTYPE of this event handler.
 
UINT GetUID ()
 Returns the globaly unique identifier of this event handler.
 

Protected Member Functions

virtual bool ProcessEvent (Event_Base *e)
 Receives all events coming through this EventHandler. More...
 
vector< THRUSTEREXHAUSTgetRelativeExhausts ()
 
virtual bool processScenarioLine (string line)
 receives all scenario lines concerning this modulefunction, one after the other. More...
 
- Protected Member Functions inherited from EventHandler
EventGeneratorcreateEventGenerator (EVENTPIPE pipe)
 Creates a new EventGenerator for this handler instance. More...
 
EventSinkcreateEventSink (EVENTPIPE pipe)
 creates a new EventSink in this handler instance More...
 
void disconnect (EventHandler *handler, bool bidirectional=true)
 Completely severs connections to and from the passed EventHandler, all sinks, all generators. More...
 
void sendEvents ()
 Tells all event generators in this event handler to advance their event cue. More...
 
void processWaitingQueue ()
 processes all events in the waiting queue. More...
 
void addEvent (Event_Base *_event, EVENTPIPE _pipe=DEFAULT_PIPE)
 Adds an event to the eventcue of an eventpipe. More...
 
void addEventToWaitingQueue (Event_Base *_event)
 Adds an event to this handlers waiting queue. More...
 
void relayEvent (Event_Base *_event, EVENTPIPE _pipe)
 Relays an event to another event pipe. More...
 
EventSinkgetEventSink (EVENTPIPE pipe)
 returns the EventSink on this EventHandler that belongs to the passed event pipe More...
 
EventGeneratorgetEventGenerator (EVENTPIPE pipe)
 Returns the EventGenerator on this EventHandler that belongs to the passed event pipe. More...
 

Protected Attributes

THRUSTER_HANDLE thruster = NULL
 
int currentthrustermode = 0
 The index of the currently active thruster mode.
 
bool operational = true
 Shows whether the thruster is currentl yoperational or not.
 
int thrustergroup = -1
 Contains the THGROUP_TYPE value or -1 if the thruster is not in a group.
 
IMS_PropulsionManagerpropmanager = NULL
 
vector< UINT > exhaust_ids
 Contains the orbiter indices of currently active exhausts for this thruster.
 
- Protected Attributes inherited from IMS_ModuleFunction_Base
FUNCTIONTYPE type
 An identifier for the type of this module function.
 
IMS_Modulemodule = NULL
 Pointer to the IMS_Module containing this module function.
 
- Protected Attributes inherited from EventHandler
EVENTPIPE defaultpipe = DEFAULT_PIPE
 Use this to set the defualt event pipe of this event handler.
 
EVENTHANDLERTYPE eventhandlertype
 An identifier that offers a group identification.
 

Private Attributes

IMS_ModuleFunctionData_Thrusterdata
 
GUI_ModuleFunction_Thruster * menu
 

Detailed Description

Modulefunction that defines a basic thruster.

This class is not abstract, but might become in the future. It is intended that specialised thruster types or roles are derived from this class (such as chemical thrusters, electrical, etc). The thruster modulefunction provides implementation for different and selectable thrustermodes, used propellant types and ratios as well as exhaust rendering.

Member Function Documentation

void IMS_ModuleFunction_Thruster::AddFunctionToVessel ( IMS2 *  vessel)
virtual

Everything that needs to be done when the modulefunction is removed from a vessel should be implemented in an overload of this function.

Parameters
vesselThe vessel the module is to be added to
Note
This function gets called every time the module is added to a new vessel, which happens on startup (whether loaded from scenario or not), at integration and at splitting.

Implements IMS_ModuleFunction_Base.

GUI_ModuleFunction_Base * IMS_ModuleFunction_Thruster::GetGui ( )
virtual

returns the GUI of this module function, or NULL if this module function doesn't have a user interface.

Note
Overload this function to return the specific GUI of your module function, otherwise the core will think that the module function has no user input.

Reimplemented from IMS_ModuleFunction_Base.

vector< THRUSTEREXHAUST > IMS_ModuleFunction_Thruster::getRelativeExhausts ( )
protected
Returns
A vector with the thrusters exhausts with vessel-relative position and direction
void IMS_ModuleFunction_Thruster::PostLoad ( )
virtual
void IMS_ModuleFunction_Thruster::PreStep ( double  simdt,
IMS2 *  vessel 
)
virtual

gets called at every clbkPreStep of the containing vessel.

Parameters
simdtelapsed time since the last frame
vesselthe vessel this module function belongs to

Reimplemented from IMS_ModuleFunction_Base.

bool IMS_ModuleFunction_Thruster::ProcessEvent ( Event_Base e)
protectedvirtual

Receives all events coming through this EventHandler.

Overload to implement event handling in your inheriting class. The function will receive Events one by one as they are coming through your event sinks, regardless of which pipe they belong to. Return true to consume an event, but be sure it was only meant for you when you do that.

Parameters
eThe event coming through the event pipe
Note
Event generators will NOT send events to this function, only sinks.

Implements EventHandler.

bool IMS_ModuleFunction_Thruster::processScenarioLine ( string  line)
protectedvirtual

receives all scenario lines concerning this modulefunction, one after the other.

Parameters
lineA string object containing the line read from the scenario use this function to implement state initialisation when your module function is loaded from scenario

Implements IMS_ModuleFunction_Base.

void IMS_ModuleFunction_Thruster::RemoveFunctionFromVessel ( IMS2 *  vessel)
virtual

Everything that needs to be done when the module is removed from a vessel should be implemented in an overload of this function.

Parameters
vesselThe vessel the module is being removed from
Note
This function only gets called on splitting, one frame before AddFunctionToVessel() is called to add it to the new vessel

Implements IMS_ModuleFunction_Base.

void IMS_ModuleFunction_Thruster::SaveState ( FILEHANDLE  scn)
virtual

overload to save modulefunction specific stuff to scenario.

Parameters
scnthe FILEHANDLE to the opened scenario file
Note
The BEGIN_MODULEFUNC and END_MODULEFUNC tags are written by the module, so you really just have to write the data.

Implements IMS_ModuleFunction_Base.

void IMS_ModuleFunction_Thruster::SetThrusterGroup ( int  thrustergroup)
virtual

Sets the thrusters control group.

Parameters
thrustergroupThe value of a THGROUP_TYPE identifier, or -1 if the thruster is removed from all groups
void IMS_ModuleFunction_Thruster::SetThrusterMode ( int  modeidx)
virtual

sets the thruster mode of the thruster.

Parameters
modeidxThe index the desired mode has in the thrusters modes list.

The documentation for this class was generated from the following files: