Skip to content

Commit

Permalink
Add Setting HitFeedbackMode
Browse files Browse the repository at this point in the history
  • Loading branch information
Deaod committed Oct 14, 2024
1 parent 5b79cee commit 16ee361
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
38 changes: 38 additions & 0 deletions Classes/IGPlus_HitFeedback.uc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class IGPlus_HitFeedback extends Mutator;
// Description="<Internal>"

var bool bCheckVisibility;

event PostBeginPlay() {
if (Level == none || Level.Game == none) {
Destroy(); // spawned client-side? wtf?
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions Classes/ServerSettings.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> ExcludeMapsForKickers;

Expand Down Expand Up @@ -132,6 +140,7 @@ function DumpServerSettings(PlayerPawn P) {
DumpSetting(P, "bEnableJitterBounding");
DumpSetting(P, "bEnableWarpFix");
DumpSetting(P, "ShowTouchedPackage");
DumpSetting(P, "HitFeedbackMode");
}

defaultproperties
Expand Down Expand Up @@ -197,4 +206,5 @@ defaultproperties
bEnableJitterBounding=False
bEnableWarpFix=True
bEnableCarcassCollision=True
HitFeedbackMode=HFM_Always
}
6 changes: 5 additions & 1 deletion Classes/UTPure.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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**
Expand Down

0 comments on commit 16ee361

Please sign in to comment.