| 1791 | } |
| 1792 | |
| 1793 | void WorldServer::modifyLiquid(Vec2I const& pos, LiquidId liquid, float quantity, bool additive) { |
| 1794 | if (liquid == EmptyLiquidId) |
| 1795 | quantity = 0; |
| 1796 | |
| 1797 | if (ServerTile* tile = m_tileArray->modifyTile(pos)) { |
| 1798 | auto materialDatabase = Root::singleton().materialDatabase(); |
| 1799 | if (tile->foreground == EmptyMaterialId || !isSolidColliding(materialDatabase->materialCollisionKind(tile->foreground))) { |
| 1800 | if (additive && liquid == tile->liquid.liquid) |
| 1801 | quantity += tile->liquid.level; |
| 1802 | |
| 1803 | setLiquid(pos, liquid, quantity, tile->liquid.pressure); |
| 1804 | m_liquidEngine->visitLocation(pos); |
| 1805 | } |
| 1806 | } |
| 1807 | } |
| 1808 | |
| 1809 | void WorldServer::setLiquid(Vec2I const& pos, LiquidId liquid, float level, float pressure) { |
| 1810 | if (ServerTile* tile = m_tileArray->modifyTile(pos)) { |
no test coverage detected