@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/as/effects.ts
ADDED
|
@@ -0,0 +1,1449 @@
|
|
|
1
|
+
// Temporary effects: beams, explosions, sprites, sparks, lights, tracers,
|
|
2
|
+
// blood - what the engine draws for a moment and forgets, sent as
|
|
3
|
+
// SVC_TEMPENTITY with the message's bytes written here.
|
|
4
|
+
//
|
|
5
|
+
// One function per effect, each with its own options: the fields are the
|
|
6
|
+
// effect's arguments in the plugin author's words. Times are seconds (the
|
|
7
|
+
// message's tenths are counted here); a colour is CSS hex; an entity, a
|
|
8
|
+
// player and a sprite are the facade's objects. Sizes the message holds as a
|
|
9
|
+
// byte - a beam's width, a sprite's scale - are the message's own numbers,
|
|
10
|
+
// which the words of each field explain. Effects that need a decal's index
|
|
11
|
+
// (TE_*DECAL, TE_MULTIGUNSHOT), the engine's tracer colours (TE_USERTRACER)
|
|
12
|
+
// or are a HUD message (TE_TEXTMESSAGE) are not here; the obsolete ones
|
|
13
|
+
// (TE_BEAM, TE_BEAMHOSE) are gone from the game.
|
|
14
|
+
//
|
|
15
|
+
// Who sees one is the second argument: everyone by default, `{ near }` the
|
|
16
|
+
// players who can see that point (MSG_PVS), `{ to }` one player. An effect is
|
|
17
|
+
// sent unreliably, as the game sends its own: a client that drops it misses a
|
|
18
|
+
// spark, where a reliable one filling up would drop him.
|
|
19
|
+
import { Player, Resource } from "./facade";
|
|
20
|
+
import { Entity, RenderMode } from "./entities";
|
|
21
|
+
import { message_begin, message_begin_f, message_end, write_angle_f, write_byte, write_coord_f, write_short } from "./natives";
|
|
22
|
+
import {
|
|
23
|
+
MSG_BROADCAST, MSG_ONE_UNRELIABLE, MSG_PVS, SVC_TEMPENTITY,
|
|
24
|
+
TE_ARMOR_RICOCHET, TE_BEAMCYLINDER, TE_BEAMDISK, TE_BEAMENTPOINT, TE_BEAMENTS, TE_BEAMFOLLOW, TE_BEAMPOINTS, TE_BEAMRING,
|
|
25
|
+
TE_BEAMSPRITE, TE_BEAMTORUS, TE_BLOOD, TE_BLOODSPRITE, TE_BLOODSTREAM, TE_BOX, TE_BREAKMODEL, TE_BUBBLES, TE_BUBBLETRAIL,
|
|
26
|
+
TE_DLIGHT, TE_ELIGHT, TE_EXPLODEMODEL, TE_EXPLOSION, TE_EXPLOSION2, TE_FIREFIELD, TE_FIZZ, TE_GLOWSPRITE, TE_GUNSHOT,
|
|
27
|
+
TE_IMPLOSION, TE_KILLBEAM, TE_KILLPLAYERATTACHMENTS, TE_LARGEFUNNEL, TE_LAVASPLASH, TE_LIGHTNING, TE_LINE, TE_MODEL,
|
|
28
|
+
TE_PARTICLEBURST, TE_PLAYERATTACHMENT, TE_PLAYERSPRITES, TE_PROJECTILE, TE_SHOWLINE, TE_SMOKE, TE_SPARKS, TE_SPRAY,
|
|
29
|
+
TE_SPRITE, TE_SPRITETRAIL, TE_SPRITE_SPRAY, TE_STREAK_SPLASH, TE_TAREXPLOSION, TE_TELEPORT, TE_TRACER,
|
|
30
|
+
TE_EXPLFLAG_NOADDITIVE, TE_EXPLFLAG_NODLIGHTS, TE_EXPLFLAG_NOSOUND, TE_EXPLFLAG_NOPARTICLES,
|
|
31
|
+
TEFIRE_FLAG_ALLFLOAT, TEFIRE_FLAG_SOMEFLOAT, TEFIRE_FLAG_LOOP, TEFIRE_FLAG_ALPHA, TEFIRE_FLAG_PLANAR
|
|
32
|
+
} from "./constants";
|
|
33
|
+
|
|
34
|
+
/** The players who see an effect - the second argument of every `effects` function; everyone when it is left out. An effect is sent as the game sends its own: a player whose connection drops it misses it. */
|
|
35
|
+
export interface EffectRecipients {
|
|
36
|
+
/**
|
|
37
|
+
* Only the players who can see this point, e.g. `{ near: grenade.origin }`.
|
|
38
|
+
*
|
|
39
|
+
* Pawn: `MSG_PVS`
|
|
40
|
+
*/
|
|
41
|
+
near?: number[];
|
|
42
|
+
/**
|
|
43
|
+
* Only this player, e.g. `{ to: player }`.
|
|
44
|
+
*
|
|
45
|
+
* Pawn: `MSG_ONE_UNRELIABLE`
|
|
46
|
+
*/
|
|
47
|
+
to?: Player;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The options of `effects.gunshot`, `effects.sparks`, `effects.tarExplosion`, `effects.lavaSplash` and `effects.teleport`. */
|
|
51
|
+
export interface PointEffectOptions {
|
|
52
|
+
/** The point the effect is at. */
|
|
53
|
+
at: number[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The options of `effects.tracer` and `effects.showLine`. */
|
|
57
|
+
export interface SegmentEffectOptions {
|
|
58
|
+
/** The point the effect starts from. */
|
|
59
|
+
start: number[];
|
|
60
|
+
/** The point the effect ends at. */
|
|
61
|
+
end: number[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The options of `effects.killBeams`. */
|
|
65
|
+
export interface EntityEffectOptions {
|
|
66
|
+
/** The entity whose beams go. */
|
|
67
|
+
entity: Entity;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The options of `effects.killPlayerAttachments`. */
|
|
71
|
+
export interface PlayerEffectOptions {
|
|
72
|
+
/** The player whose attached models go. */
|
|
73
|
+
player: Player;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The options of `effects.beamPoints`. */
|
|
77
|
+
export interface BeamPointsOptions {
|
|
78
|
+
/** The point the beam starts from. */
|
|
79
|
+
start: number[];
|
|
80
|
+
/** The point the beam ends at. */
|
|
81
|
+
end: number[];
|
|
82
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
83
|
+
sprite: Resource;
|
|
84
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
85
|
+
life: number;
|
|
86
|
+
/** The beam's width, `0` to `255`: `10` is one unit. */
|
|
87
|
+
width: number;
|
|
88
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
89
|
+
color?: string;
|
|
90
|
+
/** The brightness, `0` to `255`; `255` by default. */
|
|
91
|
+
alpha?: number;
|
|
92
|
+
/** The beam's waver, `0` to `255`: `100` is one unit; `0` by default, a straight beam. */
|
|
93
|
+
noise?: number;
|
|
94
|
+
/** The sprite's frame the beam starts from; `0` by default. */
|
|
95
|
+
frame?: number;
|
|
96
|
+
/** The sprite's frame rate, in tenths of a frame a second; `0` by default. */
|
|
97
|
+
frameRate?: number;
|
|
98
|
+
/** The speed the sprite scrolls along the beam, in tenths of a unit a second; `0` by default. */
|
|
99
|
+
speed?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The options of `effects.beamEntityPoint`. */
|
|
103
|
+
export interface BeamEntityPointOptions {
|
|
104
|
+
/** The entity the beam starts from; the beam follows it as it moves. */
|
|
105
|
+
start: Entity;
|
|
106
|
+
/** The point the beam ends at. */
|
|
107
|
+
end: number[];
|
|
108
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
109
|
+
sprite: Resource;
|
|
110
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
111
|
+
life: number;
|
|
112
|
+
/** The beam's width, `0` to `255`: `10` is one unit. */
|
|
113
|
+
width: number;
|
|
114
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
115
|
+
color?: string;
|
|
116
|
+
/** The brightness, `0` to `255`; `255` by default. */
|
|
117
|
+
alpha?: number;
|
|
118
|
+
/** The beam's waver, `0` to `255`: `100` is one unit; `0` by default, a straight beam. */
|
|
119
|
+
noise?: number;
|
|
120
|
+
/** The sprite's frame the beam starts from; `0` by default. */
|
|
121
|
+
frame?: number;
|
|
122
|
+
/** The sprite's frame rate, in tenths of a frame a second; `0` by default. */
|
|
123
|
+
frameRate?: number;
|
|
124
|
+
/** The speed the sprite scrolls along the beam, in tenths of a unit a second; `0` by default. */
|
|
125
|
+
speed?: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** The options of `effects.beamEntities` and `effects.beamRing`. */
|
|
129
|
+
export interface BeamEntitiesOptions {
|
|
130
|
+
/** The entity the beam starts from; the beam follows it as it moves. */
|
|
131
|
+
start: Entity;
|
|
132
|
+
/** The entity the beam ends at; the beam follows it as it moves. */
|
|
133
|
+
end: Entity;
|
|
134
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
135
|
+
sprite: Resource;
|
|
136
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
137
|
+
life: number;
|
|
138
|
+
/** The beam's width, `0` to `255`: `10` is one unit. */
|
|
139
|
+
width: number;
|
|
140
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
141
|
+
color?: string;
|
|
142
|
+
/** The brightness, `0` to `255`; `255` by default. */
|
|
143
|
+
alpha?: number;
|
|
144
|
+
/** The beam's waver, `0` to `255`: `100` is one unit; `0` by default, a straight beam. */
|
|
145
|
+
noise?: number;
|
|
146
|
+
/** The sprite's frame the beam starts from; `0` by default. */
|
|
147
|
+
frame?: number;
|
|
148
|
+
/** The sprite's frame rate, in tenths of a frame a second; `0` by default. */
|
|
149
|
+
frameRate?: number;
|
|
150
|
+
/** The speed the sprite scrolls along the beam, in tenths of a unit a second; `0` by default. */
|
|
151
|
+
speed?: number;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The options of `effects.beamCylinder`, `effects.beamDisk` and `effects.beamTorus`. */
|
|
155
|
+
export interface BeamCircleOptions {
|
|
156
|
+
/** The circle's centre. */
|
|
157
|
+
at: number[];
|
|
158
|
+
/** The circle's radius at the end of its life, in units. */
|
|
159
|
+
radius: number;
|
|
160
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
161
|
+
sprite: Resource;
|
|
162
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
163
|
+
life: number;
|
|
164
|
+
/** The beam's width, `0` to `255`: `10` is one unit. */
|
|
165
|
+
width: number;
|
|
166
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
167
|
+
color?: string;
|
|
168
|
+
/** The brightness, `0` to `255`; `255` by default. */
|
|
169
|
+
alpha?: number;
|
|
170
|
+
/** The beam's waver, `0` to `255`: `100` is one unit; `0` by default, a straight beam. */
|
|
171
|
+
noise?: number;
|
|
172
|
+
/** The sprite's frame the beam starts from; `0` by default. */
|
|
173
|
+
frame?: number;
|
|
174
|
+
/** The sprite's frame rate, in tenths of a frame a second; `0` by default. */
|
|
175
|
+
frameRate?: number;
|
|
176
|
+
/** The speed the sprite scrolls along the beam, in tenths of a unit a second; `0` by default. */
|
|
177
|
+
speed?: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** The options of `effects.beamFollow`. */
|
|
181
|
+
export interface BeamFollowOptions {
|
|
182
|
+
/** The entity the trail follows - a grenade, a player. */
|
|
183
|
+
entity: Entity;
|
|
184
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
185
|
+
sprite: Resource;
|
|
186
|
+
/** The lifetime of each piece of the trail, in seconds, up to `25.5`. */
|
|
187
|
+
life: number;
|
|
188
|
+
/** The beam's width, `0` to `255`: `10` is one unit. */
|
|
189
|
+
width: number;
|
|
190
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
191
|
+
color?: string;
|
|
192
|
+
/** The brightness, `0` to `255`; `255` by default. */
|
|
193
|
+
alpha?: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** The options of `effects.beamSprite`. */
|
|
197
|
+
export interface BeamSpriteOptions {
|
|
198
|
+
/** The point the beam starts from. */
|
|
199
|
+
start: number[];
|
|
200
|
+
/** The point the beam ends at, where the end sprite is. */
|
|
201
|
+
end: number[];
|
|
202
|
+
/** The beam's sprite, as `server.precache` returned it. */
|
|
203
|
+
sprite: Resource;
|
|
204
|
+
/** The sprite at the beam's end, as `server.precache` returned it. */
|
|
205
|
+
endSprite: Resource;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** The options of `effects.lightning`. */
|
|
209
|
+
export interface LightningOptions {
|
|
210
|
+
/** The point the bolt starts from. */
|
|
211
|
+
start: number[];
|
|
212
|
+
/** The point the bolt ends at. */
|
|
213
|
+
end: number[];
|
|
214
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
215
|
+
sprite: Resource;
|
|
216
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
217
|
+
life: number;
|
|
218
|
+
/** The beam's width, `0` to `255`: `10` is one unit. */
|
|
219
|
+
width: number;
|
|
220
|
+
/** The beam's waver, `0` to `255`: `100` is one unit; `0` by default, a straight beam. */
|
|
221
|
+
noise?: number;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** The options of `effects.explosion`. */
|
|
225
|
+
export interface ExplosionOptions {
|
|
226
|
+
/** The point the effect is at. */
|
|
227
|
+
at: number[];
|
|
228
|
+
/** The explosion's sprite, e.g. `sprites/zerogxplode.spr`, as `server.precache` returned it. */
|
|
229
|
+
sprite: Resource;
|
|
230
|
+
/** The sprite's size, `0` to `255`: `10` is its own size; `10` by default. */
|
|
231
|
+
scale?: number;
|
|
232
|
+
/** The sprite's frames a second; `15` by default. */
|
|
233
|
+
frameRate?: number;
|
|
234
|
+
/** Whether the sprite is drawn glowing, added to what is behind it; `true` by default, `false` draws it opaque. */
|
|
235
|
+
additive?: boolean;
|
|
236
|
+
/** Whether the explosion lights up the world around it; `true` by default. */
|
|
237
|
+
lights?: boolean;
|
|
238
|
+
/** Whether the explosion is heard; `true` by default. */
|
|
239
|
+
sound?: boolean;
|
|
240
|
+
/** Whether the explosion throws out particles; `true` by default. */
|
|
241
|
+
particles?: boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** The options of `effects.smoke`. */
|
|
245
|
+
export interface SmokeOptions {
|
|
246
|
+
/** The point the effect is at. */
|
|
247
|
+
at: number[];
|
|
248
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
249
|
+
sprite: Resource;
|
|
250
|
+
/** The sprite's size, `0` to `255`: `10` is its own size; `10` by default. */
|
|
251
|
+
scale?: number;
|
|
252
|
+
/** The sprite's frames a second; `10` by default. */
|
|
253
|
+
frameRate?: number;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** The options of `effects.particleExplosion`. */
|
|
257
|
+
export interface ParticleExplosionOptions {
|
|
258
|
+
/** The point the effect is at. */
|
|
259
|
+
at: number[];
|
|
260
|
+
/** The first colour of the game's palette the particles take, `0` to `255`; `0` by default. */
|
|
261
|
+
palette?: number;
|
|
262
|
+
/** The number of the palette's colours from there on the particles take; `16` by default. */
|
|
263
|
+
colors?: number;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** The options of `effects.implosion`. */
|
|
267
|
+
export interface ImplosionOptions {
|
|
268
|
+
/** The point the tracers fly into. */
|
|
269
|
+
at: number[];
|
|
270
|
+
/** The distance the tracers start from, in units, up to `255`. */
|
|
271
|
+
radius: number;
|
|
272
|
+
/** The number of tracers, `0` to `255`. */
|
|
273
|
+
count: number;
|
|
274
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
275
|
+
life: number;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** The options of `effects.spriteTrail`. */
|
|
279
|
+
export interface SpriteTrailOptions {
|
|
280
|
+
/** The point the effect starts from. */
|
|
281
|
+
start: number[];
|
|
282
|
+
/** The point the effect ends at. */
|
|
283
|
+
end: number[];
|
|
284
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
285
|
+
sprite: Resource;
|
|
286
|
+
/** The number of sprites, `0` to `255`. */
|
|
287
|
+
count: number;
|
|
288
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
289
|
+
life: number;
|
|
290
|
+
/** The sprite's size, `0` to `255`: `10` is its own size; `10` by default. */
|
|
291
|
+
scale?: number;
|
|
292
|
+
/** The sprites' speed along the line, `0` to `255`: `1` is ten units a second; `10` by default. */
|
|
293
|
+
speed?: number;
|
|
294
|
+
/** The spread of the sprites' speeds, `0` to `255`: `1` is ten units a second; `10` by default. */
|
|
295
|
+
randomness?: number;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** The options of `effects.sprite`. */
|
|
299
|
+
export interface SpriteOptions {
|
|
300
|
+
/** The point the effect is at. */
|
|
301
|
+
at: number[];
|
|
302
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
303
|
+
sprite: Resource;
|
|
304
|
+
/** The sprite's size, `0` to `255`: `10` is its own size; `10` by default. */
|
|
305
|
+
scale?: number;
|
|
306
|
+
/** The brightness, `0` to `255`; `255` by default. */
|
|
307
|
+
alpha?: number;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** The options of `effects.glowSprite`. */
|
|
311
|
+
export interface GlowSpriteOptions {
|
|
312
|
+
/** The point the effect is at. */
|
|
313
|
+
at: number[];
|
|
314
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
315
|
+
sprite: Resource;
|
|
316
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
317
|
+
life: number;
|
|
318
|
+
/** The sprite's size, `0` to `255`: `10` is its own size; `10` by default. */
|
|
319
|
+
scale?: number;
|
|
320
|
+
/** The brightness, `0` to `255`; `255` by default. */
|
|
321
|
+
alpha?: number;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** The options of `effects.streakSplash`. */
|
|
325
|
+
export interface StreakSplashOptions {
|
|
326
|
+
/** The point the effect is at. */
|
|
327
|
+
at: number[];
|
|
328
|
+
/** The direction the spray goes, a vector: its length is not read. */
|
|
329
|
+
direction: number[];
|
|
330
|
+
/** The number of tracers, up to `32767`. */
|
|
331
|
+
count: number;
|
|
332
|
+
/** The tracers' speed, in units a second. */
|
|
333
|
+
speed: number;
|
|
334
|
+
/** The spread of the tracers' speeds, in units a second; `0` by default. */
|
|
335
|
+
randomness?: number;
|
|
336
|
+
/** The tracers' colour in the game's palette, `0` to `255`; `5` by default, yellow sparks. */
|
|
337
|
+
palette?: number;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** The options of `effects.dynamicLight`. */
|
|
341
|
+
export interface DynamicLightOptions {
|
|
342
|
+
/** The point the light shines from. */
|
|
343
|
+
at: number[];
|
|
344
|
+
/** The light's reach, in units, up to `2550`. */
|
|
345
|
+
radius: number;
|
|
346
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
347
|
+
life: number;
|
|
348
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
349
|
+
color?: string;
|
|
350
|
+
/** The speed the light shrinks at, in units a second; `0` by default, not at all. */
|
|
351
|
+
decay?: number;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** The options of `effects.entityLight`. */
|
|
355
|
+
export interface EntityLightOptions {
|
|
356
|
+
/** The entity the light follows. */
|
|
357
|
+
entity: Entity;
|
|
358
|
+
/** The point the light starts at. */
|
|
359
|
+
at: number[];
|
|
360
|
+
/** The light's reach, in units. */
|
|
361
|
+
radius: number;
|
|
362
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
363
|
+
life: number;
|
|
364
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
365
|
+
color?: string;
|
|
366
|
+
/** The speed the light shrinks at, in units a second; `0` by default, not at all. */
|
|
367
|
+
decay?: number;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** The options of `effects.line`. */
|
|
371
|
+
export interface LineOptions {
|
|
372
|
+
/** The point the effect starts from. */
|
|
373
|
+
start: number[];
|
|
374
|
+
/** The point the effect ends at. */
|
|
375
|
+
end: number[];
|
|
376
|
+
/** The effect's lifetime, in seconds. */
|
|
377
|
+
life: number;
|
|
378
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
379
|
+
color?: string;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** The options of `effects.box`. */
|
|
383
|
+
export interface BoxOptions {
|
|
384
|
+
/** The box's lower corner. */
|
|
385
|
+
mins: number[];
|
|
386
|
+
/** The box's upper corner. */
|
|
387
|
+
maxs: number[];
|
|
388
|
+
/** The effect's lifetime, in seconds. */
|
|
389
|
+
life: number;
|
|
390
|
+
/** The colour in CSS hex, e.g. `"#0096ff"` or `"#09f"`; white by default. */
|
|
391
|
+
color?: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/** The options of `effects.largeFunnel`. */
|
|
395
|
+
export interface LargeFunnelOptions {
|
|
396
|
+
/** The funnel's bottom. */
|
|
397
|
+
at: number[];
|
|
398
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
399
|
+
sprite: Resource;
|
|
400
|
+
/** `true`: the sprites fly out of the funnel rather than into it. */
|
|
401
|
+
reverse?: boolean;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/** The options of `effects.blood` and `effects.bloodStream`. */
|
|
405
|
+
export interface BloodOptions {
|
|
406
|
+
/** The point the effect is at. */
|
|
407
|
+
at: number[];
|
|
408
|
+
/** The direction the spray goes, a vector: its length is not read. */
|
|
409
|
+
direction: number[];
|
|
410
|
+
/** The spray's speed, `0` to `255`. */
|
|
411
|
+
speed: number;
|
|
412
|
+
/** The blood's colour in the game's palette, `0` to `255`: `247` (the default) is red, `195` yellow. */
|
|
413
|
+
palette?: number;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** The options of `effects.fizz`. */
|
|
417
|
+
export interface FizzOptions {
|
|
418
|
+
/** The entity the bubbles rise in - a brush, such as water. */
|
|
419
|
+
entity: Entity;
|
|
420
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
421
|
+
sprite: Resource;
|
|
422
|
+
/** The bubbles' density, `0` to `255`. */
|
|
423
|
+
density: number;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** The sound a model makes as it bounces, one of `"none"`, `"shell"` or `"shotgunShell"`. */
|
|
427
|
+
export type BounceSound = "none" | "shell" | "shotgunShell";
|
|
428
|
+
|
|
429
|
+
/** The options of `effects.model`. */
|
|
430
|
+
export interface ModelOptions {
|
|
431
|
+
/** The point the effect is at. */
|
|
432
|
+
at: number[];
|
|
433
|
+
/** The starting velocity, in units a second. */
|
|
434
|
+
velocity: number[];
|
|
435
|
+
/** The model to draw - a `.mdl` or a sprite - as `server.precache` returned it. */
|
|
436
|
+
model: Resource;
|
|
437
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
438
|
+
life: number;
|
|
439
|
+
/** The model's starting turn around the vertical, in degrees; `0` by default. */
|
|
440
|
+
yaw?: number;
|
|
441
|
+
/** The sound the model makes as it bounces, one of `"none"` (the default), `"shell"` or `"shotgunShell"`. */
|
|
442
|
+
sound?: BounceSound;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/** The options of `effects.explodeModel`. */
|
|
446
|
+
export interface ExplodeModelOptions {
|
|
447
|
+
/** The point the effect is at. */
|
|
448
|
+
at: number[];
|
|
449
|
+
/** The pieces' speed, in units a second. */
|
|
450
|
+
speed: number;
|
|
451
|
+
/** The model to draw - a `.mdl` or a sprite - as `server.precache` returned it. */
|
|
452
|
+
model: Resource;
|
|
453
|
+
/** The number of pieces, up to `32767`. */
|
|
454
|
+
count: number;
|
|
455
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
456
|
+
life: number;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/** The material a broken thing was made of - the sound its pieces make: one of `"none"`, `"glass"`, `"metal"`, `"flesh"`, `"wood"` or `"concrete"`. */
|
|
460
|
+
export type BreakMaterial = "none" | "glass" | "metal" | "flesh" | "wood" | "concrete";
|
|
461
|
+
|
|
462
|
+
/** The options of `effects.breakModel`. */
|
|
463
|
+
export interface BreakModelOptions {
|
|
464
|
+
/** The centre of the box the pieces fly out of. */
|
|
465
|
+
at: number[];
|
|
466
|
+
/** The box's size along each axis, in units. */
|
|
467
|
+
size: number[];
|
|
468
|
+
/** The starting velocity, in units a second. */
|
|
469
|
+
velocity: number[];
|
|
470
|
+
/** The model to draw - a `.mdl` or a sprite - as `server.precache` returned it. */
|
|
471
|
+
model: Resource;
|
|
472
|
+
/** The number of pieces, `0` to `255`. */
|
|
473
|
+
count: number;
|
|
474
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
475
|
+
life: number;
|
|
476
|
+
/** The spread of the pieces' speeds, `0` to `255`: `1` is ten units a second; `0` by default. */
|
|
477
|
+
randomness?: number;
|
|
478
|
+
/** The material the pieces sound as, one of `"none"` (the default), `"glass"`, `"metal"`, `"flesh"`, `"wood"` or `"concrete"`. */
|
|
479
|
+
material?: BreakMaterial;
|
|
480
|
+
/** `true`: the pieces trail smoke. */
|
|
481
|
+
smoke?: boolean;
|
|
482
|
+
/** `true`: the pieces are drawn see-through. */
|
|
483
|
+
transparent?: boolean;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** The options of `effects.spriteSpray`. */
|
|
487
|
+
export interface SpriteSprayOptions {
|
|
488
|
+
/** The point the effect is at. */
|
|
489
|
+
at: number[];
|
|
490
|
+
/** The starting velocity, in units a second. */
|
|
491
|
+
velocity: number[];
|
|
492
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
493
|
+
sprite: Resource;
|
|
494
|
+
/** The number of pieces, `0` to `255`. */
|
|
495
|
+
count: number;
|
|
496
|
+
/** The sprites' speed, `0` to `255`. */
|
|
497
|
+
speed: number;
|
|
498
|
+
/** The spread of the sprites' directions, `0` to `255`; `0` by default. */
|
|
499
|
+
noise?: number;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** The options of `effects.armorRicochet`. */
|
|
503
|
+
export interface ArmorRicochetOptions {
|
|
504
|
+
/** The point the effect is at. */
|
|
505
|
+
at: number[];
|
|
506
|
+
/** The sprite's size, `0` to `255`: `10` is its own size; `10` by default. */
|
|
507
|
+
scale?: number;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** The options of `effects.bubbles` and `effects.bubbleTrail`. */
|
|
511
|
+
export interface BubblesOptions {
|
|
512
|
+
/** One corner of the box, or one end of the line, the bubbles appear in. */
|
|
513
|
+
start: number[];
|
|
514
|
+
/** The other corner of the box, or the other end of the line. */
|
|
515
|
+
end: number[];
|
|
516
|
+
/** The height the bubbles rise to, in units. */
|
|
517
|
+
height: number;
|
|
518
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
519
|
+
sprite: Resource;
|
|
520
|
+
/** The number of bubbles, `0` to `255`. */
|
|
521
|
+
count: number;
|
|
522
|
+
/** The bubbles' speed, in units a second. */
|
|
523
|
+
speed: number;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** The options of `effects.bloodSprite`. */
|
|
527
|
+
export interface BloodSpriteOptions {
|
|
528
|
+
/** The point the effect is at. */
|
|
529
|
+
at: number[];
|
|
530
|
+
/** The sprite of the drops that fall, e.g. `sprites/bloodspray.spr`, as `server.precache` returned it. */
|
|
531
|
+
spray: Resource;
|
|
532
|
+
/** The sprite of the blot that stays a moment, e.g. `sprites/blood.spr`, as `server.precache` returned it. */
|
|
533
|
+
drop: Resource;
|
|
534
|
+
/** The sprite's size, `0` to `255`: `10` is its own size; `10` by default. */
|
|
535
|
+
scale?: number;
|
|
536
|
+
/** The blood's colour in the game's palette, `0` to `255`: `247` (the default) is red, `195` yellow. */
|
|
537
|
+
palette?: number;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/** The options of `effects.projectile`. */
|
|
541
|
+
export interface ProjectileOptions {
|
|
542
|
+
/** The point the effect is at. */
|
|
543
|
+
at: number[];
|
|
544
|
+
/** The starting velocity, in units a second. */
|
|
545
|
+
velocity: number[];
|
|
546
|
+
/** The model to draw - a `.mdl` or a sprite - as `server.precache` returned it. */
|
|
547
|
+
model: Resource;
|
|
548
|
+
/** The projectile's lifetime, in whole seconds, up to `255`. */
|
|
549
|
+
life: number;
|
|
550
|
+
/** The player the projectile passes through; left out, it hits anyone. */
|
|
551
|
+
owner?: Player;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/** The options of `effects.spray`. */
|
|
555
|
+
export interface SprayOptions {
|
|
556
|
+
/** The point the effect is at. */
|
|
557
|
+
at: number[];
|
|
558
|
+
/** The direction the spray goes, a vector: its length is not read. */
|
|
559
|
+
direction: number[];
|
|
560
|
+
/** The model to draw - a `.mdl` or a sprite - as `server.precache` returned it. */
|
|
561
|
+
model: Resource;
|
|
562
|
+
/** The number of pieces, `0` to `255`. */
|
|
563
|
+
count: number;
|
|
564
|
+
/** The pieces' speed, `0` to `255`. */
|
|
565
|
+
speed: number;
|
|
566
|
+
/** The spread of the pieces' directions, `0` to `255`; `0` by default. */
|
|
567
|
+
noise?: number;
|
|
568
|
+
/** The pieces' render mode, as an entity's `renderMode`; `"normal"` by default. */
|
|
569
|
+
renderMode?: RenderMode;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/** The options of `effects.playerSprites`. */
|
|
573
|
+
export interface PlayerSpritesOptions {
|
|
574
|
+
/** The player the sprites come out of. */
|
|
575
|
+
player: Player;
|
|
576
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
577
|
+
sprite: Resource;
|
|
578
|
+
/** The number of sprites, `0` to `255`. */
|
|
579
|
+
count: number;
|
|
580
|
+
/** The spread of the sprites' sizes, in percent; `0` by default, all the same. */
|
|
581
|
+
variance?: number;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** The options of `effects.particleBurst`. */
|
|
585
|
+
export interface ParticleBurstOptions {
|
|
586
|
+
/** The point the effect is at. */
|
|
587
|
+
at: number[];
|
|
588
|
+
/** The burst's radius, in units. */
|
|
589
|
+
radius: number;
|
|
590
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
591
|
+
life: number;
|
|
592
|
+
/** The particles' colour in the game's palette, `0` to `255`; `0` by default. */
|
|
593
|
+
palette?: number;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/** The share of a fire field's sprites that drift upwards, one of `"none"`, `"some"` (half of them) or `"all"`. */
|
|
597
|
+
export type FireRise = "none" | "some" | "all";
|
|
598
|
+
|
|
599
|
+
/** The look of a fire field's sprites, one of `"opaque"`, `"alpha"` (half see-through) or `"additive"` (glowing). */
|
|
600
|
+
export type FireBlend = "opaque" | "alpha" | "additive";
|
|
601
|
+
|
|
602
|
+
/** The options of `effects.fireField`. */
|
|
603
|
+
export interface FireFieldOptions {
|
|
604
|
+
/** The field's centre. */
|
|
605
|
+
at: number[];
|
|
606
|
+
/** Half the side of the square the fire fills, in units. */
|
|
607
|
+
radius: number;
|
|
608
|
+
/** The sprite to draw, as `server.precache` returned it. */
|
|
609
|
+
sprite: Resource;
|
|
610
|
+
/** The number of sprites, `0` to `255`. */
|
|
611
|
+
count: number;
|
|
612
|
+
/** The effect's lifetime, in seconds, up to `25.5`. */
|
|
613
|
+
life: number;
|
|
614
|
+
/** The share of the sprites that drift upwards, one of `"none"` (the default), `"some"` or `"all"`. */
|
|
615
|
+
rise?: FireRise;
|
|
616
|
+
/** The sprites' look, one of `"opaque"` (the default), `"alpha"` or `"additive"`. */
|
|
617
|
+
blend?: FireBlend;
|
|
618
|
+
/** `true`: the sprites play at 15 frames a second; otherwise once over their lifetime. */
|
|
619
|
+
loop?: boolean;
|
|
620
|
+
/** `true`: every sprite starts at the same height, a flat field rather than a cube. */
|
|
621
|
+
flat?: boolean;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/** The options of `effects.playerAttachment`. */
|
|
625
|
+
export interface PlayerAttachmentOptions {
|
|
626
|
+
/** The player the model is attached to. */
|
|
627
|
+
player: Player;
|
|
628
|
+
/** The model to draw - a `.mdl` or a sprite - as `server.precache` returned it. */
|
|
629
|
+
model: Resource;
|
|
630
|
+
/** The effect's lifetime, in seconds. */
|
|
631
|
+
life: number;
|
|
632
|
+
/** The model's height above the player's origin, in units; `0` by default. */
|
|
633
|
+
offset?: number;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// TE_FIREFIELD's additive flag, which the include does not carry.
|
|
637
|
+
const TEFIRE_FLAG_ADDITIVE = 32;
|
|
638
|
+
|
|
639
|
+
// The palette's blood red, the colour the game bleeds in.
|
|
640
|
+
const BLOOD_RED = 247;
|
|
641
|
+
|
|
642
|
+
// The render modes in their numbers' order, as TE_SPRAY takes one.
|
|
643
|
+
const RENDER_MODES: RenderMode[] = ["normal", "color", "texture", "glow", "alpha", "additive"];
|
|
644
|
+
|
|
645
|
+
// TE_BREAKMODEL's materials and their flags (hlsdk's BREAK_*): the sound the pieces make.
|
|
646
|
+
const BREAK_MATERIALS: BreakMaterial[] = ["glass", "metal", "flesh", "wood", "concrete"];
|
|
647
|
+
const BREAK_FLAGS: i32[] = [0x01, 0x02, 0x04, 0x08, 0x40];
|
|
648
|
+
|
|
649
|
+
/** The message to whoever the effect is for, its type written. */
|
|
650
|
+
function begin(type: i32, recipients: EffectRecipients): void {
|
|
651
|
+
const player = recipients.to;
|
|
652
|
+
const near = recipients.near;
|
|
653
|
+
if (player != null) message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, [0, 0, 0], player.id);
|
|
654
|
+
else if (near != null) message_begin_f(MSG_PVS, SVC_TEMPENTITY, near, 0);
|
|
655
|
+
else message_begin(MSG_BROADCAST, SVC_TEMPENTITY, [0, 0, 0], 0);
|
|
656
|
+
write_byte(type);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** Whether every file the effect draws is precached; one that is not is said in the console and the effect is not sent. */
|
|
660
|
+
function precached(resources: Resource[]): bool {
|
|
661
|
+
for (let i = 0; i < resources.length; i++) {
|
|
662
|
+
const resource = resources[i];
|
|
663
|
+
if (resource.index > 0) continue;
|
|
664
|
+
console.error(`effects: "${resource.path}" is not precached`);
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
return true;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function byte(value: number): void {
|
|
671
|
+
write_byte(<i32>Math.max(0.0, Math.min(255.0, Math.round(value))));
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
function short(value: number): void {
|
|
675
|
+
write_short(<i32>Math.max(-32768.0, Math.min(32767.0, Math.round(value))));
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function coords(point: number[]): void {
|
|
679
|
+
for (let i = 0; i < 3; i++) write_coord_f(i < point.length ? point[i] : 0.0);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function color(hex: string): void {
|
|
683
|
+
const digits = hex.startsWith("#") ? hex.slice(1) : hex;
|
|
684
|
+
const full = digits.length == 3 ? `${digits[0]}${digits[0]}${digits[1]}${digits[1]}${digits[2]}${digits[2]}` : digits;
|
|
685
|
+
const parsed = I32.parseInt(full, 16);
|
|
686
|
+
// Read back, a colour is the same digits: "0x12" or "12gg34" is not one.
|
|
687
|
+
const value = full.length == 6 && parsed.toString(16).padStart(6, "0") == full.toLowerCase() ? parsed : -1;
|
|
688
|
+
if (value < 0) console.error(`effects: "${hex}" is not a colour - write it as "#0096ff"`);
|
|
689
|
+
const rgb = value < 0 ? 0xffffff : value;
|
|
690
|
+
write_byte((rgb >> 16) & 0xff);
|
|
691
|
+
write_byte((rgb >> 8) & 0xff);
|
|
692
|
+
write_byte(rgb & 0xff);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/** What every beam but the follow and the lightning takes after its ends. */
|
|
696
|
+
function beam(sprite: Resource, frame: number, frameRate: number, life: number, width: number, noise: number, hex: string, alpha: number, speed: number): void {
|
|
697
|
+
write_short(<i32>sprite.index);
|
|
698
|
+
byte(frame);
|
|
699
|
+
byte(frameRate);
|
|
700
|
+
byte(life * 10.0);
|
|
701
|
+
byte(width);
|
|
702
|
+
byte(noise);
|
|
703
|
+
color(hex);
|
|
704
|
+
byte(alpha);
|
|
705
|
+
byte(speed);
|
|
706
|
+
message_end();
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
function beamCircle(type: i32, options: BeamCircleOptions, to: EffectRecipients): void {
|
|
710
|
+
if (!precached([options.sprite])) return;
|
|
711
|
+
const at = options.at;
|
|
712
|
+
begin(type, to);
|
|
713
|
+
coords(at);
|
|
714
|
+
coords([at[0], at[1], at[2] + options.radius]);
|
|
715
|
+
beam(options.sprite, options.frame ?? 0, options.frameRate ?? 0, options.life, options.width, options.noise ?? 0, options.color ?? "#ffffff", options.alpha ?? 255, options.speed ?? 0);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
function point(type: i32, options: PointEffectOptions, to: EffectRecipients): void {
|
|
719
|
+
begin(type, to);
|
|
720
|
+
coords(options.at);
|
|
721
|
+
message_end();
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
function segment(type: i32, options: SegmentEffectOptions, to: EffectRecipients): void {
|
|
725
|
+
begin(type, to);
|
|
726
|
+
coords(options.start);
|
|
727
|
+
coords(options.end);
|
|
728
|
+
message_end();
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
function sprayBlood(type: i32, options: BloodOptions, to: EffectRecipients): void {
|
|
732
|
+
begin(type, to);
|
|
733
|
+
coords(options.at);
|
|
734
|
+
coords(options.direction);
|
|
735
|
+
byte(options.palette ?? BLOOD_RED);
|
|
736
|
+
byte(options.speed);
|
|
737
|
+
message_end();
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
function riseBubbles(type: i32, options: BubblesOptions, to: EffectRecipients): void {
|
|
741
|
+
if (!precached([options.sprite])) return;
|
|
742
|
+
begin(type, to);
|
|
743
|
+
coords(options.start);
|
|
744
|
+
coords(options.end);
|
|
745
|
+
write_coord_f(options.height);
|
|
746
|
+
write_short(<i32>options.sprite.index);
|
|
747
|
+
byte(options.count);
|
|
748
|
+
write_coord_f(options.speed);
|
|
749
|
+
message_end();
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Temporary effects - beams, explosions, sprites, sparks, lights, blood - the game draws for a moment and forgets. One function per effect; the options are its arguments, the second argument who sees it:
|
|
754
|
+
*
|
|
755
|
+
* ```ts
|
|
756
|
+
* const shock = server.precache("sprites/shockwave.spr");
|
|
757
|
+
*
|
|
758
|
+
* effects.beamCylinder({ at: here, radius: 385, sprite: shock, life: 0.4, width: 60, color: "#0096ff", alpha: 200 }, { near: here });
|
|
759
|
+
* effects.sparks({ at: here }); // everyone
|
|
760
|
+
* effects.beamFollow({ entity: grenade, sprite: shock, life: 1, width: 5 }, { to: player });
|
|
761
|
+
* ```
|
|
762
|
+
*
|
|
763
|
+
* Times are in seconds, a colour is CSS hex, a sprite or a model is what `server.precache` returned. An effect whose file is not precached is not sent, with a line in the console.
|
|
764
|
+
*
|
|
765
|
+
* Pawn: `message_begin(..., SVC_TEMPENTITY)`, `TE_*`
|
|
766
|
+
*/
|
|
767
|
+
export namespace effects {
|
|
768
|
+
/**
|
|
769
|
+
* A beam between two points.
|
|
770
|
+
*
|
|
771
|
+
* Pawn: `TE_BEAMPOINTS`
|
|
772
|
+
*/
|
|
773
|
+
export function beamPoints(options: BeamPointsOptions, to: EffectRecipients = {}): void {
|
|
774
|
+
if (!precached([options.sprite])) return;
|
|
775
|
+
begin(TE_BEAMPOINTS, to);
|
|
776
|
+
coords(options.start);
|
|
777
|
+
coords(options.end);
|
|
778
|
+
beam(options.sprite, options.frame ?? 0, options.frameRate ?? 0, options.life, options.width, options.noise ?? 0, options.color ?? "#ffffff", options.alpha ?? 255, options.speed ?? 0);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* A beam from an entity to a point; its start follows the entity.
|
|
783
|
+
*
|
|
784
|
+
* Pawn: `TE_BEAMENTPOINT`
|
|
785
|
+
*/
|
|
786
|
+
export function beamEntityPoint(options: BeamEntityPointOptions, to: EffectRecipients = {}): void {
|
|
787
|
+
if (!precached([options.sprite])) return;
|
|
788
|
+
begin(TE_BEAMENTPOINT, to);
|
|
789
|
+
write_short(<i32>options.start.id);
|
|
790
|
+
coords(options.end);
|
|
791
|
+
beam(options.sprite, options.frame ?? 0, options.frameRate ?? 0, options.life, options.width, options.noise ?? 0, options.color ?? "#ffffff", options.alpha ?? 255, options.speed ?? 0);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* A beam between two entities, following both.
|
|
796
|
+
*
|
|
797
|
+
* Pawn: `TE_BEAMENTS`
|
|
798
|
+
*/
|
|
799
|
+
export function beamEntities(options: BeamEntitiesOptions, to: EffectRecipients = {}): void {
|
|
800
|
+
if (!precached([options.sprite])) return;
|
|
801
|
+
begin(TE_BEAMENTS, to);
|
|
802
|
+
write_short(<i32>options.start.id);
|
|
803
|
+
write_short(<i32>options.end.id);
|
|
804
|
+
beam(options.sprite, options.frame ?? 0, options.frameRate ?? 0, options.life, options.width, options.noise ?? 0, options.color ?? "#ffffff", options.alpha ?? 255, options.speed ?? 0);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* A ring of beam between two entities: they are its diameter.
|
|
809
|
+
*
|
|
810
|
+
* Pawn: `TE_BEAMRING`
|
|
811
|
+
*/
|
|
812
|
+
export function beamRing(options: BeamEntitiesOptions, to: EffectRecipients = {}): void {
|
|
813
|
+
if (!precached([options.sprite])) return;
|
|
814
|
+
begin(TE_BEAMRING, to);
|
|
815
|
+
write_short(<i32>options.start.id);
|
|
816
|
+
write_short(<i32>options.end.id);
|
|
817
|
+
beam(options.sprite, options.frame ?? 0, options.frameRate ?? 0, options.life, options.width, options.noise ?? 0, options.color ?? "#ffffff", options.alpha ?? 255, options.speed ?? 0);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* A cylinder of beam that grows from a point to `radius` over its life - a shockwave on the ground:
|
|
822
|
+
*
|
|
823
|
+
* ```ts
|
|
824
|
+
* effects.beamCylinder({ at: here, radius: 385, sprite: shock, life: 0.4, width: 60, color: "#0096ff", alpha: 200 }, { near: here });
|
|
825
|
+
* ```
|
|
826
|
+
*
|
|
827
|
+
* Pawn: `TE_BEAMCYLINDER`
|
|
828
|
+
*/
|
|
829
|
+
export function beamCylinder(options: BeamCircleOptions, to: EffectRecipients = {}): void {
|
|
830
|
+
beamCircle(TE_BEAMCYLINDER, options, to);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* A disk of beam that grows from a point to `radius` over its life.
|
|
835
|
+
*
|
|
836
|
+
* Pawn: `TE_BEAMDISK`
|
|
837
|
+
*/
|
|
838
|
+
export function beamDisk(options: BeamCircleOptions, to: EffectRecipients = {}): void {
|
|
839
|
+
beamCircle(TE_BEAMDISK, options, to);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* A ring of beam facing the viewer that grows from a point to `radius` over its life.
|
|
844
|
+
*
|
|
845
|
+
* Pawn: `TE_BEAMTORUS`
|
|
846
|
+
*/
|
|
847
|
+
export function beamTorus(options: BeamCircleOptions, to: EffectRecipients = {}): void {
|
|
848
|
+
beamCircle(TE_BEAMTORUS, options, to);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* A trail behind a moving entity - a grenade, a player - until it stops:
|
|
853
|
+
*
|
|
854
|
+
* ```ts
|
|
855
|
+
* effects.beamFollow({ entity: grenade, sprite: trail, life: 1, width: 5, color: "#0096ff", alpha: 200 });
|
|
856
|
+
* ```
|
|
857
|
+
*
|
|
858
|
+
* Pawn: `TE_BEAMFOLLOW`
|
|
859
|
+
*/
|
|
860
|
+
export function beamFollow(options: BeamFollowOptions, to: EffectRecipients = {}): void {
|
|
861
|
+
if (!precached([options.sprite])) return;
|
|
862
|
+
begin(TE_BEAMFOLLOW, to);
|
|
863
|
+
write_short(<i32>options.entity.id);
|
|
864
|
+
write_short(<i32>options.sprite.index);
|
|
865
|
+
byte(options.life * 10.0);
|
|
866
|
+
byte(options.width);
|
|
867
|
+
color(options.color ?? "#ffffff");
|
|
868
|
+
byte(options.alpha ?? 255);
|
|
869
|
+
message_end();
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* A beam between two points with a sprite at its end.
|
|
874
|
+
*
|
|
875
|
+
* Pawn: `TE_BEAMSPRITE`
|
|
876
|
+
*/
|
|
877
|
+
export function beamSprite(options: BeamSpriteOptions, to: EffectRecipients = {}): void {
|
|
878
|
+
if (!precached([options.sprite, options.endSprite])) return;
|
|
879
|
+
begin(TE_BEAMSPRITE, to);
|
|
880
|
+
coords(options.start);
|
|
881
|
+
coords(options.end);
|
|
882
|
+
write_short(<i32>options.sprite.index);
|
|
883
|
+
write_short(<i32>options.endSprite.index);
|
|
884
|
+
message_end();
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* A bolt between two points: a beam of fewer options.
|
|
889
|
+
*
|
|
890
|
+
* Pawn: `TE_LIGHTNING`
|
|
891
|
+
*/
|
|
892
|
+
export function lightning(options: LightningOptions, to: EffectRecipients = {}): void {
|
|
893
|
+
if (!precached([options.sprite])) return;
|
|
894
|
+
begin(TE_LIGHTNING, to);
|
|
895
|
+
coords(options.start);
|
|
896
|
+
coords(options.end);
|
|
897
|
+
byte(options.life * 10.0);
|
|
898
|
+
byte(options.width);
|
|
899
|
+
byte(options.noise ?? 0);
|
|
900
|
+
write_short(<i32>options.sprite.index);
|
|
901
|
+
message_end();
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Takes away every beam attached to an entity.
|
|
906
|
+
*
|
|
907
|
+
* Pawn: `TE_KILLBEAM`
|
|
908
|
+
*/
|
|
909
|
+
export function killBeams(options: EntityEffectOptions, to: EffectRecipients = {}): void {
|
|
910
|
+
begin(TE_KILLBEAM, to);
|
|
911
|
+
write_short(<i32>options.entity.id);
|
|
912
|
+
message_end();
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* An explosion: a sprite, two lights, flying particles and the sound, rising slowly.
|
|
917
|
+
*
|
|
918
|
+
* Pawn: `TE_EXPLOSION`
|
|
919
|
+
*/
|
|
920
|
+
export function explosion(options: ExplosionOptions, to: EffectRecipients = {}): void {
|
|
921
|
+
if (!precached([options.sprite])) return;
|
|
922
|
+
let flags = 0;
|
|
923
|
+
if (!(options.additive ?? true)) flags |= TE_EXPLFLAG_NOADDITIVE;
|
|
924
|
+
if (!(options.lights ?? true)) flags |= TE_EXPLFLAG_NODLIGHTS;
|
|
925
|
+
if (!(options.sound ?? true)) flags |= TE_EXPLFLAG_NOSOUND;
|
|
926
|
+
if (!(options.particles ?? true)) flags |= TE_EXPLFLAG_NOPARTICLES;
|
|
927
|
+
begin(TE_EXPLOSION, to);
|
|
928
|
+
coords(options.at);
|
|
929
|
+
write_short(<i32>options.sprite.index);
|
|
930
|
+
byte(options.scale ?? 10);
|
|
931
|
+
byte(options.frameRate ?? 15);
|
|
932
|
+
write_byte(flags);
|
|
933
|
+
message_end();
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* A burst of dark particles with a sound.
|
|
938
|
+
*
|
|
939
|
+
* Pawn: `TE_TAREXPLOSION`
|
|
940
|
+
*/
|
|
941
|
+
export function tarExplosion(options: PointEffectOptions, to: EffectRecipients = {}): void {
|
|
942
|
+
point(TE_TAREXPLOSION, options, to);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* A burst of particles in colours of the game's palette, with a sound.
|
|
947
|
+
*
|
|
948
|
+
* Pawn: `TE_EXPLOSION2`
|
|
949
|
+
*/
|
|
950
|
+
export function particleExplosion(options: ParticleExplosionOptions, to: EffectRecipients = {}): void {
|
|
951
|
+
begin(TE_EXPLOSION2, to);
|
|
952
|
+
coords(options.at);
|
|
953
|
+
byte(options.palette ?? 0);
|
|
954
|
+
byte(options.colors ?? 16);
|
|
955
|
+
message_end();
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* A puff of smoke: a see-through sprite rising.
|
|
960
|
+
*
|
|
961
|
+
* Pawn: `TE_SMOKE`
|
|
962
|
+
*/
|
|
963
|
+
export function smoke(options: SmokeOptions, to: EffectRecipients = {}): void {
|
|
964
|
+
if (!precached([options.sprite])) return;
|
|
965
|
+
begin(TE_SMOKE, to);
|
|
966
|
+
coords(options.at);
|
|
967
|
+
write_short(<i32>options.sprite.index);
|
|
968
|
+
byte(options.scale ?? 10);
|
|
969
|
+
byte(options.frameRate ?? 10);
|
|
970
|
+
message_end();
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Tracers flying into a point.
|
|
975
|
+
*
|
|
976
|
+
* Pawn: `TE_IMPLOSION`
|
|
977
|
+
*/
|
|
978
|
+
export function implosion(options: ImplosionOptions, to: EffectRecipients = {}): void {
|
|
979
|
+
begin(TE_IMPLOSION, to);
|
|
980
|
+
coords(options.at);
|
|
981
|
+
byte(options.radius);
|
|
982
|
+
byte(options.count);
|
|
983
|
+
byte(options.life * 10.0);
|
|
984
|
+
message_end();
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* A bullet's hit: particles and a ricochet's sound.
|
|
989
|
+
*
|
|
990
|
+
* Pawn: `TE_GUNSHOT`
|
|
991
|
+
*/
|
|
992
|
+
export function gunshot(options: PointEffectOptions, to: EffectRecipients = {}): void {
|
|
993
|
+
point(TE_GUNSHOT, options, to);
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Sparks falling from a point.
|
|
998
|
+
*
|
|
999
|
+
* Pawn: `TE_SPARKS`
|
|
1000
|
+
*/
|
|
1001
|
+
export function sparks(options: PointEffectOptions, to: EffectRecipients = {}): void {
|
|
1002
|
+
point(TE_SPARKS, options, to);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* A bullet off armour: a quick spark and a ricochet's sound.
|
|
1007
|
+
*
|
|
1008
|
+
* Pawn: `TE_ARMOR_RICOCHET`
|
|
1009
|
+
*/
|
|
1010
|
+
export function armorRicochet(options: ArmorRicochetOptions, to: EffectRecipients = {}): void {
|
|
1011
|
+
begin(TE_ARMOR_RICOCHET, to);
|
|
1012
|
+
coords(options.at);
|
|
1013
|
+
byte(options.scale ?? 10);
|
|
1014
|
+
message_end();
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* A splash of particles, as from lava.
|
|
1019
|
+
*
|
|
1020
|
+
* Pawn: `TE_LAVASPLASH`
|
|
1021
|
+
*/
|
|
1022
|
+
export function lavaSplash(options: PointEffectOptions, to: EffectRecipients = {}): void {
|
|
1023
|
+
point(TE_LAVASPLASH, options, to);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* A splash of particles, as at a teleport.
|
|
1028
|
+
*
|
|
1029
|
+
* Pawn: `TE_TELEPORT`
|
|
1030
|
+
*/
|
|
1031
|
+
export function teleport(options: PointEffectOptions, to: EffectRecipients = {}): void {
|
|
1032
|
+
point(TE_TELEPORT, options, to);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* A tracer flying from one point to another.
|
|
1037
|
+
*
|
|
1038
|
+
* Pawn: `TE_TRACER`
|
|
1039
|
+
*/
|
|
1040
|
+
export function tracer(options: SegmentEffectOptions, to: EffectRecipients = {}): void {
|
|
1041
|
+
segment(TE_TRACER, options, to);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* A line of particles between two points that stays 30 seconds.
|
|
1046
|
+
*
|
|
1047
|
+
* Pawn: `TE_SHOWLINE`
|
|
1048
|
+
*/
|
|
1049
|
+
export function showLine(options: SegmentEffectOptions, to: EffectRecipients = {}): void {
|
|
1050
|
+
segment(TE_SHOWLINE, options, to);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* A shower of tracers in a direction.
|
|
1055
|
+
*
|
|
1056
|
+
* Pawn: `TE_STREAK_SPLASH`
|
|
1057
|
+
*/
|
|
1058
|
+
export function streakSplash(options: StreakSplashOptions, to: EffectRecipients = {}): void {
|
|
1059
|
+
begin(TE_STREAK_SPLASH, to);
|
|
1060
|
+
coords(options.at);
|
|
1061
|
+
coords(options.direction);
|
|
1062
|
+
byte(options.palette ?? 5);
|
|
1063
|
+
short(options.count);
|
|
1064
|
+
short(options.speed);
|
|
1065
|
+
short(options.randomness ?? 0);
|
|
1066
|
+
message_end();
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* A glowing sprite that plays once.
|
|
1071
|
+
*
|
|
1072
|
+
* Pawn: `TE_SPRITE`
|
|
1073
|
+
*/
|
|
1074
|
+
export function sprite(options: SpriteOptions, to: EffectRecipients = {}): void {
|
|
1075
|
+
if (!precached([options.sprite])) return;
|
|
1076
|
+
begin(TE_SPRITE, to);
|
|
1077
|
+
coords(options.at);
|
|
1078
|
+
write_short(<i32>options.sprite.index);
|
|
1079
|
+
byte(options.scale ?? 10);
|
|
1080
|
+
byte(options.alpha ?? 255);
|
|
1081
|
+
message_end();
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* A glowing sprite that stays a while.
|
|
1086
|
+
*
|
|
1087
|
+
* Pawn: `TE_GLOWSPRITE`
|
|
1088
|
+
*/
|
|
1089
|
+
export function glowSprite(options: GlowSpriteOptions, to: EffectRecipients = {}): void {
|
|
1090
|
+
if (!precached([options.sprite])) return;
|
|
1091
|
+
begin(TE_GLOWSPRITE, to);
|
|
1092
|
+
coords(options.at);
|
|
1093
|
+
write_short(<i32>options.sprite.index);
|
|
1094
|
+
byte(options.life * 10.0);
|
|
1095
|
+
byte(options.scale ?? 10);
|
|
1096
|
+
byte(options.alpha ?? 255);
|
|
1097
|
+
message_end();
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* A line of glowing sprites that fly off it, fall and fade.
|
|
1102
|
+
*
|
|
1103
|
+
* Pawn: `TE_SPRITETRAIL`
|
|
1104
|
+
*/
|
|
1105
|
+
export function spriteTrail(options: SpriteTrailOptions, to: EffectRecipients = {}): void {
|
|
1106
|
+
if (!precached([options.sprite])) return;
|
|
1107
|
+
begin(TE_SPRITETRAIL, to);
|
|
1108
|
+
coords(options.start);
|
|
1109
|
+
coords(options.end);
|
|
1110
|
+
write_short(<i32>options.sprite.index);
|
|
1111
|
+
byte(options.count);
|
|
1112
|
+
byte(options.life * 10.0);
|
|
1113
|
+
byte(options.scale ?? 10);
|
|
1114
|
+
byte(options.speed ?? 10);
|
|
1115
|
+
byte(options.randomness ?? 10);
|
|
1116
|
+
message_end();
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* A spray of see-through sprites.
|
|
1121
|
+
*
|
|
1122
|
+
* Pawn: `TE_SPRITE_SPRAY`
|
|
1123
|
+
*/
|
|
1124
|
+
export function spriteSpray(options: SpriteSprayOptions, to: EffectRecipients = {}): void {
|
|
1125
|
+
if (!precached([options.sprite])) return;
|
|
1126
|
+
begin(TE_SPRITE_SPRAY, to);
|
|
1127
|
+
coords(options.at);
|
|
1128
|
+
coords(options.velocity);
|
|
1129
|
+
write_short(<i32>options.sprite.index);
|
|
1130
|
+
byte(options.count);
|
|
1131
|
+
byte(options.speed);
|
|
1132
|
+
byte(options.noise ?? 0);
|
|
1133
|
+
message_end();
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* A funnel of sprites flying into a point, or out of it.
|
|
1138
|
+
*
|
|
1139
|
+
* Pawn: `TE_LARGEFUNNEL`
|
|
1140
|
+
*/
|
|
1141
|
+
export function largeFunnel(options: LargeFunnelOptions, to: EffectRecipients = {}): void {
|
|
1142
|
+
if (!precached([options.sprite])) return;
|
|
1143
|
+
begin(TE_LARGEFUNNEL, to);
|
|
1144
|
+
coords(options.at);
|
|
1145
|
+
write_short(<i32>options.sprite.index);
|
|
1146
|
+
write_short(options.reverse ? 1 : 0);
|
|
1147
|
+
message_end();
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Bubbles rising inside a brush entity, such as water.
|
|
1152
|
+
*
|
|
1153
|
+
* Pawn: `TE_FIZZ`
|
|
1154
|
+
*/
|
|
1155
|
+
export function fizz(options: FizzOptions, to: EffectRecipients = {}): void {
|
|
1156
|
+
if (!precached([options.sprite])) return;
|
|
1157
|
+
begin(TE_FIZZ, to);
|
|
1158
|
+
write_short(<i32>options.entity.id);
|
|
1159
|
+
write_short(<i32>options.sprite.index);
|
|
1160
|
+
byte(options.density);
|
|
1161
|
+
message_end();
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Bubbles rising from a box.
|
|
1166
|
+
*
|
|
1167
|
+
* Pawn: `TE_BUBBLES`
|
|
1168
|
+
*/
|
|
1169
|
+
export function bubbles(options: BubblesOptions, to: EffectRecipients = {}): void {
|
|
1170
|
+
riseBubbles(TE_BUBBLES, options, to);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Bubbles rising from a line.
|
|
1175
|
+
*
|
|
1176
|
+
* Pawn: `TE_BUBBLETRAIL`
|
|
1177
|
+
*/
|
|
1178
|
+
export function bubbleTrail(options: BubblesOptions, to: EffectRecipients = {}): void {
|
|
1179
|
+
riseBubbles(TE_BUBBLETRAIL, options, to);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* A light that lights up the world around a point.
|
|
1184
|
+
*
|
|
1185
|
+
* Pawn: `TE_DLIGHT`
|
|
1186
|
+
*/
|
|
1187
|
+
export function dynamicLight(options: DynamicLightOptions, to: EffectRecipients = {}): void {
|
|
1188
|
+
begin(TE_DLIGHT, to);
|
|
1189
|
+
coords(options.at);
|
|
1190
|
+
byte(options.radius / 10.0);
|
|
1191
|
+
color(options.color ?? "#ffffff");
|
|
1192
|
+
byte(options.life * 10.0);
|
|
1193
|
+
byte((options.decay ?? 0) / 10.0);
|
|
1194
|
+
message_end();
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* A light on an entity that lights up entities only, not the world.
|
|
1199
|
+
*
|
|
1200
|
+
* Pawn: `TE_ELIGHT`
|
|
1201
|
+
*/
|
|
1202
|
+
export function entityLight(options: EntityLightOptions, to: EffectRecipients = {}): void {
|
|
1203
|
+
begin(TE_ELIGHT, to);
|
|
1204
|
+
write_short(<i32>options.entity.id);
|
|
1205
|
+
coords(options.at);
|
|
1206
|
+
write_coord_f(options.radius);
|
|
1207
|
+
color(options.color ?? "#ffffff");
|
|
1208
|
+
byte(options.life * 10.0);
|
|
1209
|
+
write_coord_f(options.decay ?? 0);
|
|
1210
|
+
message_end();
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* A coloured line between two points.
|
|
1215
|
+
*
|
|
1216
|
+
* Pawn: `TE_LINE`
|
|
1217
|
+
*/
|
|
1218
|
+
export function line(options: LineOptions, to: EffectRecipients = {}): void {
|
|
1219
|
+
begin(TE_LINE, to);
|
|
1220
|
+
coords(options.start);
|
|
1221
|
+
coords(options.end);
|
|
1222
|
+
short(options.life * 10.0);
|
|
1223
|
+
color(options.color ?? "#ffffff");
|
|
1224
|
+
message_end();
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* The edges of a box in colour.
|
|
1229
|
+
*
|
|
1230
|
+
* Pawn: `TE_BOX`
|
|
1231
|
+
*/
|
|
1232
|
+
export function box(options: BoxOptions, to: EffectRecipients = {}): void {
|
|
1233
|
+
begin(TE_BOX, to);
|
|
1234
|
+
coords(options.mins);
|
|
1235
|
+
coords(options.maxs);
|
|
1236
|
+
short(options.life * 10.0);
|
|
1237
|
+
color(options.color ?? "#ffffff");
|
|
1238
|
+
message_end();
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* A spray of blood particles.
|
|
1243
|
+
*
|
|
1244
|
+
* Pawn: `TE_BLOOD`
|
|
1245
|
+
*/
|
|
1246
|
+
export function blood(options: BloodOptions, to: EffectRecipients = {}): void {
|
|
1247
|
+
sprayBlood(TE_BLOOD, options, to);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* A stream of blood particles.
|
|
1252
|
+
*
|
|
1253
|
+
* Pawn: `TE_BLOODSTREAM`
|
|
1254
|
+
*/
|
|
1255
|
+
export function bloodStream(options: BloodOptions, to: EffectRecipients = {}): void {
|
|
1256
|
+
sprayBlood(TE_BLOODSTREAM, options, to);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Blood as the game draws a hit: drops that fall and a blot that stays a moment.
|
|
1261
|
+
*
|
|
1262
|
+
* Pawn: `TE_BLOODSPRITE`
|
|
1263
|
+
*/
|
|
1264
|
+
export function bloodSprite(options: BloodSpriteOptions, to: EffectRecipients = {}): void {
|
|
1265
|
+
if (!precached([options.spray, options.drop])) return;
|
|
1266
|
+
begin(TE_BLOODSPRITE, to);
|
|
1267
|
+
coords(options.at);
|
|
1268
|
+
write_short(<i32>options.spray.index);
|
|
1269
|
+
write_short(<i32>options.drop.index);
|
|
1270
|
+
byte(options.palette ?? BLOOD_RED);
|
|
1271
|
+
byte(options.scale ?? 10);
|
|
1272
|
+
message_end();
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* A model thrown from a point that bounces - a shell out of a gun.
|
|
1277
|
+
*
|
|
1278
|
+
* Pawn: `TE_MODEL`
|
|
1279
|
+
*/
|
|
1280
|
+
export function model(options: ModelOptions, to: EffectRecipients = {}): void {
|
|
1281
|
+
if (!precached([options.model])) return;
|
|
1282
|
+
const sound = options.sound ?? "none";
|
|
1283
|
+
begin(TE_MODEL, to);
|
|
1284
|
+
coords(options.at);
|
|
1285
|
+
coords(options.velocity);
|
|
1286
|
+
write_angle_f(options.yaw ?? 0);
|
|
1287
|
+
write_short(<i32>options.model.index);
|
|
1288
|
+
write_byte(sound == "shell" ? 1 : sound == "shotgunShell" ? 2 : 0);
|
|
1289
|
+
byte(options.life * 10.0);
|
|
1290
|
+
message_end();
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Pieces of a model flying out of a point in every direction.
|
|
1295
|
+
*
|
|
1296
|
+
* Pawn: `TE_EXPLODEMODEL`
|
|
1297
|
+
*/
|
|
1298
|
+
export function explodeModel(options: ExplodeModelOptions, to: EffectRecipients = {}): void {
|
|
1299
|
+
if (!precached([options.model])) return;
|
|
1300
|
+
begin(TE_EXPLODEMODEL, to);
|
|
1301
|
+
coords(options.at);
|
|
1302
|
+
write_coord_f(options.speed);
|
|
1303
|
+
write_short(<i32>options.model.index);
|
|
1304
|
+
short(options.count);
|
|
1305
|
+
byte(options.life * 10.0);
|
|
1306
|
+
message_end();
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* Pieces flying out of a box - something broken:
|
|
1311
|
+
*
|
|
1312
|
+
* ```ts
|
|
1313
|
+
* effects.breakModel({ at: box.origin, size: [16, 16, 16], velocity: [0, 0, 50], model: gibs, count: 8, life: 2, material: "glass" });
|
|
1314
|
+
* ```
|
|
1315
|
+
*
|
|
1316
|
+
* Pawn: `TE_BREAKMODEL`
|
|
1317
|
+
*/
|
|
1318
|
+
export function breakModel(options: BreakModelOptions, to: EffectRecipients = {}): void {
|
|
1319
|
+
if (!precached([options.model])) return;
|
|
1320
|
+
const material = BREAK_MATERIALS.indexOf(options.material ?? "none");
|
|
1321
|
+
let flags = material >= 0 ? BREAK_FLAGS[material] : 0;
|
|
1322
|
+
if (options.smoke) flags |= 0x10;
|
|
1323
|
+
if (options.transparent) flags |= 0x20;
|
|
1324
|
+
begin(TE_BREAKMODEL, to);
|
|
1325
|
+
coords(options.at);
|
|
1326
|
+
coords(options.size);
|
|
1327
|
+
coords(options.velocity);
|
|
1328
|
+
byte(options.randomness ?? 0);
|
|
1329
|
+
write_short(<i32>options.model.index);
|
|
1330
|
+
byte(options.count);
|
|
1331
|
+
byte(options.life * 10.0);
|
|
1332
|
+
write_byte(flags);
|
|
1333
|
+
message_end();
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* A model flying like a nail that hits players.
|
|
1338
|
+
*
|
|
1339
|
+
* Pawn: `TE_PROJECTILE`
|
|
1340
|
+
*/
|
|
1341
|
+
export function projectile(options: ProjectileOptions, to: EffectRecipients = {}): void {
|
|
1342
|
+
if (!precached([options.model])) return;
|
|
1343
|
+
const owner = options.owner;
|
|
1344
|
+
begin(TE_PROJECTILE, to);
|
|
1345
|
+
coords(options.at);
|
|
1346
|
+
coords(options.velocity);
|
|
1347
|
+
write_short(<i32>options.model.index);
|
|
1348
|
+
byte(options.life);
|
|
1349
|
+
write_byte(owner != null ? <i32>owner.id : 0);
|
|
1350
|
+
message_end();
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
/**
|
|
1354
|
+
* A shower of models or sprites thrown in a direction.
|
|
1355
|
+
*
|
|
1356
|
+
* Pawn: `TE_SPRAY`
|
|
1357
|
+
*/
|
|
1358
|
+
export function spray(options: SprayOptions, to: EffectRecipients = {}): void {
|
|
1359
|
+
if (!precached([options.model])) return;
|
|
1360
|
+
begin(TE_SPRAY, to);
|
|
1361
|
+
coords(options.at);
|
|
1362
|
+
coords(options.direction);
|
|
1363
|
+
write_short(<i32>options.model.index);
|
|
1364
|
+
byte(options.count);
|
|
1365
|
+
byte(options.speed);
|
|
1366
|
+
byte(options.noise ?? 0);
|
|
1367
|
+
write_byte(max(RENDER_MODES.indexOf(options.renderMode ?? "normal"), 0));
|
|
1368
|
+
message_end();
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Sprites flying out of a player's body.
|
|
1373
|
+
*
|
|
1374
|
+
* Pawn: `TE_PLAYERSPRITES`
|
|
1375
|
+
*/
|
|
1376
|
+
export function playerSprites(options: PlayerSpritesOptions, to: EffectRecipients = {}): void {
|
|
1377
|
+
if (!precached([options.sprite])) return;
|
|
1378
|
+
begin(TE_PLAYERSPRITES, to);
|
|
1379
|
+
write_short(<i32>options.player.id);
|
|
1380
|
+
write_short(<i32>options.sprite.index);
|
|
1381
|
+
byte(options.count);
|
|
1382
|
+
byte(options.variance ?? 0);
|
|
1383
|
+
message_end();
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* A burst of particles in one colour of the game's palette.
|
|
1388
|
+
*
|
|
1389
|
+
* Pawn: `TE_PARTICLEBURST`
|
|
1390
|
+
*/
|
|
1391
|
+
export function particleBurst(options: ParticleBurstOptions, to: EffectRecipients = {}): void {
|
|
1392
|
+
begin(TE_PARTICLEBURST, to);
|
|
1393
|
+
coords(options.at);
|
|
1394
|
+
short(options.radius);
|
|
1395
|
+
byte(options.palette ?? 0);
|
|
1396
|
+
byte(options.life * 10.0);
|
|
1397
|
+
message_end();
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* A field of fire sprites filling a square.
|
|
1402
|
+
*
|
|
1403
|
+
* Pawn: `TE_FIREFIELD`
|
|
1404
|
+
*/
|
|
1405
|
+
export function fireField(options: FireFieldOptions, to: EffectRecipients = {}): void {
|
|
1406
|
+
if (!precached([options.sprite])) return;
|
|
1407
|
+
const rise = options.rise ?? "none";
|
|
1408
|
+
const blend = options.blend ?? "opaque";
|
|
1409
|
+
let flags = rise == "all" ? TEFIRE_FLAG_ALLFLOAT : rise == "some" ? TEFIRE_FLAG_SOMEFLOAT : 0;
|
|
1410
|
+
if (blend == "alpha") flags |= TEFIRE_FLAG_ALPHA;
|
|
1411
|
+
if (blend == "additive") flags |= TEFIRE_FLAG_ADDITIVE;
|
|
1412
|
+
if (options.loop) flags |= TEFIRE_FLAG_LOOP;
|
|
1413
|
+
if (options.flat) flags |= TEFIRE_FLAG_PLANAR;
|
|
1414
|
+
begin(TE_FIREFIELD, to);
|
|
1415
|
+
coords(options.at);
|
|
1416
|
+
short(options.radius);
|
|
1417
|
+
write_short(<i32>options.sprite.index);
|
|
1418
|
+
byte(options.count);
|
|
1419
|
+
write_byte(flags);
|
|
1420
|
+
byte(options.life * 10.0);
|
|
1421
|
+
message_end();
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/**
|
|
1425
|
+
* A model attached above a player that goes where he goes.
|
|
1426
|
+
*
|
|
1427
|
+
* Pawn: `TE_PLAYERATTACHMENT`
|
|
1428
|
+
*/
|
|
1429
|
+
export function playerAttachment(options: PlayerAttachmentOptions, to: EffectRecipients = {}): void {
|
|
1430
|
+
if (!precached([options.model])) return;
|
|
1431
|
+
begin(TE_PLAYERATTACHMENT, to);
|
|
1432
|
+
write_byte(<i32>options.player.id);
|
|
1433
|
+
write_coord_f(options.offset ?? 0);
|
|
1434
|
+
write_short(<i32>options.model.index);
|
|
1435
|
+
short(options.life * 10.0);
|
|
1436
|
+
message_end();
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Takes away every model attached to a player.
|
|
1441
|
+
*
|
|
1442
|
+
* Pawn: `TE_KILLPLAYERATTACHMENTS`
|
|
1443
|
+
*/
|
|
1444
|
+
export function killPlayerAttachments(options: PlayerEffectOptions, to: EffectRecipients = {}): void {
|
|
1445
|
+
begin(TE_KILLPLAYERATTACHMENTS, to);
|
|
1446
|
+
write_byte(<i32>options.player.id);
|
|
1447
|
+
message_end();
|
|
1448
|
+
}
|
|
1449
|
+
}
|