]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_electro.qc
Merge branch 'Mario/random_spawns'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_electro.qc
index e02ee701b97d3a4f213d39455365444e8a8282ba..ea2cf8bf0560dfee7a879789377231dc82e8cd0f 100644 (file)
@@ -1,5 +1,15 @@
 #ifdef REGISTER_WEAPON
-REGISTER_WEAPON(ELECTRO, w_electro, IT_CELLS, 5, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "electro", "electro", _("Electro"));
+REGISTER_WEAPON(
+/* WEP_##id  */ ELECTRO,
+/* function  */ w_electro,
+/* ammotype  */ IT_CELLS,
+/* impulse   */ 5,
+/* flags     */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
+/* rating    */ BOT_PICKUP_RATING_MID,
+/* model     */ "electro",
+/* shortname */ "electro",
+/* fullname  */ _("Electro")
+);
 #else
 #ifdef SVQC
 .float electro_count;
@@ -29,11 +39,11 @@ void W_Plasma_TriggerCombo(vector org, float rad, entity own)
 void W_Plasma_Explode (void)
 {
        if(other.takedamage == DAMAGE_AIM)
-               if(other.classname == "player")
-                       if(IsDifferentTeam(self.realowner, other))
+               if(IS_PLAYER(other))
+                       if(DIFF_TEAM(self.realowner, other))
                                if(other.deadflag == DEAD_NO)
                                        if(IsFlying(other))
-                                               AnnounceTo(self.realowner, "electrobitch");
+                                               Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
 
        self.event_damage = func_null;
        self.takedamage = DAMAGE_NO;
@@ -68,7 +78,7 @@ void W_Plasma_Touch (void)
                W_Plasma_Explode ();
        } else {
                //UpdateCSQCProjectile(self);
-               spamsound (self, CH_SHOTS, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
+               spamsound (self, CH_SHOTS, "weapons/electro_bounce.wav", VOL_BASE, ATTEN_NORM);
                self.projectiledeathtype |= HITTYPE_BOUNCE;
        }
 }
@@ -86,10 +96,10 @@ void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float dea
 
        // 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    
-       
+               return; // g_projectiles_damage says to halt
+
        self.health = self.health - damage;
        if (self.health <= 0)
        {
@@ -253,7 +263,7 @@ void lgbeam_think()
                return;
        }
 
-       if (owner_player.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || owner_player.deadflag != DEAD_NO || !owner_player.BUTTON_ATCK || owner_player.freezetag_frozen || owner_player.frozen)
+       if (owner_player.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || owner_player.deadflag != DEAD_NO || !owner_player.BUTTON_ATCK || owner_player.frozen)
        {
                if(self == owner_player.lgbeam)
                        owner_player.lgbeam = world;
@@ -269,7 +279,7 @@ void lgbeam_think()
        dt = frametime;
 
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
-       if not(owner_player.items & IT_UNLIMITED_WEAPON_AMMO)
+       if (!(owner_player.items & IT_UNLIMITED_WEAPON_AMMO))
        {
                if(autocvar_g_balance_electro_primary_ammo)
                {
@@ -327,7 +337,7 @@ void W_Electro_Attack3 (void)
 {
        // only play fire sound if 0.5 sec has passed since player let go the fire button
        if(time - self.prevlgfire > 0.5)
-               sound (self, CH_WEAPON_A, "weapons/lgbeam_fire.wav", VOL_BASE, ATTN_NORM);
+               sound (self, CH_WEAPON_A, "weapons/lgbeam_fire.wav", VOL_BASE, ATTEN_NORM);
 
        entity beam, oldself;
 
@@ -543,6 +553,27 @@ 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");
        }
+       else if (req == WR_SUICIDEMESSAGE)
+       {
+               if(w_deathtype & HITTYPE_SECONDARY)
+                       return WEAPON_ELECTRO_SUICIDE_ORBS;
+               else
+                       return WEAPON_ELECTRO_SUICIDE_BOLT;
+       }
+       else if (req == WR_KILLMESSAGE)
+       {
+               if(w_deathtype & HITTYPE_SECONDARY)
+               {
+                       return WEAPON_ELECTRO_MURDER_ORBS;
+               }
+               else
+               {
+                       if(w_deathtype & HITTYPE_BOUNCE)
+                               return WEAPON_ELECTRO_MURDER_COMBO;
+                       else
+                               return WEAPON_ELECTRO_MURDER_BOLT;
+               }
+       }
        return TRUE;
 }
 #endif
@@ -557,7 +588,7 @@ float w_electro(float req)
                {
                        pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
                        if(!w_issilent)
-                               sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTEN_NORM);
                }
                else
                {
@@ -566,13 +597,13 @@ float w_electro(float req)
                                // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
                                pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
                                if(!w_issilent)
-                                       sound(self, CH_SHOTS, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/electro_impact_combo.wav", VOL_BASE, ATTEN_NORM);
                        }
                        else
                        {
                                pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
                                if(!w_issilent)
-                                       sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+                                       sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTEN_NORM);
                        }
                }
        }
@@ -581,32 +612,6 @@ float w_electro(float req)
                precache_sound("weapons/electro_impact.wav");
                precache_sound("weapons/electro_impact_combo.wav");
        }
-       else if (req == WR_SUICIDEMESSAGE)
-       {
-               if(w_deathtype & HITTYPE_SECONDARY)
-                       w_deathtypestring = _("%s could not remember where they put their electro plasma");
-               else
-                       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 electro plasma");
-                       else // unchecked: BOUNCE
-                               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 electro combo");
-                       else if(w_deathtype & HITTYPE_SPLASH)
-                               w_deathtypestring = _("%s got too close to %s's blue electro bolt");
-                       else
-                               w_deathtypestring = _("%s was blasted by %s's blue electro bolt");
-               }
-       }
        return TRUE;
 }
 #endif