Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
Expansions.Serenity.ModuleRoboticServoHinge Class Reference
Inheritance diagram for Expansions.Serenity.ModuleRoboticServoHinge:
Expansions.Serenity.BaseServo IMultipleDragCube PartModule IResourceConsumer IPartCostModifier IPartMassModifier IAxisFieldLimits IJointLockState IConstruction

Public Member Functions

void AssumeDragCubePosition (string name)
 Used by the DragCubeSystem when it is generating drag cube entries on startup if none are found for this module. When called the module should set it's model position/setup to match the expected position/orientation when 'name' drag cube is active. More...
 
string[] GetDragCubeNames ()
 Should return an array of strings that are the drag cube names that this module implements. More...
 
override string GetInfo ()
 Returns formatted string of additional data for use in the VAB and SPH More...
 
override string GetModuleDisplayName ()
 Returns the display name for the module. More...
 
override void OnCopy (PartModule fromModule)
 Use OnCopy to copy any additional data from the PartModule provided More...
 
override void OnInventoryModeDisable ()
 This method will be called when this modules part and itself is first disabled (when it is not attached to a vessel) when created in Inventory/Construction mode. More...
 
override void OnInventoryModeEnable ()
 This method will be called when this modules part and itself is first enabled (when it is attached to a vessel) when created in Inventory/Construction mode. More...
 
override void OnModifyServo ()
 Updates the values of a PhysX servoJoint in Flight, including enabling/disabling the servoJoint. Is called when The KSPField values are modified for this PartModule. More...
 
override void OnPreModifyServo ()
 Updates the values of a servo in both scenes. Is called when The PAW values are modified for this PartModule. More...
 
override void OnStart (PartModule.StartState state)
 
void SetMaximumAngle ()
 Set the Hinge to its MaximujmLimit More...
 
void SetMinimumAngle ()
 Set the Hinge to its Minimum Limit More...
 
bool UsesProceduralDragCubes ()
 Used by the DragCubeSystem when it is generating drag cube entries on startup if none are found for this module. Should return true if this module is to use procedural drag cubes and false if it is to generate drag cubes for the drag cube names returned in GetDragCubeNames method. More...
 
- Public Member Functions inherited from Expansions.Serenity.BaseServo
Rigidbody AttachServoRigidBody (AttachNode node)
 Returns the Rigidbody for the Servo Part that Joint Should connect to when this Part is the Parent for the Joint. More...
 
GameObject BaseObject ()
 
virtual bool CanBeDetached ()
 Returns true if not moving. More...
 
virtual bool CanBeOffset ()
 Returns true if not moving. More...
 
virtual bool CanBeRotated ()
 Returns true if not moving. More...
 
override void DemoteToPhysicslessPart ()
 This method will be called from Part class DemoteToPhysicslessPart when the part is being converted from physical to physicsless part. It is called before the joints and rigidbodies are destroyed. More...
 
void DisengageMotor ()
 Disengage the motor drive More...
 
void DisengageServoLock ()
 Disengage the Lock on this robotic part More...
 
void EngageMotor ()
 Engage the motor drive More...
 
bool EngageServoLock ()
 Engage the Lock on this robotic part More...
 
AxisFieldLimit GetAxisFieldLimit (string fieldName)
 Get an AxisFieldLimit for a specific axisField More...
 
List< AxisFieldLimitGetAxisFieldLimits ()
 Get the list of AxisFieldLimit for AxisFields with hard/soft limits More...
 
List< PartResourceDefinitionGetConsumedResources ()
 
Vector2 GetHardLimits (string fieldName)
 Get the HardLimits for the named field More...
 
Vector3 GetMainAxis ()
 
float GetModuleCost (float defaultCost, ModifierStagingSituation sit)
 Return the amount to modify the original part's dry cost by. Returned values are added to the base cost. (0 means no effect) More...
 
ModifierChangeWhen GetModuleCostChangeWhen ()
 Return under which circumstances the modulecost changes More...
 
float GetModuleMass (float defaultMass, ModifierStagingSituation sit)
 Return the amount to modify the original part's dry mass by. Returned values are added to the base mass. (0 means no effect) More...
 
ModifierChangeWhen GetModuleMassChangeWhen ()
 Return under which circumstances the modulemass changes More...
 
Vector2 GetSoftLimits (string fieldName)
 Get the SoftLimits for the named field More...
 
bool HasAxisFieldLimit (string fieldName)
 Does this partmodule have an AxisField of this name with hard/soft limits More...
 
bool HasAxisFieldLimits ()
 Does this partmodule have any AxisFields with hard/soft limits More...
 
bool IsJointUnlocked ()
 Return the part joint state More...
 
GameObject MovingObject ()
 
Rigidbody NodeRigidBody (AttachNode node)
 
override void OnAwake ()
 Method fires once the module has been added to the part. Use for first time setup. Module will not have loaded fully by this point More...
 
override void OnLoad (ConfigNode node)
 Use OnLoad to load any additional data from the ConfigNode provided More...
 
override void OnSave (ConfigNode node)
 Use OnSave to serialize additional module information into the ConfigNode provided More...
 
override void OnStart (PartModule.StartState state)
 
override void OnStartBeforePartAttachJoint (StartState modStartState)
 Called in flight scene in Part.Start just before the Part attachnode joints are created. More...
 
override void PromoteToPhysicalPart ()
 This method will be called from Part class PromoteToPhysicalPart when the part is being converted from physicsless to physical part. More...
 
bool ServoTransformCollider (string colName)
 
void SetHardLimits (string fieldName, Vector2 newLimits)
 Set the HardLimits for the named field More...
 
virtual void SetLaunchPosition (float val)
 Save the launch position. More...
 
void SetSoftLimits (string fieldName, Vector2 newLimits)
 set the HardLimits for the named field More...
 
- Public Member Functions inherited from PartModule
void AddPartModuleAdjuster (AdjusterPartModuleBase newAdjuster)
 Call this to add an adjuster to this part module. More...
 
void AddPartModuleAdjusterList (List< AdjusterPartModuleBase > moduleAdjusters)
 Applies the appropriate module adjusters. Performs checks to make sure that the adjusters are valid too. More...
 
bool AppliedUpgrades ()
 Returns true if upgrades are applied More...
 
void ApplyAdjustersOnStart ()
 Called when a part module is loaded and applies all of the currently loaded adjusters. More...
 
virtual void ApplyUpgradeNode (List< string > appliedUps, ConfigNode node, bool doLoad)
 Applies the upgrades to a confignode. Will either copy the upgrades back to the node or (if doLoad) calls load/onload on it. More...
 
virtual bool ApplyUpgrades (StartState state)
 Will find and apply upgrades. Called during Part's ModulesOnStart, before a module's OnStart. More...
 
void Awake ()
 
delegate bool boolPMApplyUpgrades (PartModule pm, StartState state)
 
delegate bool boolPMBoolDelegate (PartModule pm, bool apply)
 
void ClearPersistentId ()
 Clear the modules persistentId More...
 
void Copy (PartModule fromModule)
 
virtual bool FindUpgrades (bool fillApplied, ConfigNode node=null)
 Find applicable upgrades to the partmodule (isunlocked and isenabled) and add to the upgradesApplied list. Pass true if you want to add the upgrades to upgradesApplied, false if you just want to know if at least one upgrade is applicable (unlocked rather than enabled) More...
 
virtual Color GetCurrentColor ()
 Returns the current part module color. More...
 
virtual Color GetCurrentColor (string fieldName)
 Returns the current part module color for a field where usespe. More...
 
uint GetPersistenActiontId ()
 Get the modules persistentID, and create one if it doesnt already have one More...
 
uint GetPersistentId ()
 Get the modules persistentID, and create one if it doesnt already have one More...
 
virtual string GetStagingDisableText ()
 
virtual string GetStagingEnableText ()
 
virtual string GetUpgradeInfo ()
 Called by Upgrade Stats dialog More...
 
bool HasUpgrades ()
 Returns true if upgrades exist for the partmodule More...
 
virtual bool IsStageable ()
 Should this module be counted when seeing whether to have a stack icon present? Override in a module for custom behavior; otherwise returns true if the module (or something the module inherits from above PartModule itself) overrides OnActive() More...
 
bool IsValidContractObjective (string objectiveType)
 Returns if, for example, an antenna part module qualifies as an antenna for contracts. More...
 
void Load (ConfigNode node)
 
virtual void LoadUpgrades (ConfigNode node)
 Loads module-relevant upgrades from the partmodule confignode More...
 
uint NewPersistentId ()
 Reset the modules persistentId to a new number More...
 
virtual void OnActive ()
 Called when the part is set active (after unpacking etc) More...
 
virtual void OnColorChanged (Color color)
 Meant to be overwritten by part modules implementing color changes. In this case, it doesn't matter which color picker changed specifically. More...
 
virtual void OnColorChanged (Color color, string pickerID="")
 Meant to be overwritten by part modules implementing color changes More...
 
virtual void OnConstructionModeFixedUpdate ()
 This method will be called when in EVA Construction mode and this part and itself is disabled (when it is not attached to a vessel) every FixedUpdate(). More...
 
virtual void OnConstructionModeUpdate ()
 This method will be called when in EVA Construction mode and this part and itself is disabled (when it is not attached to a vessel) every Update(). More...
 
virtual void OnIconCreate ()
 Method fires just before components are stripped from the gameobject to make it an icon. (The part is instantiated and then various components like Part, PartModule, EffectBehaviour, Colliders, Particles, etc are stripped and then it's set as the icon prefab. This lets PartModules do stuff to the model right before that happens. More...
 
virtual void OnInactive ()
 Called before the part goes inactive (after packing etc) More...
 
virtual void OnInitialize ()
 Called on all modules after all parts are loaded but before they give the ship to the game More...
 
void OnModuleAdjusterAddedWrapper (AdjusterPartModuleBase adjuster)
 Wrapper to check the mission expansion availability before performing processing specific to this part module when an adjuster is added. More...
 
virtual void OnModuleAdjusterRemoved (AdjusterPartModuleBase adjuster)
 Perform processing specific to this part module when an adjuster is removed. By default this does nothing is up to each part module to implement it properly. More...
 
virtual void OnPartCreatedFomInventory (ModuleInventoryPart moduleInventoryPart)
 This method is called when a part is being taken out from a slot while being in EVAConstruction mode. More...
 
virtual void OnStart (StartState state)
 Called when the part starts. The StartState gives an indication of where in flight you are. All values may not be plugged in! More...
 
virtual void OnStartFinished (StartState state)
 Called when the part finishes starting. The StartState gives an indication of where in flight you are. All values may not be plugged in! More...
 
virtual void OnStoredInInventory (ModuleInventoryPart moduleInventoryPart)
 Called when the part is stored in an inventory. More...
 
virtual void OnUpdate ()
 Called every frame that the part is active More...
 
virtual void OnWasCopied (PartModule copyPartModule, bool asSymCounterpart)
 Called when the PartModule was copied, through Alt+Copy or symmetry More...
 
virtual void OnWillBeCopied (bool asSymCounterpart)
 Called when the PartModule is about to be copied, through Alt+Copy or symmetry More...
 
virtual bool OnWillBeMirrored (ref Quaternion rotation, AttachNode selPartNode, Part partParent)
 This is called in the Editor scene when a symmetry copy of a part is being positioned. Only called on the symmetry parts and only when symmetry mode is set to Mirror. It allows the mirror rotation to be changed and returned before being applied to the symmetry copy part.

Parameters
rotationThe current calculated rotation. Will be updated if method returns true.
selPartNodeThe attachnode.
partParentThe part that will become this part's parent.
Returns
True if the rotation was changed. Otherwise will return false.
More...
 
virtual List< Color > PresetColors ()
 Preset colors received for any part module. By default, returns only black, override to make your own selection. More...
 
virtual string PrintUpgrades ()
 
void RemovePartModuleAdjuster (AdjusterPartModuleBase oldAdjuster)
 Call this to remove an adjuster from this part module. More...
 
void RemovePartModuleAdjusterList (List< AdjusterPartModuleBase > moduleAdjusters)
 Removes the appropriate module adjusters. Performs checks to make sure that the adjusters are valid too. More...
 
void Save (ConfigNode node)
 
virtual void SetStaging (bool newValue)
 Run by the part's staging toggle handler, sets staging on modules on symmetry counterparts. More...
 
void SetStagingState (bool newState)
 Set the staging enabled bool for this module. More...
 
virtual bool StagingEnabled ()
 Gets current staging status (is staging enabled for this module) Override me! More...
 
virtual bool StagingToggleEnabledEditor ()
 
virtual bool StagingToggleEnabledFlight ()
 
void ToggleStaging ()
 
virtual void UpdateStagingToggle ()
 Updates the staging toggle More...
 
delegate void voidPMApplyNodeDelegate (PartModule pm, List< string > appliedUps, ConfigNode node, bool doLoad)
 
delegate void voidPMDelegate (PartModule pm)
 
delegate void voidPMNodeDelegate (PartModule pm, ConfigNode node)
 

Public Attributes

float angularXLimitDamper = 0f
 The angular XLimit damper value More...
 
float angularXLimitSpring = 0f
 The angular XLimit spring value More...
 
float currentAngle
 This is the actual current Angle of the servo joint. More...
 
float displacementLimitIgnoreFrameDistance = 0.025f
 per frame angle displacmeent under which to check if we are against the limit More...
 
float displacementLimitIgnoreRange = 0.025f
 Angle amount in degrees at the end of the hinge limit where it is considered not moving More...
 
float driveDampingMutliplier = 20f
 This is the Drive Dampening Multiplier. The Joint X Drive position damper is set to: xxxxx More...
 
float driveSpringMutliplier = 100f
 This is the Drive Spring Multiplier. The Joint X Drive position spring is set to: xxxxxx More...
 
bool hideUIDamping = false
 Hide the Damping Slider in the PAW More...
 
bool hideUISoftMinMaxAngles = false
 Hide the Min/Max Angles UI component in Editor More...
 
bool hideUITraverseVelocity = false
 Hide the TraverseVelocity Slider in the PAW More...
 
float highAngularXLimitBounce = 0f
 The high angular XLimit bounciness More...
 
float highAngularXLimitSurf = 0f
 The high angular XLimit contactDistance More...
 
float hingeDamping = 100f
 This is the Hinge Damping set by the user. More...
 
float lowAngularXLimitBounce = 0f
 The low angular XLimit bounciness More...
 
float lowAngularXLimitSurf = 0f
 The low angular XLimit contactDistance More...
 
float maxAnglePerFrame
 
bool mirrorRotation = false
 The joint is the clone in a mirror symmetry pair and thus the joint angle is reversed. More...
 
float modelInitialAngle = 0f
 This is the difference between the 0 degree postion of the model and the 0 degree position of targetAngle eg an alligator hinges model 0 position is when the hinge is at a right angle, so we want the player to see 90 for teh targetAngle More...
 
float previousTargetAngle
 
Vector2 softMinMaxAngles = new Vector2(0f, 177f)
 This is the user defined maximum open and closed angles for the hinge. They are always less than or equal the mode defined hard limits More...
 
float targetAngle = 0f
 This is the desired current Target Angle set by the user. More...
 
float traverseVelocity = 90f
 The angular velocity at which the servo will rotate to the target angle. Expressed in degrees per second More...
 
- Public Attributes inherited from Expansions.Serenity.BaseServo
float baseResourceConsumptionRate = 0.001f
 Base resource consumption on motor output when the servo is moving More...
 
string baseTransformName = ""
 The Part base Transform Name in the Model. This will be the Transform that is the base of the part (not the Servo). More...
 
float connectedMassScale = 1f
 
float efficiency = 1
 Servo efficiency (1 = 100%) More...
 
Vector2 hardMinMaxLimits = new Vector2(0f, 180f)
 The angle range that's defined by the physical limits of the part model and/or the part's designer. A player must not be able to set an angle beyond this range. More...
 
bool hideUIServoIsMotorized = false
 Hide the Servo Is motorized choice in Editor More...
 
bool hideUIServoMotorLimit = false
 Hide the Servo motor limit slider in flight More...
 
bool hideUIServoMotorSize = false
 Hide the Servo motor size slider in Editor More...
 
string jointParentName = "JointParent"
 Name of the joint parent transform (parent of base and moving parts) More...
 
Quaternion jointParentRotation
 
float launchPosition
 The default angle/extension last set on a robotic part has assigned, before launch. More...
 
bool lockPartOnPowerLoss = true
 Is the servo motor receiving power and engaged with the joint More...
 
string mainAxis = "Z"
 The main Axis of the Servo that rotations will be performed around. More...
 
float maxMotorOutput = 100f
 This is the Drive Spring Multiplier. The Joint X Drive position spring is set to: driveSpringMultiplier * torqueLimit More...
 
float motorizedCostPerDriveUnit = 1f
 How much the servo costs per drive unit. Drive units are equal to the value given to PhysX as Joint X Drive position spring. More...
 
float motorizedMassPerKN = 0.1f
 How much the servo masses per KN. Drive units are equal to the value given to PhysX as Joint X Drive position spring. More...
 
string motorOutputInformation = ""
 Display that shows how much output the motor has (based off of max motor output) and how much it weighs. More...
 
string motorState = ""
 The Motor State More...
 
float referenceConsumptionVelocity = 90f
 The transform velocity (angular or positional) at which the resource consumption is 1 x the baseResourceConsumptionRate More...
 
string resourceConsumption = "0.0"
 Display that shows how much EC is being drained per tick. More...
 
ResourceConsumptionTypes resourceConsumptionMode = ResourceConsumptionTypes.CurrentVelocity
 What should the resource consumption be based on More...
 
string servoAttachNodes = ""
 A Comma separated list of AttachNodes that are part of the pivoting/rotating section of the servo. Any nodes listed will automatically be moved and rotated based on the movement of the servo. NOTE: This is only applied in the Editor scenes. More...
 
Vector3 servoCoMOffset = Vector3.zero
 Offset of the servo (moving part's) CoM from its transform. More...
 
string servoCurrentTorque
 The torque applied at the moment More...
 
bool servoIsLocked = false
 Is the servo motor receiving power and engaged with the joint More...
 
bool servoIsMotorized = true
 Is the servo receiving equipped with a motor More...
 
float servoMass = 0.1f
 The Mass of the Servo. More...
 
bool servoMotorIsEngaged = true
 Is the servo motor receiving power and engaged with the joint More...
 
float servoMotorLimit = 100f
 Lowers the output of the servo to less than maximum built size in editor More...
 
float servoMotorSize = 100f
 Lowers the size of the servo in editor scene as you build More...
 
string servoName = "Servo_0"
 The Name of the Servo More...
 
string servoSrfMeshNames = ""
 A comma separated list of Mesh/collider transform Names that are part of the pivoting/rotation section of the servo. Any parts that are surface attached to these colliders will be pivoted/rotated based on the movement of the ervo. More...
 
string servoTransformName = ""
 The Servo Transform Name in the Model. This will be the Transform the Servo will be attached to. More...
 
Vector3 servoTransformPosition
 Persists the servo Transform LocalPosition More...
 
Quaternion servoTransformRotation
 Persists the servo Transform LocalRotation More...
 
Vector2 traverseVelocityLimits = new Vector2(0.1f, 10f)
 The minimum and maximum traverse speeds (in m/s for linear motion and deg/s for rotational motion, rpm for rotors) More...
 
bool useLimits = false
 Set to true to use Hard Limits on the angles. More...
 
bool useMultipleDragCubes
 Set True to use multiple Drag Cubes. More...
 
- Public Attributes inherited from PartModule
bool isEnabled = true
 
bool moduleIsEnabled = true
 
string moduleName
 
bool overrideStagingIconIfBlank = true
 
ModuleResourceHandler resHandler = new ModuleResourceHandler()
 
bool showUpgradesInModuleInfo = false
 
ProtoPartModuleSnapshot snapshot
 
string stagingDisableText = ""
 
bool stagingEnabled = true
 
string stagingEnableText = ""
 
bool stagingToggleEnabledEditor = false
 
bool stagingToggleEnabledFlight = false
 
List< ConfigNodeupgrades
 
List< string > upgradesApplied = new List<string>()
 
bool upgradesApply = true
 
bool upgradesAsk = true
 

Protected Member Functions

override float GetFrameDisplacement ()
 Checks how much the hinge angle changed in one frame More...
 
override void InitAxisFieldLimits ()
 
override bool IsMoving ()
 Is the servo currently moving/traversing? More...
 
void MaximumAngleAction (KSPActionParam param)
 
void MinimumAngleAction (KSPActionParam param)
 
void ModifyLimits (object field)
 
void ModifyTraverseLimits (object field)
 
override void OnDestroy ()
 
override void OnFixedUpdate ()
 Called every physics/fixed frame that the part is active More...
 
override void OnJointInit (bool goodSetup)
 Called after BaseServo Joint Initialized and before Part attachJoint has been created. More...
 
override void OnPostStartJointInit ()
 Called after OnJointInit and the Part attachJoint has been created. More...
 
void OnResourceNonemptyEmpty (PartResource resource)
 Hook for when EC runs out More...
 
override void OnSaveShip (ShipConstruct ship)
 When Ship is saved - we must apply orgPos and orgRot changes to the parts. More...
 
override void OnServoLockApplied ()
 Called when the servo lock is about to be applied More...
 
override void OnServoLockRemoved ()
 Called when the servo lock is about to be removed More...
 
override void OnServoMotorDisengaged ()
 Called when the servo lock is about to be removed More...
 
override void OnServoMotorEngaged ()
 Called when the servo lock is about to be applied More...
 
override void OnVisualizeServo (bool rotateBase)
 Updates the transform of a robotic part in the editor scenes, so users can visualize rotations. Is called when The KSPField values are modified for this PartModule. More...
 
override void ResetLaunchPosition ()
 Resets the launch position of the part. Needs to be overriden by part to acomodate it's parameters. More...
 
override void SetInitialDisplacement ()
 Sets the initial transform angle for previousDisplacement More...
 
Quaternion SetTargetRotation (Quaternion startingRotation, float rotationAngle, bool setRotation)
 
void ToggleHingeAction (KSPActionParam param)
 
override void UpdateAxisFieldHardLimit (string fieldName, Vector2 newlimits)
 
override void UpdateAxisFieldSoftLimit (string fieldName, Vector2 newlimits)
 
override void UpdatePAWUI (UI_Scene currentScene)
 
- Protected Member Functions inherited from Expansions.Serenity.BaseServo
virtual void ApplyCoordsUpdate ()
 Applies Part Coordinate Updates. Can be overridden to apply appropriate changes to Part positions/rotations and components (servo transforms within a Part). Will be called when a Part is Unpacked, Vessel is Modified, and just before a ShipConstruct is saved. More...
 
void CalculateAverageRateOfMovement ()
 Uses the readings from GetFrameDisplacement to determine the average rate of change in the part's transform More...
 
virtual double CalculatePower ()
 Calculates the current power consumption in kW More...
 
virtual void CalculateResourceDrain ()
 Calculates the current resource drain rate and determines if there's still enough More...
 
void CreateServoRigidbody ()
 If the movingPartObject is set will set movingPartRB or add a RigidBody to the movingPartObject and set it's parameters and mass. More...
 
float currentTransformAngle ()
 
float currentTransformPosition ()
 
void FixedUpdate ()
 Handles resource requests More...
 
void InitJoint ()
 Initializes the Servo Joint. Assumes the servoJoint is the Part.attachJoint.Joint. This can be overridden/changed in OnJointInit for specific servo being implemented using this class, which is called at the end of this method. In OnJointInit you will need to set servoJoint, axis, secAxis, initialOrentation, lastOrientation and pivot. PostStartInitJoint() and OnPostStartJointInit() are called AFTER the Part has created it's Part.attachJoint. More...
 
void ManuallyModifyEngaged (object field)
 
void ModifyEngaged (object field)
 
void ModifyLocked (object field)
 
void ModifyServo (object field)
 Call this to Update the Servo rotation. Will Call VisualizeServo or OnUpdateServo. More...
 
void MotorOffAction (KSPActionParam param)
 
void MotorOnAction (KSPActionParam param)
 
void OnEditorCompoundPartLinked (CompoundPart linkedPart)
 
void OnEditorPartPicked (Part pickedPart)
 
void OnEditorPartPlaced (Part placedPart)
 
void OnPartMenuClose (Part inpPart)
 
void OnPartMenuOpen (UIPartActionWindow window, Part inpPart)
 
void PostStartInitJoint ()
 Completes the Initialize of the Servo Joint. sets the pJoint (part.attachJoint reference) and assigns it to the servoJoint ONLY if it hasn't already been assigned in InitJoint/OnJointInit. Connects the rigidbod to the joint and moves/rotates the moving part to ensure we dont hit Unity Angular Joint Limit Madness Will then call OnPostStartJointInit() In OnPostStartJointInit you will need to set any target values to their initial start ones and call ModifyServo amd set any init complete flags. More...
 
virtual void RecurseAttachNodeUpdate (Part p)
 Will start at the passed in Part and then recurse (through all children) looking for BaseServo Parts. For each BaseServo Part found will update the attach Nodes (on the moving servo transform) position and orientation. Will do nothing is ServoInitComplete is false. More...
 
virtual void RecurseCoordUpdate (Part p, Part rootPart)
 Sets Part orgPos and orgRot. Is called at the end of ApplyCoordsUpdate(). More...
 
void ResetPosition (KSPActionParam param)
 
void ResetPosition ()
 
void RestoreSpanningPartTargets ()
 
void SaveSpanningPartTargets ()
 
void ServoDisgageLockAction (KSPActionParam param)
 
void ServoEngageLockAction (KSPActionParam param)
 
void SetServoMass ()
 
void ToggleMotorAction (KSPActionParam param)
 
void ToggleServoLockedAction (KSPActionParam param)
 
virtual void Update ()
 
void UpdateAxisFieldLimit (string fieldName, Vector2 hardLimits, Vector2 softLimits)
 
float UpdateFieldLimits (BaseAxisField axisField, Vector2 newlimits, float currentValue, UI_FloatRange uiField=null)
 Change a fields limits and update the associated bits More...
 
void VisualizeServo (bool moveChildren)
 
- Protected Member Functions inherited from PartModule
ConfigNode GetUpgrade (string name)
 
virtual void LoadUpgradesApplied (List< string > applieds, ConfigNode node)
 Load the applied upgrade names More...
 
virtual void OnModuleAdjusterAdded (AdjusterPartModuleBase adjuster)
 Perform processing specific to this part module when an adjuster is added. By default this does nothing is up to each part module to implement it properly. More...
 
virtual void SaveUpgradesApplied (ConfigNode node)
 Save the applied upgrades. More...
 
IEnumerator UpgradeWaitForScenarioModules ()
 

Protected Attributes

Quaternion editorRotation
 
bool initComplete = false
 
float lockedTargetAngle
 
SoftJointLimit lowerLimit
 
UI_MinMaxRange softRangeField
 
BaseAxisField targetAngleAxisField
 
UI_FloatRange targetAngleUIField
 
BaseAxisField traverseVelocityAxisField
 
UI_FloatRange traverseVelocityUIField
 
SoftJointLimit upperLimit
 
JointDrive xDrive
 
SoftJointLimitSpring xSpringLimit
 
- Protected Attributes inherited from Expansions.Serenity.BaseServo
List< AttachNodeattachNodes
 
Vector3 axis
 
DictionaryValueList< string,
AxisFieldLimit
axisFieldLimits
 
GameObject basePartObject
 
Quaternion cachedStartingRotation
 
float cachedStartingRotationOffset
 
float driveUnit
 The size of the drive = maxMotorSize * servoMotorSize * 0.01f More...
 
bool hasEnoughResources
 
Transform jointParent
 The joint parent transform (parent of base and moving parts) More...
 
float lockAngle
 
bool motorManualDisengaged = false
 
float motorOutput
 The actual motorOutupt = driveUnit * servoMotorLimit * 0.01f More...
 
GameObject movingPartObject
 
Rigidbody movingPartRB
 
string OutputUnit
 
bool partIsPhysicsLess = false
 Will be set to true when the part is made physicsless and skips Update and FixedUpdate processing. This happens when the part is being manipulated in EVA construction mode. More...
 
Vector3 pivot
 
bool prevServoIsLocked
 
bool prevServoIsMotorized
 
bool prevServoMotorIsEngaged
 
double rate = 0d
 
bool servoIsBraking = false
 
ConfigurableJoint servoJoint
 This is the Joint for this Servo on the Part. More...
 
UI_FloatRange servoMotorLimitField
 
UI_FloatRange servoMotorSizeField
 
Matrix4x4 servoParentTransform
 This is the transform from the servo part FoR (ie, the moving part's parent's FoR) to the part FoR More...
 
Matrix4x4 servoParentTransformInverse
 This is the transform from the part FoR to the servo part FoR (ie, the moving part's parent's FoR) (or, the inverse of servoParentTransform) More...
 
string[] servoSrfMeshes
 
Quaternion targetRotation
 

Properties

bool IsMultipleCubesActive [get]
 
float JointTargetAngle [get]
 This is the target for the joint drive after applying any logic like inversion/offsets and clamping between the limits More...
 
- Properties inherited from Expansions.Serenity.BaseServo
float CurrentVelocityLimit [get]
 The current veloctiy limit of the joint. More...
 
bool HasEnoughResources [get]
 Are there enough resources to keep the servo going? More...
 
Callback< AxisFieldLimitLimitsChanged [get, set]
 
PartJoint pJoint [get, set]
 This is the Part Joint (Part.attachJoint) More...
 
bool ServoInitComplete [get]
 Set to true once the Servo has completed Initialization at start. More...
 
- Properties inherited from PartModule
BaseActionList Actions [get]
 
int ClassID [get]
 
string ClassName [get]
 
List< AdjusterPartModuleBaseCurrentModuleAdjusterList [get]
 List of all the module adjusters that are currently active on this part module. More...
 
BaseEventList Events [get]
 
BaseFieldList Fields [get]
 
string GUIName [get]
 
bool HasAdjusters [get]
 Has this part module been adjusted? More...
 
ReflectedAttributes ModuleAttributes [get, set]
 
Part part [get, set]
 
uint PersistentActionsId [get, set]
 A unique identifier for each vessel including from when it was Shipconstruct More...
 
uint PersistentId [get]
 A unique identifier for each vessel including from when it was Shipconstruct More...
 
Vessel vessel [get]
 
- Properties inherited from IAxisFieldLimits
Callback< AxisFieldLimitLimitsChanged [get, set]
 Callback function that should be triggered when an AxisField Limit changes More...
 
- Properties inherited from IMultipleDragCube
bool IsMultipleCubesActive [get]
 Used by the DragCubeSystem when it is generating drag cube entries on startup if none are found for this module. Should return true if multiple drag cubes are expected to be generated for the part this module is a part of or false if not. More...
 

Additional Inherited Members

- Public Types inherited from Expansions.Serenity.BaseServo
enum  ResourceConsumptionTypes { ResourceConsumptionTypes.VelocityLimit, ResourceConsumptionTypes.CurrentVelocity }
 
- Public Types inherited from PartModule
enum  PartUpgradeState { PartUpgradeState.NONE, PartUpgradeState.LOCKED, PartUpgradeState.AVAILABLE }
 
enum  StartState {
  StartState.None = 0, StartState.Editor = 1, StartState.PreLaunch = 2, StartState.Landed = 4,
  StartState.Docked = 8, StartState.Flying = 16, StartState.Splashed = 32, StartState.SubOrbital = 64,
  StartState.Orbital = 128
}
 
- Static Public Member Functions inherited from Expansions.Serenity.BaseServo
static void CacheLocalStrings ()
 
- Static Public Member Functions inherited from PartModule
static ReflectedAttributes GetReflectedAttributes (Type partModuleType)
 
static PartUpgradeState UpgradesAvailable (Part part)
 Returns true if at least one module on the part has at least one upgrade available (isUnlocked) More...
 
static PartUpgradeState UpgradesAvailable (Part part, ConfigNode node)
 Returns true if at least one module on the part has at least one upgrade available (isUnlocked) More...
 
- Static Public Attributes inherited from PartModule
static voidPMApplyNodeDelegate ApplyUpgradeNodeDel
 
static boolPMApplyUpgrades ApplyUpgradesDel
 
static bool ApplyUpgradesEditorAuto = true
 
static boolPMBoolDelegate FindUpgradesDel
 
static voidPMNodeDelegate LoadExpansionNodes
 Hook for loading extra nodes common to all part modules. More...
 
static voidPMNodeDelegate LoadUpgradesDel
 
static voidPMNodeDelegate SaveExpansionNodes
 Hook for saving extra nodes common to all part modules. More...
 
static voidPMDelegate SetupExpansion
 Hook for performing extra setup common to all part modules. More...
 
static string UpgradesAvailableString = "#autoLOC_6002273"
 
static string UpgradesLockedString = "#autoLOC_6002274"
 
- Static Protected Attributes inherited from PartModule
static Dictionary< string,
ConfigNode
exclusives = new Dictionary<string, ConfigNode>()
 
static Dictionary< Type,
ReflectedAttributes
reflectedAttributeCache = new Dictionary<Type, ReflectedAttributes>()
 

Member Function Documentation

void Expansions.Serenity.ModuleRoboticServoHinge.AssumeDragCubePosition ( string  name)
inline

Used by the DragCubeSystem when it is generating drag cube entries on startup if none are found for this module. When called the module should set it's model position/setup to match the expected position/orientation when 'name' drag cube is active.

Parameters
nameThe name of the drag cube to assume the position/setup for.

Implements IMultipleDragCube.

string [] Expansions.Serenity.ModuleRoboticServoHinge.GetDragCubeNames ( )
inline

Should return an array of strings that are the drag cube names that this module implements.

Returns

Implements IMultipleDragCube.

override float Expansions.Serenity.ModuleRoboticServoHinge.GetFrameDisplacement ( )
inlineprotectedvirtual

Checks how much the hinge angle changed in one frame

Returns
the angle difference among previous and current frame, in degrees

Implements Expansions.Serenity.BaseServo.

override string Expansions.Serenity.ModuleRoboticServoHinge.GetInfo ( )
inlinevirtual

Returns formatted string of additional data for use in the VAB and SPH

Returns

Reimplemented from Expansions.Serenity.BaseServo.

override string Expansions.Serenity.ModuleRoboticServoHinge.GetModuleDisplayName ( )
inlinevirtual

Returns the display name for the module.

Returns
The display name for the module.

Reimplemented from PartModule.

override void Expansions.Serenity.ModuleRoboticServoHinge.InitAxisFieldLimits ( )
inlineprotectedvirtual
override bool Expansions.Serenity.ModuleRoboticServoHinge.IsMoving ( )
inlineprotectedvirtual

Is the servo currently moving/traversing?

Returns

Implements Expansions.Serenity.BaseServo.

void Expansions.Serenity.ModuleRoboticServoHinge.MaximumAngleAction ( KSPActionParam  param)
inlineprotected
void Expansions.Serenity.ModuleRoboticServoHinge.MinimumAngleAction ( KSPActionParam  param)
inlineprotected
void Expansions.Serenity.ModuleRoboticServoHinge.ModifyLimits ( object  field)
inlineprotected
void Expansions.Serenity.ModuleRoboticServoHinge.ModifyTraverseLimits ( object  field)
inlineprotected
override void Expansions.Serenity.ModuleRoboticServoHinge.OnCopy ( PartModule  fromModule)
inlinevirtual

Use OnCopy to copy any additional data from the PartModule provided

Parameters
fromModule

Reimplemented from Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnDestroy ( )
inlineprotectedvirtual

Reimplemented from Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnFixedUpdate ( )
inlineprotectedvirtual

Called every physics/fixed frame that the part is active

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnInventoryModeDisable ( )
inlinevirtual

This method will be called when this modules part and itself is first disabled (when it is not attached to a vessel) when created in Inventory/Construction mode.

Reimplemented from PartModule.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnInventoryModeEnable ( )
inlinevirtual

This method will be called when this modules part and itself is first enabled (when it is attached to a vessel) when created in Inventory/Construction mode.

Reimplemented from PartModule.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnJointInit ( bool  goodSetup)
inlineprotectedvirtual

Called after BaseServo Joint Initialized and before Part attachJoint has been created.

Parameters
goodSetup

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnModifyServo ( )
inlinevirtual

Updates the values of a PhysX servoJoint in Flight, including enabling/disabling the servoJoint. Is called when The KSPField values are modified for this PartModule.

Returns

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnPostStartJointInit ( )
inlineprotectedvirtual

Called after OnJointInit and the Part attachJoint has been created.

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnPreModifyServo ( )
inlinevirtual

Updates the values of a servo in both scenes. Is called when The PAW values are modified for this PartModule.

Returns

Implements Expansions.Serenity.BaseServo.

void Expansions.Serenity.ModuleRoboticServoHinge.OnResourceNonemptyEmpty ( PartResource  resource)
inlineprotected

Hook for when EC runs out

override void Expansions.Serenity.ModuleRoboticServoHinge.OnSaveShip ( ShipConstruct  ship)
inlineprotectedvirtual

When Ship is saved - we must apply orgPos and orgRot changes to the parts.

Parameters
ship

Reimplemented from Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnServoLockApplied ( )
inlineprotectedvirtual

Called when the servo lock is about to be applied

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnServoLockRemoved ( )
inlineprotectedvirtual

Called when the servo lock is about to be removed

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnServoMotorDisengaged ( )
inlineprotectedvirtual

Called when the servo lock is about to be removed

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnServoMotorEngaged ( )
inlineprotectedvirtual

Called when the servo lock is about to be applied

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.OnStart ( PartModule.StartState  state)
inline
override void Expansions.Serenity.ModuleRoboticServoHinge.OnVisualizeServo ( bool  rotateBase)
inlineprotectedvirtual

Updates the transform of a robotic part in the editor scenes, so users can visualize rotations. Is called when The KSPField values are modified for this PartModule.

Returns

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.ResetLaunchPosition ( )
inlineprotectedvirtual

Resets the launch position of the part. Needs to be overriden by part to acomodate it's parameters.

Implements Expansions.Serenity.BaseServo.

override void Expansions.Serenity.ModuleRoboticServoHinge.SetInitialDisplacement ( )
inlineprotectedvirtual

Sets the initial transform angle for previousDisplacement

Implements Expansions.Serenity.BaseServo.

void Expansions.Serenity.ModuleRoboticServoHinge.SetMaximumAngle ( )
inline

Set the Hinge to its MaximujmLimit

void Expansions.Serenity.ModuleRoboticServoHinge.SetMinimumAngle ( )
inline

Set the Hinge to its Minimum Limit

Quaternion Expansions.Serenity.ModuleRoboticServoHinge.SetTargetRotation ( Quaternion  startingRotation,
float  rotationAngle,
bool  setRotation 
)
inlineprotected
void Expansions.Serenity.ModuleRoboticServoHinge.ToggleHingeAction ( KSPActionParam  param)
inlineprotected
override void Expansions.Serenity.ModuleRoboticServoHinge.UpdateAxisFieldHardLimit ( string  fieldName,
Vector2  newlimits 
)
inlineprotectedvirtual
override void Expansions.Serenity.ModuleRoboticServoHinge.UpdateAxisFieldSoftLimit ( string  fieldName,
Vector2  newlimits 
)
inlineprotectedvirtual
override void Expansions.Serenity.ModuleRoboticServoHinge.UpdatePAWUI ( UI_Scene  currentScene)
inlineprotectedvirtual

Reimplemented from Expansions.Serenity.BaseServo.

bool Expansions.Serenity.ModuleRoboticServoHinge.UsesProceduralDragCubes ( )
inline

Used by the DragCubeSystem when it is generating drag cube entries on startup if none are found for this module. Should return true if this module is to use procedural drag cubes and false if it is to generate drag cubes for the drag cube names returned in GetDragCubeNames method.

Returns

Implements IMultipleDragCube.

Member Data Documentation

float Expansions.Serenity.ModuleRoboticServoHinge.angularXLimitDamper = 0f

The angular XLimit damper value

float Expansions.Serenity.ModuleRoboticServoHinge.angularXLimitSpring = 0f

The angular XLimit spring value

float Expansions.Serenity.ModuleRoboticServoHinge.currentAngle

This is the actual current Angle of the servo joint.

float Expansions.Serenity.ModuleRoboticServoHinge.displacementLimitIgnoreFrameDistance = 0.025f

per frame angle displacmeent under which to check if we are against the limit

float Expansions.Serenity.ModuleRoboticServoHinge.displacementLimitIgnoreRange = 0.025f

Angle amount in degrees at the end of the hinge limit where it is considered not moving

Stuff for end of limits checking whether ewe shoudl zero out the measured velocity - basically protection for the joint bouncing off the limit endlessly. These are used as follows, if: a) the per frame displacement is less than this value - its small movements b) The target Angle is within this distance from the limit c) The current Angle is is within this distance from the limit (ie its at the target end) Then its considered to be not moving

float Expansions.Serenity.ModuleRoboticServoHinge.driveDampingMutliplier = 20f

This is the Drive Dampening Multiplier. The Joint X Drive position damper is set to: xxxxx

float Expansions.Serenity.ModuleRoboticServoHinge.driveSpringMutliplier = 100f

This is the Drive Spring Multiplier. The Joint X Drive position spring is set to: xxxxxx

Quaternion Expansions.Serenity.ModuleRoboticServoHinge.editorRotation
protected
bool Expansions.Serenity.ModuleRoboticServoHinge.hideUIDamping = false

Hide the Damping Slider in the PAW

bool Expansions.Serenity.ModuleRoboticServoHinge.hideUISoftMinMaxAngles = false

Hide the Min/Max Angles UI component in Editor

bool Expansions.Serenity.ModuleRoboticServoHinge.hideUITraverseVelocity = false

Hide the TraverseVelocity Slider in the PAW

float Expansions.Serenity.ModuleRoboticServoHinge.highAngularXLimitBounce = 0f

The high angular XLimit bounciness

float Expansions.Serenity.ModuleRoboticServoHinge.highAngularXLimitSurf = 0f

The high angular XLimit contactDistance

float Expansions.Serenity.ModuleRoboticServoHinge.hingeDamping = 100f

This is the Hinge Damping set by the user.

bool Expansions.Serenity.ModuleRoboticServoHinge.initComplete = false
protected
float Expansions.Serenity.ModuleRoboticServoHinge.lockedTargetAngle
protected
float Expansions.Serenity.ModuleRoboticServoHinge.lowAngularXLimitBounce = 0f

The low angular XLimit bounciness

float Expansions.Serenity.ModuleRoboticServoHinge.lowAngularXLimitSurf = 0f

The low angular XLimit contactDistance

SoftJointLimit Expansions.Serenity.ModuleRoboticServoHinge.lowerLimit
protected
float Expansions.Serenity.ModuleRoboticServoHinge.maxAnglePerFrame
bool Expansions.Serenity.ModuleRoboticServoHinge.mirrorRotation = false

The joint is the clone in a mirror symmetry pair and thus the joint angle is reversed.

float Expansions.Serenity.ModuleRoboticServoHinge.modelInitialAngle = 0f

This is the difference between the 0 degree postion of the model and the 0 degree position of targetAngle eg an alligator hinges model 0 position is when the hinge is at a right angle, so we want the player to see 90 for teh targetAngle

float Expansions.Serenity.ModuleRoboticServoHinge.previousTargetAngle
Vector2 Expansions.Serenity.ModuleRoboticServoHinge.softMinMaxAngles = new Vector2(0f, 177f)

This is the user defined maximum open and closed angles for the hinge. They are always less than or equal the mode defined hard limits

UI_MinMaxRange Expansions.Serenity.ModuleRoboticServoHinge.softRangeField
protected
float Expansions.Serenity.ModuleRoboticServoHinge.targetAngle = 0f

This is the desired current Target Angle set by the user.

BaseAxisField Expansions.Serenity.ModuleRoboticServoHinge.targetAngleAxisField
protected
UI_FloatRange Expansions.Serenity.ModuleRoboticServoHinge.targetAngleUIField
protected
float Expansions.Serenity.ModuleRoboticServoHinge.traverseVelocity = 90f

The angular velocity at which the servo will rotate to the target angle. Expressed in degrees per second

BaseAxisField Expansions.Serenity.ModuleRoboticServoHinge.traverseVelocityAxisField
protected
UI_FloatRange Expansions.Serenity.ModuleRoboticServoHinge.traverseVelocityUIField
protected
SoftJointLimit Expansions.Serenity.ModuleRoboticServoHinge.upperLimit
protected
JointDrive Expansions.Serenity.ModuleRoboticServoHinge.xDrive
protected
SoftJointLimitSpring Expansions.Serenity.ModuleRoboticServoHinge.xSpringLimit
protected

Property Documentation

bool Expansions.Serenity.ModuleRoboticServoHinge.IsMultipleCubesActive
get
float Expansions.Serenity.ModuleRoboticServoHinge.JointTargetAngle
get

This is the target for the joint drive after applying any logic like inversion/offsets and clamping between the limits


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