]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/pendulum.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / pendulum.qc
index a59f7a93baf6a6427dc8b7813e020ec50e39ae54..8b8d13e6e6716534e4951d89c2eeb8979dddf2fe 100644 (file)
@@ -6,8 +6,7 @@ void func_pendulum_controller_think(entity this)
        float v;
        this.nextthink = time + 0.1;
 
-       if (!(this.owner.active == ACTIVE_ACTIVE))
-       {
+       if (!(this.owner.active == ACTIVE_ACTIVE)) {
                this.owner.avelocity_x = 0;
                return;
        }
@@ -15,8 +14,7 @@ void func_pendulum_controller_think(entity this)
        // calculate sinewave using makevectors
        makevectors((this.nextthink * this.owner.freq + this.owner.phase) * '0 360 0');
        v = this.owner.speed * v_forward_y + this.cnt;
-       if(this.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed
-       {
+       if (this.owner.classname == "func_pendulum") { // don't brake stuff if the func_bobbing was killtarget'ed
                // * 10 so it will arrive in 0.1 sec
                this.owner.avelocity_z = (remainder(v - this.owner.angles_z, 360)) * 10;
        }
@@ -25,8 +23,7 @@ void func_pendulum_controller_think(entity this)
 spawnfunc(func_pendulum)
 {
        entity controller;
-       if (this.noise != "")
-       {
+       if (this.noise != "") {
                precache_sound(this.noise);
                soundto(MSG_INIT, this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE);
        }
@@ -35,26 +32,30 @@ spawnfunc(func_pendulum)
 
        // keys: angle, speed, phase, noise, freq
 
-       if(!this.speed)
+       if (!this.speed) {
                this.speed = 30;
+       }
        // not initializing this.dmg to 2, to allow damageless pendulum
 
-       if(this.dmg && (this.message == ""))
+       if (this.dmg && (this.message == "")) {
                this.message = " was squished";
-       if(this.dmg && (this.message2 == ""))
+       }
+       if (this.dmg && (this.message2 == "")) {
                this.message2 = "was squished by";
-       if(this.dmg && (!this.dmgtime))
+       }
+       if (this.dmg && (!this.dmgtime)) {
                this.dmgtime = 0.25;
+       }
        this.dmgtime2 = time;
 
        setblocked(this, generic_plat_blocked);
 
        this.avelocity_z = 0.0000001;
-       if (!InitMovingBrushTrigger(this))
+       if (!InitMovingBrushTrigger(this)) {
                return;
+       }
 
-       if(!this.freq)
-       {
+       if (!this.freq) {
                // find pendulum length (same formula as Q3A)
                this.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(this.mins_z))));
        }
@@ -70,7 +71,7 @@ spawnfunc(func_pendulum)
        this.nextthink = this.ltime + 999999999;
        setthink(this, SUB_NullThink); // for PushMove
 
-       //this.effects |= EF_LOWPRECISION;
+       // this.effects |= EF_LOWPRECISION;
 
        // TODO make a reset function for this one
 }