Skip to content

ExtendedShipAPI

TechTastic edited this page Sep 10, 2025 · 6 revisions

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!

Note: If enabled, this also exposes the physics_ticks event!

Functions

applyInvariantForce

applyInvariantForce( vector ) applyInvariantForce( number, number, number )

This method applies an invariant force to a Ship!

local mass = ship.getMass()
ship.applyInvariantForce(0, 1000 * mass, 0)

applyInvariantForceAtPos

applyInvariantForceAtPos( vector, vector ) applyInvariantForceAtPos( number, number, number, number, number, number )`

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( vector ) applyInvariantTorque( number, number, number )`

This method This method applies invariant torque to a Ship!

local mass = ship.getMass()
ship.applyInvariantTorque(0, 1000 * mass, 0)

applyRotDependentForce

aaplyRotDependentForce( vector ) applyRotDependentForce( number, number, number )

This method applies a rotation dependent force to a Ship!

local mass = ship.getMass()
ship.applyRotDependentForce(0, 1000 * mass, 0)

applyRotDependentForceAtPos

aaplyRotDependentForceAtPos( vector, vector ) applyRotDependentForceAtPos( number, number, number, number, number, number )

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

aaplyRotDependentTorque( vector ) applyRotDependentTorque( number, number, number )

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( number )

This method changes the scale of a Ship!

ship.setScale(0.5)

teleport

teleport( table )

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

Clone this wiki locally