LogoTravelers Lib

Task Providers

Task Providers

Basics

Same as the animator all the task provider is a custom class, since Travelers-Lib doesn't provide any tasks, I'll use Jurassic Saga as an example again.

public class DilophosaurusAnimal extends AbstractJSAnimal<DilophosaurusEntity> {
public DilophosaurusAnimal() {
super("dilophosaurus");
setAnimator(new DilophosaurusAnimations());
setTaskProvider(new DilophosaurusBehaviourSet());
}
.....
}

This drives the animals tasks

You might wonder, why not use goals? I've decided to make my own task system because i wanted more control with the priorities example:

@Override
public TaskPriority getPriority() {
double hunger = animal.getModules().getMetabolismModule().hungerPercentage();
if (hunger > 0.8) return TaskPriority.LOW;
if (hunger > 0.6) return TaskPriority.MEDIUM;
if (hunger > 0.4) return TaskPriority.HIGH;
if (hunger > 0.2) return TaskPriority.VERY_HIGH;
return TaskPriority.DIRECT;
}