]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/target/changelevel.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / target / changelevel.qc
index 6c006d42a91610e70cd3984bc076cdc61312885c..5540f936a7ee0229785e43f1473d32041289674c 100644 (file)
@@ -5,10 +5,9 @@
 
 void target_changelevel_use(entity this, entity actor, entity trigger)
 {
-       if(this.spawnflags & 2)
-       {
+       if (this.spawnflags & 2) {
                // simply don't react if a non-player triggers it
-               if(!IS_PLAYER(actor)) { return; }
+               if (!IS_PLAYER(actor)) { return; }
 
                actor.chlevel_targ = this;
 
@@ -17,26 +16,30 @@ void target_changelevel_use(entity this, entity actor, entity trigger)
                // let's not count bots
                FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
                        ++realplnum;
-                       if(it.chlevel_targ == this)
+                       if (it.chlevel_targ == this) {
                                ++plnum;
+                       }
                });
-               if(plnum < ceil(realplnum * min(1, this.count))) // 70% of players
+               if (plnum < ceil(realplnum * min(1, this.count))) { // 70% of players
                        return;
+               }
        }
 
-       if(this.gametype != "")
+       if (this.gametype != "") {
                MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype));
+       }
 
-       if (this.chmap == "")
+       if (this.chmap == "") {
                localcmd("endmatch\n");
-       else
+       } else {
                localcmd(strcat("changelevel ", this.chmap, "\n"));
+       }
 }
 
 spawnfunc(target_changelevel)
 {
        this.use = target_changelevel_use;
 
-       if(!this.count) { this.count = 0.7; }
+       if (!this.count) { this.count = 0.7; }
 }
 #endif