MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / genNewFlight

Function genNewFlight

src/Components/WorldMap/display.js:189–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187}
188
189function genNewFlight() {
190 if (!force && nextGenTime > lastTimestamp) {
191 return;
192 }
193 nextGenTime = lastTimestamp + 2000 + Math.random() * 4000;
194 const flight = {};
195 flight.progress = 0;
196 const new_flight = UnivList[Math.floor(Math.random() * UnivList.length)];
197 flight.latitude = new_flight.latitude;
198 flight.longitude = new_flight.longitude;
199 const longitude = flight.longitude < 0 ? flight.longitude + 360 : flight.longitude;
200 flight.total = (flight.latitude - shanghai[1]) ** 2 + (longitude - shanghai[0]) ** 2;
201 flight.tail_progrss = -longest_tail;
202 flights.push(flight);
203}
204
205function lightModeRedraw() {
206 flights = flights.filter(flight => flight.tail_progrss < flight.total);

Callers 1

lightModeRedrawFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected