@dnd-ed/jsshenanigans 0.0.0-stage → 1.1.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/src/nodes.js ADDED
@@ -0,0 +1,739 @@
1
+ /**
2
+ * Node builders.
3
+ *
4
+ * Every builder takes a single options object and returns a plain node object
5
+ * whose keys are the names the game uses (usually UPPER CASE with spaces).
6
+ * Option names mirror the Python reference library's keyword arguments.
7
+ */
8
+
9
+ /**
10
+ * Format a vector as the game's `"x, y, z"` string.
11
+ *
12
+ * Accepts an array or any iterable, *or* an already-formatted string. Strings
13
+ * pass through verbatim: the game, `dumps()` and `describe()` all express
14
+ * vectors this way, so a vector copied out of a decoded code has to survive
15
+ * being handed straight back to a builder.
16
+ *
17
+ * @param {Iterable<number> | string} value
18
+ * @returns {string}
19
+ */
20
+ export function _vec3(value) {
21
+ if (typeof value === "string") {
22
+ return value
23
+ .trim()
24
+ .replace(/^[[\]]+/, "")
25
+ .replace(/[[\]]+$/, "")
26
+ .trim();
27
+ }
28
+ return Array.from(value, (component) => String(component)).join(", ");
29
+ }
30
+
31
+ /**
32
+ * Wait a duration of time before continuing.
33
+ * @param {object} [options]
34
+ * @param {number} [options.TIME] Seconds to delay the next node by.
35
+ */
36
+ export function WAIT({ TIME = 1 } = {}) {
37
+ return { K_NAME: "WAIT", TIME };
38
+ }
39
+
40
+ /**
41
+ * Run a base moveset skill.
42
+ * @param {object} [options]
43
+ */
44
+ export function SKILL({
45
+ move = "Divergent Fist",
46
+ speed = 1,
47
+ cancel_last = false,
48
+ enable_variants = true,
49
+ hold_for = 0,
50
+ start = 0,
51
+ } = {}) {
52
+ return {
53
+ K_NAME: "SKILL",
54
+ MOVE: move,
55
+ SPEED: speed,
56
+ START: start,
57
+ "HOLD FOR": hold_for,
58
+ "ENABLE VARIANTS": enable_variants,
59
+ "CANCEL LAST": cancel_last,
60
+ };
61
+ }
62
+
63
+ /**
64
+ * Run a base moveset special skill.
65
+ * @param {object} [options]
66
+ */
67
+ export function SPECIAL({
68
+ spec = "Limitless",
69
+ speed = 1,
70
+ cancel_last = false,
71
+ enable_variants = true,
72
+ } = {}) {
73
+ return {
74
+ K_NAME: "SPECIAL",
75
+ SPEC: spec,
76
+ SPEED: speed,
77
+ "ENABLE VARIANTS": enable_variants,
78
+ "CANCEL LAST": cancel_last,
79
+ };
80
+ }
81
+
82
+ /**
83
+ * Play an animation. `animation` uses the `[character, animation]` pairs from
84
+ * `types.Animations`.
85
+ * @param {object} [options]
86
+ */
87
+ export function ANIMATION({
88
+ animation = null,
89
+ start = 0,
90
+ end = 10,
91
+ looped = false,
92
+ speed = 1,
93
+ fade_in = 0.1,
94
+ fade_out = 0,
95
+ last_hit = -1,
96
+ } = {}) {
97
+ if (animation === null) animation = [1, 1];
98
+ return {
99
+ K_NAME: "ANIM",
100
+ ANIM_USE: animation,
101
+ PREVIEW: [start, end],
102
+ SPEED: speed,
103
+ "FADE IN": fade_in,
104
+ "FADE OUT": fade_out,
105
+ "LAST HIT": last_hit,
106
+ LOOPED: looped,
107
+ };
108
+ }
109
+
110
+ /**
111
+ * Play a sound effect.
112
+ * @param {object} [options]
113
+ */
114
+ export function SOUND({
115
+ id = 12222253,
116
+ speed = 1,
117
+ volume = 0.5,
118
+ start = 0,
119
+ end = 500,
120
+ fade_in = 0,
121
+ fade_out = 0,
122
+ cancel = false,
123
+ global_ = false,
124
+ projectile_tag = "nil",
125
+ } = {}) {
126
+ return {
127
+ K_NAME: "SFX",
128
+ ID: id,
129
+ START: start,
130
+ END: end,
131
+ SPEED: speed,
132
+ VOLUME: volume,
133
+ "FADE IN": fade_in,
134
+ "FADE OUT": fade_out,
135
+ GLOBAL: global_,
136
+ "PROJECTILE TAG": projectile_tag,
137
+ CANCEL: cancel,
138
+ };
139
+ }
140
+
141
+ /**
142
+ * Apply a force to a character.
143
+ * @param {object} [options]
144
+ */
145
+ export function VELOCITY({
146
+ force = null,
147
+ time = 0,
148
+ fade = false,
149
+ track = false,
150
+ last_hit = -1,
151
+ ragdoll = 0,
152
+ true_ragdoll = false,
153
+ relative_from_branch = false,
154
+ } = {}) {
155
+ if (force === null) force = [0, 0, 0];
156
+ return {
157
+ K_NAME: "VELO",
158
+ FORCE: _vec3(force),
159
+ TIME: time,
160
+ FADE: fade,
161
+ TRACK: track,
162
+ "LAST HIT": last_hit,
163
+ RAGDOLL: ragdoll,
164
+ "TRUE RAGDOLL": true_ragdoll,
165
+ "RELATIVE FROM BRANCH": relative_from_branch,
166
+ };
167
+ }
168
+
169
+ /**
170
+ * Emit a signal to Connect Blocks.
171
+ * @param {object} [options]
172
+ */
173
+ export function CONNECT({ signal = "Nothing", time = 0.1, range = "inf" } = {}) {
174
+ return { K_NAME: "CONNECT", SIGNAL: signal, TIME: time, RANGE: range };
175
+ }
176
+
177
+ /**
178
+ * Create a hitbox.
179
+ * @param {object} [options]
180
+ */
181
+ export function HITBOX({
182
+ position = null,
183
+ rotation = null,
184
+ size = null,
185
+ stun = 1,
186
+ stun_anim = false,
187
+ ignore_wakeup = false,
188
+ damage = 1,
189
+ debree = 0,
190
+ attack_type = "Melee",
191
+ blockable = true,
192
+ blockable_360 = false,
193
+ cancel_enemy = true,
194
+ clear_knockback = false,
195
+ can_kill = true,
196
+ hit_ragdoll = false,
197
+ hit_user = false,
198
+ single_target = true,
199
+ branch = "nil",
200
+ branch_target = "nil",
201
+ branch_finisher = "nil",
202
+ projectile_tag = "nil",
203
+ link_user = false,
204
+ preview = null,
205
+ } = {}) {
206
+ if (position === null) position = [0, 0, 4];
207
+ if (rotation === null) rotation = [0, 0, 0];
208
+ if (size === null) size = [6, 6, 6];
209
+ const node = {
210
+ K_NAME: "HITBOX",
211
+ POSITION: _vec3(position),
212
+ ROTATION: _vec3(rotation),
213
+ SIZE: _vec3(size),
214
+ STUN: stun,
215
+ "STUN ANIM": stun_anim,
216
+ DAMAGE: damage,
217
+ DEBREE: debree,
218
+ "ATTACK TYPE": attack_type,
219
+ BLOCKABLE: blockable,
220
+ "360 BLOCK": blockable_360,
221
+ "CANCEL ENEMY": cancel_enemy,
222
+ "CLEAR KNOCKBACK": clear_knockback,
223
+ "CAN KILL": can_kill,
224
+ "HIT RAGDOLL": hit_ragdoll,
225
+ "HIT USER": hit_user,
226
+ "SINGLE TARGET": single_target,
227
+ BRANCH: branch,
228
+ "BRANCH TARGET": branch_target,
229
+ "BRANCH FINISHER": branch_finisher,
230
+ "PROJECTILE TAG": projectile_tag,
231
+ "IGNORE WAKEUP": ignore_wakeup,
232
+ "LINK USER": link_user,
233
+ };
234
+ if (preview !== null) node.PREVIEW = preview;
235
+ return node;
236
+ }
237
+
238
+ /**
239
+ * Proceed to a branch on hit.
240
+ * @param {object} [options]
241
+ */
242
+ export function BRANCH({ branch = "nil", random = "", last_hit = -1 } = {}) {
243
+ return {
244
+ K_NAME: "BRANCH",
245
+ BRANCH: branch,
246
+ RANDOM: random,
247
+ "LAST HIT": last_hit,
248
+ };
249
+ }
250
+
251
+ /**
252
+ * Play a visual effect.
253
+ * @param {object} [options]
254
+ */
255
+ export function VISUAL({
256
+ effect = "Slash",
257
+ amount = 1,
258
+ texture = 0,
259
+ color = "255, 255, 255",
260
+ alt_color = "255, 255, 255",
261
+ opacity = 0,
262
+ alt_opacity = 0,
263
+ position = null,
264
+ alt_position = null,
265
+ rotation = null,
266
+ alt_rotation = null,
267
+ size = 1,
268
+ alt_size = 1,
269
+ time = 1,
270
+ last_hit = -1,
271
+ limb = "HumanoidRootPart",
272
+ visual_tag = "nil",
273
+ projectile_tag = "nil",
274
+ run_on_server = false,
275
+ cancel_on_interrupt = false,
276
+ relative_from_branch = false,
277
+ can_collide = false,
278
+ easing_style = "Linear",
279
+ easing_direction = "In",
280
+ } = {}) {
281
+ if (position === null) position = [0, 0, 0];
282
+ if (alt_position === null) alt_position = [0, 0, 0];
283
+ if (rotation === null) rotation = [0, 0, 0];
284
+ if (alt_rotation === null) alt_rotation = [0, 0, 0];
285
+ return {
286
+ K_NAME: "VISUAL",
287
+ EFFECT: effect,
288
+ TIME: time,
289
+ POSITION: _vec3(position),
290
+ ROTATION: _vec3(rotation),
291
+ SIZE: size,
292
+ COLOR: color,
293
+ OPACITY: opacity,
294
+ "ALT POSITION": _vec3(alt_position),
295
+ "ALT ROTATION": _vec3(alt_rotation),
296
+ "ALT SIZE": alt_size,
297
+ "ALT COLOR": alt_color,
298
+ "ALT OPACITY": alt_opacity,
299
+ TEXTURE: texture,
300
+ "BODY PART": limb,
301
+ "EASING STYLE": easing_style,
302
+ "EASING DIRECTION": easing_direction,
303
+ "PROJECTILE TAG": projectile_tag,
304
+ "VISUAL TAG": visual_tag,
305
+ AMOUNT: amount,
306
+ "RUN ON SERVER": run_on_server,
307
+ "RELATIVE FROM BRANCH": relative_from_branch,
308
+ "CANCEL ON INTERRUPT": cancel_on_interrupt,
309
+ "CAN COLLIDE": can_collide,
310
+ "LAST HIT": last_hit,
311
+ };
312
+ }
313
+
314
+ /**
315
+ * Grab a target's limb.
316
+ * @param {object} [options]
317
+ */
318
+ export function GRAB({
319
+ limb = "HumanoidRootPart",
320
+ target_limb = "HumanoidRootPart",
321
+ position = null,
322
+ rotation = null,
323
+ time = 1,
324
+ last_hit = 1,
325
+ } = {}) {
326
+ if (position === null) position = [0, 0, 0];
327
+ if (rotation === null) rotation = [0, 0, 0];
328
+ return {
329
+ K_NAME: "GRAB",
330
+ "BODY PART": limb,
331
+ "BODY PART2": target_limb,
332
+ TIME: time,
333
+ POSITION: _vec3(position),
334
+ ROTATION: _vec3(rotation),
335
+ "LAST HIT": last_hit,
336
+ };
337
+ }
338
+
339
+ /**
340
+ * Create a projectile.
341
+ * @param {object} [options]
342
+ */
343
+ export function PROJECTILE({
344
+ projectile_tag = "nil",
345
+ position = null,
346
+ rotation = null,
347
+ size = null,
348
+ speed = 1,
349
+ time = 1,
350
+ stun = 1,
351
+ stun_anim = false,
352
+ ignore_wakeup = true,
353
+ damage = 1,
354
+ debree = 0,
355
+ attack_type = "Melee",
356
+ blockable = true,
357
+ blockable_360 = false,
358
+ cancel_enemy = true,
359
+ clear_knockback = false,
360
+ can_kill = true,
361
+ hit_ragdoll = false,
362
+ hit_user = false,
363
+ single_target = true,
364
+ aim_last_hit = -1,
365
+ continue_ = false,
366
+ branch = "nil",
367
+ branch_target = "nil",
368
+ branch_collided = "nil",
369
+ filter_interval = 1,
370
+ reflect_count = 0,
371
+ cache = true,
372
+ } = {}) {
373
+ if (position === null) position = [0, 0, 4];
374
+ if (rotation === null) rotation = [0, 0, 0];
375
+ if (size === null) size = [6, 6, 6];
376
+ return {
377
+ K_NAME: "PROJECTILE",
378
+ DAMAGE: damage,
379
+ STUN: stun,
380
+ SPEED: speed,
381
+ SIZE: _vec3(size),
382
+ POSITION: _vec3(position),
383
+ ROTATION: _vec3(rotation),
384
+ "ATTACK TYPE": attack_type,
385
+ "PROJECTILE TAG": projectile_tag,
386
+ "REFLECT COUNT": reflect_count,
387
+ "FILTER INTERVAL": filter_interval,
388
+ BRANCH: branch,
389
+ "BRANCH TARGET": branch_target,
390
+ "BRANCH COLLIDED": branch_collided,
391
+ CONTINUE: continue_,
392
+ "HIT RAGDOLL": hit_ragdoll,
393
+ "STUN ANIM": stun_anim,
394
+ "HIT USER": hit_user,
395
+ "SINGLE TARGET": single_target,
396
+ BLOCKABLE: blockable,
397
+ "360 BLOCK": blockable_360,
398
+ "CAN KILL": can_kill,
399
+ "AIM LAST HIT": aim_last_hit,
400
+ TIME: time,
401
+ "IGNORE WAKEUP": ignore_wakeup,
402
+ DEBREE: debree,
403
+ "CANCEL ENEMY": cancel_enemy,
404
+ CACHE: cache,
405
+ "CLEAR KNOCKBACK": clear_knockback,
406
+ };
407
+ }
408
+
409
+ /**
410
+ * Start a counter.
411
+ * @param {object} [options]
412
+ */
413
+ export function COUNTER({
414
+ attack_type = null,
415
+ time = 1,
416
+ stun = 1,
417
+ cancel_enemy = true,
418
+ branch = "nil",
419
+ branch_target = "nil",
420
+ remove_on_hit = true,
421
+ reflect = false,
422
+ continue_ = false,
423
+ } = {}) {
424
+ if (attack_type === null) attack_type = ["Melee"];
425
+ return {
426
+ K_NAME: "COUNTER",
427
+ TIME: time,
428
+ STUN: stun,
429
+ "ATTACK TYPE2": attack_type.join(","),
430
+ BRANCH: branch,
431
+ "BRANCH TARGET": branch_target,
432
+ "CANCEL ENEMY": cancel_enemy,
433
+ "REMOVE ON HIT": remove_on_hit,
434
+ REFLECT: reflect,
435
+ CONTINUE: continue_,
436
+ };
437
+ }
438
+
439
+ /**
440
+ * Create a tag.
441
+ * @param {object} [options]
442
+ */
443
+ export function TAG({
444
+ tag = "nil",
445
+ value = "nil",
446
+ time = 1,
447
+ check = false,
448
+ add_remove = true,
449
+ set_value = true,
450
+ branch = "nil",
451
+ last_hit = -1,
452
+ } = {}) {
453
+ return {
454
+ K_NAME: "TAG",
455
+ TAG: tag,
456
+ VALUE: value,
457
+ TIME: time,
458
+ "ADD/REMOVE": add_remove,
459
+ CHECK: check,
460
+ SET: set_value,
461
+ BRANCH: branch,
462
+ "LAST HIT": last_hit,
463
+ };
464
+ }
465
+
466
+ /**
467
+ * Check or set a character state.
468
+ * @param {object} [options]
469
+ */
470
+ export function STATE({
471
+ state = "Stun",
472
+ value = 1,
473
+ time = 1,
474
+ cancel_on_end = false,
475
+ disable_burst = false,
476
+ last_hit = -1,
477
+ check = false,
478
+ branch = "nil",
479
+ state_tag = "nil",
480
+ } = {}) {
481
+ return {
482
+ K_NAME: "STATE",
483
+ STATE: state,
484
+ VALUE: value,
485
+ TIME: time,
486
+ "DISABLE BURST": disable_burst,
487
+ "CANCEL ON END": cancel_on_end,
488
+ "LAST HIT": last_hit,
489
+ BRANCH: branch,
490
+ CHECK: check,
491
+ "STATE TAG": state_tag,
492
+ };
493
+ }
494
+
495
+ /**
496
+ * Teleport to an offset.
497
+ * @param {object} [options]
498
+ */
499
+ export function TELEPORT({
500
+ position = null,
501
+ rotation = null,
502
+ last_hit = -1,
503
+ projectile_tag = "nil",
504
+ relative_from_branch = false,
505
+ ignore_walls = false,
506
+ } = {}) {
507
+ if (position === null) position = [0, 0, 0];
508
+ if (rotation === null) rotation = [0, 0, 0];
509
+ return {
510
+ K_NAME: "TELEPORT",
511
+ POSITION: _vec3(position),
512
+ ROTATION: _vec3(rotation),
513
+ "PROJECTILE TAG": projectile_tag,
514
+ "LAST HIT": last_hit,
515
+ "RELATIVE FROM BRANCH": relative_from_branch,
516
+ "IGNORE WALLS": ignore_walls,
517
+ };
518
+ }
519
+
520
+ /**
521
+ * Add to your awakening bar.
522
+ * @param {object} [options]
523
+ */
524
+ export function ADD_AWAKENING({ amount = 5 } = {}) {
525
+ return { K_NAME: "ULTGIB", AMOUNT: amount };
526
+ }
527
+
528
+ /**
529
+ * Add to your health bar.
530
+ * @param {object} [options]
531
+ */
532
+ export function ADD_HEALTH({ amount = 5, can_kill = false } = {}) {
533
+ return { K_NAME: "HPGIB", AMOUNT: amount, "CAN KILL": can_kill };
534
+ }
535
+
536
+ /**
537
+ * Add to your evasion bar.
538
+ * @param {object} [options]
539
+ */
540
+ export function ADD_EVASION({ amount = 5 } = {}) {
541
+ return { K_NAME: "EVGIB", AMOUNT: amount };
542
+ }
543
+
544
+ /**
545
+ * Cancel the skill.
546
+ * @param {object} [options]
547
+ */
548
+ export function HIT_CANCEL({ time = 1, flip = false, endlag = 1, branch = "nil" } = {}) {
549
+ return {
550
+ K_NAME: "HITCNCL",
551
+ TIME: time,
552
+ ENDLAG: endlag,
553
+ BRANCH: branch,
554
+ FLIP: flip,
555
+ };
556
+ }
557
+
558
+ /**
559
+ * Set the cooldown of a skill.
560
+ * @param {object} [options]
561
+ */
562
+ export function SET_COOLDOWN({ key = -1, cooldown = -1 } = {}) {
563
+ return { KEY: key, K_NAME: "SETCD", COOLDOWN: cooldown };
564
+ }
565
+
566
+ /**
567
+ * Loop the current skill.
568
+ * @param {object} [options]
569
+ */
570
+ export function LOOP({ loop_back = 1, loop_amount = 3, hold = false } = {}) {
571
+ return {
572
+ "LOOP BACK": loop_back,
573
+ HOLD: hold,
574
+ "LOOP AMOUNT": loop_amount,
575
+ K_NAME: "LOOP",
576
+ };
577
+ }
578
+
579
+ /**
580
+ * Emit particles.
581
+ *
582
+ * Every setting is a typed argument, confirmed against a game-produced code.
583
+ * Values left as `null` are omitted rather than guessed. Anything not modelled
584
+ * can still be passed verbatim as an extra key.
585
+ *
586
+ * `orientation_type` is one of `FacingCamera`, `FacingCameraWorldUp`,
587
+ * `VelocityParallel`, `VelocityPerpendicular`; `flipbook_mode` is one of
588
+ * `Loop`, `OneShot`, `PingPong`, `Random`; `shape` is one of `Box`,
589
+ * `Cylinder`, `Disc`, `Sphere`. The sequence fields take either a
590
+ * comma-separated string or an array.
591
+ *
592
+ * @param {object} [options]
593
+ */
594
+ export function PARTICLE({
595
+ part_size = null,
596
+ texture = null,
597
+ emit_count = null,
598
+ rate = null,
599
+ duration = null,
600
+ color = null,
601
+ size = null,
602
+ brightness = null,
603
+ transparency = null,
604
+ squash = null,
605
+ lifetime = null,
606
+ speed = null,
607
+ rotation = null,
608
+ rot_speed = null,
609
+ acceleration = null,
610
+ drag = null,
611
+ light_emission = null,
612
+ light_influence = null,
613
+ z_offset = null,
614
+ spread_angle = null,
615
+ position = null,
616
+ lock_to_part = null,
617
+ limb = null,
618
+ orientation_type = null,
619
+ emission_direction = null,
620
+ flipbook_size = null,
621
+ flipbook_mode = null,
622
+ flipbook_framerate = null,
623
+ shape = null,
624
+ shape_inout = null,
625
+ shape_partial = null,
626
+ run_on_server = null,
627
+ client_sided = null,
628
+ cancel_tag = null,
629
+ cancel = null,
630
+ cancel_on_interrupt = null,
631
+ projectile_tag = null,
632
+ last_hit = null,
633
+ ...fields
634
+ } = {}) {
635
+ const provided = {
636
+ "PART SIZE": part_size === null ? null : _vec3(part_size),
637
+ TEXTURE: texture,
638
+ "EMIT COUNT": emit_count,
639
+ RATE: rate,
640
+ DURATION: duration,
641
+ COLOR: color,
642
+ SIZE: size === null ? null : _vec3(size),
643
+ BRIGHTNESS: brightness,
644
+ TRANSPARENCY: transparency === null ? null : _vec3(transparency),
645
+ SQUASH: squash === null ? null : _vec3(squash),
646
+ LIFETIME: lifetime === null ? null : _vec3(lifetime),
647
+ SPEED: speed === null ? null : _vec3(speed),
648
+ ROTATION: rotation === null ? null : _vec3(rotation),
649
+ "ROT SPEED": rot_speed === null ? null : _vec3(rot_speed),
650
+ ACCELERATION: acceleration === null ? null : _vec3(acceleration),
651
+ DRAG: drag,
652
+ "LIGHT EMISSION": light_emission,
653
+ "LIGHT INFLUENCE": light_influence,
654
+ ZOFFSET: z_offset,
655
+ "SPREAD ANGLE": spread_angle === null ? null : _vec3(spread_angle),
656
+ POSITION: position === null ? null : _vec3(position),
657
+ "LOCK TO PART": lock_to_part,
658
+ "BODY PART": limb,
659
+ "ORIENTATION TYPE": orientation_type,
660
+ "EMISSION DIRECTION": emission_direction,
661
+ "FLIPBOOK SIZE": flipbook_size === null ? null : _vec3(flipbook_size),
662
+ "FLIPBOOK MODE": flipbook_mode,
663
+ "FLIPBOOK FRAMERATE":
664
+ flipbook_framerate === null ? null : _vec3(flipbook_framerate),
665
+ SHAPE: shape,
666
+ "SHAPE INOUT": shape_inout,
667
+ "SHAPE PARTIAL": shape_partial,
668
+ "RUN ON SERVER": run_on_server,
669
+ "CLIENT SIDED": client_sided,
670
+ "CANCEL TAG": cancel_tag,
671
+ CANCEL: cancel,
672
+ "CANCEL ON INTERRUPT": cancel_on_interrupt,
673
+ "PROJECTILE TAG": projectile_tag,
674
+ "LAST HIT": last_hit,
675
+ };
676
+ const node = { K_NAME: "PARTICLE" };
677
+ for (const [key, value] of Object.entries(provided)) {
678
+ if (value !== null) node[key] = value;
679
+ }
680
+ Object.assign(node, fields);
681
+ return node;
682
+ }
683
+
684
+ /**
685
+ * Point the camera in a direction.
686
+ * @param {object} [options]
687
+ */
688
+ export function LOOK({
689
+ time = null,
690
+ smoothness = 40,
691
+ horizontal_only = null,
692
+ last_hit = -1,
693
+ relative_from_branch = null,
694
+ projectile_tag = null,
695
+ camera_direction = null,
696
+ grounded = null,
697
+ } = {}) {
698
+ const provided = {
699
+ TIME: time,
700
+ "HORIZONTAL ONLY": horizontal_only,
701
+ "RELATIVE FROM BRANCH": relative_from_branch,
702
+ "PROJECTILE TAG": projectile_tag,
703
+ "CAMERA DIRECTION": camera_direction,
704
+ GROUNDED: grounded,
705
+ };
706
+ const node = { K_NAME: "LOOK", SMOOTHNESS: smoothness, "LAST HIT": last_hit };
707
+ for (const [key, value] of Object.entries(provided)) {
708
+ if (value !== null) node[key] = value;
709
+ }
710
+ return node;
711
+ }
712
+
713
+ /**
714
+ * Force the user's melee count to a specific M1 for a while.
715
+ * @param {object} [options]
716
+ */
717
+ export function SETMELEE({ combo = null, offset = null, last_hit = -1 } = {}) {
718
+ const provided = { COMBO: combo, OFFSET: offset };
719
+ const node = { K_NAME: "SETMELEE", "LAST HIT": last_hit };
720
+ for (const [key, value] of Object.entries(provided)) {
721
+ if (value !== null) node[key] = value;
722
+ }
723
+ return node;
724
+ }
725
+
726
+ /**
727
+ * Build any node verbatim by its `K_NAME`.
728
+ *
729
+ * An escape hatch for nodes with no dedicated builder:
730
+ *
731
+ * raw("PARTICLE", { ID: 1, TIME: 2 })
732
+ * raw("LOOK", { TARGET: "Head" })
733
+ *
734
+ * @param {string} k_name
735
+ * @param {object} [fields]
736
+ */
737
+ export function raw(k_name, fields = {}) {
738
+ return { K_NAME: k_name, ...fields };
739
+ }