-
Notifications
You must be signed in to change notification settings - Fork 4
/
gameplay_mod_definitions.cpp
1297 lines (1111 loc) · 48.1 KB
/
gameplay_mod_definitions.cpp
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
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "player.h"
#include "custom_gamemode_config.h"
#include "weapons.h"
#include <algorithm>
#include <iterator>
#include "gamerules.h"
#include "../fmt/printf.h"
#ifdef CLIENT_DLL
extern CustomGameModeConfig clientConfig;
#endif
using namespace gameplayMods;
int g_autoSaved = 0;
static std::vector<const char *> weaponsWithBullets = {
"weapon_9mmhandgun",
"weapon_9mmhandgun_twin",
"weapon_357",
"weapon_shotgun",
"weapon_9mmAR",
"weapon_ingram",
"weapon_ingram_dual",
"weapon_m249"
};
GameplayMod &::accuracy = GameplayMod::Define( "accuracy", "Accuracy" )
.Description( "Some of your weapons become less or more accurate" )
.Arguments( {
Argument( "accuracy" ).MinMax( 0.01, 10 ).Default( "1" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Spread is multiplied by: %.1f", value );
} ),
} )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::accuracyLow.isActive() ) {
return "1.66";
} else if ( ::accuracyHigh.isActive() ) {
return "0.33";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::accuracyLow = GameplayMod::Define( "low_accuracy", "Low accuracy" )
.Description( "Some of your weapons become inaccurate" )
.CanOnlyBeActivatedRandomlyWhen( []() -> bool {
bool hasBulletBasedWeapon = false;
if ( auto player = GetPlayer() ) {
for ( auto weapon : weaponsWithBullets ) {
if ( player->HasNamedPlayerItem( weapon, true ) ) {
hasBulletBasedWeapon = true;
break;
}
}
}
return hasBulletBasedWeapon && !::accuracyHigh.isActive();
} );
GameplayMod &::accuracyHigh = GameplayMod::Define( "high_accuracy", "Super accuracy" )
.Description( "Some of your weapons become super accurate" )
.CanOnlyBeActivatedRandomlyWhen( []() -> bool {
bool hasBulletBasedWeapon = false;
if ( auto player = GetPlayer() ) {
for ( auto weapon : weaponsWithBullets ) {
if ( player->HasNamedPlayerItem( weapon, true ) ) {
hasBulletBasedWeapon = true;
break;
}
}
}
return hasBulletBasedWeapon && !::accuracyLow.isActive();
} );
GameplayMod &::autoSavesOnly = GameplayMod::Define( "autosaves_only", "Autosaves only" )
.Description( "Only autosaves are allowed" )
.CannotBeActivatedRandomly();
GameplayMod &::blackMesaMinute = GameplayMod::Define( "black_mesa_minute", "Black Mesa Minute" )
.Description( "Time-based game mode - rush against a minute and kill enemies to get more time" )
.CannotBeActivatedRandomly();;
GameplayMod &::bleeding = GameplayMod::Define( "bleeding", "Bleeding" )
.Description( "You're gradually losing health until certain limit" )
.Arguments( {
Argument( "bleeding_handicap" ).IsOptional().MinMax( 0, 99 ).RandomMinMax( 10, 50 ).Default( "20" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Bleeding until %.0f health left", value );
} ),
Argument( "bleeding_update_period" ).IsOptional().MinMax( 0.01 ).RandomMinMax( 0.1, 0.2 ).Default( "1" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Bleed update period: %.2f sec", value );
} ),
Argument( "bleeding_immunity_period" ).IsOptional().MinMax( 0.05 ).RandomMinMax( 3, 10 ).Default( "10" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Bleed again after healing in: %.1f sec", value );
} )
} )
.IsExcludedFromChaosEdition();
GameplayMod &::bulletPhysics = GameplayMod::Define( "bullet_physics", "Bullet physics mode" )
.Arguments( {
Argument( "bullet_physics_mode" ).IsOptional().Default( "for_enemies_on_slowmotion" ).Description( []( const std::string string, float value ) {
if ( string == "disabled" ) {
return "Bullet physics is disabled";
} else if ( string == "for_enemies_and_player_on_slowmotion" ) {
return "Bullet physics will be active for both enemies and player only when slowmotion is present";
} else if ( string == "constant" ) {
return "Bullet physics is always present, even when slowmotion is NOT present";
} else {
return "Bullet physics will be active only for enemies when slowmotion is present";
}
} ),
} )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::randomGameplayMods.isActive() && ::superHot.isActive() ) {
return "constant";
}
auto bulletPhysicsFromConfig = ::bulletPhysics.GetArgumentsFromCustomGameplayModeConfig();
if ( ::bulletDelayOnSlowmotion.isActive() ) {
if ( bulletPhysicsFromConfig.has_value() && bulletPhysicsFromConfig->at( 0 ).string == "for_enemies_and_player_on_slowmotion" ) {
return "for_enemies_and_player_on_slowmotion";
}
return "constant";
}
if ( ::bulletRicochet.isActive() && !bulletPhysicsFromConfig.has_value() ) {
return "constant";
}
return std::nullopt;
} )
.ForceDefaultArguments( "for_enemies_on_slowmotion" )
.CannotBeActivatedRandomly();
GameplayMod &::bulletDelayOnSlowmotion = GameplayMod::Define( "bullet_delay_on_slowmotion", "Bullet delay on slowmotion" )
.Description( "Your bullets almost stay still during slowmotion, and go at once when you disable it" )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::slowmotionForbidden.isActive();
} );
GameplayMod &::bulletRicochet = GameplayMod::Define( "bullet_ricochet", "Bullet ricochet" )
.Description( "Physical bullets ricochet off the walls" )
.Arguments( {
Argument( "bullet_ricochet_count" ).MinMax( 0 ).RandomMinMax( 2, 20 ).Default( "2" ).Description( []( const std::string string, float value ) {
return value <= 0 ? "Max ricochets: Infinite" : fmt::sprintf( "Max ricochets: %.0f", value );
} ),
Argument( "bullet_ricochet_max_degree" ).MinMax( 1, 90 ).RandomMinMax( 30, 90 ).Default( "45" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Max angle for ricochet: %.0f deg", value );
} ),
} );
GameplayMod &::bulletSelfHarm = GameplayMod::Define( "bullet_self_harm", "Bullet self harm" )
.Description( "Physical bullets shot by player can harm back" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::randomGameplayMods.isActive() && ( ::bulletRicochet.isActive() || ::bulletDelayOnSlowmotion.isActive() ) ) {
return "";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::bulletTrail = GameplayMod::Define( "bullet_trail_constant", "Bullet trail constant" )
.Description( "Physical bullets always get a trail, regardless if slowmotion is present" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( auto player = GetPlayer() ) {
if ( gameplayMods::IsSlowmotionEnabled() ) {
return "";
}
}
if ( ::randomGameplayMods.isActive() && ( ::bulletRicochet.isActive() || ::superHot.isActive() ) ) {
return "";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::chaosEdition = GameplayMod::Define( "chaos_edition", "Chaos edition" )
.Description( "Rapidly changing mods" )
.OnInit([] {
gameplayMods::previouslyProposedRandomModsCopy = gameplayMods::previouslyProposedRandomMods;
auto randomGameplayMods = gameplayMods::randomGameplayMods.isActive<RandomGameplayModsInfo>();
gameplayModsData.timeLeftUntilNextRandomGameplayMod = randomGameplayMods->timeUntilNextRandomGameplayMod;
})
.OnTimeExpired([] {
if ( auto randomGameplayMods = gameplayMods::randomGameplayMods.isActive<RandomGameplayModsInfo>() ) {
gameplayModsData.timeLeftUntilNextRandomGameplayMod = randomGameplayMods->timeUntilNextRandomGameplayMod + 1.0f;
proposedGameplayMods.clear();
}
previouslyProposedRandomMods = previouslyProposedRandomModsCopy;
previouslyProposedRandomMods.insert( &gameplayMods::chaosEdition );
});
GameplayMod &::cncSounds = GameplayMod::Define( "cnc_sounds", "Command & Conquer death sounds" )
.Description( "Tribute to one of the best death sounds" )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::deusExSounds.isActive();
} );
GameplayMod &::crossbowExplosiveBolts = GameplayMod::Define( "crossbow_explosive_bolts", "Crossbow explosive bolts" )
.Description( "Crossbow bolts explode when they hit the wall" )
.CanOnlyBeActivatedRandomlyWhen( []() -> bool {
if ( auto player = GetPlayer() ) {
return player->HasNamedPlayerWeaponWithAmmo( "weapon_crossbow", true );
}
return false;
} );
GameplayMod &::damageMultiplier = GameplayMod::Define( "damage_multiplier", "Damage multiplier" )
.Description( "Multiplies damage dealt from enemies to you" )
.RandomGameplayModName( "Double damage" )
.RandomGameplayModDescription( "It's double painful now" )
.Arguments( {
Argument( "multipler" ).MinMax( 0.01, 100 ).RandomMinMax( 2.0, 2.0 ).Default( "2" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Multiplier: %.1f", value );
} )
} )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::oneHitKO.isActive();
} );
GameplayMod &::damageMultiplierFromPlayer = GameplayMod::Define( "damage_multiplier_from_player", "Damage multiplier from player" )
.Description( "Multiplies damage dealt by you" )
.RandomGameplayModName( "Double damage from player" )
.RandomGameplayModDescription( "You deal double damage to enemies" )
.Arguments( {
Argument( "multipler" ).MinMax( 0.01, 100 ).RandomMinMax( 2.0, 2.0 ).Default( "2" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Multiplier: %.1f", value );
} )
} )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::oneHitKO.isActive();
} );
GameplayMod &::deusExSounds = GameplayMod::Define( "deus_ex_sounds", "Deus EX death sounds" )
.Description( "Self explanatory" )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::cncSounds.isActive();
} );
GameplayMod &::difficultyEasy = GameplayMod::Define( "easy", "Easy difficulty" )
.Description( "Sets up easy level of difficulty" )
.CannotBeActivatedRandomly();
GameplayMod &::difficultyHard = GameplayMod::Define( "hard", "Hard difficulty" )
.Description( "Sets up hard level of difficulty" )
.CannotBeActivatedRandomly();
GameplayMod &::divingAllowedWithoutSlowmotion = GameplayMod::Define( "diving_allowed_without_slowmotion", "Diving allowed without slowmotion" )
.Description(
"You're still allowed to dive even if you have no slowmotion charge\n"
"In that case you will dive without going into slowmotion"
)
.CannotBeActivatedRandomly();
GameplayMod &::divingOnly = GameplayMod::Define( "diving_only", "Diving only" )
.Description(
"The only way to move around is by diving\n"
"This enables Infinite slowmotion by default\n"
"You can dive even when in crouch-like position, like when being in vents etc"
)
.CannotBeActivatedRandomly();
GameplayMod &::drunkAim = GameplayMod::Define( "drunk_aim", "Drunk aim" )
.Description( "Your aim becomes wobbly" )
.Arguments( {
Argument( "max_horizontal_wobble" ).IsOptional().MinMax( 0, 25.5 ).RandomMinMax( 2, 25.5 ).Default( "20" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Max horizontal wobble: %.2f deg", value );
} ),
Argument( "max_vertical_wobble" ).IsOptional().MinMax( 0, 25.5 ).RandomMinMax( 2, 25.5 ).Default( "5" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Max vertical wobble: %.2f deg", value );
} ),
Argument( "wobble_frequency" ).IsOptional().MinMax( 0.01 ).RandomMinMax( 0.05, 6 ).Default( "1" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Wobble frequency: %.2f", value );
} ),
} );
GameplayMod &::drunkFOV = GameplayMod::Define( "drunk_fov", "Drunk FOV" )
.Description( "Your field of view becomes wobbly" )
.Arguments( {
Argument( "fov_offset_amplitude" ).IsOptional().MinMax( 0.01, 100 ).RandomMinMax( 0, 30 ).Default( "10" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "FOV offset amplitude: %.1f deg", value );
} ),
Argument( "fov_offset_frequency" ).IsOptional().MinMax( 0.01 ).RandomMinMax( 0.1, 5 ).Default( "1" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "FOV offset frequency: %.2f", value );
} ),
} )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( GetMapName() == "nightmare" ) {
return "5 1";
}
return std::nullopt;
} );
GameplayMod &::drunkLook = GameplayMod::Define( "drunk_look", "Drunk look" )
.Description( "Camera is wobbly and makes aim harder" )
.Arguments( {
Argument( "drunkiness" ).IsOptional().MinMax( 0.1, 1000 ).RandomMinMax( 25, 100 ).Default( "25" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Drunkiness: %.0f percent", value );
} ),
} )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( GetMapName() == "nightmare" ) {
return "10";
}
return std::nullopt;
} );
GameplayMod &::explosionJumping = GameplayMod::Define( "explosion_jumping", "Explosion jumping" )
.Description( "Jupming off your own rockets and grenades is harmless" )
.CanOnlyBeActivatedRandomlyWhen( []() {
if ( auto player = GetPlayer() ) {
if (
player->HasNamedPlayerWeaponWithAmmo( "weapon_handgrenade", true ) ||
player->HasNamedPlayerWeaponWithAmmo( "weapon_satchel", true ) ||
player->HasNamedPlayerWeaponWithAmmo( "weapon_tripmine", true ) ||
player->HasNamedPlayerWeaponWithAmmo( "weapon_rpg", true )
) {
return true;
}
if ( auto mp5Item = player->GetPlayerItem( "weapon_9mmAR" ) ) {
if ( auto mp5 = dynamic_cast<CBasePlayerWeapon *>( mp5Item ) ) {
if ( mp5->HasSecondaryAmmo() ) {
return true;
}
}
}
}
return false;
} );
GameplayMod &::fadingOut = GameplayMod::Define( "fading_out", "Fading out" )
.Description(
"It's getting darker, take painkillers to see better\n"
"Allows to take painkillers even when you have 100 health and enough time have passed since the last take"
)
.Arguments( {
Argument( "fade_out_percent" ).IsOptional().MinMax( 0, 100 ).RandomMinMax( 50, 90 ).Default( "90" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Fade out intensity: %.0f percent", value );
} ),
Argument( "fade_out_update_period" ).IsOptional().MinMax( 0.01 ).RandomMinMax( 0.2, 0.5 ).Default( "0.5" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Fade out update period: %.1f sec", value );
} )
} );
GameplayMod &::frictionOverride = GameplayMod::Define( "friction", "Friction" )
.Description( "Changes player's friction" )
.RandomGameplayModName( "Low friction" )
.RandomGameplayModDescription( "Slide around" )
.Arguments( {
Argument( "friction" ).IsOptional().MinMax( 0 ).RandomMinMax( 0, 1 ).Default( "4" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Friction: %.1f", value );
} )
} );
GameplayMod &::gaussFastCharge = GameplayMod::Define( "gauss_fast_charge", "Gauss fast charge" )
.Description( "Gauss charges faster like in multiplayer" )
.CanOnlyBeActivatedRandomlyWhen( []() -> bool {
if ( auto player = GetPlayer() ) {
return player->HasNamedPlayerWeaponWithAmmo( "weapon_gauss", true );
}
return false;
} );
GameplayMod &::gaussJumping = GameplayMod::Define( "gauss_jumping", "Gauss jumping" )
.Description( "Allows for easier gauss jumping like in multiplayer" )
.CanOnlyBeActivatedRandomlyWhen( []() -> bool {
if ( auto player = GetPlayer() ) {
return player->HasNamedPlayerWeaponWithAmmo( "weapon_gauss", true );
}
return false;
} );
GameplayMod &::gaussNoSelfGauss = GameplayMod::Define( "no_self_gauss", "No self gauss" )
.Description( "Prevents self gauss effect" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::randomGameplayMods.isActive() && ::instagib.isActive() ) {
return "";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::gibsAlways = GameplayMod::Define( "always_gib", "Always gib" )
.Description( "Kills will always try to result in gibbing" );
GameplayMod &::gibsEdible = GameplayMod::Define( "edible_gibs", "Edible gibs" )
.Description( "Eat gibs and heal yourself by pressing USE when aiming at the gib" );
GameplayMod &::gibsGarbage = GameplayMod::Define( "garbage_gibs", "Garbage gibs" )
.Description( "Replaces all gibs with garbage" );
GameplayMod &::gravity = GameplayMod::Define( "gravity", "Gravity" )
.Description( "Changes gravity value" )
.RandomGameplayModName( "Low gravity" )
.RandomGameplayModDescription( "You start to feel alittle lightheaded" )
.Arguments( {
Argument( "gravity" ).IsOptional().MinMax( 1, 2000 ).RandomMinMax( 100, 400 ).Default( "200" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Forced sv_gravity: %.0f", value );
} )
} );
GameplayMod &::grenadePellets = GameplayMod::Define( "grenade_pellets", "Grenade pellets" )
.Description( "Additional pellets will emerge after grenade explosion" )
.Arguments( {
Argument( "pellet_amount" ).IsOptional().MinMax( 4, 64 ).RandomMinMax( 48, 64 ).Default( "48" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Pellet amount: %.0f", value );
} )
} )
.CannotBeActivatedRandomly();
GameplayMod &::godConstant = GameplayMod::Define( "god", "God mode" )
.Description( "You are invincible and it doesn't count as a cheat" )
.CannotBeActivatedRandomly();
GameplayMod &::gungame = GameplayMod::Define( "gungame", "Gungame" )
.Description( "Kill enemies to switch weapons" )
.Arguments( {
Argument( "amount_of_kills" ).IsOptional().MinMax( 0 ).RandomMinMax( 1, 5 ).Default( "1" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Amount of kills required to get next weapon: %.0f", value );
} ),
Argument( "weapon_switch_time" ).IsOptional().MinMax( 0 ).Default( "0" ).Description( []( const std::string string, float value ) {
if ( value <= 0.0f ) {
return std::string( "Weapon won't be switched until you do enough kills" );
} else {
return fmt::sprintf( "Amount of kills required to get next weapon: %.0f", value );
}
} ),
Argument( "sequential" ).IsOptional().Default( "" ).Description( []( const std::string string, float value ) {
return string == "sequential" ? "Weapons will change sequentially" : "Weapons will change randomly";
} ),
} )
.IsExcludedFromChaosEdition();
GameplayMod &::headshots = GameplayMod::Define( "headshots", "Headshots" )
.Description( "Headshots dealt to enemies become much more deadly" )
.CannotBeActivatedRandomly();
GameplayMod &::healthRegeneration = GameplayMod::Define( "health_regeneration", "Health regeneration" )
.Description( "Allows for health regeneration options" )
.Arguments( {
Argument( "regeneration_max" ).IsOptional().MinMax( 0 ).Default( "20" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Regenerate up to: %.0f HP", value );
} ),
Argument( "regeneration_delay" ).IsOptional().MinMax( 0 ).Default( "3" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "%.1f sec after last damage", value );
} ),
Argument( "regeneration_frequency" ).IsOptional().MinMax( 0.01 ).Default( "0.2" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Regenerating: %.1f HP/sec", 1.0f / value );
} )
} )
.ForceDefaultArguments( "20 3 0.2" )
.CannotBeActivatedRandomly();
GameplayMod &::healOnKill = GameplayMod::Define( "heal_on_kill", "Heal on kill" )
.Description( "Your health will be replenished after killing an enemy" )
.Arguments( {
Argument( "max_health_taken_percent" ).IsOptional().MinMax( 1, 100 ).RandomMinMax( 50, 100 ).Default( "50" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Victim's max health percent taken after kill: %.0f", value );
} ),
} );
GameplayMod &::instagib = GameplayMod::Define( "instagib", "Instagib" )
.Description(
"Gauss Gun becomes much more deadly with 9999 damage, also gets red beam and slower rate of fire\n"
"More gibs come out"
)
.CanOnlyBeActivatedRandomlyWhen( []() {
if ( auto player = GetPlayer() ) {
if ( player->HasNamedPlayerWeaponWithAmmo( "weapon_gauss", true ) ) {
return true;
};
}
return false;
} );
GameplayMod &::infiniteAmmo = GameplayMod::Define( "infinite_ammo", "Infinite ammo" )
.Description( "All weapons get infinite ammo" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( auto player = GetPlayer() ) {
if ( ::gungame.isActive() ) {
if ( player->m_pActiveItem && FStrEq( STRING( player->m_pActiveItem->pev->classname ), "weapon_hornetgun" ) ) {
return std::nullopt;
}
return "";
}
static std::vector< CBasePlayer::DESPERATION_TYPE> desperations = {
CBasePlayer::DESPERATION_TYPE::DESPERATION_FIGHTING,
CBasePlayer::DESPERATION_TYPE::DESPERATION_REVENGE
};
if ( aux::ctr::includes( desperations, player->desperation ) ) {
return "";
}
}
return std::nullopt;
} );
GameplayMod &::infiniteAmmoClip = GameplayMod::Define( "infinite_ammo_clip", "Infinite ammo clip" )
.Description( "Most weapons get an infinite ammo clip and need no reloading" )
.CanOnlyBeActivatedRandomlyWhen( []() {
static std::vector<std::string> clipBasedWeapons = {
"weapon_9mmhandgun",
"weapon_9mmhandgun_twin",
"weapon_357",
"weapon_9mmAR",
"weapon_shotgun",
"weapon_crossbow",
"weapon_ingram",
"weapon_ingram_twin"
};
if ( auto player = GetPlayer() ) {
for ( auto &clipBasedWeapon : clipBasedWeapons ) {
if ( player->HasNamedPlayerItem( clipBasedWeapon.c_str(), true ) ) {
return true;
}
}
}
return false;
} );
GameplayMod &::initialClipAmmo = GameplayMod::Define( "initial_clip_ammo", "Initial ammo clip" )
.Description( "All weapons will have specified ammount of ammo in the clip when first picked up" )
.Arguments( {
Argument( "initial_clip_ammo" ).IsOptional().MinMax( 1 ).Default( "4" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Initial ammo in the clip: %.0f", value );
} )
} )
.CannotBeActivatedRandomly();
GameplayMod &::initialHealth = GameplayMod::Define( "starting_health", "Starting Health" )
.Description( "Start with specified health amount" )
.Arguments( {
Argument( "health_amount" ).IsOptional().MinMax( 1 ).Default( "100" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Health amount: %.0f", value );
} )
} )
.CannotBeActivatedRandomly();
GameplayMod &::inverseControls = GameplayMod::Define( "inverse_controls", "Inverse controls" )
.Description( "Movement and view controls become inversed" );
GameplayMod &::invisibility = GameplayMod::Define( "invisibility", "Invisibility" )
.Description( "Everyone is now less visible" )
.Arguments( {
Argument( "invisibilty_amount" ).IsOptional().MinMax( 1, 100 ).RandomMinMax( 70, 90 ).Default( "80" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Enemies become %.0f percent less visible", value );
} )
} );
GameplayMod &::kerotanDetector = GameplayMod::Define( "kerotan_detector", "Kerotan detector" )
.Description( "Kerotan frogs will call out to you when you get near them" )
.CannotBeActivatedRandomly();
GameplayMod &::modsDoubleTime = GameplayMod::Define( "double_time_mods", "Double time mods" )
.Description( "Next mods will last for twice as long" );
GameplayMod &::noFallDamage = GameplayMod::Define( "no_fall_damage", "No fall damage" )
.Description( "Self explanatory" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::randomGameplayMods.isActive() && ::vvvvvv.isActive() ) {
return "";
}
return std::nullopt;
} );
GameplayMod &::noGameTitle = GameplayMod::Define( "no_game_title", "No game title" )
.Description( "Prevents game title from appearing" )
.CannotBeActivatedRandomly();
GameplayMod &::noJumping = GameplayMod::Define( "no_jumping", "No jumping" )
.Description( "Don't allow to jump" )
.CannotBeActivatedRandomly();
GameplayMod &::noHealing = GameplayMod::Define( "no_healing", "No healing" )
.Description( "Don't allow to heal in any way, including Xen healing pools" )
.CannotBeActivatedRandomly();
GameplayMod &::noMapMusic = GameplayMod::Define( "no_map_music", "No map music" )
.Description(
"Music which is defined by map will not be played\n"
"Only the music defined in gameplay config files will play"
)
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
#ifndef CLIENT_DLL
if ( CHalfLifeRules *rules = dynamic_cast< CHalfLifeRules * >( g_pGameRules ) ) {
for ( auto it = rules->configs.rbegin(); it != rules->configs.rend(); it++ ) {
auto &cfg = *( *it );
if ( !cfg.musicPlaylist.empty() ) {
return "";
}
}
}
#else
if ( !clientConfig.musicPlaylist.empty() ) {
return "";
}
#endif
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::noPainkillers = GameplayMod::Define( "no_pills", "No painkillers" )
.Description( "Don't allow to take painkillers" )
.CannotBeActivatedRandomly();
GameplayMod &::noSaving = GameplayMod::Define( "no_saving", "No saving" )
.Description( "Don't allow to load saved files" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( gameplayMods::autoSavesOnly.isActive() && !g_autoSaved ) {
return "";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::noSecondaryAttack = GameplayMod::Define( "no_secondary_attack", "No secondary attack" )
.Description( "Disables the secondary attack on all weapons" )
.CanOnlyBeActivatedRandomlyWhen( []() {
static std::vector<const char *> weaponsWithSecondaryAttack = {
"weapon_shotgun",
"weapon_9mmAR",
"weapon_crossbow",
"weapon_gauss"
};
if ( auto player = GetPlayer() ) {
for ( auto weapon : weaponsWithSecondaryAttack ) {
if ( player->HasNamedPlayerItem( weapon, true ) ) {
return true;
}
}
}
return false;
} );
GameplayMod &::noSmgGrenadePickup = GameplayMod::Define( "no_smg_grenade_pickup", "No SMG grenade pickup" )
.Description( "You're not allowed to pickup and use SMG (MP5) grenades" )
.CannotBeActivatedRandomly();
GameplayMod &::noStartDark = GameplayMod::Define( "no_start_dark", "No start dark" )
.Description( "Prevents game fading out from dark at the start" )
.CannotBeActivatedRandomly();
GameplayMod &::noTargetConstant = GameplayMod::Define( "no_target", "No target" )
.Description( "You are invisible to everyone and it doesn't count as a cheat" )
.CannotBeActivatedRandomly();
GameplayMod &::noWalking = GameplayMod::Define( "no_walking", "No walking" )
.Description( "Don't allow to walk, swim, dive, climb ladders" )
.CannotBeActivatedRandomly();
GameplayMod &::oneHitKO = GameplayMod::Define( "one_hit_ko", "One hit KO" )
.Description(
"Any hit from an enemy will kill you instantly\n"
"You still get proper damage from falling and environment"
)
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::randomGameplayMods.isActive() && ::superHot.isActive() ) {
return "";
}
return std::nullopt;
} )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::snarkNuclear.isActive() && !::teleportOnKill.isActive() && !::damageMultiplier.isActive();
} )
.IsExcludedFromChaosEdition();
GameplayMod &::oneHitKOFromPlayer = GameplayMod::Define( "one_hit_ko_from_player", "One hit KO from player" )
.Description( "All enemies die in one hit" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::randomGameplayMods.isActive() && ::superHot.isActive() ) {
return "";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::painkillersInfinite = GameplayMod::Define( "infinite_painkillers", "Infinite painkillers" )
.Description( "Self explanatory" )
.CannotBeActivatedRandomly();
GameplayMod &::painkillersSlow = GameplayMod::Define( "slow_painkillers", "Slow painkillers" )
.Description( "Painkillers take time to have an effect, like in original Max Payne" )
.Arguments( {
Argument( "healing_period" ).IsOptional().MinMax( 0.01 ).RandomMinMax( 0.1, 0.3 ).Default( "0.2" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Healing period %.1f sec", value );
} )
} );
GameplayMod &::payned = GameplayMod::Define( "payned", "Payned" )
.Description( "Payne to the max!" );
GameplayMod &::paynedSounds = GameplayMod::Define( "payned_sounds", "Payned sounds" )
.Description( "Everyone make sounds of thugs from Max Payne" )
.CannotBeActivatedRandomly();
GameplayMod &::paynedSoundsHumans = GameplayMod::Define( "payned_sounds_humans", "Payned sounds - humans" )
.Description( "Humans make sounds of thugs from Max Payne" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::paynedSounds.isActive() ) {
return "";
}
if ( ::randomGameplayMods.isActive() && ::payned.isActive() ) {
return "";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::paynedSoundsMonsters = GameplayMod::Define( "payned_sounds_monsters", "Payned sounds - monsters" )
.Description( "Monsters make sounds of thugs from Max Payne" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::paynedSounds.isActive() ) {
return "";
}
if ( ::randomGameplayMods.isActive() && ::payned.isActive() ) {
return "";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::preventMonsterMovement = GameplayMod::Define( "prevent_monster_movement", "Prevent monster movement" )
.Description( "Monsters will always stay at spawn spot" )
.CannotBeActivatedRandomly();
GameplayMod &::preventMonsterSpawn = GameplayMod::Define( "prevent_monster_spawn", "Prevent monster spawn" )
.Description(
"Don't spawn predefined monsters (NPCs) when visiting a new map\n"
"This doesn't affect dynamic monster_spawners"
)
.CannotBeActivatedRandomly();
GameplayMod &::preventMonsterDrops = GameplayMod::Define( "prevent_monster_drops", "Prevent monster drops" )
.Description( "Monsters won't drop anything when dying" )
.CannotBeActivatedRandomly();
GameplayMod &::preserveNightmare = GameplayMod::Define( "preserve_nightmare", "Preserve nightmare" )
.Description( "Nightmare additional chapter will not be skipped" )
.CannotBeActivatedRandomly();
GameplayMod &::quakeRockets = GameplayMod::Define( "quake_rockets", "Quake rockets" )
.Description( "RPG is much more fast and rockets are shot instantly" )
.Arguments( {
Argument( "fire_delay" ).IsOptional().MinMax( 0.1 ).Default( "0.8" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Fire delay: %.1f sec", value );
} ),
Argument( "speed" ).IsOptional().MinMax( 10, 2000 ).Default( "1500" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Rocket speed: %.0f units", value );
} ),
} )
.CannotBeActivatedRandomly();
GameplayMod &::randomGameplayMods = GameplayMod::Define( "random_gameplay_mods", "Random gameplay mods" )
.Description( "Random gameplay mods" )
.Arguments( {
Argument( "time_for_random_gameplay_mod" ).IsOptional().MinMax( 1 ).Default( "60" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Random mod will last for %.0f sec", value );
} ),
Argument( "time_until_next_random_gameplay_mod" ).IsOptional().MinMax( 2 ).Default( "180" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Random mods will be applied every %.0f sec", value );
} ),
Argument( "time_for_random_gameplay_mod_voting" ).IsOptional().MinMax( 0 ).Default( "30" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Upcoming random mods will be shown for %.0f sec", value );
} )
} )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::chaosEdition.isActive() ) {
return "4 2 2";
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::randomSpawnerSeed = GameplayMod::Define( "random_spawner_seed", "Random spawner seed" )
.Description( "Makes random spawns same for all players based on a seed" )
.Arguments( {
Argument( "seed" ).Description( []( const std::string string, float value ) {
return "Seed: " + string + " \n";
} )
} )
.CannotBeActivatedRandomly();
GameplayMod &::scoreAttack = GameplayMod::Define( "score_attack", "Score attack" )
.Description( "Kill enemies to get as much score as possible. Build combos to get even more score" )
.CannotBeActivatedRandomly();
GameplayMod &::shotgunAutomatic = GameplayMod::Define( "shotgun_automatic", "Automatic shotgun" )
.Description( "Shotgun only fires single shots and doesn't have to be reloaded after each shot" )
.CanOnlyBeActivatedRandomlyWhen( []() -> bool {
if ( auto player = GetPlayer() ) {
return player->HasNamedPlayerWeaponWithAmmo( "weapon_shotgun", true );
}
return false;
} );
GameplayMod &::shootUnderwater = GameplayMod::Define( "shoot_underwater", "Shoot underwater" )
.Description( "All weapons now can shoot underwater" )
.CannotBeActivatedRandomly();
GameplayMod &::slowmotionConstant = GameplayMod::Define( "constant_slowmotion", "Constant slowmotion" )
.Description( "You start in slowmotion, it's infinite and you can't turn it off" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( GetMapName() == "nightmare" ) {
return "";
}
if ( auto player = GetPlayer() ) {
static std::vector< CBasePlayer::DESPERATION_TYPE> desperations = {
CBasePlayer::DESPERATION_TYPE::DESPERATION_PRE_IMMINENT,
CBasePlayer::DESPERATION_TYPE::DESPERATION_IMMINENT,
CBasePlayer::DESPERATION_TYPE::DESPERATION_ALL_FOR_REVENGE,
CBasePlayer::DESPERATION_TYPE::DESPERATION_REVENGE
};
if ( aux::ctr::includes( desperations, player->desperation ) ) {
return "";
}
}
return std::nullopt;
} )
.CannotBeActivatedRandomly();
GameplayMod &::slowmotionFastWalk = GameplayMod::Define( "slowmotion_fast_walk", "Fast walk in slowmotion" )
.Description( "You still walk and run almost as fast as when slowmotion is not active" )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::slowmotionForbidden.isActive();
} );
GameplayMod &::slowmotionForbidden = GameplayMod::Define( "no_slowmotion", "No slowmotion" )
.Description( "You're not allowed to use slowmotion" )
.CanOnlyBeActivatedRandomlyWhen( []() {
return
!::slowmotionInfinite.isActive() && !::superHotToggleable.isActive() && !!::bulletDelayOnSlowmotion.isActive() &&
!::slowmotionFastWalk.isActive() && !::slowmotionOnlyDiving.isActive() && !::slowmotionOnDamage.isActive();
} );
GameplayMod &::slowmotionInfinite = GameplayMod::Define( "infinite_slowmotion", "Infinite slowmotion" )
.Description( "You have infinite slowmotion charge and it's not considered as cheat" )
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( ::slowmotionConstant.isActive() ) {
return "";
}
if ( ::divingOnly.isActive() ) {
return "";
}
if ( gameplayModsData.slowmotionInfiniteCheat ) {
return "";
}
if ( auto player = GetPlayer() ) {
if ( player->desperation == CBasePlayer::DESPERATION_TYPE::DESPERATION_FIGHTING && !::slowmotionForbidden.isActive() ) {
return "";
}
}
return std::nullopt;
} );
GameplayMod &::slowmotionInitialCharge = GameplayMod::Define( "initial_slowmotion_charge", "Initial slowmotion charge" )
.Description( "Start with specified slowmotion charge" )
.Arguments( {
Argument( "slowmotion_charge" ).IsOptional().MinMax( 0, 100 ).Default( "0" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "%.0f percent of slowmotion charge", value );
} )
} )
.CannotBeActivatedRandomly();
GameplayMod &::slowmotionOnDamage = GameplayMod::Define( "slowmotion_on_damage", "Slowmotion on damage" )
.Description( "You get slowmotion charge when receiving damage" )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::slowmotionForbidden.isActive();
} );
GameplayMod &::slowmotionOnlyDiving = GameplayMod::Define( "slowmotion_only_diving", "Slowmotion only when diving" )
.Description( "You're allowed to go into slowmotion only by diving" )
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::slowmotionForbidden.isActive();
} );
GameplayMod &::snarkFriendlyToAllies = GameplayMod::Define( "snark_friendly_to_allies", "Snarks friendly to allies" )
.Description( "Snarks won't attack player's allies" )
.CannotBeActivatedRandomly();
GameplayMod &::snarkFriendlyToPlayer = GameplayMod::Define( "snark_friendly_to_player", "Snarks friendly to player" )
.Description( "Snarks won't attack player" )
.CanOnlyBeActivatedRandomlyWhen( []() {
if ( auto player = GetPlayer() ) {
if ( player->HasNamedPlayerItem( "weapon_snark", true ) ) {
return true;
}
}
return ::snarkInfestation.isActive() || ::snarkFromExplosion.isActive();
} );
GameplayMod &::snarkFromExplosion = GameplayMod::Define( "snark_from_explosion", "Snark from explosion" )
.Description( "Snarks will spawn in the place of explosion" );
GameplayMod &::snarkInception = GameplayMod::Define( "snark_inception", "Snark inception" )
.Description( "Killing a snark splits it into two snarks" )
.Arguments( {
Argument( "inception_depth" ).IsOptional().MinMax( 1, 100 ).RandomMinMax( 1, 1 ).Default( "10" ).Description( []( const std::string string, float value ) {
return fmt::sprintf( "Inception depth: %.0f snarks", value );
} )
} )
.CanOnlyBeActivatedRandomlyWhen( []() {
if ( auto player = GetPlayer() ) {
if ( player->HasNamedPlayerItem( "weapon_snark", true ) ) {
return true;
}
}
return
( ::snarkInfestation.isActive() || ::snarkFromExplosion.isActive() ) &&
( !::teleportOnKill.isActive() );
} );
GameplayMod &::snarkInfestation = GameplayMod::Define( "snark_infestation", "Snark infestation" )
.Description(
"Snark will spawn in the body of killed NPC\n"
"Even more snarks spawn if NPC's corpse has been gibbed"
)
.CanOnlyBeActivatedRandomlyWhen( []() {
return !::teleportOnKill.isActive();
} );
GameplayMod &::snarkNuclear = GameplayMod::Define( "snark_nuclear", "Snark nuclear" )
.Description( "Killing a snark produces a grenade-like explosion" )
.CanOnlyBeActivatedRandomlyWhen( []() {
if ( auto player = GetPlayer() ) {
if ( player->HasNamedPlayerItem( "weapon_snark", true ) ) {
return true;
}
}
return
( ::snarkInfestation.isActive() || ::snarkFromExplosion.isActive() ) &&
( !::oneHitKO.isActive() && !::teleportOnKill.isActive() );
} );
GameplayMod &::snarkPenguins = GameplayMod::Define( "snark_penguins", "Snark penguins" )
.Description( "Replaces snarks with penguins from Opposing Force\n" )
.CanOnlyBeActivatedRandomlyWhen( []() {
if ( auto player = GetPlayer() ) {
if ( player->HasNamedPlayerItem( "weapon_snark" ) ) {
return true;
}
}
return ::snarkInfestation.isActive() || ::snarkFromExplosion.isActive();
} );
GameplayMod &::snarkStayAlive = GameplayMod::Define( "snark_stay_alive", "Snark stay alive" )
.Description( "Snarks will never die on their own, they must be shot" )
.CanOnlyBeActivatedRandomlyWhen( []() {
if ( auto player = GetPlayer() ) {
if ( player->HasNamedPlayerItem( "weapon_snark", true ) ) {
return true;
}
}
return ::snarkInfestation.isActive() || ::snarkFromExplosion.isActive();
} );
GameplayMod &::superHot = GameplayMod::Define( "superhot", "SUPERHOT" )
.Description(
"Time moves forward only when you move around, everyone dies in one hit\n"
"Inspired by the game SUPERHOT"
)
.IsAlsoActiveWhen( []() -> std::optional<std::string> {
if ( auto player = GetPlayer() ) {