CAMM-Crystal-Alien-Map-Maker
CAMM-Crystal-Alien-Map-Maker copied to clipboard
Add ability to set auto repair on buildings
Auto repair is what causes the buildings (normally controlled by the AI) to start repairing themselves when damaged, as long as there is sufficient funds for the repair.
seems to be another hard-coded hack, this time in the Building class:
if (!(this.count%10)) // repair
{
if (this.health < this.stats.maxHealth)
{
if (this.repairing || (!this.friend && (this.parent.findBuilding("BA_"+this.parent.parent.oppo, this.parent.parent.oppo) || this.parent.findBuilding("BK_"+this.parent.parent.oppo, this.parent.parent.oppo))))
{
this.repairing = true;
var spend = 20 * Math.round((1/this.stats.maxHealth) * this.stats.cost * .5);
if ((this.friend && (this.parent.cash >= spend)) || (!this.friend && (this.parent.cashOppo >= spend)))
{
this.hilite = true;
this.health = min(this.stats.maxHealth, this.health+=20);
if (this.friend)
this.parent.cash -= spend;
if (!this.friend)
this.parent.cashOppo -= spend;
if (this.healthPerc > 25)
{
this.MCsprite.building.smoke.removeMovieClip();
if (!this.stats.weapon || this.stats.isHQ)
{
this.MCsprite.building.gotoAndPlay("loopstart");
this.MCsprite.shadow.gotoAndStop(15);
}
}
}
else
this.repairing = false;
}
}
else
this.repairing = false;
}
Just to clarify, is the goal of this to have an option so that whenever a certain building takes damage it starts the "auto-repair" by itself without the player telling it to?
i think the goal is to be able to configure it for any level, any team, and possibly per-building?
@leveleditor that correct?