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
@@ -1,51 +1,2 @@
// Companion-specific commands extend Core's authenticated transport.
modded class ERR_AdminService
{
protected override string Setting(string section, string option)
{
if (section == "hq")
{
if (option == "interval") return "reportIntervalSeconds";
if (option == "squads") return "supportSquadLimit";
if (option == "radius") return "responseRadiusMetres";
}
if (section == "intel")
{
if (option == "carrying") return "aiIntelChancePercent";
}
return super.Setting(section, option);
}
protected override bool Extension(ERR_GameMode mode, string arguments, array<string> replies)
{
if (arguments == "intel show")
{
replies.Insert("aiIntelChancePercent=" + mode.Settings().Get("aiIntelChancePercent").ToString());
replies.Insert("intelRevealChancePercent=" + mode.Settings().Get("intelRevealChancePercent").ToString());
return true;
}
if (arguments == "intel reroll" || arguments == "intel reroll show")
{
ERR_IntelService intel = mode.Intel();
if (!intel) { replies.Insert("Intel service unavailable."); return true; }
if (arguments == "intel reroll" && !intel.BeginReroll())
replies.Insert("Intel reroll could not start. It requires an active round and no running reroll.");
replies.Insert(intel.RerollStatus());
return true;
}
if (arguments != "status" && arguments != "hq show" && arguments != "hq log") return super.Extension(mode, arguments, replies);
ERR_HQ hq = ERR_HQ.Cast(mode.Command());
if (!hq) { replies.Insert("HQ unavailable"); return true; }
if (arguments == "hq show" || arguments == "status") replies.Insert(hq.Status());
else
{
int cursor;
hq.Journal().Read(Math.Max(0, hq.Journal().Sequence() - 8), replies, cursor);
if (replies.IsEmpty()) replies.Insert("HQ journal is empty.");
}
return true;
}
protected override string Help()
{
return super.Help() + " | hq show|log | hq interval|squads|radius show|set N | intel show | intel carrying show|set N | intel reroll [show]";
}
}
// Chat commands are mission services in Core. Optional AI and Intel command
// providers register from their owning addons, including without ERR_Chat loaded.
@@ -566,6 +566,9 @@ modded class ERR_GameMode
}
else if (m_ERRSmokeStep == 3)
{
int adminMenu = ERR_ProbeAdminMenu(now);
if (adminMenu < 0) { ERR_Check(false, "integrated admin menu"); return; }
if (adminMenu == 0) return;
if (!ERR_CheckIntelReroll(now)) return;
if (!ERR_Check(m_ERRSmokeRadio.Knowledge() == 2, "carried intel identifies radio through intel service")) return;
if (!ERR_Check(!TuneRadio(m_ERRSmokePlayer, m_ERRSmokeRadio), "radio rejects distant player")) return;