]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/stingray.qc
Begin working on a new mage attack
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / stingray.qc
index 3c12e684e3cacd2ddccb480d3e251da2d5bdd73a..e6b47aa441f3592a2d87bfd8d414e4eef51bbb28 100644 (file)
@@ -2,20 +2,26 @@
 REGISTER_MONSTER(
 /* MON_##id   */ STINGRAY,
 /* function   */ m_stingray,
+/* spawnflags */ MONSTER_TYPE_SWIM | MONSTER_SIZE_BROKEN | MON_FLAG_MELEE | MON_FLAG_MUTATORBLOCKED,
 /* mins,maxs  */ '-20 -20 -31', '20 20 20',
 /* model      */ "fish.mdl",
 /* netname    */ "stingray",
 /* fullname   */ _("Stingray")
 );
 
+#define STINGRAY_SETTINGS(monster) \
+       MON_ADD_CVAR(monster, health) \
+       MON_ADD_CVAR(monster, attack_bite_damage) \
+       MON_ADD_CVAR(monster, attack_bite_delay) \
+       MON_ADD_CVAR(monster, speed_stop) \
+       MON_ADD_CVAR(monster, speed_run) \
+       MON_ADD_CVAR(monster, speed_walk) 
+
+#ifdef SVQC
+STINGRAY_SETTINGS(stingray)
+#endif // SVQC
 #else
 #ifdef SVQC
-float autocvar_g_monster_stingray;
-float autocvar_g_monster_stingray_health;
-float autocvar_g_monster_stingray_damage;
-float autocvar_g_monster_stingray_speed_walk;
-float autocvar_g_monster_stingray_speed_run;
-
 const float stingray_anim_attack = 0;
 const float stingray_anim_death  = 1;
 const float stingray_anim_swim   = 2;
@@ -27,13 +33,13 @@ float stingray_attack(float attack_type)
        {
                case MONSTER_ATTACK_MELEE:
                {
-                       monsters_setframe(stingray_anim_attack);
-                       self.attack_finished_single = time + 0.5;
-                       monster_melee(self.enemy, autocvar_g_monster_stingray_damage, 0.1, DEATH_MONSTER_STINGRAY, FALSE);
-                       
-                       return TRUE;
+                       return 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);
                }
                case MONSTER_ATTACK_RANGED:
+               {
+                       // no ranged attack for stingray (yet?)
+                       return FALSE;
+               }
        }
        
        return FALSE;
@@ -41,8 +47,6 @@ float stingray_attack(float attack_type)
 
 void spawnfunc_monster_stingray()
 {
-       if not(autocvar_g_monster_stingray) { remove(self); return; }
-       
        self.classname = "monster_stingray";
        
        self.monster_spawnfunc = spawnfunc_monster_stingray;
@@ -50,7 +54,7 @@ void spawnfunc_monster_stingray()
        if(Monster_CheckAppearFlags(self))
                return;
        
-       if not(monster_initialize(MON_STINGRAY, TRUE, MONSTER_TYPE_SWIM | MONSTER_SIZE_BROKEN)) { remove(self); return; }
+       if not(monster_initialize(MON_STINGRAY, TRUE)) { remove(self); return; }
 }
 
 float m_stingray(float req)
@@ -59,26 +63,32 @@ float m_stingray(float req)
        {
                case MR_THINK:
                {
-                       monster_move(autocvar_g_monster_stingray_speed_run, autocvar_g_monster_stingray_speed_walk, 10, stingray_anim_swim, stingray_anim_swim, stingray_anim_swim);
+                       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);
                        return TRUE;
                }
                case MR_DEATH:
                {
-                       monsters_setframe(stingray_anim_death);
+                       self.frame = stingray_anim_death;
                        return TRUE;
                }
                case MR_SETUP:
                {
-                       if not(self.health) self.health = autocvar_g_monster_stingray_health;
-                               
+                       if not(self.health) self.health = MON_CVAR(stingray, health);
+                       
+                       self.monster_loot = spawnfunc_item_health_small;
                        self.monster_attackfunc = stingray_attack;
-                       monsters_setframe(stingray_anim_swim);
+                       self.frame = stingray_anim_swim;
                        
                        return TRUE;
                }
-               case MR_INIT:
+               case MR_PRECACHE:
+               {
+                       precache_model ("models/monsters/fish.mdl");
+                       return TRUE;
+               }
+               case MR_CONFIG:
                {
-                       // nothing
+                       MON_CONFIG_SETTINGS(STINGRAY_SETTINGS(stingray))
                        return TRUE;
                }
        }
@@ -92,12 +102,7 @@ float m_stingray(float req)
 {
        switch(req)
        {
-               case MR_DEATH:
-               {
-                       // nothing
-                       return TRUE;
-               }
-               case MR_INIT:
+               case MR_PRECACHE:
                {
                        precache_model ("models/monsters/fish.mdl");
                        return TRUE;