MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / tickShared

Method tickShared

source/game/StarProjectile.cpp:868–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

866}
867
868void 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
902void Projectile::setup() {
903 if (auto uniqueId = m_parameters.optString("uniqueId"))

Callers

nothing calls this directly

Calls 15

getAngleSideFunction · 0.85
makeSMutableIteratorFunction · 0.85
stickingDirectionMethod · 0.80
setSourcePositionMethod · 0.80
pullOccurredMethod · 0.80
getArrayMethod · 0.80
wrapTickMethod · 0.80
velocityMethod · 0.45
valueMethod · 0.45
setRotationMethod · 0.45
angleMethod · 0.45
setDirectionMethod · 0.45

Tested by

no test coverage detected