diff --git a/Classes/IGPlus_HitFeedback.uc b/Classes/IGPlus_HitFeedback.uc index a22b62f..6794911 100644 --- a/Classes/IGPlus_HitFeedback.uc +++ b/Classes/IGPlus_HitFeedback.uc @@ -1,6 +1,8 @@ class IGPlus_HitFeedback extends Mutator; // Description="" +var bool bCheckVisibility; + event PostBeginPlay() { if (Level == none || Level.Game == none) { Destroy(); // spawned client-side? wtf? @@ -43,6 +45,39 @@ function ModifyPlayer(Pawn P) { CreateTracker(P); } +function bool CheckVisibility(Pawn Orig, Pawn Dest) { + local rotator DirYaw; + local vector X,Y,Z; + local vector Start; + local vector End[7]; + local int i; + + if (bCheckVisibility == false) + return true; + + DirYaw = rotator(Dest.Location - Orig.Location); + DirYaw.Pitch = 0; + DirYaw.Roll = 0; + + GetAxes(DirYaw,X,Y,Z); + + Start = Orig.Location + vect(0,0,1)*Orig.BaseEyeHeight; + + End[0] = Dest.Location; // center + End[1] = End[0] + Y*Dest.CollisionRadius + Z*Dest.CollisionHeight; // top left + End[2] = End[0] - Y*Dest.CollisionRadius + Z*Dest.CollisionHeight; // top right + End[3] = End[0] + Y*Dest.CollisionRadius; // center left + End[4] = End[0] - Y*Dest.CollisionRadius; // center right + End[5] = End[0] + Y*Dest.CollisionRadius - Z*Dest.CollisionHeight; // bottom left + End[6] = End[0] - Y*Dest.CollisionRadius - Z*Dest.CollisionHeight; // bottom right + + for (i = 0; i < arraycount(End); ++i) + if (FastTrace(End[i], Start)) + return true; + + return false; +} + function MutatorTakeDamage( out int ActualDamage, Pawn Victim, @@ -56,6 +91,9 @@ function MutatorTakeDamage( local IGPlus_HitFeedbackTracker Tracker; if (InstigatedBy != none && Victim != none) { + if (CheckVisibility(InstigatedBy, Victim) == false) + return; + Tracker = FindTracker(Victim); if (Tracker != none) TotalDamage = Tracker.LastDamage; diff --git a/Classes/ServerSettings.uc b/Classes/ServerSettings.uc index 54664a1..939266a 100644 --- a/Classes/ServerSettings.uc +++ b/Classes/ServerSettings.uc @@ -80,6 +80,14 @@ var config bool bEnableWarpFix; var config bool bEnableCarcassCollision; var config bool ShowTouchedPackage; +enum EHitFeedbackMode { + HFM_Disabled, + HFM_VisibleOnly, + HFM_Always +}; + +var config EHitFeedbackMode HitFeedbackMode; + //Add the maplist where kickers will work using normal network var config array ExcludeMapsForKickers; @@ -132,6 +140,7 @@ function DumpServerSettings(PlayerPawn P) { DumpSetting(P, "bEnableJitterBounding"); DumpSetting(P, "bEnableWarpFix"); DumpSetting(P, "ShowTouchedPackage"); + DumpSetting(P, "HitFeedbackMode"); } defaultproperties @@ -197,4 +206,5 @@ defaultproperties bEnableJitterBounding=False bEnableWarpFix=True bEnableCarcassCollision=True + HitFeedbackMode=HFM_Always } diff --git a/Classes/UTPure.uc b/Classes/UTPure.uc index 515641b..105dd9f 100644 --- a/Classes/UTPure.uc +++ b/Classes/UTPure.uc @@ -20,6 +20,7 @@ var string zzDefaultPackages[8]; // Auto Pause Handler var PureAutoPause zzAutoPauser; +var IGPlus_HitFeedback MutHitFeedback; //Add the maplist where kickers will work using normal network var bool bExludeKickers; @@ -243,7 +244,10 @@ function PostBeginPlay() Spawn(class'NN_SpawnNotify'); Spawn(class'IGPlus_UnlagPause'); Spawn(class'IGPlus_CarcassSpawnNotify').bEnableCarcassCollision = Settings.bEnableCarcassCollision; - Spawn(class'IGPlus_HitFeedback'); + if (Settings.HitFeedbackMode != HFM_Disabled) { + MutHitFeedback = Spawn(class'IGPlus_HitFeedback'); + MutHitFeedback.bCheckVisibility = (Settings.HitFeedbackMode == HFM_VisibleOnly); + } if (Settings.NNAnnouncer) Spawn(class'NNAnnouncerSA'); diff --git a/README.md b/README.md index debc75d..60fc9a2 100644 --- a/README.md +++ b/README.md @@ -983,6 +983,7 @@ Server settings can be found inside InstaGibPlus.ini. 1. [bEnableCarcassCollision](#benablecarcasscollision) 1. [ShowTouchedPackage](#showtouchedpackage) 1. [ExcludeMapsForKickers](#excludemapsforkickers) +1. [HitFeedbackMode](#hitfeedbackmode) 1. [ForcedSettings](#forcedsettings) ## HeadshotDamage @@ -1230,6 +1231,17 @@ Config list of supported player packs ## bForceDefaultHitSounds **Reserved** +## HitFeedbackMode + +**Type: EHitFeedbackMode** +**Default: HFM_Always** + +Determines how server-side hit feedback is handled. + +* `HFM_Disabled`: No feedback to clients +* `HFM_VisibleOnly`: Feedback only if client can see the victim +* `HFM_Always`: Feedback always provided + ## TeleRadius **Type: int**