Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/Mirage.js
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
Mirage.prototype.Get = function(iid) | Mirage.prototype.Get = function(iid) | ||||
{ | { | ||||
return this.miragedIids.get(iid); | return this.miragedIids.get(iid); | ||||
}; | }; | ||||
// ============================ | // ============================ | ||||
// Parent entity data | // Parent entity data | ||||
Mirage.prototype.CopyCapturable = function(cmpCapturable) | /** | ||||
{ | * @param {number} iid - The component to mirage. | ||||
this.miragedIids.set(IID_Capturable, cmpCapturable.Mirage()); | */ | ||||
}; | Mirage.prototype.CopyComponent = function(iid) | ||||
{ | |||||
Mirage.prototype.CopyFoundation = function(cmpFoundation) | let cmp = Engine.QueryInterface(this.parent, iid); | ||||
{ | if (cmp) | ||||
this.miragedIids.set(IID_Foundation, cmpFoundation.Mirage()); | this.miragedIids.set(iid, cmp.Mirage(this.entity, this.player)); | ||||
}; | |||||
Mirage.prototype.CopyHealth = function(cmpHealth) | |||||
{ | |||||
this.miragedIids.set(IID_Health, cmpHealth.Mirage()); | |||||
}; | |||||
Mirage.prototype.CopyIdentity = function(cmpIdentity) | |||||
{ | |||||
this.miragedIids.set(IID_Identity, cmpIdentity.Mirage()); | |||||
}; | |||||
Mirage.prototype.CopyMarket = function(cmpMarket) | |||||
{ | |||||
this.miragedIids.set(IID_Market, cmpMarket.Mirage(this.entity, this.player)); | |||||
}; | |||||
Mirage.prototype.CopyRepairable = function(cmpRepairable) | |||||
{ | |||||
this.miragedIids.set(IID_Repairable, cmpRepairable.Mirage()); | |||||
}; | |||||
Mirage.prototype.CopyResourceSupply = function(cmpResourceSupply) | |||||
{ | |||||
this.miragedIids.set(IID_ResourceSupply, cmpResourceSupply.Mirage()); | |||||
}; | }; | ||||
// ============================ | // ============================ | ||||
Mirage.prototype.OnVisibilityChanged = function(msg) | Mirage.prototype.OnVisibilityChanged = function(msg) | ||||
{ | { | ||||
// Mirages get VIS_HIDDEN when the original entity becomes VIS_VISIBLE. | // Mirages get VIS_HIDDEN when the original entity becomes VIS_VISIBLE. | ||||
if (msg.player != this.player || msg.newVisibility != VIS_HIDDEN) | if (msg.player != this.player || msg.newVisibility != VIS_HIDDEN) | ||||
Show All 12 Lines |
Wildfire Games · Phabricator