@amxts/core 0.1.0 → 0.2.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.
Files changed (74) hide show
  1. package/README.md +18 -23
  2. package/README.ru.md +19 -22
  3. package/as/amxts.d.ts +63 -3
  4. package/as/constants.ts +684 -116
  5. package/as/entities.ts +1905 -1364
  6. package/as/events.ts +1694 -905
  7. package/as/facade.ts +1240 -220
  8. package/as/fetch.ts +1519 -0
  9. package/as/flags.ts +159 -145
  10. package/as/hlds.ts +1071 -0
  11. package/as/hooks.ts +5226 -5379
  12. package/as/kit.ts +15 -5
  13. package/as/lib/check.ts +1 -1
  14. package/as/natives.ts +2658 -2499
  15. package/as/remote.ts +39 -15
  16. package/as/tsconfig.json +6 -2
  17. package/as/vector.ts +12 -9
  18. package/includes/order.txt +22 -29
  19. package/includes/sources.json +0 -8
  20. package/node_modules/assemblyscript/std/assembly/index.d.ts +20 -11
  21. package/package.json +29 -7
  22. package/runtime/deps/assemblyscript/dist/asc.js +86 -16
  23. package/runtime/deps/assemblyscript/dist/assemblyscript.js +29 -29
  24. package/runtime/licenses/MPL-2.0.txt +373 -0
  25. package/runtime/licenses/README.md +5 -1
  26. package/runtime/licenses/curl-COPYING +22 -0
  27. package/runtime/licenses/libssh2-COPYING +43 -0
  28. package/runtime/licenses/mbedTLS-LICENSE +553 -0
  29. package/runtime/natives.txt +108 -105
  30. package/runtime/patches/assemblyscript-0.28.20-amxts.patch +752 -296
  31. package/runtime/patches/wamr-2.4.5-amxts.patch +148 -0
  32. package/scripts/apply-docs.ts +2 -2
  33. package/scripts/auto-imports.ts +2 -2
  34. package/scripts/build-identity.ts +115 -0
  35. package/scripts/build-wasm.ts +101 -50
  36. package/scripts/check.ts +17 -3
  37. package/scripts/client-messages.ts +246 -0
  38. package/scripts/compile-pool.ts +128 -0
  39. package/scripts/compile-worker.ts +23 -0
  40. package/scripts/compile.ts +156 -59
  41. package/scripts/docker-server.ts +13 -3
  42. package/scripts/docs/as/amxts.ts +86 -0
  43. package/scripts/docs/as/facade.ts +688 -188
  44. package/scripts/docs/as/fetch.ts +805 -0
  45. package/scripts/docs/entities.ts +43 -144
  46. package/scripts/docs/events.ts +15 -26
  47. package/scripts/docs/game.ts +68 -22
  48. package/scripts/docs/messages.ts +330 -16
  49. package/scripts/editor-api.ts +101 -0
  50. package/scripts/hlds-events.ts +370 -0
  51. package/scripts/includes.ts +12 -10
  52. package/scripts/player-fields.ts +16 -15
  53. package/scripts/prebuilt.ts +65 -23
  54. package/scripts/prepare.ts +39 -28
  55. package/scripts/project.ts +120 -20
  56. package/scripts/reapi-events.ts +98 -0
  57. package/scripts/shared-modules.ts +85 -23
  58. package/scripts/source-map.ts +242 -0
  59. package/scripts/system.ts +1 -1
  60. package/scripts/typed-commands.ts +263 -0
  61. package/scripts/typed-configs.ts +23 -12
  62. package/scripts/ui.ts +3 -1
  63. package/scripts/upgrade-menus.ts +274 -0
  64. package/scripts/upgrade-names.ts +384 -0
  65. package/scripts/upgrade.ts +830 -0
  66. package/src/cli-api.mjs +37 -4
  67. package/src/system.mjs +74 -3
  68. package/src/testing/compile.ts +8 -5
  69. package/src/testing/natives.ts +199 -5
  70. package/src/testing/network.ts +531 -0
  71. package/src/testing/server.ts +565 -47
  72. package/src/testing/tables.ts +25 -0
  73. package/as/modules/http.ts +0 -184
  74. package/scripts/docs/as/modules/http.ts +0 -66
@@ -21,9 +21,9 @@ export interface GameDoc {
21
21
 
22
22
  const player: Text = { en: `The player the event is about.`, ru: `Игрок, о котором событие.` };
23
23
  // Vector arguments are read only: reapi takes a vector back only as itself.
24
- const grenadeStart: Text = { en: `The point the grenade is thrown from, a Vector. Read only.`, ru: `Точка, откуда летит граната, Vector. Только чтение.` };
24
+ const grenadeStart: Text = { en: `The point the grenade is thrown from, a Vector.`, ru: `Точка, откуда летит граната, Vector.` };
25
25
  const thrower: Text = { en: `The player who threw the grenade.`, ru: `Игрок, который бросил гранату.` };
26
- const grenadeVelocity: Text = { en: `The grenade's velocity, a Vector. Read only.`, ru: `Скорость гранаты, Vector. Только чтение.` };
26
+ const grenadeVelocity: Text = { en: `The grenade's velocity, a Vector.`, ru: `Скорость гранаты, Vector.` };
27
27
 
28
28
  // The entity a Ham Sandwich event of one class is about.
29
29
  const theWeapon: Text = { en: `The weapon the event is about - one of the class \`classname\` names.`, ru: `Оружие, о котором событие, — одного класса, названного в \`classname\`.` };
@@ -46,10 +46,10 @@ export const GAME: Record<string, GameDoc> = {
46
46
  inflictor: { en: `The source of the damage: a weapon, a grenade, the world.`, ru: `Источник урона: оружие, граната, мир.` },
47
47
  attacker: { en: `The player who does the damage.`, ru: `Игрок, который наносит урон.` },
48
48
  damage: { en: `The damage, before armour. Assign to change it.`, ru: `Урон до брони. Присвойте, чтобы изменить.` },
49
- damageType: { en: `The kinds of damage, e.g. \`"Fall"\`, \`"Bullet"\`, \`"Burn"\`.`, ru: `Виды урона, например \`"Fall"\`, \`"Bullet"\`, \`"Burn"\`.` },
49
+ damageType: { en: `The kinds of damage, e.g. \`"fall"\`, \`"bullet"\`, \`"burn"\`.`, ru: `Виды урона, например \`"fall"\`, \`"bullet"\`, \`"burn"\`.` },
50
50
  },
51
51
  },
52
- flPlayerFallDamage: {
52
+ fallDamage: {
53
53
  summary: {
54
54
  en: `The game works out how much a fall hurts. In a post listener \`event.result\` is that number; return a number to replace it.`,
55
55
  ru: `Игра считает урон от падения. В post-обработчике \`event.result\` — это число; верните своё, чтобы заменить его.`,
@@ -84,7 +84,7 @@ export const GAME: Record<string, GameDoc> = {
84
84
  ru: `Выстрел или нож попал в игрока, ещё до урона. \`preventDefault()\` — и попадания не было.`,
85
85
  },
86
86
  fields: {
87
- dir: { en: `The shot's direction, a Vector. Read only.`, ru: `Направление выстрела, Vector. Только чтение.` },
87
+ direction: { en: `The shot's direction, a Vector.`, ru: `Направление выстрела, Vector.` },
88
88
  },
89
89
  },
90
90
  throwSmokeGrenade: {
@@ -153,7 +153,7 @@ export const GAME: Record<string, GameDoc> = {
153
153
  delay: { en: `The seconds until the next round.`, ru: `Секунды до следующего раунда.` },
154
154
  },
155
155
  },
156
- restartRound: {
156
+ newRound: {
157
157
  summary: { en: `A new round is starting.`, ru: `Начинается новый раунд.` },
158
158
  },
159
159
  checkWinConditions: {
@@ -162,9 +162,21 @@ export const GAME: Record<string, GameDoc> = {
162
162
  ru: `Игра проверяет, не победила ли какая-то сторона. \`preventDefault()\` не даст ей закончить раунд.`,
163
163
  },
164
164
  },
165
- onRoundFreezeEnd: {
165
+ roundStart: {
166
166
  summary: { en: `The freeze time at the start of the round is over.`, ru: `Закончилось время заморозки в начале раунда.` },
167
167
  },
168
+ shoot: {
169
+ summary: {
170
+ en: `A gun fires a shot: the game traces the bullet, through walls as its penetration allows, and deals its damage.`,
171
+ ru: `Оружие стреляет: игра ведёт пулю, сквозь стены, насколько позволяет пробивание, и наносит её урон.`,
172
+ },
173
+ },
174
+ shootBuckshot: {
175
+ summary: {
176
+ en: `A shotgun fires: the game traces each pellet and deals its damage.`,
177
+ ru: `Дробовик стреляет: игра ведёт каждую дробину и наносит её урон.`,
178
+ },
179
+ },
168
180
  radio: {
169
181
  summary: {
170
182
  en: `A radio message is sent. \`preventDefault()\` silences it.`,
@@ -191,14 +203,14 @@ export const GAME: Record<string, GameDoc> = {
191
203
  },
192
204
  fields: {
193
205
  player: { en: `The player who is blinded.`, ru: `Игрок, которого ослепляет.` },
194
- color: { en: `The flash's colour, [r, g, b] as a Vector. Read only.`, ru: `Цвет вспышки, [r, g, b] как Vector. Только чтение.` },
206
+ color: { en: `The flash's colour, [r, g, b] as a Vector.`, ru: `Цвет вспышки, [r, g, b] как Vector.` },
195
207
  },
196
208
  },
197
209
  startDeathCam: {
198
210
  summary: { en: `A dead player's camera starts.`, ru: `Включается камера погибшего игрока.` },
199
211
  fields: { player },
200
212
  },
201
- impulseCommands: {
213
+ impulse: {
202
214
  summary: { en: `A player sends an impulse: \`100\` is the flashlight, \`201\` the spray.`, ru: `Игрок отправляет impulse: \`100\` — фонарик, \`201\` — спрей.` },
203
215
  fields: { player },
204
216
  },
@@ -236,14 +248,14 @@ export const GAME: Record<string, GameDoc> = {
236
248
  },
237
249
  },
238
250
  },
239
- buyWeaponByWeaponId: {
251
+ buyWeapon: {
240
252
  summary: {
241
253
  en: `A player buys a weapon. In a post listener \`event.result\` is the weapon.`,
242
254
  ru: `Игрок покупает оружие. В post-обработчике \`event.result\` — само оружие.`,
243
255
  },
244
256
  fields: { player, weapon: { en: `The weapon bought, as \`weapon.kind\` names it, e.g. \`"ak47"\` or \`"awp"\`.`, ru: `Покупаемое оружие, как его называет \`weapon.kind\`, например \`"ak47"\` или \`"awp"\`.` } },
245
257
  },
246
- addAccount: {
258
+ addMoney: {
247
259
  summary: {
248
260
  en: `A player's money changes. Assign \`event.amount\` to change how much.`,
249
261
  ru: `У игрока меняются деньги. Присвойте \`event.amount\`, чтобы изменить сумму.`,
@@ -256,19 +268,53 @@ export const GAME: Record<string, GameDoc> = {
256
268
  },
257
269
  },
258
270
  },
259
- hasRestrictItem: {
271
+ itemRestricted: {
260
272
  summary: {
261
273
  en: `The game asks if an item is forbidden to a player. Return \`true\` to forbid it.`,
262
274
  ru: `Игра спрашивает, запрещён ли игроку предмет. Верните \`true\`, чтобы запретить.`,
263
275
  },
264
276
  fields: {
265
277
  player,
278
+ item: {
279
+ en: `The item asked about, by its kind, e.g. \`"awp"\`, \`"hegrenade"\`, \`"kevlar"\`, \`"defusekit"\`.`,
280
+ ru: `Предмет, о котором спрашивают, по его виду, например \`"awp"\`, \`"hegrenade"\`, \`"kevlar"\`, \`"defusekit"\`.`,
281
+ },
266
282
  restriction: {
267
283
  en: `The way the player would get the item, one of \`"buying"\`, \`"touched"\` (picked up) or \`"equipped"\` (given on spawn).`,
268
284
  ru: `Способ, которым игрок получит предмет, — одно из \`"buying"\` (покупка), \`"touched"\` (подобрал) или \`"equipped"\` (выдан при спавне).`,
269
285
  },
270
286
  },
271
287
  },
288
+ pain: {
289
+ summary: {
290
+ en: `A player cries out in pain after a hit.`,
291
+ ru: `Игрок вскрикивает от боли после попадания.`,
292
+ },
293
+ fields: {
294
+ player,
295
+ lastHitGroup: {
296
+ en: `The body part the hit struck, e.g. \`"head"\`, \`"chest"\`, \`"leftLeg"\`.`,
297
+ ru: `Часть тела, куда пришлось попадание, например \`"head"\`, \`"chest"\`, \`"leftLeg"\`.`,
298
+ },
299
+ hasArmour: {
300
+ en: `\`true\` when the player wears armour: the game picks the sound by it.`,
301
+ ru: `\`true\`, когда на игроке броня: по ней игра выбирает звук.`,
302
+ },
303
+ },
304
+ },
305
+ setAnimation: {
306
+ summary: {
307
+ en: `The game sets the animation a player's model plays: walking, jumping, attacking, reloading.`,
308
+ ru: `Игра задаёт анимацию, которую играет модель игрока: ходьба, прыжок, атака, перезарядка.`,
309
+ },
310
+ fields: {
311
+ player,
312
+ animation: {
313
+ en: `The animation, e.g. \`"jump"\`, \`"attack1"\`, \`"reload"\`.`,
314
+ ru: `Анимация, например \`"jump"\`, \`"attack1"\`, \`"reload"\`.`,
315
+ },
316
+ },
317
+ },
272
318
  addResource: {
273
319
  summary: {
274
320
  en: `A file is added to what clients download.`,
@@ -282,7 +328,7 @@ export const GAME: Record<string, GameDoc> = {
282
328
  resourceIndex: { en: `The resource's number in the list.`, ru: `Номер ресурса в списке.` },
283
329
  },
284
330
  },
285
- onEvent: {
331
+ gameEvent: {
286
332
  summary: {
287
333
  en: `The game tells the bots something happened.`,
288
334
  ru: `Игра сообщает ботам, что что-то произошло.`,
@@ -301,8 +347,8 @@ export const GAME: Record<string, GameDoc> = {
301
347
  },
302
348
  fields: {
303
349
  flags: {
304
- en: `The extras the death message carries, any of \`"Position"\`, \`"Assistant"\`, \`"KillRarity"\`.`,
305
- ru: `Дополнения к сообщению о смерти, любые из \`"Position"\`, \`"Assistant"\`, \`"KillRarity"\`.`,
350
+ en: `The extras the death message carries, any of \`"position"\`, \`"assistant"\`, \`"killRarity"\`.`,
351
+ ru: `Дополнения к сообщению о смерти, любые из \`"position"\`, \`"assistant"\`, \`"killRarity"\`.`,
306
352
  },
307
353
  rarity: {
308
354
  en: `The things that made the kill rare, e.g. \`"Headshot"\`, \`"NoScope"\`, \`"Penetrated"\`, \`"InAir"\`.`,
@@ -314,7 +360,7 @@ export const GAME: Record<string, GameDoc> = {
314
360
  summary: { en: `A player throws a grenade.`, ru: `Игрок бросает гранату.` },
315
361
  fields: { player: thrower, velocity: grenadeVelocity },
316
362
  },
317
- hintMessageEx: {
363
+ hintMessage: {
318
364
  summary: { en: `The game shows a player a hint.`, ru: `Игра показывает игроку подсказку.` },
319
365
  fields: {
320
366
  player,
@@ -324,15 +370,15 @@ export const GAME: Record<string, GameDoc> = {
324
370
  },
325
371
  },
326
372
  },
327
- sendSayMessage: {
373
+ chatMessage: {
328
374
  summary: {
329
375
  en: `A player's chat message goes out to the players and to the server console. Assign \`event.text\` to change what they read, or call \`preventDefault()\` so nobody gets it.`,
330
376
  ru: `Сообщение игрока в чат уходит игрокам и в консоль сервера. Чтобы изменить, что они прочтут, присвойте \`event.text\`; чтобы его не получил никто, вызовите \`preventDefault()\`.`,
331
377
  },
332
378
  fields: {
333
379
  player: { en: `The player who wrote the message.`, ru: `Игрок, который написал сообщение.` },
334
- cmd: { en: `The command the message came with, \`"say"\` or \`"say_team"\`.`, ru: `Команда, с которой пришло сообщение, \`"say"\` или \`"say_team"\`.` },
335
- teamonly: { en: `\`true\` when only the player's team gets the message.`, ru: `\`true\`, когда сообщение получает только команда игрока.` },
380
+ command: { en: `The command the message came with, \`"say"\` or \`"say_team"\`.`, ru: `Команда, с которой пришло сообщение, \`"say"\` или \`"say_team"\`.` },
381
+ teamOnly: { en: `\`true\` when only the player's team gets the message.`, ru: `\`true\`, когда сообщение получает только команда игрока.` },
336
382
  text: { en: `The message as the player wrote it. Assign to change it.`, ru: `Сообщение, как его написал игрок. Присвойте, чтобы изменить.` },
337
383
  format: {
338
384
  en: `The chat's format that puts the name, the place and the message together, e.g. \`"#Cstrike_Chat_All"\`.`,
@@ -346,14 +392,14 @@ export const GAME: Record<string, GameDoc> = {
346
392
  },
347
393
  takeDamageImpulse: {
348
394
  summary: {
349
- en: `A hurt player is pushed back and slowed down by the hit, after the damage. Assign \`event.knockbackForce\` or \`event.velModifier\` to change how much, or call \`preventDefault()\` for neither.`,
350
- ru: `Раненого игрока отбрасывает и замедляет от удара, уже после урона. Чтобы изменить насколько, присвойте \`event.knockbackForce\` или \`event.velModifier\`; чтобы не было ни того ни другого, вызовите \`preventDefault()\`.`,
395
+ en: `A hurt player is pushed back and slowed down by the hit, after the damage. Assign \`event.knockbackForce\` or \`event.velocityModifier\` to change how much, or call \`preventDefault()\` for neither.`,
396
+ ru: `Раненого игрока отбрасывает и замедляет от удара, уже после урона. Чтобы изменить насколько, присвойте \`event.knockbackForce\` или \`event.velocityModifier\`; чтобы не было ни того ни другого, вызовите \`preventDefault()\`.`,
351
397
  },
352
398
  fields: {
353
399
  player: { en: `The player who is hurt.`, ru: `Игрок, которого ранили.` },
354
400
  attacker: { en: `The player who did the damage.`, ru: `Игрок, который нанёс урон.` },
355
401
  knockbackForce: { en: `The force that pushes the player away from the attacker. Assign to change it.`, ru: `Сила, которая отталкивает игрока от атакующего. Присвойте, чтобы изменить.` },
356
- velModifier: {
402
+ velocityModifier: {
357
403
  en: `The share of speed the player keeps while slowed by the hit, e.g. \`0.5\` for half. Assign to change it.`,
358
404
  ru: `Доля скорости, которая остаётся у игрока, пока его замедляет удар, например \`0.5\` — половина. Присвойте, чтобы изменить.`,
359
405
  },