/* Fodder Graze // */ machine FodderGraze { default state Start { action AddRandomAnimation("call", "01_lp", 10.0, 15.0) action AddRandomAnimation("tail", "flck_lp", 3.0, 5.0) action StartLook("LookProximity", 0.5) action ClearTarget() action SetRunMode(false) action SetSpeedModifierWalk(1.0) transition { goto SetWander } } state SetWander { transition SetWander() == true { action SetRandomTimerBetween(1, 5.0, 7.0) goto GetTarget } } state GetTarget { transition HasArrived() { goto Start } transition IsTimerUp(1) { goto GrazeStart } } state GrazeStart { transition IsInGrazeArea() == false { goto GetTarget } transition { action SetStandStill() action SetRandomTimerBetween(1, 1.0, 2.0) goto Graze } } state Graze { transition IsTimerUp(1) { action SetSpeedDirect(0.0) action SetStandStill() action SendEnclosureEvent("feeding_plant") action StopAllRandomAnimations() action SetAutoMovementBlend(false) action StopLook() action PlayAnim("graze", "st", false) goto GrazeWait } } state GrazeWait { transition IsAnimPlaying("graze", "lp", false) == true { action SetRandomTimerBetween(1, 5.0, 15.0) goto GrazeLoop } } state GrazeLoop { action UpdateDeltaVariable("FoodEnergy", 0.01) transition IsTimerUp(1) { action StopAnimState("graze") action SetRandomTimerBetween(1, 3.0, 4.0) goto GrazeEnd } } state GrazeEnd { transition IsAnimStatePlaying("graze", false) == false { action AddRandomAnimation("call", "02_lp", 10.0, 15.0) action AddRandomAnimation("tail", "flck_lp", 3.0, 5.0) action StartLook("LookProximity", 0.5) action SetAutoMovementBlend(true) goto WanderWait } } state WanderWait { transition IsTimerUp(1) { goto SetWander } } ;------------------------ Exit States Begin ---------------------- exitstart state GrazeCleanUp { action StopAnimState("graze") transition { goto GrazeCleanUpLoop } } state GrazeCleanUpLoop { transition IsAnimStatePlaying("graze", false) == false { goto GrazeCleanUpEnd } } exitend state GrazeCleanUpEnd { action SetAutoMovementBlend(true) action StopLook() } ;------------------------ Exit States End ---------------------- }