Handle empty Auras reference in checkrefs
Some checks failed
checkrefs / lfscheck (push) Has been cancelled
checkrefs / checkrefs (push) Has been cancelled
lint / cppcheck (push) Has been cancelled
lint / copyright (push) Has been cancelled
lint / jenkinsfiles (push) Has been cancelled
pre-commit / build (push) Has been cancelled

This commit is contained in:
Atrik 2026-04-12 08:16:32 +02:00 committed by Vantha
parent eb2ff98883
commit 0171a58f26
2 changed files with 22 additions and 21 deletions

View file

@ -84,14 +84,9 @@ Auras.prototype.GetRangeOverlays = function()
{
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 preview entities, show auras even if isApplied is false
if (!this.IsRangeAura(name) || (!isPreview && !this[name].isApplied))
if (!this.IsRangeAura(name) || !this.AreTechnologyRequirementsMet(name))
continue;
const rangeOverlay = AuraTemplates.Get(name).rangeOverlay;
@ -144,22 +139,27 @@ Auras.prototype.CalculateAffectedPlayers = function(name)
}
};
Auras.prototype.CanApply = function(name)
Auras.prototype.AreTechnologyRequirementsMet = 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)
const aura = AuraTemplates.Get(name);
if (!aura || !aura.requiredTechnology)
return true;
const cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager);
if (!cmpTechnologyManager)
return false;
return cmpTechnologyManager.IsTechnologyResearched(AuraTemplates.Get(name).requiredTechnology);
return cmpTechnologyManager.IsTechnologyResearched(aura.requiredTechnology);
};
Auras.prototype.CanApply = function(name)
{
// Check if this is a preview entity
const cmpVisibility = Engine.QueryInterface(this.entity, IID_Visibility);
if (cmpVisibility && cmpVisibility.GetPreview && cmpVisibility.GetPreview())
return false;
return this.AreTechnologyRequirementsMet(name);
};
Auras.prototype.HasFormationAura = function()

View file

@ -432,12 +432,13 @@ class CheckRefs:
cmp_auras = entity.find("Auras")
if cmp_auras is not None:
aura_string = cmp_auras.text
for aura in aura_string.split():
if not aura:
continue
if aura.startswith("-"):
continue
self.deps.append((fp, Path(f"simulation/data/auras/{aura}.json")))
if aura_string:
for aura in aura_string.split():
if not aura:
continue
if aura.startswith("-"):
continue
self.deps.append((fp, Path(f"simulation/data/auras/{aura}.json")))
cmp_identity = entity.find("Identity")
if cmp_identity is not None: