]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monster/stingray.qc
Attempt to fix monster vehicle support
[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 | MON_FLAG_MELEE,
6 /* mins,maxs  */ '-20 -20 -31', '20 20 20',
7 /* model      */ "fish.mdl",
8 /* netname    */ "stingray",
9 /* fullname   */ _("Stingray")
10 );
11
12 #define STINGRAY_SETTINGS(monster) \
13         MON_ADD_CVAR(monster, health) \
14         MON_ADD_CVAR(monster, attack_bite_damage) \
15         MON_ADD_CVAR(monster, attack_bite_delay) \
16         MON_ADD_CVAR(monster, speed_stop) \
17         MON_ADD_CVAR(monster, speed_run) \
18         MON_ADD_CVAR(monster, speed_walk) 
19
20 #ifdef SVQC
21 STINGRAY_SETTINGS(stingray)
22 #endif // SVQC
23 #else
24 #ifdef SVQC
25 const float stingray_anim_attack = 0;
26 const float stingray_anim_death  = 1;
27 const float stingray_anim_swim   = 2;
28 const float stingray_anim_pain   = 3;
29
30 float stingray_attack(float attack_type)
31 {
32         switch(attack_type)
33         {
34                 case MONSTER_ATTACK_MELEE:
35                 {
36                         if(monster_melee(self.enemy, MON_CVAR(stingray, attack_bite_damage), stingray_anim_attack, self.attack_range, MON_CVAR(stingray, attack_bite_delay), DEATH_MONSTER_STINGRAY, FALSE))
37                                 return TRUE;
38                                 
39                         return FALSE;
40                 }
41                 case MONSTER_ATTACK_RANGED:
42                 {
43                         // no ranged attack for stingray (yet?)
44                         return FALSE;
45                 }
46         }
47         
48         return FALSE;
49 }
50
51 void spawnfunc_monster_stingray()
52 {
53         self.classname = "monster_stingray";
54         
55         self.monster_spawnfunc = spawnfunc_monster_stingray;
56         
57         if(Monster_CheckAppearFlags(self))
58                 return;
59         
60         if not(monster_initialize(MON_STINGRAY, TRUE)) { remove(self); return; }
61 }
62
63 float m_stingray(float req)
64 {
65         switch(req)
66         {
67                 case MR_THINK:
68                 {
69                         monster_move(MON_CVAR(stingray, speed_run), MON_CVAR(stingray, speed_walk), MON_CVAR(stingray, speed_stop), stingray_anim_swim, stingray_anim_swim, stingray_anim_swim);
70                         return TRUE;
71                 }
72                 case MR_DEATH:
73                 {
74                         monsters_setframe(stingray_anim_death);
75                         return TRUE;
76                 }
77                 case MR_SETUP:
78                 {
79                         if not(self.health) self.health = MON_CVAR(stingray, health);
80                         
81                         self.monster_loot = spawnfunc_item_health_small;
82                         self.monster_attackfunc = stingray_attack;
83                         monsters_setframe(stingray_anim_swim);
84                         
85                         return TRUE;
86                 }
87                 case MR_INIT:
88                 {
89                         // nothing
90                         return TRUE;
91                 }
92                 case MR_CONFIG:
93                 {
94                         MON_CONFIG_SETTINGS(STINGRAY_SETTINGS(stingray))
95                         return TRUE;
96                 }
97         }
98         
99         return TRUE;
100 }
101
102 #endif // SVQC
103 #ifdef CSQC
104 float m_stingray(float req)
105 {
106         switch(req)
107         {
108                 case MR_DEATH:
109                 {
110                         // nothing
111                         return TRUE;
112                 }
113                 case MR_INIT:
114                 {
115                         precache_model ("models/monsters/fish.mdl");
116                         return TRUE;
117                 }
118         }
119         
120         return TRUE;
121 }
122
123 #endif // CSQC
124 #endif // REGISTER_MONSTER