diff --git a/frontend/react/src/server/servermanager.ts b/frontend/react/src/server/servermanager.ts index ba116042..e080627c 100644 --- a/frontend/react/src/server/servermanager.ts +++ b/frontend/react/src/server/servermanager.ts @@ -100,13 +100,14 @@ export class ServerManager { ) { var xmlHttp = new XMLHttpRequest(); + /* V2: commented out because we now use timeouts */ /* If a request on this uri is still pending (meaning it's not done or did not yet fail), skip the request, to avoid clogging the TCP workers */ /* If we are forcing the request we don't care if one already exists, just send it. CAREFUL: this makes sense only for low frequency requests, like refreshes, when we are reasonably confident any previous request will be done before we make a new one on the same URI. */ - if (uri in this.#requests && this.#requests[uri].readyState !== 4 && !force) { - //console.warn(`GET request on ${uri} URI still pending, skipping...`); - return; - } + //if (uri in this.#requests && this.#requests[uri].readyState !== 4 && !force) { + // //console.warn(`GET request on ${uri} URI still pending, skipping...`); + // //return; + //} if (!force) this.#requests[uri] = xmlHttp; @@ -806,7 +807,7 @@ export class ServerManager { return time; }, true); - window.setInterval(() => { + window.setTimeout(() => { this.getUnits((buffer: ArrayBuffer) => { var time = getApp().getUnitsManager()?.update(buffer, true); return time; @@ -815,7 +816,6 @@ export class ServerManager { } checkSessionHash(newSessionHash: string) { - console.log(`Checking session hash: ${newSessionHash}`); if (this.#sessionHash != null) { if (newSessionHash !== this.#sessionHash) location.reload(); } else { @@ -826,11 +826,7 @@ export class ServerManager { setConnected(newConnected: boolean) { if (this.#connected != newConnected) { - newConnected ? getApp().addInfoMessage("Connected to DCS Olympus server") : getApp().addInfoMessage("Disconnected from DCS Olympus server"); - if (newConnected) { - document.getElementById("splash-screen")?.classList.add("hide"); - document.getElementById("gray-out")?.classList.add("hide"); - } + //newConnected ? getApp().addInfoMessage("Connected to DCS Olympus server") : getApp().addInfoMessage("Disconnected from DCS Olympus server"); } this.#connected = newConnected; diff --git a/frontend/react/src/ui/panels/unitcontrolmenu.tsx b/frontend/react/src/ui/panels/unitcontrolmenu.tsx index b2f2c3a4..4a3de7ce 100644 --- a/frontend/react/src/ui/panels/unitcontrolmenu.tsx +++ b/frontend/react/src/ui/panels/unitcontrolmenu.tsx @@ -90,7 +90,7 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { radio: undefined as undefined | Radio, TACAN: undefined as undefined | TACAN, generalSettings: undefined as undefined | GeneralSettings, - alarmState: undefined as undefined | AlarmState + alarmState: undefined as undefined | AlarmState, }; } @@ -207,11 +207,11 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { Object.entries(getters).forEach(([key, getter]) => { let newDatum = getApp()?.getUnitsManager()?.getSelectedUnitsVariable(getter); if (forcedUnitsData[key] !== undefined) { - if (newDatum === updatedData[key]) { + if (newDatum === forcedUnitsData[key]) { anyForcedDataUpdated = true; - forcedUnitsData[key] === undefined; + forcedUnitsData[key] = undefined; } - updatedData[key] = forcedUnitsData[key]; + else updatedData[key] = forcedUnitsData[key]; } else updatedData[key] = newDatum; }); setSelectedUnitsData(updatedData as typeof selectedUnitsData); @@ -420,12 +420,9 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { return ( - {" "} -
- {entry[1][1] as string} -
+
{entry[1][1] as string}
{["blue", "neutral", "red"].map((coalition) => { return ( @@ -800,65 +797,53 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) {
{" "} - {" "} - Hold fire: The unit will not shoot in any circumstance + Hold fire: The unit will not shoot in + any circumstance
{" "} - {" "} - Return fire: The unit will not fire unless fired upon + Return fire: The unit will not fire + unless fired upon
{" "} - {" "} + {" "}
{" "} - Fire on target: The unit will not fire unless fired upon{" "} -

- or -

{" "} - ordered to do so{" "} + Fire on target: The unit will not fire unless fired upon

or

ordered to do so{" "}
{" "} - {" "} - Free: The unit will fire at any detected enemy in range + Free: The unit will fire at any + detected enemy in range
- +
Currently, DCS blue and red ground units do not respect{" "} - {" "} - and{" "} - {" "} - rules of engagement, so be careful, they may start shooting when you don't want them to. Use neutral units for finer - control. + and{" "} + rules of engagement, so be careful, they + may start shooting when you don't want them to. Use neutral units for finer control.
@@ -901,7 +886,7 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { `} > Alarm State - + ( void }) {
Sets the alarm state of the unit, in order:
-
+
{" "} - Green: The unit will not engage with its sensors in any circumstances. The unit will be able to move. + `} + />{" "} + Green: The unit will not engage with its sensors in any circumstances. The unit will be able to move.
{" "} - {" "} -
- {" "} - Auto: The unit will use its sensors to engage based on its ROE. -
+ `} + />{" "} +
Auto: The unit will use its sensors to engage based on its ROE.
- +
{" "} - Red: The unit will be actively searching for target with its sensors. For some units, this will deploy - the radar and make the unit not able to move. + `} + />{" "} + Red: The unit will be actively searching for target with its sensors. For some units, this will deploy the radar and make + the unit not able to move.
@@ -965,7 +958,6 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { } {/* ============== Alarm state selector END ============== */} - {selectedCategories.every((category) => { return ["Aircraft", "Helicopter"].includes(category); }) && ( @@ -990,35 +982,31 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) {
{" "} - {" "} - No reaction: The unit will not react in any circumstance + No reaction: The unit will not + react in any circumstance
{" "} - {" "} - Passive: The unit will use counter-measures, but will not alter its course + Passive: The unit will use + counter-measures, but will not alter its course
{" "} - {" "} - Manouevre: The unit will try to evade the threat using manoeuvres, but no counter-measures + Manouevre: The unit will try + to evade the threat using manoeuvres, but no counter-measures
{" "} - {" "} - Full evasion: the unit will try to evade the threat both manoeuvering and using counter-measures + Full evasion: the unit will try + to evade the threat both manoeuvering and using counter-measures
@@ -1069,35 +1057,31 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) {
{" "} - {" "} - Radio silence: No radar or ECM will be used + Radio silence: No radar or + ECM will be used
{" "} - {" "} - Defensive: The unit will turn radar and ECM on only when threatened + Defensive: The unit will turn + radar and ECM on only when threatened
{" "} - {" "} - Attack: The unit will use radar and ECM when engaging other units + Attack: The unit will use + radar and ECM when engaging other units
{" "} - {" "} - Free: the unit will use the radar and ECM all the time + Free: the unit will use the + radar and ECM all the time
@@ -1315,9 +1299,9 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { >
- +
Currently, DCS blue and red ground units do not respect their rules of engagement, so be careful, they may start shooting when @@ -1348,7 +1332,6 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { .stop(null, () => setForcedUnitsData({ ...forcedUnitsData, - missOnPurpose: false, scenicAAA: false, }) ); @@ -1358,7 +1341,6 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { .scenicAAA(null, () => setForcedUnitsData({ ...forcedUnitsData, - missOnPurpose: false, scenicAAA: true, }) ); @@ -1393,7 +1375,6 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { .stop(null, () => setForcedUnitsData({ ...forcedUnitsData, - scenicAAA: false, missOnPurpose: false, }) ); @@ -1403,7 +1384,6 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { .missOnPurpose(null, () => setForcedUnitsData({ ...forcedUnitsData, - scenicAAA: false, missOnPurpose: true, }) ); @@ -1496,9 +1476,9 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) {
{/* ============== Operate as toggle START ============== */} {selectedUnits.every((unit) => unit.getCoalition() === "neutral") && ( -
+
void }) { `} >
-
- Barrel height:{" "} -
+
Barrel height:
void }) { setBarrelHeight(barrelHeight - 0.1); }} > -
- m -
+
m
-
- Muzzle velocity:{" "} -
+
Muzzle velocity:
void }) { setMuzzleVelocity(muzzleVelocity - 10); }} > -
- m/s -
+
m/s
-
- Aim time:{" "} -
+
Aim time:
void }) { setAimTime(aimTime - 0.1); }} > -
- s -
+
s
-
- Shots to fire:{" "} -
+
Shots to fire:
void }) { >
-
- Shots base interval:{" "} -
+
Shots base interval:
void }) { setShotsBaseInterval(shotsBaseInterval - 0.1); }} > -
- s -
+
s
-
- Shots base scatter:{" "} -
+
Shots base scatter:
void }) { setShotsBaseScatter(shotsBaseScatter - 0.1); }} > -
- deg -
+
deg
-
- Engagement range:{" "} -
+
Engagement range:
void }) { setEngagementRange(engagementRange - 100); }} > -
- m -
+
m
-
- Targeting range:{" "} -
+
Targeting range:
void }) { setTargetingRange(targetingRange - 100); }} > -
- m -
+
m
-
- Aim method range:{" "} -
+
Aim method range:
void }) { setAimMethodRange(aimMethodRange - 100); }} > -
- m -
+
m
-
- Acquisition range:{" "} -
+
Acquisition range:
void }) { setAcquisitionRange(acquisitionRange - 100); }} > -
- m -
+
m
diff --git a/frontend/react/src/ui/ui.tsx b/frontend/react/src/ui/ui.tsx index 394a5f1a..ab159ca5 100644 --- a/frontend/react/src/ui/ui.tsx +++ b/frontend/react/src/ui/ui.tsx @@ -141,7 +141,7 @@ export function UI() {
{!connectedOnce &&
Establishing connection
} {connectedOnce &&
Connection lost
} - {!connectedOnce &&
Trying to connect with the server, please wait...
} + {!connectedOnce &&
Trying to connect to the server, please wait...
} {connectedOnce && (
Try reloading this page. However, this usually means that you internet connection is down, or that the server is offline, paused, or loading a