]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/vectormamamam.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / vectormamamam.qc
index 951a740a2024675371cd2e35412f8887adfe188e..78aecf15fe8a1972197ea40e217b2d744f6af1d1 100644 (file)
@@ -16,43 +16,43 @@ vector func_vectormamamam_origin(entity o, float t)
        v = '0 0 0';
 
        e = o.wp00;
-       if(e)
-       {
+       if (e) {
                p = e.origin + t * e.velocity;
-               if(f & 1)
+               if (f & 1) {
                        v = v + (p * o.targetnormal) * o.targetnormal * o.targetfactor;
-               else
+               } else {
                        v = v + (p - (p * o.targetnormal) * o.targetnormal) * o.targetfactor;
+               }
        }
 
        e = o.wp01;
-       if(e)
-       {
+       if (e) {
                p = e.origin + t * e.velocity;
-               if(f & 2)
+               if (f & 2) {
                        v = v + (p * o.target2normal) * o.target2normal * o.target2factor;
-               else
+               } else {
                        v = v + (p - (p * o.target2normal) * o.target2normal) * o.target2factor;
+               }
        }
 
        e = o.wp02;
-       if(e)
-       {
+       if (e) {
                p = e.origin + t * e.velocity;
-               if(f & 4)
+               if (f & 4) {
                        v = v + (p * o.target3normal) * o.target3normal * o.target3factor;
-               else
+               } else {
                        v = v + (p - (p * o.target3normal) * o.target3normal) * o.target3factor;
+               }
        }
 
        e = o.wp03;
-       if(e)
-       {
+       if (e) {
                p = e.origin + t * e.velocity;
-               if(f & 8)
+               if (f & 8) {
                        v = v + (p * o.target4normal) * o.target4normal * o.target4factor;
-               else
+               } else {
                        v = v + (p - (p * o.target4normal) * o.target4normal) * o.target4factor;
+               }
        }
 
        return v;
@@ -62,32 +62,37 @@ void func_vectormamamam_controller_think(entity this)
 {
        this.nextthink = time + 0.1;
 
-       if(this.owner.active != ACTIVE_ACTIVE)
-       {
+       if (this.owner.active != ACTIVE_ACTIVE) {
                this.owner.velocity = '0 0 0';
                return;
        }
 
-       if(this.owner.classname == "func_vectormamamam") // don't brake stuff if the func_vectormamamam was killtarget'ed
+       if (this.owner.classname == "func_vectormamamam") { // don't brake stuff if the func_vectormamamam was killtarget'ed
                this.owner.velocity = (this.owner.destvec + func_vectormamamam_origin(this.owner, 0.1) - this.owner.origin) * 10;
+       }
 }
 
 void func_vectormamamam_findtarget(entity this)
 {
-       if(this.target != "")
+       if (this.target != "") {
                this.wp00 = find(NULL, targetname, this.target);
+       }
 
-       if(this.target2 != "")
+       if (this.target2 != "") {
                this.wp01 = find(NULL, targetname, this.target2);
+       }
 
-       if(this.target3 != "")
+       if (this.target3 != "") {
                this.wp02 = find(NULL, targetname, this.target3);
+       }
 
-       if(this.target4 != "")
+       if (this.target4 != "") {
                this.wp03 = find(NULL, targetname, this.target4);
+       }
 
-       if(!this.wp00 && !this.wp01 && !this.wp02 && !this.wp03)
+       if (!this.wp00 && !this.wp01 && !this.wp02 && !this.wp03) {
                objerror(this, "No reference entity found, so there is nothing to move. Aborting.");
+       }
 
        this.destvec = this.origin - func_vectormamamam_origin(this, 0);
 
@@ -100,50 +105,62 @@ void func_vectormamamam_findtarget(entity this)
 
 spawnfunc(func_vectormamamam)
 {
-       if (this.noise != "")
-       {
+       if (this.noise != "") {
                precache_sound(this.noise);
                soundto(MSG_INIT, this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE);
        }
 
-       if(!this.targetfactor)
+       if (!this.targetfactor) {
                this.targetfactor = 1;
+       }
 
-       if(!this.target2factor)
+       if (!this.target2factor) {
                this.target2factor = 1;
+       }
 
-       if(!this.target3factor)
+       if (!this.target3factor) {
                this.target3factor = 1;
+       }
 
-       if(!this.target4factor)
+       if (!this.target4factor) {
                this.target4factor = 1;
+       }
 
-       if(this.targetnormal)
+       if (this.targetnormal) {
                this.targetnormal = normalize(this.targetnormal);
+       }
 
-       if(this.target2normal)
+       if (this.target2normal) {
                this.target2normal = normalize(this.target2normal);
+       }
 
-       if(this.target3normal)
+       if (this.target3normal) {
                this.target3normal = normalize(this.target3normal);
+       }
 
-       if(this.target4normal)
+       if (this.target4normal) {
                this.target4normal = normalize(this.target4normal);
+       }
 
        setblocked(this, generic_plat_blocked);
-       if(this.dmg && (this.message == ""))
+       if (this.dmg && (this.message == "")) {
                this.message = " was squished";
-    if(this.dmg && (this.message == ""))
+       }
+       if (this.dmg && (this.message == "")) {
                this.message2 = "was squished by";
-       if(this.dmg && (!this.dmgtime))
+       }
+       if (this.dmg && (!this.dmgtime)) {
                this.dmgtime = 0.25;
+       }
        this.dmgtime2 = time;
 
-       if(this.netname == "")
+       if (this.netname == "") {
                this.netname = "1 0 0 0 1";
+       }
 
-       if (!InitMovingBrushTrigger(this))
+       if (!InitMovingBrushTrigger(this)) {
                return;
+       }
 
        // wait for targets to spawn
        this.nextthink = this.ltime + 999999999;