Skip to content

Commit

Permalink
Replace vec3 and vec2 by Vector3 and Vector2
Browse files Browse the repository at this point in the history
Returning vec3 was wrong because it's more than a simple array.
Vector3 is defined as an array of numbers
  • Loading branch information
leniver committed Sep 8, 2022
1 parent b7582e9 commit b4316ea
Show file tree
Hide file tree
Showing 20 changed files with 149 additions and 316 deletions.
8 changes: 4 additions & 4 deletions api-mockup/adjustor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ function Adjustor()
function self.getMaxThrustBase() error("Adjustor.getMaxThrustBase() is deprecated, use Adjustor.getMaxThrust().") end

--- Returns the adjustor exhaust thrust direction in construct local coordinates
---@return vec3
---@return Vector3
function self.getThrustAxis() end

--- Returns the adjustor torque axis in construct local coordinates
---@return vec3
---@return Vector3
function self.getTorqueAxis() end

--- Returns the adjustor exhaust thrust direction in world coordinates
---@return vec3
---@return Vector3
function self.getWorldThrustAxis() end
---@deprecated Adjustor.thrustAxis() is deprecated, use Adjustor.getWorldThrustAxis().
function self.thrustAxis() error("Adjustor.thrustAxis() is deprecated, use Adjustor.getWorldThrustAxis().") end

--- Returns the adjustor torque axis in world coordinates
---@return vec3
---@return Vector3
function self.getWorldTorqueAxis() end
---@deprecated Adjustor.torqueAxis() is deprecated, use Adjustor.getWorldTorqueAxis().
function self.torqueAxis() error("Adjustor.torqueAxis() is deprecated, use Adjustor.getWorldTorqueAxis().") end
Expand Down
8 changes: 4 additions & 4 deletions api-mockup/airfoil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ function Airfoil()
function self.getMaxThrustEfficiency() error("Airfoil.getMaxThrustEfficiency() is deprecated, use Airfoil.getMaxLiftEfficiency().") end

--- Returns the airfoil lift direction in construct local coordinates
---@return vec3
---@return Vector3
function self.getLiftAxis() end

--- Returns the airfoil torque axis in construct local coordinates
---@return vec3
---@return Vector3
function self.getTorqueAxis() end

--- Returns the airfoil lift direction in world coordinates
---@return vec3
---@return Vector3
function self.getWorldLiftAxis() end
---@deprecated Airfoil.thrustAxis() is deprecated, use Airfoil.getWorldLiftAxis().
function self.thrustAxis() error("Airfoil.thrustAxis() is deprecated, use Airfoil.getWorldLiftAxis().") end

--- Returns the adjustor torque axis in world coordinates
---@return vec3
---@return Vector3
function self.getWorldTorqueAxis() end
---@deprecated Airfoil.torqueAxis() is deprecated, use Airfoil.getWorldTorqueAxis().
function self.torqueAxis() error("Airfoil.torqueAxis() is deprecated, use Airfoil.getWorldTorqueAxis().") end
Expand Down
4 changes: 2 additions & 2 deletions api-mockup/brakeengine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ function BrakeEngine()
function self.getMaxThrustEfficiency() end

--- Returns the brake thrust direction in construct local coordinates
---@return vec3
---@return Vector3
function self.getThrustAxis() end

--- Returns the brake thrust direction in world coordinates
---@return vec3
---@return Vector3
function self.getWorldThrustAxis() end
---@deprecated BrakeEngine.thrustAxis() is deprecated, use BrakeEngine.getWorldThrustAxis().
function self.thrustAxis() error("BrakeEngine.thrustAxis() is deprecated, use BrakeEngine.getWorldThrustAxis().") end
Expand Down
78 changes: 39 additions & 39 deletions api-mockup/construct.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ function Construct()
---@return number[]
function self.getInertialTensor() end
--- Returns the position of the center of mass of the construct, in local construct coordinates
---@return vec3
---@return Vector3
function self.getCenterOfMass() end
--- Returns the position of the center of mass of the construct, in world coordinates
---@return vec3
---@return Vector3
function self.getWorldCenterOfMass() end
--- Returns the construct's cross sectional surface in the current direction of movement
---@return number value The construct's surface exposed in the current direction of movement in meters square
function self.getCrossSection() end
--- Returns the size of the building zone of the construct
---@return vec3
---@return Vector3
function self.getSize() end
--- Returns the size of the bounding box of the construct
---@return vec3
---@return Vector3
function self.getBoundingBoxSize() end
--- Returns the position of the center of bounding box of the construct in local construct coordinates
---@return vec3
---@return Vector3
function self.getBoundingBoxCenter() end


Expand All @@ -97,7 +97,7 @@ function Construct()
--- orientation, obstruction, engine damage, etc)
--- This is typically used in conjunction with the Control Unit throttle to setup the desired forward acceleration
---@param taglist string Comma (for union) or space (for intersection) separated list of tags. You can set tags directly on the engines in the right-click menu
---@param CRefAxis vec3 Axis along which to compute the max force (in construct reference)
---@param CRefAxis Vector3 Axis along which to compute the max force (in construct reference)
---@return number[] value The kinematics parameters in Newtons in the order: atmoRange.FMaxPlus, atmoRange.FMaxMinus, spaceRange.FMaxPlus, spaceRange.FMaxMinus
function self.getMaxThrustAlongAxis(taglist, CRefAxis) end
--- Returns the current braking force generated by construct brakes
Expand All @@ -108,87 +108,87 @@ function Construct()
function self.getMaxBrake() end

--- Returns the world position of the construct
---@return vec3 value The xyz world coordinates of the construct center position in meters
---@return Vector3 value The xyz world coordinates of the construct center position in meters
function self.getWorldPosition() end
--- The construct's linear velocity, relative to its parent, in construct local coordinates
---@return vec3 value Relative linear velocity vector, in construct local coordinates in m/s
---@return Vector3 value Relative linear velocity vector, in construct local coordinates in m/s
function self.getVelocity() end
--- The construct's linear velocity, relative to its parent, in world coordinates
---@return vec3 value Relative linear velocity vector, in world coordinates in m/s
---@return Vector3 value Relative linear velocity vector, in world coordinates in m/s
function self.getWorldVelocity() end
--- The construct's absolute linear velocity, in construct local coordinates
---@return vec3 value Absolute linear velocity vector, in construct local coordinates in m/s
---@return Vector3 value Absolute linear velocity vector, in construct local coordinates in m/s
function self.getAbsoluteVelocity() end
--- The construct's absolute linear velocity, in world coordinates
---@return vec3 value Absolute linear velocity vector, in world coordinates in m/s
---@return Vector3 value Absolute linear velocity vector, in world coordinates in m/s
function self.getWorldAbsoluteVelocity() end
--- The construct's linear acceleration, in construct local coordinates
---@return vec3 value Linear acceleration vector, in construct local coordinates in m/s2
---@return Vector3 value Linear acceleration vector, in construct local coordinates in m/s2
function self.getAcceleration() end
--- The construct's linear acceleration, in world coordinates
---@return vec3 value Linear acceleration vector, in world coordinates in m/s2
---@return Vector3 value Linear acceleration vector, in world coordinates in m/s2
function self.getWorldAcceleration() end
--- The construct's angular velocity, in construct local coordinates
---@return vec3 value Angular velocity vector, in construct local coordinates in rad/s
---@return Vector3 value Angular velocity vector, in construct local coordinates in rad/s
function self.getAngularVelocity() end
--- The construct's angular velocity, in world coordinates
---@return vec3 value Angular velocity vector, in world coordinates in rad/s
---@return Vector3 value Angular velocity vector, in world coordinates in rad/s
function self.getWorldAngularVelocity() end
--- The construct's angular acceleration, in construct local coordinates
---@return vec3 value Angular acceleration vector, in construct local coordinates in rad/s2
---@return Vector3 value Angular acceleration vector, in construct local coordinates in rad/s2
function self.getAngularAcceleration() end
--- The construct's angular acceleration, in world coordinates
---@return vec3 value Angular acceleration vector, in world coordinates in rad/s2
---@return Vector3 value Angular acceleration vector, in world coordinates in rad/s2
function self.getWorldAngularAcceleration() end
--- Returns the acceleration generated by air resistance
---@return vec3 value The xyz world acceleration generated by air resistance
---@return Vector3 value The xyz world acceleration generated by air resistance
function self.getWorldAirFrictionAcceleration() end
--- Returns the acceleration torque generated by air resistance
---@return vec3 value The xyz world acceleration torque generated by air resistance
---@return Vector3 value The xyz world acceleration torque generated by air resistance
function self.getWorldAirFrictionAngularAcceleration() end
--- Returns the speed at which your construct will suffer damage due to friction with the air
---@return number value The construct speed to get damages due to friction in m/s
function self.getFrictionBurnSpeed() end

--- Returns the forward vector of the construct coordinates system
---@return vec3 value The forward vector of the construct coordinates system. It's a static value equal to (0,1,0)
---@return Vector3 value The forward vector of the construct coordinates system. It's a static value equal to (0,1,0)
function self.getForward() end
--- Returns the right vector of the construct coordinates system
---@return vec3 value The right vector of the construct coordinates system. It's a static value equal to (1,0,0)
---@return Vector3 value The right vector of the construct coordinates system. It's a static value equal to (1,0,0)
function self.getRight() end
--- Returns the up direction vector of the construct coordinates system
---@return vec3 value The up vector of the construct coordinates system.. It's a static value equal to (0,0,1)
---@return Vector3 value The up vector of the construct coordinates system.. It's a static value equal to (0,0,1)
function self.getUp() end
--- Returns the forward direction vector of the construct, in world coordinates
---@return vec3 value The forward direction vector of the construct, in world coordinates
---@return Vector3 value The forward direction vector of the construct, in world coordinates
function self.getWorldForward() end
--- Returns the right direction vector of the construct, in world coordinates
---@return vec3 value The right direction vector of the construct, in world coordinates
---@return Vector3 value The right direction vector of the construct, in world coordinates
function self.getWorldRight() end
--- Returns the up direction vector of the construct, in world coordinates
---@return vec3 value The up direction vector of the construct, in world coordinates
---@return Vector3 value The up direction vector of the construct, in world coordinates
function self.getWorldUp() end

--- Returns the local id of the current active orientation unit (core unit or gyro unit)
---@return integer value local id of the current active orientation unit (core unit or gyro unit)
function self.getOrientationUnitId() end
--- Returns the forward direction vector of the active orientation unit, in construct local coordinates
---@return vec3 value Forward direction vector of the active orientation unit, in construct local coordinates
---@return Vector3 value Forward direction vector of the active orientation unit, in construct local coordinates
function self.getOrientationForward() end
--- Returns the right direction vector of the active orientation unit, in construct local coordinates
---@return vec3 value Right direction vector of the active orientation unit, in construct local coordinates
---@return Vector3 value Right direction vector of the active orientation unit, in construct local coordinates
function self.getOrientationRight() end
--- Returns the up direction vector of the active orientation unit, in construct local coordinates
---@return vec3 value Up direction vector of the active orientation unit, in construct local coordinates
---@return Vector3 value Up direction vector of the active orientation unit, in construct local coordinates
function self.getOrientationUp() end
--- Returns the forward direction vector of the active orientation unit, in world coordinates
---@return vec3 value Forward direction vector of the active orientation unit, in world coordinates
---@return Vector3 value Forward direction vector of the active orientation unit, in world coordinates
function self.getWorldOrientationForward() end
--- Returns the right direction vector of the active orientation unit, in world coordinates
---@return vec3 value Right direction vector of the active orientation unit, in world coordinates
---@return Vector3 value Right direction vector of the active orientation unit, in world coordinates
function self.getWorldOrientationRight() end
--- Returns the up direction vector of the active orientation unit, in world coordinates
---@return vec3 value Up direction vector of the active orientation unit, in world coordinates
---@return Vector3 value Up direction vector of the active orientation unit, in world coordinates
function self.getWorldOrientationUp() end

--- Returns the id of the parent construct of our active construct
Expand All @@ -202,28 +202,28 @@ function Construct()
function self.getCloseParents() end

--- Returns the position of the construct's parent when docked in local coordinates
---@return vec3 value The position of the construct's parent in local coordinates
---@return Vector3 value The position of the construct's parent in local coordinates
function self.getParentPosition() end
--- Returns the position of the construct's parent when docked in world coordinates
---@return vec3 value The position of the construct's parent in world coordinates
---@return Vector3 value The position of the construct's parent in world coordinates
function self.getParentWorldPosition() end
--- Returns the construct's parent forward direction vector, in local coordinates
---@return vec3 value The construct's parent forward direction vector, in local coordinates
---@return Vector3 value The construct's parent forward direction vector, in local coordinates
function self.getParentForward() end
--- Returns the construct's parent right direction vector, in construct local coordinates
---@return vec3 value The construct's parent right direction vector, in construct local coordinates
---@return Vector3 value The construct's parent right direction vector, in construct local coordinates
function self.getParentRight() end
--- Returns the construct's parent up direction vector, in construct local coordinates
---@return vec3 value The construct's parent up direction vector, in construct local coordinates
---@return Vector3 value The construct's parent up direction vector, in construct local coordinates
function self.getParentUp() end
--- Returns the construct's parent forward direction vector, in world coordinates
---@return vec3 value The construct's parent forward direction vector, in world coordinates
---@return Vector3 value The construct's parent forward direction vector, in world coordinates
function self.getParentWorldForward() end
--- Returns the construct's parent right direction vector, in world coordinates
---@return vec3 value The construct's parent right direction vector, in world coordinates
---@return Vector3 value The construct's parent right direction vector, in world coordinates
function self.getParentWorldRight() end
--- Returns the construct's parent up direction vector, in world coordinates
---@return vec3 value The construct's parent up direction vector, in world coordinates
---@return Vector3 value The construct's parent up direction vector, in world coordinates
function self.getParentWorldUp() end


Expand Down
6 changes: 3 additions & 3 deletions api-mockup/controlunit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function ControlUnit()
--- to approximate it
--- This function must be used on a piloting controller in onFlush event
---@param taglist string Comma (for union) or space (for intersection) separated list of tags. You can set tags directly on the engines in the right-click menu
---@param acceleration vec3 The desired acceleration expressed in world coordinates in m/s2
---@param angularAcceleration vec3 The desired angular acceleration expressed in world coordinates in rad/s2
---@param acceleration Vector3 The desired acceleration expressed in world coordinates in m/s2
---@param angularAcceleration Vector3 The desired angular acceleration expressed in world coordinates in rad/s2
---@param keepForceCollinearity boolean Forces the resulting acceleration vector to be collinear to the acceleration parameter
---@param keepTorqueCollinearity boolean Forces the resulting angular acceleration vector to be collinear to the angular acceleration parameter
---@param priority1SubTags string Comma (for union) or space (for intersection) separated list of tags of included engines to use as priority 1
Expand All @@ -112,7 +112,7 @@ function ControlUnit()
--- Returns the total thrust values of all engines in the tag list
--- This function must be used on a piloting controller
---@param taglist string Comma separated list of tags. You can set tags directly on the engines in the right-click menu
---@return vec3 The total thrust in newtons
---@return Vector3 The total thrust in newtons
function self.getEngineThrust(taglist) end

--- Set the value of throttle in the cockpit, which will be displayed in the cockpit widget when flying
Expand Down
12 changes: 6 additions & 6 deletions api-mockup/coreunit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,22 @@ function CoreUnit()

--- Returns the position of the Element, identified by its local ID, in construct local coordinates.
---@param localId integer The local ID of the Element
---@return vec3
---@return Vector3
function self.getElementPositionById(localId) end

--- Returns the up direction vector of the Element, identified by its local ID, in construct local coordinates
---@param localId integer The local ID of the Element
---@return vec3
---@return Vector3
function self.getElementUpById(localId) end

--- Returns the right direction vector of the Element, identified by its local ID, in construct local coordinates
---@param localId integer The local ID of the Element
---@return vec3
---@return Vector3
function self.getElementRightById(localId) end

--- Returns the forward direction vector of the Element, identified by its local ID, in construct local coordinates
---@param localId integer The local ID of the Element
---@return vec3
---@return Vector3
function self.getElementForwardById(localId) end

--- Returns the status of the Industry Unit Element, identified by its local ID
Expand All @@ -246,11 +246,11 @@ function CoreUnit()
function self.g() error("CoreUnit.g() is deprecated, use CoreUnit.getGravityIntensity() instead.") end

--- Returns the local gravity vector in world coordinates
---@return vec3
---@return Vector3
function self.getWorldGravity() end

--- Returns the vertical unit vector along gravity, in world coordinates (0 in space)
---@return vec3
---@return Vector3
function self.getWorldVertical() end

--- Returns the id of the current close stellar body
Expand Down
Loading

0 comments on commit b4316ea

Please sign in to comment.