]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monster/animus.qc
Replace monsters config with a modified dumped config
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / animus.qc
1 #ifdef REGISTER_MONSTER
2 REGISTER_MONSTER(
3 /* MON_##id   */ ANIMUS,
4 /* function   */ m_animus,
5 /* spawnflags */ MONSTER_SIZE_BROKEN,
6 /* mins,maxs  */ '-41 -41 -31', '41 41 31',
7 /* model      */ "demon.mdl",
8 /* netname    */ "animus",
9 /* fullname   */ _("Animus")
10 );
11
12 #define ANIMUS_SETTINGS(monster) \
13         MON_ADD_CVAR(monster, health) \
14         MON_ADD_CVAR(monster, attack_jump_damage) \
15         MON_ADD_CVAR(monster, attack_melee_damage) \
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 ANIMUS_SETTINGS(animus)
22 #endif // SVQC
23 #else
24 #ifdef SVQC
25 const float animus_anim_stand   = 0;
26 const float animus_anim_walk    = 1;
27 const float animus_anim_run             = 2;
28 const float animus_anim_leap    = 3;
29 const float animus_anim_pain    = 4;
30 const float animus_anim_death   = 5;
31 const float animus_anim_attack  = 6;
32
33 void animus_touch_jump()
34 {
35         if (self.health <= 0)
36                 return;
37
38         if (monster_isvalidtarget(other, self))
39         {
40                 if (vlen(self.velocity) > 300)
41                 {
42                         Damage(other, self, self, MON_CVAR(animus, attack_jump_damage) * monster_skill, DEATH_MONSTER_ANIMUS, other.origin, normalize(other.origin - self.origin));
43                         self.touch = MonsterTouch; // instantly turn it off to stop damage spam
44                 }
45         }
46
47         if(trace_dphitcontents)
48                 self.touch = MonsterTouch;
49 }
50
51 float animus_attack(float attack_type)
52 {
53         switch(attack_type)
54         {
55                 case MONSTER_ATTACK_MELEE:
56                 {
57                         monsters_setframe(animus_anim_attack);
58                         self.attack_finished_single = time + 1;
59                         monster_melee(self.enemy, MON_CVAR(animus, attack_melee_damage), 0.3, DEATH_MONSTER_ANIMUS, TRUE);
60                         
61                         return TRUE;
62                 }
63                 case MONSTER_ATTACK_RANGED:
64                 {
65                         makevectors(self.angles);
66                         if(monster_leap(animus_anim_leap, animus_touch_jump, v_forward * 700 + '0 0 300', 0.8))
67                                 return TRUE;
68                 }
69         }
70         
71         return FALSE;
72 }
73
74 void spawnfunc_monster_animus()
75 {
76         self.classname = "monster_animus";
77         
78         self.monster_spawnfunc = spawnfunc_monster_animus;
79         
80         if(Monster_CheckAppearFlags(self))
81                 return;
82         
83         if not(monster_initialize(MON_ANIMUS, FALSE)) { remove(self); return; }
84 }
85
86 // compatibility with old spawns
87 void spawnfunc_monster_demon1() { spawnfunc_monster_animus(); }
88 void spawnfunc_monster_demon() { spawnfunc_monster_animus(); }
89
90 float m_animus(float req)
91 {
92         switch(req)
93         {
94                 case MR_THINK:
95                 {
96                         monster_move(MON_CVAR(animus, speed_run), MON_CVAR(animus, speed_walk), MON_CVAR(animus, speed_stop), animus_anim_run, animus_anim_walk, animus_anim_stand);
97                         return TRUE;
98                 }
99                 case MR_DEATH:
100                 {
101                         monsters_setframe(animus_anim_death);
102                         return TRUE;
103                 }
104                 case MR_SETUP:
105                 {
106                         if not(self.health) self.health = MON_CVAR(animus, health);
107                                 
108                         self.monster_attackfunc = animus_attack;
109                         monsters_setframe(animus_anim_stand);
110                         
111                         return TRUE;
112                 }
113                 case MR_INIT:
114                 {
115                         // nothing
116                         return TRUE;
117                 }
118                 case MR_CONFIG:
119                 {
120                         MON_CONFIG_SETTINGS(ANIMUS_SETTINGS(animus))
121                         return TRUE;
122                 }
123         }
124         
125         return TRUE;
126 }
127
128 #endif // SVQC
129 #ifdef CSQC
130 float m_animus(float req)
131 {
132         switch(req)
133         {
134                 case MR_DEATH:
135                 {
136                         // nothing
137                         return TRUE;
138                 }
139                 case MR_INIT:
140                 {
141                         precache_model ("models/monsters/demon.mdl");
142                         return TRUE;
143                 }
144         }
145         
146         return TRUE;
147 }
148
149 #endif // CSQC
150 #endif // REGISTER_MONSTER