| 582 | } |
| 583 | |
| 584 | void Npc::tickShared(float dt) { |
| 585 | if (m_hitDamageNotificationLimiter) |
| 586 | m_hitDamageNotificationLimiter--; |
| 587 | |
| 588 | m_songbook->update(*entityMode(), world()); |
| 589 | |
| 590 | m_effectEmitter->setSourcePosition("normal", position()); |
| 591 | m_effectEmitter->setSourcePosition("mouth", position() + mouthOffset()); |
| 592 | m_effectEmitter->setSourcePosition("feet", position() + feetOffset()); |
| 593 | m_effectEmitter->setSourcePosition("headArmor", headArmorOffset() + position()); |
| 594 | m_effectEmitter->setSourcePosition("chestArmor", chestArmorOffset() + position()); |
| 595 | m_effectEmitter->setSourcePosition("legsArmor", legsArmorOffset() + position()); |
| 596 | m_effectEmitter->setSourcePosition("backArmor", backArmorOffset() + position()); |
| 597 | |
| 598 | m_effectEmitter->setDirection(m_humanoid.facingDirection()); |
| 599 | m_effectEmitter->tick(dt, *entityMode()); |
| 600 | |
| 601 | m_humanoid.setMovingBackwards(m_movementController->movingDirection() != m_movementController->facingDirection()); |
| 602 | m_humanoid.setFacingDirection(m_movementController->facingDirection()); |
| 603 | m_humanoid.setRotation(m_movementController->rotation()); |
| 604 | |
| 605 | ActorMovementModifiers firingModifiers; |
| 606 | if (auto fireableMain = as<FireableItem>(handItem(ToolHand::Primary))) { |
| 607 | if (fireableMain->firing()) { |
| 608 | if (fireableMain->stopWhileFiring()) |
| 609 | firingModifiers.movementSuppressed = true; |
| 610 | else if (fireableMain->walkWhileFiring()) |
| 611 | firingModifiers.runningSuppressed = true; |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | if (auto fireableAlt = as<FireableItem>(handItem(ToolHand::Alt))) { |
| 616 | if (fireableAlt->firing()) { |
| 617 | if (fireableAlt->stopWhileFiring()) |
| 618 | firingModifiers.movementSuppressed = true; |
| 619 | else if (fireableAlt->walkWhileFiring()) |
| 620 | firingModifiers.runningSuppressed = true; |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | m_armor->setupHumanoid(m_humanoid, false); |
| 625 | |
| 626 | m_tools->suppressItems(!canUseTool()); |
| 627 | m_tools->tick(dt, m_shifting.get(), {}); |
| 628 | |
| 629 | if (auto overrideDirection = m_tools->setupHumanoidHandItems(m_humanoid, position(), aimPosition())) |
| 630 | m_movementController->controlFace(*overrideDirection); |
| 631 | |
| 632 | m_humanoid.animate(dt); |
| 633 | } |
| 634 | |
| 635 | LuaCallbacks Npc::makeNpcCallbacks() { |
| 636 | LuaCallbacks callbacks; |
nothing calls this directly
no test coverage detected