Integrate mission-owned chat administration and menu

This commit is contained in:
2026-09-19 23:49:54 +02:00
parent 27989b85a3
commit 5e742691ad
154 changed files with 19498 additions and 134 deletions
+6 -1
View File
@@ -390,5 +390,10 @@ class ERR_HQ : ERR_CommandService
modded class ERR_GameMode
{
protected override ERR_CommandService CreateCommandService() { return new ERR_HQ(this); }
protected override ERR_CommandService CreateCommandService()
{
ERR_HQ hq = new ERR_HQ(this);
Admin().Register(new ERR_HQAdminProvider(hq));
return hq;
}
}
@@ -0,0 +1,48 @@
// 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;
}
}