SmartBrainLib (Forge/Fabric/Quilt)

SmartBrainLib (Forge/Fabric/Quilt)

26M Downloads

[1.21.1] Schedule and Priority not able to fallback to default Activity

lcy0x1 opened this issue ยท 0 comments

commented

My mob has a schedule containing activities with requirements (let's call it S0, S1, S2, IDLE), and at the same time the mob has some other activities with requirements that should override schedule (lt's call it P0, FIGHT, P1).

By default, the priority list has [FIGHT, IDLE]. This will invalidate all schedules as IDLE will always override schedule in SmartBrain::findAndSetActiveActivity calling setActiveActivityToFirstValid. Thus, I cannot have IDLE in priority list.

So, my priority list is [P0, FIGHT, P1], and my schedule has [S0, S1, S2, IDLE].

Now, when my schedule is on S0 but the memory requirement for S0 fails, I would expect it to fallback on IDLE, but in SmartBrain::findAndSetActiveActivity's implementation, it does not check when all tasks fails.

My current temp solution is to extend SmartBrainSchedule, before turning the activity from tick, check if it passes activityRequirementsAreMet, and if not, return IDLE instead.