]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_electro.qc
Merge branch 'master' into terencehill/menu_tooltips_2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_electro.qc
index da29a441843d3f9122f683f0522276feb57d724d..e46f749c79fdf0526f8031f2dc9c12360317ecbc 100644 (file)
@@ -62,7 +62,7 @@ void W_Plasma_Explode_Combo (void)
 void W_Plasma_Touch (void)
 {
        //self.velocity = self.velocity  * 0.1;
-       
+
        PROJECTILE_TOUCH;
        if (other.takedamage == DAMAGE_AIM) {
                W_Plasma_Explode ();
@@ -178,10 +178,10 @@ void W_Electro_Attack2()
        proj.health = autocvar_g_balance_electro_secondary_health;
        proj.event_damage = W_Plasma_Damage;
        proj.flags = FL_PROJECTILE;
-       
+
        proj.bouncefactor = autocvar_g_balance_electro_secondary_bouncefactor;
        proj.bouncestop = autocvar_g_balance_electro_secondary_bouncestop;
-       
+
 #if 0
        entity p2;
        p2 = spawn();
@@ -232,7 +232,7 @@ void lgbeam_think()
                remove(self);
                return;
        }
-       if (self.owner.weaponentity.state != WS_INUSE || (self.owner.ammo_cells <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)) || self.owner.deadflag != DEAD_NO || !self.owner.BUTTON_ATCK || (g_freezetag && self.owner.freezetag_frozen))
+       if (self.owner.weaponentity.state != WS_INUSE || (self.owner.ammo_cells <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)) || self.owner.deadflag != DEAD_NO || !self.owner.BUTTON_ATCK || self.owner.freezetag_frozen)
        {
                if(self == self.owner.lgbeam)
                        self.owner.lgbeam = world;
@@ -295,6 +295,7 @@ void W_Electro_Attack3 (void)
        entity beam, oldself;
 
        self.lgbeam = beam = spawn();
+       beam.classname = "lgbeam";
        beam.solid = SOLID_NOT;
        beam.think = lgbeam_think;
        beam.owner = self;
@@ -351,7 +352,14 @@ float w_electro(float req)
                        self.bot_secondary_electromooth = 0;
                if(self.bot_secondary_electromooth == 0)
                {
-                       if(bot_aim(autocvar_g_balance_electro_primary_speed, 0, autocvar_g_balance_electro_primary_lifetime, FALSE))
+                       float shoot;
+
+                       if(autocvar_g_balance_electro_primary_speed)
+                               shoot = bot_aim(autocvar_g_balance_electro_primary_speed, 0, autocvar_g_balance_electro_primary_lifetime, FALSE);
+                       else
+                               shoot = bot_aim(1000000, 0, 0.001, FALSE);
+
+                       if(shoot)
                        {
                                self.BUTTON_ATCK = TRUE;
                                if(random() < 0.01) self.bot_secondary_electromooth = 1;
@@ -370,6 +378,15 @@ float w_electro(float req)
        {
                if (self.BUTTON_ATCK)
                {
+                       if(autocvar_g_balance_electro_lightning)
+                               if(self.BUTTON_ATCK_prev)
+                               {
+                                       // prolong the animtime while the gun is being fired
+                                       if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y)
+                                               weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_electro_primary_animtime, w_ready);
+                                       else
+                                               weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
+                               }
                        if (weapon_prepareattack(0, (autocvar_g_balance_electro_lightning ? 0 : autocvar_g_balance_electro_primary_refire)))
                        {
                                if(autocvar_g_balance_electro_lightning)
@@ -378,19 +395,24 @@ float w_electro(float req)
                                        {
                                                W_Electro_Attack3();
                                        }
-                                       self.BUTTON_ATCK_prev = 1;
+                                       if(!self.BUTTON_ATCK_prev)
+                                       {
+                                               weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
+                                               self.BUTTON_ATCK_prev = 1;
+                                       }
                                }
                                else
                                {
                                        W_Electro_Attack();
+                                       weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
                                }
-                               weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
                        }
                } else {
                        if(autocvar_g_balance_electro_lightning)
                        {
                                if (self.BUTTON_ATCK_prev != 0)
                                {
+                                       weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
                                        ATTACK_FINISHED(self) = time + autocvar_g_balance_electro_primary_refire * W_WeaponRateFactor();
                                }
                                self.BUTTON_ATCK_prev = 0;
@@ -404,7 +426,7 @@ float w_electro(float req)
                        W_Electro_Attack2();
                        self.electro_count = autocvar_g_balance_electro_secondary_count;
                        weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
-                       self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2;
+                       self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor();
                }
        }
        else if (req == WR_PRECACHE)