/* Generic Carnivore Chase People // // This machine should be used through the normal call mechanism // */ machine CarnChaseHuman { state ChaseStart { transition IsHumanWaitingToDie() == true { goto GrabExitStart } transition CanGrabTarget(false) == false { goto GrabExitStart } transition IsTargetSmall() == false { goto GrabExitStart } action SeekTarget(true, true) action StopLook() transition { direct goto GrabSetup } } state GrabSetup { transition IsHumanWaitingToDie() == true { 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() == true { goto GrabExitStart } transition IsFacingTargetUnit(0.6) == 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 } } 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 } } ;------------------------ Exit States Begin ---------------------- exitstart state GrabExitStart { transition { goto GrabExitEnd } } exitend state GrabExitEnd { action LookEnd() action DeleteAllCommands() action StopAnimState("grab") action DetachTarget() action LockMachine(false) } ;------------------------ Exit States End ---------------------- }