Move unculled zones out of MapModel.

This commit is contained in:
Dan Albert
2022-02-22 19:37:43 -08:00
parent 95836a217c
commit 1c543666b5
8 changed files with 45 additions and 70 deletions

View File

@@ -385,7 +385,6 @@ new QWebChannel(qt.webChannelTransport, function (channel) {
game.flightsChanged.connect(drawAircraft);
game.threatZonesChanged.connect(drawThreatZones);
game.mapZonesChanged.connect(drawMapZones);
game.unculledZonesChanged.connect(drawUnculledZones);
game.selectedFlightChanged.connect(updateSelectedFlight);
});
@@ -402,6 +401,9 @@ function handleStreamedEvents(events) {
for (const player of events.navmesh_updates) {
drawNavmesh(player);
}
if (events.unculled_zones_updated) {
drawUnculledZones();
}
}
function recenterMap(center) {
@@ -1124,7 +1126,7 @@ function drawMapZones() {
inclusionZones.clearLayers();
exclusionZones.clearLayers();
getJson("/map-zones").then((zones) => {
getJson("/map-zones/terrain").then((zones) => {
for (const zone of zones.sea) {
L.polygon(zone, {
color: "#344455",
@@ -1157,14 +1159,16 @@ function drawMapZones() {
function drawUnculledZones() {
unculledZones.clearLayers();
for (const zone of game.unculledZones) {
L.circle(zone.position, {
radius: zone.radius,
color: "#b4ff8c",
fill: false,
interactive: false,
}).addTo(unculledZones);
}
getJson("/map-zones/unculled").then((zones) => {
for (const zone of zones) {
L.circle(zone.position, {
radius: zone.radius,
color: "#b4ff8c",
fill: false,
interactive: false,
}).addTo(unculledZones);
}
});
}
function drawIpZones(id) {