From: Mario Date: Sat, 15 Jun 2013 05:44:33 +0000 (+1000) Subject: Move more g_ca checks into mutator hooks X-Git-Tag: xonotic-v0.8.0~366^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=18f8c08faff54821b78084eafe7242868c49cc1f;p=xonotic%2Fxonotic-data.pk3dir.git Move more g_ca checks into mutator hooks --- diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 5eb8247c2..fbe6d7aea 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -485,9 +485,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht self.dmg_take = self.dmg_take + take;//max(take - 10, 0); self.dmg_inflictor = inflictor; - if(g_ca && self != attacker && IS_PLAYER(attacker)) - PlayerTeamScore_Add(attacker, SP_SCORE, ST_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier); - float abot, vbot, awep; abot = (IS_BOT_CLIENT(attacker)); vbot = (IS_BOT_CLIENT(self)); diff --git a/qcsrc/server/mutators/gamemode_arena.qc b/qcsrc/server/mutators/gamemode_arena.qc index 46b8faccc..bb6312ea1 100644 --- a/qcsrc/server/mutators/gamemode_arena.qc +++ b/qcsrc/server/mutators/gamemode_arena.qc @@ -237,6 +237,15 @@ MUTATOR_HOOKFUNCTION(arena_SV_StartFrame) return 1; } +MUTATOR_HOOKFUNCTION(arena_FilterItem) +{ + if(autocvar_g_powerups <= 0) + if(self.flags & FL_POWERUP) + return TRUE; + + return FALSE; +} + void arena_Initialize() { maxspawned = max(2, autocvar_g_arena_maxspawned); @@ -260,6 +269,7 @@ MUTATOR_DEFINITION(gamemode_arena) MUTATOR_HOOK(GiveFragsForKill, arena_GiveFragsForKill, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerDies, arena_PlayerDies, CBC_ORDER_ANY); MUTATOR_HOOK(SV_StartFrame, arena_SV_StartFrame, CBC_ORDER_ANY); + MUTATOR_HOOK(FilterItem, arena_FilterItem, CBC_ORDER_ANY); MUTATOR_ONADD { diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 1f43bdde8..7c4904565 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -242,7 +242,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage) { if(IS_PLAYER(frag_target)) if(frag_target.deadflag == DEAD_NO) - if(frag_target == frag_attacker || !IsDifferentTeam(frag_target, frag_attacker)) + if(frag_target == frag_attacker || !IsDifferentTeam(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL) frag_damage = 0; frag_mirrordamage = 0; @@ -250,6 +250,28 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage) return FALSE; } +MUTATOR_HOOKFUNCTION(ca_FilterItem) +{ + if(autocvar_g_powerups <= 0) + if(self.flags & FL_POWERUP) + return TRUE; + + if(autocvar_g_pickup_items <= 0) + return TRUE; + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(ca_PlayerDamage_SplitHealthArmor) +{ + float excess = max(0, frag_damage - damage_take - damage_save); + + if(frag_target != frag_attacker && IS_PLAYER(frag_attacker)) + PlayerTeamScore_Add(frag_attacker, SP_SCORE, ST_SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier); + + return FALSE; +} + // scoreboard setup void ca_ScoreRules() { @@ -293,6 +315,8 @@ MUTATOR_DEFINITION(gamemode_ca) MUTATOR_HOOK(GiveFragsForKill, ca_GiveFragsForKill, CBC_ORDER_FIRST); MUTATOR_HOOK(SetStartItems, ca_SetStartItems, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerDamage_Calculate, ca_PlayerDamage, CBC_ORDER_ANY); + MUTATOR_HOOK(FilterItem, ca_FilterItem, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, ca_PlayerDamage_SplitHealthArmor, CBC_ORDER_ANY); MUTATOR_ONADD { diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index e22cba6bb..424b124f5 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -93,7 +93,7 @@ void CreatureFrame (void) { // check for falling damage float velocity_len = vlen(self.velocity); - if(!self.hook.state && !g_ca && !(g_cts && !autocvar_g_cts_selfdamage)) + if(!self.hook.state && !(g_cts && !autocvar_g_cts_selfdamage)) { dm = vlen(self.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. if (self.deadflag) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 926a4ab9d..a89560072 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -277,10 +277,6 @@ float have_pickup_item(void) return TRUE; if(autocvar_g_powerups == 0) return FALSE; - if(g_ca) - return FALSE; - if(g_arena) - return FALSE; } else { @@ -288,8 +284,6 @@ float have_pickup_item(void) return TRUE; if(autocvar_g_pickup_items == 0) return FALSE; - if(g_ca) - return FALSE; if(g_weaponarena) if(!WEPSET_EMPTY_E(self) || (self.items & IT_AMMO)) return FALSE;