CAMM-Crystal-Alien-Map-Maker icon indicating copy to clipboard operation
CAMM-Crystal-Alien-Map-Maker copied to clipboard

Add ability to set auto repair on buildings

Open leveleditor opened this issue 5 years ago • 3 comments

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.

leveleditor avatar May 05 '20 00:05 leveleditor

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;
			}

Brian151 avatar May 12 '20 01:05 Brian151

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?

Landlighter avatar Sep 26 '20 20:09 Landlighter

i think the goal is to be able to configure it for any level, any team, and possibly per-building?

@leveleditor that correct?

Brian151 avatar Sep 27 '20 02:09 Brian151