]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_tuba.qc
Merge remote branch 'origin/master' into fruitiex/animations
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_tuba.qc
index 491030fcbcc486cfde1249c03d5d560e09b22bb4..117d32cb96a5a454d31d76896b67d17c35fabf34 100644 (file)
@@ -1,9 +1,8 @@
 #ifdef REGISTER_WEAPON
-REGISTER_WEAPON(TUBA, w_tuba, 0, 1, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "tuba", "tuba", "@!#%'n Tuba");
+REGISTER_WEAPON(TUBA, w_tuba, 0, 1, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "tuba", "tuba", _("@!#%'n Tuba"))
 #else
 #ifdef SVQC
 //#define TUBA_NOTE(n) strcat("weapons/tuba_note", ftos(n), ".wav")
-.float tuba_notecount;
 .entity tuba_note;
 .float tuba_smoketime;
 
@@ -48,7 +47,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;
@@ -83,7 +82,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;
 }
@@ -97,30 +96,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 = cvar("g_balance_tuba_attenuation") / cvar("snd_soundradius");
+       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;
                }
@@ -130,18 +129,8 @@ void W_Tuba_NoteThink()
 void W_Tuba_Attack(float hittype)
 {
        vector o;
-       float c, n;
-       W_SetupShot(self, FALSE, 2, "", cvar("g_balance_tuba_damage"));
-       if(self.tuba_notecount)
-       {
-               self.tuba_notecount = FALSE;
-               c = CHAN_WEAPON;
-       }
-       else
-       {
-               self.tuba_notecount = TRUE;
-               c = CHAN_WEAPON2;
-       }
+       float n;
+       W_SetupShot(self, FALSE, 2, "", 0, autocvar_g_balance_tuba_damage);
 
        n = Tuba_GetNote(self, hittype);
 
@@ -161,17 +150,17 @@ 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;
                Net_LinkEntity(self.tuba_note, FALSE, 0, W_Tuba_NoteSendEntity);
        }
 
-       self.tuba_note.teleport_time = time + cvar("g_balance_tuba_refire") * 2; // so it can get prolonged safely
+       self.tuba_note.teleport_time = time + autocvar_g_balance_tuba_refire * 2; // so it can get prolonged safely
 
-       //sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), cvar("g_balance_tuba_attenuation"));
-       RadiusDamage(self, self, cvar("g_balance_tuba_damage"), cvar("g_balance_tuba_edgedamage"), cvar("g_balance_tuba_radius"), world, cvar("g_balance_tuba_force"), hittype | WEP_TUBA, world);
+       //sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation);
+       RadiusDamage(self, self, autocvar_g_balance_tuba_damage, autocvar_g_balance_tuba_edgedamage, autocvar_g_balance_tuba_radius, world, autocvar_g_balance_tuba_force, hittype | WEP_TUBA, world);
 
        o = gettaginfo(self.exteriorweaponentity, 0);
        if(time > self.tuba_smoketime)
@@ -192,7 +181,7 @@ float w_tuba(float req)
        {
                // bots cannot play the Tuba well yet
                // I think they should start with the recorder first
-               if(vlen(self.origin - self.enemy.origin) < cvar("g_balance_tuba_radius"))
+               if(vlen(self.origin - self.enemy.origin) < autocvar_g_balance_tuba_radius)
                {
                        if(random() > 0.5)
                                self.BUTTON_ATCK = 1;
@@ -203,18 +192,18 @@ float w_tuba(float req)
        else if (req == WR_THINK)
        {
                if (self.BUTTON_ATCK)
-               if (weapon_prepareattack(0, cvar("g_balance_tuba_refire")))
+               if (weapon_prepareattack(0, autocvar_g_balance_tuba_refire))
                {
                        W_Tuba_Attack(0);
-                       //weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_tuba_animtime"), w_ready);
-                       weapon_thinkf(WFRAME_IDLE, cvar("g_balance_tuba_animtime"), w_ready);
+                       //weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
+                       weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready);
                }
                if (self.BUTTON_ATCK2)
-               if (weapon_prepareattack(1, cvar("g_balance_tuba_refire")))
+               if (weapon_prepareattack(1, autocvar_g_balance_tuba_refire))
                {
                        W_Tuba_Attack(HITTYPE_SECONDARY);
-                       //weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_tuba_animtime"), w_ready);
-                       weapon_thinkf(WFRAME_IDLE, cvar("g_balance_tuba_animtime"), w_ready);
+                       //weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
+                       weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready);
                }
                if(self.tuba_note)
                {
@@ -236,7 +225,10 @@ float w_tuba(float req)
                //      precache_sound(TUBA_NOTE(i));
        }
        else if (req == WR_SETUP)
+       {
                weapon_setup(WEP_TUBA);
+               self.current_ammo = ammo_none;
+       }
        else if (req == WR_CHECKAMMO1)
                return TRUE; // TODO use fuel?
        else if (req == WR_CHECKAMMO2)
@@ -257,11 +249,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;
 }