]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_tuba.qc
EXPERIMENTAL change: make projectiles able to hit yourself when shot through a warpzone
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_tuba.qc
index 1a62d02c28b287ce52c01c0b880edbef01245d36..46197204026359c0de9a914c109e63da86d15779 100644 (file)
@@ -7,12 +7,6 @@ REGISTER_WEAPON(TUBA, w_tuba, 0, 1, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH, BOT_PICKU
 .entity tuba_note;
 .float tuba_smoketime;
 
-void W_Tuba_SetAmmoCounter()
-{
-       // this weapon doesn't have a reload system, so always set the clip to 0 when switching to it
-       self.clip_load = self.clip_size = 0; // also keeps crosshair ammo from displaying
-}
-
 float Tuba_GetNote(entity pl, float hittype)
 {
        float note;
@@ -54,7 +48,7 @@ float Tuba_GetNote(entity pl, float hittype)
        // kind of tuba currently is player slot number, or team number if in
        // teamplay
        // that way, holes in the range of notes are "plugged"
-       if(teams_matter)
+       if(teamplay)
        {
                if(pl.team == COLOR_TEAM2 || pl.team == COLOR_TEAM4)
                        note += 3;
@@ -89,7 +83,7 @@ float W_Tuba_NoteSendEntity(entity to, float sf)
                WriteCoord(MSG_ENTITY, self.origin_x);
                WriteCoord(MSG_ENTITY, self.origin_y);
                WriteCoord(MSG_ENTITY, self.origin_z);
-               WriteByte(MSG_ENTITY, self.owner != to);
+               WriteByte(MSG_ENTITY, self.realowner != to);
        }
        return TRUE;
 }
@@ -103,30 +97,30 @@ void W_Tuba_NoteThink()
        entity e;
        if(time > self.teleport_time)
        {
-               self.owner.tuba_note = world;
+               self.realowner.tuba_note = world;
                remove(self);
                return;
        }
        self.nextthink = time;
        dist_mult = autocvar_g_balance_tuba_attenuation / autocvar_snd_soundradius;
        FOR_EACH_REALCLIENT(e)
-       if(e != self.owner)
+       if(e != self.realowner)
        {
                v = self.origin - (e.origin + e.view_ofs);
                vol0 = max(0, 1 - vlen(v) * dist_mult);
                dir0 = normalize(v);
-               v = self.owner.origin - (e.origin + e.view_ofs);
+               v = self.realowner.origin - (e.origin + e.view_ofs);
                vol1 = max(0, 1 - vlen(v) * dist_mult);
                dir1 = normalize(v);
                if(fabs(vol0 - vol1) > 0.005) // 0.5 percent change in volume
                {
-                       setorigin(self, self.owner.origin);
+                       setorigin(self, self.realowner.origin);
                        self.SendFlags |= 1;
                        break;
                }
                if(dir0 * dir1 < 0.9994) // 2 degrees change in angle
                {
-                       setorigin(self, self.owner.origin);
+                       setorigin(self, self.realowner.origin);
                        self.SendFlags |= 1;
                        break;
                }
@@ -167,7 +161,7 @@ void W_Tuba_Attack(float hittype)
        if not(self.tuba_note)
        {
                self.tuba_note = spawn();
-               self.tuba_note.owner = self;
+               self.tuba_note.owner = self.tuba_note.realowner = self;
                self.tuba_note.cnt = n;
                self.tuba_note.think = W_Tuba_NoteThink;
                self.tuba_note.nextthink = time;
@@ -244,17 +238,12 @@ float w_tuba(float req)
        else if (req == WR_SETUP)
        {
                weapon_setup(WEP_TUBA);
-               W_Porto_SetAmmoCounter();
+               self.current_ammo = ammo_none;
        }
        else if (req == WR_CHECKAMMO1)
                return TRUE; // TODO use fuel?
        else if (req == WR_CHECKAMMO2)
                return TRUE; // TODO use fuel?
-       else if (req == WR_SWITCHABLE)
-       {
-               // no reloading system, return true
-               return TRUE;
-       }
        return TRUE;
 };
 #endif
@@ -271,11 +260,11 @@ float w_tuba(float req)
        }
        else if (req == WR_SUICIDEMESSAGE)
        {
-               w_deathtypestring = "%s hurt his own ears with the @!#%%'n Tuba";
+               w_deathtypestring = _("%s hurt his own ears with the @!#%%'n Tuba");
        }
        else if (req == WR_KILLMESSAGE)
        {
-               w_deathtypestring = "%s died of %s's great playing on the @!#%%'n Tuba";
+               w_deathtypestring = _("%s died of %s's great playing on the @!#%%'n Tuba");
        }
        return TRUE;
 }