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

Method update

source/game/StarPlayer.cpp:835–1127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833}
834
835void Player::update(float dt, uint64_t) {
836 m_movementController->setTimestep(dt);
837
838 if (isMaster()) {
839 if (m_emoteCooldownTimer) {
840 m_emoteCooldownTimer -= dt;
841 if (m_emoteCooldownTimer <= 0) {
842 m_emoteCooldownTimer = 0;
843 m_emoteState = HumanoidEmote::Idle;
844 }
845 }
846
847 if (m_chatMessageUpdated) {
848 auto state = Root::singleton().emoteProcessor()->detectEmotes(m_chatMessage);
849 if (state != HumanoidEmote::Idle)
850 addEmote(state);
851 m_chatMessageUpdated = false;
852 }
853
854 m_blinkCooldownTimer -= dt;
855 if (m_blinkCooldownTimer <= 0) {
856 m_blinkCooldownTimer = Random::randf(m_blinkInterval[0], m_blinkInterval[1]);
857 auto loungeAnchor = as<LoungeAnchor>(m_movementController->entityAnchor());
858 if (m_emoteState == HumanoidEmote::Idle && (!loungeAnchor || !loungeAnchor->emote))
859 addEmote(HumanoidEmote::Blink);
860 }
861
862 m_lastDamagedOtherTimer += dt;
863
864 if (m_movementController->zeroG())
865 m_movementController->controlParameters(m_zeroGMovementParameters);
866
867 if (isTeleporting()) {
868 m_teleportTimer -= dt;
869 if (m_teleportTimer <= 0 && m_state == State::TeleportIn) {
870 m_state = State::Idle;
871 m_effectsAnimator->burstParticleEmitter(m_teleportAnimationType + "Burst");
872 }
873 }
874
875 if (!isTeleporting()) {
876 processControls();
877
878 m_questManager->update(dt);
879 m_companions->update(dt);
880 m_deployment->update(dt);
881
882 bool edgeTriggeredUse = take(m_edgeTriggeredUse);
883
884 m_inventory->cleanup();
885 refreshEquipment();
886
887 if (inConflictingLoungeAnchor())
888 m_movementController->resetAnchorState();
889
890 if (m_state == State::Lounge) {
891 if (auto loungeAnchor = as<LoungeAnchor>(m_movementController->entityAnchor())) {
892 m_statusController->setPersistentEffects("lounging", loungeAnchor->statusEffects);

Callers

nothing calls this directly

Calls 15

singletonClass · 0.85
randfFunction · 0.85
takeFunction · 0.85
ItemDescriptorClass · 0.85
numericalDirectionFunction · 0.85
setTimestepMethod · 0.80
detectEmotesMethod · 0.80
emoteProcessorMethod · 0.80
entityAnchorMethod · 0.80
zeroGMethod · 0.80
controlParametersMethod · 0.80
burstParticleEmitterMethod · 0.80

Tested by

no test coverage detected