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

Method liquidInteraction

source/game/StarWorldGeneration.cpp:98–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void LiquidWorld::liquidInteraction(Vec2I const& a, LiquidId aLiquid, Vec2I const& b, LiquidId bLiquid) {
99 auto handleInteraction = [this](Vec2I const& target, Maybe<LiquidInteractionResult> interaction) {
100 if (interaction) {
101 if (interaction->isLeft()) {
102 m_worldServer->modifyTile(target, PlaceMaterial{TileLayer::Foreground, interaction->left(), 0}, false);
103 } else {
104 auto liquidLevel = m_worldServer->liquidLevel(target);
105 m_worldServer->setLiquid(target, interaction->right(), liquidLevel.level, liquidLevel.level);
106 }
107 }
108 };
109
110 handleInteraction(a, m_liquidsDatabase->interact(aLiquid, bLiquid));
111 handleInteraction(b, m_liquidsDatabase->interact(bLiquid, aLiquid));
112}
113
114void LiquidWorld::liquidCollision(Vec2I const& liquidPos, LiquidId liquidId, Vec2I const& blockPos) {
115 auto const& blockTile = m_worldServer->getServerTile(blockPos);

Callers

nothing calls this directly

Calls 7

isLeftMethod · 0.80
leftMethod · 0.80
rightMethod · 0.80
modifyTileMethod · 0.45
liquidLevelMethod · 0.45
setLiquidMethod · 0.45
interactMethod · 0.45

Tested by

no test coverage detected