diff --git a/backend/core/include/commands.h b/backend/core/include/commands.h index 2badd091..f0071562 100644 --- a/backend/core/include/commands.h +++ b/backend/core/include/commands.h @@ -211,12 +211,13 @@ private: class SpawnAircrafts : public Command { public: - SpawnAircrafts(string coalition, vector spawnOptions, string airbaseName, string country, bool immediate, function callback = [](){}) : + SpawnAircrafts(string coalition, vector spawnOptions, string airbaseName, string country, string skill, bool immediate, function callback = [](){}) : Command(callback), coalition(coalition), spawnOptions(spawnOptions), airbaseName(airbaseName), country(country), + skill(skill), immediate(immediate) { priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW; @@ -229,6 +230,7 @@ private: const vector spawnOptions; const string airbaseName; const string country; + const string skill; const bool immediate; }; @@ -236,12 +238,13 @@ private: class SpawnHelicopters : public Command { public: - SpawnHelicopters(string coalition, vector spawnOptions, string airbaseName, string country, bool immediate, function callback = [](){}) : + SpawnHelicopters(string coalition, vector spawnOptions, string airbaseName, string country, string skill, bool immediate, function callback = [](){}) : Command(callback), coalition(coalition), spawnOptions(spawnOptions), airbaseName(airbaseName), country(country), + skill(skill), immediate(immediate) { priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW; @@ -254,6 +257,7 @@ private: const vector spawnOptions; const string airbaseName; const string country; + const string skill; const bool immediate; }; diff --git a/backend/core/include/datatypes.h b/backend/core/include/datatypes.h index 6dd44e85..c0e1c86e 100644 --- a/backend/core/include/datatypes.h +++ b/backend/core/include/datatypes.h @@ -152,6 +152,7 @@ struct SpawnOptions { string unitType; Coords location; string loadout; + string skill; string liveryID; }; diff --git a/backend/core/src/commands.cpp b/backend/core/src/commands.cpp index e7579d05..a0868ca1 100644 --- a/backend/core/src/commands.cpp +++ b/backend/core/src/commands.cpp @@ -106,6 +106,7 @@ string SpawnAircrafts::getString() << "coalition = " << "\"" << coalition << "\"" << ", " << "airbaseName = \"" << airbaseName << "\", " << "country = \"" << country << "\", " + << "skill = \"" << skill << "\", " << "units = " << "{" << unitsSS.str() << "}" << "}"; return commandSS.str(); } @@ -134,6 +135,7 @@ string SpawnHelicopters::getString() << "coalition = " << "\"" << coalition << "\"" << ", " << "airbaseName = \"" << airbaseName << "\", " << "country = \"" << country << "\", " + << "skill = \"" << skill << "\", " << "units = " << "{" << unitsSS.str() << "}" << "}"; return commandSS.str(); } diff --git a/scripts/lua/backend/OlympusCommand.lua b/scripts/lua/backend/OlympusCommand.lua index e7da4ce3..fcdb37eb 100644 --- a/scripts/lua/backend/OlympusCommand.lua +++ b/scripts/lua/backend/OlympusCommand.lua @@ -545,7 +545,7 @@ end -- loadout: (string, optional) only for air units, must be one of the loadouts defined in unitPayloads.lua -- payload: (table, optional) overrides loadout, specifies directly the loadout of the unit -- liveryID: (string, optional) -function Olympus.spawnUnits(spawnTable) +function Olympus.spawnUnits(spawnTable, skill) Olympus.debug("Olympus.spawnUnits " .. Olympus.serializeTable(spawnTable), 2) local unitsTable = nil @@ -554,11 +554,11 @@ function Olympus.spawnUnits(spawnTable) -- Generate the units table and route as per DCS requirements if spawnTable.category == 'Aircraft' then - unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) + unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill) route = Olympus.generateAirUnitsRoute(spawnTable) category = 'plane' elseif spawnTable.category == 'Helicopter' then - unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) + unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill) route = Olympus.generateAirUnitsRoute(spawnTable) category = 'helicopter' elseif spawnTable.category == 'GroundUnit' then @@ -1109,9 +1109,9 @@ function Olympus.setUnitsData(arg, time) -- Generate the units table as per DCS requirements if table["category"] == 'Aircraft' then - unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) + unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill) elseif table["category"] == 'Helicopter' then - unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) + unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill) elseif table["category"] == 'GroundUnit' then unitsTable = Olympus.generateGroundUnitsTable(spawnTable.units) elseif table["category"] == 'NavyUnit' then