Compare commits
20 Commits
5171baedd7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f1e4f91461 | |||
| 18b3debb53 | |||
| 79bd47ff0c | |||
| f284a27ded | |||
| a6bfb8e8c7 | |||
| 4a8c91a4ec | |||
| 57594aebbd | |||
| df29e4d0ef | |||
| cf00c7c212 | |||
| 805a116e59 | |||
| 70afcad526 | |||
| 2fc2fdec28 | |||
| 3a4dcbee61 | |||
| 128e58151b | |||
| 8ce294291c | |||
| d125696058 | |||
| 96555f71d1 | |||
| c7dffb0727 | |||
| 22b23f39cd | |||
| 85ea2d81a0 |
8
_test.lua
Normal file
8
_test.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local rootPath = utils.get_appdata_path("PopstarDevs", "2Take1Menu") .. "\\scripts\\"
|
||||
|
||||
function load(file)
|
||||
local chunk, status = loadfile(rootPath .. file)
|
||||
if chunk then chunk() end
|
||||
end
|
||||
|
||||
load("ts-lua\\dist\\test.lua")
|
||||
1
ts-lua/README
Normal file
1
ts-lua/README
Normal file
@@ -0,0 +1 @@
|
||||
wstring will not be added for now, and the only mention of it is in the discord where kektram mentions a bug that never got fixed so it's not worth it until i finish everything else (https://canary.discord.com/channels/701762303024169027/701762305012006921/846484799064899614)
|
||||
368
ts-lua/dist/test.lua
vendored
Normal file
368
ts-lua/dist/test.lua
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
||||
|
||||
local ____modules = {}
|
||||
local ____moduleCache = {}
|
||||
local ____originalRequire = require
|
||||
local function require(file)
|
||||
if ____moduleCache[file] then
|
||||
return ____moduleCache[file]
|
||||
end
|
||||
if ____modules[file] then
|
||||
____moduleCache[file] = ____modules[file]()
|
||||
return ____moduleCache[file]
|
||||
else
|
||||
if ____originalRequire then
|
||||
return ____originalRequire(file)
|
||||
else
|
||||
error("module '" .. file .. "' not found")
|
||||
end
|
||||
end
|
||||
end
|
||||
____modules = {
|
||||
["index"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
||||
end,
|
||||
["classes.Feature"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
||||
-- Lua Library inline imports
|
||||
function __TS__Class(self)
|
||||
local c = {prototype = {}}
|
||||
c.prototype.__index = c.prototype
|
||||
c.prototype.constructor = c
|
||||
return c
|
||||
end
|
||||
|
||||
function __TS__ArrayPush(arr, ...)
|
||||
local items = {...}
|
||||
for ____, item in ipairs(items) do
|
||||
arr[#arr + 1] = item
|
||||
end
|
||||
return #arr
|
||||
end
|
||||
|
||||
function __TS__ArraySplice(list, ...)
|
||||
local len = #list
|
||||
local actualArgumentCount = select("#", ...)
|
||||
local start = select(1, ...)
|
||||
local deleteCount = select(2, ...)
|
||||
local actualStart
|
||||
if start < 0 then
|
||||
actualStart = math.max(len + start, 0)
|
||||
else
|
||||
actualStart = math.min(start, len)
|
||||
end
|
||||
local itemCount = math.max(actualArgumentCount - 2, 0)
|
||||
local actualDeleteCount
|
||||
if actualArgumentCount == 0 then
|
||||
actualDeleteCount = 0
|
||||
elseif actualArgumentCount == 1 then
|
||||
actualDeleteCount = len - actualStart
|
||||
else
|
||||
actualDeleteCount = math.min(
|
||||
math.max(deleteCount or 0, 0),
|
||||
len - actualStart
|
||||
)
|
||||
end
|
||||
local out = {}
|
||||
do
|
||||
local k = 0
|
||||
while k < actualDeleteCount do
|
||||
local from = actualStart + k
|
||||
if list[from + 1] then
|
||||
out[k + 1] = list[from + 1]
|
||||
end
|
||||
k = k + 1
|
||||
end
|
||||
end
|
||||
if itemCount < actualDeleteCount then
|
||||
do
|
||||
local k = actualStart
|
||||
while k < (len - actualDeleteCount) do
|
||||
local from = k + actualDeleteCount
|
||||
local to = k + itemCount
|
||||
if list[from + 1] then
|
||||
list[to + 1] = list[from + 1]
|
||||
else
|
||||
list[to + 1] = nil
|
||||
end
|
||||
k = k + 1
|
||||
end
|
||||
end
|
||||
do
|
||||
local k = len
|
||||
while k > ((len - actualDeleteCount) + itemCount) do
|
||||
list[k] = nil
|
||||
k = k - 1
|
||||
end
|
||||
end
|
||||
elseif itemCount > actualDeleteCount then
|
||||
do
|
||||
local k = len - actualDeleteCount
|
||||
while k > actualStart do
|
||||
local from = (k + actualDeleteCount) - 1
|
||||
local to = (k + itemCount) - 1
|
||||
if list[from + 1] then
|
||||
list[to + 1] = list[from + 1]
|
||||
else
|
||||
list[to + 1] = nil
|
||||
end
|
||||
k = k - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
local j = actualStart
|
||||
for i = 3, actualArgumentCount do
|
||||
list[j + 1] = select(i, ...)
|
||||
j = j + 1
|
||||
end
|
||||
do
|
||||
local k = #list - 1
|
||||
while k >= ((len - actualDeleteCount) + itemCount) do
|
||||
list[k + 1] = nil
|
||||
k = k - 1
|
||||
end
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
function __TS__ClassExtends(target, base)
|
||||
target.____super = base
|
||||
local staticMetatable = setmetatable({__index = base}, base)
|
||||
setmetatable(target, staticMetatable)
|
||||
local baseMetatable = getmetatable(base)
|
||||
if baseMetatable then
|
||||
if type(baseMetatable.__index) == "function" then
|
||||
staticMetatable.__index = baseMetatable.__index
|
||||
end
|
||||
if type(baseMetatable.__newindex) == "function" then
|
||||
staticMetatable.__newindex = baseMetatable.__newindex
|
||||
end
|
||||
end
|
||||
setmetatable(target.prototype, base.prototype)
|
||||
if type(base.prototype.__index) == "function" then
|
||||
target.prototype.__index = base.prototype.__index
|
||||
end
|
||||
if type(base.prototype.__newindex) == "function" then
|
||||
target.prototype.__newindex = base.prototype.__newindex
|
||||
end
|
||||
if type(base.prototype.__tostring) == "function" then
|
||||
target.prototype.__tostring = base.prototype.__tostring
|
||||
end
|
||||
end
|
||||
|
||||
local ____exports = {}
|
||||
____exports.FeatureParent = __TS__Class()
|
||||
local FeatureParent = ____exports.FeatureParent
|
||||
FeatureParent.name = "FeatureParent"
|
||||
function FeatureParent.prototype.____constructor(self, name, parent)
|
||||
self.parentid = 0
|
||||
self.children = {}
|
||||
self.name = name
|
||||
if parent then
|
||||
self.parent = parent
|
||||
self.parentid = parent.id
|
||||
self.parent:addChild(self)
|
||||
end
|
||||
self.feat = menu.add_feature(
|
||||
name,
|
||||
self:type(),
|
||||
self.parentid,
|
||||
function() return self:select() end
|
||||
)
|
||||
self.id = self.feat.id
|
||||
end
|
||||
function FeatureParent.prototype.type(self)
|
||||
return "parent"
|
||||
end
|
||||
function FeatureParent.prototype.hidden(self)
|
||||
return self.feat.hidden
|
||||
end
|
||||
function FeatureParent.prototype.setHidden(self, val)
|
||||
self.feat.hidden = val
|
||||
end
|
||||
function FeatureParent.prototype.select(self)
|
||||
end
|
||||
function FeatureParent.prototype.addChild(self, feat)
|
||||
do
|
||||
local i = 0
|
||||
while i < #self.children do
|
||||
if self.children[i + 1]:equals(feat) then
|
||||
return
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
__TS__ArrayPush(self.children, feat)
|
||||
end
|
||||
function FeatureParent.prototype.removeChild(self, feat)
|
||||
do
|
||||
local i = 0
|
||||
while i < #self.children do
|
||||
if self.children[i + 1]:equals(feat) then
|
||||
__TS__ArraySplice(self.children, i, 1)
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
function FeatureParent.prototype.equals(self, feat)
|
||||
return self.id == feat.id
|
||||
end
|
||||
____exports.FeatureAction = __TS__Class()
|
||||
local FeatureAction = ____exports.FeatureAction
|
||||
FeatureAction.name = "FeatureAction"
|
||||
__TS__ClassExtends(FeatureAction, ____exports.FeatureParent)
|
||||
function FeatureAction.prototype.____constructor(self, name, parent, handler)
|
||||
FeatureAction.____super.prototype.____constructor(self, name, parent)
|
||||
if handler then
|
||||
self.handler = handler
|
||||
end
|
||||
end
|
||||
function FeatureAction.prototype.type(self)
|
||||
return "action"
|
||||
end
|
||||
function FeatureAction.prototype.select(self)
|
||||
if self.handler then
|
||||
self:handler(self)
|
||||
end
|
||||
end
|
||||
function FeatureAction.prototype.setHandler(self, handler)
|
||||
self.handler = handler
|
||||
end
|
||||
____exports.FeatureToggle = __TS__Class()
|
||||
local FeatureToggle = ____exports.FeatureToggle
|
||||
FeatureToggle.name = "FeatureToggle"
|
||||
__TS__ClassExtends(FeatureToggle, ____exports.FeatureAction)
|
||||
function FeatureToggle.prototype.____constructor(self, name, parent, defaultvalue, handler)
|
||||
if defaultvalue == nil then
|
||||
defaultvalue = false
|
||||
end
|
||||
FeatureToggle.____super.prototype.____constructor(self, name, parent, handler)
|
||||
self:setValue(defaultvalue)
|
||||
end
|
||||
function FeatureToggle.prototype.type(self)
|
||||
return "toggle"
|
||||
end
|
||||
function FeatureToggle.prototype.value(self)
|
||||
return self.feat.on
|
||||
end
|
||||
function FeatureToggle.prototype.setValue(self, val)
|
||||
self.feat.on = val
|
||||
end
|
||||
function FeatureToggle.prototype.toggle(self)
|
||||
self.feat.on = not self.feat.on
|
||||
end
|
||||
____exports.FeatureNum = __TS__Class()
|
||||
local FeatureNum = ____exports.FeatureNum
|
||||
FeatureNum.name = "FeatureNum"
|
||||
__TS__ClassExtends(FeatureNum, ____exports.FeatureAction)
|
||||
function FeatureNum.prototype.____constructor(self, name, parent, defaultnum, handler)
|
||||
if defaultnum == nil then
|
||||
defaultnum = 0
|
||||
end
|
||||
FeatureNum.____super.prototype.____constructor(self, name, parent, handler)
|
||||
self:setNum(defaultnum)
|
||||
end
|
||||
function FeatureNum.prototype.type(self)
|
||||
return "action_value_i"
|
||||
end
|
||||
function FeatureNum.prototype.num(self)
|
||||
return self.feat.value_i
|
||||
end
|
||||
function FeatureNum.prototype.setNum(self, val)
|
||||
self.feat.value_i = val
|
||||
end
|
||||
function FeatureNum.prototype.min(self)
|
||||
return self.feat.min_i
|
||||
end
|
||||
function FeatureNum.prototype.setMin(self, val)
|
||||
self.feat.min_i = math.floor(val + 0.5)
|
||||
end
|
||||
function FeatureNum.prototype.max(self)
|
||||
return self.feat.max_i
|
||||
end
|
||||
function FeatureNum.prototype.setMax(self, val)
|
||||
self.feat.max_i = math.floor(val + 0.5)
|
||||
end
|
||||
function FeatureNum.prototype.step(self)
|
||||
return self.feat.mod_i
|
||||
end
|
||||
function FeatureNum.prototype.setStep(self, val)
|
||||
self.feat.mod_i = math.floor(val + 0.5)
|
||||
end
|
||||
____exports.FeatureNumToggle = __TS__Class()
|
||||
local FeatureNumToggle = ____exports.FeatureNumToggle
|
||||
FeatureNumToggle.name = "FeatureNumToggle"
|
||||
__TS__ClassExtends(FeatureNumToggle, ____exports.FeatureNum)
|
||||
function FeatureNumToggle.prototype.____constructor(self, name, parent, defaultnum, defaultvalue, handler)
|
||||
if defaultnum == nil then
|
||||
defaultnum = 0
|
||||
end
|
||||
if defaultvalue == nil then
|
||||
defaultvalue = false
|
||||
end
|
||||
FeatureNumToggle.____super.prototype.____constructor(self, name, parent, defaultnum, handler)
|
||||
self:setValue(defaultvalue)
|
||||
end
|
||||
function FeatureNumToggle.prototype.type(self)
|
||||
return "value_i"
|
||||
end
|
||||
function FeatureNumToggle.prototype.value(self)
|
||||
return self.feat.on
|
||||
end
|
||||
function FeatureNumToggle.prototype.setValue(self, val)
|
||||
self.feat.on = val
|
||||
end
|
||||
function FeatureNumToggle.prototype.toggle(self)
|
||||
self.feat.on = not self.feat.on
|
||||
end
|
||||
return ____exports
|
||||
end,
|
||||
["test"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
||||
-- Lua Library inline imports
|
||||
function __TS__New(target, ...)
|
||||
local instance = setmetatable({}, target.prototype)
|
||||
instance:____constructor(...)
|
||||
return instance
|
||||
end
|
||||
|
||||
local ____exports = {}
|
||||
local ____Feature = require("classes.Feature")
|
||||
local FeatureAction = ____Feature.FeatureAction
|
||||
local FeatureParent = ____Feature.FeatureParent
|
||||
local fps = 60
|
||||
local duration = 5
|
||||
local testParent = __TS__New(FeatureParent, "test")
|
||||
__TS__New(
|
||||
FeatureAction,
|
||||
"display box",
|
||||
testParent,
|
||||
function(____, f)
|
||||
do
|
||||
local i = 0
|
||||
while i < (fps * duration) do
|
||||
scriptdraw.draw_rect(
|
||||
v2(0, 0),
|
||||
v2(1, 1),
|
||||
4294967295
|
||||
)
|
||||
system.wait(0)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
__TS__New(
|
||||
FeatureAction,
|
||||
"print parent data",
|
||||
testParent,
|
||||
function(____, f)
|
||||
if f.parent then
|
||||
print(
|
||||
(("parent: " .. f.parent.name) .. "\nid: ") .. tostring(f.parent.id)
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
return ____exports
|
||||
end,
|
||||
}
|
||||
return require("test")
|
||||
407
ts-lua/package-lock.json
generated
407
ts-lua/package-lock.json
generated
@@ -1,143 +1,278 @@
|
||||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"@rauschma/stringio": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@rauschma/stringio/-/stringio-1.4.0.tgz",
|
||||
"integrity": "sha512-3uor2f/MXZkmX5RJf8r+OC3WvZVzpSme0yyL0rQDPEnatE02qRcqwEwnsgpgriEck0S/n4vWtUd6tTtrJwk45Q==",
|
||||
"requires": {
|
||||
"@types/node": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "10.17.60",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz",
|
||||
"integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw=="
|
||||
"name": "ts-lua",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"lua-types": "^2.10.1",
|
||||
"types-ts-2take1": "git+https://git@git.zomo.dev/zomo/types-ts-2take1",
|
||||
"typescript-to-lua": "^0.40.1"
|
||||
}
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz",
|
||||
"integrity": "sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.6",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
|
||||
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz",
|
||||
"integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/lua-types": {
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.10.1.tgz",
|
||||
"integrity": "sha512-Ai7L25I5kHZYGN5C3LALUse7Eus0k/kM9tEO2zwReG2Xuker0c+0e2M4iyfiEvlGOmBc7cDouqJ5lFwyg8JqiQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"typescript-to-lua": "^0.39.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lua-types/node_modules/typescript-to-lua": {
|
||||
"version": "0.39.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-0.39.6.tgz",
|
||||
"integrity": "sha512-Yq+XsmFKknMlz9jm1FvTw5B7R4H8lYUly4uwxlR44aT4OFyG9S7mOImrTIF07j414PdrJSQ5dAAhQOBVRqHbMw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3",
|
||||
"typescript": "~4.3.2"
|
||||
},
|
||||
"bin": {
|
||||
"tstl": "dist/tstl.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
|
||||
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.2.0",
|
||||
"path-parse": "^1.0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/tapable": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz",
|
||||
"integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/types-ts-2take1": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "git+https://git@git.zomo.dev/zomo/types-ts-2take1#dc5f38b2321b7c6d8adecf8c037c7a5650d48a1d",
|
||||
"dev": true,
|
||||
"license": "UNLICENSED"
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz",
|
||||
"integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-to-lua": {
|
||||
"version": "0.40.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-0.40.1.tgz",
|
||||
"integrity": "sha512-wbnXddF+kPWKDQMcuVZLRUeZsMde5Qni6FnYIc3SKOAhg2/ZAm9ctWQsyQLwH8piMUX+uZzFXaJ3pMe186crfw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"enhanced-resolve": "^5.8.2",
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3",
|
||||
"typescript": "~4.3.2"
|
||||
},
|
||||
"bin": {
|
||||
"tstl": "dist/tstl.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.13.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.17.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.4.tgz",
|
||||
"integrity": "sha512-8kQ3+wKGRNN0ghtEn7EGps/B8CzuBz1nXZEIGGLP2GnwbqYn4dbTs7k+VKLTq1HvZLRCIDtN3Snx1Ege8B7L5A=="
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz",
|
||||
"integrity": "sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.2.6",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
|
||||
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
|
||||
"dev": true
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"is-core-module": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz",
|
||||
"integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"lua-types": {
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.10.1.tgz",
|
||||
"integrity": "sha512-Ai7L25I5kHZYGN5C3LALUse7Eus0k/kM9tEO2zwReG2Xuker0c+0e2M4iyfiEvlGOmBc7cDouqJ5lFwyg8JqiQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"typescript-to-lua": "^0.39.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"dependencies": {
|
||||
"enhanced-resolve": {
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz",
|
||||
"integrity": "sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.2.6",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
|
||||
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
|
||||
"dev": true
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"is-core-module": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz",
|
||||
"integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"lua-types": {
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.10.1.tgz",
|
||||
"integrity": "sha512-Ai7L25I5kHZYGN5C3LALUse7Eus0k/kM9tEO2zwReG2Xuker0c+0e2M4iyfiEvlGOmBc7cDouqJ5lFwyg8JqiQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"typescript-to-lua": "^0.39.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript-to-lua": {
|
||||
"version": "0.39.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-0.39.6.tgz",
|
||||
"integrity": "sha512-Yq+XsmFKknMlz9jm1FvTw5B7R4H8lYUly4uwxlR44aT4OFyG9S7mOImrTIF07j414PdrJSQ5dAAhQOBVRqHbMw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3",
|
||||
"typescript": "~4.3.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
|
||||
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-core-module": "^2.2.0",
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true
|
||||
},
|
||||
"tapable": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz",
|
||||
"integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==",
|
||||
"dev": true
|
||||
},
|
||||
"types-ts-2take1": {
|
||||
"version": "git+https://git@git.zomo.dev/zomo/types-ts-2take1#dc5f38b2321b7c6d8adecf8c037c7a5650d48a1d",
|
||||
"dev": true,
|
||||
"from": "types-ts-2take1@git+https://git@git.zomo.dev/zomo/types-ts-2take1"
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz",
|
||||
"integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript-to-lua": {
|
||||
"version": "0.39.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-0.39.6.tgz",
|
||||
"integrity": "sha512-Yq+XsmFKknMlz9jm1FvTw5B7R4H8lYUly4uwxlR44aT4OFyG9S7mOImrTIF07j414PdrJSQ5dAAhQOBVRqHbMw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3",
|
||||
"typescript": "~4.3.2"
|
||||
}
|
||||
"version": "0.40.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-0.40.1.tgz",
|
||||
"integrity": "sha512-wbnXddF+kPWKDQMcuVZLRUeZsMde5Qni6FnYIc3SKOAhg2/ZAm9ctWQsyQLwH8piMUX+uZzFXaJ3pMe186crfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"enhanced-resolve": "^5.8.2",
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3",
|
||||
"typescript": "~4.3.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"node-ts": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/node-ts/-/node-ts-5.1.1.tgz",
|
||||
"integrity": "sha512-summDCKhk7qaMlhe50vSzdhLqTowv4xCD+jEkPToYQD0fU1jshfC61hj5oPE7PZmYG1Af+HsVu8Vhr/jhFVENA==",
|
||||
"requires": {
|
||||
"@rauschma/stringio": "^1.4.0",
|
||||
"@types/node": "^14.14.0"
|
||||
}
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
|
||||
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-core-module": "^2.2.0",
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true
|
||||
},
|
||||
"tapable": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz",
|
||||
"integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz",
|
||||
"integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript-to-lua": {
|
||||
"version": "0.40.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-0.40.1.tgz",
|
||||
"integrity": "sha512-wbnXddF+kPWKDQMcuVZLRUeZsMde5Qni6FnYIc3SKOAhg2/ZAm9ctWQsyQLwH8piMUX+uZzFXaJ3pMe186crfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"enhanced-resolve": "^5.8.2",
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3",
|
||||
"typescript": "~4.3.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tstl",
|
||||
"dev": "tstl --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lua-types": "^2.10.1",
|
||||
"typescript-to-lua": "^0.40.1"
|
||||
}
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tstl && $npm_package_scripts_postbuild",
|
||||
"postbuild": "cp ./dist/test.lua ../",
|
||||
"dev": "tstl --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lua-types": "^2.10.1",
|
||||
"types-ts-2take1": "git+https://git@git.zomo.dev/zomo/types-ts-2take1",
|
||||
"typescript-to-lua": "^0.40.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# notes
|
||||
|
||||
- all `number` will be classified as `integer` or `float` in the `@remarks` or `@param`/`@returns`
|
||||
- `vector` in the docs is represented as a `table` in lua, which is just an `object` in typescript
|
||||
- `uint*_t` are `number`, not `Uint*Array`
|
||||
163
ts-lua/src/classes/Feature.ts
Normal file
163
ts-lua/src/classes/Feature.ts
Normal file
@@ -0,0 +1,163 @@
|
||||
type AnyFeature = FeatureParent|FeatureAction|FeatureToggle|FeatureNum|FeatureNumToggle;
|
||||
|
||||
export class FeatureParent {
|
||||
|
||||
type(): menu.featureTypes { return "parent"; }
|
||||
|
||||
name: string;
|
||||
id: number;
|
||||
parent?: FeatureParent|null;
|
||||
parentid: number = 0;
|
||||
children: AnyFeature[] = [];
|
||||
|
||||
feat: Feat;
|
||||
|
||||
hidden(): boolean {
|
||||
return this.feat.hidden;
|
||||
}
|
||||
setHidden(val: boolean) {
|
||||
this.feat.hidden = val;
|
||||
}
|
||||
|
||||
select() {}
|
||||
|
||||
constructor(name: string, parent?: FeatureParent|null) {
|
||||
this.name = name;
|
||||
|
||||
if (parent) {
|
||||
this.parent = parent;
|
||||
this.parentid = parent.id;
|
||||
this.parent.addChild(this);
|
||||
}
|
||||
|
||||
this.feat = menu.add_feature(name, this.type(), this.parentid, () => this.select());
|
||||
this.id = this.feat.id;
|
||||
}
|
||||
|
||||
/* children */
|
||||
|
||||
addChild(feat: AnyFeature) {
|
||||
for (let i = 0; i < this.children.length; i++)
|
||||
if (this.children[i].equals(feat))
|
||||
return;
|
||||
this.children.push(feat);
|
||||
}
|
||||
|
||||
removeChild(feat: AnyFeature) {
|
||||
for (let i = 0; i < this.children.length; i++)
|
||||
if (this.children[i].equals(feat))
|
||||
this.children.splice(i, 1);
|
||||
}
|
||||
|
||||
/* util */
|
||||
|
||||
equals(feat: AnyFeature): boolean {
|
||||
return this.id === feat.id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class FeatureAction extends FeatureParent {
|
||||
|
||||
type(): menu.featureTypes { return "action"; }
|
||||
|
||||
handler?: (feat: this) => void;
|
||||
|
||||
select() {
|
||||
if (this.handler)
|
||||
this.handler(this);
|
||||
}
|
||||
|
||||
constructor(name: string, parent?: FeatureParent|null, handler?: (feat: AnyFeature) => void) {
|
||||
super(name, parent);
|
||||
|
||||
if (handler)
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
setHandler(handler: (feat: AnyFeature) => void) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class FeatureToggle extends FeatureAction {
|
||||
|
||||
type(): menu.featureTypes { return "toggle"; }
|
||||
|
||||
value(): boolean {
|
||||
return this.feat.on;
|
||||
}
|
||||
setValue(val: boolean) {
|
||||
this.feat.on = val;
|
||||
}
|
||||
toggle() {
|
||||
this.feat.on = !this.feat.on;
|
||||
}
|
||||
|
||||
constructor(name: string, parent?: FeatureParent|null, defaultvalue = false, handler?: (feat: AnyFeature) => void) {
|
||||
super(name, parent, handler);
|
||||
this.setValue(defaultvalue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class FeatureNum extends FeatureAction {
|
||||
|
||||
type(): menu.featureTypes { return "action_value_i"; }
|
||||
|
||||
num(): number {
|
||||
return this.feat.value_i;
|
||||
}
|
||||
setNum(val: number) {
|
||||
this.feat.value_i = val;
|
||||
}
|
||||
|
||||
min(): number {
|
||||
return this.feat.min_i;
|
||||
}
|
||||
setMin(val: number) {
|
||||
this.feat.min_i = Math.round(val);
|
||||
}
|
||||
|
||||
max(): number {
|
||||
return this.feat.max_i;
|
||||
}
|
||||
setMax(val: number) {
|
||||
this.feat.max_i = Math.round(val);
|
||||
}
|
||||
|
||||
step(): number {
|
||||
return this.feat.mod_i;
|
||||
}
|
||||
setStep(val: number) {
|
||||
this.feat.mod_i = Math.round(val);
|
||||
}
|
||||
|
||||
constructor(name: string, parent?: FeatureParent|null, defaultnum = 0, handler?: (feat: AnyFeature) => void) {
|
||||
super(name, parent, handler);
|
||||
this.setNum(defaultnum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class FeatureNumToggle extends FeatureNum {
|
||||
|
||||
type(): menu.featureTypes { return "value_i"; }
|
||||
|
||||
value(): boolean {
|
||||
return this.feat.on;
|
||||
}
|
||||
setValue(val: boolean) {
|
||||
this.feat.on = val;
|
||||
}
|
||||
toggle() {
|
||||
this.feat.on = !this.feat.on;
|
||||
}
|
||||
|
||||
constructor(name: string, parent?: FeatureParent|null, defaultnum = 0, defaultvalue = false, handler?: (feat: AnyFeature) => void) {
|
||||
super(name, parent, defaultnum, handler);
|
||||
this.setValue(defaultvalue);
|
||||
}
|
||||
|
||||
}
|
||||
0
ts-lua/src/index.ts
Normal file
0
ts-lua/src/index.ts
Normal file
24
ts-lua/src/test.ts
Normal file
24
ts-lua/src/test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
const fps = 60,
|
||||
duration = 5 //seconds
|
||||
|
||||
import { FeatureAction, FeatureParent } from './classes/Feature'
|
||||
|
||||
let testParent = new FeatureParent('test')
|
||||
|
||||
new FeatureAction('display box', testParent, f => {
|
||||
|
||||
for (let i = 0; i < fps * duration; i++) {
|
||||
|
||||
scriptdraw.draw_rect(v2(0, 0), v2(1, 1), 0xffffffff)
|
||||
system.wait(0)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
new FeatureAction('print parent data', testParent, f => {
|
||||
|
||||
if (f.parent)
|
||||
print(`parent: ${f.parent.name}\nid: ${f.parent.id}`)
|
||||
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
let a = new Feat('debug')
|
||||
a.value_i
|
||||
|
||||
menu.add_feature('', '', 0, () => {
|
||||
|
||||
})
|
||||
@@ -1,15 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"target": "esnext",
|
||||
"lib": ["esnext"],
|
||||
"moduleResolution": "node",
|
||||
"types": ["lua-types/5.4"],
|
||||
"types": ["lua-types/5.4", "types-ts-2take1"],
|
||||
"strict": true,
|
||||
"typeRoots": [
|
||||
"./types"
|
||||
]
|
||||
"typeRoots": []
|
||||
},
|
||||
"tstl": {
|
||||
"luaTarget": "JIT"
|
||||
}
|
||||
"luaTarget": "universal",
|
||||
"luaLibImport": "inline",
|
||||
"luaBundle": "test.lua",
|
||||
"luaBundleEntry": "./src/test.ts",
|
||||
},
|
||||
}
|
||||
15
ts-lua/types/2take1.d.ts
vendored
15
ts-lua/types/2take1.d.ts
vendored
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Menu Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace lua2take1 {
|
||||
type Player = number;
|
||||
type Entity = number;
|
||||
type Ped = number;
|
||||
type Vehicle = number;
|
||||
type Group = number;
|
||||
type Hash = number;
|
||||
type Ptfx = number;
|
||||
type Any = number;
|
||||
type Thread = number;
|
||||
}
|
||||
9
ts-lua/types/D3D.d.ts
vendored
9
ts-lua/types/D3D.d.ts
vendored
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* D3D Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace d3d {
|
||||
|
||||
|
||||
|
||||
}
|
||||
9
ts-lua/types/Hooks.d.ts
vendored
9
ts-lua/types/Hooks.d.ts
vendored
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Hook Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace hook {
|
||||
|
||||
|
||||
|
||||
}
|
||||
9
ts-lua/types/Input.d.ts
vendored
9
ts-lua/types/Input.d.ts
vendored
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Input Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace input {
|
||||
|
||||
|
||||
|
||||
}
|
||||
45
ts-lua/types/Menu.d.ts
vendored
45
ts-lua/types/Menu.d.ts
vendored
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Menu Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace menu {
|
||||
|
||||
/**
|
||||
* @param parent integer
|
||||
*/
|
||||
export function add_feature(name: string, type: string, parent: number, script_handler: (feat: Feat) => void): Feat;
|
||||
|
||||
/**
|
||||
* @param id int
|
||||
*/
|
||||
export function delete_feature(id: number): boolean;
|
||||
|
||||
export function set_menu_can_navigate(): void;
|
||||
|
||||
export function get_version(): void;
|
||||
|
||||
/**
|
||||
* @param parent integer
|
||||
*/
|
||||
export function add_player_feature(name: string, type: string, parent: number, script_handler: (feat: Feat) => void): PlayerFeat
|
||||
|
||||
/**
|
||||
* @param i uint32_t
|
||||
*/
|
||||
export function get_player_feature(i: number): PlayerFeat
|
||||
|
||||
/**
|
||||
* @param mode int
|
||||
*/
|
||||
export function is_threading_mode(mode: number): boolean
|
||||
|
||||
/**
|
||||
* @privateRemarks callback declaration may be wrong
|
||||
*/
|
||||
export function create_thread(callback: () => void, context: any): lua2take1.Thread
|
||||
|
||||
export function has_thread_finished(id: lua2take1.Thread): boolean
|
||||
|
||||
export function delete_thread(id: lua2take1.Thread): boolean
|
||||
|
||||
}
|
||||
10
ts-lua/types/RAGE/AI.d.ts
vendored
10
ts-lua/types/RAGE/AI.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* AI Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace ai {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Audio.d.ts
vendored
10
ts-lua/types/RAGE/Audio.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Audio Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace audio {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Cam.d.ts
vendored
10
ts-lua/types/RAGE/Cam.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Cam Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace cam {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Control.d.ts
vendored
10
ts-lua/types/RAGE/Control.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Control Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace control {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Cutscene.d.ts
vendored
10
ts-lua/types/RAGE/Cutscene.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Cutscene Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace cutscene {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Decorator.d.ts
vendored
10
ts-lua/types/RAGE/Decorator.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Decorator Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace decorator {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Entity.d.ts
vendored
10
ts-lua/types/RAGE/Entity.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Entity Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace entity {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Fire.d.ts
vendored
10
ts-lua/types/RAGE/Fire.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Fire Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace fire {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Gameplay.d.ts
vendored
10
ts-lua/types/RAGE/Gameplay.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Gameplay Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace gameplay {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Graphics.d.ts
vendored
10
ts-lua/types/RAGE/Graphics.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Graphics Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace graphics {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Interior.d.ts
vendored
10
ts-lua/types/RAGE/Interior.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Interior Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace interior {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Network.d.ts
vendored
10
ts-lua/types/RAGE/Network.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Network Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace network {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Object.d.ts
vendored
10
ts-lua/types/RAGE/Object.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Object Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace object {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Ped.d.ts
vendored
10
ts-lua/types/RAGE/Ped.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Ped Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace ped {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Player.d.ts
vendored
10
ts-lua/types/RAGE/Player.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Player Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace player {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Script.d.ts
vendored
10
ts-lua/types/RAGE/Script.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Script Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace script {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/ScriptDraw.d.ts
vendored
10
ts-lua/types/RAGE/ScriptDraw.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* ScriptDraw Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace scriptdraw {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Stats.d.ts
vendored
10
ts-lua/types/RAGE/Stats.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Stats Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace stats {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Streaming.d.ts
vendored
10
ts-lua/types/RAGE/Streaming.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Streaming Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace streaming {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/System.d.ts
vendored
10
ts-lua/types/RAGE/System.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* System Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace system {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Time.d.ts
vendored
10
ts-lua/types/RAGE/Time.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Time Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace time {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/UI.d.ts
vendored
10
ts-lua/types/RAGE/UI.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* UI Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace ui {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Utils.d.ts
vendored
10
ts-lua/types/RAGE/Utils.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Utils Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace utils {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Vehicle.d.ts
vendored
10
ts-lua/types/RAGE/Vehicle.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Vehicle Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace vehicle {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Water.d.ts
vendored
10
ts-lua/types/RAGE/Water.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Water Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace water {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Weapon.d.ts
vendored
10
ts-lua/types/RAGE/Weapon.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Weapon Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace weapon {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
10
ts-lua/types/RAGE/Worldprobe.d.ts
vendored
10
ts-lua/types/RAGE/Worldprobe.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Worldprobe Functions
|
||||
* @public
|
||||
*/
|
||||
declare namespace worldprobe {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
117
ts-lua/types/structs/Feat.d.ts
vendored
117
ts-lua/types/structs/Feat.d.ts
vendored
@@ -1,117 +0,0 @@
|
||||
/**
|
||||
* a feature from the menu
|
||||
* @public
|
||||
*/
|
||||
declare class Feat {
|
||||
|
||||
/**
|
||||
* only for testing,
|
||||
*
|
||||
* @param type "debug"
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* new Feat("debug")
|
||||
*
|
||||
*/
|
||||
constructor(type: "debug");
|
||||
|
||||
/**
|
||||
* feature on/off boolean
|
||||
*/
|
||||
public get on(): boolean;
|
||||
public set on(on: boolean);
|
||||
|
||||
readonly parent: Feat|null;
|
||||
|
||||
/**
|
||||
* Only for parents
|
||||
*/
|
||||
readonly children: Feat[];
|
||||
|
||||
/**
|
||||
* Only for parents
|
||||
*/
|
||||
readonly child_count: number;
|
||||
|
||||
readonly type: number;
|
||||
|
||||
/**
|
||||
* Ids will be recycled after the feature is deleted
|
||||
*/
|
||||
readonly id: number;
|
||||
|
||||
/**
|
||||
* value for integer features
|
||||
*
|
||||
* @remarks integer
|
||||
*/
|
||||
public get value_i(): number;
|
||||
public set value_i(value_i: number);
|
||||
|
||||
/**
|
||||
* min value
|
||||
*
|
||||
* @remarks integer
|
||||
*/
|
||||
public get min_1(): number;
|
||||
public set min_1(min_1: number);
|
||||
|
||||
/**
|
||||
* max value
|
||||
*
|
||||
* @remarks integer
|
||||
*/
|
||||
public get max_i(): number;
|
||||
public set max_i(max_i: number);
|
||||
|
||||
/**
|
||||
* step size
|
||||
*
|
||||
* @remarks integer
|
||||
*/
|
||||
public get mod_i(): number;
|
||||
public set mod_i(mod_i: number);
|
||||
|
||||
/**
|
||||
* deprecated
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public get threaded(): boolean;
|
||||
public set threaded(threaded: boolean);
|
||||
|
||||
public get name(): string;
|
||||
public set name(name: string);
|
||||
|
||||
/**
|
||||
* d3d handler
|
||||
*
|
||||
* @privateRemarks
|
||||
*
|
||||
* it's only defined as `any` because I don't understand the d3d handler function enough
|
||||
*
|
||||
*/
|
||||
public get renderer(): any;
|
||||
public set renderer(renderer: any);
|
||||
|
||||
/**
|
||||
* show/hide featur
|
||||
*
|
||||
*/
|
||||
public get hidden(): boolean;
|
||||
public set hidden(hidden: boolean);
|
||||
|
||||
/**
|
||||
* additional context passed to script handlers
|
||||
*/
|
||||
public get data(): any;
|
||||
public set data(data: any);
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns Feat
|
||||
*/
|
||||
public toggle(): Feat;
|
||||
|
||||
}
|
||||
29
ts-lua/types/structs/MenuKey.d.ts
vendored
29
ts-lua/types/structs/MenuKey.d.ts
vendored
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
declare class MenuKey {
|
||||
|
||||
/**
|
||||
* vector of virtual keys
|
||||
*
|
||||
* @remarks table<uint32_t>
|
||||
*/
|
||||
readonly keys: object;
|
||||
|
||||
/**
|
||||
* @param virtualKeyCode uint32_t
|
||||
*/
|
||||
public push_vk(virtualKeyCode: number): void;
|
||||
|
||||
public push_str(key: string): boolean;
|
||||
|
||||
public pop(): void;
|
||||
|
||||
public clear(): void;
|
||||
|
||||
public is_down(): boolean;
|
||||
|
||||
public is_down_stepped(): boolean;
|
||||
|
||||
}
|
||||
42
ts-lua/types/structs/PlayerFeat.d.ts
vendored
42
ts-lua/types/structs/PlayerFeat.d.ts
vendored
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* a player feature
|
||||
* @public
|
||||
*/
|
||||
declare class PlayerFeat {
|
||||
|
||||
/**
|
||||
* only for testing,
|
||||
*
|
||||
* @param type "debug"
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* new Feat("debug")
|
||||
*
|
||||
*/
|
||||
constructor(type: "debug");
|
||||
|
||||
readonly feats: Feat[];
|
||||
|
||||
readonly id: number;
|
||||
|
||||
readonly parent_id: number;
|
||||
|
||||
/**
|
||||
* deprecated
|
||||
*/
|
||||
public get threaded(): boolean;
|
||||
public set threaded(threaded: boolean);
|
||||
|
||||
/**
|
||||
* Make sure you set the renderer with the PlayerFeat function, and not the Feat function. Otherwise the handler will not receive the player id in the second param.
|
||||
*
|
||||
* @privateRemarks
|
||||
*
|
||||
* it's only defined as `any` because I don't understand the d3d handler function enough
|
||||
*
|
||||
*/
|
||||
public get renderer(): any;
|
||||
public set renderer(renderer: any);
|
||||
|
||||
}
|
||||
27
ts-lua/types/structs/Regex.d.ts
vendored
27
ts-lua/types/structs/Regex.d.ts
vendored
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
declare class Regex {
|
||||
|
||||
/**
|
||||
* only for testing,
|
||||
*
|
||||
* @param type "debug"
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* new Feat("debug")
|
||||
*
|
||||
*/
|
||||
constructor(type: "debug");
|
||||
|
||||
readonly pattern: string;
|
||||
|
||||
constructor(pattern: string);
|
||||
|
||||
public search(subject: string): RegexResult;
|
||||
|
||||
public __tostring(): string;
|
||||
|
||||
}
|
||||
44
ts-lua/types/structs/RegexResult.d.ts
vendored
44
ts-lua/types/structs/RegexResult.d.ts
vendored
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* @privateRemarks
|
||||
*
|
||||
* example directly translated from the api docs and is untested
|
||||
*
|
||||
* I also don't know if javascript's regex will work
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* let r = new Regex("^(test123)"),
|
||||
* s = "test123 abcd 345345",
|
||||
* m = r.search(r, s)
|
||||
*
|
||||
* if (m.count > 0)
|
||||
* ui.notify_above_map(m.matches[1], "Lua regex", 140)
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
declare class RegexResult {
|
||||
|
||||
/**
|
||||
* only for testing,
|
||||
*
|
||||
* @param type "debug"
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* new Feat("debug")
|
||||
*
|
||||
*/
|
||||
constructor(type: "debug");
|
||||
|
||||
/**
|
||||
*
|
||||
* @remarks integer
|
||||
*/
|
||||
readonly count: number;
|
||||
|
||||
readonly matches: string[];
|
||||
|
||||
public __tostring(): string;
|
||||
|
||||
}
|
||||
64
ts-lua/types/structs/v2.d.ts
vendored
64
ts-lua/types/structs/v2.d.ts
vendored
@@ -1,64 +0,0 @@
|
||||
/**
|
||||
* a 2x1 matrix
|
||||
* @public
|
||||
*/
|
||||
declare class v2 {
|
||||
|
||||
/**
|
||||
*
|
||||
* @remarks float
|
||||
*/
|
||||
readonly x: number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @remarks float
|
||||
*/
|
||||
readonly y: number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param x float
|
||||
* @param y float
|
||||
*/
|
||||
constructor(x?: number, y?: number);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __add(val: v2|v3|number): v2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __sub(val: v2|v3|number): v2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __mul(val: v2|v3|number): v2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __div(val: v2|v3|number): v2;
|
||||
|
||||
public __eq(val: v2): boolean;
|
||||
|
||||
public __lt(val: v2): boolean;
|
||||
|
||||
public __le(val: v2): boolean;
|
||||
|
||||
public __tostring(): string
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns float
|
||||
*/
|
||||
public magnitude(val: v2|null): number;
|
||||
|
||||
}
|
||||
102
ts-lua/types/structs/v3.d.ts
vendored
102
ts-lua/types/structs/v3.d.ts
vendored
@@ -1,102 +0,0 @@
|
||||
/**
|
||||
* a 3x1 matrix
|
||||
*
|
||||
* @privateRemarks
|
||||
*
|
||||
* example directly translated from the api docs and is untested
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* let player_id = player.player_id(),
|
||||
* player_ped = player.get_player_ped(player_id),
|
||||
* pos = player.get_player_coords(player_id),
|
||||
* rot = entity.get_entity_rotation(player_ped),
|
||||
* dir = rot
|
||||
*
|
||||
* dir.transformRotToDir()
|
||||
* dir *= 4
|
||||
* pos += dir
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
declare class v3 {
|
||||
|
||||
/**
|
||||
*
|
||||
* @remarks float
|
||||
*/
|
||||
readonly x: number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @remarks float
|
||||
*/
|
||||
readonly y: number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @remarks float
|
||||
*/
|
||||
readonly z: number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param x float
|
||||
* @param y float
|
||||
* @param z float
|
||||
*/
|
||||
constructor(x?: number, y?: number, z?: number);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __add(val: v2|v3|number): v3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __sub(val: v2|v3|number): v3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __mul(val: v2|v3|number): v3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param val float
|
||||
*/
|
||||
public __div(val: v2|v3|number): v3;
|
||||
|
||||
public __eq(val: v2): boolean;
|
||||
|
||||
public __lt(val: v2): boolean;
|
||||
|
||||
public __le(val: v2): boolean;
|
||||
|
||||
public __tostring(): string
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns float
|
||||
*/
|
||||
public magnitude(val: v3|null): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @privateRemarks
|
||||
*
|
||||
* I don't understand this methough function enough to even try to test this in typescript
|
||||
*
|
||||
*/
|
||||
public transformRotToDir(): void;
|
||||
|
||||
public radToDeg(): void;
|
||||
|
||||
public degToRad(): void;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user