// 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. //================================================================================ // ThingFactory. //================================================================================ class ThingFactory extends Keypoint placeable; enum EDistribution { DIST_Constant, DIST_Uniform, DIST_Gaussian }; var() Class prototype; var() int maxitems; var int numitems; var int numspots; var() int capacity; var() float interval; var() name itemtag; var() bool bFalling; var() EDistribution timeDistribution; var() bool bOnlyPlayerTouched; var() bool bCovert; var() bool bStoppable; var Spawnpoint spawnspot[16]; function PostBeginPlay () { local Spawnpoint newspot; Super.PostBeginPlay(); numspots=0; numitems=0; foreach AllActors(Class'Spawnpoint',newspot,Tag) { if ( numspots < 16 ) { spawnspot[numspots]=newspot; newspot.Factory=self; numspots += 1; } } if ( itemtag == 'None' ) { itemtag='MadeInUSA'; } } function StartBuilding () { } auto state Waiting { function Trigger (Actor Other, Pawn EventInstigator) { local Actor A; if ( Event != 'None' ) { foreach AllActors(Class'Actor',A,Event) { A.Trigger(self,EventInstigator); } } GotoState('Spawning'); } function Touch (Actor Other) { local Pawn OtherPawn; OtherPawn=Pawn(Other); if ( (OtherPawn != None) && ( !bOnlyPlayerTouched) ) // || OtherPawn.bIsPlayer) ) { Trigger(Other,OtherPawn); } } } state Spawning { function UnTouch (Actor Other) { local int i; if ( bStoppable ) { i=0; JL0010: if ( i < 4 ) { if ( (Pawn(Touching[i]) != None) && ( !bOnlyPlayerTouched) ) // || Pawn(Touching[i]).bIsPlayer) ) { return; } i++; goto JL0010; } GotoState('Waiting'); } } function Trigger (Actor Other, Pawn EventInstigator) { if ( Other.Class != prototype ) { return; } numitems--; if ( numitems < maxitems ) { StartBuilding(); } } function bool trySpawn (int Start, int End) { local int i; local bool Done; Done=False; i=Start; JL0013: if ( i < End ) { if ( spawnspot[i].Create() ) { Done=True; i=End; capacity--; numitems++; if ( capacity == 0 ) { GotoState('Finished'); } } i++; goto JL0013; } return Done; } function Timer () { local int Start; if ( numitems < maxitems ) { Start=Rand(numspots); if ( !trySpawn(Start,numspots) ) { trySpawn(0,Start); } } if ( numitems < maxitems ) { StartBuilding(); } } function StartBuilding () { local float nextTime; if ( timeDistribution == 0 ) { nextTime=interval; } else { if ( timeDistribution == 1 ) { nextTime=2.00 * FRand() * interval; } else { nextTime=0.50 * (FRand() + FRand() + FRand() + FRand()) * interval; } } if ( capacity > 0 ) { SetTimer(nextTime,False); } } function BeginState () { if ( !bStoppable ) { Disable('UnTouch'); } } Begin: Timer(); } state Finished { } defaultproperties { maxitems=1 capacity=1000000 Interval=1.000000 bFalling=True bStatic=False Texture=Texture'Engine.S_KVehFact' bCollideActors=True }