]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/monsters/monster/stingray.qc
61dccfbd6af3f80e4231cd7fead87b006a2170ba
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / monsters / monster / stingray.qc
1 const vector STINGRAY_MIN = '-20 -20 -31';
2 const vector STINGRAY_MAX = '20 20 20';
3
4 string STINGRAY_MODEL = "models/monsters/fish.mdl";
5
6 #ifdef SVQC
7 float autocvar_g_monster_stingray;
8 float autocvar_g_monster_stingray_health;
9 float autocvar_g_monster_stingray_damage;
10 float autocvar_g_monster_stingray_speed_walk;
11 float autocvar_g_monster_stingray_speed_run;
12
13 const float stingray_anim_attack = 0;
14 const float stingray_anim_death  = 1;
15 const float stingray_anim_swim   = 2;
16 const float stingray_anim_pain   = 3;
17
18 void stingray_think()
19 {
20         self.think = stingray_think;
21         self.nextthink = time + self.ticrate;
22         
23         monster_move(autocvar_g_monster_stingray_speed_run, autocvar_g_monster_stingray_speed_walk, 10, stingray_anim_swim, stingray_anim_swim, stingray_anim_swim);
24 }
25
26 float stingray_attack(float attack_type)
27 {
28         switch(attack_type)
29         {
30                 case MONSTER_ATTACK_MELEE:
31                 {
32                         monsters_setframe(stingray_anim_attack);
33                         self.attack_finished_single = time + 0.5;
34                         monster_melee(self.enemy, autocvar_g_monster_stingray_damage, 0.1, DEATH_MONSTER_STINGRAY, FALSE);
35                         
36                         return TRUE;
37                 }
38                 case MONSTER_ATTACK_RANGED:
39         }
40         
41         return FALSE;
42 }
43
44 void stingray_die()
45 {
46         Monster_CheckDropCvars ("stingray");
47         
48         self.think = monster_dead_think;
49         self.nextthink = time + self.ticrate;
50         self.ltime = time + 5;
51         monsters_setframe(stingray_anim_death);
52         
53         monster_hook_death(); // for post-death mods
54 }
55
56 void stingray_spawn()
57 {
58         if not(self.health)
59                 self.health = autocvar_g_monster_stingray_health;
60
61         self.damageforcescale   = 0.5;
62         self.classname                  = "monster_stingray";
63         self.monster_attackfunc = stingray_attack;
64         self.flags                         |= FL_SWIM;
65         self.nextthink                  = time + random() * 0.5 + 0.1;
66         self.think                              = stingray_think;
67         
68         monster_setupsounds("stingray");
69         
70         monster_hook_spawn(); // for post-spawn mods
71 }
72
73 void spawnfunc_monster_stingray()
74 {
75         if not(autocvar_g_monster_stingray) { remove(self); return; }
76         
77         self.monster_spawnfunc = spawnfunc_monster_stingray;
78         
79         if(Monster_CheckAppearFlags(self))
80                 return;
81         
82         self.scale = 1.3;
83         
84         if not (monster_initialize(
85                          "Stingray", MONSTER_STINGRAY,
86                          STINGRAY_MIN, STINGRAY_MAX,
87                          TRUE,
88                          stingray_die, stingray_spawn))
89         {
90                 remove(self);
91                 return;
92         }
93 }
94
95 #endif // SVQC