mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Feat: added backend ability to set spawn heading
This commit is contained in:
@@ -155,6 +155,7 @@ struct SpawnOptions {
|
||||
string loadout;
|
||||
string skill;
|
||||
string liveryID;
|
||||
double heading;
|
||||
};
|
||||
|
||||
struct CloneOptions {
|
||||
|
||||
@@ -170,7 +170,8 @@ void AirUnit::AIloop()
|
||||
if (isActiveTanker) {
|
||||
taskSS << "{ [1] = { id = 'Tanker' }, [2] = { id = 'Orbit', pattern = 'Race-Track', altitude = " <<
|
||||
desiredAltitude << ", speed = " << desiredSpeed << ", altitudeType = '" <<
|
||||
(desiredAltitudeType ? "AGL" : "ASL") << "', speedType = '" << (desiredSpeedType ? "GS" : "CAS") << "' }}";
|
||||
(desiredAltitudeType ? "AGL" : "ASL") << "', speedType = '" << (desiredSpeedType ? "GS" : "CAS") << "', heading = " <<
|
||||
heading << ", length = " << (50000 * 1.852) << " }}";
|
||||
}
|
||||
else if (isActiveAWACS) {
|
||||
taskSS << "{ [1] = { id = 'AWACS' }, [2] = { id = 'Orbit', pattern = 'Circle', altitude = " <<
|
||||
@@ -178,9 +179,10 @@ void AirUnit::AIloop()
|
||||
(desiredAltitudeType ? "AGL" : "ASL") << "', speedType = '" << (desiredSpeedType ? "GS" : "CAS") << "' }}";
|
||||
}
|
||||
else {
|
||||
taskSS << "{ id = 'Orbit', pattern = 'Circle', altitude = " <<
|
||||
taskSS << "{ id = 'Orbit', pattern = 'Race-Track', altitude = " <<
|
||||
desiredAltitude << ", speed = " << desiredSpeed << ", altitudeType = '" <<
|
||||
(desiredAltitudeType ? "AGL" : "ASL") << "', speedType = '" << (desiredSpeedType ? "GS" : "CAS") << "'}";
|
||||
(desiredAltitudeType ? "AGL" : "ASL") << "', speedType = '" << (desiredSpeedType ? "GS" : "CAS") << "', heading = " <<
|
||||
heading << ", length = " << desiredSpeed * 30 << " }";
|
||||
}
|
||||
Command* command = dynamic_cast<Command*>(new SetTask(groupName, taskSS.str(), [this]() { this->setHasTaskAssigned(true); }));
|
||||
scheduler->appendCommand(command);
|
||||
|
||||
@@ -46,6 +46,7 @@ string SpawnGroundUnits::getString()
|
||||
<< "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", "
|
||||
<< "lat = " << spawnOptions[i].location.lat << ", "
|
||||
<< "lng = " << spawnOptions[i].location.lng << ", "
|
||||
<< "heading = " << spawnOptions[i].heading << ", "
|
||||
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
|
||||
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
|
||||
|
||||
@@ -72,6 +73,7 @@ string SpawnNavyUnits::getString()
|
||||
<< "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", "
|
||||
<< "lat = " << spawnOptions[i].location.lat << ", "
|
||||
<< "lng = " << spawnOptions[i].location.lng << ", "
|
||||
<< "heading = " << spawnOptions[i].heading << ", "
|
||||
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
|
||||
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
|
||||
}
|
||||
@@ -97,6 +99,7 @@ string SpawnAircrafts::getString()
|
||||
<< "lat = " << spawnOptions[i].location.lat << ", "
|
||||
<< "lng = " << spawnOptions[i].location.lng << ", "
|
||||
<< "alt = " << spawnOptions[i].location.alt << ", "
|
||||
<< "heading = " << spawnOptions[i].heading << ", "
|
||||
<< "loadout = \"" << spawnOptions[i].loadout << "\"" << ", "
|
||||
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
|
||||
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
|
||||
@@ -125,6 +128,7 @@ string SpawnHelicopters::getString()
|
||||
<< "lat = " << spawnOptions[i].location.lat << ", "
|
||||
<< "lng = " << spawnOptions[i].location.lng << ", "
|
||||
<< "alt = " << spawnOptions[i].location.alt << ", "
|
||||
<< "heading = " << spawnOptions[i].heading << ", "
|
||||
<< "loadout = \"" << spawnOptions[i].loadout << "\"" << ", "
|
||||
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << ", "
|
||||
<< "skill = \"" << spawnOptions[i].skill << "\"" << "}, ";
|
||||
|
||||
@@ -202,12 +202,16 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
|
||||
double lat = unit[L"location"][L"lat"].as_double();
|
||||
double lng = unit[L"location"][L"lng"].as_double();
|
||||
double alt = unit[L"altitude"].as_double();
|
||||
double heading = 0;
|
||||
if (unit.has_number_field(L"heading"))
|
||||
heading = unit[L"heading"].as_double();
|
||||
|
||||
Coords location; location.lat = lat; location.lng = lng; location.alt = alt;
|
||||
string loadout = to_string(unit[L"loadout"]);
|
||||
string liveryID = to_string(unit[L"liveryID"]);
|
||||
string skill = to_string(unit[L"skill"]);
|
||||
|
||||
spawnOptions.push_back({unitType, location, loadout, skill, liveryID});
|
||||
spawnOptions.push_back({unitType, location, loadout, skill, liveryID, heading});
|
||||
log(username + " spawned a " + coalition + " " + unitType , true);
|
||||
}
|
||||
|
||||
@@ -231,11 +235,15 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
|
||||
string unitType = to_string(unit[L"unitType"]);
|
||||
double lat = unit[L"location"][L"lat"].as_double();
|
||||
double lng = unit[L"location"][L"lng"].as_double();
|
||||
double heading = 0;
|
||||
if (unit.has_number_field(L"heading"))
|
||||
heading = unit[L"heading"].as_double();
|
||||
|
||||
Coords location; location.lat = lat; location.lng = lng;
|
||||
string liveryID = to_string(unit[L"liveryID"]);
|
||||
string skill = to_string(unit[L"skill"]);
|
||||
|
||||
spawnOptions.push_back({ unitType, location, "", skill, liveryID});
|
||||
spawnOptions.push_back({ unitType, location, "", skill, liveryID, heading});
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user