class CyBotX expands CyBotBases
abstract;

#exec MESH IMPORT MESH=CyBotX ANIVFILE=MODELS\CyBotX_a.3d DATAFILE=MODELS\CyBotX_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=CyBotX STRENGTH=0
#exec MESH ORIGIN MESH=CyBotX X=0 Y=0 Z=0

#exec MESH SEQUENCE MESH=CyBotX SEQ=All STARTFRAME=0 NUMFRAMES=6
#exec MESH SEQUENCE MESH=CyBotX SEQ=Closed STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=CyBotX SEQ=Openned STARTFRAME=5 NUMFRAMES=1
#exec MESH SEQUENCE MESH=CyBotX SEQ=Openning STARTFRAME=0 NUMFRAMES=6 RATE=5.0

#exec MESHMAP NEW MESHMAP=CyBotX MESH=CyBotX
#exec MESHMAP SCALE MESHMAP=CyBotX X=0.0375 Y=0.0375 Z=0.075

#exec TEXTURE IMPORT NAME=Sk_CybotX FILE=SKINS\Sk_CybotX.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=CyBotX NUM=1 TEXTURE=Sk_CybotX

#exec TEXTURE IMPORT NAME=NanoDefault FILE=SKINS\NanoDefault.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=CyBotX NUM=2 TEXTURE=NanoDefault

#exec TEXTURE IMPORT NAME=CyBase FILE=SKINS\CyBase.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=CyBotX NUM=3 TEXTURE=CyBase

var() class<XEnergy> EnergyBallX;
var() texture EnergyOverlaySkin;

var CyBotXOver XOverFX;
var XEnergy EnX;


simulated function PostBeginPlay()
{
	Super.PostBeginPlay();

	if (Class'NWMutator'.default.bCybotID_InTeamGames && Level.Game.IsA('TeamGamePlus') && !Level.Game.IsA('MonsterHunt'))
		MultiSkins[2] = TeamNano[Instigator.PlayerReplicationInfo.Team];
}


function SpawnWreckedPiece( vector SpawnDir)
{
local WreckedPieceSteady wp;

	wp = Spawn(Class'WreckedPieceSteady',,, Location, Rotation);
	GiveProperties(wp);
}

simulated function GiveProperties(actor A)
{
	A.AnimSequence = AnimSequence;
	A.AnimFrame = AnimFrame;
	A.DrawScale = DrawScale;
	A.Mesh = Mesh;

	Destroy();
}


simulated function AnimEnd()
{
	SpawnStuff();
	XOverFX = Spawn(Class'CyBotXOver', Self);
	XOverFX.MultiSkins[1] = EnergyOverlaySkin;
}


function SpawnStuff()
{
	EnX = Spawn(EnergyBallX,,, Location + vect(0,0,10));
}

simulated function Destroyed()
{
	if (EnX != None)
		EnX.Destroy();

	if (XOverFX != None)
		XOverFX.Destroy();

	Super.Destroyed();
}


defaultproperties
{
	DrawType=DT_Mesh
	Mesh=CyBotX
}
