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

Method update

source/game/StarObject.cpp:383–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383void Object::update(float dt, uint64_t) {
384 if (!inWorld())
385 return;
386
387 if (isMaster()) {
388 m_tileDamageStatus->recover(m_config->tileDamageParameters, dt);
389
390 if (m_liquidCheckTimer.wrapTick())
391 checkLiquidBroken();
392
393 if (auto orientation = currentOrientation()) {
394 auto frame = clamp<int>(std::floor(m_animationTimer / orientation->animationCycle * orientation->frames), 0, orientation->frames - 1);
395 if (m_currentFrame != frame) {
396 m_currentFrame = frame;
397 setImageKey("frame", toString(frame));
398 }
399
400 m_animationTimer = std::fmod(m_animationTimer + dt, orientation->animationCycle);
401 }
402
403 m_networkedAnimator->update(dt, nullptr);
404 m_networkedAnimator->setFlipped(direction() == Direction::Left, m_animationCenterLine);
405
406 m_scriptComponent.update(m_scriptComponent.updateDt(dt));
407
408 } else {
409 m_networkedAnimator->update(dt, &m_networkedAnimatorDynamicTarget);
410 m_networkedAnimatorDynamicTarget.updatePosition(position() + m_animationPosition);
411 }
412
413 if (m_lightFlickering)
414 m_lightFlickering->update(dt);
415
416 for (auto& timer : m_emissionTimers)
417 timer.tick(dt);
418
419 if (world()->isClient())
420 m_scriptedAnimator.update();
421}
422
423void Object::render(RenderCallback* renderCallback) {
424 renderParticles(renderCallback);

Callers 2

addNodeConnectionMethod · 0.45
removeNodeConnectionMethod · 0.45

Calls 8

toStringFunction · 0.85
recoverMethod · 0.80
wrapTickMethod · 0.80
setFlippedMethod · 0.80
updateDtMethod · 0.80
updatePositionMethod · 0.80
isClientMethod · 0.80
tickMethod · 0.45

Tested by

no test coverage detected