Esempio n. 1
0
int G_BuildableDeconValue(gentity_t *ent)
{
	HealthComponent* healthComponent = ent->entity->Get<HealthComponent>();

	if (!healthComponent->Alive()) {
		return 0;
	}

	return (int)roundf((float)BG_Buildable(ent->s.modelindex)->buildPoints
	                   * healthComponent->HealthFraction());
}
Esempio n. 2
0
static AIValue_t percentHealth( gentity_t *self, const AIValue_t *params )
{
	AIEntity_t e = ( AIEntity_t ) AIUnBoxInt( params[ 0 ] );
	botEntityAndDistance_t et = AIEntityToGentity( self, e );
	float healthFraction;
	HealthComponent *healthComponent;

	if (et.ent && (healthComponent = et.ent->entity->Get<HealthComponent>())) {
		healthFraction = healthComponent->HealthFraction();
	} else {
		healthFraction = 0.0f;
	}

	return AIBoxFloat( healthFraction );
}