ExtendedShipAPI - TechTastic/CC-VS GitHub Wiki

ExtendedShipAPI

This API is an extension of ShipAPI specifically for Command Computers by default and has inherited the original methods! It will appear listed as both "ship" and as the Ship's name at the time of startup!

Functions

applyInvariantForce

applyInvariantForce(xForce, yForce, zForce)

This method applies an invariant force to a Ship!

local mass = ship.getMass()

ship.applyInvariantForce(0, 1000 * mass, 0)

applyInvariantForceAtPos

applyInvariantForceAtPos(xForce, yForce, zForce, xPos, yPos, zPos)

This method applies an invariant force to a Ship at a position!

local pos = ...
local mass = ship.getMass()

ship.applyInvariantForceAtPos(0, 1000 * mass, 0, pos.x, pos.y, pos.z)

applyInvariantTorque

applyInvariantTorque(xTorque, yTorque, zTorque)

This method This method applies invariant torque to a Ship!

local mass = ship.getMass()

ship.applyInvariantTorque(0, 1000 * mass, 0)

applyRotDependentForce

applyRotDependentForce(xForce, yForce, zForce)

This method applies a rotation dependent force to a Ship!

local mass = ship.getMass()

ship.applyRotDependentForce(0, 1000 * mass, 0)

applyRotDependentForceAtPos

applyRotDependentForceAtPos(xForce, yForce, zForce, xPos, yPos, zPos)

This method applies a rotation dependent force to a Ship at a position!

local pos = ...
local mass = ship.getMass()

ship.applyRotDependentForceAtPos(0, 1000 * mass, 0, pos.x, pos.y, pos.z)

applyRotDependentTorque

applyRotDependentTorque(xTorque, yTorque, zTorque)

This method This method applies rotation dependent torque to a Ship!

local mass = ship.getMass()

ship.applyRotDependentTorque(0, 1000 * mass, 0)

setStatic

setStatic(boolean)

This method sets a Ship as static!

ship.setStatic(true)

setScale

setScale(scale)

This method changes the scale of a Ship!

ship.setScale(0.5)

teleport

teleport(teleportSettings)

This method teleports a Ship! This is disabled in configs by default!

while true do
    local tp = {
        ["pos"] = {
            ["x"] = math.random(0, 32) - 8,
            ["y"] = -58,
            ["z"] = math.random(0, 32) - 8
        }
    }
    
    ship.teleport(tp)
    os.sleep()
end