HUD: ability bar defaults hidden until a local player exists
Fixes the empty-bar leak into ArtStaging / menu / pre-connect: AbilityBarSystem.OnUpdate early-returns when there is no valid NetworkTime, so the 'hide when no local player' line never ran. Root now DisplayStyle.None at build, flips to Flex only when the local player is found — also kills any pre-connect flash in gameplay.
This commit is contained in:
@@ -81,12 +81,14 @@ namespace ProjectM.Client
|
||||
|
||||
bool haveDb = SystemAPI.TryGetSingleton<AbilityDatabase>(out var db) && db.Value.IsCreated;
|
||||
|
||||
bool foundLocal = false; // no local player (menu / ArtStaging / pre-spawn) -> hide the bar entirely
|
||||
foreach (var (cd, dashCd, entity) in
|
||||
SystemAPI.Query<RefRO<SocketCooldown>, RefRO<DashCooldown>>()
|
||||
.WithAll<GhostOwnerIsLocal, PlayerTag>().WithEntityAccess())
|
||||
{
|
||||
if (!EntityManager.HasBuffer<AbilitySocket>(entity) || !EntityManager.HasBuffer<EffectiveSocketStats>(entity))
|
||||
continue;
|
||||
foundLocal = true;
|
||||
var sockets = EntityManager.GetBuffer<AbilitySocket>(entity, true);
|
||||
var effs = EntityManager.GetBuffer<EffectiveSocketStats>(entity, true);
|
||||
|
||||
@@ -108,6 +110,7 @@ namespace ProjectM.Client
|
||||
UpdateSlotCooldown(DashSlot, RemainingTicks(dashCd.ValueRO.NextTick, now), dashTotal);
|
||||
break; // one local player
|
||||
}
|
||||
_doc.rootVisualElement.style.display = foundLocal ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
}
|
||||
|
||||
static int RemainingTicks(uint nextFireRaw, NetworkTick now)
|
||||
@@ -185,6 +188,7 @@ namespace ProjectM.Client
|
||||
root.style.position = Position.Absolute;
|
||||
root.style.left = 0; root.style.right = 0; root.style.top = 0; root.style.bottom = 0;
|
||||
root.pickingMode = PickingMode.Ignore;
|
||||
root.style.display = DisplayStyle.None; // hidden until a local player is found (no flash in menu/ArtStaging/pre-connect)
|
||||
|
||||
var bar = HudUi.Group(Align.Center);
|
||||
bar.style.position = Position.Absolute;
|
||||
|
||||
Reference in New Issue
Block a user