Teardown-Issue-Tracker-Maintainers / Teardown-Issue-Tracker

A public repo for the community to track issues/bugs/feature requests in Teardown.
12 stars 5 forks source link

[Documentation] Undocumented API functions #111

Closed TTFH closed 2 years ago

TTFH commented 2 years ago

Document to improve

Teardown scripting API (0.9.0) https://teardowngame.com/modding/api.html

Enhancement

Some functions are not documented. A few useful functions that are not available in the API are:

function DisableAllLights() end

---@param val number
function ShakeCamera(val) end

---@return number w
---@return number h
function UiGetRelativePos() end

---@param xAxis table
---@param zAxis table
---@return table quat
function QuatAlignXZ(xAxis, zAxis) end

---@param file string
---@return boolean
function HasFile(file) end

---@param command string
function Command(command, ...) end

---@param cmd string
function handleCommand(cmd) end

---@param quat table
---@return string
function QuatStr(quat) end

---@param transform table
---@return string
function TransformStr(transform) end

---@param vector table
---@return string
function VecStr(vector) end

Some other functions can use parameters that are not documented

---@param body number
---@param origin table
---@param maxDist number
---@return boolean hit
---@return table point
---@return table normal
---@return number shape
function GetBodyClosestPoint(body, origin, maxDist) end

---@param path string
---@param nomDist number
---@return number handle
function LoadLoop(path, nomDist) end

---@param path string
---@param nomDist number
---@return number handle
function LoadSound(path, nomDist) end

---@param start table
---@param _end table
---@param maxDist number
---@param targetRadius number
---@param pathType string
function QueryPath(start, _end, maxDist, targetRadius, pathType) end

---@param origin table
---@param direction table
---@param _type number
---@param strength number
function Shoot(origin, direction, _type, strength) end

---@param handle number
---@param pos table
---@param volume number
---@param unknow boolean
function PlaySound(handle, pos, volume, unknow) end

---@param mission string
---@param path string
---@param layers string
---@param noLoading boolean
function StartLevel(mission, path, layers, noLoading) end

---@param text string
---@param move boolean
---@param maxChars number
---@return number w
---@return number h
function UiText(text, move, maxChars) end

---@param path string
---@param width number
---@param height number
---@param unknow number --Used in menu.lua, may be a typo
---@param borderWidth number
---@param borderHeight number
function UiImageBox(path, width, height, borderWidth, borderHeight, unknow) end
tuxedolabs commented 2 years ago

Some functions are older and may disappear in the future. Same with parameters, use at your own risk!