]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/terencehill/minelayer_bugfixes'
authorSamual Lenks <samual@xonotic.org>
Mon, 25 Feb 2013 18:30:29 +0000 (13:30 -0500)
committerSamual Lenks <samual@xonotic.org>
Mon, 25 Feb 2013 18:30:29 +0000 (13:30 -0500)
qcsrc/server/defs.qh
qcsrc/server/w_minelayer.qc

index bfea6b2bcb39f681c8d6110d81db1d90b0399f70..2f3eeaa4f3994f3f976dc1fc567dd21efaebb6e7 100644 (file)
@@ -253,8 +253,6 @@ float nJoinAllowed(entity ignore);
 
 .entity flagcarried;
 
-.entity lastrocket;
-
 .float playerid;
 float playerid_last;
 .float noalign;                // if set to 1, the item or spawnpoint won't be dropped to the floor
@@ -547,7 +545,13 @@ float client_cefc_accumulatortime;
 .float clip_load;
 .float old_clip_load;
 .float clip_size;
+
+.entity lastrocket;
 .float minelayer_mines;
+.float nex_charge;
+.float nex_charge_rottime;
+.float nex_chargepool_ammo;
+.float hagar_load;
 
 .float grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
 
@@ -584,12 +588,6 @@ string deathmessage;
 .void (float act_state) setactive;
 .entity realowner;
 
-.float nex_charge;
-.float nex_charge_rottime;
-.float nex_chargepool_ammo;
-
-.float hagar_load;
-
 float allowed_to_spawn; // boolean variable used by the clan arena code to determine if a player can spawn (after the round has ended)
 
 float serverflags;
index 1b4f7c6cd06aa232811c06b67617006ba6f031d2..85ffa6399ff0555edb84717ee346f4c56e37c10e 100644 (file)
@@ -5,6 +5,7 @@ REGISTER_WEAPON(MINE_LAYER, w_minelayer, IT_ROCKETS, 4, WEP_FLAG_MUTATORBLOCKED
 void W_Mine_Think (void);
 .float minelayer_detonate, mine_explodeanyway;
 .float mine_time;
+.vector mine_orientation;
 
 void spawnfunc_weapon_minelayer (void)
 {
@@ -31,7 +32,7 @@ void W_Mine_Stick (entity to)
        setmodel(newmine, "models/mine.md3");
        newmine.angles = vectoangles(-trace_plane_normal); // face against the surface
 
-       newmine.oldvelocity = self.velocity;
+       newmine.mine_orientation = -trace_plane_normal;
 
        newmine.takedamage = self.takedamage;
        newmine.damageforcescale = self.damageforcescale;
@@ -95,7 +96,7 @@ void W_Mine_DoRemoteExplode ()
        self.takedamage = DAMAGE_NO;
 
        if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
-               self.velocity = self.oldvelocity;
+               self.velocity = self.mine_orientation; // particle fx and decals need .velocity
 
        RadiusDamage (self, self.realowner, autocvar_g_balance_minelayer_remote_damage, autocvar_g_balance_minelayer_remote_edgedamage, autocvar_g_balance_minelayer_remote_radius, world, autocvar_g_balance_minelayer_remote_force, self.projectiledeathtype | HITTYPE_BOUNCE, world);
 
@@ -153,7 +154,7 @@ float W_Mine_Count(entity e)
        entity mine;
        for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.realowner == e)
                minecount += 1;
-               
+
        return minecount;
 }
 
@@ -225,7 +226,12 @@ void W_Mine_Touch (void)
        if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
                return; // we're already a stuck mine, why do we get called? TODO does this even happen?
 
-       PROJECTILE_TOUCH;
+       if(WarpZone_Projectile_Touch())
+       {
+               if(wasfreed(self))
+                       self.realowner.minelayer_mines -= 1;
+               return;
+       }
 
        if(other && other.classname == "player" && other.deadflag == DEAD_NO)
        {
@@ -263,8 +269,7 @@ void W_Mine_Attack (void)
        // scan how many mines we placed, and return if we reached our limit
        if(autocvar_g_balance_minelayer_limit)
        {
-       
-               if(W_Mine_Count(self) >= autocvar_g_balance_minelayer_limit)
+               if(self.minelayer_mines >= autocvar_g_balance_minelayer_limit)
                {
                        // the refire delay keeps this message from being spammed
                        sprint(self, strcat("minelayer: You cannot place more than ^2", ftos(autocvar_g_balance_minelayer_limit), " ^7mines at a time\n") );
@@ -355,7 +360,10 @@ float w_minelayer(float req)
        if (req == WR_AIM)
        {
                // aim and decide to fire if appropriate
-               self.BUTTON_ATCK = bot_aim(autocvar_g_balance_minelayer_speed, 0, autocvar_g_balance_minelayer_lifetime, FALSE);
+               if(self.minelayer_mines >= autocvar_g_balance_minelayer_limit)
+                       self.BUTTON_ATCK = FALSE;
+               else
+                       self.BUTTON_ATCK = bot_aim(autocvar_g_balance_minelayer_speed, 0, autocvar_g_balance_minelayer_lifetime, FALSE);
                if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
                {
                        // decide whether to detonate mines
@@ -505,6 +513,10 @@ float w_minelayer(float req)
                else
                        return FALSE;
        }
+       else if (req == WR_RESETPLAYER)
+       {
+               self.minelayer_mines = 0;
+       }
        else if (req == WR_RELOAD)
        {
                W_Reload(autocvar_g_balance_minelayer_ammo, autocvar_g_balance_minelayer_reload_ammo, autocvar_g_balance_minelayer_reload_time, "weapons/reload.wav");