class IceWall expands Effects;

#exec MESH IMPORT MESH=IceWall ANIVFILE=MODELS\IceWall_a.3d DATAFILE=MODELS\IceWall_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=IceWall STRENGTH=0
#exec MESH ORIGIN MESH=IceWall X=0 Y=0 Z=0 PITCH=-64

#exec MESH SEQUENCE MESH=IceWall SEQ=All STARTFRAME=0 NUMFRAMES=3
#exec MESH SEQUENCE MESH=IceWall SEQ=Shrink STARTFRAME=0 NUMFRAMES=2 RATE=1.0
#exec MESH SEQUENCE MESH=IceWall SEQ=Grow STARTFRAME=1 NUMFRAMES=2 RATE=5.0

#exec MESHMAP NEW MESHMAP=IceWall MESH=IceWall
#exec MESHMAP SCALE MESHMAP=IceWall X=0.1 Y=0.1 Z=0.2

#exec AUDIO IMPORT NAME="IceWallRise" FILE=SOUNDS\IceWallRise.wav GROUP="Freezer"
#exec AUDIO IMPORT NAME="IceHit" FILE=SOUNDS\IceHit.wav GROUP="Freezer"


var float MoreDamage;
var bool HealthGiver;

var bool bEnding;

replication
{
	// Things the server should send to the client.
	reliable if(Role==ROLE_Authority)
		MoreDamage, HealthGiver;
}

function MakeSound()
{
	PlaySound(EffectSound1,, 20.0);
}

simulated function Touch(Actor Other)
{
	if (Role == ROLE_Authority)
	{
	if ((HealthGiver && Other != Instigator) || !HealthGiver)
		Other.TakeDamage(5 * FMax(1.0,MoreDamage), Instigator, Other.Location, vect(0,0,0), 'Spiked');
	else if(HealthGiver && Other.IsA('Pawn'))
	{
		If (((Pawn(Other).PlayerReplicationInfo.Team == Instigator.PlayerReplicationInfo.Team && Level.Game.IsA('TeamGamePlus') && !Level.Game.IsA('MonsterHunt')) ||
		(Level.Game.IsA('MonsterHunt') && !Pawn(Other).IsA('ScriptedPawn')) || Pawn(Other) == Instigator) && Pawn(Other).Health < Class'NWMutator'.default.MaxHealth)
		{
			Pawn(Other).Health += 5 * FMax(1.0,MoreDamage);
				if (Pawn(Other).Health > Class'NWMutator'.default.MaxHealth)
					Pawn(Other).Health = Class'NWMutator'.default.MaxHealth;
		}
	}
	}
}


simulated function PostBeginPlay()
{
	if ( Level.NetMode != NM_Client )
		MakeSound();
	
	PlayAnim('Grow', 1.0);
	SetTimer(3.0, False);
	RemoteRole = ROLE_DumbProxy;
}


simulated function Timer()
{
	bEnding = True;
	PlayAnim('Shrink', 1.0);
}

simulated function Tick( float DeltaTime)
{
	if (bEnding)
	{
		RemoteRole = ROLE_SimulatedProxy;
		ScaleGlow = LifeSpan * Default.ScaleGlow;
	}
}


defaultproperties
{
	DrawType=DT_Mesh
	Mesh=IceWall
	RemoteRole=ROLE_SimulatedProxy
	Style=STY_Translucent
	bMeshEnviroMap=True
	Texture=Ice
	ScaleGlow=2.000000
	CollisionHeight=45.000000
	CollisionRadius=45.000000
	DrawScale=1.000000
	bNetTemporary=False
	LifeSpan=4.000000
	EffectSound1=IceWallRise
	EffectSound2=IceHit
	bCollideWhenPlacing=False
	bCollideActors=True
	bCollideWorld=False
	bProjTarget=True
}
