mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
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
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:
parent
eb2ff98883
commit
0171a58f26
2 changed files with 22 additions and 21 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue