Skip to content

Commit

Permalink
Added ShockProjectileBlockFlakChunk & ShockProjectileBlockFlakSlug Se…
Browse files Browse the repository at this point in the history
…ttings (#27)

These two settings control whether Flak Cannon primary fire chunks and secondary fire slugs can pass through Shock Balls.
  • Loading branch information
rxut authored Oct 19, 2024
1 parent 16ee361 commit 8423f20
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
28 changes: 26 additions & 2 deletions Classes/ST_FlakSlug.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Classes/ST_UTChunk.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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)) )
{
Expand Down
4 changes: 4 additions & 0 deletions Classes/WeaponSettings.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -257,6 +259,8 @@ defaultproperties
ShockProjectileHurtRadius=70
ShockProjectileMomentum=1.0
ShockProjectileBlockBullets=True
ShockProjectileBlockFlakChunk=True
ShockProjectileBlockFlakSlug=True
ShockProjectileTakeDamage=False
ShockProjectileCompensatePing=False
ShockProjectileHealth=30
Expand Down
9 changes: 9 additions & 0 deletions Classes/WeaponSettingsRepl.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -201,6 +203,8 @@ replication {
ShockProjectileHurtRadius,
ShockProjectileMomentum,
ShockProjectileBlockBullets,
ShockProjectileBlockFlakChunk,
ShockProjectileBlockFlakSlug,
ShockProjectileTakeDamage,
ShockProjectileCompensatePing,
ShockProjectileHealth,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -691,6 +698,8 @@ defaultproperties
ShockProjectileHurtRadius=70
ShockProjectileMomentum=1.0
ShockProjectileBlockBullets=True
ShockProjectileBlockFlakChunk=True
ShockProjectileBlockFlakSlug=True
ShockProjectileTakeDamage=False
ShockProjectileCompensatePing=False
ShockProjectileHealth=30
Expand Down

0 comments on commit 8423f20

Please sign in to comment.