]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_electro.qc
Merge remote-tracking branch 'origin/master' into samual/spawn_weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_electro.qc
index 526d4cd32d6253ff11f5b07022f8e76bd0b369f7..19f8b4443621723f8a7a708ee963283654a0d181 100644 (file)
@@ -9,7 +9,7 @@ void W_Plasma_Explode_Combo (void);
 
 void W_Plasma_TriggerCombo(vector org, float rad, entity own)
 {
-       local entity e;
+       entity e;
        e = WarpZone_FindRadius(org, rad, TRUE);
        while (e)
        {
@@ -39,12 +39,12 @@ void W_Plasma_Explode (void)
        self.takedamage = DAMAGE_NO;
        if (self.movetype == MOVETYPE_BOUNCE)
        {
-               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_secondary_damage, autocvar_g_balance_electro_secondary_edgedamage, autocvar_g_balance_electro_secondary_radius, world, autocvar_g_balance_electro_secondary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_secondary_damage, autocvar_g_balance_electro_secondary_edgedamage, autocvar_g_balance_electro_secondary_radius, world, world, autocvar_g_balance_electro_secondary_force, self.projectiledeathtype, other);
        }
        else
        {
                W_Plasma_TriggerCombo(self.origin, autocvar_g_balance_electro_primary_comboradius, self.realowner);
-               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_primary_damage, autocvar_g_balance_electro_primary_edgedamage, autocvar_g_balance_electro_primary_radius, world, autocvar_g_balance_electro_primary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_primary_damage, autocvar_g_balance_electro_primary_edgedamage, autocvar_g_balance_electro_primary_radius, world, world, autocvar_g_balance_electro_primary_force, self.projectiledeathtype, other);
        }
 
        remove (self);
@@ -55,7 +55,7 @@ void W_Plasma_Explode_Combo (void)
        W_Plasma_TriggerCombo(self.origin, autocvar_g_balance_electro_combo_comboradius, self.realowner);
 
        self.event_damage = SUB_Null;
-       RadiusDamage (self, self.realowner, autocvar_g_balance_electro_combo_damage, autocvar_g_balance_electro_combo_edgedamage, autocvar_g_balance_electro_combo_radius, world, autocvar_g_balance_electro_combo_force, WEP_ELECTRO | HITTYPE_BOUNCE, world); // use THIS type for a combo because primary can't bounce
+       RadiusDamage (self, self.realowner, autocvar_g_balance_electro_combo_damage, autocvar_g_balance_electro_combo_edgedamage, autocvar_g_balance_electro_combo_radius, world, world, autocvar_g_balance_electro_combo_force, WEP_ELECTRO | HITTYPE_BOUNCE, world); // use THIS type for a combo because primary can't bounce
        remove (self);
 }
 
@@ -83,13 +83,19 @@ void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float dea
 {
        if(self.health <= 0)
                return;
+
        // note: combos are usually triggered by W_Plasma_TriggerCombo, not damage
+       float is_combo = (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim");
+       
+       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_combo ? 1 : -1)))
+               return; // g_projectiles_damage says to halt    
+       
        self.health = self.health - damage;
        if (self.health <= 0)
        {
                self.takedamage = DAMAGE_NO;
                self.nextthink = time;
-               if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
+               if (is_combo)
                {
                        // change owner to whoever caused the combo explosion
                        self.realowner = inflictor.realowner;
@@ -108,7 +114,7 @@ void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float dea
 
 void W_Electro_Attack()
 {
-       local entity proj;
+       entity proj;
 
        W_DecreaseAmmo(ammo_cells, autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_reload_ammo);
 
@@ -134,6 +140,7 @@ void W_Electro_Attack()
        proj.touch = W_Plasma_TouchExplode;
        setsize(proj, '0 0 -3', '0 0 -3');
        proj.flags = FL_PROJECTILE;
+       proj.missile_flags = MIF_SPLASH;
 
        CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
 
@@ -142,7 +149,7 @@ void W_Electro_Attack()
 
 void W_Electro_Attack2()
 {
-       local entity proj;
+       entity proj;
 
        W_DecreaseAmmo(ammo_cells, autocvar_g_balance_electro_secondary_ammo, autocvar_g_balance_electro_reload_ammo);
 
@@ -175,9 +182,11 @@ void W_Electro_Attack2()
        proj.health = autocvar_g_balance_electro_secondary_health;
        proj.event_damage = W_Plasma_Damage;
        proj.flags = FL_PROJECTILE;
+       proj.damagedbycontents = (autocvar_g_balance_electro_secondary_damagedbycontents);
 
        proj.bouncefactor = autocvar_g_balance_electro_secondary_bouncefactor;
        proj.bouncestop = autocvar_g_balance_electro_secondary_bouncestop;
+       proj.missile_flags = MIF_SPLASH | MIF_ARC;
 
 #if 0
        entity p2;
@@ -268,7 +277,7 @@ void lgbeam_think()
                        {
                                dt = min(dt, owner_player.clip_load / autocvar_g_balance_electro_primary_ammo);
                                owner_player.clip_load = max(0, owner_player.clip_load - autocvar_g_balance_electro_primary_ammo * frametime);
-                               owner_player.weapon_load[WEP_ELECTRO] = owner_player.clip_load;
+                               owner_player.(weapon_load[WEP_ELECTRO]) = owner_player.clip_load;
                        }
                        else
                        {
@@ -507,19 +516,27 @@ float w_electro(float req)
                                ammo_amount = 1;
                        else
                                ammo_amount = self.ammo_cells > 0;
-                       ammo_amount += self.weapon_load[WEP_ELECTRO] > 0;
+                       ammo_amount += self.(weapon_load[WEP_ELECTRO]) > 0;
                }
                else
                {
                        ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
-                       ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_primary_ammo;
+                       ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_primary_ammo;
                }
                return ammo_amount;
        }
        else if (req == WR_CHECKAMMO2)
        {
-               ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo;
-               ammo_amount += self.weapon_load[WEP_ELECTRO] >= autocvar_g_balance_electro_secondary_ammo;
+               if(autocvar_g_balance_electro_combo_safeammocheck) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
+               {
+                       ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo;
+                       ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo;
+               }
+               else
+               {
+                       ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo;
+                       ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo;
+               }
                return ammo_amount;
        }
        else if (req == WR_RESETPLAYER)
@@ -531,7 +548,7 @@ float w_electro(float req)
                W_Reload(min(autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_secondary_ammo), autocvar_g_balance_electro_reload_ammo, autocvar_g_balance_electro_reload_time, "weapons/reload.wav");
        }
        return TRUE;
-};
+}
 #endif
 #ifdef CSQC
 float w_electro(float req)
@@ -571,27 +588,27 @@ float w_electro(float req)
        else if (req == WR_SUICIDEMESSAGE)
        {
                if(w_deathtype & HITTYPE_SECONDARY)
-                       w_deathtypestring = _("%s could not remember where they put plasma");
+                       w_deathtypestring = _("%s could not remember where they put their electro plasma");
                else
-                       w_deathtypestring = _("%s played with plasma");
+                       w_deathtypestring = _("%s played with electro plasma");
        }
        else if (req == WR_KILLMESSAGE)
        {
                if(w_deathtype & HITTYPE_SECONDARY)
                {
                        if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
-                               w_deathtypestring = _("%s just noticed %s's blue ball");
+                               w_deathtypestring = _("%s just noticed %s's electro plasma");
                        else // unchecked: BOUNCE
-                               w_deathtypestring = _("%s got in touch with %s's blue ball");
+                               w_deathtypestring = _("%s got in touch with %s's electro plasma");
                }
                else
                {
                        if(w_deathtype & HITTYPE_BOUNCE) // combo
-                               w_deathtypestring = _("%s felt the electrifying air of %s's combo");
+                               w_deathtypestring = _("%s felt the electrifying air of %s's electro combo");
                        else if(w_deathtype & HITTYPE_SPLASH)
-                               w_deathtypestring = _("%s got too close to %s's blue beam");
+                               w_deathtypestring = _("%s got too close to %s's blue electro bolt");
                        else
-                               w_deathtypestring = _("%s was blasted by %s's blue beam");
+                               w_deathtypestring = _("%s was blasted by %s's blue electro bolt");
                }
        }
        return TRUE;