| 866 | } |
| 867 | |
| 868 | void Projectile::tickShared(float dt) { |
| 869 | if (!m_config->orientationLocked && !m_movementController->stickingDirection()) { |
| 870 | auto apparentVelocity = m_movementController->velocity() - m_referenceVelocity.value(); |
| 871 | if (apparentVelocity != Vec2F()) |
| 872 | m_movementController->setRotation(apparentVelocity.angle()); |
| 873 | } |
| 874 | |
| 875 | m_animationTimer += dt; |
| 876 | setFrame(getFrame()); |
| 877 | |
| 878 | m_effectEmitter->setSourcePosition("normal", position()); |
| 879 | m_effectEmitter->setDirection(getAngleSide(m_movementController->rotation(), true).second); |
| 880 | m_effectEmitter->tick(dt, *entityMode()); |
| 881 | |
| 882 | if (m_collisionEvent.pullOccurred()) { |
| 883 | for (auto const& action : m_parameters.getArray("actionOnCollide", m_config->actionOnCollide)) |
| 884 | processAction(action); |
| 885 | } |
| 886 | |
| 887 | auto periodicActionIt = makeSMutableIterator(m_periodicActions); |
| 888 | while (periodicActionIt.hasNext()) { |
| 889 | auto& periodicAction = periodicActionIt.next(); |
| 890 | if (get<1>(periodicAction)) { |
| 891 | if (get<0>(periodicAction).wrapTick()) |
| 892 | processAction(get<2>(periodicAction)); |
| 893 | } else { |
| 894 | if (get<0>(periodicAction).tick(dt)) { |
| 895 | processAction(get<2>(periodicAction)); |
| 896 | periodicActionIt.remove(); |
| 897 | } |
| 898 | } |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | void Projectile::setup() { |
| 903 | if (auto uniqueId = m_parameters.optString("uniqueId")) |
nothing calls this directly
no test coverage detected