Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Mirage.js
Show All 9 Lines | |||||
Mirage.prototype.Init = function() | Mirage.prototype.Init = function() | ||||
{ | { | ||||
this.player = null; | this.player = null; | ||||
this.parent = INVALID_ENTITY; | this.parent = INVALID_ENTITY; | ||||
this.miragedIids = new Set(); | this.miragedIids = new Set(); | ||||
this.classesList = []; | |||||
this.numBuilders = 0; | this.numBuilders = 0; | ||||
this.buildTime = {}; | this.buildTime = {}; | ||||
this.maxHitpoints = null; | this.maxHitpoints = null; | ||||
this.hitpoints = null; | this.hitpoints = null; | ||||
this.repairable = null; | this.repairable = null; | ||||
this.unhealable = null; | this.unhealable = null; | ||||
Show All 31 Lines | |||||
Mirage.prototype.Mirages = function(iid) | Mirage.prototype.Mirages = function(iid) | ||||
{ | { | ||||
return this.miragedIids.has(iid); | return this.miragedIids.has(iid); | ||||
}; | }; | ||||
// ============================ | // ============================ | ||||
// Parent entity data | // Parent entity data | ||||
Mirage.prototype.CopyIdentity = function(cmpIdentity) | |||||
{ | |||||
this.miragedIids.add(IID_Identity); | |||||
this.classesList = cmpIdentity.GetClassesList(); | |||||
temple: An alternative solution would be to clone here. | |||||
}; | |||||
Mirage.prototype.GetClassesList = function() { return this.classesList }; | |||||
// Foundation data | // Foundation data | ||||
Not Done Inline ActionsShould also mention why the template based approach is not used IMO elexis: Should also mention why the template based approach is not used IMO | |||||
Mirage.prototype.CopyFoundation = function(cmpFoundation) | Mirage.prototype.CopyFoundation = function(cmpFoundation) | ||||
{ | { | ||||
this.miragedIids.add(IID_Foundation); | this.miragedIids.add(IID_Foundation); | ||||
this.numBuilders = cmpFoundation.GetNumBuilders(); | this.numBuilders = cmpFoundation.GetNumBuilders(); | ||||
this.buildTime = cmpFoundation.GetBuildTime(); | this.buildTime = cmpFoundation.GetBuildTime(); | ||||
Not Done Inline ActionsIt's an art in itself to keep comments short while still carrying all the necessary information for future developers to be able to decide things without having to dig much. Ok for me if you want to shorten it a bit or leave it as is. Certainly better too much than too few here IMO. I believe this would summarize the information you have posted, but as I mentioned take which variant you want. I'm not claiming this to be well phrased :-) // In almost all cases we want to ignore mirage entities when querying Identity components of owned entities. // To avoid adding a test everywhere, we don't transfer the classeslist in the template but here. // We clone this since the classes list is not synchronized and since the mirage should be a snapshot of the entity at the given time. elexis: It's an art in itself to keep comments short while still carrying all the necessary information… | |||||
Not Done Inline ActionsSounds fine. temple: Sounds fine. | |||||
}; | }; | ||||
Mirage.prototype.GetNumBuilders = function() { return this.numBuilders; }; | Mirage.prototype.GetNumBuilders = function() { return this.numBuilders; }; | ||||
Mirage.prototype.GetBuildTime = function() { return this.buildTime; }; | Mirage.prototype.GetBuildTime = function() { return this.buildTime; }; | ||||
// Repairable data (numBuilders and buildTime shared with foundation as entities can't have both) | // Repairable data (numBuilders and buildTime shared with foundation as entities can't have both) | ||||
Mirage.prototype.CopyRepairable = function(cmpRepairable) | Mirage.prototype.CopyRepairable = function(cmpRepairable) | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
An alternative solution would be to clone here.