|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
/** |
|
|
|
|
* This rule detects suspicious attempts to deal damage and |
|
|
|
|
* applies friendly fire scaling according to 'FixFFHack's rules. |
|
|
|
|
* applies friendly fire scaling according to 'FixFFHack's rules. |
|
|
|
|
* Copyright 2019 Anton Tarasenko |
|
|
|
|
*------------------------------------------------------------------------------ |
|
|
|
|
* This file is part of Acedia. |
|
|
|
@ -21,51 +21,53 @@
|
|
|
|
|
class FFHackRule extends GameRules; |
|
|
|
|
|
|
|
|
|
function int NetDamage( |
|
|
|
|
int originalDamage, |
|
|
|
|
int damage, |
|
|
|
|
Pawn injured, |
|
|
|
|
Pawn instigator, |
|
|
|
|
Vector hitLocation, |
|
|
|
|
out Vector momentum, |
|
|
|
|
class<DamageType> damageType |
|
|
|
|
int originalDamage, |
|
|
|
|
int damage, |
|
|
|
|
Pawn injured, |
|
|
|
|
Pawn instigator, |
|
|
|
|
Vector hitLocation, |
|
|
|
|
out Vector momentum, |
|
|
|
|
class<DamageType> damageType |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
local KFGameType gameType; |
|
|
|
|
local FixFFHack ffHackFix; |
|
|
|
|
gameType = KFGameType(level.game); |
|
|
|
|
// Something is very wrong and we can just bail on this damage |
|
|
|
|
if (damageType == none || gameType == none) return 0; |
|
|
|
|
local KFGameType gameType; |
|
|
|
|
local FixFFHack ffHackFix; |
|
|
|
|
gameType = KFGameType(level.game); |
|
|
|
|
// Something is very wrong and we can just bail on this damage |
|
|
|
|
if (damageType == none || gameType == none) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// We only check when suspicious instigators that aren't a world |
|
|
|
|
if (!damageType.default.bCausedByWorld && IsSuspicious(instigator)) |
|
|
|
|
{ |
|
|
|
|
ffHackFix = FixFFHack(class'FixFFHack'.static.GetInstance()); |
|
|
|
|
if (ffHackFix != none && ffHackFix.ShouldScaleDamage(damageType)) |
|
|
|
|
{ |
|
|
|
|
// Remove pushback to avoid environmental kills |
|
|
|
|
momentum = Vect(0.0, 0.0, 0.0); |
|
|
|
|
damage *= gameType.friendlyFireScale; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return super.NetDamage( originalDamage, damage, injured, instigator, |
|
|
|
|
hitLocation, momentum, damageType); |
|
|
|
|
// We only check when suspicious instigators that aren't a world |
|
|
|
|
if (!damageType.default.bCausedByWorld && IsSuspicious(instigator)) |
|
|
|
|
{ |
|
|
|
|
ffHackFix = FixFFHack(class'FixFFHack'.static.GetInstance()); |
|
|
|
|
if (ffHackFix != none && ffHackFix.ShouldScaleDamage(damageType)) |
|
|
|
|
{ |
|
|
|
|
// Remove pushback to avoid environmental kills |
|
|
|
|
momentum = Vect(0.0, 0.0, 0.0); |
|
|
|
|
damage *= gameType.friendlyFireScale; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return super.NetDamage( originalDamage, damage, injured, instigator, |
|
|
|
|
hitLocation, momentum, damageType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function bool IsSuspicious(Pawn instigator) |
|
|
|
|
{ |
|
|
|
|
// Instigator vanished |
|
|
|
|
if (instigator == none) return true; |
|
|
|
|
// Instigator vanished |
|
|
|
|
if (instigator == none) return true; |
|
|
|
|
|
|
|
|
|
// Instigator already became spectator |
|
|
|
|
if (KFPawn(instigator) != none) |
|
|
|
|
{ |
|
|
|
|
if (instigator.playerReplicationInfo != none) |
|
|
|
|
{ |
|
|
|
|
return instigator.playerReplicationInfo.bOnlySpectator; |
|
|
|
|
} |
|
|
|
|
return true; // Replication info is gone => suspicious |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
// Instigator already became spectator |
|
|
|
|
if (KFPawn(instigator) != none) |
|
|
|
|
{ |
|
|
|
|
if (instigator.playerReplicationInfo != none) |
|
|
|
|
{ |
|
|
|
|
return instigator.playerReplicationInfo.bOnlySpectator; |
|
|
|
|
} |
|
|
|
|
return true; // Replication info is gone => suspicious |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
defaultproperties |
|
|
|
|