Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

U2.Arena


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
//=============================================================================
// Arena.
// Replaces all weapons and ammo with specified (in subclassses) weapon and ammo.
//=============================================================================

class Arena extends U2Mutator
	abstract;

var string WeaponInventoryString;			// weapon inventory string (should be set in subclasses)

// set in PreBeginPlay
var private name WeaponPickupName;			// weapon pickup class name
var private name AmmoPickupName;			// ammo pickup class name
var private name WeaponInventoryName;		// weapon inventory class name
var class<Pickup> WeaponPickupClass;		// weapon pickup class
var class<Pickup> AmmoPickupClass;			// ammo pickup class

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

function AddMutator( Mutator M )
{
	if( Arena(M) != None )
	{
		log( M $ " not allowed (already have an Arena mutator)" );
		return; //only allow one arena mutator
	}
	Super.AddMutator(M);
}

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

event PreBeginPlay()
{
	Super.PreBeginPlay();

	DefaultWeapon = class<Weapon>(DynamicLoadObject( WeaponInventoryString, class'Class' ));

	WeaponInventoryName = DefaultWeapon.Name;
	WeaponPickupName	= DefaultWeapon.default.PickupClass.Name;
	AmmoPickupName		= DefaultWeapon.default.AmmoName.default.PickupClass.Name;
	WeaponPickupClass	= DefaultWeapon.default.PickupClass;
	AmmoPickupClass		= DefaultWeapon.default.AmmoName.default.PickupClass;

	// !!mdf-tbd: leave this in to help mod authors?
	DM( "Arena:" );
	DM( "  WeaponInventoryName:  " $ WeaponInventoryName );
	DM( "  WeaponPickupName:     " $ WeaponPickupName );
	DM( "  AmmoPickupName:       " $ AmmoPickupName );
	DM( "  WeaponPickupClass:    " $ WeaponPickupClass );
	DM( "  AmmoPickupClass:      " $ AmmoPickupClass );
}

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

function bool AlwaysKeep( Actor Other )
{
	if( Other.IsA( WeaponPickupName ) )
	{
		//!!mdf-tbd: WeaponPickup(Other).PickupAmmoCount = WeaponPickup(Other).AmmoName.default.MaxAmmo;
		return true;
	}
	if( Other.IsA( AmmoPickupName ) )
	{
		//!!mdf-tbd:	Ammo(Other).AmmoAmount = Ammo(Other).MaxAmmo;
		return true;
	}

	if( NextMutator != None )
		return NextMutator.AlwaysKeep( Other );

	return false;
}

//-----------------------------------------------------------------------------
							   
function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
	if( WeaponPickup(Other) != None )
	{
		if( !Other.IsA( WeaponPickupName ) )
		{
			Level.Game.bCoopWeaponMode = false;
			ReplaceWithClass( Other, WeaponPickupClass );
			return false;
		}
	}

	if( Ammo(Other) != None )
	{
		if( !Other.IsA( AmmoPickupName ) )
		{
			ReplaceWithClass( Other, AmmoPickupClass );
			return false;
		}
	}

	if( Weapon(Other) != None )
	{
		if( !Other.IsA( WeaponInventoryName ) )
		{
			Level.Game.bCoopWeaponMode = false;
			ReplaceWith( Other, WeaponInventoryString );
			return false;
		}
	}

	bSuperRelevant = 0;
	return true;
}

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

defaultproperties
{
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:37.291 - Created with UnCodeX