]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add shotgunarena as a mutator
authorMario <zacjardine@y7mail.com>
Wed, 25 Feb 2015 05:49:53 +0000 (16:49 +1100)
committerMario <zacjardine@y7mail.com>
Wed, 25 Feb 2015 05:49:53 +0000 (16:49 +1100)
qcsrc/server/mutators/mutator_shotgunarena.qc [new file with mode: 0644]
qcsrc/server/mutators/mutators.qc
qcsrc/server/mutators/mutators.qh
qcsrc/server/mutators/mutators_include.qc

diff --git a/qcsrc/server/mutators/mutator_shotgunarena.qc b/qcsrc/server/mutators/mutator_shotgunarena.qc
new file mode 100644 (file)
index 0000000..d266b0f
--- /dev/null
@@ -0,0 +1,80 @@
+void sha_SetCvars()
+{
+       cvar_settemp("g_balance_shotgun_primary_damage", cvar_string("g_shotgunarena_shotgun_primary_damage"));
+       cvar_settemp("g_balance_shotgun_primary_force", cvar_string("g_shotgunarena_shotgun_primary_force"));
+       cvar_settemp("g_balance_shotgun_primary_refire", cvar_string("g_shotgunarena_shotgun_primary_refire"));
+       cvar_settemp("g_balance_shotgun_primary_spread", cvar_string("g_shotgunarena_shotgun_primary_spread"));
+       cvar_settemp("g_balance_shotgun_reload_ammo", cvar_string("g_shotgunarena_shotgun_reload_ammo"));
+       cvar_settemp("g_balance_shotgun_reload_time", cvar_string("g_shotgunarena_shotgun_reload_time"));
+       cvar_settemp("g_balance_shotgun_secondary_damage", cvar_string("g_shotgunarena_shotgun_secondary_damage"));
+       cvar_settemp("g_balance_shotgun_secondary_force", cvar_string("g_shotgunarena_shotgun_secondary_force"));
+       cvar_settemp("g_balance_shotgun_secondary_melee_time", cvar_string("g_shotgunarena_shotgun_secondary_melee_time"));
+       cvar_settemp("g_balance_shotgun_secondary_refire", cvar_string("g_shotgunarena_shotgun_secondary_refire"));
+}
+
+MUTATOR_HOOKFUNCTION(sha_FilterItem)
+{
+       switch (self.items)
+       {
+               case IT_5HP:
+               case IT_ARMOR_SHARD:
+                       return false;
+       }
+
+       return true;
+}
+
+MUTATOR_HOOKFUNCTION(sha_StartItems)
+{
+       start_items |= IT_UNLIMITED_WEAPON_AMMO;
+       //start_ammo_shells = warmup_start_ammo_shells = 100;
+       warmup_start_weapons = start_weapons = WEPSET_SHOTGUN;
+
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(sha_ForbidThrowCurrentWeapon)
+{
+       return true;
+}
+
+MUTATOR_HOOKFUNCTION(sha_BuildMutatorsString)
+{
+       ret_string = strcat(ret_string, ":SHA");
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(sha_BuildMutatorsPrettyString)
+{
+       ret_string = strcat(ret_string, ", Shotgun Arena");
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(sha_SetModname)
+{
+       modname = "Shotgun Arena";
+       return true;
+}
+
+MUTATOR_DEFINITION(mutator_shotgunarena)
+{
+       MUTATOR_HOOK(FilterItem, sha_FilterItem, CBC_ORDER_ANY);
+       MUTATOR_HOOK(SetStartItems, sha_StartItems, CBC_ORDER_ANY);
+       MUTATOR_HOOK(ForbidThrowCurrentWeapon, sha_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
+       MUTATOR_HOOK(BuildMutatorsString, sha_BuildMutatorsString, CBC_ORDER_ANY);
+       MUTATOR_HOOK(BuildMutatorsPrettyString, sha_BuildMutatorsPrettyString, CBC_ORDER_ANY);
+       MUTATOR_HOOK(SetModname, sha_SetModname, CBC_ORDER_ANY);
+
+       MUTATOR_ONADD
+       {
+               sha_SetCvars();
+       }
+
+       MUTATOR_ONREMOVE
+       {
+               print("This cannot be removed at runtime\n");
+               return -1;
+       }
+
+       return false;
+}
index 8535f5de5956c0cfbbe53f8837c92fbfbcda97cd..488527c966244843341b5b0765326f9adadca8f8 100644 (file)
@@ -42,6 +42,7 @@ void mutators_add()
        CHECK_MUTATOR_ADD("g_buffs", mutator_buffs, !g_nexball && !g_race && !g_cts);
        CHECK_MUTATOR_ADD("g_itemeditor", mutator_itemeditor, cvar("g_pickup_items") && !g_ca);
        CHECK_MUTATOR_ADD("g_skycycle", mutator_skycycle, 1);
+       CHECK_MUTATOR_ADD("g_shotgunarena", mutator_shotgunarena, !cvar("g_instagib") && !g_nexball && !cvar("g_overkill") && !cvar("g_riflearena"));
 
        #undef CHECK_MUTATOR_ADD
 }
index 2fa9d72c3ba55ca962d6cfad70df5efab9713f18..96099cc2fc9cd19108f3ccd5a38e78e2a8ea9925 100644 (file)
@@ -51,6 +51,7 @@ MUTATOR_DECLARATION(mutator_piggyback);
 MUTATOR_DECLARATION(mutator_buffs);
 MUTATOR_DECLARATION(mutator_itemeditor);
 MUTATOR_DECLARATION(mutator_skycycle);
+MUTATOR_DECLARATION(mutator_shotgunarena);
 MUTATOR_DECLARATION(sandbox);
 
 #endif
index 73e9474b2b6c9d7995ecefd5a134d9e2b41ceab8..bd7e3a791896dbd297bc0c218968c0f8d7092b62 100644 (file)
 #include "mutator_buffs.qc"
 #include "mutator_itemeditor.qc"
 #include "mutator_skycycle.qc"
+#include "mutator_shotgunarena.qc"