class ACTION_PlayKFReplicatedAmbientSound extends ACTION_PlayAmbientSound;

var(Action) edfindable protected 	Actor 	SoundActor; // actor to set ambientsound on
// used to find SoundActor, if it is not set. Tag must be unique!
var(Action) edfindable 				name 	SoundActorTag; 



function bool InitActionFor(ScriptedController C)
{
	// play appropriate sound
	if ( AmbientSound != None )
	{
		if ( SoundActor == none )
			foreach C.AllActors(class'Actor', SoundActor, SoundActorTag)
				break;
		
		if ( SoundActor != none ) {
			// this probabaly isn't working, 
			// because actor must have those values set in defaultproperties
			if ( SoundActor.RemoteRole < ROLE_SimulatedProxy )
				SoundActor.RemoteRole = ROLE_SimulatedProxy;
			SoundActor.bAlwaysRelevant = true; // 

			SoundActor.AmbientSound = AmbientSound;
			SoundActor.SoundVolume = SoundVolume;
			SoundActor.SoundPitch = SoundPitch;
			SoundActor.SoundRadius = SoundRadius;
			
			SoundActor.NetUpdateTime = SoundActor.Level.TimeSeconds - 1;
		}
	}
	return false;	
}

function string GetActionString()
{
	return ActionString@AmbientSound;
}

defaultproperties
{
}
