/* Spino Grabbing Machine // // This machine should be used through the normal call mechanism // */ machine GrabOnly { default state GrabStart { transition CanGrabTarget(false) == false { goto GrabExitStart } transition IsTargetSmall() == false { goto GrabExitStart } action PreGrabTarget() action StopLook() action LockMachine(true) action PlayAnimLinked("grab", "a", "st", false) transition { goto GrabInitiate } } state GrabInitiate { transition IsDead() { action SetStandStill() goto GrabExitStart } transition IsAnimPlaying("grab", "st", false) == true { direct goto GrabCheck } } state GrabCheck { transition CanGrabTarget(true) == true { action SetStandStill() action GrabTarget() action PlayAnimTarget("cap", "st", false) action SetRandomTimerBetween(3, 4.0, 8.0) action SetRand(0, 2) ;// whether swallow or throw action SetDispInjured(true, true) goto ShakeWait } transition { goto GrabExitStart } } state ShakeWait { transition IsDead() { action SetStandStill() action ReleaseTarget() goto GrabExitStart } transition HasTarget() == false { action SetStandStill() goto GrabExitStart } transition IsAnimStatePlaying("grab")==false { action SetStandStill() goto GrabExitStart } transition IsAnimPlaying("grab", "shake_lp", false) == false { goto ShakeWait } transition IsAnimPlayingTarget("cap", "shke_lp", false) == false { goto ShakeWait } transition IsTimerUp(3) { action SetAutoLinkAnimOff("grab", "shake_lp", true) action SetAutoLinkAnimOffTarget("cap", "shke_lp", true) goto ShakeLoopWait } } state ShakeLoopWait { transition { action SetRandomTimerBetween(4, 6.0, 8.0) action StopAnim("grab", "shake_lp") action StopAnimTarget("cap", "shke_lp") goto EndWait } } state EndWait { transition IsDead() { action SetStandStill() action ReleaseTarget() goto GrabExitStart } transition IsAnimStatePlaying("grab")==false { action PlayAnimLooping("mouth", "open", false, -1.0, 1.0) goto GrabExitStart } transition IsTimerUp(4) { goto ShakeWait } } ;------------------------ Exit States Begin ---------------------- exitstart state GrabExitStart { transition { goto GrabExitEnd } } exitend state GrabExitEnd { ;// action DeleteAllCommands() action StopAnimState("grab") ;// action ReleaseTarget() ;// action LockMachine(false) } ;------------------------ Exit States End ---------------------- }