forked from JordanSantiagoYT/FNF-JS-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.lua
1440 lines (1424 loc) · 55.1 KB
/
header.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---@diagnostic disable: lowercase-global, missing-return, unused-local
--[[
A header class which adds basic documentation for all PsychLua functions and variables
To add to your current working script, use `---@module "header"` into the top of the script, and have this file in the bin/ directory (where the assets or mods folder is found). This will add syntax highlighting, code completion, and much more
Written and Maintained by saturn-volv (https://github.com/saturn-volv)
]]--
--- Common colors that may be used. Just a helper object.
---@enum common_colors
COMMON_COLORS = {
BLACK = "000000",
WHITE = "FFFFFF",
RED = "FF0000",
GREEN = "00FF00",
BLUE = "0000FF",
YELLOW = "FFFF00",
CYAN = "00FFFF",
MAGENTA = "FF00FF"
}
---@enum charType
local CHAR_TYPES = {
BOYFRIEND = "boyfriend",
BF = "boyfriend",
DAD = "dad",
GIRLFRIEND = "gf",
GF = "gf"
}
---@enum keylist
local KEY_LIST = {
A = "A",
ALT = "ALT",
B = "B",
BACKSLASH = "BACKSLASH",
BACKSPACE = "BACKSPACE",
BREAK = "BREAK",
C = "C",
CAPSLOCK = "CAPSLOCK",
COMMA = "COMMA",
CONTROL = "CONTROL",
D = "D",
DELETE = "DELETE",
DOWN = "DOWN",
E = "E",
EIGHT = "EIGHT",
END = "END",
ENTER = "ENTER",
ESCAPE = "ESCAPE",
F = "F",
F1 = "F1",
F10 = "F10",
F11 = "F11",
F12 = "F12",
F2 = "F2",
F3 = "F3",
F4 = "F4",
F5 = "F5",
F6 = "F6",
F7 = "F7",
F8 = "F8",
F9 = "F9",
FIVE = "FIVE",
FOUR = "FOUR",
G = "G",
GRAVEACCENT = "GRAVEACCENT",
H = "H",
HOME = "HOME",
I = "I",
INSERT = "INSERT",
J = "J",
K = "K",
L = "L",
LBRACKET = "LBRACKET",
LEFT = "LEFT",
M = "M",
MENU = "MENU",
MINUS = "MINUS",
N = "N",
NINE = "NINE",
NUMLOCK = "NUMLOCK",
NUMPADEIGHT = "NUMPADEIGHT",
NUMPADFIVE = "NUMPADFIVE",
NUMPADFOUR = "NUMPADFOUR",
NUMPADMINUS = "NUMPADMINUS",
NUMPADMULTIPLY = "NUMPADMULTIPLY",
NUMPADNINE = "NUMPADNINE",
NUMPADONE = "NUMPADONE",
NUMPADPERIOD = "NUMPADPERIOD",
NUMPADPLUS = "NUMPADPLUS",
NUMPADSEVEN = "NUMPADSEVEN",
NUMPADSIX = "NUMPADSIX",
NUMPADSLASH = "NUMPADSLASH",
NUMPADTHREE = "NUMPADTHREE",
NUMPADTWO = "NUMPADTWO",
NUMPADZERO = "NUMPADZERO",
O = "O",
ONE = "ONE",
P = "P",
PAGEDOWN = "PAGEDOWN",
PAGEUP = "PAGEUP",
PERIOD = "PERIOD",
PLUS = "PLUS",
PRINTSCREEN = "PRINTSCREEN",
Q = "Q",
QUOTE = "QUOTE",
R = "R",
RBRACKET = "RBRACKET",
RIGHT = "RIGHT",
S = "S",
SCROLL_LOCK = "SCROLL_LOCK",
SEMICOLON = "SEMICOLON",
SEVEN = "SEVEN",
SHIFT = "SHIFT",
SIX = "SIX",
SLASH = "SLASH",
SPACE = "SPACE",
T = "T",
TAB = "TAB",
THREE = "THREE",
TWO = "TWO",
U = "U",
UP = "UP",
V = "V",
W = "W",
WINDOWS = "WINDOWS",
X = "X",
Y = "Y",
Z = "Z",
ZERO = "ZERO"
}
---@enum lower_keylist
local LOWER_KEY_LIST = {
A = "a",
ALT = "alt",
B = "b",
BACKSLASH = "backslash",
BACKSPACE = "backspace",
BREAK = "break",
C = "c",
CAPSLOCK = "capslock",
COMMA = "comma",
CONTROL = "control",
D = "d",
DELETE = "delete",
DOWN = "down",
E = "e",
EIGHT = "eight",
END = "end",
ENTER = "enter",
ESCAPE = "escape",
F = "f",
F1 = "f1",
F10 = "f10",
F11 = "f11",
F12 = "f12",
F2 = "f2",
F3 = "f3",
F4 = "f4",
F5 = "f5",
F6 = "f6",
F7 = "f7",
F8 = "f8",
F9 = "f9",
FIVE = "five",
FOUR = "four",
G = "g",
GRAVEACCENT = "graveaccent",
H = "h",
HOME = "home",
I = "i",
INSERT = "insert",
J = "j",
K = "k",
L = "l",
LBRACKET = "lbracket",
LEFT = "left",
M = "m",
MENU = "menu",
MINUS = "minus",
N = "n",
NINE = "nine",
NUMLOCK = "numlock",
NUMPADEIGHT = "numpadeight",
NUMPADFIVE = "numpadfive",
NUMPADFOUR = "numpadfour",
NUMPADMINUS = "numpadminus",
NUMPADMULTIPLY = "numpadmultiply",
NUMPADNINE = "numpadnine",
NUMPADONE = "numpadone",
NUMPADPERIOD = "numpadperiod",
NUMPADPLUS = "numpadplus",
NUMPADSEVEN = "numpadseven",
NUMPADSIX = "numpadsix",
NUMPADSLASH = "numpadslash",
NUMPADTHREE = "numpadthree",
NUMPADTWO = "numpadtwo",
NUMPADZERO = "numpadzero",
O = "o",
ONE = "one",
P = "p",
PAGEDOWN = "pagedown",
PAGEUP = "pageup",
PERIOD = "period",
PLUS = "plus",
PRINTSCREEN = "printscreen",
Q = "q",
QUOTE = "quote",
R = "r",
RBRACKET = "rbracket",
RIGHT = "right",
S = "s",
SCROLL_LOCK = "scroll_lock",
SEMICOLON = "semicolon",
SEVEN = "seven",
SHIFT = "shift",
SIX = "six",
SLASH = "slash",
SPACE = "space",
T = "t",
TAB = "tab",
THREE = "three",
TWO = "two",
U = "u",
UP = "up",
V = "v",
W = "w",
WINDOWS = "windows",
X = "x",
Y = "y",
Z = "z",
ZERO = "zero"
}
---@enum game_keyList
local GAME_KEY_LIST = {
left = "left",
down = "down",
up = "up",
right = "right",
accept = "accept",
back = "back",
pause = "pause",
reset = "reset",
space = "space"
}
--[[ CALLBACKS ]]--
--[[
onCreate
onCreatePost
onUpdate
onUpdatePost
onDestroy
onBeatHit
onStepHit
onSectionHit
onTweenCompleted
onTimerCompleted
onSoundFinished
onStartCountdown
onCountdownTick
onPause
onResume
onGameOver
onGameOverStart
onGameOverConfirm
onSpawnNote
goodNoteHit
opponentNoteHit
noteMiss
noteMissPress
onGhostTap
onKeyPressed
onKeyReleased
onNextDialogue
onSkipDialogue
onEvent
eventEarlyTrigger
onSongStart
onEndSong
onMoveCamera
onRecalculateRating
onUpdateScore
]]--
--[[ VARIABLES ]]--
---Stops the Lua script. Must be returned
---@type any
Function_StopLua = "##PSYCHLUA_FUNCTIONSTOPLUA"
---Stops the game. Must be returned
---@type any
Function_Stop = "##PSYCHLUA_FUNCTIONSTOP"
---Continues the game. Must be returned
---@type any
Function_Continue = "##PSYCHLUA_FUNCTIONCONTINUE"
--- If enabled PsychLua will leave a debug log on screen
---```lua
--- luaDebugMode = true -- Enables debug mode
---```
---@type boolean Defaults to false
luaDebugMode = false
--- If enabled and `luaDebugMode` is enabled, PsychLua will log all instances of deprecated functions being used
---```lua
--- luaDeprecatedWarnings = false -- Disables warnings
---```
---@type boolean Defaults to true
luaDeprecatedWarnings = true
--- If you are in the Chart Editor's playtest state
---@type boolean
inChartEditor = false
--- The current score. Alternative to `getScore()`
---@type number
score = 0
--- The current misses. Alternative to `getMisses()`
---@type number
misses = 0
--- The total notes hit. Alternative to `getHits()`
---@type number
hits = 0
--- The current rating percentage (from 0 to 1)
---@type number
rating = 0
--- The current rating name
---@type string
ratingName = ''
--- The current rating FC
---@type string
ratingFC = ''
--- The current song's scroll speed
---@type number
scrollSpeed = 0.0
--- The current song's duration in ms
---@type number
songLength = 0
--- The current song's directory
---@type string
songPath = ''
--- If the countdown has started
---@type boolean
startedCountdown = false
--- If you are in the `GameOverSubstate`
---@type boolean
inGameOver = false
--- The current song's difficulty
---@type number
difficulty = 0
--- The current song's difficulty name
---@type string
difficultyName = ''
--- The current song's difficulty directory
---@type string
difficultyPath = ''
--- The current week
---@type number
weekRaw = 0
--- The current week's name
---@type string
week = ''
--- If the game was played from `StoryModeState` or `FreeplayState`
---@type boolean
isStoryMode = false
--- The current bpm of the song
---@type number
curBpm = 0
--- The inital bpm of the song
---@type number
bpm = 0
--- Interval between beat hits in ms
---@type number
crochet = 0
--- Interval between step hits in ms
---@type number
stepCrochet = 0
--- The current beat
---@type number
curBeat = 0
--- The current step
---@type number
curStep = 0
--- The current beat with decimal
---@type number
curDecBeat = 0
--- The current step with decimal
---@type number
curDecStep = 0
--- The current section
---@type number
curSection = 0
--- If the camera points to BF
---@type boolean
mustHitSection = false
--- If characters play `-alt` animations
---@type boolean
altAnim = false
--- If `player3` sings instead of whoever the section points to
---@type boolean
gfSection = false
--- If the notes scroll downwards instead of upwards
---@type boolean
downscroll = false
--- If the player's notes are centered rather than on one side
---@type boolean
middlescroll = false
--- "Pretty self explanatory, isn't it?"
---@type number
framerate = 0
--- If you can press note keys without hitting a note and not miss
---@type boolean
ghostTapping = false
--- If the hud is hidden
---@type boolean
hideHud = false
--- @alias timeBarTypes "Time Left" | "Time Elapsed" | "Song Name" | "Disabled"
--- @type timeBarTypes The text displayed over the timebar
timeBarType = "Time Left"
--- If the score text zooms on each note hit
---@type boolean
scoreZoom = false
--- If the camera bops on each song beat
---@type boolean
cameraZoomOnBeat = false
--- If some items which may cause epilepsy, they will be disabled
---@type boolean
flashingLights = false
--- The offset from `songPosition` for notes to be pushed at in ms
---@type number
noteOffset = 0
--- The transparency of the healthBar and it's icons
---@type number
healthBarAlpha = 0
--- If the player can enter `GameOverSubstate` from a keystroke
---@type boolean
noResetButton = false
--- Hides certain items to increase performance
---@type boolean
lowQuality = false
--- If runtime shaders can be enabled.\
--- **MAY DECREASE PERFORMANCE**
---@type boolean
shadersEnabled = false
--- The current camera X position
---@type number
cameraX = 0
--- The current camera Y position
---@type number
cameraY = 0
--- The game width
---@type number
screenWidth = 0
--- The game height
---@type number
screenHeight = 0
--- Multiplier for how much health is gained on a note hit
---@type number
healthGainMult = 0
--- Multiplier for how much health is lossed on a missed note
---@type number
healthLossMult = 0
--- If the player must FC to win
---@type boolean
instakillOnMiss = false
--- If a CPU plays instead of the player
---@type boolean
botPlay = false
--- If the player can't die due to health loss
---@type boolean
practice = false
--- How fast the game plays
---@type number
playbackRate = 0
--- The inital boyfriend X position
---@type number
defaultBoyfriendX = 0
--- The inital boyfriend Y position
---@type number
defaultBoyfriendY = 0
--- The inital opponent X position
---@type number
defaultOpponentX = 0
--- The inital opponent Y position
---@type number
defaultOpponentY = 0
--- The inital girlfriend X position
---@type number
defaultGirlfriendX = 0
--- The initial girlfriend Y position
---@type number
defaultGirlfriendY = 0
--- The name of the `boyfriend` character\
--- Alias to `getProperty('boyfriend.curCharacter')`
---@type string
boyfriendName = ''
--- The name of the `dad` character\
--- Alias to `getProperty('dad.curCharacter')`
---@type string
dadName = ''
--- The name of the `gf` character\
--- Alias to `getProperty('gf.curCharacter')`
---@type string
gfName = ''
--- The inital X position for the Left Player Strum
---@type number
defaultPlayerStrumX0 = 0
--- The inital X position for the Down Player Strum
---@type number
defaultPlayerStrumX1 = 0
--- The inital X position for the Up Player Strum
---@type number
defaultPlayerStrumX2 = 0
--- The inital X position for the Right Player Strum
---@type number
defaultPlayerStrumX3 = 0
--- The inital X position for the Left Player Strum
---@type number
defaultPlayerStrumY0 = 0
--- The inital Y position for the Down Player Strum
---@type number
defaultPlayerStrumY1 = 0
--- The inital Y position for the Up Player Strum
---@type number
defaultPlayerStrumY2 = 0
--- The inital Y position for the Right Player Strum
---@type number
defaultPlayerStrumY3 = 0
--- The inital Y position for the Left Player Strum
---@type number
defaultOpponentStrumX0 = 0
--- The inital X position for the Down Opponent Strum
---@type number
defaultOpponentStrumX1 = 0
--- The inital X position for the Up Opponent Strum
---@type number
defaultOpponentStrumX2 = 0
--- The inital X position for the Right Opponent Strum
---@type number
defaultOpponentStrumX3 = 0
--- The inital Y position for the Left Opponent Strum
---@type number
defaultOpponentStrumY0 = 0
--- The inital Y position for the Down Opponent Strum
---@type number
defaultOpponentStrumY1 = 0
--- The inital Y position for the Up Opponent Strum
---@type number
defaultOpponentStrumY2 = 0
--- The inital Y position for the Right Opponent Strum
---@type number
defaultOpponentStrumY3 = 0
--- The current version of Psych Engine being used
---@type number
version = 0
---@type "windows" | "linux" | "mac" | "browser" | "android" | "unknown" The current build target.
buildTarget = "windows"
--- The filename for the working script
---@type string
scriptName = ''
--- The foldername for the current working directory
---@type string
currentModDirectory = ''
--- The name of the current stage
---@type string
curStage = ''
--[[ FUNCTIONS ]]--
---Sets the colors for the health bar
---@param left string | common_colors Stick to "0xFFFFFFFF" or "FFFFFF" format
---@param right? string | common_colors Stick to "0xFFFFFFFF" or "FFFFFF" format
function setHealthBarColors(left, right) end
---Sets the colors for the health bar
---@param left string | common_colors Stick to "0xFFFFFFFF" or "FFFFFF" format
---@param right? string | common_colors Stick to "0xFFFFFFFF" or "FFFFFF" format
function setTimeBarColors(left, right) end
---Adds `value` to the player's current score
---@param value number
function addScore(value) end
---Adds `value` to the player's current miss count
---@param value number
function addMisses(value) end
---Adds `value` to the player's current hit count
---@param value number
function addHits(value) end
---@return number score The player's score
function getScore() end
---@return number misses The player's total misses
function getMisses() end
---@return number hits The player's total notes hit
function getHits() end
---Sets the player's score to `value`
---@param value number
function setScore(value) end
---Sets the player's miss count to `value`
---@param value number
function setMisses(value) end
---Sets the player's hit count to `value`
---@param value number
function setHits(value) end
---Sets the player's rating to `value`. Value must be between 0 and 1
---@param value number
function setRatingPercent(value) end
---Sets the player's rating name to `value`
---@param value string
function setRatingName(value) end
---Sets the player's rating FC name to `value`
---@param value string
function setRatingFC(value) end
---Adds `value` to the player's current health
---@param value number
function addHealth(value) end
---@return number health The player's current health
function getHealth() end
---Sets the player's health to `value`
---@param value number
function setHealth(value) end
---@param charType charType
---@return number characterX The current character's X position
function getCharacterX(charType) end
---@param charType charType
---@return number characterX The current character's Y position
function getCharacterY(charType) end
--- Sets the given character's X position
---@param charType charType
---@param x number
function setCharacterX(charType, x) end
--- Sets the given character's Y position
---@param charType charType
---@param y number
function setCharacterY(charType, y) end
--- Plays the given character's `idle` or `dance` animation
---@param charType charType
function characterDance(charType) end
---Alias for `Conductor.songPosition`
---@return number songPos The current song time passed in ms
function getSongPosition() end
---If the countdown hasn't started already, will trigger the countdown event
function startCountdown() end
---Ends the song, saving the current score
function endSong() end
---Restarts the current song
---@param skipTrans? boolean skips the transition, defaults to false
function restartSong(skipTrans) end
---Exists the current song, without saving the current score
---@param skipTrans? boolean skips the transition, defaults to false
function exitSong(skipTrans) end
---Runs the given event without the need for charting it
---@param eventName string
---@param value1? string | number | boolean
---@param value2? string | number | boolean
function triggerEvent(eventName, value1, value2) end
---Returns a random integer between `min` and `max`. Will **not** return any numbers in the `exclude` array
---@param min number
---@param max number
---@param exclude? string Optional array of values to ignore. Numbers must be seperated by a comma: `"1, 2, 3, 4, 5, 6, 7"`
---@return number integer
function getRandomInt(min, max, exclude) end
---Returns a random integer float `min` and `max`. Will **not** return any numbers in the `exclude` array
---@param min number
---@param max number
---@param exclude? string Optional array of values to ignore. Numbers must be seperated by a comma: `"1, 2, 3, 4, 5, 6, 7"`
---@return number float
function getRandomFloat(min, max, exclude) end
---Returns `true` or `false` based on `chance`.
---@param chance number if `number >= 100`, it returns true always
---@return boolean
function getRandomBool(chance) end
---Starts a dialogue cutscene.
---@param dialogueFile string The cutscenes `JSON` file directory. Root starts in the song's `data/<song>/` folder
---@param music string Directory of the music file to use. Root starts from `music/`
function startDialogue(dialogueFile, music) end
---Starts a video cutscene
---@param videoFile string Directory of the video file to use. Root starts from `videos/`
function startVideo(videoFile) end
---Points the camera towards the given target
---@param target "dad" | "boyfriend"
function cameraSetTarget(target) end
---@alias cameras "game" | "hud" | "other" | "camGame" | "camHUD" | "camOther"
---Shakes the camera.
---@param camera cameras The `FlxCamera` to shake
---@param intensity number The intensity of the shake. Anything over 0.05 may be excessive
---@param duration number The duration of the shake
function cameraShake(camera, intensity, duration) end
---FLashes the camera with `color`
---@param camera cameras The `FlxCamera` to flash
---@param color string | common_colors The color to flash the camera with
---@param duration number The duration in seconds
---@param forced boolean Restarts the flash if the camera is already flashed
function cameraFlash(camera, color, duration, forced) end
---Fades the camera to `color`
---@param camera cameras The `FlxCamera` to fade
---@param color string | common_colors The color to fade the camera to
---@param duration number The duration in seconds
---@param forced boolean Restarts the fade if the camera is already fading
function cameraFade(camera, color, duration, forced) end
---Gets a global variable from another Lua file
---@param luaFile string The path to the lua file
---@param global string The variable to get
---@return any value
function getGlobalFromScript(luaFile, global) end
---Sets a global variable from another Lua file to `value`
---@param luaFile string The path to the lua file
---@param global string The variable to set
---@param value any What to set `global` to
function setGlobalFromScript(luaFile, global, value) end
---Gets a variable from source code using `Reflect`. Will cause a break at the current line if the variable can't be found
---@param property string Path to the variable. Local to `PlayState.instance`
---@return any value
function getProperty(property) end
---Sets a variable from source code using `Reflect`. Will cause a break at the current line if the variable can't be found
---@param property string Path to the variable. Local to `PlayState.instance`
---@param value any
function setProperty(property, value) end
---Gets a variable from source code using `Reflect`. Will cause a break at the current line if the variable can't be found
---@param classPath string Path to the class
---@param property string Path to the variable. Local to `classPath`
---@return any value
function getPropertyFromClass(classPath, property) end
---Gets a variable from source code using `Reflect`. Will cause a break at the current line if the variable can't be found
---@param classPath string Path to the class
---@param property string Path to the variable. Local to `classPath`
---@param value any
function setPropertyFromClass(classPath, property, value) end
---Gets a variable from source code using `Reflect`. Will cause a break at the current line if the variable can't be found
---@param group string Group name. Local to `PlayState.instance`
---@param index number Index of `group` to get from
---@param property string Path to the variable. Local to `group[index]`
---@return any value
function getPropertyFromGroup(group, index, property) end
---Gets a variable from source code using `Reflect`. Will cause a break at the current line if the variable can't be found
---@param group string Group name. Local to `PlayState.instance`
---@param index number Index of `group` to set from
---@param property string Path to the variable. Local to `group[index]`
---@param value any
function setPropertyFromGroup(group, index, property, value) end
---@param script string The Haxe code to run
---Runs the given Haxe code in `script` as long as all of it is valid. Any errors will cause the code to not run, `null` values and other runtime errors cause a break at the current line
---You can get variables/functions from other classes but natively limited to what is already imported. To add more libraries to your current `Expr` use `addHaxeLibrary`\
--- Already imported libraries:
---```haxe
--- flixel.FlxG;
--- flixel.FlxSprite;
--- flixel.camera.FlxCamera;
--- flixel.util.FlxTimer;
--- flixel.tweens.FlxTween;
--- PlayState; // as "PlayState" or "game"
--- Paths;
--- Conductor;
--- ClientPrefs;
--- Character;
--- Alphabet;
--- CustomSubstate;
--- flixel.addons.display.FlxRuntimeShader;
--- openfl.filters.ShaderFilter;
--- StringTools;
---```
---Types are non-strict and are not required for variable declaration
function runHaxeCode(script) end
---Adds support for calling a specific Library Package from any source implemented haxelibs or native Haxe libraries
---@param class string The class name, such as `FlxMath`
---@param package? string The path to the class name, such as `flixel.math`
function addHaxeLibrary(class, package) end
---Returns if the key `name` was just pressed on the current frame
---@param name keylist | lower_keylist
---@return boolean
function keyboardJustPressed(name) end
---Returns if the key `name` is pressed on the current frame
---@param name keylist | lower_keylist
---@return boolean
function keyboardPressed(name) end
---Returns if the key `name` was just released on the current frame
---@param name keylist | lower_keylist
---@return boolean
function keyboardReleased(name) end
---Returns if the key `name` was just pressed on the current frame
---@param name game_keyList
---@return boolean
function keyJustPressed(name) end
---Returns if the key `name` is pressed on the current frame
---@param name game_keyList
---@return boolean
function keyPressed(name) end
---Returns if the key `name` was just released on the current frame
---@param name game_keyList
---@return boolean
function keyReleased(name) end
---@alias mouse_button "left" | "middle" | "right"
---Returns if the mouse button `button` was just clicked on the current frame
---@param button mouse_button
---@return boolean
function mouseClicked(button) end
---Returns if the mouse button `button` is down on the current frame
---@param button mouse_button
---@return boolean
function mousePressed(button) end
---Returns if the mouse button `button` was just released on the current frame
---@param button mouse_button
---@return boolean
function mouseReleased(button) end
---Returns the current mouse X position relative to `camera`
---@param camera cameras
---@return number x
function getMouseX(camera) end
---Returns the current mouse Y position relative to `camera`
---@param camera cameras
---@return number y
function getMouseY(camera) end
---Precaches the given character for a `Change Character` event
---@param name string Name of the character
---@param type charType Which character to cache for
function addCharacterToList(name, type) end
---Precaches an image from `path`
---@param path string The path to the image to cache
function precacheImage(path) end
---Precaches a sound from `path`
---@param path string The path to the sound to cache
function precacheSound(path) end
---Precaches music from `path`
---@param path string The path to the music to cache
function precacheMusic(path) end
---Initializes the save data `name`, in the path `folder`. Directory root is the bin folder.
---@param name string The save data filename
---@param folder string directory to save to
function initSaveData(name, folder) end
---Returns a value from a save created with `initSaveData`
---@generic T
---@param name string Save data name
---@param field string The value to get from
---@param defaultValue `T` If it's `nil`, return this instead
---@return T
function getDataFromSave(name, field, defaultValue) end
---Sets a value to a save created with `initSaveData`
---@param name string Save data name
---@param field string The value to set
---@param value any What `field` is set to
function setDataFromSave(name, field, value) end
---Flushes the save `name`
---@param name string
function flushSaveData(name) end
---Creates a file at the path `path`. Directory root is the bin folder
---@param path string The path to save to
---@param content string The content to save
---@param absolute? boolean Start from root folder rather than `root/mods/`
function saveFile(path, content, absolute) end
---Deletes a file at path `path`. Directory root is the bin folder
---@param path string The path to save to
---@param absolute? boolean Start from root folder rather than `root/mods/`
function deleteFile(path, absolute) end
---Returns the contents of the file at `path`. Directory root is the bin folder
---@param path string The path to get from
---@param absolute? boolean Start from root folder rather than `root/mods/`
---@return string content
function getTextFromFile(path, absolute) end
---Returns if the file at `path` is found. Directory root is the bin folder
---@param path string The path to check
---@param absolute boolean Start from root folder rather than `root/mods/`
---@return boolean
function checkFileExists(path, absolute) end
---Returns the name and type of all the files in `path`. Directory root is the bin folder
---@param path string The path to check. Starts from `root/` **not** `root/mods/`
function directoryFileList(path) end
---Adds a lua script to the stack
---@param path string The lua file's directory
---@param showWarnings? boolean If the game should print warnings that the script is already running
function addLuaScript(path, showWarnings) end
---Removes a lua script from the stack
---@param path string The lua file's directory
---@param showWarnings? boolean If the game should print warnings that the script is already running
function removeLuaScript(path, showWarnings) end
---Returns a list of all the currently active scripts
---@return string[] scripts
function getRunningScripts() end
---Returns that the script `path` is in the stack
---@param path string The Lua file's directory
---@return boolean
function isRunning(path) end
---Prints the list of text given to `PlayState.camOther`
---@param ... string
function debugPrint(...) end
---Closes `this` script
function close() end
---Initializes the shader `name`
---@param name string The name of the shader frag file in `<currentModDir>/shaders/`
---@param glslVersion? number The GLSL version of the shader
function initLuaShader(name, glslVersion) end
---Applies a shader to a sprite
---@param tag string Sprite's object path
---@param shader string The shader to apply. **[Must be initialized with`initLuaShader`]**
function setSpriteShader(tag, shader) end
---Removes the shader from a sprite
---@param tag string Sprite's object path
function removeSpriteShader(tag) end
---Returns a `bool` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to return
---@return boolean
function getShaderBool(tag, property) end
---Returns a `bool[]` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to return
---@return boolean[]
function getShaderBoolArray(tag, property) end
---Returns a `int` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to return
---@return number
function getShaderInt(tag, property) end
---Returns a `int[]` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to return
---@return number[]
function getShaderIntArray(tag, property) end
---Returns a `float` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to return
---@return number
function getShaderFloat(tag, property) end
---Returns a `float[]` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to return
---@return number[]
function getShaderFloatArray(tag, property) end
---Set's a `bool` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to change
---@param value boolean What to set `property` to.
function setShaderBool(tag, property, value) end
---Set's a `bool[]` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to change
---@param value boolean[] What to set `property` to.
function setShaderBoolArray(tag, property, value) end
---Set's a `int` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to change
---@param value number What to set `property` to.
function setShaderInt(tag, property, value) end
---Set's a `int[]` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to change
---@param value number[] What to set `property` to.
function setShaderIntArray(tag, property, value) end
---Set's a `float` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to change
---@param value number What to set `property` to.
function setShaderFloat(tag, property, value) end
---Set's a `float[]` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to change
---@param value number[] What to set `property` to.
function setShaderFloatArray(tag, property, value) end
---Set's a `sampler2D` parameter of an object's shader
---@param tag string Sprite's object path
---@param property string The name of the parameter to change
---@param path string Path to the bitmapData used.
function setShaderSampler2D(tag, property, path) end
---Plays a sound file
---@param sound string "`<mods|assets>/sounds/<sound>`" Must be a .OGG file. Once the sound is completed, does a callback for `onSoundFinished()`
---@param volume? number Sound volume. From 0 to 1, where 1 is default
---@param tag? string Sound's string tag. Is optional but is required for all sound related functions
function playSound(sound, volume, tag) end
---Plays a music file
---@param music string "`<mods|assets>/music/<music>`" Must be a .OGG file. Once the sound is completed, does a callback for `onSoundFinished()`
---@param volume? number Sound volume. From 0 to 1, where 1 is default
---@param loop? boolean If the music should loop
function playMusic(music, volume, loop) end
---Pauses a sound
---@param tag string Sound tag name
function pauseSound(tag) end
---Resumes a sound
---@param tag string Sound tag name
function resumeSound(tag) end
---Stops a sound
---@param tag string Sound tag name
function stopSound(tag) end
---Fades a sound in
---@param tag string Sound tag name
---@param duration number Duration for the sound to fully fade in
---@param from? number Initial volume to fade from
---@param to? number Final volume to fade to
function soundFadeIn(tag, duration, from, to) end
---Fades a sound out
---@param tag string Sound tag name
---@param duration number Duration for the sound to fully fade out
---@param to? number Final volume to fade to
function soundFadeOut(tag, duration, to) end
---Cancels a current sound fade
---@param tag string Sound tag name
function soundFadeCancel(tag) end
---Returns the current volume of sound `tag`
---@param tag string Sound tag name
---@return number volume
function getSoundVolume(tag) end
---Returns the current timestamp of the sound `tag`
---@param tag string Sound tag name
---@return number timestamp_ms
function getSoundTime(tag) end
---Sets the volume of sound `tag` to `value`
---@param tag string Sound tag name
---@param value number Volume to set the sound to
function setSoundVolume(tag, value) end
---Sets the timestamp of sound `tag` to `value`
---@param tag string Sound tag name
---@param value number Timestamp to set the sound to in ms