3 const vector TARBABY_MIN = '-16 -16 -24';
4 const vector TARBABY_MAX = '16 16 16';
7 string TARBABY_MODEL = "models/monsters/tarbaby.mdl";
13 float autocvar_g_monster_tarbaby;
14 float autocvar_g_monster_tarbaby_health;
15 float autocvar_g_monster_tarbaby_speed_walk;
16 float autocvar_g_monster_tarbaby_speed_run;
19 const float tarbaby_anim_walk = 0;
20 const float tarbaby_anim_run = 1;
21 const float tarbaby_anim_jump = 2;
22 const float tarbaby_anim_fly = 3;
23 const float tarbaby_anim_explode = 4;
27 self.think = tarbaby_think;
28 self.nextthink = time + self.ticrate;
30 monster_move(autocvar_g_monster_tarbaby_speed_run, autocvar_g_monster_tarbaby_speed_walk, 20, tarbaby_anim_run, tarbaby_anim_walk, tarbaby_anim_walk);
38 if(vlen(self.velocity) > 200)
40 // make the monster die
41 self.event_damage(self, self, self.health + self.max_health + 200, DEATH_MONSTER_TARBABY, self.origin, '0 0 0');
46 if (trace_dphitcontents)
48 if not(self.flags & FL_ONGROUND)
50 self.touch = MonsterTouch;
51 self.flags |= FL_ONGROUND;
52 self.movetype = MOVETYPE_WALK;
59 if not(self.flags & FL_ONGROUND)
61 monsters_setframe(tarbaby_anim_jump);
62 self.movetype = MOVETYPE_BOUNCE;
63 self.touch = Tar_JumpTouch;
64 makevectors (self.angles);
66 self.velocity = v_forward * 600 + '0 0 200';
67 self.velocity_z += random()*150;
68 if (self.flags & FL_ONGROUND)
69 self.flags -= FL_ONGROUND;
71 self.attack_finished_single = time + 0.5;
80 void tarbaby_blowup ()
82 float bigboom = 250 * (self.scale * 0.7);
83 RadiusDamage(self, self, 250 * monster_skill, 15, bigboom * (monster_skill * 0.7), world, 250, DEATH_MONSTER_TARBABY, world);
84 pointparticles(particleeffectnum(((self.scale > 3) ? "explosion_big" : "explosion_medium")), self.origin, '0 0 0', 1);
85 sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
87 Monster_CheckDropCvars ("tarbaby"); // drop items after exploding to prevent player picking up item before dying
92 void tarbaby_explode()
96 self.think = Monster_Fade;
97 self.nextthink = time + 0.1;
99 monster_hook_death(); // calling this next frame should be ok...
104 self.think = tarbaby_explode;
105 self.nextthink = time + 0.1;
106 self.event_damage = func_null;
107 self.movetype = MOVETYPE_NONE;
111 WaypointSprite_Kill(self.sprite);
113 self.SendFlags |= MSF_MOVE | MSF_STATUS;
116 void tarbaby_spawn ()
119 self.health = autocvar_g_monster_tarbaby_health * self.scale;
121 self.damageforcescale = 0.003;
122 self.classname = "monster_tarbaby";
123 self.checkattack = GenericCheckAttack;
124 self.attack_ranged = tbaby_jump;
125 self.attack_melee = tarbaby_jump;
126 self.nextthink = time + random() * 0.5 + 0.1;
127 self.think = tarbaby_think;
128 self.sprite_height = 20;
130 monsters_setframe(tarbaby_anim_walk);
132 monster_hook_spawn(); // for post-spawn mods
135 void spawnfunc_monster_tarbaby ()
137 if not(autocvar_g_monster_tarbaby) { remove(self); return; }
139 self.monster_spawnfunc = spawnfunc_monster_tarbaby;
141 if(Monster_CheckAppearFlags(self))
146 if not (monster_initialize(
147 "Spawn", MONSTER_TARBABY,
148 TARBABY_MIN, TARBABY_MAX,
150 tarbaby_die, tarbaby_spawn))
156 precache_sound ("weapons/rocket_impact.wav");
159 // compatibility with old spawns
160 void spawnfunc_monster_spawn () { spawnfunc_monster_tarbaby(); }