Add (very!) rough simulation of frozen combat.

There are some TODOs here but th behavior is flagged off by default. The
biggest TODO here is that the time spent frozen is not simulated, so
flights that are engaged by SAMs will unfreeze, move slightly, then re-
freeze.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
This commit is contained in:
Dan Albert
2021-12-22 13:07:10 -08:00
parent bc41261009
commit 2585dcc130
19 changed files with 260 additions and 35 deletions

View File

@@ -400,6 +400,10 @@ function handleStreamedEvents(events) {
redrawCombat(combat);
}
for (const combatId of events.ended_combats) {
clearCombat(combatId);
}
for (const player of events.navmesh_updates) {
drawNavmesh(player);
}
@@ -1355,18 +1359,23 @@ function drawHoldZones(id) {
var COMBATS = {};
function redrawCombat(combat) {
if (combat.id in COMBATS) {
for (layer in COMBATS[combat.id]) {
function clearCombat(id) {
if (id in COMBATS) {
for (const layer of COMBATS[id]) {
layer.removeFrom(combatLayer);
}
delete COMBATS[id];
}
}
function redrawCombat(combat) {
clearCombat(combat.id);
const layers = [];
if (combat.footprint) {
layers.push(
L.polygon(airCombat.footprint, {
L.polygon(combat.footprint, {
color: Colors.Red,
interactive: false,
fillOpacity: 0.2,