2 // reusing some fields havocbots declared
3 .entity wp00, wp01, wp02, wp03;
5 .float targetfactor, target2factor, target3factor, target4factor;
6 .vector targetnormal, target2normal, target3normal, target4normal;
8 vector func_vectormamamam_origin(entity o, float t)
20 p = e.origin + t * e.velocity;
22 v = v + (p * o.targetnormal) * o.targetnormal * o.targetfactor;
24 v = v + (p - (p * o.targetnormal) * o.targetnormal) * o.targetfactor;
30 p = e.origin + t * e.velocity;
32 v = v + (p * o.target2normal) * o.target2normal * o.target2factor;
34 v = v + (p - (p * o.target2normal) * o.target2normal) * o.target2factor;
40 p = e.origin + t * e.velocity;
42 v = v + (p * o.target3normal) * o.target3normal * o.target3factor;
44 v = v + (p - (p * o.target3normal) * o.target3normal) * o.target3factor;
50 p = e.origin + t * e.velocity;
52 v = v + (p * o.target4normal) * o.target4normal * o.target4factor;
54 v = v + (p - (p * o.target4normal) * o.target4normal) * o.target4factor;
60 void func_vectormamamam_controller_think()
62 self.nextthink = time + 0.1;
64 if(self.owner.active != ACTIVE_ACTIVE)
66 self.owner.velocity = '0 0 0';
70 if(self.owner.classname == "func_vectormamamam") // don't brake stuff if the func_vectormamamam was killtarget'ed
71 self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
74 void func_vectormamamam_findtarget()
77 self.wp00 = find(world, targetname, self.target);
79 if(self.target2 != "")
80 self.wp01 = find(world, targetname, self.target2);
82 if(self.target3 != "")
83 self.wp02 = find(world, targetname, self.target3);
85 if(self.target4 != "")
86 self.wp03 = find(world, targetname, self.target4);
88 if(!self.wp00 && !self.wp01 && !self.wp02 && !self.wp03)
89 objerror("No reference entity found, so there is nothing to move. Aborting.");
91 self.destvec = self.origin - func_vectormamamam_origin(self, 0);
94 controller = new(func_vectormamamam_controller);
95 controller.owner = self;
96 controller.nextthink = time + 1;
97 controller.think = func_vectormamamam_controller_think;
100 spawnfunc(func_vectormamamam)
102 if (self.noise != "")
104 precache_sound(self.noise);
105 soundto(MSG_INIT, self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE);
108 if(!self.targetfactor)
109 self.targetfactor = 1;
111 if(!self.target2factor)
112 self.target2factor = 1;
114 if(!self.target3factor)
115 self.target3factor = 1;
117 if(!self.target4factor)
118 self.target4factor = 1;
120 if(vlen(self.targetnormal))
121 self.targetnormal = normalize(self.targetnormal);
123 if(vlen(self.target2normal))
124 self.target2normal = normalize(self.target2normal);
126 if(vlen(self.target3normal))
127 self.target3normal = normalize(self.target3normal);
129 if(vlen(self.target4normal))
130 self.target4normal = normalize(self.target4normal);
132 self.blocked = generic_plat_blocked;
133 if(self.dmg && (self.message == ""))
134 self.message = " was squished";
135 if(self.dmg && (self.message == ""))
136 self.message2 = "was squished by";
137 if(self.dmg && (!self.dmgtime))
139 self.dmgtime2 = time;
141 if(self.netname == "")
142 self.netname = "1 0 0 0 1";
144 if (!InitMovingBrushTrigger())
147 // wait for targets to spawn
148 self.SUB_NEXTTHINK = self.SUB_LTIME + 999999999;
149 self.SUB_THINK = SUB_NullThink; // for PushMove
151 // Savage: Reduce bandwith, critical on e.g. nexdm02
152 self.effects |= EF_LOWPRECISION;
154 self.active = ACTIVE_ACTIVE;
156 InitializeEntity(self, func_vectormamamam_findtarget, INITPRIO_FINDTARGET);