4 void func_rotating_setactive(entity this, int astate)
6 if (astate == ACTIVE_TOGGLE)
8 if(this.active == ACTIVE_ACTIVE)
9 this.active = ACTIVE_NOT;
11 this.active = ACTIVE_ACTIVE;
16 if(this.active == ACTIVE_NOT)
18 this.avelocity = '0 0 0';
19 stopsound(this, CH_AMBIENT_SINGLE);
23 this.avelocity = this.pos1;
24 if(this.noise && this.noise != "")
26 _sound(this, CH_AMBIENT_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE);
31 void func_rotating_reset(entity this)
33 // TODO: reset angles as well?
35 if(this.spawnflags & FUNC_ROTATING_STARTOFF)
37 this.setactive(this, ACTIVE_NOT);
41 this.setactive(this, ACTIVE_ACTIVE);
45 void func_rotating_init_for_player(entity this, entity player)
47 if (this.noise && this.noise != "" && this.active == ACTIVE_ACTIVE && IS_REAL_CLIENT(player))
50 soundto (MSG_ONE, this, CH_AMBIENT_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE, 0);
54 /*QUAKED spawnfunc_func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
55 Brush model that spins in place on one axis (default Z).
56 speed : speed to rotate (in degrees per second)
57 noise : path/name of looping .wav file to play.
58 dmg : Do this much damage every .dmgtime interval when blocked
62 spawnfunc(func_rotating)
64 if (this.noise && this.noise != "")
66 precache_sound(this.noise);
69 this.setactive = func_rotating_setactive;
73 if (this.spawnflags & FUNC_ROTATING_XAXIS)
74 this.avelocity = '0 0 1' * this.speed;
75 else if (this.spawnflags & FUNC_ROTATING_YAXIS)
76 this.avelocity = '1 0 0' * this.speed;
78 this.avelocity = '0 1 0' * this.speed;
80 this.pos1 = this.avelocity;
82 if(this.dmg && (this.message == ""))
83 this.message = _(" was squished");
84 if(this.dmg && (this.message2 == ""))
85 this.message2 = _("was squished by");
88 if(this.dmg && (!this.dmgtime))
93 if (!InitMovingBrushTrigger(this))
95 // no EF_LOWPRECISION here, as rounding angles is bad
97 setblocked(this, generic_plat_blocked);
99 // wait for targets to spawn
100 this.nextthink = this.ltime + 999999999;
101 setthink(this, SUB_NullThink); // for PushMove
103 this.reset = func_rotating_reset;
106 // maybe send sound to new players
107 IL_PUSH(g_initforplayer, this);
108 this.init_for_player = func_rotating_init_for_player;