/* Generic Carnivore Grabbing People // // This machine should be used through the normal call mechanism // */ machine CarnGrabHuman { default state GrabStart { transition IsHumanWaitingToDie() == false { goto GrabExitStart } transition CanGrabTarget(false) == false { goto GrabExitStart } transition IsTargetSmall() == false { goto GrabExitStart } action StopLook() transition InTargetProximityRadius(1.0, false) { ;// too close goto StepBack } transition { direct goto GrabSetup } } state StepBack { action SetSpeedModifierWalk(1.0) action SetWalkBackMode(true) action StepBackFromTarget(10.0) transition { action SetRandomTimerBetween(2, 4.0, 5.0) goto StepBackLoop } } state StepBackLoop { transition IsDead() { action SetWalkBackMode(false) action SetLockFacing(false) action SetStandStill() goto GrabExitStart } action LookAtTargetPosition(2.0) transition InTargetProximityRadius(1.1, false) == false { goto StepBackEnd } transition IsTimerUp(2) { goto StepBackEnd } transition HasArrived() { goto StepBackEnd } } state StepBackEnd { action LookEnd() action SetWalkBackMode(false) action SetLockFacing(false) action SetStandStill() transition { goto SniffTarget } } state SniffTarget { transition IsHumanWaitingToDie() == false { goto GrabExitStart } transition IsAnimLoaded("idle", "snif_lp") { action SetSpeedDirect(0.0) action SetStandStill() action StopAllUserAnimations() action SetAutoMovementBlend(false) action PlayAnim("idle", "snif_lp", true) goto Sniff } transition { goto GrabSetup } } state Sniff { transition IsDead() { action SetStandStill() goto GrabExitStart } action LookAtTargetPosition(2.0) transition AnimStateFinished("idle") { action LookEnd() action SetAutoMovementBlend(true) goto GrabSetup } } state GrabSetup { transition IsHumanWaitingToDie() == false { goto GrabExitStart } action LookEnd() 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 IsHumanWaitingToDie() == false { goto GrabExitStart } transition CanGrabTarget(true) == true { action SetStandStill() action AttachTarget() action KillHuman() action PlayAnimTarget("cap", "st", false) action SetRandomTimerBetween(3, 4.0, 8.0) action SetRand(0, 2) ;// whether swallow or throw goto ShakeWait } transition { goto GrabExitStart } } state ShakeWait { transition IsDead() { action SetStandStill() action DetachTarget() action DestroyTargetUnit() goto GrabExitStart } transition IsTimerUp(3) { direct goto EndChoose } } state EndChoose { transition IsDead() { action SetStandStill() action DetachTarget() action DestroyTargetUnit() goto GrabExitStart } transition IsAnimPlaying("grab", "shake_lp", false) == false { goto EndChoose ;// wait until the correct anim is playing } transition ;//GetRand() == 0 { action StopAnimLinked("grab", "shake_lp", "swal_ed", true) action StopAnimLinkedTarget("cap", "shke_lp", "swld_ed", false) goto EndWait } /* transition { action StopAnimLinked("grab", "shake_lp", "thrw_ed", true) action StopAnimLinkedTarget("cap", "shke_lp", "thrw_ed", false) goto EndWait } */ } state EndWait { transition IsDead() { action SetStandStill() action DetachTarget() action DestroyTargetUnit() goto GrabExitStart } transition IsAnimStatePlaying("grab")==false { direct goto ReleaseChoose } transition IsAnimPlaying("grab", "swal_ed", false) { action SwallowScaleTarget(0.2, 0.7) goto EndWait } } state ReleaseChoose { action AddKillExperience(1, 0.0) action SendEnclosureEvent("kill_human") transition ;//GetRand() == 0 ;// swallowed { action CarnEatTarget(true) action DetachTarget() action DestroyTargetUnit() ;//action UpdateVariable("FoodEnergy", 0.1) action UpdateVariable("Stress", -0.4) goto GrabExitStart } /* transition ;// thrown onto ground { action ReleaseTarget() goto GrabExitStart } */ } ;------------------------ Exit States Begin ---------------------- exitstart state GrabExitStart { transition { goto GrabExitEnd } } exitend state GrabExitEnd { action LookEnd() action SetWalkBackMode(false) action SetLockFacing(false) action DeleteAllCommands() action StopAnimState("grab") action DetachTarget() action LockMachine(false) } ;------------------------ Exit States End ---------------------- }