mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Follow, tankers and AWACS completed
This commit is contained in:
@@ -169,6 +169,7 @@ protected:
|
||||
|
||||
/********** Mission data **********/
|
||||
double fuel = 0;
|
||||
double initialFuel = 0; // Used internally to detect refueling completed
|
||||
json::value ammo = json::value::null();
|
||||
json::value targets = json::value::null();
|
||||
bool hasTask = false;
|
||||
@@ -193,12 +194,12 @@ protected:
|
||||
bool isTanker = false;
|
||||
bool isAWACS = false;
|
||||
bool TACANOn = false;
|
||||
int TACANChannel = 0;
|
||||
int TACANChannel = 40;
|
||||
wstring TACANXY = L"X";
|
||||
wstring TACANCallsign = L"TKR";
|
||||
bool radioOn = false;
|
||||
int radioFrequency = 0;
|
||||
int radioCallsign = 0;
|
||||
int radioFrequency = 260000000; // MHz
|
||||
int radioCallsign = 1;
|
||||
int radioCallsignNumber = 1;
|
||||
|
||||
/********** Options data **********/
|
||||
|
||||
@@ -83,6 +83,7 @@ void AirUnit::setState(int newState)
|
||||
break;
|
||||
}
|
||||
case State::REFUEL: {
|
||||
initialFuel = fuel;
|
||||
clearActivePath();
|
||||
resetActiveDestination();
|
||||
addMeasure(L"currentState", json::value(L"Refuel"));
|
||||
@@ -192,6 +193,9 @@ void AirUnit::AIloop()
|
||||
if (isTanker) {
|
||||
taskSS << "{ [1] = { id = 'Tanker' }, [2] = { id = 'Orbit', pattern = 'Race-Track' } }";
|
||||
}
|
||||
else if (isAWACS) {
|
||||
taskSS << "{ [1] = { id = 'AWACS' }, [2] = { id = 'Orbit', pattern = 'Circle' } }";
|
||||
}
|
||||
else {
|
||||
taskSS << "{ id = 'Orbit', pattern = 'Circle' }";
|
||||
}
|
||||
@@ -239,7 +243,7 @@ void AirUnit::AIloop()
|
||||
break;
|
||||
}
|
||||
case State::LAND: {
|
||||
wstring enrouteTask = L"{" "id = 'land' }";
|
||||
wstring enrouteTask = L"{ id = 'Land' }";
|
||||
currentTask = L"Landing";
|
||||
|
||||
if (activeDestination == NULL)
|
||||
@@ -311,13 +315,18 @@ void AirUnit::AIloop()
|
||||
currentTask = L"Refueling";
|
||||
|
||||
if (!hasTask) {
|
||||
std::wostringstream taskSS;
|
||||
taskSS << "{"
|
||||
<< "id = 'Refuel'"
|
||||
<< "}";
|
||||
Command* command = dynamic_cast<Command*>(new SetTask(ID, taskSS.str()));
|
||||
scheduler->appendCommand(command);
|
||||
hasTask = true;
|
||||
if (fuel <= initialFuel) {
|
||||
std::wostringstream taskSS;
|
||||
taskSS << "{"
|
||||
<< "id = 'Refuel'"
|
||||
<< "}";
|
||||
Command* command = dynamic_cast<Command*>(new SetTask(ID, taskSS.str()));
|
||||
scheduler->appendCommand(command);
|
||||
hasTask = true;
|
||||
}
|
||||
else {
|
||||
setState(State::IDLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user