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

Gameplay.EmergencyStation


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
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
///////////////////////////////////////////////////////////////////////////////
//
// Emergency Station
//
class EmergencyStation extends BaseDevice
	native;

//
// Access point variables
//
var(EmergencyStation) float				accessPointOffset	"Offset of the access area from the Emergency station";
var(EmergencyStation) float				accessRadius		"Radius of the access area in front of the Emergency station";
var(EmergencyStation) float				accessHeight		"Height of the access area in front of the Emergency station";
var(EmergencyStation) Material			activeLightSkin		"The active light skin texture";
var(EmergencyStation) int				activeLightSkinSlot	"skin slot for the flashing light skin";
var(EmergencyStation) class<RepairPack>	repairPackClass		"class of repair pack to give";
var(EmergencyStation) class<EmergencyStationAccess>	accessClass	"Access Class to spawn";
var(EmergencyStation) float				respawnDelay		"Duration of repair pack respawn";

var EmergencyStationAccess access;
var bool bForceIconVisible;	// used to turn on icon in radar

enum eBakeAnimationState
{
	BAS_End,
	BAS_Start,
	BAS_Baking
};
var eBakeAnimationState animationState;

cpptext
{
	virtual UBOOL canBeSeenBy(APawn* pawn) {return false;}	// AI's can't see EmergencyStation's
}

function PostBeginPlay()
{
	local Vector accessPointLocation;
	local Vector xAxis, zAxis;

	Super.PostBeginPlay();

	// Place the access point in front of the emergency station (along the y axis)
	GetAxes(rotation, xAxis, accessPointLocation, zAxis);
	accessPointLocation *= accessPointOffset;
	accessPointLocation += location;

	// create the access point
	access = spawn(accessClass, None, , accessPointLocation, Rotation);
	access.setCollision(true, false, false);
	access.setCollisionSize(accessRadius, accessHeight);

	// set self as access control
	access.initialise(self);

	// Update the useable points array
	UseablePoints[0] = access.GetUseablePoint();
	UseablePointsValid[0] = UP_Valid;
}

simulated function tick(float deltaSeconds)
{
	super.tick(deltaSeconds);

	// animation processing
	if (Role == ROLE_Authority)
	{
		switch (animationState)
		{
		case BAS_Start:
			if (!isAnimating())
			{
				// start bake animation
				savedAnim = 'Bake';
				bLoopSavedAnim = false;
				PlayAnim('Bake', GetAnimLength('Bake') / respawnDelay);
				animationState = BAS_Baking;
			}
			break;
		case BAS_Baking:
			if (!isAnimating())
			{
				// start end animation
				PlayBDAnim('End');
				animationState = BAS_End;
			}
			break;
		}
	}
}

function bool isRepairPackAvailable()
{
	return animationState == BAS_End;
}

simulated function Destroyed()
{
	// Delete spawned access class
	if (access != None)
		access.Destroy();

	Super.Destroyed();
}

// State Unpowered
simulated state Unpowered
{
	simulated function BeginState()
	{
		// Play flashing light animation 
		Skins[ActiveLightSkinSlot] = activeLightSkin;
		// start the alarm
		TriggerEffectEvent('Alarm');
	}
}

// State Active
simulated state Active
{
	simulated function BeginState()
	{
		// Stop flashing light animation 
		Skins[ActiveLightSkinSlot] = None;
		// stop the alarm
		UnTriggerEffectEvent('Alarm');
	}
}

function repairPackTaken()
{
	PlayBDAnim('Start');
	animationState = BAS_Start;
}

function bool isOnCharactersTeam(Character testCharacter)
{
	return isFriendly(testCharacter);
}

function bool canBeSensed()
{
	return bForceIconVisible;
}

// its always functional
function bool isFunctional()
{
	return true;
}

defaultproperties
{
	Mesh				= SkeletalMesh'BaseObjects.RepairStation'
	DrawType			= DT_Mesh
	ActiveLightSkin		= shader'BaseObjects.vstationlightshader'
	ActiveLightSkinSlot	= 3

	bReplicateAnimations = true

	bCanBeDamaged	= false
	bAIThreat		= false

	accessRadius	= 50
	accessHeight	= 80
	accessClass		= class'Gameplay.EmergencyStationAccess'

	repairPackClass = class'Gameplay.RepairPack'

	respawnDelay	= 5
}

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