]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc
Reduce name space of resource constants and variables (RESOURCE_* --> RES_*, resour...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / assault / sv_assault.qc
index c3ef2db96f1fb551c87f3f0659cf3d821a37f2fe..72a4d23a8c602deecf8591c97ff6abbd1a4b62e7 100644 (file)
@@ -17,7 +17,7 @@ STATIC_INIT(g_assault)
 void assault_objective_use(entity this, entity actor, entity trigger)
 {
        // activate objective
-       SetResourceAmount(this, RESOURCE_HEALTH, 100);
+       SetResourceAmount(this, RES_HEALTH, 100);
        //print("^2Activated objective ", this.targetname, "=", etos(this), "\n");
        //print("Activator is ", actor.classname, "\n");
 
@@ -29,7 +29,7 @@ void assault_objective_use(entity this, entity actor, entity trigger)
 
 vector target_objective_spawn_evalfunc(entity this, entity player, entity spot, vector current)
 {
-       float hlth = GetResourceAmount(this, RESOURCE_HEALTH);
+       float hlth = GetResourceAmount(this, RES_HEALTH);
        if (hlth < 0 || hlth >= ASSAULT_VALUE_INACTIVE)
                return '-1 0 0';
        return current;
@@ -39,7 +39,7 @@ vector target_objective_spawn_evalfunc(entity this, entity player, entity spot,
 // and when a new round starts
 void assault_objective_reset(entity this)
 {
-       SetResourceAmount(this, RESOURCE_HEALTH, ASSAULT_VALUE_INACTIVE);
+       SetResourceAmount(this, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
 }
 
 // decrease the health of targeted objectives
@@ -60,19 +60,19 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger)
        else
                return; // already activated! cannot activate again!
 
-       float hlth = GetResourceAmount(this.enemy, RESOURCE_HEALTH);
+       float hlth = GetResourceAmount(this.enemy, RES_HEALTH);
        if (hlth < ASSAULT_VALUE_INACTIVE)
        {
                if (hlth - this.dmg > 0.5)
                {
                        GameRules_scoring_add_team(actor, SCORE, this.dmg);
-                       TakeResource(this.enemy, RESOURCE_HEALTH, this.dmg);
+                       TakeResource(this.enemy, RES_HEALTH, this.dmg);
                }
                else
                {
                        GameRules_scoring_add_team(actor, SCORE, hlth);
                        GameRules_scoring_add_team(actor, ASSAULT_OBJECTIVES, 1);
-                       SetResourceAmount(this.enemy, RESOURCE_HEALTH, -1);
+                       SetResourceAmount(this.enemy, RES_HEALTH, -1);
 
                        if(this.enemy.message)
                                FOREACH_CLIENT(IS_PLAYER(it), { centerprint(it, this.enemy.message); });
@@ -99,7 +99,7 @@ void assault_setenemytoobjective(entity this)
 
 bool assault_decreaser_sprite_visible(entity this, entity player, entity view)
 {
-       if(GetResourceAmount(this.assault_decreaser.enemy, RESOURCE_HEALTH) >= ASSAULT_VALUE_INACTIVE)
+       if(GetResourceAmount(this.assault_decreaser.enemy, RES_HEALTH) >= ASSAULT_VALUE_INACTIVE)
                return false;
 
        return true;
@@ -127,7 +127,7 @@ void target_objective_decrease_activate(entity this)
                {
                        WaypointSprite_UpdateSprites(spr, WP_AssaultDefend, WP_AssaultDestroy, WP_AssaultDestroy);
                        WaypointSprite_UpdateMaxHealth(spr, it.max_health);
-                       WaypointSprite_UpdateHealth(spr, GetResourceAmount(it, RESOURCE_HEALTH));
+                       WaypointSprite_UpdateHealth(spr, GetResourceAmount(it, RES_HEALTH));
                        it.sprite = spr;
                }
                else
@@ -176,7 +176,7 @@ void assault_roundstart_use_this(entity this)
 
 void assault_wall_think(entity this)
 {
-       if(GetResourceAmount(this.enemy, RESOURCE_HEALTH) < 0)
+       if(GetResourceAmount(this.enemy, RES_HEALTH) < 0)
        {
                this.model = "";
                this.solid = SOLID_NOT;
@@ -323,7 +323,7 @@ spawnfunc(target_objective_decrease)
                this.dmg = 101;
 
        this.use = assault_objective_decrease_use;
-       SetResourceAmount(this, RESOURCE_HEALTH, ASSAULT_VALUE_INACTIVE);
+       SetResourceAmount(this, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
        this.max_health = ASSAULT_VALUE_INACTIVE;
        this.enemy = NULL;
 
@@ -333,15 +333,15 @@ spawnfunc(target_objective_decrease)
 // destructible walls that can be used to trigger target_objective_decrease
 bool destructible_heal(entity targ, entity inflictor, float amount, float limit)
 {
-       float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health);
-       float hlth = GetResourceAmount(targ, RESOURCE_HEALTH);
+       float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
+       float hlth = GetResourceAmount(targ, RES_HEALTH);
        if (hlth <= 0 || hlth >= true_limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        if(targ.sprite)
        {
-               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RES_HEALTH));
        }
        func_breakable_colormod(targ);
        return true;
@@ -412,7 +412,7 @@ void havocbot_goalrating_ast_targets(entity this, float ratingscale)
                entity destr = it;
                IL_EACH(g_assault_objectivedecreasers, it.targetname == destr.target,
                {
-                       float hlth = GetResourceAmount(it.enemy, RESOURCE_HEALTH);
+                       float hlth = GetResourceAmount(it.enemy, RES_HEALTH);
                        if (hlth > 0 && hlth < ASSAULT_VALUE_INACTIVE)
                        {
                                found = true;