diff --git a/package-lock.json b/package-lock.json index 6147690..9ab9082 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,8 @@ "dependencies": { "@flamework/components": "^1.3.2", "@flamework/core": "^1.3.2", - "@flamework/networking": "^1.3.2" + "@flamework/networking": "^1.3.2", + "ts-patch": "^3.3.0" }, "devDependencies": { "@eslint/eslintrc": "^3.3.1", @@ -19,6 +20,7 @@ "@rbxts/compiler-types": "^3.0.0-types.0", "@rbxts/services": "^1.5.5", "@rbxts/signal": "^1.1.1", + "@rbxts/t": "^3.2.1", "@rbxts/types": "^1.0.882", "@typescript-eslint/eslint-plugin": "^8.44.0", "@typescript-eslint/parser": "^8.44.0", @@ -30,6 +32,7 @@ "rbxts-transformer-flamework": "^1.3.2", "rbxts-transformer-instances": "^1.0.1", "rbxts-transformer-services": "^1.1.1", + "rbxts-transformer-t-new-new": "^0.2.0", "roblox-ts": "^3.0.0", "typescript": "~5.5.3" } @@ -180,6 +183,12 @@ "@flamework/core": "*" } }, + "node_modules/@flamework/components/node_modules/@rbxts/t": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@rbxts/t/-/t-2.2.1.tgz", + "integrity": "sha512-MoFLHRQdm1tpAviAVxgkQj/ktxtnGBund2HXQj5xRqgYUWuC3kYuLkctuxXiJHUd1o1JzfU/HvVHtZfpqp61tg==", + "license": "ISC" + }, "node_modules/@flamework/core": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@flamework/core/-/core-1.3.2.tgz", @@ -193,12 +202,6 @@ "@rbxts/t": "^3.2.1" } }, - "node_modules/@flamework/core/node_modules/@rbxts/t": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@rbxts/t/-/t-3.2.1.tgz", - "integrity": "sha512-/fnf2QSx+TI3HSJ6QW2ikvGQk0mlx/63UXo60pLAKGqbxXiAuTJh88bpKpHw6aCzfFLJAwrVIcgCUOokLMPcag==", - "license": "ISC" - }, "node_modules/@flamework/networking": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@flamework/networking/-/networking-1.3.2.tgz", @@ -214,12 +217,6 @@ "@flamework/core": "*" } }, - "node_modules/@flamework/networking/node_modules/@rbxts/t": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@rbxts/t/-/t-3.2.1.tgz", - "integrity": "sha512-/fnf2QSx+TI3HSJ6QW2ikvGQk0mlx/63UXo60pLAKGqbxXiAuTJh88bpKpHw6aCzfFLJAwrVIcgCUOokLMPcag==", - "license": "ISC" - }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -355,9 +352,9 @@ "license": "ISC" }, "node_modules/@rbxts/t": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@rbxts/t/-/t-2.2.1.tgz", - "integrity": "sha512-MoFLHRQdm1tpAviAVxgkQj/ktxtnGBund2HXQj5xRqgYUWuC3kYuLkctuxXiJHUd1o1JzfU/HvVHtZfpqp61tg==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@rbxts/t/-/t-3.2.1.tgz", + "integrity": "sha512-/fnf2QSx+TI3HSJ6QW2ikvGQk0mlx/63UXo60pLAKGqbxXiAuTJh88bpKpHw6aCzfFLJAwrVIcgCUOokLMPcag==", "license": "ISC" }, "node_modules/@rbxts/types": { @@ -803,7 +800,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -813,7 +809,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -904,7 +899,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -974,7 +968,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -987,7 +980,6 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, "license": "MIT" }, "node_modules/concat-map": { @@ -1519,6 +1511,19 @@ "node": ">=0.10.0" } }, + "node_modules/expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -1709,7 +1714,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1725,6 +1729,21 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-installed-path": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/get-installed-path/-/get-installed-path-4.0.8.tgz", + "integrity": "sha512-PmANK1xElIHlHH2tXfOoTnSDUjX1X3GvKK6ZyLbUnSCCn1pADwu67eVWttuPzJWrXDDT2MfO6uAaKILOFfitmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "global-modules": "1.0.0" + }, + "engines": { + "node": ">=6", + "npm": ">=5", + "yarn": ">=1" + } + }, "node_modules/glob": { "version": "9.3.5", "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz", @@ -1783,6 +1802,51 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/globals": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", @@ -1814,7 +1878,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1831,7 +1894,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -1840,6 +1902,19 @@ "node": ">= 0.4" } }, + "node_modules/homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "parse-passwd": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -1890,6 +1965,13 @@ "node": ">=0.8.19" } }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, + "license": "ISC" + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -1907,7 +1989,6 @@ "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", - "dev": true, "license": "MIT", "dependencies": { "hasown": "^2.0.2" @@ -1962,6 +2043,16 @@ "node": ">=0.12.0" } }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2026,6 +2117,15 @@ "json-buffer": "3.0.1" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", @@ -2123,6 +2223,15 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/minipass": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz", @@ -2236,6 +2345,16 @@ "node": ">=6" } }, + "node_modules/parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2260,7 +2379,6 @@ "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, "license": "MIT" }, "node_modules/path-scurry": { @@ -2444,6 +2562,18 @@ "typescript": "^5.2.2" } }, + "node_modules/rbxts-transformer-t-new-new": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/rbxts-transformer-t-new-new/-/rbxts-transformer-t-new-new-0.2.0.tgz", + "integrity": "sha512-IS3z/SBv78ft/eDMu46boB5eyl2hBAffVoJzUeIzuVBe6z38mz9L/c7OvCvgEX9QGRZI+LmEJA/mgPR6gH7Bsw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@rbxts/t": "^3.1.1", + "get-installed-path": "^4.0.8", + "typescript": "^5.5.4" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -2481,7 +2611,6 @@ "version": "1.22.11", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", - "dev": true, "license": "MIT", "dependencies": { "is-core-module": "^2.16.1", @@ -2498,6 +2627,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -2597,7 +2740,6 @@ "version": "7.7.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", - "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -2684,7 +2826,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -2710,7 +2851,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -2723,7 +2863,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -2774,6 +2913,71 @@ "typescript": ">=4.8.4" } }, + "node_modules/ts-patch": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-3.3.0.tgz", + "integrity": "sha512-zAOzDnd5qsfEnjd9IGy1IRuvA7ygyyxxdxesbhMdutt8AHFjD8Vw8hU2rMF89HX1BKRWFYqKHrO8Q6lw0NeUZg==", + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2", + "global-prefix": "^4.0.0", + "minimist": "^1.2.8", + "resolve": "^1.22.2", + "semver": "^7.6.3", + "strip-ansi": "^6.0.1" + }, + "bin": { + "ts-patch": "bin/ts-patch.js", + "tspc": "bin/tspc.js" + } + }, + "node_modules/ts-patch/node_modules/global-prefix": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-4.0.0.tgz", + "integrity": "sha512-w0Uf9Y9/nyHinEk5vMJKRie+wa4kR5hmDbEhGGds/kG1PwGLLHKRoNMeJOyCQjjBkANlnScqgzcFwGHgmgLkVA==", + "license": "MIT", + "dependencies": { + "ini": "^4.1.3", + "kind-of": "^6.0.3", + "which": "^4.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/ts-patch/node_modules/ini": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz", + "integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==", + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/ts-patch/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "license": "ISC", + "engines": { + "node": ">=16" + } + }, + "node_modules/ts-patch/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index b616048..a3d2dab 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "build": "rbxtsc", "watch": "rbxtsc -w", - "lint": "eslint" + "lint": "eslint", + "prepare": "ts-patch install -s" }, "keywords": [], "author": "Aconit team", @@ -18,6 +19,7 @@ "@rbxts/compiler-types": "^3.0.0-types.0", "@rbxts/services": "^1.5.5", "@rbxts/signal": "^1.1.1", + "@rbxts/t": "^3.2.1", "@rbxts/types": "^1.0.882", "@typescript-eslint/eslint-plugin": "^8.44.0", "@typescript-eslint/parser": "^8.44.0", @@ -29,12 +31,14 @@ "rbxts-transformer-flamework": "^1.3.2", "rbxts-transformer-instances": "^1.0.1", "rbxts-transformer-services": "^1.1.1", + "rbxts-transformer-t-new-new": "^0.2.0", "roblox-ts": "^3.0.0", "typescript": "~5.5.3" }, "dependencies": { "@flamework/components": "^1.3.2", "@flamework/core": "^1.3.2", - "@flamework/networking": "^1.3.2" + "@flamework/networking": "^1.3.2", + "ts-patch": "^3.3.0" } -} +} \ No newline at end of file diff --git a/src/client/controllers/gameplay.ts b/src/client/controllers/gameplay.ts new file mode 100644 index 0000000..431220d --- /dev/null +++ b/src/client/controllers/gameplay.ts @@ -0,0 +1,29 @@ +import { GuiService, Players, UserInputService } from "@rbxts/services"; +import { GameplayClientEvents } from "../networking"; +import { Controller, OnStart } from "@flamework/core"; + +@Controller() +class GameplayController implements OnStart { + private player = Players.LocalPlayer; + onStart(): void { + UserInputService.InputBegan.Connect((input) => { + if (input.KeyCode === Enum.KeyCode.LeftShift) { + GameplayClientEvents.sprint(true); + } + }); + + UserInputService.InputEnded.Connect((input) => { + if (input.KeyCode === Enum.KeyCode.LeftShift) { + GameplayClientEvents.sprint(false); + } + }); + + const staminavalue = this.player.WaitForChild("Stamina") as NumberValue; + const playergui = this.player.WaitForChild("PlayerGui"); + const label = playergui.WaitForChild("Main").WaitForChild("Stamina") as TextLabel; + staminavalue.Changed.Connect((newvalue) => { + label.Text = tostring(newvalue); + }); + label.Text = tostring(staminavalue.Value); + } +} diff --git a/src/client/main.client.ts b/src/client/main.client.ts deleted file mode 100644 index 6e38d71..0000000 --- a/src/client/main.client.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { UserInputService } from "@rbxts/services"; -import { GameplayClientEvents } from "./networking"; -import { Controller, OnStart } from "@flamework/core"; - -@Controller() -class GameplayController implements OnStart { - onStart(): void { - UserInputService.InputBegan.Connect((input) => { - if (input.KeyCode === Enum.KeyCode.LeftShift) { - GameplayClientEvents.sprint(true); - } - }); - - UserInputService.InputEnded.Connect((input) => { - if (input.KeyCode === Enum.KeyCode.LeftShift) { - GameplayClientEvents.sprint(false); - } - }); - } -} diff --git a/src/client/runtime.client.ts b/src/client/runtime.client.ts new file mode 100644 index 0000000..88841d4 --- /dev/null +++ b/src/client/runtime.client.ts @@ -0,0 +1,7 @@ +import { Flamework } from "@flamework/core"; + +// Flamework.addPaths("src/client/components"); +Flamework.addPaths("src/client/controllers"); +// Flamework.addPaths("src/shared/components"); + +Flamework.ignite(); diff --git a/src/server/gameplay.server.ts b/src/server/gameplay.server.ts deleted file mode 100644 index c0fd5d9..0000000 --- a/src/server/gameplay.server.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Players } from "@rbxts/services"; -import { GameplayServerEvents } from "./networking"; -import { OnStart, Service } from "@flamework/core"; -import { RagdollHandler } from "shared/ragdoll"; - -/** - * Service related to Gameplay. - * - Contains Script related to Sprinting, Ragdoll, etc. - */ -@Service() -class GameplayService implements OnStart { - // Sprint config. - private base_sprint_speed = 16; - private sprint_speed = 1.5; - private is_running = new Map(); - - onStart(): void { - // Handle Animation. - const RunAnim = new Animation(); - RunAnim.AnimationId = "rbxassetid://88297455683117"; - - Players.PlayerAdded.Connect((player) => { - let running_connection: RBXScriptConnection; - - player.CharacterAdded.Connect((character) => { - const ragdollhandler = new RagdollHandler(character); - ragdollhandler.getRagdollFallingEvent().Connect(() => { - ragdollhandler.ragdoll(); - ragdollhandler.waitMotionLess().Wait(); - ragdollhandler.stopRagdoll(); - }); - - const humanoid = character.FindFirstChildWhichIsA("Humanoid"); - if (humanoid) { - // Setup the animation. - const animator = humanoid.WaitForChild("Animator") as Animator; - const animation_track = animator.LoadAnimation(RunAnim); - animation_track.Priority = Enum.AnimationPriority.Action; - - // Change the animation when the running speed change. - running_connection = humanoid.Running.Connect((speed) => { - if (this.is_running.get(player.UserId)) { - if (speed > 2) { - if (!animation_track.IsPlaying) animation_track.Play(0.2); - } else { - if (animation_track.IsPlaying) animation_track?.Stop(0.2); - } - } else if (animation_track?.IsPlaying) { - animation_track?.Stop(1); - } - }); - } - }); - // Clean up the connection when the character died. - player.CharacterRemoving.Once(() => running_connection.Disconnect()); - }); - - // Change the sprint state with networking - GameplayServerEvents.sprint.connect((player, enabled) => { - const character = player.Character; - this.is_running.set(player.UserId, enabled); - if (character) { - const humanoid = character.FindFirstChildOfClass("Humanoid"); - if (humanoid) { - if (enabled) { - humanoid.WalkSpeed = this.base_sprint_speed * this.sprint_speed; - } else { - humanoid.WalkSpeed = this.base_sprint_speed; - } - } - } - }); - } -} diff --git a/src/server/runtime.server.ts b/src/server/runtime.server.ts new file mode 100644 index 0000000..5728924 --- /dev/null +++ b/src/server/runtime.server.ts @@ -0,0 +1,7 @@ +import { Flamework } from "@flamework/core"; + +// Flamework.addPaths("src/server/components"); +Flamework.addPaths("src/server/services"); +// Flamework.addPaths("src/shared/components"); + +Flamework.ignite(); diff --git a/src/server/command.server.ts b/src/server/services/command.ts similarity index 95% rename from src/server/command.server.ts rename to src/server/services/command.ts index 48834b6..753f59c 100644 --- a/src/server/command.server.ts +++ b/src/server/services/command.ts @@ -1,6 +1,6 @@ import { OnStart, Service } from "@flamework/core"; import { Players, TextChatService } from "@rbxts/services"; -import { RagdollHandler, takeNetworkOwner } from "shared/ragdoll"; +import { RagdollHandler, takeNetworkOwner } from "shared/ownership"; /** * Setup Chat Command diff --git a/src/server/decoration.server.ts b/src/server/services/decoration.ts similarity index 100% rename from src/server/decoration.server.ts rename to src/server/services/decoration.ts diff --git a/src/server/services/gameplay/ragdoll.ts b/src/server/services/gameplay/ragdoll.ts new file mode 100644 index 0000000..4a8723b --- /dev/null +++ b/src/server/services/gameplay/ragdoll.ts @@ -0,0 +1,20 @@ +import { OnStart, Service } from "@flamework/core"; +import { RagdollHandler } from "shared/ownership"; +import { OnPlayerJoined } from "../modding/playerjoinservice"; + +/** + * Service related to Ragdoll. + */ +@Service() +class RagdollService implements OnPlayerJoined { + onPlayerJoined(player: Player): void { + player.CharacterAdded.Connect((character) => { + const ragdollhandler = new RagdollHandler(character); + ragdollhandler.getRagdollFallingEvent().Connect(() => { + ragdollhandler.ragdoll(); + ragdollhandler.waitMotionLess().Wait(); + ragdollhandler.stopRagdoll(); + }); + }); + } +} diff --git a/src/server/services/gameplay/sprint.ts b/src/server/services/gameplay/sprint.ts new file mode 100644 index 0000000..849d861 --- /dev/null +++ b/src/server/services/gameplay/sprint.ts @@ -0,0 +1,122 @@ +import { OnStart, Service } from "@flamework/core"; +import { Players } from "@rbxts/services"; +import { GameplayServerEvents } from "server/networking"; +import { OnPlayerJoined } from "../modding/playerjoinservice"; + +/** + * Service related to Sprinting. + */ +@Service() +class SprintService implements OnStart, OnPlayerJoined { + // Sprint config. + private default_stamina = 100; + private base_sprint_speed = 16; + private sprint_speed = 1.5; + private animation_id = "rbxassetid://88297455683117"; + + // Cache + private is_running = new Set(); + private is_sprinting = new Set(); + private stamina = new Map(); + private timeout = new Map(); + private runanim = new Animation(); + + constructor() { + // Handle Animation. + this.runanim.AnimationId = this.animation_id; + } + + onStart(): void { + // Handle stamina gestion + task.spawn(() => { + while (true) { + for (const player of Players.GetPlayers()) { + if (this.timeout.has(player.UserId)) { + this.timeout.set(player.UserId, this.timeout.get(player.UserId)! - 1); + if (this.timeout.get(player.UserId)! <= 0) { + this.timeout.delete(player.UserId); + } + continue; + } + const stamina = this.stamina.get(player.UserId); + if (!stamina) continue; + if (this.is_sprinting.has(player.UserId)) { + stamina.Value = math.max(0, stamina.Value - 1); + if (stamina.Value <= 0) { + this.timeout.set(player.UserId, 30); + this.is_running.delete(player.UserId); + const humanoid = player.Character!.FindFirstChildOfClass("Humanoid"); + if (humanoid) { + humanoid.WalkSpeed = this.base_sprint_speed; + } + } + } else { + stamina.Value = math.min(stamina.GetAttribute("Max")! as number, stamina.Value + 1); + } + } + task.wait(0.075); + } + }); + + // Change the sprint state with networking + GameplayServerEvents.sprint.connect((player, enabled) => { + if (this.timeout.has(player.UserId)) return; + const character = player.Character; + enabled ? this.is_running.add(player.UserId) : this.is_running.delete(player.UserId); + if (character) { + const humanoid = character.FindFirstChildOfClass("Humanoid"); + if (humanoid) { + if (enabled) { + humanoid.WalkSpeed = this.base_sprint_speed * this.sprint_speed; + } else { + humanoid.WalkSpeed = this.base_sprint_speed; + } + } + } + }); + } + onPlayerJoined(player: Player): void { + let running_connection: RBXScriptConnection; + + const stamina = new Instance("NumberValue"); + stamina.Name = "Stamina"; + stamina.Value = this.default_stamina; + stamina.Parent = player; + stamina.SetAttribute("Max", this.default_stamina); + this.stamina.set(player.UserId, stamina); + + player.CharacterAdded.Connect((character) => { + const humanoid = character.FindFirstChildWhichIsA("Humanoid"); + if (humanoid) { + // Setup the animation. + const animator = humanoid.WaitForChild("Animator") as Animator; + const animation_track = animator.LoadAnimation(this.runanim); + animation_track.Priority = Enum.AnimationPriority.Action; + + // Change the animation when the running speed change. + running_connection = humanoid.Running.Connect((speed) => { + if (this.is_running.has(player.UserId)) { + if (speed > 2) { + if (!animation_track.IsPlaying) { + animation_track.Play(0.2); + this.is_sprinting.add(player.UserId); + } + } else { + if (animation_track.IsPlaying) { + animation_track?.Stop(0.2); + this.is_sprinting.delete(player.UserId); + } + } + } else if (animation_track?.IsPlaying) { + { + animation_track?.Stop(1); + this.is_sprinting.delete(player.UserId); + } + } + }); + } + }); + // Clean up the connection when the character died. + player.CharacterRemoving.Once(() => running_connection.Disconnect()); + } +} diff --git a/src/server/services/modding/playerjoinservice.ts b/src/server/services/modding/playerjoinservice.ts new file mode 100644 index 0000000..0ba131c --- /dev/null +++ b/src/server/services/modding/playerjoinservice.ts @@ -0,0 +1,28 @@ +import { Modding, OnStart, Service } from "@flamework/core"; +import { Players } from "@rbxts/services"; + +export interface OnPlayerJoined { + onPlayerJoined(player: Player): void; +} + +@Service() +class PlayerJoinService implements OnStart { + onStart() { + const listeners = new Set(); + + Modding.onListenerAdded((object) => listeners.add(object)); + Modding.onListenerRemoved((object) => listeners.delete(object)); + + Players.PlayerAdded.Connect((player) => { + for (const listener of listeners) { + task.spawn(() => listener.onPlayerJoined(player)); + } + }); + + for (const player of Players.GetPlayers()) { + for (const listener of listeners) { + task.spawn(() => listener.onPlayerJoined(player)); + } + } + } +} diff --git a/src/shared/networking.ts b/src/shared/networking.ts index c1be6e2..6d33123 100644 --- a/src/shared/networking.ts +++ b/src/shared/networking.ts @@ -1,11 +1,9 @@ import { Networking } from "@flamework/networking"; -const { createEvent } = Networking; - interface GameplayClient { sprint(enabled: boolean): void; } interface GameplayServer {} -export const GameplayEvents = createEvent(); +export const GameplayEvents = Networking.createEvent(); diff --git a/src/shared/ragdoll.ts b/src/shared/ownership.ts similarity index 96% rename from src/shared/ragdoll.ts rename to src/shared/ownership.ts index e8d37bc..c83186e 100644 --- a/src/shared/ragdoll.ts +++ b/src/shared/ownership.ts @@ -46,9 +46,10 @@ export class RagdollHandler { constructor(character: Model) { this.character = character; - const humanoid = character.FindFirstAncestorOfClass("Humanoid"); + const humanoid = character.WaitForChild("Humanoid"); const root = character.FindFirstChild("HumanoidRootPart"); - if (!humanoid || !root?.IsA("Part")) throw '"character" isn\'t a player Character. Failed to handle ragdoll.'; + if (!humanoid?.IsA("Humanoid") || !root?.IsA("Part")) + throw '"character" isn\'t a player Character. Failed to handle ragdoll.'; this.humanoid = humanoid; this.root = root; this.prepareRagdoll(); diff --git a/tsconfig.json b/tsconfig.json index a0c642d..69e7f35 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,7 @@ "target": "ESNext", "typeRoots": [ "node_modules/@rbxts", - "node_modules/@flamework" + "node_modules/@flamework", ], // configurable "rootDir": "src", @@ -28,15 +28,18 @@ "plugins": [ { "transform": "rbxts-transformer-flamework", - "obfuscation": true }, { "transform": "rbxts-transformer-instances" }, { "transform": "rbxts-transformer-services" + }, + { + "transform": "rbxts-transformer-t-new-new" } - ] + ], + "removeComments": true }, "include": [ "src/**/*",