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

This event serves to notify the vessel that something happened that requires it to shift its center of gravity. More...

Inheritance diagram for ShiftCGEvent:
Event_Timed Event_Base

Public Member Functions

 ShiftCGEvent (unsigned int miliseconds=10000)
 
- Public Member Functions inherited from Event_Timed
 Event_Timed (EVENTTYPE _type, unsigned int miliseconds)
 
- Public Member Functions inherited from Event_Base
 Event_Base (EVENTTYPE _type, unsigned int _delay=0)
 
EventHandlerGetCaller ()
 Returns the EventHandler at which this event originated.
 
virtual bool operator== (Event_Base *e)
 Compare whether two events are the same. More...
 
virtual bool operator!= (Event_Base *e)
 
virtual bool operator== (EVENTTYPE type)
 Allows to compare an event directly to an EVENTTYPE. More...
 
EVENTPIPE GetEventPipe ()
 

Additional Inherited Members

- Protected Member Functions inherited from Event_Timed
virtual bool sendMe ()
 Checks how much time has elapsed since the creation of the event. More...
 
- Protected Attributes inherited from Event_Base
unsigned int delay
 How many calls of ProcessEvents() on the event generator the event should be delayed.
 
EventHandlercaller
 Stores the EventHandler at which the event originated.
 
EVENTTYPE eventtype
 The type of this event.
 
EVENTPIPE pipe
 The pipe the event travels in (unless it was relayed). This is set by the EventHandler itself.
 

Detailed Description

This event serves to notify the vessel that something happened that requires it to shift its center of gravity.

Not to be confused with the CoGHasChanged event, which serves to tell everyone else that the CoG has been shifted and contains the data where to. This event contains no data and is pretty much useless for modules or module functions. It should therefore always be consumed by the vessel. Also, this event should only be generated by the vessel. Modules and module functions should send a MassHasChangedEvent and let the vessel take it from there. Otherwise, there will be multiple ShiftCGEvents coming in, leading to redundant code execution.

this event has a default delay of 10 seconds. This is because in many circumstances, like firing a thruster, the CoG technically changes every single frame, but shifting it around all the time is not useful, neither for cpu usage nor for stability. Some actions that can assumed to be momentary, like assembling or disassembling a vessel, can define a lower timer. Recommended in such cases is a delay of 1 miliseconds, which will fire the event in the next frame under any reasonable circumstances. a timer of 0 will lead to immediate propagation at time of creation and is not recommended.

See also
CoGHasChangedEvent
MassHasCHangedEvent
EventHandler.h

Constructor & Destructor Documentation

ShiftCGEvent::ShiftCGEvent ( unsigned int  miliseconds = 10000)
inline
Parameters
milisecondsDelay between event creation and event trigger in miliseconds

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