Legacy:EONSMineLayer - Unreal Wiki

# Legacy:EONSMineLayer

### From Unreal Wiki, The Unreal Engine Documentation Site

Status: Finished. Feel free to use code derived from this weapon, but please provide credit to me in the comments and/or ReadMe file of your new creation.

Description: The EONS Mine Layer is a modification of the UT2004 ONS Mine Layer intended to alter the functionality of the Mine Layer to make it an effective anti-vehicle weapon and reduce its effectiveness as an anti-infantry weapon.

New Features:

1. Mines deploy on primary fire at a much higher velocity. Mines are significantly faster, respond to enemies in a larger area, but do not track enemies on foot. Mines will still detonate if they come in direct contact with enemy infantry.

2. Maximum number of deployable mines has been reduced from 8 to 4.

3. In team-based gametypes, the EONS Mine Layer's secondary fire targeting laser is team-colored.

Current code is provided below.

    //========================================================================
    // EONSMineLayer
    // EONS Mine Layer by Wail of Suicide
    // Feel free to use this content in any maps you create, but please provide credit in the readme.
    // Contact: wailofsuicide@gmail.com - Comments and suggestions welcome.
    //========================================================================

    class EONSMineLayer extends ONSMineLayer;

    simulated function NewDrawWeaponInfo(Canvas Canvas, float YPos)
    {
        local int i;
        local float ScaleFactor;

        ScaleFactor = 99 * Canvas.ClipX/3200;
        Canvas.Style = ERenderStyle.STY_Alpha;
        Canvas.DrawColor = class'HUD'.Default.WhiteColor;
        for (i = 0; i < MaxMines; i++)
        {
            if (i >= CurrentMines)
                Canvas.DrawColor = FadedColor;
            Canvas.SetPos(Canvas.ClipX - (i+1) * ScaleFactor * 1.25, YPos);
            Canvas.DrawTile(Material'HudContent.Generic.HUD', ScaleFactor, ScaleFactor, 391, 383, 44, 49);
        }
    }

    defaultproperties
    {
     ItemName="EONS Mine Layer"
     Description="The Anti-Vehicular Spider Mine Layer is used for deploying spider mines, autonomous mobile mines that are highly effective against vehicles. While the mines to not track infantry, they will explode upon contact with enemy soldiers."
     FireModeClass(0)=class'EONS-MineLayer_BETA1.EONSMineThrowFire'
     FireModeClass(1)=class'EONS-MineLayer_BETA1.EONSMineLayerAltFire'
     PickupClass=class'EONS-MineLayer_BETA1.EONSMineLayerPickup'
     GroupOffset=10
     MaxMines=4
    }

    //========================================================================
    // EONSMineThrowFire
    // EONS Mine Layer by Wail of Suicide
    //========================================================================

    class EONSMineThrowFire extends ONSMineThrowFire;

    defaultproperties
    {
        ProjectileClass=class'EONS-MineLayer_BETA1.EONSMineProjectile'
        RedMineClass=class'EONS-MineLayer_BETA1.EONSMineProjectileRED'
        BlueMineClass=class'EONS-MineLayer_BETA1.EONSMineProjectileBLUE'
    }

    //========================================================================
    // EONSMineProjectile
    // EONS Mine Layer by Wail of Suicide
    // Projectile launched by EONSMineLayer -- Mines chase only vehicles.
    //========================================================================

    class EONSMineProjectile extends ONSMineProjectile;

    function AcquireTarget()
    {
        local Vehicle A;
        local xPawn B;
        local float Dist, BestDist;

        TargetPawn = None;

        foreach VisibleCollidingActors(class'Vehicle', A, 4096.0)
        {
            if ( A != Instigator && A.Health > 0 && A.GetTeamNum() != TeamNum
            && A.Driver != None && (ONSStationaryWeaponPawn(A) == None || ONSStationaryWeaponPawn(A).bPowered) )
            {
                Dist = VSize(A.Location - Location);
                if (TargetPawn == None || Dist < BestDist)
                {
                    TargetPawn = A;
                    BestDist = Dist;
                }
            }
        }

        foreach VisibleCollidingActors(class'xPawn', B, 16.0)
        {
            if ( B != Instigator && B.Health > 0 && B.GetTeamNum() != TeamNum )
            {
                Dist = VSize(B.Location - Location);
                if (TargetPawn == None || Dist < BestDist)
                {
                    TargetPawn = B;
                    BestDist = Dist;
                }
            }
        }
    }

    simulated function PhysicsVolumeChange( PhysicsVolume Volume )
    {
        if (Volume.bWaterVolume)
        {
            BlowUp(Location);
        }
    }

    defaultproperties
    {
        MyDamageType=class'EONS-MineLayer_BETA1.DamTypeEONSMineProjectile'
        Damage=50.000
        Speed=1500.0
        MaxSpeed=4000.0
        ScurryAnimRate=6.2
        ScurrySpeed=925.0

        bUnlit=false
    }

    //========================================================================
    // EONSMineProjectileBLUE
    // EONS Mine Layer by Wail of Suicide
    //========================================================================

    class EONSMineProjectileBLUE extends EONSMineProjectile;

    defaultproperties
    {
        Skins(0)=Texture'VMWeaponsTX.PlayerWeaponsGroup.SpiderMineBLUETEX'
        Skins(1)=Texture'VMWeaponsTX.PlayerWeaponsGroup.SpiderMineBLUETEX'
        TeamNum=1
    }

    //========================================================================
    // EONSMineProjectileRED
    // EONS Mine Layer by Wail of Suicide
    //========================================================================

    class EONSMineProjectileRED extends EONSMineProjectile;

    defaultproperties
    {
        Skins(0)=Texture'VMWeaponsTX.PlayerWeaponsGroup.SpiderMineTEX'
        Skins(1)=Texture'VMWeaponsTX.PlayerWeaponsGroup.SpiderMineTEX'
        TeamNum=0
    }

    //========================================================================
    // EONSMineLayerAltFire
    // EONS Mine Layer by Wail of Suicide
    //========================================================================

    class EONSMineLayerAltFire extends ONSMineLayerAltFire;

    var class<ONSMineLayerTargetBeamEffect> TeamBeamClasses[2];

    simulated function ModeTick(float deltaTime)
    {
        local vector HitLocation, HitNormal, StartTrace, EndTrace, X, Y, Z;
        local rotator Aim;
        local Actor Other;
        local int i;

        if (!bIsFiring)
            return;

           Weapon.GetViewAxes(X,Y,Z);

        // the to-hit trace always starts right in front of the eye
        StartTrace = Instigator.Location + Instigator.EyePosition() + X*Instigator.CollisionRadius;
        Aim = AdjustAim(StartTrace, AimError);
        X = Vector(Aim);
        EndTrace = StartTrace + TraceRange * X;

        Other = Weapon.Trace(HitLocation, HitNormal, EndTrace, StartTrace, false);
        if (Other == None || Other == Instigator)
            HitLocation = EndTrace;

        if (Beam == None)
        {
            if (Weapon.Role == ROLE_Authority)
            {
                 if ( (Instigator.PlayerReplicationInfo.Team != None) && (Instigator.PlayerReplicationInfo.Team.TeamIndex == 1) )
                     Beam = Weapon.spawn(TeamBeamClasses[1],,, Instigator.Location);
                 else
                     Beam = Weapon.spawn(TeamBeamClasses[0],,, Instigator.Location);
            }
            else
                foreach Weapon.DynamicActors(class'ONSMineLayerTargetBeamEffect', Beam)
                    break;
        }

        if (Beam != None)
            Beam.EndEffect = HitLocation;

        if (bDoHit)
            for (i = 0; i < Gun.Mines.Length; i++)
            {
                if (Gun.Mines[i] == None)
                {
                    Gun.Mines.Remove(i, 1);
                    i--;
                }
                else if (ONSMineProjectile(Gun.Mines[i]) != None)
                    ONSMineProjectile(Gun.Mines[i]).SetScurryTarget(HitLocation);
            }
    }

    defaultproperties
    {
     TeamBeamClasses(0)=class'Onslaught.ONSMineLayerTargetBeamEffect'
     TeamBeamClasses(1)=class'EONS-MineLayer_BETA1.EONSMineLayerTargetBeamEffectBlue'
    }

    //========================================================================
    // EONSMineLayerTargetBeamEffectBlue
    // EONS Mine Layer by Wail of Suicide
    //========================================================================

    class EONSMineLayerTargetBeamEffectBlue extends ONSMineLayerTargetBeamEffect;

    defaultproperties
    {
     Begin Object Class=BeamEmitter Name=BeamEmitter0
            BeamDistanceRange=(Min=10000.000000,Max=10000.000000)
            DetermineEndPointBy=PTEP_Distance
            BeamTextureUScale=16.000000
            RotatingSheets=3
            LowFrequencyPoints=2
            HighFrequencyPoints=2
            AutomaticInitialSpawning=False
            ColorScale(0)=(Color=(B=192))
            ColorScale(1)=(RelativeTime=0.500000,Color=(B=255,G=64,R=64))
            ColorScale(2)=(RelativeTime=1.000000,Color=(B=255))
            ColorMultiplierRange=(X=(Min=0.000000,Max=0.000000),Y=(Min=0.000000,Max=0.000000),Z=(Min=0.500000,Max=0.500000))
            MaxParticles=1
            UseRotationFrom=PTRS_Actor
            StartSizeRange=(X=(Min=10.000000,Max=10.000000),Y=(Min=10.000000,Max=10.000000))
            InitialParticlesPerSecond=5000.000000
            Texture=Texture'AW-2004Particles.Weapons.BeamFragment'
            LifetimeRange=(Min=0.020000,Max=0.020000)
            StartVelocityRange=(X=(Min=1.000000,Max=1.000000))
        End Object
        Emitters(0)=BeamEmitter'BeamEmitter0'

        bNetInitialRotation=true
        bNoDelete=false
        AutoDestroy=true
        RemoteRole=ROLE_SimulatedProxy
        bUpdateSimulatedPosition=true
        bReplicateInstigator=true

        EffectOffset=(X=-5,Y=15,Z=20)
    }

    //========================================================================
    // EONSMineLayerPickup
    // EONS Mine Layer by Wail of Suicide
    //========================================================================

    class EONSMineLayerPickup extends ONSMineLayerPickup;

    defaultproperties
    {
        InventoryType=class'EONS-MineLayer_BETA1.EONSMineLayer'
        PickupMessage="You got the EONS Mine Layer."

        MaxDesireability=+0.65
    }

##### Views

- Legacy
- Discussion
- Current revision

##### Search