]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix player turret count increasing even if they're out of fuel
authorMario <mario.mario@y7mail.com>
Mon, 18 Mar 2013 14:57:55 +0000 (01:57 +1100)
committerMario <mario.mario@y7mail.com>
Mon, 18 Mar 2013 14:57:55 +0000 (01:57 +1100)
qcsrc/server/mutators/gamemode_towerdefense.qc

index fe2941b7862f4d70a93f445d22f6d27c8091b2b4..0d8238ab2203bd21b621d8e2b0b09cae6ea5902f 100644 (file)
@@ -258,6 +258,7 @@ float td_checkfuel(entity ent, string tur)
 void spawnturret(entity spawnedby, entity own, string turet, vector orig)
 {
        if not(IS_PLAYER(spawnedby)) { dprint("Warning: A non-player entity tried to spawn a turret\n"); return; }
+       if not(td_checkfuel(spawnedby, turet)) { return; }
                
        entity oldself;
        
@@ -275,12 +276,12 @@ void spawnturret(entity spawnedby, entity own, string turet, vector orig)
        
        switch(turet)
        {
-               case "plasma": if not(td_checkfuel(spawnedby, turet)) return; spawnfunc_turret_plasma(); break;
-               case "mlrs": if not(td_checkfuel(spawnedby, turet)) return; spawnfunc_turret_mlrs(); break;
-               case "walker": if not(td_checkfuel(spawnedby, turet)) return; spawnfunc_turret_walker(); break;
-               case "flac": if not(td_checkfuel(spawnedby, turet)) return; spawnfunc_turret_flac(); break;
-               case "towerbuff": if not(td_checkfuel(spawnedby, turet)) return; spawnfunc_turret_fusionreactor(); break;
-               case "barricade": if not(td_checkfuel(spawnedby, turet)) return; spawn_barricade(); break;
+               case "plasma": spawnfunc_turret_plasma(); break;
+               case "mlrs": spawnfunc_turret_mlrs(); break;
+               case "walker": spawnfunc_turret_walker(); break;
+               case "flac": spawnfunc_turret_flac(); break;
+               case "towerbuff": spawnfunc_turret_fusionreactor(); break;
+               case "barricade": spawn_barricade(); break;
                default: Send_Notification(NOTIF_ONE, spawnedby, MSG_INFO, INFO_TD_INVALID); remove(self); self = oldself; return;
        }