- Code: Select all
//=============================================================================
// Blob.
//=============================================================================
class Blob expands ThrownProjectile;
var vector SurfaceNormal;
var int numBio;
var float mpDamage;
var float time;
var() float WallTime;
var bool exploded;
function Frob(Actor Frobber, Inventory frobWith)
{
}
simulated function Tick(float deltaTime)
{
local ScriptedPawn P;
local DeusExPlayer Player;
local Vector dist, HitLocation, HitNormal;
local float blinkRate, mult, skillDiff;
local float proxRelevance;
local Pawn curPawn;
local bool pass;
local Actor HitActor;
if ( Role == ROLE_Authority )
Super.Tick(deltaTime);
if(bStuck)
{
time += deltaTime;
if (time % 0.3 > 0.25)
if(time > WallTime && !exploded)
{
DrawExplosionEffects(Location, Location);
exploded=true;
HurtRadius(damage * Drawscale, FMin(100, DrawScale * 75), 'Poison', MomentumTransfer * Drawscale, Location);
GotoState('Exploding');
return;
}
}
time += deltaTime;
if ( Role == ROLE_Authority )
{
if (bDisabled)
return;
if ( (Owner == None) && ((Level.NetMode == NM_DedicatedServer) || (Level.NetMode == NM_ListenServer)) )
{
// Owner has logged out
bDisabled = False;
team = -1;
}
if (( Owner != None ) && (DeusExPlayer(Owner) != None ))
{
if ( TeamDMGame(DeusExPlayer(Owner).DXGame) != None )
{
// If they switched sides disable the grenade
if ( DeusExPlayer(Owner).PlayerReplicationInfo.team != team )
{
bDisabled = False;
team = -1;
}
}
}
// check for proximity
if (bProximityTriggered)
{
if (bArmed)
{
proxCheckTime += deltaTime;
// beep based on skill
if (skillTime != 0)
// if we have been triggered, count down based on skill
if (skillTime > 0)
skillTime -= deltaTime;
// explode if time < 0
if (skillTime < 0)
{
bDoExplode = True;
bArmed = False;
}
// DC - new ugly way of doing it - old way was "if (proxCheckTime > 0.25)"
// new way: weight the check frequency based on distance from player
proxRelevance=DistanceFromPlayer/2000.0; // at 500 units it behaves as it did before
if (proxRelevance<0.25)
proxRelevance=0.25; // low bound 1/4
else if (proxRelevance>10.0)
proxRelevance=20.0; // high bound 30
else
proxRelevance=proxRelevance*2; // out past 1.0s, double the timing
if (proxCheckTime>proxRelevance)
{
proxCheckTime = 0;
// pre-placed explosives are only prox triggered by the player
if (Owner == None)
{
foreach RadiusActors(class'DeusExPlayer', Player, proxRadius*4)
{
// the owner won't set it off, either
if (Player != Owner)
{
dist = Player.Location - Location;
if (VSize(dist) < proxRadius)
if (skillTime == 0)
skillTime = FClamp(-20.0 * Player.SkillSystem.GetSkillLevelValue(class'SkillDemolition'), 1.0, 10.0);
}
}
}
else
{
// If in multiplayer, check other players
if (( Level.NetMode == NM_DedicatedServer) || ( Level.NetMode == NM_ListenServer))
{
curPawn = Level.PawnList;
while ( curPawn != None )
{
pass = False;
if ( curPawn.IsA('DeusExPlayer') )
{
Player = DeusExPlayer( curPawn );
// Pass on owner
if ( Player == Owner )
pass = True;
// Pass on team member
else if ( (TeamDMGame(Player.DXGame) != None) && (team == player.PlayerReplicationInfo.team) )
pass = True;
// Pass if radar transparency on
else if ( Player.AugmentationSystem.GetClassLevel( class'AugRadarTrans' ) == 3 )
pass = False;
// Finally, make sure we can see them (no exploding through thin walls)
if ( !pass )
{
// Only players we can see : changed this to Trace from FastTrace so doors are included
HitActor = Trace( HitLocation, HitNormal, Player.Location, Location, True );
if (( HitActor == None ) || (DeusExPlayer(HitActor) == Player))
{
}
else
pass = True;
}
if ( !pass )
{
dist = Player.Location - Location;
if ( VSize(dist) < proxRadius )
{
if (skillTime == 0)
{
skillDiff = -skillAtSet + Player.SkillSystem.GetSkillLevelValue(class'SkillDemolition');
if ( skillDiff >= 0.0 ) // Scale goes 1.0, 1.6, 2.8, 4.0
skillTime = FClamp( 1.0 + skillDiff * 6.0, 1.0, 2.5 );
else // Scale goes 1.0, 1.4, 2.2, 3.0
skillTime = FClamp( 1.0 + (-Player.SkillSystem.GetSkillLevelValue(class'SkillDemolition') * 4.0), 1.0, 3.0 );
}
}
}
}
curPawn = curPawn.nextPawn;
}
}
else // Only have scripted pawns set off promixity grenades in single player
{
foreach RadiusActors(class'ScriptedPawn', P, proxRadius*4)
{
// only "heavy" pawns will set this off
if ((P != None) && (P.Mass >= 20))
{
// the owner won't set it off, either
if (P != Owner)
{
dist = P.Location - Location;
if (VSize(dist) < proxRadius)
if (skillTime == 0)
skillTime = 1.0;
}
}
}
}
}
}
}
}
}
}
simulated function DrawExplosionEffects(vector HitLocation, vector HitNormal)
{
local TearGas f;
local ParticleGenerator gen;
local ExplosionLightGreen light;
f = spawn(class'TearGas',,,Location + SurfaceNormal*8);
if (f != None)
{
f.RemoteRole = ROLE_None;
}
gen = Spawn(class'ParticleGenerator',,, HitLocation, Rotator(HitNormal));
if (gen != None)
{
gen.RemoteRole = ROLE_None;
gen.particleDrawScale = 0.5;
gen.checkTime = 0.05;
gen.frequency = 1.0;
gen.ejectSpeed = 200.0;
gen.bGravity = True;
gen.bRandomEject = True;
gen.particleTexture = Texture'Effects.Fire.proj_Prifle';
gen.LifeSpan = 1.5;
}
light = Spawn(class'ExplosionLightGreen',,, HitLocation);
if (light != None)
{
light.RemoteRole = ROLE_None;
light.size = 6;
}
}
auto simulated state Flying
{
simulated function ProcessTouch (Actor Other, Vector HitLocation)
{
if (bStuck)
return;
if ((Other != instigator) && (DeusExProjectile(Other) == None) &&
(Other != Owner))
{
damagee = Other;
Explode(HitLocation, Normal(HitLocation-damagee.Location));
// DEUS_EX AMSD Spawn blood server side only
if (Role == ROLE_Authority)
{
if (damagee.IsA('Pawn') && bBlood)
SpawnBlood(HitLocation, Normal(HitLocation-damagee.Location));
else if
(damagee.IsA('DeusExDecoration') && bBlood)
SpawnBlood(HitLocation, Normal(HitLocation-damagee.Location));
else if
(damagee.IsA('DeusExCarcass') && bBlood)
SpawnBlood(HitLocation, Normal(HitLocation-damagee.Location));
}
}
}
simulated function HitWall(vector HitNormal, actor Wall)
{
local vector TraceNorm, TraceLoc, Extent;
local actor HitActor;
if (bStickToWall)
{
SetPhysics(PHYS_None);
Velocity = vect(0,0,0);
Acceleration = vect(0,0,0);
PlayAnim('Hit');
bStuck = True;
SurfaceNormal = HitNormal;
if ( Level.NetMode != NM_DedicatedServer )
spawn(class'BlobPool',,,Location, rotator(SurfaceNormal));
// MBCODE: Do this only on server side
if ( Role == ROLE_Authority )
{
if (Level.NetMode != NM_Standalone)
SetTimer(5.0,False);
if (Wall.IsA('Mover'))
{
SetBase(Wall);
Wall.TakeDamage(Damage, Pawn(Owner), Wall.Location, MomentumTransfer*Normal(Velocity), damageType);
}
}
}
if (Wall.IsA('BreakableGlass'))
bDebris = False;
SpawnEffects(Location, HitNormal, Wall);
Super.HitWall(HitNormal, Wall);
}
simulated function BeginState()
{
local DeusExWeapon W;
if ( Role == ROLE_Authority )
{
Velocity = Vector(Rotation) * Speed;
if( Region.zone.bWaterZone )
Velocity=Velocity*0.7;
}
if ( Level.NetMode != NM_DedicatedServer )
RandSpin(100000);
}
}
simulated function PreBeginPlay()
{
// If this is a netgame, then override defaults
if ( Level.NetMode != NM_StandAlone )
{
DamageType='TearGas';
blastRadius=192;
bStickToWall=True;
}
if ( Level.NetMode == NM_StandAlone )
{
DamageType='TearGas';
blastRadius=128;
bStickToWall=True;
}
}
This monster of a code is my pride and joy mod weapon projectile
It sticks to walls, Explodes, and is Proximity triggered by enemies. (So it's basically a DX version of a Biorifle blob, using only DX stuff.)
The problem is, this code works a charm, except for when it's first launched, and when it's been proxy triggered. The problem is, it makes noises like a LAM, but i dont want these noises. So, if someone could help me, i would be most grateful (And there may even be a prerelease version of this, and the rest of the modpack in it for you )
Edit: There us nothing LAM noise related in the default properties.