2 const vector TARBABY_MIN = '-16 -16 -24';
3 const vector TARBABY_MAX = '16 16 16';
6 float autocvar_g_monster_tarbaby;
7 float autocvar_g_monster_tarbaby_health;
8 float autocvar_g_monster_tarbaby_speed_walk;
9 float autocvar_g_monster_tarbaby_speed_run;
12 #define tarbaby_anim_walk 0
13 #define tarbaby_anim_run 1
14 #define tarbaby_anim_jump 2
15 #define tarbaby_anim_fly 3
16 #define tarbaby_anim_explode 4
20 self.think = tarbaby_think;
21 self.nextthink = time + 0.3;
23 monster_move(autocvar_g_monster_tarbaby_speed_run, autocvar_g_monster_tarbaby_speed_walk, 20, tarbaby_anim_run, tarbaby_anim_walk, tarbaby_anim_walk);
28 // dunno why this would be called when dead, but to be safe
33 if (vlen(self.velocity) > 200)
35 // make the monster die
36 self.event_damage(self, self, self.health + self.max_health, DEATH_TOUCHEXPLODE, self.origin, '0 0 0');
41 if (trace_dphitcontents)
43 if not(self.flags & FL_ONGROUND)
45 self.touch = MonsterTouch;
46 self.flags |= FL_ONGROUND;
47 self.movetype = MOVETYPE_WALK;
54 if not(self.flags & FL_ONGROUND)
56 self.frame = tarbaby_anim_jump;
57 // dunno why this would be called when dead, but to be safe
60 self.movetype = MOVETYPE_BOUNCE;
61 self.touch = Tar_JumpTouch;
62 makevectors (self.angles);
64 self.velocity = v_forward * 600 + '0 0 200';
65 self.velocity_z += random()*150;
66 if (self.flags & FL_ONGROUND)
67 self.flags -= FL_ONGROUND;
69 self.attack_finished_single = time + 0.5;
78 void tarbaby_blowup ()
80 float bigboom = 250 * (self.scale * 0.7);
81 RadiusDamage(self, self, 250 * monster_skill, 15, bigboom * (monster_skill * 0.7), world, 250, DEATH_MONSTER_TARBABY_BLOWUP, world);
82 pointparticles(particleeffectnum(((self.scale > 3) ? "explosion_big" : "explosion_medium")), self.origin, '0 0 0', 1);
83 sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
85 Monster_CheckDropCvars ("tarbaby"); // drop items after exploding to prevent player picking up item before dying
90 void tarbaby_explode()
94 monster_hook_death(); // calling this next frame should be ok...
99 self.solid = SOLID_NOT;
100 self.takedamage = DAMAGE_NO;
101 self.event_damage = func_null;
102 self.movetype = MOVETYPE_NONE;
104 self.think = tarbaby_explode;
105 self.nextthink = time + 0.1;
108 void tarbaby_spawn ()
111 self.health = autocvar_g_monster_tarbaby_health * self.scale;
113 self.damageforcescale = 0.003;
114 self.classname = "monster_tarbaby";
115 self.checkattack = GenericCheckAttack;
116 self.attack_ranged = tbaby_jump;
117 self.attack_melee = tarbaby_jump;
118 self.nextthink = time + random() * 0.5 + 0.1;
119 self.think = tarbaby_think;
120 self.sprite_height = 20 * self.scale;
121 self.frame = tarbaby_anim_walk;
123 monster_hook_spawn(); // for post-spawn mods
126 void spawnfunc_monster_tarbaby ()
128 if not(autocvar_g_monster_tarbaby)
134 self.monster_spawnfunc = spawnfunc_monster_tarbaby;
136 if(self.spawnflags & MONSTERFLAG_APPEAR)
138 self.think = func_null;
140 self.use = Monster_Appear;
146 if not (monster_initialize(
148 "models/monsters/tarbaby.mdl",
149 TARBABY_MIN, TARBABY_MAX,
151 tarbaby_die, tarbaby_spawn))
157 precache_sound ("weapons/rocket_impact.wav");
160 // compatibility with old spawns
161 void spawnfunc_monster_spawn () { spawnfunc_monster_tarbaby(); }