@amxts/core 0.1.0 → 0.2.1
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/README.md +21 -25
- package/README.ru.md +22 -24
- package/as/amxts.d.ts +63 -3
- package/as/constants.ts +684 -116
- package/as/entities.ts +1905 -1364
- package/as/events.ts +1696 -907
- package/as/facade.ts +1240 -220
- package/as/fetch.ts +1519 -0
- package/as/flags.ts +159 -145
- package/as/hlds.ts +1071 -0
- package/as/hooks.ts +5226 -5379
- package/as/kit.ts +15 -5
- package/as/lib/check.ts +1 -1
- package/as/natives.ts +2658 -2499
- package/as/remote.ts +39 -15
- package/as/tsconfig.json +7 -2
- package/as/vector.ts +12 -9
- package/includes/order.txt +22 -29
- package/includes/sources.json +0 -8
- package/node_modules/assemblyscript/std/assembly/index.d.ts +20 -11
- package/package.json +29 -7
- package/runtime/deps/assemblyscript/dist/asc.js +86 -16
- package/runtime/deps/assemblyscript/dist/assemblyscript.js +29 -29
- package/runtime/licenses/MPL-2.0.txt +373 -0
- package/runtime/licenses/README.md +5 -1
- package/runtime/licenses/curl-COPYING +22 -0
- package/runtime/licenses/libssh2-COPYING +43 -0
- package/runtime/licenses/mbedTLS-LICENSE +553 -0
- package/runtime/natives.txt +108 -105
- package/runtime/patches/assemblyscript-0.28.20-amxts.patch +752 -296
- package/runtime/patches/wamr-2.4.5-amxts.patch +148 -0
- package/scripts/apply-docs.ts +2 -2
- package/scripts/auto-imports.ts +2 -2
- package/scripts/build-identity.ts +115 -0
- package/scripts/build-wasm.ts +101 -50
- package/scripts/check.ts +17 -3
- package/scripts/client-messages.ts +246 -0
- package/scripts/compile-cache.ts +4 -2
- package/scripts/compile-pool.ts +128 -0
- package/scripts/compile-worker.ts +23 -0
- package/scripts/compile.ts +156 -59
- package/scripts/docker-server.ts +13 -3
- package/scripts/docs/as/amxts.ts +86 -0
- package/scripts/docs/as/facade.ts +688 -188
- package/scripts/docs/as/fetch.ts +805 -0
- package/scripts/docs/entities.ts +43 -144
- package/scripts/docs/events.ts +17 -28
- package/scripts/docs/game.ts +68 -22
- package/scripts/docs/messages.ts +330 -16
- package/scripts/editor-api.ts +101 -0
- package/scripts/hlds-events.ts +370 -0
- package/scripts/includes.ts +12 -10
- package/scripts/player-fields.ts +16 -15
- package/scripts/prebuilt.ts +65 -23
- package/scripts/prepare.ts +42 -28
- package/scripts/project.ts +120 -20
- package/scripts/reapi-events.ts +98 -0
- package/scripts/shared-modules.ts +85 -23
- package/scripts/source-map.ts +242 -0
- package/scripts/system.ts +1 -1
- package/scripts/typed-commands.ts +263 -0
- package/scripts/typed-configs.ts +23 -12
- package/scripts/ui.ts +3 -1
- package/scripts/upgrade-menus.ts +274 -0
- package/scripts/upgrade-names.ts +384 -0
- package/scripts/upgrade.ts +857 -0
- package/src/cli-api.mjs +37 -4
- package/src/system.mjs +74 -3
- package/src/testing/compile.ts +8 -5
- package/src/testing/index.ts +2 -1
- package/src/testing/natives.ts +199 -5
- package/src/testing/network.ts +531 -0
- package/src/testing/server.ts +572 -48
- package/src/testing/setup.ts +1 -1
- package/src/testing/tables.ts +25 -0
- package/as/modules/http.ts +0 -184
- package/scripts/docs/as/modules/http.ts +0 -66
package/as/flags.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
// Flag families as string literal types, and FlagList - the array a plugin
|
|
5
5
|
// sees where Pawn has a bit mask.
|
|
6
|
-
import {
|
|
6
|
+
import { __entvarCell, __setEntvarCell, __memberCell, __setMemberCell } from "./entities";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// ---------------------------------------------------------------- the list
|
|
@@ -52,25 +52,25 @@ export abstract class FlagStore {
|
|
|
52
52
|
abstract write(mask: i32): void;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/** A mask in an entvar - var_flags, var_effects, var_button. */
|
|
55
|
+
/** A mask in an entvar - var_flags, var_effects, var_button - at its offset in entvars_t. */
|
|
56
56
|
export class EntvarFlags extends FlagStore {
|
|
57
|
-
constructor(private entity: i32, private
|
|
58
|
-
read(): i32 { return
|
|
59
|
-
write(mask: i32): void {
|
|
57
|
+
constructor(private entity: i32, private offset: i32) { super(); }
|
|
58
|
+
read(): i32 { return __entvarCell(this.entity, this.offset); }
|
|
59
|
+
write(mask: i32): void { __setEntvarCell(this.entity, this.offset, mask); }
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/** A mask in a game member - m_iHideHUD. */
|
|
62
|
+
/** A mask in a game member - m_iHideHUD - by its place in entities.ts's member table. */
|
|
63
63
|
export class MemberFlags extends FlagStore {
|
|
64
|
-
constructor(private entity: i32, private
|
|
65
|
-
read(): i32 { return
|
|
66
|
-
write(mask: i32): void {
|
|
64
|
+
constructor(private entity: i32, private member: i32) { super(); }
|
|
65
|
+
read(): i32 { return __memberCell(this.entity, this.member); }
|
|
66
|
+
write(mask: i32): void { __setMemberCell(this.entity, this.member, mask); }
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* The flags a mask holds, as an array of names.
|
|
71
71
|
*
|
|
72
72
|
* `push` sets the bit where the mask lives as well, so
|
|
73
|
-
* `player.hideHud.push("
|
|
73
|
+
* `player.hideHud.push("money")` hides the money. Everything else is a plain
|
|
74
74
|
* array: `includes`, `filter`, `length`, a for loop. To take flags away,
|
|
75
75
|
* assign the array back - `player.hideHud = player.hideHud.filter(...)`.
|
|
76
76
|
*/
|
|
@@ -99,201 +99,215 @@ export function flagList<T>(store: FlagStore, family: FlagFamily): FlagList<T> {
|
|
|
99
99
|
|
|
100
100
|
/** Parts of the HUD a player does not see - m_iHideHUD. */
|
|
101
101
|
export type HideHud =
|
|
102
|
-
| "
|
|
103
|
-
| "
|
|
104
|
-
| "
|
|
105
|
-
| "
|
|
106
|
-
| "
|
|
107
|
-
| "
|
|
108
|
-
| "
|
|
109
|
-
| "
|
|
102
|
+
| "weapons"
|
|
103
|
+
| "flashlight"
|
|
104
|
+
| "all"
|
|
105
|
+
| "health"
|
|
106
|
+
| "timer"
|
|
107
|
+
| "money"
|
|
108
|
+
| "crosshair"
|
|
109
|
+
| "observerCrosshair";
|
|
110
110
|
|
|
111
111
|
/** The HideHud names and their bits, for the hood. */
|
|
112
112
|
export const HIDE_HUD = new FlagFamily(
|
|
113
|
-
["
|
|
113
|
+
["weapons", "flashlight", "all", "health", "timer", "money", "crosshair", "observerCrosshair"],
|
|
114
114
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7]
|
|
115
115
|
);
|
|
116
116
|
|
|
117
117
|
/** Buttons a player holds - var_button, var_oldbuttons. */
|
|
118
118
|
export type Button =
|
|
119
|
-
| "
|
|
120
|
-
| "
|
|
121
|
-
| "
|
|
122
|
-
| "
|
|
123
|
-
| "
|
|
124
|
-
| "
|
|
125
|
-
| "
|
|
126
|
-
| "
|
|
127
|
-
| "
|
|
128
|
-
| "
|
|
129
|
-
| "
|
|
130
|
-
| "
|
|
131
|
-
| "
|
|
132
|
-
| "
|
|
133
|
-
| "
|
|
134
|
-
| "
|
|
119
|
+
| "attack"
|
|
120
|
+
| "jump"
|
|
121
|
+
| "duck"
|
|
122
|
+
| "forward"
|
|
123
|
+
| "back"
|
|
124
|
+
| "use"
|
|
125
|
+
| "cancel"
|
|
126
|
+
| "left"
|
|
127
|
+
| "right"
|
|
128
|
+
| "moveLeft"
|
|
129
|
+
| "moveRight"
|
|
130
|
+
| "attack2"
|
|
131
|
+
| "run"
|
|
132
|
+
| "reload"
|
|
133
|
+
| "alt1"
|
|
134
|
+
| "score";
|
|
135
135
|
|
|
136
136
|
/** The Button names and their bits, for the hood. */
|
|
137
137
|
export const BUTTON = new FlagFamily(
|
|
138
|
-
["
|
|
138
|
+
["attack", "jump", "duck", "forward", "back", "use", "cancel", "left", "right", "moveLeft", "moveRight", "attack2", "run", "reload", "alt1", "score"],
|
|
139
139
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7, 1 << 8, 1 << 9, 1 << 10, 1 << 11, 1 << 12, 1 << 13, 1 << 14, 1 << 15]
|
|
140
140
|
);
|
|
141
141
|
|
|
142
142
|
/** Visual effects on an entity - var_effects. */
|
|
143
143
|
export type Effect =
|
|
144
|
-
| "
|
|
145
|
-
| "
|
|
146
|
-
| "
|
|
147
|
-
| "
|
|
148
|
-
| "
|
|
149
|
-
| "
|
|
150
|
-
| "
|
|
151
|
-
| "
|
|
152
|
-
| "
|
|
153
|
-
| "
|
|
154
|
-
| "
|
|
155
|
-
| "
|
|
156
|
-
| "
|
|
144
|
+
| "brightField"
|
|
145
|
+
| "muzzleFlash"
|
|
146
|
+
| "brightLight"
|
|
147
|
+
| "dimLight"
|
|
148
|
+
| "invLight"
|
|
149
|
+
| "noInterp"
|
|
150
|
+
| "light"
|
|
151
|
+
| "noDraw"
|
|
152
|
+
| "forceVisibility"
|
|
153
|
+
| "ownerVisibility"
|
|
154
|
+
| "ownerNoVisibility"
|
|
155
|
+
| "noSlerp"
|
|
156
|
+
| "followKeepRender";
|
|
157
157
|
|
|
158
158
|
/** The Effect names and their bits, for the hood. */
|
|
159
159
|
export const EFFECT = new FlagFamily(
|
|
160
|
-
["
|
|
160
|
+
["brightField", "muzzleFlash", "brightLight", "dimLight", "invLight", "noInterp", "light", "noDraw", "forceVisibility", "ownerVisibility", "ownerNoVisibility", "noSlerp", "followKeepRender"],
|
|
161
161
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7, 1 << 11, 1 << 12, 1 << 13, 1 << 14, 1 << 15]
|
|
162
162
|
);
|
|
163
163
|
|
|
164
164
|
/** Engine flags of an entity - var_flags. */
|
|
165
165
|
export type EntityFlag =
|
|
166
|
-
| "
|
|
167
|
-
| "
|
|
168
|
-
| "
|
|
169
|
-
| "
|
|
170
|
-
| "
|
|
171
|
-
| "
|
|
172
|
-
| "
|
|
173
|
-
| "
|
|
174
|
-
| "
|
|
175
|
-
| "
|
|
176
|
-
| "
|
|
177
|
-
| "
|
|
178
|
-
| "
|
|
179
|
-
| "
|
|
180
|
-
| "
|
|
181
|
-
| "
|
|
182
|
-
| "
|
|
183
|
-
| "
|
|
184
|
-
| "
|
|
185
|
-
| "
|
|
186
|
-
| "
|
|
187
|
-
| "
|
|
188
|
-
| "
|
|
189
|
-
| "
|
|
190
|
-
| "
|
|
191
|
-
| "
|
|
192
|
-
| "
|
|
193
|
-
| "
|
|
194
|
-
| "
|
|
195
|
-
| "
|
|
166
|
+
| "fly"
|
|
167
|
+
| "swim"
|
|
168
|
+
| "conveyor"
|
|
169
|
+
| "client"
|
|
170
|
+
| "inWater"
|
|
171
|
+
| "monster"
|
|
172
|
+
| "godMode"
|
|
173
|
+
| "noTarget"
|
|
174
|
+
| "skipLocalHost"
|
|
175
|
+
| "onGround"
|
|
176
|
+
| "partialGround"
|
|
177
|
+
| "waterJump"
|
|
178
|
+
| "frozen"
|
|
179
|
+
| "fakeClient"
|
|
180
|
+
| "ducking"
|
|
181
|
+
| "float"
|
|
182
|
+
| "graphed"
|
|
183
|
+
| "immuneWater"
|
|
184
|
+
| "immuneSlime"
|
|
185
|
+
| "immuneLava"
|
|
186
|
+
| "proxy"
|
|
187
|
+
| "alwaysThink"
|
|
188
|
+
| "baseVelocity"
|
|
189
|
+
| "monsterClip"
|
|
190
|
+
| "onTrain"
|
|
191
|
+
| "worldBrush"
|
|
192
|
+
| "spectator"
|
|
193
|
+
| "customEntity"
|
|
194
|
+
| "killMe"
|
|
195
|
+
| "dormant";
|
|
196
196
|
|
|
197
197
|
/** The EntityFlag names and their bits, for the hood. */
|
|
198
198
|
export const ENTITY_FLAG = new FlagFamily(
|
|
199
|
-
["
|
|
199
|
+
["fly", "swim", "conveyor", "client", "inWater", "monster", "godMode", "noTarget", "skipLocalHost", "onGround", "partialGround", "waterJump", "frozen", "fakeClient", "ducking", "float", "graphed", "immuneWater", "immuneSlime", "immuneLava", "proxy", "alwaysThink", "baseVelocity", "monsterClip", "onTrain", "worldBrush", "spectator", "customEntity", "killMe", "dormant"],
|
|
200
200
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7, 1 << 8, 1 << 9, 1 << 10, 1 << 11, 1 << 12, 1 << 13, 1 << 14, 1 << 15, 1 << 16, 1 << 17, 1 << 18, 1 << 19, 1 << 20, 1 << 21, 1 << 22, 1 << 23, 1 << 24, 1 << 25, 1 << 26, 1 << 29, 1 << 30, 1 << 31]
|
|
201
201
|
);
|
|
202
202
|
|
|
203
203
|
/** Kinds of damage - the damage type a hook receives. */
|
|
204
204
|
export type Damage =
|
|
205
|
-
| "
|
|
206
|
-
| "
|
|
207
|
-
| "
|
|
208
|
-
| "
|
|
209
|
-
| "
|
|
210
|
-
| "
|
|
211
|
-
| "
|
|
212
|
-
| "
|
|
213
|
-
| "
|
|
214
|
-
| "
|
|
215
|
-
| "
|
|
216
|
-
| "
|
|
217
|
-
| "
|
|
218
|
-
| "
|
|
219
|
-
| "
|
|
220
|
-
| "
|
|
221
|
-
| "
|
|
222
|
-
| "
|
|
223
|
-
| "
|
|
224
|
-
| "
|
|
225
|
-
| "
|
|
226
|
-
| "
|
|
227
|
-
| "
|
|
228
|
-
| "
|
|
205
|
+
| "crush"
|
|
206
|
+
| "bullet"
|
|
207
|
+
| "slash"
|
|
208
|
+
| "burn"
|
|
209
|
+
| "freeze"
|
|
210
|
+
| "fall"
|
|
211
|
+
| "blast"
|
|
212
|
+
| "club"
|
|
213
|
+
| "shock"
|
|
214
|
+
| "sonic"
|
|
215
|
+
| "energyBeam"
|
|
216
|
+
| "neverGib"
|
|
217
|
+
| "alwaysGib"
|
|
218
|
+
| "drown"
|
|
219
|
+
| "paralyze"
|
|
220
|
+
| "nerveGas"
|
|
221
|
+
| "poison"
|
|
222
|
+
| "radiation"
|
|
223
|
+
| "drownRecover"
|
|
224
|
+
| "acid"
|
|
225
|
+
| "slowBurn"
|
|
226
|
+
| "slowFreeze"
|
|
227
|
+
| "mortar"
|
|
228
|
+
| "grenade";
|
|
229
229
|
// Not single bits, so not names: DMG_GENERIC = 0, DMG_GIB_CORPSE = 737, DMG_SHOWNHUD = 7815448.
|
|
230
230
|
|
|
231
231
|
/** The Damage names and their bits, for the hood. */
|
|
232
232
|
export const DAMAGE = new FlagFamily(
|
|
233
|
-
["
|
|
233
|
+
["crush", "bullet", "slash", "burn", "freeze", "fall", "blast", "club", "shock", "sonic", "energyBeam", "neverGib", "alwaysGib", "drown", "paralyze", "nerveGas", "poison", "radiation", "drownRecover", "acid", "slowBurn", "slowFreeze", "mortar", "grenade"],
|
|
234
234
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7, 1 << 8, 1 << 9, 1 << 10, 1 << 12, 1 << 13, 1 << 14, 1 << 15, 1 << 16, 1 << 17, 1 << 18, 1 << 19, 1 << 20, 1 << 21, 1 << 22, 1 << 23, 1 << 24]
|
|
235
235
|
);
|
|
236
236
|
|
|
237
237
|
/** What an admin may do - get_user_flags, users.ini letters. */
|
|
238
238
|
export type Access =
|
|
239
|
-
| "
|
|
240
|
-
| "
|
|
241
|
-
| "
|
|
242
|
-
| "
|
|
243
|
-
| "
|
|
244
|
-
| "
|
|
245
|
-
| "
|
|
246
|
-
| "
|
|
247
|
-
| "
|
|
248
|
-
| "
|
|
249
|
-
| "
|
|
250
|
-
| "
|
|
251
|
-
| "
|
|
252
|
-
| "
|
|
253
|
-
| "
|
|
254
|
-
| "
|
|
255
|
-
| "
|
|
256
|
-
| "
|
|
257
|
-
| "
|
|
258
|
-
| "
|
|
259
|
-
| "
|
|
260
|
-
| "
|
|
261
|
-
| "
|
|
262
|
-
| "
|
|
239
|
+
| "immunity"
|
|
240
|
+
| "reservation"
|
|
241
|
+
| "kick"
|
|
242
|
+
| "ban"
|
|
243
|
+
| "slay"
|
|
244
|
+
| "map"
|
|
245
|
+
| "cvar"
|
|
246
|
+
| "cfg"
|
|
247
|
+
| "chat"
|
|
248
|
+
| "vote"
|
|
249
|
+
| "password"
|
|
250
|
+
| "rcon"
|
|
251
|
+
| "levelA"
|
|
252
|
+
| "levelB"
|
|
253
|
+
| "levelC"
|
|
254
|
+
| "levelD"
|
|
255
|
+
| "levelE"
|
|
256
|
+
| "levelF"
|
|
257
|
+
| "levelG"
|
|
258
|
+
| "levelH"
|
|
259
|
+
| "menu"
|
|
260
|
+
| "banTemp"
|
|
261
|
+
| "admin"
|
|
262
|
+
| "user";
|
|
263
263
|
// Not single bits, so not names: ADMIN_ALL = 0.
|
|
264
264
|
|
|
265
265
|
/** The Access names and their bits, for the hood. */
|
|
266
266
|
export const ACCESS = new FlagFamily(
|
|
267
|
-
["
|
|
267
|
+
["immunity", "reservation", "kick", "ban", "slay", "map", "cvar", "cfg", "chat", "vote", "password", "rcon", "levelA", "levelB", "levelC", "levelD", "levelE", "levelF", "levelG", "levelH", "menu", "banTemp", "admin", "user"],
|
|
268
268
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7, 1 << 8, 1 << 9, 1 << 10, 1 << 11, 1 << 12, 1 << 13, 1 << 14, 1 << 15, 1 << 16, 1 << 17, 1 << 18, 1 << 19, 1 << 20, 1 << 21, 1 << 24, 1 << 25]
|
|
269
269
|
);
|
|
270
270
|
|
|
271
|
+
/** What the scoreboard shows beside a player - the ScoreAttrib message: dead, the bomb, the VIP, a defuse kit. */
|
|
272
|
+
export type ScoreStatus =
|
|
273
|
+
| "dead"
|
|
274
|
+
| "bomb"
|
|
275
|
+
| "vip"
|
|
276
|
+
| "defuseKit";
|
|
277
|
+
// Not single bits, so not names: SCORE_STATUS_NONE = 0.
|
|
278
|
+
|
|
279
|
+
/** The ScoreStatus names and their bits, for the hood. */
|
|
280
|
+
export const SCORE_STATUS = new FlagFamily(
|
|
281
|
+
["dead", "bomb", "vip", "defuseKit"],
|
|
282
|
+
[1 << 0, 1 << 1, 1 << 2, 1 << 3]
|
|
283
|
+
);
|
|
284
|
+
|
|
271
285
|
/** Modes a weapon is in - m_iWeaponState: a silencer on, burst fire, the shield drawn. */
|
|
272
286
|
export type WeaponState =
|
|
273
|
-
| "
|
|
274
|
-
| "
|
|
275
|
-
| "
|
|
276
|
-
| "
|
|
277
|
-
| "
|
|
278
|
-
| "
|
|
287
|
+
| "uspSilenced"
|
|
288
|
+
| "glock18Burst"
|
|
289
|
+
| "m4a1Silenced"
|
|
290
|
+
| "eliteLeft"
|
|
291
|
+
| "famasBurst"
|
|
292
|
+
| "shieldDrawn";
|
|
279
293
|
|
|
280
294
|
/** The WeaponState names and their bits, for the hood. */
|
|
281
295
|
export const WEAPON_STATE = new FlagFamily(
|
|
282
|
-
["
|
|
296
|
+
["uspSilenced", "glock18Burst", "m4a1Silenced", "eliteLeft", "famasBurst", "shieldDrawn"],
|
|
283
297
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5]
|
|
284
298
|
);
|
|
285
299
|
|
|
286
300
|
/** The physics state of a player - m_afPhysicsFlags: on a ladder, on a train, ducking. */
|
|
287
301
|
export type PhysicsFlag =
|
|
288
|
-
| "
|
|
289
|
-
| "
|
|
290
|
-
| "
|
|
291
|
-
| "
|
|
292
|
-
| "
|
|
293
|
-
| "
|
|
302
|
+
| "onLadder"
|
|
303
|
+
| "onTrain"
|
|
304
|
+
| "onBarnacle"
|
|
305
|
+
| "ducking"
|
|
306
|
+
| "using"
|
|
307
|
+
| "observer";
|
|
294
308
|
|
|
295
309
|
/** The PhysicsFlag names and their bits, for the hood. */
|
|
296
310
|
export const PHYSICS_FLAG = new FlagFamily(
|
|
297
|
-
["
|
|
311
|
+
["onLadder", "onTrain", "onBarnacle", "ducking", "using", "observer"],
|
|
298
312
|
[1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5]
|
|
299
313
|
);
|