Mostly Harmless

Legacy:EONS Vulture

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
//===========================================================
// EONS Vulture
// EONS Vulture by Wail of Suicide
//===========================================================
 
class EONSVulture extends ONSAttackCraft;
 
var rotator FanYaw,TailYaw;
var float   FanYawRate;
 
simulated function PostNetBeginPlay()
{
    Super.PostNetBeginPlay();
 
    if (Role == ROLE_Authority)
    {
        if (WeaponPawns[0]!=None)
            WeaponPawns[0].Gun.SetOwner(self);
 
        if (Weapons.Length == 2 && ONSLinkableWeapon(Weapons[0]) != None)
    {
        ONSLinkableWeapon(Weapons[0]).ChildWeapon = Weapons[1];
        if (EONSVultureWeapon(Weapons[1]) != None)
            EONSVultureWeapon(Weapons[1]).bSkipFire = True;
 
            if (EONSVultureWeapon(Weapons[0]) != None)
                EONSVultureWeapon(Weapons[0]).bFiresRight = true;
        }
 
    }
}
 
//
function TakeDamage(int Damage, Pawn instigatedBy, Vector Hitlocation, Vector Momentum, class<DamageType> DamageType)
{
    if ( (ClassIsChildOf(DamageType, class'DamTypeShockTankShockBall')) )
       Damage *= 2.00;
 
    Momentum *= 0.75; //
    Super.TakeDamage(Damage, instigatedBy, Hitlocation, Momentum, damageType);
}
 
//Ammo Stuff??? Or handle in gun
 
defaultproperties
{
     VehiclePositionString="in an EONS Vulture"
     VehicleNameString="EONS Vulture"
 
     Mesh=Mesh'ONSBPAnimations.DualAttackCraftMesh'
     RedSkin=texture'ONSBPTextures.CicadaTan'
     BlueSkin=texture'ONSBPTextures.CicadaGreen'
 
     HealthMax=900.000000
     Health=900
 
     EntryPosition=(X=0,Y=0,Z=-20)
     EntryRadius=300
     CollisionRadius=+240.0
 
     ExitPositions(0)=(X=0,Y=-400,Z=100)
     ExitPositions(1)=(X=0,Y=400,Z=100)
     ExitPositions(2)=(X=-600,Y=0,Z=100)
 
     VehicleMass=3.000000
 
     TPCamWorldOffset=(Z=350)
     TPCamDistance=1000.000000
     FanYawRate=98000
 
     IdleSound=sound'CicadaSnds.CicadaIdle'
     StartUpSound=sound'CicadaSnds.CicadaStartUp'
     ShutDownSound=sound'CicadaSnds.CicadaShutDown'
 
     TrailEffectPositions(0)=(X=250,Y=-20,Z=10);
     TrailEffectPositions(1)=(X=250,Y=20,Z=10);
     //TrailEffectClass=Class'ONS-MinusTankMeUp-)o(-Evo-V7.HammerExhaust'
 
     StreamerEffectOffset(0)=(X=-157.943192,Y=-230.908951,Z=89.714783)
     StreamerEffectOffset(1)=(X=-157.943192,Y=230.908951,Z=89.714783)
     StreamerEffectOffset(2)=(X=175.045227,Y=-265.933014,Z=-74.389023)
     StreamerEffectOffset(3)=(X=175.045227,Y=265.933014,Z=-74.389023)
 
     HeadlightCoronaOffset(0)=(X=289.538422,Y=4.749050,Z=-74.851456)
     HeadlightCoronaOffset(1)=(X=210.839508,Y=-159.415634,Z=-74.851456)
     HeadlightCoronaOffset(2)=(X=210.839508,Y=159.415634,Z=-74.851456)
 
     DriverWeapons(0)=(WeaponClass=Class'EONS-Cicada_BETA1.EONSVultureWeapon',WeaponBone=RightRLAttach)
     DriverWeapons(1)=(WeaponClass=Class'EONS-Cicada_BETA1.EONSVultureWeapon',WeaponBone=LeftRLAttach)
     //DriverWeapons(1)=(WeaponClass=Class'ONS-MinusTankMeUp-)o(-Evo-V7.HammerMinigunMaster',WeaponBone="leftminigun")
     //DriverWeapons(2)=(WeaponClass=Class'ONS-MinusTankMeUp-)o(-Evo-V7.HammerMinigun',WeaponBone="rightminigun")
 
     Begin Object Class=KarmaParamsRBFull Name=KParams0
         KInertiaTensor(0)=1.000000
         KInertiaTensor(3)=3.000000
         KInertiaTensor(5)=3.500000
         KCOMOffset=(X=-0.250000)
         KLinearDamping=0.000000
         KAngularDamping=0.000000
         KStartEnabled=True
         bKNonSphericalInertia=True
         KActorGravScale=0.000000
         bHighDetailOnly=False
         bClientOnly=False
         bKDoubleTickRate=True
         bKStayUpright=True
         bKAllowRotate=True
         bDestroyOnWorldPenetrate=True
         bDoSafetime=True
         KFriction=0.500000
         KImpactThreshold=300.000000
         Name="KParams0"
     End Object
 
     bSelected=True
 
     DestroyedVehicleMesh=StaticMesh'ONSBP_DestroyedVehicles.Cicada.DestroyedCicada'
     DestructionEffectClass=class'Onslaught.ONSVehicleExplosionEffect'
     DestructionLinearMomentum=(Min=250000,Max=400000)
     DestructionAngularMomentum=(Min=100,Max=150)
     DisintegrationHealth=-100
     DisintegrationEffectClass=class'OnslaughtBP.ONSDualACDeathExp'
}
//===========================================================
// EONS Vulture
// EONS Vulture by Wail of Suicide
//===========================================================
 
class EONSVultureWeapon extends ONSLinkableWeapon;
 
//Minigun turret
var class<Emitter>      mTracerClass< SEMI >
var() editinline Emitter mTracer;
var() float             mTracerInterval;
var() float             mTracerPullback;
var() float             mTracerMinDistance;
var() float             mTracerSpeed;
var float               mLastTracerTime;
 
//Dual AC
var bool bSkipFire;         // If true, it ignore this shot and pass it to it's linked weapon
var bool bFiresRight;       // If true, this weapon will eject shells to the right instead of the left
 
//New
var int  ShellsLoaded;              // Vultures can only load 2 shells at a time.
var float ShellReloadTime;          // Once a shell has been shot, it takes this long to reload (Fire Interval only controls how long to fire the two loaded shells)
var float ShellReloadCounter;       // Tracks progress of reloading
 
#EXEC OBJ LOAD FILE=InterfaceContent.utx
#EXEC OBJ LOAD FILE=UT2004Weapons.utx
 
////
 
static function StaticPrecache(LevelInfo L)
{
    L.AddPrecacheMaterial(Material'VMparticleTextures.TankFiringP.CloudParticleOrangeBMPtex');
    L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.TracerShot');
    L.AddPrecacheMaterial(Material'WeaponSkins.RocketShellTex');
    L.AddPrecacheMaterial(Material'XEffects.RocketFlare');
    L.AddPrecacheMaterial(Material'XEffects.SmokeAlphab_t');
    L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.TankTrail');
    L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
    L.AddPrecacheMaterial(Material'ONSInterface-TX.tankBarrelAligned');
    L.AddPrecacheMaterial(Material'VMParticleTextures.TankFiringP.TankDustKick1');
    L.AddPrecacheMaterial(Material'EmitterTextures.MultiFrame.rockchunks02');
    L.AddPrecacheMaterial(Material'EpicParticles.Smoke.SparkCloud_01aw');
    L.AddPrecacheMaterial(Material'BenTex01.Textures.SmokePuff01');
    L.AddPrecacheMaterial(Material'AW-2004Explosions.Fire.Part_explode2');
    L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.HardSpot');
}
 
simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial(Material'VMparticleTextures.TankFiringP.CloudParticleOrangeBMPtex');
    Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.TracerShot');
    Level.AddPrecacheMaterial(Material'WeaponSkins.RocketShellTex');
    Level.AddPrecacheMaterial(Material'XEffects.RocketFlare');
    Level.AddPrecacheMaterial(Material'XEffects.SmokeAlphab_t');
    Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.TankTrail');
    Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
    Level.AddPrecacheMaterial(Material'ONSInterface-TX.tankBarrelAligned');
    Level.AddPrecacheMaterial(Material'VMParticleTextures.TankFiringP.TankDustKick1');
    Level.AddPrecacheMaterial(Material'EmitterTextures.MultiFrame.rockchunks02');
    Level.AddPrecacheMaterial(Material'EpicParticles.Smoke.SparkCloud_01aw');
    Level.AddPrecacheMaterial(Material'BenTex01.Textures.SmokePuff01');
    Level.AddPrecacheMaterial(Material'AW-2004Explosions.Fire.Part_explode2');
    Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.HardSpot');
 
    Super.UpdatePrecacheMaterials();
}
 
simulated function UpdatePrecacheStaticMeshes()
{
    Level.AddPrecacheStaticMesh(StaticMesh'WeaponStaticMesh.RocketProj');
    Super.UpdatePrecacheStaticMeshes();
}
 
////
 
 
replication
{
	reliable if(bNetDirty && Role==ROLE_Authority)
		ShellsLoaded;
}
 
//Tracer
function byte BestMode()
{
    return 0;
}
 
//Tracer
simulated function Destroyed()
{
    if (mTracer != None)
        mTracer.Destroy();
 
    Super.Destroyed();
}
 
//Tracer
simulated function UpdateTracer()
{
    local vector SpawnDir, SpawnVel;
    local float hitDist;
 
    if (Level.NetMode == NM_DedicatedServer)
        return;
 
    if (mTracer == None)
    {
        mTracer = Spawn(mTracerClass);
    }
 
    if (Level.bDropDetail || Level.DetailMode == DM_Low)
        mTracerInterval = 2 * Default.mTracerInterval;
    else
        mTracerInterval = Default.mTracerInterval;
 
    if (mTracer != None && Level.TimeSeconds > mLastTracerTime + mTracerInterval)
    {
            mTracer.SetLocation(WeaponFireLocation);
 
        hitDist = VSize(LastHitLocation - WeaponFireLocation) - mTracerPullback;
 
        if (Instigator != None && Instigator.IsLocallyControlled())
            SpawnDir = vector(WeaponFireRotation);
        else
            SpawnDir = Normal(LastHitLocation - WeaponFireLocation);
 
        if(hitDist > mTracerMinDistance)
        {
            SpawnVel = SpawnDir * mTracerSpeed;
 
            mTracer.Emitters[0].StartVelocityRange.X.Min = SpawnVel.X;
            mTracer.Emitters[0].StartVelocityRange.X.Max = SpawnVel.X;
            mTracer.Emitters[0].StartVelocityRange.Y.Min = SpawnVel.Y;
            mTracer.Emitters[0].StartVelocityRange.Y.Max = SpawnVel.Y;
            mTracer.Emitters[0].StartVelocityRange.Z.Min = SpawnVel.Z;
            mTracer.Emitters[0].StartVelocityRange.Z.Max = SpawnVel.Z;
 
            mTracer.Emitters[0].LifetimeRange.Min = hitDist / mTracerSpeed;
            mTracer.Emitters[0].LifetimeRange.Max = mTracer.Emitters[0].LifetimeRange.Min;
 
            mTracer.SpawnParticle(1);
        }
 
        mLastTracerTime = Level.TimeSeconds;
    }
}
 
//Tracer
simulated function FlashMuzzleFlash()
{
    Super.FlashMuzzleFlash();
 
    if (Role < ROLE_Authority)
        DualFireOffset *= -1;
 
    UpdateTracer();
}
 
 
// ONS Weapon - Machine Gun alternating Fire
event bool AttemptFire(Controller C, bool bAltFire)
{
    if(Role != ROLE_Authority || bForceCenterAim)
        return False;
 
    if (FireCountdown <= 0)
    {
        CalcWeaponFire();
        if (bCorrectAim)
            WeaponFireRotation = AdjustAim(bAltFire);
        if (Spread > 0)
            WeaponFireRotation = rotator(vector(WeaponFireRotation) + VRand()*FRand()*Spread);
 
            DualFireOffset *= -1;
 
        Instigator.MakeNoise(1.0);
        if (bAltFire && ShellsLoaded > 0)            //Cannot Altfire unless there are shells loaded
        {
            FireCountdown = AltFireInterval;
            ShellsLoaded--;
            AltFire(C);
 
            //
            Log("AttemptFire: bAltFire && ShellsLoaded > 0: "$ShellsLoaded);
        }
        if (bAltFire && ShellsLoaded < 1)        //Play sound if no shells are loaded
        {
            PlaySound(sound'PickupSounds.FlakAmmoPickup', SLOT_Misc);
 
            //
            Log("AttemptFire: bAltFire && ShellsLoaded < 1: "$ShellsLoaded);
        }
        else
        {
            FireCountdown = FireInterval;
            GatlingFire(C, false, true);
        }
        AimLockReleaseTime = Level.TimeSeconds + FireCountdown * FireIntervalAimLock;
 
        return True;
    }
 
    return False;
}
 
 
//DualACWeapon - Machine Gun Alternating Fire
function GatlingFire(Controller C, bool bAltFire, optional bool bDontSkip)
{
    if (!bSkipFire || bDontSkip)
    {
        CalcWeaponFire();
        if (bCorrectAim)
            WeaponFireRotation = AdjustAim(false);
 
        DualFireOffset *= -1;
 
        Instigator.MakeNoise(1.0);
 
        if (bAltFire)
        {
            FireCountdown = AltFireInterval;
            AltFire(C);
        }
        else
        {
            FireCountdown = FireInterval;
            Fire(C);
        }
 
        AimLockReleaseTime = Level.TimeSeconds + FireCountdown * FireIntervalAimLock;
    }
    else
    {
        FireCountdown = FireInterval;
    }
 
    bSkipFire = !bSkipFire;
 
    if (ChildWeapon != none && EONSVultureWeapon(ChildWeapon) != None)
        EONSVultureWeapon(ChildWeapon).GatlingFire(C, bAltFire, bDontSkip);
 
}
 
 
 
//Shell Fire
state InstantFireMode
{
   function AltFire(Controller C)
   {
      if (ShellsLoaded > 0)
      {
         SpawnProjectile(ProjectileClass, False);
         //SetTimer(ShellReloadTime, false);
 
         //
         Log("InstantFireMode AltFire: ShellsLoaded = "$ShellsLoaded);
      }
      else
      {
 
      }
   }
}
 
/*
function Projectile SpawnProjectile(class<Projectile> ProjClass, bool bAltFire)
{
   if (ShellsLoaded < 1)
   {
      PlaySound(sound'PickupSounds.FlakAmmoPickup', SLOT_Misc);
      return none;
   }
   else
      Super.SpawnProjectile(ProjClass, bAltFire);
}
*/
 
/*
simulated event Timer()
{
	//
}
*/
 
simulated function Tick(float DeltaTime)
{
   if (Role == ROLE_Authority)
	   {
	      // Shells reload after the change in time exceeds the specified charge duration
	      ShellReloadCounter+=DeltaTime;
	      if (ShellReloadCounter > ShellReloadTime)
	      {
	         if (ShellsLoaded < 2)
	         {
	            ShellsLoaded++;
 
	            //
	            Log("Tick: Shells Loaded: "$ShellsLoaded);
           }
           ShellReloadCounter = 0;
 
           //
           Log("Tick: Shell Reload Counter: "$ShellReloadCounter);
	      }
	   }
 
	   Super.Tick(DeltaTime);
}
 
//Draw loading progress as chargebar
simulated function float ChargeBar()
{
    if (ShellsLoaded < 2)
       return FClamp(ShellReloadCounter/ShellReloadTime, 0.0, 0.999);
    else
       return 0.999;
}
 
 
/*
//Handle display of loaded shells
simulated function DrawWeaponInfo(Canvas Canvas)
{
    NewDrawWeaponInfo(Canvas, 0.705*Canvas.ClipY);
 
    //
    Log("DrawWeaponInfo");
}
*/
 
//Handle display of loaded shells
//simulated function NewDrawWeaponInfo(Canvas Canvas, float YPos)
simulated function DrawHud(Canvas Canvas)
{
    local int i,Count;
    local float ScaleFactor;
 
    ScaleFactor = 99 * Canvas.ClipX/3200;
    Canvas.Style = ERenderStyle.STY_Alpha;
    Canvas.DrawColor = class'HUD'.Default.WhiteColor;
    Count = Min(2, ShellsLoaded);
    for( i=0; i<Count; i++ )
    {
        Canvas.SetPos(Canvas.ClipX - (0.5*i+1) * ScaleFactor, (0.705*Canvas.ClipY));  //YPos=0.705*Canvas.ClipY
        Canvas.DrawTile( Material'HudContent.Generic.HUD', ScaleFactor, ScaleFactor, 174, 259, 46, 45);
    }
    /*
    if ( ShellsLoaded > 8 )
    {
        Count = Min(16,AmmoAmount(1));
        for( i=8; i<Count; i++ )
        {
            Canvas.SetPos(Canvas.ClipX - (0.5*(i-8)+1) * ScaleFactor, YPos - ScaleFactor);
            Canvas.DrawTile( Material'HudContent.Generic.HUD', ScaleFactor, ScaleFactor, 174, 259, 46, 45);
        }
    }
    */
 
    //
    Log("NewDrawWeaponInfo");
}
 
 
 
defaultproperties
{
  Mesh=Mesh'ONSBPAnimations.DualAttackCraftSideGunMesh'
  YawBone=RL_Right
  PitchBone=RL_Right
  WeaponFireAttachmentBone=FirePoint
 
  bShowChargingBar=true
  bInstantFire=true
  bAimable=True
  bInstantRotation=true
  bIsRepeatingFF=True
  //bAmbientFireSound=True
  bDoOffsetTrace=true
 
  AmbientEffectEmitterClass=class'Onslaught.ONSRVChainGunFireEffect'
  FireInterval=0.10
  Spread=0.10
  DamageMin=7
  DamageMax=8
  RotationsPerSecond=0.09
 
  mTracerInterval=0.06
  mTracerClass=class'XEffects.NewTracer'
  mTracerPullback=100.0
  mTracerMinDistance=0.0
  mTracerSpeed=20000.0
 
  FireSoundClass=sound'ONSVehicleSounds-S.TankMachineGun01'
  SoundVolume=255
  AmbientSoundScaling=1.3
  FireSoundVolume=70.0
  AltFireSoundVolume=70.0
 
  ShakeOffsetMag=(X=1.0,Y=1.0,Z=1.0)
  ShakeOffsetRate=(X=1000.0,Y=1000.0,Z=1000.0)
  ShakeOffsetTime=2
  ShakeRotMag=(X=50.0,Y=50.0,Z=50.0)
  ShakeRotRate=(X=10000.0,Y=10000.0,Z=10000.0)
  ShakeRotTime=2
 
  YawStartConstraint=-5000
  YawEndConstraint=5000
  PitchUpLimit=18000
  PitchDownLimit=50000
 
  AIInfo(0)=(bInstantHit=true,AimError=750)
  AIInfo(1)=(bInstantHit=true,AimError=750)
  CullDistance=+8000.0
 
  //
  ProjectileClass=class'Onslaught.ONSRocketProjectile'
  //EffectEmitterClass=class'Onslaught.ONSTankFireEffect'
  AltFireInterval=2.5
 
  ShellsLoaded=2
  ShellReloadTime=6.000000
}