]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/sv_turrets.qc
Merge branch 'drjaska/silent-respawn' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / sv_turrets.qc
index 20fcb40a6d64e62f310d9fd3da1d535f8b36efb4..a42005f32a2a0af5fca32a41a671a0873e17844b 100644 (file)
@@ -1,6 +1,12 @@
 #include "sv_turrets.qh"
+
 #ifdef SVQC
-#include <server/autocvars.qh>
+#include <common/mapobjects/defs.qh>
+#include <server/bot/api.qh>
+#include <server/damage.qh>
+#include <server/weapons/common.qh>
+#include <server/weapons/weaponsystem.qh>
+#include <server/world.qh>
 
 // Generic aiming
 vector turret_aim_generic(entity this)
@@ -298,6 +304,8 @@ void turret_respawn(entity this)
 
        Turret tur = get_turretinfo(this.m_id);
        tur.tr_setup(tur, this);
+
+       setorigin(this, this.origin); // make sure it's linked to the area grid
 }
 
 
@@ -424,11 +432,11 @@ void turret_projectile_explode(entity this)
        this.event_damage = func_null;
 #ifdef TURRET_DEBUG
        float d;
-       d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL);
+       d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.projectiledeathtype, DMG_NOWEP, NULL);
        this.owner.tur_debug_dmg_t_h = this.owner.tur_debug_dmg_t_h + d;
        this.owner.tur_debug_dmg_t_f = this.owner.tur_debug_dmg_t_f + this.owner.shot_dmg;
 #else
-       RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL);
+       RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.projectiledeathtype, DMG_NOWEP, NULL);
 #endif
        delete(this);
 }
@@ -470,7 +478,7 @@ entity turret_projectile(entity actor, Sound _snd, float _size, float _health, f
        IL_PUSH(g_projectiles, proj);
        IL_PUSH(g_bot_dodge, proj);
        proj.enemy                = actor.enemy;
-       proj.totalfrags  = _death;
+       proj.projectiledeathtype         = _death;
        PROJECTILE_MAKETRIGGER(proj);
        if(_health)
        {
@@ -687,7 +695,8 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
        if(!e_target)
                return -2;
 
-       if(e_target.owner == e_turret)
+       // Don't attack against owner
+       if(e_target.owner == e_turret || e_target == e_turret.realowner)
                return -0.5;
 
        if(!checkpvs(e_target.origin, e_turret))
@@ -1250,7 +1259,7 @@ void turret_findtarget(entity this)
        entity e = find(NULL, classname, "turret_manager");
        if(!e)
        {
-               e = new(turret_manager);
+               e = new_pure(turret_manager);
                setthink(e, turrets_manager_think);
                e.nextthink = time + 2;
        }