49 lines
1.8 KiB
C
49 lines
1.8 KiB
C
// HQ administration belongs to AI; Core sees only ERR_AdminProvider.
|
|
class ERR_HQAdminProvider : ERR_AdminProvider
|
|
{
|
|
protected ERR_HQ m_HQ;
|
|
void ERR_HQAdminProvider(ERR_HQ hq) { m_HQ = hq; }
|
|
override string Id() { return "hq"; }
|
|
override void Capabilities(array<string> values) { values.Insert("supports=hq"); }
|
|
override string Setting(string section, string option)
|
|
{
|
|
if (section != "hq") return "";
|
|
if (option == "interval") return "reportIntervalSeconds";
|
|
if (option == "squads") return "supportSquadLimit";
|
|
if (option == "radius") return "responseRadiusMetres";
|
|
return "";
|
|
}
|
|
override int JournalSequence()
|
|
{
|
|
if (!m_HQ || !m_HQ.Journal()) return -1;
|
|
return m_HQ.Journal().Sequence();
|
|
}
|
|
override bool ReadJournal(int after, array<string> lines, out int cursor, int limit = 8)
|
|
{
|
|
if (!m_HQ || !m_HQ.Journal()) return false;
|
|
m_HQ.Journal().Read(after, lines, cursor, limit);
|
|
return true;
|
|
}
|
|
override bool Execute(ERR_GameMode mode, string arguments, array<string> replies)
|
|
{
|
|
if (arguments != "status" && arguments != "hq show" && arguments != "hq log") return false;
|
|
if (!m_HQ) { replies.Insert("HQ unavailable."); return true; }
|
|
if (arguments == "hq show" || arguments == "status") replies.Insert(m_HQ.Status());
|
|
else
|
|
{
|
|
int cursor;
|
|
ReadJournal(Math.Max(0, JournalSequence() - 8), replies, cursor);
|
|
if (replies.IsEmpty()) replies.Insert("HQ journal is empty.");
|
|
}
|
|
return true;
|
|
}
|
|
override bool Help(string topic, array<string> replies)
|
|
{
|
|
if (topic != "hq") return false;
|
|
replies.Insert("/esc hq show | hq log show|next|set on|off");
|
|
replies.Insert("/esc hq interval|squads|radius show|set N");
|
|
replies.Insert("HQ assigns available physical squads through delivered reports. These commands do not create replacement forces.");
|
|
return true;
|
|
}
|
|
}
|