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