| 2178 | } |
| 2179 | |
| 2180 | void WorldServer::removeEntity(EntityId entityId, bool andDie) { |
| 2181 | auto entity = m_entityMap->entity(entityId); |
| 2182 | if (!entity) |
| 2183 | return; |
| 2184 | |
| 2185 | if (auto tileEntity = as<TileEntity>(entity)) |
| 2186 | updateTileEntityTiles(tileEntity, true); |
| 2187 | |
| 2188 | if (andDie) |
| 2189 | entity->destroy(nullptr); |
| 2190 | |
| 2191 | for (auto const& pair : m_clientInfo) { |
| 2192 | auto& clientInfo = pair.second; |
| 2193 | if (auto version = clientInfo->clientSlavesNetVersion.maybeTake(entity->entityId())) { |
| 2194 | auto netRules = clientInfo->clientState.netCompatibilityRules(); |
| 2195 | ByteArray finalDelta = entity->writeNetState(*version, netRules).first; |
| 2196 | clientInfo->outgoingPackets.append(make_shared<EntityDestroyPacket>(entity->entityId(), std::move(finalDelta), andDie)); |
| 2197 | } |
| 2198 | } |
| 2199 | |
| 2200 | m_entityMap->removeEntity(entityId); |
| 2201 | entity->uninit(); |
| 2202 | } |
| 2203 | |
| 2204 | float WorldServer::windLevel(Vec2F const& pos) const { |
| 2205 | return WorldImpl::windLevel(m_tileArray, pos, m_weather.wind()); |
nothing calls this directly
no test coverage detected