From: Mircea Kitsune Date: Sat, 25 Sep 2010 23:55:43 +0000 (+0300) Subject: Mine limit. Players my only plant 4 mines at a time by default X-Git-Tag: xonotic-v0.1.0preview~307^2~33^2~42 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=96c585631ac1e6735cb7228808b6246074718f55;p=xonotic%2Fxonotic-data.pk3dir.git Mine limit. Players my only plant 4 mines at a time by default --- diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index de1f03eef..a3d6a0e2a 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -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 diff --git a/qcsrc/server/w_minelayer.qc b/qcsrc/server/w_minelayer.qc index e733b3b35..7884ea57c 100644 --- a/qcsrc/server/w_minelayer.qc +++ b/qcsrc/server/w_minelayer.qc @@ -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");