]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monster/stingray.qc
3c12e684e3cacd2ddccb480d3e251da2d5bdd73a
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / stingray.qc
1 #ifdef REGISTER_MONSTER
2 REGISTER_MONSTER(
3 /* MON_##id   */ STINGRAY,
4 /* function   */ m_stingray,
5 /* mins,maxs  */ '-20 -20 -31', '20 20 20',
6 /* model      */ "fish.mdl",
7 /* netname    */ "stingray",
8 /* fullname   */ _("Stingray")
9 );
10
11 #else
12 #ifdef SVQC
13 float autocvar_g_monster_stingray;
14 float autocvar_g_monster_stingray_health;
15 float autocvar_g_monster_stingray_damage;
16 float autocvar_g_monster_stingray_speed_walk;
17 float autocvar_g_monster_stingray_speed_run;
18
19 const float stingray_anim_attack = 0;
20 const float stingray_anim_death  = 1;
21 const float stingray_anim_swim   = 2;
22 const float stingray_anim_pain   = 3;
23
24 float stingray_attack(float attack_type)
25 {
26         switch(attack_type)
27         {
28                 case MONSTER_ATTACK_MELEE:
29                 {
30                         monsters_setframe(stingray_anim_attack);
31                         self.attack_finished_single = time + 0.5;
32                         monster_melee(self.enemy, autocvar_g_monster_stingray_damage, 0.1, DEATH_MONSTER_STINGRAY, FALSE);
33                         
34                         return TRUE;
35                 }
36                 case MONSTER_ATTACK_RANGED:
37         }
38         
39         return FALSE;
40 }
41
42 void spawnfunc_monster_stingray()
43 {
44         if not(autocvar_g_monster_stingray) { remove(self); return; }
45         
46         self.classname = "monster_stingray";
47         
48         self.monster_spawnfunc = spawnfunc_monster_stingray;
49         
50         if(Monster_CheckAppearFlags(self))
51                 return;
52         
53         if not(monster_initialize(MON_STINGRAY, TRUE, MONSTER_TYPE_SWIM | MONSTER_SIZE_BROKEN)) { remove(self); return; }
54 }
55
56 float m_stingray(float req)
57 {
58         switch(req)
59         {
60                 case MR_THINK:
61                 {
62                         monster_move(autocvar_g_monster_stingray_speed_run, autocvar_g_monster_stingray_speed_walk, 10, stingray_anim_swim, stingray_anim_swim, stingray_anim_swim);
63                         return TRUE;
64                 }
65                 case MR_DEATH:
66                 {
67                         monsters_setframe(stingray_anim_death);
68                         return TRUE;
69                 }
70                 case MR_SETUP:
71                 {
72                         if not(self.health) self.health = autocvar_g_monster_stingray_health;
73                                 
74                         self.monster_attackfunc = stingray_attack;
75                         monsters_setframe(stingray_anim_swim);
76                         
77                         return TRUE;
78                 }
79                 case MR_INIT:
80                 {
81                         // nothing
82                         return TRUE;
83                 }
84         }
85         
86         return TRUE;
87 }
88
89 #endif // SVQC
90 #ifdef CSQC
91 float m_stingray(float req)
92 {
93         switch(req)
94         {
95                 case MR_DEATH:
96                 {
97                         // nothing
98                         return TRUE;
99                 }
100                 case MR_INIT:
101                 {
102                         precache_model ("models/monsters/fish.mdl");
103                         return TRUE;
104                 }
105         }
106         
107         return TRUE;
108 }
109
110 #endif // CSQC
111 #endif // REGISTER_MONSTER