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

Gameplay.MPCapturable


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
class MPCapturable extends MPCarryable;

var bool					bAllowEnemyReturn			"When true, enemies will return this capturable to its home location when they touch it (NOT YET IMPLEMENTED)";

var(Stats) class<Stat>		returnStat					"The stat awarded for returning this capturable";
var(Stats) class<Stat>		captureStat					"The stat awarded for capturing this capturable";
var(Stats) class<Stat>		timelyReturnStat			"The stat awarded for returning a capturable in order for a teammate to capture";
var(Stats) int				timelyReturnSeconds			"The number of seconds between capturing and returning to be considered a timely return";

var MPCapturePoint	homeCapturePoint;	// Automatically set by an MPCapturePoint

function registerStats(StatTracker tracker)
{
	Super.registerStats(tracker);
	tracker.registerStat(captureStat);
	tracker.registerStat(returnStat);
	tracker.registerStat(timelyReturnStat);
	tracker.registerStat(defendStat);
}

function returnToHome(optional bool bForced)
{

	Super.returnToHome(bForced);

	if (homeCapturePoint != None)
		homeCapturePoint.onHomeCapturableReturned();
}

function Vector chooseHomeLocation()
{
	if (homeCapturePoint != None)
		return homeCapturePoint.Location + homeCapturePoint.homeCapturableOffset;
	else
		return Super.chooseHomeLocation();
}

// onCapture
function onCapture(Character c)
{
	awardStat(captureStat, c);
	dispatchMessage(new class'MessageCapturableCaptured'(label, carrier.label, carrier.getTeamLabel() ));
	returnToHome();
}

// scoreReturn
function scoreReturn(Character instigator)
{
	awardStat(returnStat, instigator);
}

function onPickedUp(Character c)
{
	//Level.Game.BroadcastLocalized(self, class'MPCapturableMessages', 1, team());
}

function bool validCarrier(Character c, optional bool ignoreLastCarrierCheck)
{
	// Valid only if collider is neutral or enemy
	if (c.team() == team())
		return false;

	return Super.validCarrier(c, ignoreLastCarrierCheck);
}

// Dropped state
state Dropped
{
	function onCharacterPassedThrough(Character c)
	{
		if (c.team() != team())
			return;

		// Return the flag home if a player passes through his own team's flag while dropped
		// Display a secondary message
		if (SecondaryMessageClass != None)
			Level.Game.BroadcastLocalized(self, SecondaryMessageClass, 2, c.tribesReplicationInfo);

		dispatchMessage(new class'MessageCarryableReturned'(label));
		scoreReturn(c);
		returnToHome(true);
	}

	// return timer
	function Timer()
	{
		//Level.Game.BroadcastLocalized(self, class'MPFlagMessages', 3, team());
		Super.Timer();
	}
}

defaultproperties
{
	CollisionRadius			= 120
	CollisionHeight			= 100
	GravityScale			= 1.0
	
	returnTime				= 20
	elasticity				= 0.05	

	bAllowEnemyReturn		= true
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 15:53:18.000 - Creation time: st 23.5.2018 00:10:45.813 - Created with UnCodeX