From 8423f2007b66eda162c2d02d2f99a405c9960ceb Mon Sep 17 00:00:00 2001 From: rX <126023192+rxut@users.noreply.github.com> Date: Sat, 19 Oct 2024 08:34:58 +0100 Subject: [PATCH] Added ShockProjectileBlockFlakChunk & ShockProjectileBlockFlakSlug Settings (#27) These two settings control whether Flak Cannon primary fire chunks and secondary fire slugs can pass through Shock Balls. --- Classes/ST_FlakSlug.uc | 28 ++++++++++++++++++++++++++-- Classes/ST_UTChunk.uc | 4 ++++ Classes/WeaponSettings.uc | 4 ++++ Classes/WeaponSettingsRepl.uc | 9 +++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/Classes/ST_FlakSlug.uc b/Classes/ST_FlakSlug.uc index 0427ec58..e19d3625 100644 --- a/Classes/ST_FlakSlug.uc +++ b/Classes/ST_FlakSlug.uc @@ -7,11 +7,35 @@ class ST_FlakSlug extends flakslug; var ST_Mutator STM; +var WeaponSettingsRepl WSettings; + +simulated final function WeaponSettingsRepl FindWeaponSettings() { + local WeaponSettingsRepl S; + + foreach AllActors(class'WeaponSettingsRepl', S) + return S; + + return none; +} + +simulated final function WeaponSettingsRepl GetWeaponSettings() { + if (WSettings != none) + return WSettings; + + WSettings = FindWeaponSettings(); + return WSettings; +} function ProcessTouch (Actor Other, vector HitLocation) { - if ( Other != instigator ) - NewExplode(HitLocation,Normal(HitLocation-Other.Location), Other.IsA('Pawn')); + + if (Other == Instigator) + return; + + if (Other.IsA('ShockProj') && GetWeaponSettings().ShockProjectileBlockFlakSlug == false) + return; // If ShockProjectileBlockFlakSlug is False, we do nothing and the flak slug passes through + + NewExplode(HitLocation, Normal(HitLocation-Other.Location), Other.IsA('Pawn')); } function NewExplode(vector HitLocation, vector HitNormal, bool bDirect) diff --git a/Classes/ST_UTChunk.uc b/Classes/ST_UTChunk.uc index dc0ff1e4..4e7a7987 100644 --- a/Classes/ST_UTChunk.uc +++ b/Classes/ST_UTChunk.uc @@ -18,6 +18,10 @@ function ProcessTouch (Actor Other, vector HitLocation) if (Physics == PHYS_None) return; + + // For ShockProjectileBlockFlakChunk + if (ShockProj(Other) != None && !Chunkie.STM.WeaponSettings.ShockProjectileBlockFlakChunk) + return; if ( (Chunk(Other) == None) && ((Physics == PHYS_Falling) || (Other != Instigator)) ) { diff --git a/Classes/WeaponSettings.uc b/Classes/WeaponSettings.uc index f918350f..a3146171 100644 --- a/Classes/WeaponSettings.uc +++ b/Classes/WeaponSettings.uc @@ -102,6 +102,8 @@ var config float ShockProjectileDamage; var config float ShockProjectileHurtRadius; var config float ShockProjectileMomentum; var config bool ShockProjectileBlockBullets; +var config bool ShockProjectileBlockFlakChunk; +var config bool ShockProjectileBlockFlakSlug; var config bool ShockProjectileTakeDamage; var config bool ShockProjectileCompensatePing; var config float ShockProjectileHealth; @@ -257,6 +259,8 @@ defaultproperties ShockProjectileHurtRadius=70 ShockProjectileMomentum=1.0 ShockProjectileBlockBullets=True + ShockProjectileBlockFlakChunk=True + ShockProjectileBlockFlakSlug=True ShockProjectileTakeDamage=False ShockProjectileCompensatePing=False ShockProjectileHealth=30 diff --git a/Classes/WeaponSettingsRepl.uc b/Classes/WeaponSettingsRepl.uc index 8521cdf5..fb50e717 100644 --- a/Classes/WeaponSettingsRepl.uc +++ b/Classes/WeaponSettingsRepl.uc @@ -75,6 +75,8 @@ var float ShockProjectileDamage; var float ShockProjectileHurtRadius; var float ShockProjectileMomentum; var bool ShockProjectileBlockBullets; +var bool ShockProjectileBlockFlakChunk; +var bool ShockProjectileBlockFlakSlug; var bool ShockProjectileTakeDamage; var bool ShockProjectileCompensatePing; var float ShockProjectileHealth; @@ -201,6 +203,8 @@ replication { ShockProjectileHurtRadius, ShockProjectileMomentum, ShockProjectileBlockBullets, + ShockProjectileBlockFlakChunk, + ShockProjectileBlockFlakSlug, ShockProjectileTakeDamage, ShockProjectileCompensatePing, ShockProjectileHealth, @@ -526,6 +530,9 @@ function InitFromWeaponSettings(WeaponSettings S) { ShockProjectileHurtRadius = S.ShockProjectileHurtRadius; ShockProjectileMomentum = S.ShockProjectileMomentum; ShockProjectileBlockBullets = S.ShockProjectileBlockBullets; + ShockProjectileBlockFlakChunk = S.ShockProjectileBlockFlakChunk; + ShockProjectileBlockFlakSlug = S.ShockProjectileBlockFlakSlug; + ShockProjectileTakeDamage = S.ShockProjectileTakeDamage; ShockProjectileCompensatePing = S.ShockProjectileCompensatePing; ShockProjectileHealth = S.ShockProjectileHealth; @@ -691,6 +698,8 @@ defaultproperties ShockProjectileHurtRadius=70 ShockProjectileMomentum=1.0 ShockProjectileBlockBullets=True + ShockProjectileBlockFlakChunk=True + ShockProjectileBlockFlakSlug=True ShockProjectileTakeDamage=False ShockProjectileCompensatePing=False ShockProjectileHealth=30