try to fix roadblocks

This commit is contained in:
2026-10-15 21:38:20 +02:00
parent 009b2fb591
commit ae9aaafaae
5 changed files with 69 additions and 12 deletions
@@ -1,4 +1,13 @@
#ifdef WORKBENCH
class ERR_RoadblockProbeRules
{
static int Target()
{
string value;
if (System.GetCLIParam("errRoadblockProbeCount", value)) return Math.Clamp(value.ToInt(), 1, 30);
return 30;
}
}
modded class ERR_HQ
{
bool ERR_ProbeRoadblockGroup(SCR_AIGroup group)
@@ -14,7 +23,7 @@ modded class ERR_Roadblocks
{
string outcome;
if (!m_Begun && System.GetCLIParam("errSmokeOutcome", outcome) && outcome == "roadblocks")
m_Mode.Settings().Set("roadblockCount", 30);
m_Mode.Settings().Set("roadblockCount", ERR_RoadblockProbeRules.Target());
return super.Prepare(definition);
}
protected int m_ERRLayoutPosts;
@@ -27,7 +36,7 @@ modded class ERR_Roadblocks
// Inspect the actual spawned models before the transaction clears its refs.
if (m_BuildHold)
{
bool valid = m_BuildCovers.Count() == 10 && m_BuildSpawned.Count() == 15;
bool valid = ShareProps();
for (int i = 0; i < m_BuildCovers.Count() && valid; i++)
{
ERR_RoadblockProp prop = m_BuildCovers[i];
@@ -89,7 +98,7 @@ modded class ERR_Roadblocks
bool ERR_ProbeBackgroundPending() { return m_Background; }
bool ERR_ProbeCompleteRoadblocks()
{
if (m_ERRLayoutFailed || m_ERRLayoutPosts < 30 || m_Target != 30 || m_Positions.Count() != 30 || m_Background || !m_Ready) return false;
if (m_ERRLayoutFailed || m_ERRLayoutPosts < ERR_RoadblockProbeRules.Target() || m_Target != ERR_RoadblockProbeRules.Target() || m_Positions.Count() != m_Target || m_Background || !m_Ready) return false;
foreach (SCR_AIGroup group : m_Groups)
{
ERR_ForceRecord record = m_Mode.Forces().FindGroup(group);
@@ -147,13 +156,13 @@ modded class ERR_GameMode
IEntity player; if (controller) player = controller.GetControlledEntity();
if (!player || !Players().CurrentActor(player)) return;
DamageManagerComponent.Cast(player.FindComponent(DamageManagerComponent)).EnableDamageHandling(false);
if (!posts.ERR_ProbeBackgroundPending() || posts.ERR_ProbePostCount() >= 30 || !UnlockPrison(player)) { ERR_RoadblockProbeFail("did not enter background search with prison unlocked"); return; }
if (!posts.ERR_ProbeBackgroundPending() || posts.ERR_ProbePostCount() >= ERR_RoadblockProbeRules.Target() || !UnlockPrison(player)) { ERR_RoadblockProbeFail("did not enter background search with prison unlocked"); return; }
m_ERRRoadblockInitial = posts.ERR_ProbePostCount();
PrintFormat("ERR SMOKE PASS: roadblocks prison unlocked with %1/30 posts; background still pending", m_ERRRoadblockInitial);
PrintFormat("ERR SMOKE PASS: roadblocks prison unlocked with %1/%2 posts; background still pending", m_ERRRoadblockInitial, ERR_RoadblockProbeRules.Target());
}
if (posts.ERR_ProbeBackgroundPending()) return;
if (!posts.ERR_ProbeCompleteRoadblocks() || posts.ERR_ProbePostCount() <= m_ERRRoadblockInitial) { ERR_RoadblockProbeFail("30 physical four-guard posts, ledger and HQ admission"); return; }
Print("ERR SMOKE PASS: roadblocks 30 physical posts / 120 guards / 300 checkpoint props; verified model footprints and centre lane; background completed after prison unlock, no extra posts on repeat tick");
if (!posts.ERR_ProbeCompleteRoadblocks() || posts.ERR_ProbePostCount() <= m_ERRRoadblockInitial) { ERR_RoadblockProbeFail("physical four-guard posts, replicated props, ledger and HQ admission"); return; }
PrintFormat("ERR SMOKE PASS: roadblocks %1 physical posts / %2 guards / %3 replicated checkpoint props with distance streaming disabled; verified model footprints and centre lane; background completed after prison unlock, no extra posts on repeat tick", posts.ERR_ProbePostCount(), posts.ERR_ProbePostCount() * 4, posts.ERR_ProbePostCount() * 10);
ERR_StopRoadblockProbe();
Transition(ERR_Phase.DEFEAT);
Print("ERR SMOKE COMPLETE: roadblocks background completion on Everon; scripted local fixture");
@@ -224,6 +224,27 @@ class ERR_Roadblocks
m_BuildSpawned.Clear(); m_BuildGroup = null; m_BuildHold = null;
m_BuildPositions.Clear(); m_BuildCovers.Clear();
}
// A free Game Master camera does not force-stream bare, non-editable props
// with the nearby editable guards. Keep this bounded bank (<=300 objects) on
// clients, including late joiners, rather than tying it to the player's body.
// Do not report a completed post if any physical prop lacks a network node.
protected bool ShareProps()
{
if (m_BuildCovers.Count() != 10 || m_BuildSpawned.Count() != 15) return false;
for (int i = 4; i < 14; i++)
{
IEntity entity = m_BuildSpawned[i];
RplComponent component;
if (entity) component = RplComponent.Cast(entity.FindComponent(RplComponent));
if (!component || component.Id() == RplId.Invalid()) return false;
}
for (int i = 4; i < 14; i++)
{
RplComponent component = RplComponent.Cast(m_BuildSpawned[i].FindComponent(RplComponent));
component.EnableStreaming(false);
}
return true;
}
protected void BuildPost()
{
if (!PlayersClear() || m_Mode.Forces().Count() >= 250) { CancelPost(); return; }
@@ -256,6 +277,11 @@ class ERR_Roadblocks
m_BuildSpawned.Insert(m_BuildHold); m_BuildHold.SetCompletionRadius(25);
return;
}
if (!ShareProps())
{
PrintFormat("Reintroduced [roadblocks]: rejected post at %1; checkpoint props missing replication nodes", m_Centre);
CancelPost(); return;
}
string id = "roadblock-" + m_Positions.Count().ToString();
if (!m_Mode.Forces().Register(id, ERR_ForceKind.CHECKPOINT, m_Centre, 4, null, m_BuildGroup, GetGame().GetWorld().GetWorldTime()))
{ CancelPost(); return; }
@@ -264,7 +290,7 @@ class ERR_Roadblocks
m_BuildGroup.AddWaypoint(m_BuildHold);
m_Mode.RegisterGroup(m_BuildGroup); m_BuildGroup.ActivateAI();
m_Mining.Register(m_BuildGroup, m_BuildHold, m_Right);
PrintFormat("Reintroduced [roadblocks]: %1 at %2 guards=4 props=10 roadPassage=open HQ=registered", id, m_Centre);
PrintFormat("Reintroduced [roadblocks]: %1 at %2 guards=4 props=10 networkedProps=10 propStreaming=always roadPassage=open HQ=registered", id, m_Centre);
m_BuildSpawned.Clear(); m_BuildGroup = null; m_BuildHold = null;
m_BuildPositions.Clear(); m_BuildCovers.Clear();
m_NextSearch = System.GetTickCount() + 2000;