]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Mine limit. Players my only plant 4 mines at a time by default
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 25 Sep 2010 23:55:43 +0000 (02:55 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 25 Sep 2010 23:55:43 +0000 (02:55 +0300)
balanceXonotic.cfg
qcsrc/server/w_minelayer.qc

index de1f03eeffa740cab07f39bf6c63127cbbd15673..a3d6a0e2a312a19d0d18850f78b8c8a38b0f1d24 100644 (file)
@@ -312,10 +312,11 @@ set g_balance_minelayer_detectionradius 150
 set g_balance_minelayer_speed 0
 set g_balance_minelayer_speedstart 750
 set g_balance_minelayer_lifetime 60
-set g_balance_minelayer_refire 2
+set g_balance_minelayer_refire 1.5
 set g_balance_minelayer_animtime 0.4
 set g_balance_minelayer_ammo 5
 set g_balance_minelayer_health 10
+set g_balance_minelayer_limit 4 // 0 disables the limit
 set g_balance_minelayer_damageforcescale 0
 set g_balance_minelayer_detonatedelay -1 // positive: timer till detonation is allowed, negative: "security device" that prevents ANY remote detonation if it could hurt its owner, zero: detonatable at any time
 set g_balance_minelayer_remote_damage 45
index e733b3b354d761b72c1ec8bda583161e686e6896..7884ea57cf8d52f504e585749b190aeac8ead486 100644 (file)
@@ -3,6 +3,7 @@ REGISTER_WEAPON(MINE_LAYER, w_minelayer, IT_ROCKETS, 9, WEP_FLAG_NORMAL | WEP_TY
 #else
 #ifdef SVQC
 .float minelayer_detonate;
+.float mine_number;
 
 void spawnfunc_weapon_minelayer (void)
 {
@@ -138,6 +139,19 @@ void W_Mine_Attack (void)
        local entity mine;
        local entity flash;
 
+       // scan how many mines we placed, and return if we reached our limit
+       if(cvar("g_balance_minelayer_limit"))
+       {
+               entity min;
+               self.mine_number = 0;
+               for(min = world; (min = find(min, classname, "mine")); )
+                       if(min.owner == self)
+                               self.mine_number += 1;
+
+               if(self.mine_number >= cvar("g_balance_minelayer_limit"))
+                       return;
+       }
+
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
                self.ammo_rockets = self.ammo_rockets - cvar("g_balance_minelayer_ammo");