]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/sv_vehicles.qc
Add a second list for bot dodge entities
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / sv_vehicles.qc
index f7c5a55741fe1bbf6d87b1a65fdcf31b7c487b32..60a8ee07760fbe897e58cd58fab2e22904337728 100644 (file)
@@ -249,6 +249,7 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
        set_movetype(proj, MOVETYPE_FLYMISSILE);
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
+       IL_PUSH(g_bot_dodge, proj);
        proj.bot_dodge          = true;
        proj.bot_dodgerating  = _dmg;
        proj.velocity            = _vel;
@@ -433,17 +434,15 @@ void vehicles_reset_colors(entity this)
 void vehicles_clearreturn(entity veh)
 {
        // Remove "return helper" entities, if any.
-       FOREACH_ENTITY_ENT(wp00, veh,
+       IL_EACH(g_vehicle_returners, it.wp00 == veh,
        {
-               if(it.classname == "vehicle_return")
-               {
-                       it.classname = "";
-                       setthink(it, SUB_Remove);
-                       it.nextthink = time + 0.1;
+               it.classname = "";
+               setthink(it, SUB_Remove);
+               it.nextthink = time + 0.1;
+               IL_REMOVE(g_vehicle_returners, it);
 
-                       if(it.waypointsprite_attached)
-                               WaypointSprite_Kill(it.waypointsprite_attached);
-               }
+               if(it.waypointsprite_attached)
+                       WaypointSprite_Kill(it.waypointsprite_attached);
        });
 }
 
@@ -513,6 +512,7 @@ void vehicles_setreturn(entity veh)
        vehicles_clearreturn(veh);
 
        entity ret = new(vehicle_return);
+       IL_PUSH(g_vehicle_returners, ret);
        ret.wp00           = veh;
        ret.team                = veh.team;
        setthink(ret, vehicles_showwp);
@@ -532,7 +532,7 @@ void vehicles_setreturn(entity veh)
 
 void vehicle_use(entity this, entity actor, entity trigger)
 {
-       LOG_DEBUG("vehicle ", this.netname, " used by ", actor.classname, "\n");
+       LOG_DEBUG("vehicle ", this.netname, " used by ", actor.classname);
 
        this.tur_head.team = actor.team;
 
@@ -543,7 +543,7 @@ void vehicle_use(entity this, entity actor, entity trigger)
 
        if(this.active == ACTIVE_ACTIVE && !IS_DEAD(this) && !gameover)
        {
-               LOG_DEBUG("Respawning vehicle: ", this.netname, "\n");
+               LOG_DEBUG("Respawning vehicle: ", this.netname);
                if(this.effects & EF_NODRAW)
                {
                        setthink(this, vehicles_spawn);
@@ -765,7 +765,7 @@ void vehicles_exit(entity vehic, bool eject)
 
        if(vehicles_exit_running)
        {
-               LOG_TRACE("^1vehicles_exit already running! this is not good...\n");
+               LOG_TRACE("^1vehicles_exit already running! this is not good...");
                return;
        }
 
@@ -1060,7 +1060,7 @@ void vehicles_reset(entity this)
 // initialization
 void vehicles_spawn(entity this)
 {
-       LOG_DEBUG("Spawning vehicle: ", this.classname, "\n");
+       LOG_DEBUG("Spawning vehicle: ", this.classname);
 
        // disown & reset
        this.vehicle_hudmodel.viewmodelforclient = this;
@@ -1076,6 +1076,8 @@ void vehicles_spawn(entity this)
        this.solid                              = SOLID_SLIDEBOX;
        this.takedamage                 = DAMAGE_AIM;
        this.deadflag                   = DEAD_NO;
+       if(!this.bot_attack)
+               IL_PUSH(g_bot_targets, this);
        this.bot_attack                 = true;
        this.flags                              = FL_NOTARGET;
        this.avelocity                  = '0 0 0';
@@ -1126,7 +1128,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
                this.vehicle_controller = find(NULL, target, this.targetname);
                if(!this.vehicle_controller)
                {
-                       LOG_DEBUG("^1WARNING: ^7Vehicle with invalid .targetname\n");
+                       LOG_DEBUG("^1WARNING: ^7Vehicle with invalid .targetname");
                        this.active = ACTIVE_ACTIVE;
                }
                else
@@ -1161,6 +1163,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        this.tur_head.owner                     = this;
        this.takedamage                         = DAMAGE_NO;
        this.bot_attack                         = true;
+       IL_PUSH(g_bot_targets, this);
        this.iscreature                         = true;
        this.teleportable                       = false; // no teleporting for vehicles, too buggy
        this.damagedbycontents          = true;