]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/monsters/monster/tarbaby.qc
Lower ogre grenade refire rate
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / monsters / monster / tarbaby.qc
1 // size
2 const vector TARBABY_MIN = '-16 -16 -24';
3 const vector TARBABY_MAX = '16 16 16';
4
5 // model
6 string TARBABY_MODEL = "models/monsters/slime.dpm";
7
8 #ifdef SVQC
9 // cvars
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;
14
15 // animations
16 const float tarbaby_anim_walk           = 0;
17 const float tarbaby_anim_idle           = 1;
18 const float tarbaby_anim_jump           = 2;
19 const float tarbaby_anim_fly            = 3;
20 const float tarbaby_anim_die            = 4;
21 const float tarbaby_anim_pain           = 5;
22
23 void tarbaby_think ()
24 {
25         self.think = tarbaby_think;
26         self.nextthink = time + self.ticrate;
27         
28         monster_move(autocvar_g_monster_tarbaby_speed_run, autocvar_g_monster_tarbaby_speed_walk, 20, tarbaby_anim_walk, tarbaby_anim_walk, tarbaby_anim_idle);
29 }
30
31 void Tar_JumpTouch ()
32 {
33         if(self.health > 0)
34         if(other.health > 0)
35         if(other.takedamage)
36         if(vlen(self.velocity) > 200)
37         {
38                 // make the monster die
39                 self.event_damage(self, self, self.health + self.max_health + 200, DEATH_MONSTER_TARBABY, self.origin, '0 0 0');
40                         
41                 return;
42         }
43
44         if (trace_dphitcontents)
45         {
46                 self.touch = MonsterTouch;
47                 self.movetype = MOVETYPE_WALK;
48         }
49 }
50
51 void tarbaby_jump ()
52 {
53         self.movetype = MOVETYPE_BOUNCE;
54         makevectors(self.angles);
55         monster_leap(tarbaby_anim_jump, Tar_JumpTouch, v_forward * 600 + '0 0 200', 0.5);
56 }
57
58 float tbaby_jump ()
59 {
60         tarbaby_jump();
61         return TRUE;
62 }
63
64 void tarbaby_blowup ()
65 {
66         RadiusDamage(self, self, 250 * monster_skill, 15, 250 * (monster_skill * 0.7), world, 250, DEATH_MONSTER_TARBABY, world);
67         pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
68         sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
69         
70         Monster_CheckDropCvars ("tarbaby"); // drop items after exploding to prevent player picking up item before dying
71         
72         setmodel(self, "");
73 }
74
75 void tarbaby_explode()
76 {
77         tarbaby_blowup();
78         
79         self.think = Monster_Fade;
80         self.nextthink = time + 0.1;
81         
82         monster_hook_death();
83         
84         self.event_damage = func_null; // reset by monster_hook_death
85         self.takedamage = DAMAGE_NO;
86 }
87
88 void tarbaby_die ()
89 {
90         self.think                      = tarbaby_explode;
91         self.nextthink          = time + 0.1;
92         self.event_damage   = func_null;
93         self.movetype           = MOVETYPE_NONE;
94         self.enemy                      = world;
95         self.health                     = 0;
96         
97         WaypointSprite_Kill(self.sprite);
98         
99         self.SendFlags |= MSF_MOVE | MSF_STATUS;
100 }
101
102 void tarbaby_spawn ()
103 {
104         if not(self.health)
105                 self.health = autocvar_g_monster_tarbaby_health;
106         
107         self.damageforcescale   = 0.003;
108         self.classname                  = "monster_tarbaby";
109         self.checkattack                = GenericCheckAttack;
110         self.attack_ranged              = tbaby_jump;
111         self.attack_melee               = tarbaby_jump;
112         self.nextthink                  = time + random() * 0.5 + 0.1;
113         self.think                              = tarbaby_think;
114         
115         monsters_setframe(tarbaby_anim_idle);
116         
117         monster_setupsounds("tarbaby");
118         
119         monster_hook_spawn(); // for post-spawn mods
120 }
121
122 void spawnfunc_monster_tarbaby ()
123 {       
124         if not(autocvar_g_monster_tarbaby) { remove(self); return; }
125         
126         self.monster_spawnfunc = spawnfunc_monster_tarbaby;
127         
128         if(Monster_CheckAppearFlags(self))
129                 return;
130         
131         if not (monster_initialize(
132                          "Slime", MONSTER_TARBABY,
133                          TARBABY_MIN, TARBABY_MAX,
134                          FALSE,
135                          tarbaby_die, tarbaby_spawn))
136         {
137                 remove(self);
138                 return;
139         }
140 }
141
142 #endif // SVQC