## XIIIMP
Class XIIIMPDuckMutator

source: C:\XIII\XIIIMP\Classes\XIIIMPDuckMutator.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Info
             |
             +--Engine.Mutator
                |
                +--XIIIMP.XIIIMPMutator
                   |
                   +--XIIIMP.MPBombMutator
                      |
                      +--XIIIMP.XIIIMPDuckMutator

Direct Known Subclasses:XIIIMPCatchableDuckMutator

class XIIIMPDuckMutator
extends XIIIMP.MPBombMutator

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Variables
`string` | `DuckPickupName` to replace ammo picks by default one
`bool` | `DuckWasAdded` to replace ammo picks by default one
`string` | `GrenadPickupName` to replace ammo picks by default one
`class` | `defaultAmmoPickupClass` to replace ammo picks by default one
`string` | `defaultAmmoPickupName` to replace ammo picks by default one

Function Summary
`void` | `AddTheDuck()`
    //_____________________________________________________________________________
`bool` | `CheckReplacement(Actor Other, out byte)`
    //_____________________________________________________________________________
`void` | `ModifyPlayer(Pawn Other)`
    //_____________________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIMPDuckMutator extends MPBombMutator;
    00005
    00006	var string defaultAmmoPickupName; // to replace ammo picks by default one
    00007	var string GrenadPickupName; // to replace ammo picks by default one
    00008	var class<Actor> defaultAmmoPickupClass;
    00009	var string DuckPickupName;
    00010	var bool DuckWasAdded;
    00011
    00012
    00013	//_____________________________________________________________________________
    00014
    00015	function AddTheDuck()
    00016	{
    00017	    local NavigationPoint Nav;
    00018	    local TheDuck MyDuck;
    00019	    local XIIIMPDuckController DC;;
    00020	    local Array<NavigationPoint> NavPointList;
    00021
    00022	    Nav = Level.NavigationPointList;
    00023
    00024	    while( Nav != none)
    00025	    {
    00026	        if( CrouchPathNode(Nav) == none )
    00027	        {
    00028	            NavPointList.Length = NavPointList.Length+1;
    00029	            NavPointList[ NavPointList.Length-1 ] = Nav;
    00030	        }
    00031
    00032	        Nav = Nav.NextNavigationPoint;
    00033	    }
    00034
    00035	    Nav = NavPointList[ Rand(NavPointList.Length) ];
    00036
    00037	    MyDuck = Spawn(class'TheDuck',,, Nav.Location);
    00038
    00039	    XIIIMPDuckGameInfo(Level.Game).TheDuck=MyDuck;
    00040
    00041	    DuckWasAdded = true;
    00042	}
    00043
    00044	//_____________________________________________________________________________
    00045
    00046	event PreBeginPlay()
    00047	{
    00048	    DefaultAmmoPickupClass = Class<Actor>(DynamicLoadObject(DefaultAmmoPickupName, class'class'));
    00049	}
    00050
    00051	//_____________________________________________________________________________
    00052
    00053	function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    00054	{
    00055	    if ( DBMutator ) Log("MUTATOR CheckReplacement for"@Other);
    00056
    00057	    if( ( ( XIIIWeaponPickup(Other) != none ) && ( FGrenadPick(Other) == none ) ) && ( FusilChassePick(Other) == none ) )
    00058	    {
    00059	        if( ! DuckWasAdded )
    00060	            AddTheDuck();
    00061
    00062	        ReplaceWith(Other, GrenadPickupName);
    00063	    }
    00064	    else if ( (XIIIAmmoPick(Other) != none) && ( PumpAmmoBox(Other) == none ) )
    00065	        ReplaceWith(Other, DefaultAmmoPickupName);
    00066
    00067	    return true;
    00068	}
    00069
    00070	//_____________________________________________________________________________
    00071
    00072	function ModifyPlayer(Pawn Other)
    00073	{
    00074	    local XIIIMPPlayerPawn MPPlayer;
    00075	    Local Weapon Inv;
    00076
    00077	    MPPlayer = XIIIMPPlayerPawn(Other);
    00078
    00079	    Inv = Weapon(GiveSomething(class'FGrenadB', MPPlayer));
    00080	    Inv.AmmoType.AmmoAmount = 1;
    00081	    Inv = Weapon(GiveSomething(class'FusilChasse', MPPlayer));
    00082	    Inv.AmmoType.AmmoAmount = 20;
    00083
    00084	    if ( NextMutator != None )
    00085	      NextMutator.ModifyPlayer(Other);
    00086	}
    00087
    00088
    00089
    00090
    00091	defaultproperties
    00092	{
    00093	     defaultAmmoPickupName="XIII.PumpAmmoBox"
    00094	     GrenadPickupName="XIII.FGrenadPick"
    00095	     DuckPickupName="XIIIMP.XIIIMPDuckPickUp"
    00096	}

End Source Code