@amxts/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/README.ru.md +162 -0
- package/amxmodx/base/include/amxconst.inc +594 -0
- package/amxmodx/base/include/amxmisc.inc +902 -0
- package/amxmodx/base/include/amxmodx.inc +3447 -0
- package/amxmodx/base/include/amxmodx_version.inc +20 -0
- package/amxmodx/base/include/cellarray.inc +525 -0
- package/amxmodx/base/include/cellstack.inc +166 -0
- package/amxmodx/base/include/celltrie.inc +412 -0
- package/amxmodx/base/include/core.inc +202 -0
- package/amxmodx/base/include/csstats.inc +298 -0
- package/amxmodx/base/include/csstats_const.inc +29 -0
- package/amxmodx/base/include/cstrike.inc +1287 -0
- package/amxmodx/base/include/cstrike_const.inc +521 -0
- package/amxmodx/base/include/csx.inc +259 -0
- package/amxmodx/base/include/cvars.inc +547 -0
- package/amxmodx/base/include/datapack.inc +161 -0
- package/amxmodx/base/include/dbi.inc +154 -0
- package/amxmodx/base/include/dodconst.inc +152 -0
- package/amxmodx/base/include/dodfun.inc +152 -0
- package/amxmodx/base/include/dodstats.inc +69 -0
- package/amxmodx/base/include/dodx.inc +161 -0
- package/amxmodx/base/include/engine.inc +1343 -0
- package/amxmodx/base/include/engine_const.inc +310 -0
- package/amxmodx/base/include/engine_stocks.inc +248 -0
- package/amxmodx/base/include/esf.inc +70 -0
- package/amxmodx/base/include/esf_const.inc +74 -0
- package/amxmodx/base/include/fakemeta.inc +1127 -0
- package/amxmodx/base/include/fakemeta_const.inc +793 -0
- package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
- package/amxmodx/base/include/fakemeta_util.inc +882 -0
- package/amxmodx/base/include/file.inc +666 -0
- package/amxmodx/base/include/float.inc +422 -0
- package/amxmodx/base/include/fun.inc +333 -0
- package/amxmodx/base/include/gameconfig.inc +93 -0
- package/amxmodx/base/include/geoip.inc +264 -0
- package/amxmodx/base/include/ham_const.inc +4352 -0
- package/amxmodx/base/include/hamsandwich.inc +439 -0
- package/amxmodx/base/include/hlsdk_const.inc +808 -0
- package/amxmodx/base/include/json.inc +777 -0
- package/amxmodx/base/include/lang.inc +119 -0
- package/amxmodx/base/include/message_const.inc +1130 -0
- package/amxmodx/base/include/message_stocks.inc +161 -0
- package/amxmodx/base/include/messages.inc +604 -0
- package/amxmodx/base/include/newmenus.inc +387 -0
- package/amxmodx/base/include/ns.inc +754 -0
- package/amxmodx/base/include/ns_const.inc +196 -0
- package/amxmodx/base/include/nvault.inc +154 -0
- package/amxmodx/base/include/regex.inc +348 -0
- package/amxmodx/base/include/sockets.inc +183 -0
- package/amxmodx/base/include/sorting.inc +107 -0
- package/amxmodx/base/include/sqlx.inc +582 -0
- package/amxmodx/base/include/string.inc +786 -0
- package/amxmodx/base/include/string_const.inc +156 -0
- package/amxmodx/base/include/string_stocks.inc +325 -0
- package/amxmodx/base/include/textparse_ini.inc +214 -0
- package/amxmodx/base/include/textparse_smc.inc +261 -0
- package/amxmodx/base/include/tfcconst.inc +84 -0
- package/amxmodx/base/include/tfcstats.inc +62 -0
- package/amxmodx/base/include/tfcx.inc +148 -0
- package/amxmodx/base/include/time.inc +118 -0
- package/amxmodx/base/include/tsconst.inc +154 -0
- package/amxmodx/base/include/tsfun.inc +198 -0
- package/amxmodx/base/include/tsstats.inc +65 -0
- package/amxmodx/base/include/tsx.inc +88 -0
- package/amxmodx/base/include/vault.inc +60 -0
- package/amxmodx/base/include/vector.inc +131 -0
- package/amxmodx/base/include/xs.inc +1570 -0
- package/as/amxts.d.ts +153 -0
- package/as/constants.ts +4730 -0
- package/as/effects.ts +1449 -0
- package/as/entities.ts +5482 -0
- package/as/events.ts +3054 -0
- package/as/facade.ts +4639 -0
- package/as/flags.ts +299 -0
- package/as/fs.ts +287 -0
- package/as/hooks.ts +18536 -0
- package/as/kit.ts +25 -0
- package/as/lib/check.ts +86 -0
- package/as/modules/http.ts +184 -0
- package/as/natives.ts +11845 -0
- package/as/os.ts +30 -0
- package/as/promise.ts +1392 -0
- package/as/promise.types.d.ts +82 -0
- package/as/remote.ts +288 -0
- package/as/tsconfig.json +22 -0
- package/as/vector.ts +65 -0
- package/bin/amxts.mjs +10 -0
- package/includes/menu_core.inc +355 -0
- package/includes/order.txt +54 -0
- package/includes/sources.json +27 -0
- package/includes/universal_config.inc +355 -0
- package/lint/oxlint-plugin.mjs +77 -0
- package/node_modules/assemblyscript/LICENSE +201 -0
- package/node_modules/assemblyscript/NOTICE +93 -0
- package/node_modules/assemblyscript/package.json +63 -0
- package/node_modules/assemblyscript/std/README.md +6 -0
- package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
- package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
- package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
- package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
- package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
- package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
- package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
- package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
- package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
- package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
- package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
- package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
- package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
- package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
- package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
- package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
- package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
- package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
- package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
- package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
- package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
- package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
- package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
- package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
- package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
- package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
- package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
- package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
- package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
- package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
- package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
- package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
- package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
- package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
- package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
- package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
- package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
- package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
- package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
- package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
- package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
- package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
- package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
- package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
- package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
- package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
- package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
- package/node_modules/assemblyscript/std/assembly.json +16 -0
- package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
- package/node_modules/assemblyscript/std/portable/index.js +416 -0
- package/node_modules/assemblyscript/std/portable.json +11 -0
- package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
- package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
- package/node_modules/assemblyscript/tsconfig-base.json +13 -0
- package/package.json +112 -0
- package/runtime/deps/assemblyscript/LICENSE +201 -0
- package/runtime/deps/assemblyscript/NOTICE +93 -0
- package/runtime/deps/assemblyscript/bin/asc.js +35 -0
- package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
- package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
- package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
- package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
- package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
- package/runtime/deps/assemblyscript/package.json +114 -0
- package/runtime/host/amxts.inc +85 -0
- package/runtime/licenses/AMXX-LICENSE.txt +34 -0
- package/runtime/licenses/AssemblyScript-LICENSE +201 -0
- package/runtime/licenses/AssemblyScript-NOTICE +93 -0
- package/runtime/licenses/Binaryen-LICENSE +201 -0
- package/runtime/licenses/Bun-LICENSE.md +84 -0
- package/runtime/licenses/GPL-3.0.txt +674 -0
- package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
- package/runtime/licenses/README.md +25 -0
- package/runtime/licenses/WAMR-LICENSE +219 -0
- package/runtime/natives.txt +1095 -0
- package/runtime/patches/README.md +59 -0
- package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
- package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
- package/scripts/apply-docs.ts +508 -0
- package/scripts/asc.ts +27 -0
- package/scripts/auto-imports.ts +258 -0
- package/scripts/build-wasm.ts +595 -0
- package/scripts/check.ts +93 -0
- package/scripts/compile-cache.ts +179 -0
- package/scripts/compile.ts +401 -0
- package/scripts/docker-server.ts +73 -0
- package/scripts/docs/as/amxts.ts +210 -0
- package/scripts/docs/as/effects.ts +1684 -0
- package/scripts/docs/as/facade.ts +3302 -0
- package/scripts/docs/as/fs.ts +173 -0
- package/scripts/docs/as/lib/check.ts +68 -0
- package/scripts/docs/as/modules/http.ts +66 -0
- package/scripts/docs/as/os.ts +16 -0
- package/scripts/docs/as/promise.ts +132 -0
- package/scripts/docs/as/promise.types.ts +63 -0
- package/scripts/docs/as/vector.ts +48 -0
- package/scripts/docs/entities.ts +2338 -0
- package/scripts/docs/events.ts +245 -0
- package/scripts/docs/game.ts +497 -0
- package/scripts/docs/messages.ts +148 -0
- package/scripts/file-contents.ts +74 -0
- package/scripts/includes.ts +134 -0
- package/scripts/player-fields.ts +866 -0
- package/scripts/plugin-cache.ts +92 -0
- package/scripts/plugin-natives.ts +1157 -0
- package/scripts/prebuilt.ts +268 -0
- package/scripts/prepare.ts +134 -0
- package/scripts/project.ts +973 -0
- package/scripts/run.ts +28 -0
- package/scripts/shared-modules.ts +906 -0
- package/scripts/system.ts +33 -0
- package/scripts/tracked-fs.ts +115 -0
- package/scripts/typed-configs.ts +788 -0
- package/scripts/ui.ts +77 -0
- package/src/cli-api.mjs +175 -0
- package/src/parser/include-parser.ts +506 -0
- package/src/system.mjs +155 -0
- package/src/testing/compile-cache.ts +31 -0
- package/src/testing/compile.ts +222 -0
- package/src/testing/coroutines.ts +191 -0
- package/src/testing/index.ts +39 -0
- package/src/testing/kits.ts +55 -0
- package/src/testing/memory.ts +125 -0
- package/src/testing/natives.ts +925 -0
- package/src/testing/server.ts +1874 -0
- package/src/testing/setup.ts +63 -0
- package/src/testing/tables.ts +139 -0
- package/src/types.ts +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kukson777
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="assets/logo.svg" alt="amxts" width="96" height="96">
|
|
4
|
+
|
|
5
|
+
# amxts
|
|
6
|
+
|
|
7
|
+
*Counter-Strike 1.6 plugins in TypeScript*
|
|
8
|
+
|
|
9
|
+
[Documentation](https://amxts.github.io/) • [Getting started](https://amxts.github.io/docs/getting-started/quick-start) • [Modules](https://amxts.github.io/modules) • [Building from source](#building-from-source)
|
|
10
|
+
|
|
11
|
+
**English** | [Русский](README.ru.md)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
amxts is a framework for writing AMX Mod X plugins in TypeScript. A plugin is
|
|
16
|
+
an ordinary `.ts` file - classes, closures, `async`/`await`, events you
|
|
17
|
+
listen to - compiled ahead of time to native code and run inside AMX Mod X,
|
|
18
|
+
next to your Pawn plugins. The two call each other: a TypeScript plugin
|
|
19
|
+
exports natives and forwards for Pawn, and calls any native of any module or
|
|
20
|
+
plugin.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **TypeScript you already know.** `number`, `string`, arrays, `Map`,
|
|
25
|
+
classes, interfaces with optional fields, closures, `async`/`await` with
|
|
26
|
+
`AbortSignal`.
|
|
27
|
+
- **Players and entities are objects.** `player.health = 100`,
|
|
28
|
+
`player.team == "CT"`, `player.hideHud.push("Money")`,
|
|
29
|
+
`entity.renderMode = "additive"`.
|
|
30
|
+
- **Events as in the DOM.** `server.addEventListener("putinserver", ...)`,
|
|
31
|
+
`game.addEventListener("takeDamage", ...)` for the game's events (reapi's
|
|
32
|
+
hookchains and Ham Sandwich's functions), with
|
|
33
|
+
`event.preventDefault()` and an answer by `return`.
|
|
34
|
+
- **The editor knows the game.** Every native, reapi field and hookchain
|
|
35
|
+
comes with its type and a tooltip in English or Russian; a typo is a red
|
|
36
|
+
line, not a runtime error.
|
|
37
|
+
- **No import lines.** `Player`, `server`, `print` and the modules' names are
|
|
38
|
+
auto-imported: the build adds what a plugin uses, and nothing else.
|
|
39
|
+
- **Save and play.** `amxts dev` rebuilds what you saved, deploys it and
|
|
40
|
+
reloads the running server - no map change, nobody disconnected.
|
|
41
|
+
- **Tests without a server.** Your plugin runs on a fake server under
|
|
42
|
+
`bun test`, driven as players would drive it.
|
|
43
|
+
- **Faster than Pawn.** Plugins are machine code by the time the server loads
|
|
44
|
+
them; on the hot path of a real plugin that is about three times faster
|
|
45
|
+
than the same logic in Pawn.
|
|
46
|
+
- **Modules, one per server.** `amxts.config.ts` lists them, `amxts module add`
|
|
47
|
+
installs them, and each runs once per server for every plugin that
|
|
48
|
+
uses it; a module no plugin uses is not built.
|
|
49
|
+
|
|
50
|
+
## Requirements
|
|
51
|
+
|
|
52
|
+
On the server:
|
|
53
|
+
|
|
54
|
+
- **Windows or Linux** - the `amxts_amxx` module is `amxts_amxx.dll` or
|
|
55
|
+
`amxts_amxx_i386.so`, both tested on a real server. A plugin is compiled
|
|
56
|
+
for its server's system, which the build reads off the server's folder
|
|
57
|
+
(or `--os`).
|
|
58
|
+
- **ReHLDS with ReGameDLL and reapi** - recommended, and what amxts is tested
|
|
59
|
+
on. Entity fields and the game events reapi delivers need it; plain HLDS
|
|
60
|
+
has not been tried.
|
|
61
|
+
- **AMX Mod X 1.9** or later.
|
|
62
|
+
|
|
63
|
+
To write plugins: [Node.js](https://nodejs.org) 20.12+. The build runs on
|
|
64
|
+
[Bun](https://bun.sh), which the core installs itself - nothing to set up.
|
|
65
|
+
|
|
66
|
+
## Getting started
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npm create amxts@latest # or: pnpm create amxts, yarn create amxts, bun create amxts
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
It asks for the package manager, the folder, the modules, lint and the
|
|
73
|
+
server's folder, writes a project with a first plugin and its test, and
|
|
74
|
+
installs everything.
|
|
75
|
+
|
|
76
|
+
> [!WARNING]
|
|
77
|
+
> The packages are not on npm yet. Until they are, create a project from a
|
|
78
|
+
> clone of this repository, with [amxts-cli](https://github.com/amxts/amxts-cli)
|
|
79
|
+
> (the `amxts` command) and the official modules cloned beside it; it links
|
|
80
|
+
> the core and the modules instead of installing them:
|
|
81
|
+
> `node <core>/bin/amxts.mjs init my-server --local`.
|
|
82
|
+
> See [getting started](https://amxts.github.io/docs/getting-started/quick-start#a-project).
|
|
83
|
+
|
|
84
|
+
Then, in the project:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
npx amxts dev # build, deploy to the server in AMXTS_SERVER, again on every save
|
|
88
|
+
npx amxts build --deploy # build once and deploy
|
|
89
|
+
npx amxts test # the tests, on a fake server
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## A plugin
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// plugins/hello.ts
|
|
96
|
+
plugin({ name: "Hello", version: "1.0.0", author: "you", description: "An example" });
|
|
97
|
+
|
|
98
|
+
server.addCommand("/hp", sayHp);
|
|
99
|
+
server.addEventListener("putinserver", (event) => {
|
|
100
|
+
print(0, `${event.player.name} joined`);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
function sayHp(player: Player) {
|
|
104
|
+
print(player, `${player.name}, your HP: ${player.health}`);
|
|
105
|
+
|
|
106
|
+
if (player.health < 50) player.health = 100;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Modules
|
|
111
|
+
|
|
112
|
+
The core includes no modules: a project lists the ones it uses in
|
|
113
|
+
`amxts.config.ts`, and `npx amxts module add <name>` installs one. The
|
|
114
|
+
official modules, kept by the amxts authors:
|
|
115
|
+
|
|
116
|
+
| module | what |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| [menu-core](https://github.com/amxts/menu-core) | menus from INI, YAML or JSON files or from code: conditions, lists, countdowns - and the `mc_*` natives for Pawn plugins |
|
|
119
|
+
| [config-core](https://github.com/amxts/config-core) | configs in INI, YAML or JSON, read into typed objects and written back - and the `cfg_*` natives for Pawn plugins |
|
|
120
|
+
| [resemiclip](https://github.com/amxts/resemiclip) | who walks through whom, as a rule over two players, over the ReSemiclip module |
|
|
121
|
+
|
|
122
|
+
`fetch` over easy_http comes with the core (`~/modules/http`). More modules
|
|
123
|
+
are in the [catalog](https://amxts.github.io/modules), and
|
|
124
|
+
`npx amxts init --module` starts your own.
|
|
125
|
+
|
|
126
|
+
## Editor support
|
|
127
|
+
|
|
128
|
+
[amxts for VS Code](https://github.com/amxts/amxts-vscode) gives menu and
|
|
129
|
+
config files completion, checks and navigation, from the names your plugins
|
|
130
|
+
register as you type them. TypeScript itself needs nothing extra: a project's
|
|
131
|
+
`tsconfig.json` is ready for any editor.
|
|
132
|
+
|
|
133
|
+
## Documentation
|
|
134
|
+
|
|
135
|
+
[amxts.github.io](https://amxts.github.io/) - getting started, the API,
|
|
136
|
+
modules, testing and what amxts cannot do yet, in English and Russian. The
|
|
137
|
+
sources are in [`docs`](docs).
|
|
138
|
+
|
|
139
|
+
## Building from source
|
|
140
|
+
|
|
141
|
+
Working on amxts itself takes Bun, an AMX Mod X 1.10 distribution
|
|
142
|
+
(`bun run setup:amxmodx`), for the Windows module Windows with CMake and
|
|
143
|
+
Visual Studio (32-bit) and LLVM 18 for `wamrc`, for the Linux one Docker
|
|
144
|
+
(`bun run build:linux`, `bun run test:server --linux`), and the official
|
|
145
|
+
modules and the `amxts` command ([amxts-cli](https://github.com/amxts/amxts-cli))
|
|
146
|
+
checked out beside the core. The compilers are patched - AssemblyScript
|
|
147
|
+
0.28.20 and WAMR 2.4.5 - and the generated API is not committed:
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
npm install --no-package-lock # npm, not bun: it links the file: folders
|
|
151
|
+
bun run generate # after the compilers are built and patched
|
|
152
|
+
bun run test
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
[`CONTRIBUTING.md`](CONTRIBUTING.md) has every step, the checks and how to
|
|
156
|
+
send a change.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
[MIT](LICENSE). The server module and the host plugin built from this code use
|
|
161
|
+
AMX Mod X's SDK, so they are distributed under GPL-3.0-or-later. Third-party
|
|
162
|
+
licenses: [`runtime/licenses`](runtime/licenses/README.md).
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="assets/logo.svg" alt="amxts" width="96" height="96">
|
|
4
|
+
|
|
5
|
+
# amxts
|
|
6
|
+
|
|
7
|
+
*Плагины для Counter-Strike 1.6 на TypeScript*
|
|
8
|
+
|
|
9
|
+
[Документация](https://amxts.github.io/ru/) • [Начало работы](https://amxts.github.io/ru/docs/getting-started/quick-start) • [Модули](https://amxts.github.io/ru/modules) • [Сборка из исходников](#сборка-из-исходников)
|
|
10
|
+
|
|
11
|
+
[English](README.md) | **Русский**
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
amxts — фреймворк для плагинов AMX Mod X на TypeScript. Плагин — обычный
|
|
16
|
+
файл `.ts`: классы, замыкания, `async`/`await`, события, на которые
|
|
17
|
+
подписываешься, — заранее компилируется в машинный код и работает внутри AMX
|
|
18
|
+
Mod X рядом с Pawn-плагинами. Они вызывают друг друга: TypeScript-плагин
|
|
19
|
+
отдаёт Pawn нативы и форварды и вызывает любой натив любого модуля или
|
|
20
|
+
плагина.
|
|
21
|
+
|
|
22
|
+
## Возможности
|
|
23
|
+
|
|
24
|
+
- **Знакомый TypeScript.** `number`, `string`, массивы, `Map`, классы,
|
|
25
|
+
интерфейсы с необязательными полями, замыкания, `async`/`await` с
|
|
26
|
+
`AbortSignal`.
|
|
27
|
+
- **Игроки и сущности — объекты.** `player.health = 100`,
|
|
28
|
+
`player.team == "CT"`, `player.hideHud.push("Money")`,
|
|
29
|
+
`entity.renderMode = "additive"`.
|
|
30
|
+
- **События как в DOM.** `server.addEventListener("putinserver", ...)`,
|
|
31
|
+
`game.addEventListener("takeDamage", ...)` для событий игры (хукчейнов
|
|
32
|
+
reapi и функций Ham Sandwich), с
|
|
33
|
+
`event.preventDefault()` и ответом через `return`.
|
|
34
|
+
- **Редактор знает игру.** Каждый натив, поле reapi и хукчейн — с типом и
|
|
35
|
+
подсказкой на русском или английском; опечатка — красная строка, а не
|
|
36
|
+
ошибка на сервере.
|
|
37
|
+
- **Без строк импорта.** `Player`, `server`, `print` и имена модулей
|
|
38
|
+
импортируются сами: сборка добавляет то, чем плагин пользуется, и ничего
|
|
39
|
+
больше.
|
|
40
|
+
- **Сохранил — играешь.** `amxts dev` пересобирает сохранённое, выкладывает и
|
|
41
|
+
перезагружает работающий сервер — без смены карты, никого не выкидывает.
|
|
42
|
+
- **Тесты без сервера.** Плагин работает на поддельном сервере под
|
|
43
|
+
`bun test`, и тест ведёт его, как вели бы игроки.
|
|
44
|
+
- **Быстрее Pawn.** К загрузке на сервер плагин уже машинный код; на горячем
|
|
45
|
+
пути настоящего плагина это примерно в три раза быстрее той же логики на
|
|
46
|
+
Pawn.
|
|
47
|
+
- **Модули — по одному на сервер.** `amxts.config.ts` их перечисляет,
|
|
48
|
+
`amxts module add` ставит, и каждый работает на сервере в одном экземпляре
|
|
49
|
+
для всех плагинов, которые им пользуются; модуль, которым не пользуется
|
|
50
|
+
никто, не собирается.
|
|
51
|
+
|
|
52
|
+
## Требования
|
|
53
|
+
|
|
54
|
+
На сервере:
|
|
55
|
+
|
|
56
|
+
- **Windows или Linux** — модуль `amxts_amxx` — это `amxts_amxx.dll` или
|
|
57
|
+
`amxts_amxx_i386.so`, оба проверены на настоящем сервере. Плагин
|
|
58
|
+
компилируется под систему своего сервера, которую сборка узнаёт по папке
|
|
59
|
+
сервера (или по `--os`).
|
|
60
|
+
- **ReHLDS с ReGameDLL и reapi** — рекомендуется, на этом amxts и
|
|
61
|
+
проверяется. Полям сущностей нужен reapi, как и событиям игры, которые
|
|
62
|
+
приходят от него; на обычном HLDS не запускали.
|
|
63
|
+
- **AMX Mod X 1.9** или новее.
|
|
64
|
+
|
|
65
|
+
Для разработки плагинов: [Node.js](https://nodejs.org) 20.12+. Сборка работает
|
|
66
|
+
на [Bun](https://bun.sh), которого ядро ставит само — настраивать ничего не нужно.
|
|
67
|
+
|
|
68
|
+
## Начало работы
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npm create amxts@latest # or: pnpm create amxts, yarn create amxts, bun create amxts
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Команда спрашивает менеджер пакетов, папку, модули, линт и папку сервера,
|
|
75
|
+
пишет проект с первым плагином и его тестом и всё устанавливает.
|
|
76
|
+
|
|
77
|
+
> [!WARNING]
|
|
78
|
+
> Пакетов в npm пока нет. До тех пор проект создаётся из клона этого
|
|
79
|
+
> репозитория, рядом с которым склонированы [amxts-cli](https://github.com/amxts/amxts-cli)
|
|
80
|
+
> (команда `amxts`) и официальные модули; он подключает ядро и модули
|
|
81
|
+
> ссылками, а не ставит их: `node <core>/bin/amxts.mjs init my-server --local`.
|
|
82
|
+
> Подробнее — в [начале работы](https://amxts.github.io/ru/docs/getting-started/quick-start#проект).
|
|
83
|
+
|
|
84
|
+
Дальше, в проекте:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
npx amxts dev # build, deploy to the server in AMXTS_SERVER, again on every save
|
|
88
|
+
npx amxts build --deploy # build once and deploy
|
|
89
|
+
npx amxts test # the tests, on a fake server
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Плагин
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// plugins/hello.ts
|
|
96
|
+
plugin({ name: "Hello", version: "1.0.0", author: "you", description: "An example" });
|
|
97
|
+
|
|
98
|
+
server.addCommand("/hp", sayHp);
|
|
99
|
+
server.addEventListener("putinserver", (event) => {
|
|
100
|
+
print(0, `${event.player.name} joined`);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
function sayHp(player: Player) {
|
|
104
|
+
print(player, `${player.name}, your HP: ${player.health}`);
|
|
105
|
+
|
|
106
|
+
if (player.health < 50) player.health = 100;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Модули
|
|
111
|
+
|
|
112
|
+
Ядро не включает модулей: проект перечисляет нужные в `amxts.config.ts`, а
|
|
113
|
+
`npx amxts module add <name>` ставит модуль. Официальные модули от авторов
|
|
114
|
+
amxts:
|
|
115
|
+
|
|
116
|
+
| модуль | что |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| [menu-core](https://github.com/amxts/menu-core) | меню из файлов INI, YAML или JSON или из кода: условия, списки, отсчёты — и нативы `mc_*` для Pawn-плагинов |
|
|
119
|
+
| [config-core](https://github.com/amxts/config-core) | конфиги в INI, YAML или JSON, прочитанные в типизированные объекты и записанные обратно, — и нативы `cfg_*` для Pawn-плагинов |
|
|
120
|
+
| [resemiclip](https://github.com/amxts/resemiclip) | кто сквозь кого проходит, правилом над двумя игроками, поверх модуля ReSemiclip |
|
|
121
|
+
|
|
122
|
+
`fetch` поверх easy_http идёт с ядром (`~/modules/http`). Другие модули — в
|
|
123
|
+
[каталоге](https://amxts.github.io/ru/modules), а `npx amxts init --module`
|
|
124
|
+
начинает свой.
|
|
125
|
+
|
|
126
|
+
## Поддержка в редакторе
|
|
127
|
+
|
|
128
|
+
[amxts для VS Code](https://github.com/amxts/amxts-vscode) даёт файлам меню и
|
|
129
|
+
конфигов подсказки, проверки и навигацию — по именам, которые регистрируют
|
|
130
|
+
плагины, прямо при наборе. Самому TypeScript ничего дополнительно не нужно:
|
|
131
|
+
`tsconfig.json` проекта готов для любого редактора.
|
|
132
|
+
|
|
133
|
+
## Документация
|
|
134
|
+
|
|
135
|
+
[amxts.github.io](https://amxts.github.io/ru/) — начало работы, API, модули,
|
|
136
|
+
тесты и то, чего amxts пока не умеет, на русском и английском. Исходники — в
|
|
137
|
+
[`docs`](docs).
|
|
138
|
+
|
|
139
|
+
## Сборка из исходников
|
|
140
|
+
|
|
141
|
+
Для работы над самим amxts нужны Bun, дистрибутив AMX Mod X 1.10
|
|
142
|
+
(`bun run setup:amxmodx`), для модуля под Windows — Windows с CMake и Visual
|
|
143
|
+
Studio (32-битная сборка) и LLVM 18 для `wamrc`, для модуля под Linux — Docker
|
|
144
|
+
(`bun run build:linux`, `bun run test:server --linux`), а также официальные
|
|
145
|
+
модули и команда `amxts` ([amxts-cli](https://github.com/amxts/amxts-cli))
|
|
146
|
+
рядом с ядром. Компиляторы заплатаны — AssemblyScript 0.28.20 и WAMR 2.4.5, —
|
|
147
|
+
а сгенерированный API не коммитится:
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
npm install --no-package-lock # npm, not bun: it links the file: folders
|
|
151
|
+
bun run generate # after the compilers are built and patched
|
|
152
|
+
bun run test
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
[`CONTRIBUTING.ru.md`](CONTRIBUTING.ru.md) — все шаги, проверки и то, как
|
|
156
|
+
прислать изменение.
|
|
157
|
+
|
|
158
|
+
## Лицензия
|
|
159
|
+
|
|
160
|
+
[MIT](LICENSE). Модуль сервера и host-плагин, собранные из этого кода,
|
|
161
|
+
используют SDK AMX Mod X, поэтому распространяются под GPL-3.0-or-later.
|
|
162
|
+
Лицензии сторонних проектов: [`runtime/licenses`](runtime/licenses/README.md).
|