3 void func_bobbing_controller_think()
6 self.nextthink = time + 0.1;
8 if(self.owner.active != ACTIVE_ACTIVE)
10 self.owner.velocity = '0 0 0';
14 // calculate sinewave using makevectors
15 makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
16 v = self.owner.destvec + self.owner.movedir * v_forward_y;
17 if(self.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed
18 // * 10 so it will arrive in 0.1 sec
19 self.owner.velocity = (v - self.owner.origin) * 10;
22 /*QUAKED spawnfunc_func_bobbing (0 .5 .8) ? X_AXIS Y_AXIS
23 Brush model that moves back and forth on one axis (default Z).
24 speed : how long one cycle takes in seconds (default 4)
25 height : how far the cycle moves (default 32)
26 phase : cycle timing adjustment (0-1 as a fraction of the cycle, default 0)
27 noise : path/name of looping .wav file to play.
28 dmg : Do this mutch dmg every .dmgtime intervall when blocked
31 void spawnfunc_func_bobbing()
36 precache_sound(self.noise);
37 soundto(MSG_INIT, self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE);
43 // center of bobbing motion
44 self.destvec = self.origin;
45 // time scale to get degrees
46 self.cnt = 360 / self.speed;
48 self.active = ACTIVE_ACTIVE;
50 // damage when blocked
51 self.blocked = generic_plat_blocked;
52 if(self.dmg && (self.message == ""))
53 self.message = " was squished";
54 if(self.dmg && (self.message2 == ""))
55 self.message2 = "was squished by";
56 if(self.dmg && (!self.dmgtime))
61 if (self.spawnflags & 1) // X
62 self.movedir = '1 0 0' * self.height;
63 else if (self.spawnflags & 2) // Y
64 self.movedir = '0 1 0' * self.height;
66 self.movedir = '0 0 1' * self.height;
68 if (!InitMovingBrushTrigger())
71 // wait for targets to spawn
73 controller.classname = "func_bobbing_controller";
74 controller.owner = self;
75 controller.nextthink = time + 1;
76 controller.think = func_bobbing_controller_think;
77 self.nextthink = self.ltime + 999999999;
78 self.think = SUB_NullThink; // for PushMove
80 // Savage: Reduce bandwith, critical on e.g. nexdm02
81 self.effects |= EF_LOWPRECISION;
83 // TODO make a reset function for this one