]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/conveyor.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / conveyor.qc
index 960ee2150d6e666f6434e392d5a0a6f3ad02c3b7..163e8b958dc9072c3d70a45da591a6c11a68f984 100644 (file)
@@ -7,7 +7,7 @@ void conveyor_think(entity this)
        // TODO: check if this is what is causing the glitchiness when switching between them
        float dt = time - this.move_time;
        this.move_time = time;
-       if(dt <= 0) { return; }
+       if (dt <= 0) { return; }
 #endif
 
        // set myself as current conveyor where possible
@@ -17,31 +17,30 @@ void conveyor_think(entity this)
                IL_REMOVE(g_conveyed, it);
        });
 
-       if(this.state)
-       {
+       if (this.state) {
                FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, !it.conveyor.state && isPushable(it),
                {
                        vector emin = it.absmin;
                        vector emax = it.absmax;
-                       if(this.solid == SOLID_BSP)
-                       {
+                       if (this.solid == SOLID_BSP) {
                                emin -= '1 1 1';
                                emax += '1 1 1';
                        }
-                       if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
-                               if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
-                               {
-                                       if(!it.conveyor)
+                       if (boxesoverlap(emin, emax, this.absmin, this.absmax)) { // quick
+                               if (WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) { // accurate
+                                       if (!it.conveyor) {
                                                IL_PUSH(g_conveyed, it);
+                                       }
                                        it.conveyor = this;
                                }
+                       }
                });
 
                IL_EACH(g_conveyed, it.conveyor == this,
                {
-                       if(IS_CLIENT(it)) // doing it via velocity has quite some advantages
+                       if (IS_CLIENT(it)) { // doing it via velocity has quite some advantages
                                continue; // done in SV_PlayerPhysics   continue;
-
+                       }
                        setorigin(it, it.origin + this.movedir * PHYS_INPUT_FRAMETIME);
                        move_out_of_solid(it);
 #ifdef SVQC
@@ -51,7 +50,7 @@ void conveyor_think(entity this)
                        // stupid conveyor code
                        tracebox(it.origin, it.mins, it.maxs, it.origin + this.movedir * sys_frametime, MOVE_NORMAL, it);
                        if(trace_fraction > 0)
-                               setorigin(it, trace_endpos);
+                           setorigin(it, trace_endpos);
                        */
                });
        }
@@ -82,8 +81,7 @@ bool conveyor_send(entity this, entity to, int sf)
        WriteHeader(MSG_ENTITY, ENT_CLIENT_CONVEYOR);
        WriteByte(MSG_ENTITY, sf);
 
-       if(sf & 1)
-       {
+       if (sf & 1) {
                WriteByte(MSG_ENTITY, this.warpzone_isboxy);
                WriteCoord(MSG_ENTITY, this.origin_x);
                WriteCoord(MSG_ENTITY, this.origin_y);
@@ -107,26 +105,26 @@ bool conveyor_send(entity this, entity to, int sf)
                WriteString(MSG_ENTITY, this.target);
        }
 
-       if(sf & 2)
+       if (sf & 2) {
                WriteByte(MSG_ENTITY, this.state);
+       }
 
        return true;
 }
 
 void conveyor_init(entity this)
 {
-       if (!this.speed) this.speed = 200;
+       if (!this.speed) { this.speed = 200; }
        this.movedir *= this.speed;
        setthink(this, conveyor_think);
        this.nextthink = time;
-       if(THIS_TARGETED)
-       {
+       if (THIS_TARGETED) {
                this.use = conveyor_use;
                this.reset = conveyor_reset;
                this.reset(this);
-       }
-       else
+       } else {
                this.state = 1;
+       }
 
        FixSize(this);
 
@@ -156,8 +154,9 @@ void conveyor_draw(entity this) { conveyor_think(this); }
 
 void conveyor_init(entity this, bool isnew)
 {
-       if(isnew)
+       if (isnew) {
                IL_PUSH(g_drawables, this);
+       }
        this.draw = conveyor_draw;
        this.drawmask = MASK_NORMAL;
 
@@ -171,8 +170,7 @@ NET_HANDLE(ENT_CLIENT_CONVEYOR, bool isnew)
 {
        int sf = ReadByte();
 
-       if(sf & 1)
-       {
+       if (sf & 1) {
                this.warpzone_isboxy = ReadByte();
                this.origin_x = ReadCoord();
                this.origin_y = ReadCoord();
@@ -200,8 +198,9 @@ NET_HANDLE(ENT_CLIENT_CONVEYOR, bool isnew)
                conveyor_init(this, isnew);
        }
 
-       if(sf & 2)
+       if (sf & 2) {
                this.state = ReadByte();
+       }
 
        return true;
 }