This commit is contained in:
WoodyXP
2024-01-11 17:37:28 +01:00
parent b9201d583c
commit c042d2b6f5
4 changed files with 14 additions and 7 deletions

View File

@@ -211,12 +211,13 @@ private:
class SpawnAircrafts : public Command class SpawnAircrafts : public Command
{ {
public: public:
SpawnAircrafts(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate, function<void(void)> callback = [](){}) : SpawnAircrafts(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, string skill, bool immediate, function<void(void)> callback = [](){}) :
Command(callback), Command(callback),
coalition(coalition), coalition(coalition),
spawnOptions(spawnOptions), spawnOptions(spawnOptions),
airbaseName(airbaseName), airbaseName(airbaseName),
country(country), country(country),
skill(skill),
immediate(immediate) immediate(immediate)
{ {
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW; priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
@@ -229,6 +230,7 @@ private:
const vector<SpawnOptions> spawnOptions; const vector<SpawnOptions> spawnOptions;
const string airbaseName; const string airbaseName;
const string country; const string country;
const string skill;
const bool immediate; const bool immediate;
}; };
@@ -236,12 +238,13 @@ private:
class SpawnHelicopters : public Command class SpawnHelicopters : public Command
{ {
public: public:
SpawnHelicopters(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate, function<void(void)> callback = [](){}) : SpawnHelicopters(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, string skill, bool immediate, function<void(void)> callback = [](){}) :
Command(callback), Command(callback),
coalition(coalition), coalition(coalition),
spawnOptions(spawnOptions), spawnOptions(spawnOptions),
airbaseName(airbaseName), airbaseName(airbaseName),
country(country), country(country),
skill(skill),
immediate(immediate) immediate(immediate)
{ {
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW; priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
@@ -254,6 +257,7 @@ private:
const vector<SpawnOptions> spawnOptions; const vector<SpawnOptions> spawnOptions;
const string airbaseName; const string airbaseName;
const string country; const string country;
const string skill;
const bool immediate; const bool immediate;
}; };

View File

@@ -152,6 +152,7 @@ struct SpawnOptions {
string unitType; string unitType;
Coords location; Coords location;
string loadout; string loadout;
string skill;
string liveryID; string liveryID;
}; };

View File

@@ -106,6 +106,7 @@ string SpawnAircrafts::getString()
<< "coalition = " << "\"" << coalition << "\"" << ", " << "coalition = " << "\"" << coalition << "\"" << ", "
<< "airbaseName = \"" << airbaseName << "\", " << "airbaseName = \"" << airbaseName << "\", "
<< "country = \"" << country << "\", " << "country = \"" << country << "\", "
<< "skill = \"" << skill << "\", "
<< "units = " << "{" << unitsSS.str() << "}" << "}"; << "units = " << "{" << unitsSS.str() << "}" << "}";
return commandSS.str(); return commandSS.str();
} }
@@ -134,6 +135,7 @@ string SpawnHelicopters::getString()
<< "coalition = " << "\"" << coalition << "\"" << ", " << "coalition = " << "\"" << coalition << "\"" << ", "
<< "airbaseName = \"" << airbaseName << "\", " << "airbaseName = \"" << airbaseName << "\", "
<< "country = \"" << country << "\", " << "country = \"" << country << "\", "
<< "skill = \"" << skill << "\", "
<< "units = " << "{" << unitsSS.str() << "}" << "}"; << "units = " << "{" << unitsSS.str() << "}" << "}";
return commandSS.str(); return commandSS.str();
} }

View File

@@ -545,7 +545,7 @@ end
-- loadout: (string, optional) only for air units, must be one of the loadouts defined in unitPayloads.lua -- 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 -- payload: (table, optional) overrides loadout, specifies directly the loadout of the unit
-- liveryID: (string, optional) -- liveryID: (string, optional)
function Olympus.spawnUnits(spawnTable) function Olympus.spawnUnits(spawnTable, skill)
Olympus.debug("Olympus.spawnUnits " .. Olympus.serializeTable(spawnTable), 2) Olympus.debug("Olympus.spawnUnits " .. Olympus.serializeTable(spawnTable), 2)
local unitsTable = nil local unitsTable = nil
@@ -554,11 +554,11 @@ function Olympus.spawnUnits(spawnTable)
-- Generate the units table and route as per DCS requirements -- Generate the units table and route as per DCS requirements
if spawnTable.category == 'Aircraft' then if spawnTable.category == 'Aircraft' then
unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill)
route = Olympus.generateAirUnitsRoute(spawnTable) route = Olympus.generateAirUnitsRoute(spawnTable)
category = 'plane' category = 'plane'
elseif spawnTable.category == 'Helicopter' then elseif spawnTable.category == 'Helicopter' then
unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill)
route = Olympus.generateAirUnitsRoute(spawnTable) route = Olympus.generateAirUnitsRoute(spawnTable)
category = 'helicopter' category = 'helicopter'
elseif spawnTable.category == 'GroundUnit' then elseif spawnTable.category == 'GroundUnit' then
@@ -1109,9 +1109,9 @@ function Olympus.setUnitsData(arg, time)
-- Generate the units table as per DCS requirements -- Generate the units table as per DCS requirements
if table["category"] == 'Aircraft' then if table["category"] == 'Aircraft' then
unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill)
elseif table["category"] == 'Helicopter' then elseif table["category"] == 'Helicopter' then
unitsTable = Olympus.generateAirUnitsTable(spawnTable.units) unitsTable = Olympus.generateAirUnitsTable(spawnTable.units, skill)
elseif table["category"] == 'GroundUnit' then elseif table["category"] == 'GroundUnit' then
unitsTable = Olympus.generateGroundUnitsTable(spawnTable.units) unitsTable = Olympus.generateGroundUnitsTable(spawnTable.units)
elseif table["category"] == 'NavyUnit' then elseif table["category"] == 'NavyUnit' then