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