class CyBotZDown expands CyBotBases;

#exec MESH IMPORT MESH=CyBotZDown ANIVFILE=MODELS\CyBotZDown_a.3d DATAFILE=MODELS\CyBotZDown_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=CyBotZDown STRENGTH=0
#exec MESH ORIGIN MESH=CyBotZDown X=0 Y=0 Z=0

#exec MESH SEQUENCE MESH=CyBotZDown SEQ=All STARTFRAME=0 NUMFRAMES=12
#exec MESH SEQUENCE MESH=CyBotZDown SEQ=Closed STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=CyBotZDown SEQ=Openned STARTFRAME=11 NUMFRAMES=1
#exec MESH SEQUENCE MESH=CyBotZDown SEQ=Openning STARTFRAME=0 NUMFRAMES=5 RATE=5.0

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

#exec MESHMAP SETTEXTURE MESHMAP=CyBotZDown NUM=1 TEXTURE=NanoDefault

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

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

var CyBotZUp cbu;


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

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

	SpawnUpPart();
}

function SpawnUpPart()
{
	cbu = Spawn(Class'CyBotZUp');
	cbu.DrawScale = DrawScale;
}

simulated function Destroyed()
{
	if (cbu != none)
		cbu.Destroy();

	Super.Destroyed();
}

function SpawnWreckedPiece( vector SpawnDir)
{
local WreckedPieceSteady wp;

	if (cbu != none)
	{
		cbu.SpawnWreckedPiece(SpawnDir);
		cbu = None;
	}

	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();
}

defaultproperties
{
	DrawType=DT_Mesh
	Mesh=CyBotZDown
	Health=150
	bEMPWeak=True
}
