]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_tuba.qc
Don't consider grabbing a cheat if sandbox mode is enabled
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_tuba.qc
index 79f12f55f8a0aa4636b91df84b3887fd95cf46b1..c10d1f544a2d01e67fdef7e2c3b8b396fe53b515 100644 (file)
@@ -78,6 +78,10 @@ float W_Tuba_NoteSendEntity(entity to, float sf)
 {
        float f;
 
+       msg_entity = to;
+       if(!sound_allowed(MSG_ONE, self.realowner))
+               return FALSE;
+
        WriteByte(MSG_ENTITY, ENT_CLIENT_TUBANOTE);
        WriteByte(MSG_ENTITY, sf);
        if(sf & 1)
@@ -141,10 +145,19 @@ void W_Tuba_Attack(float hittype)
 {
        vector o;
        float n;
+
        W_SetupShot(self, FALSE, 2, "", 0, autocvar_g_balance_tuba_damage);
 
        n = Tuba_GetNote(self, hittype);
 
+       hittype = 0;
+       if(self.tuba_instrument & 1)
+               hittype |= HITTYPE_SECONDARY;
+       if(self.tuba_instrument & 2)
+               hittype |= HITTYPE_BOUNCE;
+       if(self.tuba_instrument & 4)
+               hittype |= HITTYPE_HEADSHOT;
+
        if(self.tuba_note)
        {
                if(self.tuba_note.cnt != n || self.tuba_note.tuba_instrument != self.tuba_instrument)
@@ -236,25 +249,24 @@ float w_tuba(float req)
        {
                weapon_setup(WEP_TUBA);
                self.current_ammo = ammo_none;
+               self.tuba_instrument = 0;
        }
        else if (req == WR_RELOAD)
        {
-               // TODO switch to alternate instruments :)
+               // switch to alternate instruments :)
                if(self.weaponentity.state == WS_READY)
                {
-                       /*
                        switch(self.tuba_instrument)
                        {
                                case 0:
                                        self.tuba_instrument = 1;
-                                       self.weaponname = "laser";
+                                       self.weaponname = "akordeon";
                                        break;
                                case 1:
                                        self.tuba_instrument = 0;
                                        self.weaponname = "tuba";
                                        break;
                        }
-                       */
                        W_SetupShot(self, FALSE, 0, "", 0, 0);
                        pointparticles(particleeffectnum("teleport"), w_shotorg, '0 0 0', 1);
                        self.weaponentity.state = WS_INUSE;
@@ -266,7 +278,7 @@ float w_tuba(float req)
        else if (req == WR_CHECKAMMO2)
                return TRUE; // TODO use fuel?
        return TRUE;
-};
+}
 #endif
 #ifdef CSQC
 float w_tuba(float req)
@@ -281,11 +293,45 @@ float w_tuba(float req)
        }
        else if (req == WR_SUICIDEMESSAGE)
        {
-               w_deathtypestring = _("%s hurt his own ears with the @!#%%'n Tuba");
+               float instr;
+               instr = 0;
+               if(w_deathtype & HITTYPE_SECONDARY)
+                       instr |= 1;
+               if(w_deathtype & HITTYPE_BOUNCE)
+                       instr |= 2;
+               if(w_deathtype & HITTYPE_HEADSHOT)
+                       instr |= 4;
+               switch(instr)
+               {
+                       default:
+                       case 0: // Tuba
+                               w_deathtypestring = _("%s hurt his own ears with the @!#%%'n Tuba");
+                               break;
+                       case 1: // Accordeon
+                               w_deathtypestring = _("%s hurt his own ears with the @!#%%'n Accordeon");
+                               break;
+               }
        }
        else if (req == WR_KILLMESSAGE)
        {
-               w_deathtypestring = _("%s died of %s's great playing on the @!#%%'n Tuba");
+               float instr;
+               instr = 0;
+               if(w_deathtype & HITTYPE_SECONDARY)
+                       instr |= 1;
+               if(w_deathtype & HITTYPE_BOUNCE)
+                       instr |= 2;
+               if(w_deathtype & HITTYPE_HEADSHOT)
+                       instr |= 4;
+               switch(instr)
+               {
+                       default:
+                       case 0: // Tuba
+                               w_deathtypestring = _("%s died of %s's great playing on the @!#%%'n Tuba");
+                               break;
+                       case 1: // Accordeon
+                               w_deathtypestring = _("%s died of %s's great playing on the @!#%%'n Accordeon");
+                               break;
+               }
        }
        return TRUE;
 }