Display aura range overlay during building preview

Fixes #8868
This commit is contained in:
Atrik
2026-04-12 07:30:00 +02:00
committed by Vantha
parent 7758c98e7c
commit eb2ff98883
2 changed files with 13 additions and 1 deletions
@@ -84,9 +84,14 @@ Auras.prototype.GetRangeOverlays = function()
{ {
const rangeOverlays = []; const rangeOverlays = [];
// Check if this is a preview entity
const cmpVisibility = Engine.QueryInterface(this.entity, IID_Visibility);
const isPreview = cmpVisibility && cmpVisibility.GetPreview && cmpVisibility.GetPreview();
for (const name of this.GetAuraNames()) for (const name of this.GetAuraNames())
{ {
if (!this.IsRangeAura(name) || !this[name].isApplied) // For preview entities, show auras even if isApplied is false
if (!this.IsRangeAura(name) || (!isPreview && !this[name].isApplied))
continue; continue;
const rangeOverlay = AuraTemplates.Get(name).rangeOverlay; const rangeOverlay = AuraTemplates.Get(name).rangeOverlay;
@@ -141,6 +146,12 @@ Auras.prototype.CalculateAffectedPlayers = function(name)
Auras.prototype.CanApply = function(name) Auras.prototype.CanApply = function(name)
{ {
// Check if this is a preview entity via Visibility component
// If it is, then we don't apply the aura
const cmpVisibility = Engine.QueryInterface(this.entity, IID_Visibility);
if (cmpVisibility && cmpVisibility.GetPreview && cmpVisibility.GetPreview())
return false;
if (!AuraTemplates.Get(name).requiredTechnology) if (!AuraTemplates.Get(name).requiredTechnology)
return true; return true;
@@ -5,6 +5,7 @@
to this list should be carefully considered --> to this list should be carefully considered -->
<!-- Attack is needed for the Actor Viewer and attack range overlay --> <!-- Attack is needed for the Actor Viewer and attack range overlay -->
<Attack merge=""/> <Attack merge=""/>
<Auras merge=""/>
<BuildRestrictions merge=""/> <BuildRestrictions merge=""/>
<Decay merge=""/> <Decay merge=""/>
<Footprint merge=""/> <Footprint merge=""/>