diff --git a/Classes/ST_Mutator.uc b/Classes/ST_Mutator.uc index 79cb65e..28262d7 100644 --- a/Classes/ST_Mutator.uc +++ b/Classes/ST_Mutator.uc @@ -421,9 +421,6 @@ function bool CheckHeadShot(Pawn P, vector HitLocation, vector Direction) { if (P == none) return false; - if (WeaponSettings.bEnhancedHeadshotDetection == false) - return (HitLocation.Z - P.Location.Z > 0.62 * P.CollisionHeight); - if (HitLocation.Z - P.Location.Z <= 0.3 * P.CollisionHeight) return false; @@ -475,9 +472,6 @@ function bool CheckBodyShot(Pawn P, vector HitLocation, vector Direction) { if (P == none) return false; - if (WeaponSettings.bEnhancedHeadshotDetection == false) - return CheckHeadShot(P, HitLocation, Direction) == false; - if (CollChecker == none || CollChecker.bDeleteMe) { CollChecker = Spawn(class'ST_HitTestHelper',self, , P.Location); CollChecker.bCollideWorld = false; diff --git a/Classes/ST_Razor2.uc b/Classes/ST_Razor2.uc index 1deafe0..80180eb 100644 --- a/Classes/ST_Razor2.uc +++ b/Classes/ST_Razor2.uc @@ -27,7 +27,7 @@ auto state Flying Dir = Normal(Velocity); if (bCanHitInstigator || (Other != Instigator)) { if (Role == ROLE_Authority) { - if (Other.bIsPawn && STM.CheckHeadShot(Pawn(Other), HitLocation, Dir) && + if (Other.bIsPawn && (HitLocation.Z - Other.Location.Z > 0.62 * Other.CollisionHeight) && (!Instigator.IsA('Bot') || !Bot(Instigator).bNovice) ) { Other.TakeDamage( @@ -37,7 +37,7 @@ auto state Flying STM.WeaponSettings.RipperHeadshotMomentum * MomentumTransfer * Dir, 'decapitated' ); - } else if (Other.bIsPawn == false || STM.CheckBodyShot(Pawn(Other), HitLocation, Dir)) { + } else { Other.TakeDamage( STM.WeaponSettings.RipperPrimaryDamage, instigator, diff --git a/Classes/ST_ShockRifle.uc b/Classes/ST_ShockRifle.uc index 07dba65..e9a244c 100644 --- a/Classes/ST_ShockRifle.uc +++ b/Classes/ST_ShockRifle.uc @@ -35,6 +35,39 @@ function PostBeginPlay() break; // Find master :D } +function TraceFire(float Accuracy) { + local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z; + local actor Other; + local Pawn PawnOwner; + + PawnOwner = Pawn(Owner); + + Owner.MakeNoise(PawnOwner.SoundDampening); + GetAxes(PawnOwner.ViewRotation,X,Y,Z); + StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.Y * Y + FireOffset.Z * Z; + EndTrace = StartTrace + (Accuracy * (FRand() - 0.5 )* Y * 1000) + (Accuracy * (FRand() - 0.5 ) * Z * 1000); + + if (bBotSpecialMove && (Tracked != None) && ( + ((Owner.Acceleration == vect(0,0,0)) && (VSize(Owner.Velocity) < 40)) || + (Normal(Owner.Velocity) Dot Normal(Tracked.Velocity) > 0.95) + ) + ) { + EndTrace += 10000 * Normal(Tracked.Location - StartTrace); + } else { + AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2.75*AimError, False, False); + EndTrace += (10000 * vector(AdjustedAim)); + } + + Tracked = None; + bBotSpecialMove = false; + + if (STM.WeaponSettings.ShockBeamUseReducedHitbox) + Other = STM.TraceShot(HitLocation, HitNormal, EndTrace, StartTrace, PawnOwner); + else + Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace); + ProcessTraceHit(Other, HitLocation, HitNormal, vector(AdjustedAim),Y,Z); +} + function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z) { local PlayerPawn PlayerOwner; diff --git a/Classes/ST_SniperRifle.uc b/Classes/ST_SniperRifle.uc index ebb3491..de16468 100644 --- a/Classes/ST_SniperRifle.uc +++ b/Classes/ST_SniperRifle.uc @@ -55,8 +55,11 @@ function TraceFire(float Accuracy) { StartTrace = Owner.Location + PawnOwner.Eyeheight * vect(0,0,1); AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2*AimError, False, False); X = vector(AdjustedAim); - EndTrace = StartTrace + 100000 * X; - Other = STM.TraceShot(HitLocation, HitNormal, EndTrace, StartTrace, PawnOwner); + EndTrace = StartTrace + 100000 * X; + if (STM.WeaponSettings.SniperUseReducedHitbox) + Other = STM.TraceShot(HitLocation, HitNormal, EndTrace, StartTrace, PawnOwner); + else + Other = PawnOwner.TraceShot(HitLocation, HitNormal, EndTrace, StartTrace); ProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z); } @@ -77,7 +80,7 @@ function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vect if (Other == Level) { Spawn(class'UT_HeavyWallHitEffect',,, HitLocation+HitNormal, Rotator(HitNormal)); } else if ((Other != self) && (Other != Owner) && (Other != None)) { - if (Other.bIsPawn && STM.CheckHeadShot(Pawn(Other), HitLocation, X) && + if (Other.bIsPawn && CheckHeadShot(Pawn(Other), HitLocation, X) && (instigator.IsA('PlayerPawn') || (instigator.IsA('Bot') && !Bot(Instigator).bNovice)) ) { Other.PlaySound(Sound 'ChunkHit',, 4.0,,100); @@ -107,6 +110,13 @@ function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vect } } +function bool CheckHeadShot(Pawn P, vector HitLocation, vector BulletDir) { + if (STM.WeaponSettings.SniperUseReducedHitbox == false) + return (HitLocation.Z - P.Location.Z > 0.62 * P.CollisionHeight); + + return STM.CheckHeadShot(P, HitLocation, BulletDir); +} + function SetSwitchPriority(pawn Other) { // Make sure "old" priorities are kept. local int i; diff --git a/Classes/ST_enforcer.uc b/Classes/ST_enforcer.uc index d552dff..173baef 100644 --- a/Classes/ST_enforcer.uc +++ b/Classes/ST_enforcer.uc @@ -35,6 +35,47 @@ function PostBeginPlay() break; // Find master :D } +function TraceFire(float Accuracy) { + local vector RealOffset; + local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z; + local Actor Other; + local Pawn PawnOwner; + + RealOffset = FireOffset; + FireOffset *= 0.35; + if ( (SlaveEnforcer != None) || bIsSlave ) + Accuracy = FClamp(3*Accuracy,0.75,3); + else if ( Owner.IsA('Bot') && !Bot(Owner).bNovice ) + Accuracy = FMax(Accuracy, 0.45); + + PawnOwner = Pawn(Owner); + + Owner.MakeNoise(PawnOwner.SoundDampening); + GetAxes(PawnOwner.ViewRotation,X,Y,Z); + StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; + AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2*AimError, False, False); + EndTrace = StartTrace + Accuracy * (FRand() - 0.5 )* Y * 1000 + + Accuracy * (FRand() - 0.5 ) * Z * 1000; + X = vector(AdjustedAim); + EndTrace += (10000 * X); + if (STM.WeaponSettings.EnforcerUseReducedHitbox) + Other = STM.TraceShot(HitLocation, HitNormal, EndTrace, StartTrace, PawnOwner); + else + Other = PawnOwner.TraceShot(HitLocation, HitNormal, EndTrace, StartTrace); + ProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z); + + FireOffset = RealOffset; + + // Higor: move slave enforcer to TraceFire start location + // to ensure firing sounds are played from the right place + if (Owner != None && (Level.NetMode == NM_DedicatedServer || Level.NetMode == NM_ListenServer)) { + if (bIsSlave && !bCollideActors) + SetLocation(Owner.Location + CalcDrawOffset()); + else if (SlaveEnforcer != None && !SlaveEnforcer.bCollideActors) + SlaveEnforcer.SetLocation(Owner.Location + SlaveEnforcer.CalcDrawOffset()); + } +} + function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z) { local UT_Shellcase s; diff --git a/Classes/WeaponSettings.uc b/Classes/WeaponSettings.uc index 112bdec..9a40398 100644 --- a/Classes/WeaponSettings.uc +++ b/Classes/WeaponSettings.uc @@ -24,7 +24,6 @@ var config bool bEnhancedSplashIgnoreStationaryPawns; var config float SplashMaxDiffraction; var config float SplashMinDiffractionDistance; -var config bool bEnhancedHeadshotDetection; var config float HeadHalfHeight; var config float HeadRadius; @@ -38,6 +37,7 @@ var config float SniperHeadshotDamage; var config float SniperMomentum; var config float SniperHeadshotMomentum; var config float SniperReloadTime; +var config bool SniperUseReducedHitbox; var config float EightballSelectTime; var config float EightballDownTime; @@ -97,6 +97,7 @@ var config float ShockSelectTime; var config float ShockDownTime; var config float ShockBeamDamage; var config float ShockBeamMomentum; +var config bool ShockBeamUseReducedHitbox; var config float ShockProjectileDamage; var config float ShockProjectileHurtRadius; var config float ShockProjectileMomentum; @@ -124,6 +125,7 @@ var config float EnforcerMomentum; var config float EnforcerReloadTime; var config float EnforcerReloadTimeAlt; var config float EnforcerReloadTimeRepeat; +var config bool EnforcerUseReducedHitbox; var config bool EnforcerAllowDouble; var config float EnforcerDamageDouble; @@ -176,7 +178,6 @@ defaultproperties SplashMaxDiffraction=0.5 SplashMinDiffractionDistance=50.0 - bEnhancedHeadshotDetection=False HeadHalfHeight=7.5 HeadRadius=10.0 @@ -190,6 +191,7 @@ defaultproperties SniperMomentum=1.0 SniperHeadshotMomentum=1.0 SniperReloadTime=0.6666666666 + SniperUseReducedHitbox=False EightballSelectTime=0.606061 EightballDownTime=0.366667 @@ -249,6 +251,7 @@ defaultproperties ShockDownTime=0.259259 ShockBeamDamage=40 ShockBeamMomentum=1.0 + ShockBeamUseReducedHitbox=False ShockProjectileDamage=55 ShockProjectileHurtRadius=70 ShockProjectileMomentum=1.0 @@ -276,6 +279,7 @@ defaultproperties EnforcerReloadTime=0.27 EnforcerReloadTimeAlt=0.26 EnforcerReloadTimeRepeat=0.266667 + EnforcerUseReducedHitbox=False EnforcerAllowDouble=True EnforcerDamageDouble=17