mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix: Groups emptied correctly when all units are killed
This commit is contained in:
parent
4f927faeb4
commit
a65a5a5bed
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3
databases/units/mods.json
Normal file
3
databases/units/mods.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
@ -325,6 +325,7 @@ export enum OlympusState {
|
||||
GAME_MASTER = "Game master",
|
||||
IMPORT_EXPORT = "Import/export",
|
||||
WARNING = "Warning modal",
|
||||
DATABASE_EDITOR = "Database editor"
|
||||
}
|
||||
|
||||
export const NO_SUBSTATE = "No substate";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { OlStateButton } from "../components/olstatebutton";
|
||||
import { faGamepad, faPencil, faEllipsisV, faCog, faQuestionCircle, faPlusSquare, faVolumeHigh, faJ, faCrown, faA } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faGamepad, faPencil, faEllipsisV, faCog, faQuestionCircle, faPlusSquare, faVolumeHigh, faJ, faCrown, faA, faDatabase } from "@fortawesome/free-solid-svg-icons";
|
||||
import { getApp } from "../../olympusapp";
|
||||
import { NO_SUBSTATE, OlympusState, OlympusSubState, SpawnSubState } from "../../constants/constants";
|
||||
import { AppStateChangedEvent } from "../../events";
|
||||
|
||||
@ -141,10 +141,13 @@ export function UI() {
|
||||
<div
|
||||
className={`
|
||||
absolute left-0 top-0 z-50 flex h-screen w-screen items-center
|
||||
justify-center bg-gray-900 bg-opacity-80 text-white backdrop-blur-sm
|
||||
justify-center bg-gray-900 bg-opacity-80 text-center text-white
|
||||
backdrop-blur-sm
|
||||
`}
|
||||
>
|
||||
<div className="flex flex-col items-center justify-center gap-4">
|
||||
<div className={`
|
||||
flex w-[400px] flex-col items-center justify-center gap-4
|
||||
`}>
|
||||
<div className="bouncing-ball">
|
||||
<img
|
||||
src="images/olympus-500x500.png"
|
||||
|
||||
@ -20,7 +20,7 @@ export class UnitDatabase {
|
||||
const newBlueprints = xhr.response as { [key: string]: UnitBlueprint };
|
||||
for (let unit in newBlueprints) {
|
||||
if (!newBlueprints[unit].category) {
|
||||
if (category) newBlueprints[unit].category = category
|
||||
if (category) newBlueprints[unit].category = category
|
||||
else console.warn(`No category provided for ${unit}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,8 +766,10 @@ export abstract class Unit extends CustomMarker {
|
||||
* @param newAlive (boolean) true = alive, false = dead
|
||||
*/
|
||||
setAlive(newAlive: boolean) {
|
||||
if (newAlive != this.#alive) UnitDeadEvent.dispatch(this);
|
||||
this.#alive = newAlive;
|
||||
if (newAlive != this.#alive) {
|
||||
this.#alive = newAlive;
|
||||
UnitDeadEvent.dispatch(this);
|
||||
}
|
||||
}
|
||||
|
||||
/** Set the unit as user-selected
|
||||
|
||||
@ -61,6 +61,7 @@ export class UnitsManager {
|
||||
this.#unitDatabase.load("./api/databases/units/helicopterdatabase", "helicopter");
|
||||
this.#unitDatabase.load("./api/databases/units/groundunitdatabase", "groundunit");
|
||||
this.#unitDatabase.load("./api/databases/units/navyunitdatabase", "navyunit");
|
||||
this.#unitDatabase.load("./api/databases/units/mods");
|
||||
|
||||
CommandModeOptionsChangedEvent.on(() => {
|
||||
Object.values(this.#units).forEach((unit: Unit) => unit.updateVisibility());
|
||||
|
||||
@ -9,54 +9,5 @@ module.exports = function (databasesLocation) {
|
||||
var contents = fs.readFileSync(path.join(databasesLocation, req.params.type, req.params.name + ".json"));
|
||||
res.status(200).send(contents);
|
||||
});
|
||||
|
||||
router.put('/save/:type/:name', function (req, res) {
|
||||
var dir = path.join(databasesLocation, req.params.type, "old");
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
|
||||
var filepath = path.join(databasesLocation, req.params.type, req.params.name + ".json");
|
||||
if (fs.existsSync(filepath)) {
|
||||
var newFilepath = path.join(databasesLocation, req.params.type, "old", req.params.name + ".json");
|
||||
fs.copyFileSync(filepath, newFilepath);
|
||||
if (fs.existsSync(newFilepath)) {
|
||||
try {
|
||||
var json = JSON.stringify(req.body.blueprints, null, "\t");
|
||||
fs.writeFileSync(filepath, json, 'utf8');
|
||||
res.send("OK");
|
||||
} catch {
|
||||
res.status(422).send("Error");
|
||||
}
|
||||
} else {
|
||||
res.status(422).send("Error");
|
||||
}
|
||||
} else {
|
||||
res.status(404).send('Not found');
|
||||
}
|
||||
});
|
||||
|
||||
router.put('/reset/:type/:name', function (req, res) {
|
||||
var filepath = path.join(databasesLocation, req.params.type, "default", req.params.name + ".json");
|
||||
if (fs.existsSync(filepath)) {
|
||||
var newFilepath = path.join(databasesLocation, req.params.type, req.params.name + ".json");
|
||||
fs.copyFileSync(filepath, newFilepath);
|
||||
res.send("OK");
|
||||
} else {
|
||||
res.status(404).send('Not found');
|
||||
}
|
||||
});
|
||||
|
||||
router.put('/restore/:type/:name', function (req, res) {
|
||||
var filepath = path.join(databasesLocation, req.params.type, "old", req.params.name + ".json");
|
||||
if (fs.existsSync(filepath)) {
|
||||
var newFilepath = path.join(databasesLocation, req.params.type, req.params.name + ".json");
|
||||
fs.copyFileSync(filepath, newFilepath);
|
||||
res.send("OK");
|
||||
} else {
|
||||
res.status(404).send('Not found');
|
||||
}
|
||||
});
|
||||
|
||||
return router;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user