# SFWeapon.SFEpBolt

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 |
    //=============================================================================
    // Spatial Fear
    // Class: SFEpBolt
    // Descripton: Subclasses of SFProjectile
    // Implements secondary fire effect for the Electric Projector.
    //				Stationary electric flash.
    //
    // Author: Markus Nuebel
    //=============================================================================

    // Electric Projector effect mesh

    class SFEpBolt extends SFProjectile;

    #exec OBJ LOAD FILE=k_GorillaTex.utx PACKAGE=k_GorillaTex GROUP=FX
    #exec OBJ LOAD FILE=SPF-Content.uax  PACKAGE=SPF-Content GROUP=Weapons

    #exec mesh import mesh=epbolt1 anivfile=Models\epbolt_a.3d datafile=Models\epbolt_d.3d x=0 y=505 z=0 mlod=0
    #exec mesh origin mesh=epbolt1 x=0 y=505 z=0 yaw=64
    #exec mesh sequence mesh=epbolt1 seq=All startframe=0 numframes=1
    #exec meshmap new meshmap=epbolt1 mesh=epbolt1
    #exec meshmap scale meshmap=epbolt1 x=0.12500 y=0.100 z=0.250000

    #exec mesh import mesh=epbolt2 anivfile=Models\epbolt_a.3d datafile=Models\epbolt_d.3d x=0 y=505 z=0 mlod=0
    #exec mesh origin mesh=epbolt2 x=0 y=505 z=0 yaw=64
    #exec mesh sequence mesh=epbolt2 seq=All startframe=0 numframes=1
    #exec meshmap new meshmap=epbolt2 mesh=epbolt2
    #exec meshmap scale meshmap=epbolt2 x=0.12500 y=0.200 z=0.250000

    #exec mesh import mesh=epbolt3 anivfile=Models\epbolt_a.3d datafile=Models\epbolt_d.3d x=0 y=505 z=0 mlod=0
    #exec mesh origin mesh=epbolt3 x=0 y=505 z=0 yaw=64
    #exec mesh sequence mesh=epbolt3 seq=All startframe=0 numframes=1
    #exec meshmap new meshmap=epbolt3 mesh=epbolt3
    #exec meshmap scale meshmap=epbolt3 x=0.12500 y=0.300 z=0.25000

    #exec mesh import mesh=epbolt4 anivfile=Models\epbolt_a.3d datafile=Models\epbolt_d.3d x=0 y=505 z=0 mlod=0
    #exec mesh origin mesh=epbolt4 x=0 y=505 z=0 yaw=64
    #exec mesh sequence mesh=epbolt4 seq=All startframe=0 numframes=1
    #exec meshmap new meshmap=epbolt4 mesh=epbolt4
    #exec meshmap scale meshmap=epbolt4 x=0.12500 y=0.400 z=0.25000

    #exec mesh import mesh=epbolt5 anivfile=Models\epbolt_a.3d datafile=Models\epbolt_d.3d x=0 y=505 z=0 mlod=0
    #exec mesh origin mesh=epbolt5 x=0 y=505 z=0 yaw=64
    #exec mesh sequence mesh=epbolt5 seq=All startframe=0 numframes=1
    #exec meshmap new meshmap=epbolt5 mesh=epbolt5
    #exec meshmap scale meshmap=epbolt5 x=0.12500 y=0.500 z=0.25000

    #exec mesh import mesh=epbolt6 anivfile=Models\epbolt_a.3d datafile=Models\epbolt_d.3d x=0 y=505 z=0 mlod=0
    #exec mesh origin mesh=epbolt6 x=0 y=505 z=0 yaw=64
    #exec mesh sequence mesh=epbolt6 seq=All startframe=0 numframes=1
    #exec meshmap new meshmap=epbolt6 mesh=epbolt6
    #exec meshmap scale meshmap=epbolt6 x=0.12500 y=0.600 z=0.25000

    #exec mesh import mesh=epbolt7 anivfile=Models\epbolt_a.3d datafile=Models\epbolt_d.3d x=0 y=505 z=0 mlod=0
    #exec mesh origin mesh=epbolt7 x=0 y=505 z=0 yaw=64
    #exec mesh sequence mesh=epbolt7 seq=All startframe=0 numframes=1
    #exec meshmap new meshmap=epbolt7 mesh=epbolt7
    #exec meshmap scale meshmap=epbolt7 x=0.12500 y=0.700 z=0.25000

    var float m_fRange;

    var int SpriteFrame;
    var PBolt PlasmaBeam;
    var SFElectroCap WallEffect;
    var vector FireOffset;
    var bool bRight, bCenter;
    var float AccumulatedDamage, LastHitTime;
    var Actor DamagedActor;
    var rotator AimRotation;

    replication
    {
    	// Things the server should send to the client.
    	unreliable if( Role==ROLE_Authority )
    		bRight, bCenter;
    }

    simulated function Tick(float DeltaTime)
    {
    	local vector X,Y,Z, AimSpot, DrawOffset, AimStart;
    	local int YawErr;
    	local float dAdjust;
    	local Bot MyBot;

    	// orient with respect to instigator
    	if ( Instigator != None )
    	{
    		AimRotation = Instigator.ViewRotation;
    		SetRotation(AimRotation);
    		Drawoffset = Instigator.Weapon.CalcDrawOffset();
    		GetAxes(Instigator.ViewRotation,X,Y,Z);

    		if ( bCenter )
    		{
    			FireOffset.Z = Default.FireOffset.Z * 1.5;
    			FireOffset.Y = 0;
    		}
    		else
    		{
    			FireOffset.Z = Default.FireOffset.Z;
    			if ( bRight )
    			{
    				FireOffset.Y = Default.FireOffset.Y;
    			}
    			else
    			{
    				FireOffset.Y = -1 * Default.FireOffset.Y;
    			}
    		}
    		SetLocation(Instigator.Location + DrawOffset + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z);
    	}
    	else
    		GetAxes(Rotation,X,Y,Z);

    	CheckBeam(X, DeltaTime);
    }

    simulated function Destroyed()
    {
    	Super.Destroyed();
    	if ( WallEffect != None )
    		WallEffect.Destroy();
    }

    simulated function adjustBeamToMax()
    {
    	Mesh=Mesh'epbolt7';
    	DrawScale=1.0f;
    }

    simulated function adjustBeam(vector HitLocation)
    {
    	local float	fDist;
    	local int	nSection;

    	fDist		= VSize(HitLocation - Location);
    	nSection	= int(fDist/100);
    	switch(nSection)
    	{
    		case 0:
    		case 1:
    			Mesh = Mesh'epbolt1';
    			DrawScale	= fDist/100;;
    			break;
    		case 2:
    			Mesh = Mesh'epbolt2';
    			DrawScale	= fDist/200;;
    			break;
    		case 3:
    			Mesh = Mesh'epbolt3';
    			DrawScale	= fDist/300;;
    			break;
    		case 4:
    			Mesh = Mesh'epbolt4';
    			DrawScale	= fDist/400;;
    			break;
    		case 5:
    			Mesh = Mesh'epbolt5';
    			DrawScale	= fDist/500;;
    			break;
    		case 6:
    			Mesh = Mesh'epbolt6';
    			DrawScale	= fDist/600;;
    			break;
    		default:
    			Mesh = Mesh'epbolt7';
    			DrawScale	= 1.0;
    			break;
    	}
    	DrawScale	*= 1.2;
    }

    simulated function CheckBeam(vector X, float DeltaTime)
    {
    	local actor HitActor;
    	local vector HitLocation, HitNormal;

    	// check to see if hits something, else spawn or orient child
    	HitActor = Trace(HitLocation, HitNormal, Location + m_fRange * X, Location, true);
    	if ( (HitActor != None)	&& (HitActor != Instigator)
    		&& (HitActor.bProjTarget || (HitActor == Level) || (HitActor.bBlockActors && HitActor.bBlockPlayers))
    		&& ((Pawn(HitActor) == None) || Pawn(HitActor).AdjustHitLocation(HitLocation, Velocity)) )
    	{
    		adjustBeam(HitLocation);

    		if ( Level.Netmode != NM_Client )
    		{

    			if ( DamagedActor == None )
    			{
    				AccumulatedDamage = FMin(0.5 * (Level.TimeSeconds - LastHitTime), 0.1);
    				HitActor.TakeDamage(damage * AccumulatedDamage, instigator,HitLocation,
    					(MomentumTransfer * X * AccumulatedDamage), MyDamageType);
    				AccumulatedDamage = 0;
    			}
    			else if ( DamagedActor != HitActor )
    			{
    				DamagedActor.TakeDamage(damage * AccumulatedDamage, instigator,HitLocation,
    					(MomentumTransfer * X * AccumulatedDamage), MyDamageType);
    				AccumulatedDamage = 0;
    			}
    			LastHitTime = Level.TimeSeconds;
    			DamagedActor = HitActor;
    			AccumulatedDamage += DeltaTime;
    			if ( AccumulatedDamage > 0.22 )
    			{
    				if ( DamagedActor.IsA('Carcass') && (FRand() < 0.09) )
    					AccumulatedDamage = 35/damage;
    				DamagedActor.TakeDamage(damage * AccumulatedDamage, instigator,HitLocation,
    					(MomentumTransfer * X * AccumulatedDamage), MyDamageType);
    				AccumulatedDamage = 0;
    			}
    		}
    		if ( HitActor.bIsPawn  )
    		{
    			if ( WallEffect != None )
    				WallEffect.Destroy();
    		}
    		else if ( (WallEffect == None) || WallEffect.bDeleteMe )
    			WallEffect = Spawn(class'SFElectroCap',,, HitLocation - 5 * X);
    		else if ( !WallEffect.IsA('SFElectroCap') )
    		{
    			WallEffect.Destroy();
    			WallEffect = Spawn(class'SFElectroCap',,, HitLocation - 5 * X);
    		}
    		else
    			WallEffect.SetLocation(HitLocation - 5 * X);

    		if ( (WallEffect != None) && (Level.NetMode != NM_DedicatedServer) )
    			Spawn(ExplosionDecal,,,HitLocation,rotator(HitNormal));

    		return;
    	}
    	else if ( (Level.Netmode != NM_Client) && (DamagedActor != None) )
    	{
    		adjustBeam(DamagedActor.Location);

    		DamagedActor.TakeDamage(damage * AccumulatedDamage, instigator, DamagedActor.Location - X * 1.2 * DamagedActor.CollisionRadius,
    			(MomentumTransfer * X * AccumulatedDamage), MyDamageType);
    		AccumulatedDamage = 0;
    		DamagedActor = None;
    	}
    	else
    		adjustBeamToMax();

    	// Nothing hit
    	if(None != WallEffect)
    	{
    		WallEffect.Destroy();
    		WallEffect = None;
    	}
    }

    //     AmbientSound=Sound'Botpack.PulseGun.PulseBolt'

    defaultproperties
    {
         m_fRange=700.000000
         FireOffset=(X=39.000000,Y=11.000000,Z=-9.000000)
         bRight=True
         MaxSpeed=0.000000
         Damage=60.000000
         MyDamageType=zapped
         ExplosionDecal=Class'Botpack.BoltScorch'
         bNetTemporary=False
         Physics=PHYS_None
         RemoteRole=ROLE_SimulatedProxy
         LifeSpan=60.000000
         Style=STY_Translucent
         Mesh=Mesh'SFWeapon.epbolt1'
         bUnlit=True
         MultiSkins(0)=FireTexture'k_GorillaTex.FX.epbolt1'
         MultiSkins(1)=FireTexture'k_GorillaTex.FX.epbolt3'
         MultiSkins(2)=FireTexture'k_GorillaTex.FX.epbolt2'
         SoundRadius=12
         SoundVolume=255
         bCollideActors=False
         bCollideWorld=False
    }

class file time: 12/7/2003 3:58:26 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX