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

Method updateLiquidPercentage

source/game/StarMovementController.cpp:804–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804void MovementController::updateLiquidPercentage() {
805 auto pos = position();
806 auto body = collisionBody();
807 RectF boundBox = body.boundBox();
808
809 LiquidLevel cll;
810 if (boundBox.isEmpty())
811 cll = world()->liquidLevel(Vec2I::floor(pos));
812 else
813 cll = world()->liquidLevel(boundBox);
814
815 m_liquidPercentage = clamp(cll.level, 0.0f, 1.0f);
816 m_liquidId = cll.liquid;
817}
818
819void MovementController::setOnGround(bool onGround) {
820 m_onGround.set(onGround);

Callers

nothing calls this directly

Calls 4

clampFunction · 0.85
boundBoxMethod · 0.45
isEmptyMethod · 0.45
liquidLevelMethod · 0.45

Tested by

no test coverage detected