Commit 53fa7721 authored by Samual's avatar Samual

Merge remote-tracking branch 'origin/Mario/mutators'

parents 4b392add 8ece2525
......@@ -11,7 +11,7 @@ set g_dodging 0 "set to 1 to enable dodging in games"
seta cl_dodging_timeout 0.2 "determines how long apart (in seconds) two taps on the same direction key are considered a dodge. use 0 to disable"
set sv_dodging_wall_dodging 0 "set to 1 to allow dodging off walls. 0 to disable"
set sv_dodging_delay 0.5 "determines how long a player has to wait to be able to dodge again after dodging"
set sv_dodging_delay 0.7 "determines how long a player has to wait to be able to dodge again after dodging"
set sv_dodging_up_speed 200 "the jump velocity of the dodge"
set sv_dodging_horiz_speed 400 "the horizontal velocity of the dodge"
set sv_dodging_horiz_speed_frozen 200 "the horizontal velocity of the dodge while frozen"
......@@ -149,17 +149,6 @@ set g_nades_nade_force 650
set g_nades_nade_newton_style 0
// =============
// rifle arena
// =============
set g_riflearena 0
set g_riflearena_rifle_secondary_spread 0
set g_riflearena_rifle_secondary_shots 1
set g_riflearena_rifle_secondary_animtime 0.15
set g_riflearena_rifle_secondary_refire 0.15
set g_riflearena_rifle_secondary_damage 40
// ============
// camp check
// ============
......
......@@ -923,7 +923,6 @@ void readlevelcvars(void)
CHECK_MUTATOR_ADD("g_melee_only", mutator_melee_only, !cvar("g_minstagib"));
CHECK_MUTATOR_ADD("g_nades", mutator_nades, 1);
CHECK_MUTATOR_ADD("g_sandbox", sandbox, 1);
CHECK_MUTATOR_ADD("g_riflearena", mutator_riflearena, !cvar("g_minstagib"));
CHECK_MUTATOR_ADD("g_campcheck", mutator_campcheck, 1);
#undef CHECK_MUTATOR_ADD
......
......@@ -523,7 +523,7 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPhysics)
{
if(self.freezetag_frozen)
{
if(autocvar_sv_dodging_frozen)
if(autocvar_sv_dodging_frozen && IS_REAL_CLIENT(self))
{
self.movement_x = bound(-5, self.movement_x, 5);
self.movement_y = bound(-5, self.movement_y, 5);
......
......@@ -168,6 +168,9 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
tap_direction_x = 0;
tap_direction_y = 0;
float frozen_dodging;
frozen_dodging = (self.freezetag_frozen && autocvar_sv_dodging_frozen);
float dodge_detected;
if (g_dodging == 0)
......@@ -185,7 +188,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
if (self.movement_x > 0) {
// is this a state change?
if (!(self.pressedkeys & KEY_FORWARD)) {
if (!(self.pressedkeys & KEY_FORWARD) || frozen_dodging) {
if ((time - self.last_FORWARD_KEY_time) < self.cvar_cl_dodging_timeout) {
tap_direction_x = 1.0;
dodge_detected = 1;
......@@ -196,7 +199,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
if (self.movement_x < 0) {
// is this a state change?
if (!(self.pressedkeys & KEY_BACKWARD)) {
if (!(self.pressedkeys & KEY_BACKWARD) || frozen_dodging) {
tap_direction_x = -1.0;
if ((time - self.last_BACKWARD_KEY_time) < self.cvar_cl_dodging_timeout) {
dodge_detected = 1;
......@@ -207,7 +210,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
if (self.movement_y > 0) {
// is this a state change?
if (!(self.pressedkeys & KEY_RIGHT)) {
if (!(self.pressedkeys & KEY_RIGHT) || frozen_dodging) {
tap_direction_y = 1.0;
if ((time - self.last_RIGHT_KEY_time) < self.cvar_cl_dodging_timeout) {
dodge_detected = 1;
......@@ -218,7 +221,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
if (self.movement_y < 0) {
// is this a state change?
if (!(self.pressedkeys & KEY_LEFT)) {
if (!(self.pressedkeys & KEY_LEFT) || frozen_dodging) {
tap_direction_y = -1.0;
if ((time - self.last_LEFT_KEY_time) < self.cvar_cl_dodging_timeout) {
dodge_detected = 1;
......
void ra_SetCvars()
{
cvar_settemp("g_balance_rifle_secondary_spread", ftos(cvar("g_riflearena_rifle_secondary_spread")));
cvar_settemp("g_balance_rifle_secondary_shots", ftos(cvar("g_riflearena_rifle_secondary_shots")));
cvar_settemp("g_balance_rifle_secondary_animtime", ftos(cvar("g_riflearena_rifle_secondary_animtime")));
cvar_settemp("g_balance_rifle_secondary_refire", ftos(cvar("g_riflearena_rifle_secondary_refire")));
cvar_settemp("g_balance_rifle_secondary_damage", ftos(cvar("g_riflearena_rifle_secondary_damage")));
}
MUTATOR_HOOKFUNCTION(ra_PlayerDamage)
{
if(IS_PLAYER(frag_attacker))
if(IS_PLAYER(frag_target))
{
if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER))
{
if(frag_attacker == frag_target)
frag_damage = 5;
else
frag_damage = 0;
if (frag_target != frag_attacker)
{
if (frag_target.health >= 1 && IS_PLAYER(frag_target))
centerprint(frag_attacker, "Laser inflicts no damage!");
frag_force = '0 0 0';
}
}
}
return FALSE;
}
MUTATOR_HOOKFUNCTION(ra_PlayerSpawn)
{
WEPSET_CLEAR_E(self);
WEPSET_OR_EW(self, WEP_RIFLE);
WEPSET_OR_EW(self, WEP_LASER);
return FALSE;
}
MUTATOR_HOOKFUNCTION(ra_FilterItem)
{
switch (self.items)
{
case IT_5HP:
case IT_ARMOR_SHARD:
return FALSE;
}
return TRUE;
}
MUTATOR_HOOKFUNCTION(ra_StartItems)
{
start_items |= IT_UNLIMITED_AMMO;
start_ammo_nails = 100;
return FALSE;
}
MUTATOR_HOOKFUNCTION(ra_ForbidThrowCurrentWeapon)
{
nades_CheckThrow();
return TRUE;
}
MUTATOR_HOOKFUNCTION(ra_BuildMutatorsString)
{
ret_string = strcat(ret_string, ":RA");
return FALSE;
}
MUTATOR_HOOKFUNCTION(ra_BuildMutatorsPrettyString)
{
ret_string = strcat(ret_string, ", Rifle Arena");
return FALSE;
}
MUTATOR_HOOKFUNCTION(ra_SetModname)
{
modname = "Rifle Arena";
return TRUE;
}
MUTATOR_DEFINITION(mutator_riflearena)
{
MUTATOR_HOOK(PlayerDamage_Calculate, ra_PlayerDamage, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerSpawn, ra_PlayerSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(FilterItem, ra_FilterItem, CBC_ORDER_ANY);
MUTATOR_HOOK(SetStartItems, ra_StartItems, CBC_ORDER_ANY);
MUTATOR_HOOK(ForbidThrowCurrentWeapon, ra_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
MUTATOR_HOOK(BuildMutatorsString, ra_BuildMutatorsString, CBC_ORDER_ANY);
MUTATOR_HOOK(BuildMutatorsPrettyString, ra_BuildMutatorsPrettyString, CBC_ORDER_ANY);
MUTATOR_ONADD
{
ra_SetCvars();
weapon_action(WEP_LASER, WR_PRECACHE);
weapon_action(WEP_RIFLE, WR_PRECACHE);
}
MUTATOR_ONREMOVE
{
print("This cannot be removed at runtime\n");
return -1;
}
return FALSE;
}
......@@ -28,7 +28,6 @@ MUTATOR_DECLARATION(mutator_random_gravity);
MUTATOR_DECLARATION(mutator_multijump);
MUTATOR_DECLARATION(mutator_melee_only);
MUTATOR_DECLARATION(mutator_nades);
MUTATOR_DECLARATION(mutator_riflearena);
MUTATOR_DECLARATION(mutator_campcheck);
MUTATOR_DECLARATION(sandbox);
......@@ -257,7 +257,6 @@ mutators/mutator_random_gravity.qc
mutators/mutator_multijump.qc
mutators/mutator_melee_only.qc
mutators/mutator_nades.qc
mutators/mutator_riflearena.qc
mutators/mutator_campcheck.qc
../warpzonelib/anglestransform.qc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment