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

Method tickMaster

source/game/StarActorMovementController.cpp:723–1018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721}
722
723void ActorMovementController::tickMaster(float dt) {
724 EntityAnchorConstPtr newAnchor;
725 if (auto anchorState = m_anchorState.get()) {
726 if (auto anchorableEntity = as<AnchorableEntity>(world()->entity(anchorState->entityId)))
727 newAnchor = anchorableEntity->anchor(anchorState->positionIndex);
728 }
729
730 if (newAnchor)
731 m_entityAnchor = newAnchor;
732 else
733 resetAnchorState();
734
735 if (m_entityAnchor) {
736 m_walking.set(false);
737 m_running.set(false);
738 m_crouching.set(false);
739 m_flying.set(false);
740 m_falling.set(false);
741 m_canJump.set(false);
742 m_jumping.set(false);
743 m_groundMovement.set(false);
744 m_liquidMovement.set(false);
745
746 setVelocity((m_entityAnchor->position - MovementController::position()) / dt);
747 MovementController::tickMaster(dt);
748 setPosition(m_entityAnchor->position);
749 } else {
750 auto activeParameters = m_baseParameters.merge(m_controlParameters);
751 auto activeModifiers = m_baseModifiers.combine(m_controlModifiers);
752
753 if (activeModifiers.movementSuppressed) {
754 m_controlMove = {};
755 m_controlRun = false;
756 m_controlCrouch = false;
757 m_controlDown = false;
758 m_controlJump = false;
759 m_controlFly = {};
760 m_controlPathMove = {};
761 }
762
763 if (m_controlMove.isValid()
764 || m_controlCrouch
765 || m_controlDown
766 || m_controlJump
767 || m_controlFly.isValid()
768 || !m_controlApproachVelocities.empty()
769 || !m_controlApproachVelocityAlongAngles.empty()) {
770 // controlling any other movement overrides the pathing
771 m_controlPathMove.reset();
772 }
773
774 if (m_controlPathMove && m_pathMoveResult.isNothing()) {
775 if (appliedForceRegion()) {
776 m_pathController->reset();
777 } else if (!m_pathController->pathfinding()) {
778 m_pathMoveResult = m_pathController->move(*this, activeParameters, activeModifiers, m_controlPathMove->second, dt)
779 .apply([this](bool result) { return pair<Vec2F, bool>(m_controlPathMove->first, result); });
780

Callers

nothing calls this directly

Calls 15

GameTimerClass · 0.85
isValidMethod · 0.80
isNothingMethod · 0.80
pathfindingMethod · 0.80
curActionMethod · 0.80
orMaybeMethod · 0.80
facingMethod · 0.80
findPathMethod · 0.80
magnitudeSquaredMethod · 0.80
normalizedMethod · 0.80
getMethod · 0.45
entityMethod · 0.45

Tested by

no test coverage detected