-
-
-//////////////////////////////////////////////
-// Testting //
-// Everything below this point is a mess :D //
-//////////////////////////////////////////////
-//#define TLIBS_TETSLIBS
-#ifdef TLIBS_TETSLIBS
-void flocker_die()
-{SELFPARAM();
- Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
-
- self.owner.cnt += 1;
- self.owner = world;
-
- self.nextthink = time;
- self.think = SUB_Remove;
-}
-
-
-void flocker_think()
-{SELFPARAM();
- vector dodgemove,swarmmove;
- vector reprellmove,wandermove,newmove;
-
- self.angles_x = self.angles.x * -1;
- makevectors(self.angles);
- self.angles_x = self.angles.x * -1;
-
- dodgemove = steerlib_traceavoid(0.35,1000);
- swarmmove = steerlib_flock(500,75,700,500);
- reprellmove = steerlib_repell(self.owner.enemy.origin+self.enemy.velocity,2000) * 700;
-
- if(vlen(dodgemove) == 0)
- {
- self.pos1 = steerlib_wander(0.5,0.1,self.pos1);
- wandermove = self.pos1 * 50;
- }
- else
- self.pos1 = normalize(self.velocity);
-
- dodgemove = dodgemove * vlen(self.velocity) * 5;
-
- newmove = swarmmove + reprellmove + wandermove + dodgemove;
- self.velocity = movelib_inertmove_byspeed(newmove,300,0.2,0.9);
- //self.velocity = movelib_inertmove(dodgemove,0.65);
-
- self.velocity = movelib_dragvec(0.01,0.6);
-
- self.angles = vectoangles(self.velocity);
-
- if(self.health <= 0)
- flocker_die();
- else
- self.nextthink = time + 0.1;
-}
-
-MODEL(FLOCKER, "models/turrets/rocket.md3");
-
-void spawn_flocker()
-{SELFPARAM();
- entity flocker = new(flocker);
-
- setorigin(flocker, self.origin + '0 0 32');
- setmodel (flocker, MDL_FLOCKER);
- setsize (flocker, '-3 -3 -3', '3 3 3');
-
- flocker.flock_id = self.flock_id;
- flocker.owner = self;
- flocker.think = flocker_think;
- flocker.nextthink = time + random() * 5;
- PROJECTILE_MAKETRIGGER(flocker);
- flocker.movetype = MOVETYPE_BOUNCEMISSILE;
- flocker.effects = EF_LOWPRECISION;
- flocker.velocity = randomvec() * 300;
- flocker.angles = vectoangles(flocker.velocity);
- flocker.health = 10;
- flocker.pos1 = normalize(flocker.velocity + randomvec() * 0.1);
-
- self.cnt = self.cnt -1;
-
-}
-
-void flockerspawn_think()
-{SELFPARAM();
-
-
- if(self.cnt > 0)
- spawn_flocker();
-
- self.nextthink = time + self.delay;
-
-}
-
-void flocker_hunter_think()
-{SELFPARAM();
- vector dodgemove,attractmove,newmove;
- entity e,ee;
- float d,bd;
-
- self.angles_x = self.angles.x * -1;
- makevectors(self.angles);
- self.angles_x = self.angles.x * -1;
-
- if(self.enemy)
- if(vlen(self.enemy.origin - self.origin) < 64)
- {
- ee = self.enemy;
- ee.health = -1;
- self.enemy = world;
-
- }
-
- if(!self.enemy)
- {
- e = findchainfloat(flock_id,self.flock_id);
- while(e)
- {
- d = vlen(self.origin - e.origin);
-
- if(e != self.owner)
- if(e != ee)
- if(d > bd)
- {
- self.enemy = e;
- bd = d;
- }
- e = e.chain;
- }
- }
-
- if(self.enemy)
- attractmove = steerlib_attract(self.enemy.origin+self.enemy.velocity * 0.1,5000) * 1250;
- else
- attractmove = normalize(self.velocity) * 200;
-
- dodgemove = steerlib_traceavoid(0.35,1500) * vlen(self.velocity);
-
- newmove = dodgemove + attractmove;
- self.velocity = movelib_inertmove_byspeed(newmove,1250,0.3,0.7);
- self.velocity = movelib_dragvec(0.01,0.5);
-
-
- self.angles = vectoangles(self.velocity);
- self.nextthink = time + 0.1;
-}
-
-
-float globflockcnt;
-spawnfunc(flockerspawn)
-{SELFPARAM();
- ++globflockcnt;
-
- if(!self.cnt) self.cnt = 20;
- if(!self.delay) self.delay = 0.25;
- if(!self.flock_id) self.flock_id = globflockcnt;
-
- self.think = flockerspawn_think;
- self.nextthink = time + 0.25;
-
- self.enemy = new(FLock Hunter);
-
- setmodel(self.enemy, MDL_FLOCKER);
- setorigin(self.enemy,self.origin + '0 0 768' + (randomvec() * 128));
-
- self.enemy.scale = 3;
- self.enemy.effects = EF_LOWPRECISION;
- self.enemy.movetype = MOVETYPE_BOUNCEMISSILE;
- PROJECTILE_MAKETRIGGER(self.enemy);
- self.enemy.think = flocker_hunter_think;
- self.enemy.nextthink = time + 10;
- self.enemy.flock_id = self.flock_id;
- self.enemy.owner = self;
-}
-#endif
-
-
-