]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/sv_turrets.qc
Purge server/defs.qh
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / sv_turrets.qc
index 18197c078373f749c8d3127cc10f68396600889a..84b0c824908da1c96a49b618495b34fcbcb748f2 100644 (file)
@@ -1,6 +1,11 @@
 #include "sv_turrets.qh"
 #ifdef SVQC
 #include <server/autocvars.qh>
+#include <server/bot/api.qh>
+#include <server/g_damage.qh>
+#include <server/weapons/common.qh>
+#include <server/weapons/weaponsystem.qh>
+#include <common/mapobjects/defs.qh>
 
 // Generic aiming
 vector turret_aim_generic(entity this)
@@ -320,7 +325,6 @@ void turrets_setframe(entity this, float _frame, float client_only)
 
 bool turret_send(entity this, entity to, float sf)
 {
-
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TURRET);
        WriteByte(MSG_ENTITY, sf);
        if(sf & TNSF_SETUP)
@@ -329,8 +333,7 @@ bool turret_send(entity this, entity to, float sf)
 
                WriteVector(MSG_ENTITY, this.origin);
 
-               WriteAngle(MSG_ENTITY, this.angles_x);
-               WriteAngle(MSG_ENTITY, this.angles_y);
+               WriteAngleVector2D(MSG_ENTITY, this.angles);
        }
 
        if(sf & TNSF_ANG)
@@ -402,7 +405,7 @@ void load_unit_settings(entity ent, bool is_reload)
        ent.ammo_max             *= ent.turret_scale_ammo;
        ent.ammo_recharge        *= ent.turret_scale_ammo;
        ent.aim_speed            *= ent.turret_scale_aim;
-       ent.health               *= ent.turret_scale_health;
+       SetResourceExplicit(ent, RES_HEALTH, GetResource(ent, RES_HEALTH) * ent.turret_scale_health);
        ent.respawntime          *= ent.turret_scale_respawn;
        ent.shot_dmg             *= ent.turret_scale_damage;
        ent.shot_refire          *= ent.turret_scale_refire;
@@ -426,11 +429,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);
 }
@@ -472,7 +475,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)
        {
@@ -756,6 +759,9 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
 
                        if (e_turret.team != e_target.owner.team)
                                return -12;
+
+                       if (e_turret.team != e_target.aiment.team)
+                               return -12; // portals
                }
                else
                {
@@ -764,6 +770,9 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
 
                        if (e_turret.team == e_target.owner.team)
                                return -14;
+
+                       if (e_turret.team == e_target.aiment.team)
+                               return -14; // portals
                }
        }
 
@@ -782,7 +791,6 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
        tvt_thadv = angleofs3(e_turret.tur_head.origin, e_turret.angles + e_turret.tur_head.angles, e_target.origin);
        tvt_tadv = shortangle_vxy(angleofs(e_turret, e_target), e_turret.angles);
        tvt_thadf = vlen(tvt_thadv);
-       tvt_tadf = vlen(tvt_tadv);
 
        /*
        if(validate_flags & TFL_TARGETSELECT_FOV)