Fix foundation and corpses phenotypes being different than the source entity.
Reported by: @wowgetoffyourcellphone This was SVN commit r25832.
This commit is contained in:
parent
c6a9e7188e
commit
2bda444435
@ -343,6 +343,19 @@ Foundation.prototype.Build = function(builderEnt, work)
|
||||
if (cmpVisual && cmpBuildingVisual)
|
||||
cmpBuildingVisual.SetActorSeed(cmpVisual.GetActorSeed());
|
||||
|
||||
const cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity);
|
||||
const cmpBuildingIdentity = Engine.QueryInterface(building, IID_Identity);
|
||||
if (cmpIdentity && cmpBuildingIdentity)
|
||||
{
|
||||
const oldPhenotype = cmpIdentity.GetPhenotype();
|
||||
if (cmpBuildingIdentity.GetPhenotype() !== oldPhenotype)
|
||||
{
|
||||
cmpBuildingIdentity.SetPhenotype(oldPhenotype);
|
||||
if (cmpVisualCorpse)
|
||||
cmpVisualCorpse.RecomputeActorName();
|
||||
}
|
||||
}
|
||||
|
||||
if (cmpPlayerStatisticsTracker)
|
||||
cmpPlayerStatisticsTracker.IncreaseConstructedBuildingsCounter(building);
|
||||
|
||||
|
@ -378,6 +378,22 @@ Health.prototype.CreateCorpse = function()
|
||||
cmpVisualCorpse.SelectAnimation("death", true, 1);
|
||||
}
|
||||
|
||||
const cmpIdentityCorpse = Engine.QueryInterface(entCorpse, IID_Identity);
|
||||
if (cmpIdentityCorpse)
|
||||
{
|
||||
const cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity);
|
||||
if (cmpIdentity)
|
||||
{
|
||||
const oldPhenotype = cmpIdentity.GetPhenotype();
|
||||
if (cmpIdentityCorpse.GetPhenotype() !== oldPhenotype)
|
||||
{
|
||||
cmpIdentityCorpse.SetPhenotype(oldPhenotype);
|
||||
if (cmpVisualCorpse)
|
||||
cmpVisualCorpse.RecomputeActorName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resource)
|
||||
Engine.PostMessage(this.entity, MT_EntityRenamed, {
|
||||
"entity": this.entity,
|
||||
|
@ -201,6 +201,11 @@ Identity.prototype.SetControllable = function(controllability)
|
||||
this.controllable = controllability;
|
||||
};
|
||||
|
||||
Identity.prototype.SetPhenotype = function(phenotype)
|
||||
{
|
||||
this.phenotype = phenotype;
|
||||
};
|
||||
|
||||
function IdentityMirage() {}
|
||||
IdentityMirage.prototype.Init = function(cmpIdentity)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user