Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ToggleThingFactory.
  3. //=============================================================================
  4. class ToggleThingFactory expands ThingFactory;
  5.  
  6. var() bool bStatus;         //set me to be on or off
  7. var bool curStatus;
  8.  
  9. var() bool bAnnounceToggle; //should I announce if I get changed?
  10.  
  11. Auto State Waiting
  12. {
  13.     function Trigger( actor Other, pawn EventInstigator )
  14.     {
  15.         TriggerEvent(Event,Self,EventInstigator);
  16.    
  17.         curStatus = bStatus;
  18.         bStatus = !bStatus;
  19.         if (curStatus) {
  20.             if (bAnnounceToggle) BroadcastMessage(self.name@": status is"@self.curStatus, true, 'CriticalEvent');
  21.             GotoState('Spawning');
  22.         }
  23.     }
  24.  
  25.     function Touch(Actor Other)
  26.     {
  27.         local pawn otherpawn;
  28.  
  29.         otherpawn = Pawn(Other);
  30.         if ( (otherpawn != None) && (!bOnlyPlayerTouched || otherpawn.bIsPlayer) )
  31.             Trigger(other, otherPawn);
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement