]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/t_items.qc
Merge branch 'terencehill/bot_waypoints' into terencehill/bot_ai
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / t_items.qc
index 97938e81d850d65b490aac9728cacb2c47da0e0e..feefd10985aa37763770520146704e307b78ae87 100644 (file)
@@ -533,7 +533,7 @@ void Item_Respawn (entity this)
 
 void Item_RespawnCountdown (entity this)
 {
-       if(this.count >= ITEM_RESPAWN_TICKS)
+       if(this.item_respawncounter >= ITEM_RESPAWN_TICKS)
        {
                if(this.waypointsprite_attached)
                        WaypointSprite_Kill(this.waypointsprite_attached);
@@ -542,8 +542,8 @@ void Item_RespawnCountdown (entity this)
        else
        {
                this.nextthink = time + 1;
-               this.count += 1;
-               if(this.count == 1)
+               this.item_respawncounter += 1;
+               if(this.item_respawncounter == 1)
                {
                        do {
                                {
@@ -584,7 +584,7 @@ void Item_RespawnCountdown (entity this)
                        });
 
                        WaypointSprite_Ping(this.waypointsprite_attached);
-                       //WaypointSprite_UpdateHealth(this.waypointsprite_attached, this.count);
+                       //WaypointSprite_UpdateHealth(this.waypointsprite_attached, this.item_respawncounter);
                }
        }
 }
@@ -607,7 +607,7 @@ void Item_ScheduleRespawnIn(entity e, float t)
                setthink(e, Item_RespawnCountdown);
                e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
                e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
-               e.count = 0;
+               e.item_respawncounter = 0;
                if(Item_ItemsTime_Allow(e.itemdef) || (e.weapons & WEPSET_SUPERWEAPONS))
                {
                        t = Item_ItemsTime_UpdateTime(e, e.scheduledrespawntime);
@@ -842,8 +842,6 @@ float Item_GiveTo(entity item, entity player)
                player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
        }
 
-LABEL(skip)
-
        // always eat teamed entities
        if(item.team)
                pickedup = true;
@@ -905,11 +903,7 @@ void Item_Touch(entity this, entity toucher)
 
        toucher = M_ARGV(1, entity);
 
-       // TODO: Proper way to handle expiring and not expiring loot.
-       // Expiring loot will have strength "ticking" will it's dropped.
-       // Not expiring will not tick.
-       // OTOH, do we really need expiring loot?
-       if (this.classname == "droppedweapon")
+       if (Item_IsExpiring(this))
        {
                this.strength_finished = max(0, this.strength_finished - time);
                this.invincible_finished = max(0, this.invincible_finished - time);
@@ -918,7 +912,7 @@ void Item_Touch(entity this, entity toucher)
        bool gave = ITEM_HANDLE(Pickup, this.itemdef, this, toucher);
        if (!gave)
        {
-               if (Item_IsLoot(this))
+               if (Item_IsExpiring(this))
                {
                        // undo what we did above
                        this.strength_finished += time;
@@ -1132,8 +1126,6 @@ float ammo_pickupevalfunc(entity player, entity item)
        return rating;
 }
 
-.int item_group;
-.int item_group_count;
 float healtharmor_pickupevalfunc(entity player, entity item)
 {
        float c = 0;
@@ -1232,11 +1224,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                this.takedamage = DAMAGE_YES;
                this.event_damage = Item_Damage;
 
-               // TODO: Proper way to handle expiring and not expiring loot.
-               // Expiring loot will have strength "ticking" will it's dropped.
-               // Not expiring will not tick.
-               // OTOH, do we really need expiring loot?
-               if (this.strength_finished || this.invincible_finished || this.superweapons_finished)
+               if (Item_IsExpiring(this))
                {
                        // if item is worthless after a timer, have it expire then
                        this.nextthink = max(this.strength_finished, this.invincible_finished, this.superweapons_finished);
@@ -1351,7 +1339,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
 
        if(def.instanceOfWeaponPickup)
        {
-               if (this.classname != "droppedweapon") // if dropped, colormap is already set up nicely
+               if (!Item_IsLoot(this)) // if dropped, colormap is already set up nicely
                        this.colormap = 1024; // color shirt=0 pants=0 grey
                else
                        this.gravity = 1;
@@ -1452,7 +1440,7 @@ void setItemGroupCount()
 
 void target_items_use(entity this, entity actor, entity trigger)
 {
-       if(actor.classname == "droppedweapon")
+       if(Item_IsLoot(actor))
        {
                EXACTTRIGGER_TOUCH(this, trigger);
                delete(actor);
@@ -1467,7 +1455,7 @@ void target_items_use(entity this, entity actor, entity trigger)
                EXACTTRIGGER_TOUCH(this, trigger);
        }
 
-       IL_EACH(g_items, it.enemy == actor && it.classname == "droppedweapon",
+       IL_EACH(g_items, it.enemy == actor && Item_IsLoot(it),
        {
                delete(it);
        });