| 96 | } |
| 97 | |
| 98 | void 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 | |
| 114 | void LiquidWorld::liquidCollision(Vec2I const& liquidPos, LiquidId liquidId, Vec2I const& blockPos) { |
| 115 | auto const& blockTile = m_worldServer->getServerTile(blockPos); |
nothing calls this directly
no test coverage detected