| 2382 | } |
| 2383 | |
| 2384 | void WorldClient::informTilePrediction(Vec2I const& pos, TileModification const& modification) { |
| 2385 | auto now = Time::monotonicMilliseconds(); |
| 2386 | auto& p = m_predictedTiles[pos]; |
| 2387 | p.time = now; |
| 2388 | if (auto placeMaterial = modification.ptr<PlaceMaterial>()) { |
| 2389 | if (placeMaterial->layer == TileLayer::Foreground) { |
| 2390 | auto materialDatabase = Root::singleton().materialDatabase(); |
| 2391 | if (!materialDatabase->isCascadingFallingMaterial(placeMaterial->material) |
| 2392 | && !materialDatabase-> isFallingMaterial(placeMaterial->material)) { |
| 2393 | p.foreground = placeMaterial->material; |
| 2394 | p.foregroundHueShift = placeMaterial->materialHueShift; |
| 2395 | } |
| 2396 | else |
| 2397 | p.foreground = StructureMaterialId; |
| 2398 | if (placeMaterial->collisionOverride != TileCollisionOverride::None) |
| 2399 | p.collision = collisionKindFromOverride(placeMaterial->collisionOverride); |
| 2400 | else |
| 2401 | p.collision = materialDatabase->materialCollisionKind(placeMaterial->material); |
| 2402 | dirtyCollision(RectI::withSize(pos, { 1, 1 })); |
| 2403 | } else { |
| 2404 | p.background = placeMaterial->material; |
| 2405 | p.backgroundHueShift = placeMaterial->materialHueShift; |
| 2406 | } |
| 2407 | } |
| 2408 | else if (auto placeMod = modification.ptr<PlaceMod>()) { |
| 2409 | if (placeMod->layer == TileLayer::Foreground) |
| 2410 | p.foregroundMod = placeMod->mod; |
| 2411 | else |
| 2412 | p.backgroundMod = placeMod->mod; |
| 2413 | } |
| 2414 | else if (auto placeColor = modification.ptr<PlaceMaterialColor>()) { |
| 2415 | if (placeColor->layer == TileLayer::Foreground) |
| 2416 | p.foregroundColorVariant = placeColor->color; |
| 2417 | else |
| 2418 | p.backgroundColorVariant = placeColor->color; |
| 2419 | } |
| 2420 | else if (auto placeLiquid = modification.ptr<PlaceLiquid>()) { |
| 2421 | if (!p.liquid || p.liquid->liquid != placeLiquid->liquid) |
| 2422 | p.liquid = LiquidLevel(placeLiquid->liquid, placeLiquid->liquidLevel); |
| 2423 | else |
| 2424 | p.liquid->level += placeLiquid->liquidLevel; |
| 2425 | } |
| 2426 | } |
| 2427 | |
| 2428 | void WorldClient::setupForceRegions() { |
| 2429 | m_forceRegions.clear(); |
nothing calls this directly
no test coverage detected