mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
rewrite of interact system, bugfixes, ai tweaks
This commit is contained in:
parent
f5222be9d2
commit
ac1a1b2449
62 changed files with 649 additions and 491 deletions
|
|
@ -5,12 +5,12 @@ class TaskLookAround extends TaskBase
|
|||
private $finYaw = 0;
|
||||
public function shouldBeExecuted(EntityAI $ai)
|
||||
{
|
||||
return !$ai->entity->isMoving() && $ai->entity->lookTime <= 0 && mt_rand(0,30) == 1 && $ai->entity->idleTime <= 0 && !($ai->lastTask instanceof TaskLookAround);
|
||||
return !$ai->entity->isMoving() && $ai->entity->lookTime <= 0 && mt_rand(0,30) == 1 && $ai->entity->idleTime <= 0;
|
||||
}
|
||||
|
||||
public function wasExecuted(EntityAI $ai){
|
||||
|
||||
return $ai->entity->lookTime > 0;
|
||||
return $ai->entity->lookTime > 0 && $ai->entity->moveTime <= 0;
|
||||
}
|
||||
|
||||
public function onStart(EntityAI $ai){
|
||||
|
|
@ -24,12 +24,12 @@ class TaskLookAround extends TaskBase
|
|||
//60 - 30 = 90deg rot
|
||||
//30 - 15 = -45deg rot
|
||||
if($ai->entity->lookTime === 1){
|
||||
$ai->entity->idleTime = mt_rand(40, 200);
|
||||
$ai->entity->idleTime = mt_rand(10, 40);
|
||||
}
|
||||
if(Utils::in_range($ai->entity->lookTime, 105, 120) || Utils::in_range($ai->entity->lookTime, 15, 30)){
|
||||
if(Utils::in_range($ai->entity->lookTime, 45, 60) || Utils::in_range($ai->entity->lookTime, 0, 15)){
|
||||
$ai->entity->yaw -= 3;
|
||||
}
|
||||
if(Utils::in_range($ai->entity->lookTime, 50, 80)){
|
||||
if(Utils::in_range($ai->entity->lookTime, 15, 45)){
|
||||
$ai->entity->yaw += 3;
|
||||
}
|
||||
|
||||
|
|
@ -44,4 +44,3 @@ class TaskLookAround extends TaskBase
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue