2 const vector TARBABY_MIN = '-16 -16 -24';
3 const vector TARBABY_MAX = '16 16 16';
6 string TARBABY_MODEL = "models/monsters/tarbaby.mdl";
10 float autocvar_g_monster_tarbaby;
11 float autocvar_g_monster_tarbaby_health;
12 float autocvar_g_monster_tarbaby_speed_walk;
13 float autocvar_g_monster_tarbaby_speed_run;
16 const float tarbaby_anim_walk = 0;
17 const float tarbaby_anim_run = 1;
18 const float tarbaby_anim_jump = 2;
19 const float tarbaby_anim_fly = 3;
20 const float tarbaby_anim_explode = 4;
24 self.think = tarbaby_think;
25 self.nextthink = time + self.ticrate;
27 monster_move(autocvar_g_monster_tarbaby_speed_run, autocvar_g_monster_tarbaby_speed_walk, 20, tarbaby_anim_run, tarbaby_anim_walk, tarbaby_anim_walk);
35 if(vlen(self.velocity) > 200)
37 // make the monster die
38 self.event_damage(self, self, self.health + self.max_health + 200, DEATH_MONSTER_TARBABY, self.origin, '0 0 0');
43 if (trace_dphitcontents)
45 self.touch = MonsterTouch;
46 self.movetype = MOVETYPE_WALK;
52 self.movetype = MOVETYPE_BOUNCE;
53 makevectors(self.angles);
54 monster_leap(tarbaby_anim_jump, Tar_JumpTouch, v_forward * 600 + '0 0 200', 0.5);
63 void tarbaby_blowup ()
65 float bigboom = 250 * (self.scale * 0.7);
66 RadiusDamage(self, self, 250 * monster_skill, 15, bigboom * (monster_skill * 0.7), world, 250, DEATH_MONSTER_TARBABY, world);
67 pointparticles(particleeffectnum(((self.scale > 3) ? "explosion_big" : "explosion_medium")), self.origin, '0 0 0', 1);
68 sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
70 Monster_CheckDropCvars ("tarbaby"); // drop items after exploding to prevent player picking up item before dying
75 void tarbaby_explode()
79 self.think = Monster_Fade;
80 self.nextthink = time + 0.1;
82 monster_hook_death(); // calling this next frame should be ok...
87 self.think = tarbaby_explode;
88 self.nextthink = time + 0.1;
89 self.event_damage = func_null;
90 self.movetype = MOVETYPE_NONE;
94 WaypointSprite_Kill(self.sprite);
96 self.SendFlags |= MSF_MOVE | MSF_STATUS;
102 self.health = autocvar_g_monster_tarbaby_health * self.scale;
104 self.damageforcescale = 0.003;
105 self.classname = "monster_tarbaby";
106 self.checkattack = GenericCheckAttack;
107 self.attack_ranged = tbaby_jump;
108 self.attack_melee = tarbaby_jump;
109 self.nextthink = time + random() * 0.5 + 0.1;
110 self.think = tarbaby_think;
112 monsters_setframe(tarbaby_anim_walk);
114 monster_setupsounds("tarbaby");
116 monster_hook_spawn(); // for post-spawn mods
119 void spawnfunc_monster_tarbaby ()
121 if not(autocvar_g_monster_tarbaby) { remove(self); return; }
123 self.monster_spawnfunc = spawnfunc_monster_tarbaby;
125 if(Monster_CheckAppearFlags(self))
130 if not (monster_initialize(
131 "Spawn", MONSTER_TARBABY,
132 TARBABY_MIN, TARBABY_MAX,
134 tarbaby_die, tarbaby_spawn))
141 // compatibility with old spawns
142 void spawnfunc_monster_spawn () { spawnfunc_monster_tarbaby(); }