Module ship
This API is added by CC: VS and allows CC: Tweaked computers to access information from Valkyrien Skies Ships.
Functions
| getId () | Gets the Ship's ID |
| getSlug () | Gets the Ship's unique Slug |
| setSlug (name) | Sets the Ship's unique Slug |
| getMass () | Gets the Ship's total mass |
| isStatic () | Gets whether the Ship is static |
| getConstraints () | Gets the constraints on the Ship |
| getShipyardPosition () | Gets the Ship's Center of Mass in ship-local coordinates |
| getWorldspacePosition () | Gets the Ship's Center of Mass in world coordinates |
| transformPositionToWorld (pos) | Transforms a position from ship-local coordinates to world coordinates |
| getVelocity () | Gets the Ship's linear velocity |
| getOmega () | Gets the Ship's angular velocity |
| getScale () | Gets the Ship's scale |
| getQuaternion () | Gets the Ship's Quaternion |
| getTransformationMatrix () | Gets the Ship's Transformation Matrix |
| getMomentOfInertiaTensorToSave () | Gets the Moment of Inertia Tensor to be saved |
| getMomentOfInertiaTensor () | Gets the current Moment of Inertia Tensor |
| pullPhysicsTicks () | Pulls physics ticks for the Ship
This function blocks until the next physics tick event for the Ship is available. |
Extended Ship API
| setStatic (isStatic) | Sets the Ship to be static or dynamic |
| setScale (scale) | Sets the Ship's scale |
| teleport (data) | Teleports the Ship to a new position and orientation
This function instantly moves the Ship to the specified position and orientation. |
| applyInvariantForce (x, y, z) | Applies an invariant force to the Ship |
| applyInvariantTorque (x, y, z) | Applies an invariant torque to the Ship |
| applyInvariantForceToPos (fx, fy, fz, px, py, pz) | Applies an invariant force to the Ship at a specific position |
| applyRotDependentForce (x, y, z) | Applies a rotation-dependent force to the Ship |
| applyRotDependentTorque (x, y, z) | Applies a rotation-dependent torque to the Ship |
| applyRotDependentForceToPos (fx, fy, fz, px, py, pz) | Applies a rotation-dependent force to the Ship at a specific position |
Deprecated Methods
| getEulerAnglesZYX () | Gets the Ship's Euler Angles in ZYX order |
| getEulerAnglesZXY () | Gets the Ship's Euler Angles in ZXY order |
| getEulerAnglesYXZ () | Gets the Ship's Euler Angles in YXZ order |
| getEulerAnglesXYZ () | Gets the Ship's Euler Angles in XYZ order |
| getRoll () | Gets the Ship's Roll angle |
| getYaw () | Gets the Ship's Yaw angle |
| getPitch () | Gets the Ship's Pitch angle |
| getRotationMatrix () | Gets the Ship's Rotation Matrix |
Physics Ticks Event Data
| getBuoyancyFactor () | Gets the Ship's buoyancy factor during the physics tick |
| isStatic () | Whether the Ship is static during the physics tick |
| doFluidDrag () | Whether the Ship is affected by fluid drag during the physics tick |
| getInertiaData () | Gets the Ship's Inertia Data during the physics tick |
| getPoseVel () | Gets the Ship's Pose and Velocity during the physics tick |
| getForceInducers () | Gets the Force Inducers on the Ship during the physics tick |
Functions
- getId ()
-
Gets the Ship's ID
Returns:
-
number
The Ship ID
Raises:
This method errors if there is no Ship associated with the computer - getSlug ()
-
Gets the Ship's unique Slug
Returns:
-
string
The Ship's Slug
Raises:
This method errors if there is no Ship associated with the computerSee also:
- setSlug (name)
-
Sets the Ship's unique Slug
Parameters:
- name string The Ship's new Slug
Raises:
This method errors if there is no Ship associated with the computerSee also:
- getMass ()
-
Gets the Ship's total mass
Returns:
-
number
The Ship's mass
Raises:
This method errors if there is no Ship associated with the computer - isStatic ()
-
Gets whether the Ship is static
Returns:
-
boolean
Whether the Ship is static
Raises:
This method errors if there is no Ship associated with the computerSee also:
- getConstraints ()
-
Gets the constraints on the Ship
Returns:
-
table
A table of constraints on the Ship
Raises:
This method errors if there is no Ship associated with the computer - getShipyardPosition ()
-
Gets the Ship's Center of Mass in ship-local coordinates
Returns:
-
vector
The Ship's Center of Mass in the Shipyard
Raises:
This method errors if there is no Ship associated with the computerSee also:
- getWorldspacePosition ()
-
Gets the Ship's Center of Mass in world coordinates
Returns:
-
vector
The Ship's Center of Mass in Worldspace
Raises:
This method errors if there is no Ship associated with the computerSee also:
- transformPositionToWorld (pos)
-
Transforms a position from ship-local coordinates to world coordinates
Parameters:
- pos vector The position in ship-local coordinates
Returns:
-
vector
The position in world coordinates
Raises:
This method errors if there is no Ship associated with the computer - getVelocity ()
-
Gets the Ship's linear velocity
Returns:
-
vector
The Ship's linear velocity
Raises:
This method errors if there is no Ship associated with the computerSee also:
- getOmega ()
-
Gets the Ship's angular velocity
Returns:
-
vector
The Ship's angular velocity
Raises:
This method errors if there is no Ship associated with the computerSee also:
- getScale ()
-
Gets the Ship's scale
Returns:
-
vector
The Ship's scale
Raises:
This method errors if there is no Ship associated with the computerSee also:
- getQuaternion ()
-
Gets the Ship's Quaternion
Returns:
-
quaternion
The Ship's Quaternion
Raises:
This method errors if there is no Ship associated with the computer - getTransformationMatrix ()
-
Gets the Ship's Transformation Matrix
Returns:
-
matrix
The Ship's Transformation Matrix
Raises:
This method errors if there is no Ship associated with the computer - getMomentOfInertiaTensorToSave ()
-
Gets the Moment of Inertia Tensor to be saved
Returns:
-
matrix
The Ship's Moment of Inertia Tensor
Raises:
This method errors if there is no Ship associated with the computerSee also:
- getMomentOfInertiaTensor ()
-
Gets the current Moment of Inertia Tensor
Returns:
-
matrix
The Ship's Moment of Inertia Tensor
Raises:
This method errors if there is no Ship associated with the computerSee also:
- pullPhysicsTicks ()
-
Pulls physics ticks for the Ship
This function blocks until the next physics tick event for the Ship is available. It returns the event name and the physics ticks information.
Returns:
- string The event name
- ... Physics ticks information
Raises:
This method errors if there is no Ship associated with the computer
Extended Ship API
- setStatic (isStatic)
-
Sets the Ship to be static or dynamic
Parameters:
- isStatic boolean Whether the Ship should be static
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it. - setScale (scale)
-
Sets the Ship's scale
Parameters:
- scale number The new scale for the Ship
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it. - teleport (data)
-
Teleports the Ship to a new position and orientation
This function instantly moves the Ship to the specified position and orientation. It does not take into account any physics simulation and may result in unexpected behavior if the new position intersects with other objects or violates physics constraints.
Note: This function may cause physics instability if used improperly. Use with caution.
Parameters:
- data table The new position and orientation for the Ship
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it OR if this method is disabled in the configuration. - applyInvariantForce (x, y, z)
-
Applies an invariant force to the Ship An invariant force is applied in world coordinates and does not change with the Ship's rotation.
Parameters:
- x vector or number Either a vector representing the force, or the X component of the force
- y number or nil The Y component of the force (if x is a number)
- z number or nil The Z component of the force (if x is a number)
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it. - applyInvariantTorque (x, y, z)
-
Applies an invariant torque to the Ship An invariant torque is applied in world coordinates and does not change with the Ship's rotation.
Parameters:
- x vector or number Either a vector representing the torque, or the X component of the torque
- y number or nil The Y component of the torque (if x is a number)
- z number or nil The Z component of the torque (if x is a number)
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it. - applyInvariantForceToPos (fx, fy, fz, px, py, pz)
-
Applies an invariant force to the Ship at a specific position An invariant force is applied in world coordinates and does not change with the Ship's rotation.
Parameters:
- fx vector or number Either a vector representing the force, or the X component of the force
- fy vector or number Either a vector representing the position, or the Y component of the force
- fz number or nil The Z component of the force (if fx is a number)
- px number or nil The X component of the position (if pos is a number)
- py number or nil The Y component of the position (if pos is a number)
- pz number or nil The Z component of the position (if pos is a number)
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it. - applyRotDependentForce (x, y, z)
-
Applies a rotation-dependent force to the Ship A rotation-dependent force is applied in the Ship's local coordinate system and changes with the Ship's rotation.
Parameters:
- x vector or number Either a vector representing the force, or the X component of the force
- y number or nil The Y component of the force (if x is a number)
- z number or nil The Z component of the force (if x is a number)
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it. - applyRotDependentTorque (x, y, z)
-
Applies a rotation-dependent torque to the Ship A rotation-dependent torque is applied in the Ship's local coordinate system and changes with the Ship's rotation.
Parameters:
- x vector or number Either a vector representing the torque, or the X component of the torque
- y number or nil The Y component of the torque (if x is a number)
- z number or nil The Z component of the torque (if x is a number)
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it. - applyRotDependentForceToPos (fx, fy, fz, px, py, pz)
-
Applies a rotation-dependent force to the Ship at a specific position A rotation-dependent force is applied in the Ship's local coordinate system and changes with the Ship's rotation.
Parameters:
- fx vector or number Either a vector representing the force, or the X component of the force
- fy vector or number Either a vector representing the position, or the Y component of the force
- fz number or nil The Z component of the force (if fx is a number)
- px number or nil The X component of the position (if pos is a number)
- py number or nil The Y component of the position (if pos is a number)
- pz number or nil The Z component of the position (if pos is a number)
Raises:
This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
Deprecated Methods
- getEulerAnglesZYX ()
-
Gets the Ship's Euler Angles in ZYX order
Raises:
This method no longer exists! Please utilize the new quaternion API! - getEulerAnglesZXY ()
-
Gets the Ship's Euler Angles in ZXY order
Raises:
This method no longer exists! Please utilize the new quaternion API! - getEulerAnglesYXZ ()
-
Gets the Ship's Euler Angles in YXZ order
Raises:
This method no longer exists! Please utilize the new quaternion API! - getEulerAnglesXYZ ()
-
Gets the Ship's Euler Angles in XYZ order
Raises:
This method no longer exists! Please utilize the new quaternion API! - getRoll ()
-
Gets the Ship's Roll angle
Raises:
This method no longer exists! Please utilize the new quaternion API! - getYaw ()
-
Gets the Ship's Yaw angle
Raises:
This method no longer exists! Please utilize the new quaternion API! - getPitch ()
-
Gets the Ship's Pitch angle
Raises:
This method no longer exists! Please utilize the new quaternion API! - getRotationMatrix ()
-
Gets the Ship's Rotation Matrix
Raises:
This method no longer exists! Use getTransformationMatrix instead!
Physics Ticks Event Data
- getBuoyancyFactor ()
-
Gets the Ship's buoyancy factor during the physics tick
Returns:
-
number
The Ship's buoyancy factor
- isStatic ()
-
Whether the Ship is static during the physics tick
Returns:
-
boolean
Whether the Ship is static
- doFluidDrag ()
-
Whether the Ship is affected by fluid drag during the physics tick
Returns:
-
boolean
Whether the Ship has fluid drag
- getInertiaData ()
-
Gets the Ship's Inertia Data during the physics tick
Returns:
-
table
The Ship's Inertia Data comprised of mass and moment of inertia tensor
- getPoseVel ()
-
Gets the Ship's Pose and Velocity during the physics tick
Returns:
-
table
The Ship's Pose and Velocity data including position, rotation, linear velocity, and angular velocity
- getForceInducers ()
-
Gets the Force Inducers on the Ship during the physics tick
Returns:
-
table
A table of Force Inducers on the Ship