rem: hp.curr = Math.min( hp.max, hp.curr + (points/bp.max)*hp.max ); 
context: function performBuild( evt ){	if( !canBuild( this, evt.target ) )	{		evt.preventDefault();		return;	}		var t = evt.target;	var b = this.actions.build;	var bp = t.buildPoints;	var hp = t.traits.health;		var points = parseFloat( b.rate ) * parseFloat( b.speed ) / 1000.0;	if ( bp.curr == 0 )	{		t.flattenTerrain(); //make the terrain stable for the building		//t.placeBuildingFootprint(false);  //false means display regular footprint, not rubble	}	bp.curr += points;	hp.curr = Math.min( hp.max, hp.curr + (points/bp.max)*hp.max );			if( bp.curr >= bp.max )	{		// We've finished building this object; convert the foundation to a building		if( t.building != "" )	// Might be false if another unit finished building the thing during our last anim cycle		{			t.template = getEntityTemplate( t.building, t.player );			t.building = "";						t.attachAuras();						if (t.traits.population && t.traits.population.add)				this.player.resources.housing += parseInt(t.traits.population.add);		}		evt.preventDefault();	// Stop performing this action	}}
meta: 1070	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/1070/0799dda0dafaf3bf421816535f5d3ed849c4025a/entity_functions.js/buggy/binaries/data/mods/official/scripts/entity_functions.js