From: Mario Date: Wed, 25 Feb 2015 05:49:53 +0000 (+1100) Subject: Add shotgunarena as a mutator X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7ce867a6ff21a7ac13251591bcfae341d00619d5;p=xonotic%2Fxonotic-data.pk3dir.git Add shotgunarena as a mutator --- diff --git a/qcsrc/server/mutators/mutator_shotgunarena.qc b/qcsrc/server/mutators/mutator_shotgunarena.qc new file mode 100644 index 000000000..d266b0fbb --- /dev/null +++ b/qcsrc/server/mutators/mutator_shotgunarena.qc @@ -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; +} diff --git a/qcsrc/server/mutators/mutators.qc b/qcsrc/server/mutators/mutators.qc index 8535f5de5..488527c96 100644 --- a/qcsrc/server/mutators/mutators.qc +++ b/qcsrc/server/mutators/mutators.qc @@ -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 } diff --git a/qcsrc/server/mutators/mutators.qh b/qcsrc/server/mutators/mutators.qh index 2fa9d72c3..96099cc2f 100644 --- a/qcsrc/server/mutators/mutators.qh +++ b/qcsrc/server/mutators/mutators.qh @@ -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 diff --git a/qcsrc/server/mutators/mutators_include.qc b/qcsrc/server/mutators/mutators_include.qc index 73e9474b2..bd7e3a791 100644 --- a/qcsrc/server/mutators/mutators_include.qc +++ b/qcsrc/server/mutators/mutators_include.qc @@ -131,3 +131,4 @@ #include "mutator_buffs.qc" #include "mutator_itemeditor.qc" #include "mutator_skycycle.qc" +#include "mutator_shotgunarena.qc"