// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. class GeoAIFish extends Pawn placeable; var Actor HurtingActor; // An Actor to get away from. var vector OldLocation; // Used to determine if stuck. var int DamageTaken; // Most recent damage amount. var bool bStartled; // Recently startled. var float RndOffset; // Random offset to the target point, to give more variation.. instead of having fixed points all the time. // PostBeginPlay() is originally defined in Actor(). // We will use it to make sure an AIController is spawned for our NaliCow. event PostBeginPlay() { Super.PostBeginPlay(); if ( ( ControllerClass != None ) && ( Controller == None ) ) Controller = spawn( ControllerClass ); if ( Controller != None ) Controller.Possess( self ); } // MoveCheck() deals with periodic checks for bStartled, DamageTaken and falling. // Then moves the character in direction of Rotation and at speed of SpeedRatio. function MoveCheck( float SpeedRatio ) { DamageTaken = 0; // Reset most recent damage memory. if ( Controller.MoveTarget == None ) ReachedDestination( self ); if ( VSize( Controller.MoveTarget.Location - Location ) < 64 ) ReachedDestination( Controller.MoveTarget ); if ( VSize( OldLocation - Location ) < 48 ) ReachedDestination( Controller.MoveTarget ); OldLocation = Location; RotationRate.Yaw = SpeedRatio * 20000; Velocity = ( SpeedRatio * GroundSpeed ) * vector( Rotation ); Acceleration = Velocity; } // ReachedDestination() is originally defined in Pawn. // MoveTarget and other relevant properties are defined in Controller. function bool ReachedDestination( Actor OldTarget ) { local Actor NewTarget, A; local NavigationPoint NP; local bool found; /* forEach VisibleActors( class'Actor', A ) if ( A != OldTarget && A != HurtingActor ) { NewTarget = A; break; } */ forEach RadiusActors( class'NavigationPoint', NP, 1024 ) if ( FRand() > 0.5 && NP != OldTarget && FastTrace( NP.Location ) ) { A = NP; NewTarget = A; found = true; break; } if ( NewTarget != None ) { Controller.MoveTarget = NewTarget; Controller.Destination = NewTarget.Location; Controller.FocalPoint = NewTarget.Location; Controller.Focus = NewTarget; RndOffset = FRand() * 128; } else { //Find random point. forEach RadiusActors( class'NavigationPoint', NP, 1024 ) if ( NP != OldTarget ) { A = NP; NewTarget = A; RndOffset = FRand() * 128; found = true; break; } if (found) { Controller.MoveTarget = NewTarget; Controller.Destination = NewTarget.Location; Controller.FocalPoint = NewTarget.Location; Controller.Focus = NewTarget; } } return found; } // Trigger() is originally defined in Actor. function Trigger( Actor Other, Pawn EventInstigator ) { } // Touch() is originally defined in Actor. function Touch( Actor Other ) { GotoState('Walk'); } // Bump() is originally defined in Actor. function Bump( Actor Other ) { GotoState('Walk'); } // Landed() is originally defined in Actor. event Landed( vector HitNormal ) { Super.Landed( HitNormal ); } // TakeDamage() is originally defined in Actor. function TakeDamage(int Damage, Pawn InstigatedBy, Vector HitLocation, Vector Momentum, class DamageType) { } // Died() is originally defined in Pawn. function Died( Controller Killer, class DamageType, vector HitLocation ) { //TakeDamage( Health, None, Location, vect(0,0,-1), class'Crushed' ); } // TornOff() is originally defined in Actor. event TornOff() { if ( PlayerCanSeeMe() ) DeRez(); else Destroy(); } // DeRez() will signal removal of the dead NaliCow. simulated function DeRez() { if ( Level.NetMode == NM_DedicatedServer ) return; Skins.length = 0; //Skins[0] = Material'DeRez.Shaders.DeRezFinalBody'; } auto state Walk { function Tick( float DeltaTime ) { local bool found; found = false; Velocity = ( 0.5 * GroundSpeed ) * vector( Rotation ); Acceleration = Velocity; if ( Controller.MoveTarget != None && VSize( Controller.MoveTarget.Location - Location ) < 64 + RndOffset ) found = ReachedDestination( Controller.MoveTarget ); if ( found == false && VSize( OldLocation - Location ) < 48 + RndOffset ) ReachedDestination( Controller.MoveTarget ); if ( found == false && FRand() > 0.98) ReachedDestination( Controller.MoveTarget ); } event AnimEnd( int Channel ) { } Begin: // DisplayBehavior( 7 ); MoveCheck( 0.5 ); } defaultproperties { GroundSpeed=100.000000 Physics=PHYS_Swimming DrawType=DT_StaticMesh StaticMesh=StaticMesh'MatthijsSM.PumpingStation.dopefish' bReplicateAnimations=True DrawScale=0.100000 SoundRadius=512.000000 bFullVolume=True CollisionHeight=15.000000 }