-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathz_settings.lua
3099 lines (2728 loc) · 93.1 KB
/
z_settings.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
showSettings = false
blacklistAddRequest = false
-- inputs
INPUT_A = 0
INPUT_JOYSTICK = 1
local scrollOffset = 0
local joystickCooldown = 0
local bgWidth = 600
local bgHeight = djui_hud_get_screen_height() - 80
local selection = 1
local awaitingInput = nil
local scrollEntry = 12
local statGroupIndex = 0
local statIndex = 0
local sentStatPacket = false
local achievementIndex = 0
local achievementEntryIndex = 0
local sentAchievementPacket = false
local previousRgbValue = nil
local rgbValue = nil
local oldTheme = nil
local function on_off_text(bool)
if bool then return "On" else return "Off" end
end
local function is_entry_visible(entryIndex)
local entryHeight = 90
for i = 1, #entries do
entryHeight = entryHeight + 60
if entries[i].seperator ~= nil then
entryHeight = entryHeight + 30
end
if i == entryIndex then break end
end
if entryHeight - scrollOffset < 30 then return false end
if entryHeight - scrollOffset > 810 then return false end
return true
end
local function get_controller_dir()
-- get which direction we are facing
local m = gMarioStates[0]
local direction = CONT_LEFT
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.stickX > 0.5 then direction = CONT_RIGHT end
return direction
end
-- click functions
local function set_gamemode()
if (gMarioStates[0].controller.buttonPressed & R_JPAD ~= 0
or (gMarioStates[0].controller.stickX > 0.5 and joystickCooldown <= 0)) then
local prevGamemode = gGlobalSyncTable.gamemode
if gGlobalSyncTable.randomGamemode then
gGlobalSyncTable.gamemode = MIN_GAMEMODE
gGlobalSyncTable.randomGamemode = false
else
if gGlobalSyncTable.gamemode + 1 > MAX_GAMEMODE then
gGlobalSyncTable.randomGamemode = true
else
gGlobalSyncTable.gamemode = gGlobalSyncTable.gamemode + 1
end
end
if not gGlobalSyncTable.randomGamemode and gGlobalSyncTable.roundState == ROUND_ACTIVE and gGlobalSyncTable.gamemode ~= prevGamemode then
gGlobalSyncTable.roundState = ROUND_WAIT_PLAYERS
end
else
local prevGamemode = gGlobalSyncTable.gamemode
if gGlobalSyncTable.randomGamemode then
gGlobalSyncTable.gamemode = MAX_GAMEMODE
gGlobalSyncTable.randomGamemode = false
else
if gGlobalSyncTable.gamemode - 1 < MIN_GAMEMODE then
gGlobalSyncTable.randomGamemode = true
else
gGlobalSyncTable.gamemode = gGlobalSyncTable.gamemode - 1
end
end
if not gGlobalSyncTable.randomGamemode and gGlobalSyncTable.roundState == ROUND_ACTIVE and gGlobalSyncTable.gamemode ~= prevGamemode then
gGlobalSyncTable.roundState = ROUND_WAIT_PLAYERS
end
end
end
local function set_modifier()
if (gMarioStates[0].controller.buttonPressed & R_JPAD ~= 0
or (gMarioStates[0].controller.stickX > 0.5 and joystickCooldown <= 0)) then
local prevModifier = gGlobalSyncTable.modifier
if gGlobalSyncTable.randomModifiers then
gGlobalSyncTable.modifier = MODIFIER_MIN
gGlobalSyncTable.randomModifiers = false
else
if gGlobalSyncTable.modifier + 1 > MODIFIER_MAX then
gGlobalSyncTable.randomModifiers = true
if gGlobalSyncTable.roundState ~= ROUND_ACTIVE then
gGlobalSyncTable.modifier = MODIFIER_NONE
end
else
gGlobalSyncTable.modifier = gGlobalSyncTable.modifier + 1
end
end
if not gGlobalSyncTable.randomModifiers and gGlobalSyncTable.roundState == ROUND_ACTIVE and gGlobalSyncTable.modifier ~= prevModifier then
gGlobalSyncTable.roundState = ROUND_WAIT_PLAYERS
end
else
local prevModifier = gGlobalSyncTable.modifier
if gGlobalSyncTable.randomModifiers then
gGlobalSyncTable.modifier = MODIFIER_MAX
gGlobalSyncTable.randomModifiers = false
else
if gGlobalSyncTable.modifier - 1 < MODIFIER_MIN then
gGlobalSyncTable.randomModifiers = true
else
gGlobalSyncTable.modifier = gGlobalSyncTable.modifier - 1
end
end
if not gGlobalSyncTable.randomModifiers and gGlobalSyncTable.roundState == ROUND_ACTIVE and gGlobalSyncTable.gamemode ~= prevModifier then
gGlobalSyncTable.roundState = ROUND_WAIT_PLAYERS
end
end
end
local function toggle_bljs()
gGlobalSyncTable.bljs = not gGlobalSyncTable.bljs
save_bool("bljs", gGlobalSyncTable.bljs)
end
local function toggle_cannons()
gGlobalSyncTable.cannons = not gGlobalSyncTable.cannons
save_bool("cannons", gGlobalSyncTable.cannons)
end
local function toggle_water()
gGlobalSyncTable.water = not gGlobalSyncTable.water
save_bool("water", gGlobalSyncTable.water)
end
local function toggle_eliminate_on_death()
if gGlobalSyncTable.lateJoining then
gGlobalSyncTable.eliminateOnDeath = false
else
gGlobalSyncTable.eliminateOnDeath = not gGlobalSyncTable.eliminateOnDeath
end
save_bool("eliminateOnDeath", gGlobalSyncTable.eliminateOnDeath)
end
local function toggle_late_joining()
gGlobalSyncTable.lateJoining = not gGlobalSyncTable.lateJoining
save_bool("lateJoining", gGlobalSyncTable.lateJoining)
if gGlobalSyncTable.lateJoining then
toggle_eliminate_on_death()
end
end
local function toggle_voting()
gGlobalSyncTable.doVoting = not gGlobalSyncTable.doVoting
save_bool("voting", gGlobalSyncTable.voting)
end
local function toggle_auto_mode()
gGlobalSyncTable.autoMode = not gGlobalSyncTable.autoMode
save_bool("autoMode", gGlobalSyncTable.autoMode)
end
local function toggle_boost()
gGlobalSyncTable.boosts = not gGlobalSyncTable.boosts
save_bool("boost", gGlobalSyncTable.boosts)
end
local function toggle_friendly_fire()
gGlobalSyncTable.friendlyFire = not gGlobalSyncTable.friendlyFire
save_bool("friendlyFire", gGlobalSyncTable.friendlyFire)
end
local function set_boost_cooldown()
-- get which direction we are facing
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 30
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 10 * 30
end
if direction == CONT_LEFT then
gGlobalSyncTable.boostCooldown = gGlobalSyncTable.boostCooldown - speed
if gGlobalSyncTable.boostCooldown <= 0 then
gGlobalSyncTable.boostCooldown = 0
end
else
gGlobalSyncTable.boostCooldown = gGlobalSyncTable.boostCooldown + speed
end
end
local function set_bomb_cooldown()
-- get which direction we are facing
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 0.1 * 30
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 1 * 30
end
if direction == CONT_LEFT then
gGlobalSyncTable.maxBombCooldown = gGlobalSyncTable.maxBombCooldown - speed
if gGlobalSyncTable.maxBombCooldown <= 0 then
gGlobalSyncTable.maxBombCooldown = 0
end
else
gGlobalSyncTable.maxBombCooldown = gGlobalSyncTable.maxBombCooldown + speed
end
save_int("maxBombCooldown", gGlobalSyncTable.maxBombCooldown)
end
local function set_blaster_cooldown()
-- get which direction we are facing
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 0.1 * 30
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 1 * 30
end
if direction == CONT_LEFT then
gGlobalSyncTable.maxBlasterCooldown = gGlobalSyncTable.maxBlasterCooldown - speed
if gGlobalSyncTable.maxBlasterCooldown <= 0 then
gGlobalSyncTable.maxBlasterCooldown = 0
end
else
gGlobalSyncTable.maxBlasterCooldown = gGlobalSyncTable.maxBlasterCooldown + speed
end
save_int("maxBlasterCooldown", gGlobalSyncTable.maxBlasterCooldown)
end
local function toggle_hazards()
gGlobalSyncTable.hazardSurfaces = not gGlobalSyncTable.hazardSurfaces
save_bool("hazardSurfaces", gGlobalSyncTable.hazardSurfaces)
end
local function toggle_pipes()
gGlobalSyncTable.pipes = not gGlobalSyncTable.pipes
save_bool("pipes", gGlobalSyncTable.pipes)
end
local function toggle_romhack_cam()
useRomhackCam = not useRomhackCam
save_bool("useRomhackCam", useRomhackCam)
end
local function toggle_auto_hide_hud()
autoHideHud = not autoHideHud
save_bool("autoHideHud", autoHideHud)
end
local function toggle_auto_hide_hud_always_show_timer()
autoHideHudAlwaysShowTimer = not autoHideHudAlwaysShowTimer
save_bool("autoHideHudAlwaysShowTimer", autoHideHudAlwaysShowTimer)
end
local function toggle_show_titles()
showTitles = not showTitles
save_bool("showTitles", showTitles)
end
local function reset_general_settings()
if network_is_server()
or network_is_moderator() then
gGlobalSyncTable.bljs = false
save_bool("bljs", false)
gGlobalSyncTable.cannons = false
save_bool("cannons", false)
gGlobalSyncTable.water = false
save_bool("water", false)
gGlobalSyncTable.eliminateOnDeath = true
save_bool("eliminateOnDeath", true)
gGlobalSyncTable.voting = true
save_bool("voting", true)
gGlobalSyncTable.autoMode = true
save_bool("autoMode", true)
gGlobalSyncTable.boosts = true
save_bool("boosts", true)
gGlobalSyncTable.friendlyFire = false
save_bool("friendlyFire", false)
end
useRomhackCam = true
save_bool("useRomhackCam", true)
autoHideHud = true
save_bool("autoHideHud", true)
autoHideHudAlwaysShowTimer = true
save_bool("autoHideHudAlwaysShowTimer", true)
end
local function set_active_timer(g, v)
v = clampf(v, 30 * 30, v)
gGlobalSyncTable.activeTimers[g] = v
save_int("activeTimers_" .. g, v)
end
local function get_active_timer(g)
return gGlobalSyncTable.activeTimers[g]
end
local function set_time_limit(gamemode)
-- get which direction we are facing
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 1
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 10
end
-- I need to make this way cleaner (if your reading this then chances are i've released the mod
-- and past me is not proud of myself, but hey SCREW PAST ME THAT GUY SUCKS HAHAHAH)
-- seriously though don't take this as an example for your mods, please, please make
-- it organized and compressed, and don't underlook functions, they are HUGE
-- New developments: Future me here. What the heck is the abomination of junky code
-- What the hell was past me thinking, holy crap, this code SUCKS
-- I aint redoing it, cuz it works, but this is the most crappy piece of junk
-- i've seen all day
-- Future me, it's March 10th, tag v2.2 is released, and i'm getting ready
-- to release 2.21. What the hell is this. This could've been optimized heavily.
-- I don't think the ranting I did above is justified, its not thaat bad.
-- If it ain't broke, don't fix it
-- Future me again, it's March 12th. Tag v2.21 is released, and I have a new gamemode im implementing as of 8 p.m CT.
-- I despise having to touch this code, above me should have fixed it.
-- I'm not gonna fix it, too lazy for that, but this is just stupid that
-- I've looked at this code 3 TIMES and haven't touched it ONCE... oh well...
-- Hello. The date is April 19, 2024. I just got done shredding mayo in a 1v1.
-- I've finally come around to fixing this abomination. It's now split into 2 functions.
-- This is a incredible day, a day I accomplished something with this mod.
-- This day is to be remembered as the day EmeraldLockdown did a thing!
-- set variable based off of dir and speed
if direction == CONT_LEFT then
set_active_timer(gamemode, get_active_timer(gamemode) - 30 * speed)
else
set_active_timer(gamemode, get_active_timer(gamemode) + 30 * speed)
end
end
local function set_lives(gamemode)
-- get which direction we are facing
local direction = get_controller_dir()
if direction == CONT_LEFT then
gGlobalSyncTable.maxLives[gamemode] = gGlobalSyncTable.maxLives[gamemode] - 1
elseif direction == CONT_RIGHT then
gGlobalSyncTable.maxLives[gamemode] = gGlobalSyncTable.maxLives[gamemode] + 1
end
gGlobalSyncTable.maxLives[gamemode] = clamp(gGlobalSyncTable.maxLives[gamemode], 1, 20)
save_int("maxLives_" .. gamemode, gGlobalSyncTable.maxLives[gamemode])
end
local function set_hide_time(g)
-- get which direction we are facing
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 1
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 10
end
if direction == CONT_LEFT then
gGlobalSyncTable.hidingTimer[g] = gGlobalSyncTable.hidingTimer[g] - (30 * speed)
if gGlobalSyncTable.hidingTimer[g] <= 15 * 30 then
gGlobalSyncTable.hidingTimer[g] = 15 * 30
end
else
gGlobalSyncTable.hidingTimer[g] = gGlobalSyncTable.hidingTimer[g] + (30 * speed)
end
save_int("hidingTimer_" .. g, gGlobalSyncTable.hidingTimer[g])
end
local function set_frozen_health_drain()
-- get which direction we are facing
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 1
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 10
end
if direction == CONT_LEFT then
gGlobalSyncTable.freezeHealthDrain = gGlobalSyncTable.freezeHealthDrain - speed
if gGlobalSyncTable.freezeHealthDrain <= 0 then
gGlobalSyncTable.freezeHealthDrain = 0
end
else
gGlobalSyncTable.freezeHealthDrain = gGlobalSyncTable.freezeHealthDrain + speed
end
save_int("freezeHealthDrain", gGlobalSyncTable.freezeHealthDrain)
end
local function set_theme()
local direction = get_controller_dir()
if direction == CONT_LEFT then
selectedTheme = selectedTheme - 1
if tagThemes[selectedTheme] == nil then
selectedTheme = #tagThemes
end
else
selectedTheme = selectedTheme + 1
if tagThemes[selectedTheme] == nil then
selectedTheme = 1
end
end
save_int("theme", selectedTheme)
end
local function set_color_value(c)
local m = gMarioStates[0]
local direction = get_controller_dir()
local speed = 1
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 10
end
if direction == CONT_LEFT then
c = c - speed
if c < 0 then c = 255 end
else
c = c + speed
if c > 255 then c = 0 end
end
return c
end
local function create_rgb_slider(rgb)
entries = rgbSliderEntries
selection = 1
rgbValue = rgb
previousRgbValue = table.copy(rgbValue)
end
local function stop_round()
gGlobalSyncTable.roundState = ROUND_WAIT_PLAYERS
for i = 0, MAX_PLAYERS - 1 do
if gNetworkPlayers[i].connected then
gPlayerSyncTable[i].state = RUNNER
end
end
end
local function stop_round_disabled()
if gGlobalSyncTable.autoMode then return true end
return false
end
local function set_player_role(i)
-- get which direction we are facing
local direction = get_controller_dir()
if direction == CONT_LEFT then
gPlayerSyncTable[i].state = gPlayerSyncTable[i].state - 1
if gPlayerSyncTable[i].state < 0 then gPlayerSyncTable[i].state = 3 end
if gPlayerSyncTable[i].state == 2 then gPlayerSyncTable[i].state = 1 end
else
gPlayerSyncTable[i].state = gPlayerSyncTable[i].state + 1
if gPlayerSyncTable[i].state > 3 then gPlayerSyncTable[i].state = 0 end
if gPlayerSyncTable[i].state == 2 then gPlayerSyncTable[i].state = 3 end
end
if gPlayerSyncTable[i].state == RUNNER then
gPlayerSyncTable[i].tagLives = gGlobalSyncTable.tagMaxLives
end
end
local function set_tournament_system()
local direction = get_controller_dir()
if direction == CONT_LEFT then
gGlobalSyncTable.tournamentPointSystem = gGlobalSyncTable.tournamentPointSystem - 1
if gGlobalSyncTable.tournamentPointSystem < TOURNAMENT_SYSTEM_MIN then
gGlobalSyncTable.tournamentPointSystem = TOURNAMENT_SYSTEM_MAX
end
else
gGlobalSyncTable.tournamentPointSystem = gGlobalSyncTable.tournamentPointSystem + 1
if gGlobalSyncTable.tournamentPointSystem > TOURNAMENT_SYSTEM_MAX then
gGlobalSyncTable.tournamentPointSystem = TOURNAMENT_SYSTEM_MIN
end
end
save_int("tournamentPointSystem", gGlobalSyncTable.tournamentPointSystem)
end
local function set_tournament_points_req()
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 1
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 10
end
if direction == CONT_LEFT then
gGlobalSyncTable.tournamentPointsReq = gGlobalSyncTable.tournamentPointsReq - speed
else
gGlobalSyncTable.tournamentPointsReq = gGlobalSyncTable.tournamentPointsReq + speed
end
gGlobalSyncTable.tournamentPointsReq = clamp(gGlobalSyncTable.tournamentPointsReq, 10, 200)
save_int("tournamentPointsReq", gGlobalSyncTable.tournamentPointsReq)
end
local function set_tournament_round_limit()
local m = gMarioStates[0]
local direction = get_controller_dir()
-- get speed
local speed = 1
if m.controller.buttonPressed & R_JPAD ~= 0
or m.controller.buttonPressed & L_JPAD ~= 0 then
speed = 10
end
if direction == CONT_LEFT then
gGlobalSyncTable.tournamentRoundLimit = gGlobalSyncTable.tournamentRoundLimit - speed
else
gGlobalSyncTable.tournamentRoundLimit = gGlobalSyncTable.tournamentRoundLimit + speed
end
gGlobalSyncTable.tournamentRoundLimit = clamp(gGlobalSyncTable.tournamentRoundLimit, 3, 20)
save_int("tournamentRoundLimit", gGlobalSyncTable.tournamentRoundLimit)
end
local function get_rules(gamemode)
if gamemode ~= nil then
local text = get_rules_for_gamemode(gamemode)
entries = {
{
text = text
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = gamemodeHelpEntries
selection = 1
end
}
}
else
local text = get_general_rules()
entries = {
{
text = text
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = helpEntries
selection = 1
end
}
}
end
selection = 1
end
local function get_modifier_rules(modifier)
if modifier ~= nil then
local text = get_rules_for_modifier(modifier)
entries = {
{
text = text
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = modifierHelpEntries
selection = 1
end
}
}
selection = 1
end
end
local function wait_for_button(bindIndex)
if binds[bindIndex] == nil then return end
awaitingInput = bindIndex
end
-- main selections
mainEntries = {}
-- setting selections
settingEntries = {}
-- general selections
generalEntries = {}
-- gamemode entries
gamemodeEntries = {}
-- modifier entries
modifierEntries = {}
-- start round selections
startEntries = {}
-- players
playerEntries = {}
-- blacklisted level entries
blacklistLevelEntries = {}
-- blacklisted gamemode entries
blacklistGamemodeEntries = {}
-- blacklisted modifier entries
blacklistModifierEntries = {}
-- blacklisted entries
-- generate it here as it is never changed
blacklistEntries = {
{
name = "Levels",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = blacklistLevelEntries
selection = 1
end,
},
{
name = "Gamemodes",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = blacklistGamemodeEntries
selection = 1
end,
},
{
name = "Modifiers",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = blacklistModifierEntries
selection = 1
end,
},
{
name = "Enemies",
permission = PERMISSION_SERVER,
input = INPUT_A,
func = function ()
entries = enemyEntries
selection = 1
end,
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = settingEntries
selection = 1
end,
},
}
-- binds
bindsEntries = {}
-- romhack entries
romhackEntries = {}
-- tournament entries
tournamentEntries = {}
-- help entries
-- generate it here as it is never changed
gamemodeHelpEntries = {}
for i = MIN_GAMEMODE, MAX_GAMEMODE do
table.insert(gamemodeHelpEntries, {
name = get_gamemode(i),
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
get_rules(i)
end
})
end
table.insert(gamemodeHelpEntries, {
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = helpEntries
selection = 1
end
})
modifierHelpEntries = {}
for i = MODIFIER_MIN + 1, MODIFIER_MAX do
table.insert(modifierHelpEntries, {
name = get_modifier_text(i),
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
get_modifier_rules(i)
end
})
end
table.insert(modifierHelpEntries, {
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = helpEntries
selection = 1
end
})
helpEntries = {
{
name = "General",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
get_rules(nil)
end,
},
{
name = "Gamemodes",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = gamemodeHelpEntries
selection = 1
end,
},
{
name = "Modifiers",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = modifierHelpEntries
selection = 1
end,
},
{
name = "Spectating",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = {
{
text = get_spectator_help()
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = helpEntries
selection = 1
end
}
}
selection = 1
end
},
{
name = "Tournaments",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = {
{
text = get_tournament_help()
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = helpEntries
selection = 1
end
}
}
selection = 1
end
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = mainEntries
selection = 1
end,
}
}
-- stat entries
statPlayerSelectionEntries = {}
statGroupEntries = {}
statEntries = {}
-- achievement entries
achievementEntry = {}
achievementEntries = {}
achievementsPlayerEntries = {}
-- rewards entry
titleRewardEntries = {}
trailRewardEntries = {}
rewardEntries = {
{
name = "Titles",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = titleRewardEntries
selection = 1
end,
},
{
name = "Trails",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = trailRewardEntries
selection = 1
end,
},
{
name = "Back",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = mainEntries
selection = 1
end,
}
}
enemyEntries = {}
themeEntries = {}
themeBuilderEntries = {}
themeManagerEntries = {}
rgbSliderEntries = {}
creditEntries = {}
entries = mainEntries
local function background()
local theme = get_selected_theme()
local x = (djui_hud_get_screen_width() / 2) - (bgWidth / 2)
local y = djui_hud_get_screen_height() - bgHeight
djui_hud_set_color(theme.background.r, theme.background.g, theme.background.b, 250)
djui_hud_render_rect_rounded_outlined(x, y / 2, bgWidth, bgHeight, theme.backgroundOutline.r, theme.backgroundOutline.g, theme.backgroundOutline.b, 10, 250)
end
local function settings_text()
local theme = get_selected_theme()
local text = "Options"
local x = (djui_hud_get_screen_width() / 2) - (bgWidth / 2)
local y = (djui_hud_get_screen_height() - bgHeight) / 2
if y - scrollOffset < -20 then return end
djui_hud_set_color(theme.text.r, theme.text.g, theme.text.b, 255)
djui_hud_print_text(text, x + ((bgWidth / 2) - djui_hud_measure_text(text)), y + 50 - scrollOffset, 2)
text = versions[1]
djui_hud_set_color(theme.text.r, theme.text.g, theme.text.b, 255)
djui_hud_print_text(text, x + (bgWidth / 2) - (djui_hud_measure_text(text) / 2), y + 105 - scrollOffset, 1)
end
local function reset_main_selections()
local resetEntries = entries == mainEntries
mainEntries = {
-- start selection
{name = "Start",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = startEntries
selection = 1
end,
valueText = ">",},
-- setting selection
{name = "Settings",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = settingEntries
selection = 1
end,
valueText = ">",},
-- stats selection
{name = "Stats",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = statPlayerSelectionEntries
selection = 1
end,
valueText = ">",},
-- achievements selection
{name = "Achievements",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = achievementsPlayerEntries
selection = 1
end,
valueText = ">",},
{name = "Rewards",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = rewardEntries
selection = 1
end,
valueText = ">",},
-- help selection
{name = "Help",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = helpEntries
selection = 1
end},
-- changelog selection
{name = "Changelog",
permission = PERMISSION_NONE,
input = INPUT_A,
func = function ()
entries = {}
for k, v in ipairs(versions) do