]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/monsters/monster/wizard.qc
Fix hell-knight .think usage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / monsters / monster / wizard.qc
index 62a3be9e0a889000a9ded01f07f837f772b944bc..f584e8411e797c43e6b8470ebed6449a02ad9ff9 100644 (file)
@@ -1,7 +1,14 @@
+#ifndef MENUQC
 // size
-const vector WIZARD_MIN = '-16 -16 -24';
-const vector WIZARD_MAX = '16 16 24';
+const vector WIZARD_MIN = '-16 -16 -45';
+const vector WIZARD_MAX = '16 16 16';
 
+// model
+string WIZARD_MODEL = "models/monsters/wizard.mdl";
+
+#endif
+
+#ifdef SVQC
 // cvars
 float autocvar_g_monster_wizard;
 float autocvar_g_monster_wizard_health;
@@ -13,11 +20,11 @@ float autocvar_g_monster_wizard_spike_radius;
 float autocvar_g_monster_wizard_spike_speed;
 
 // animations
-#define wizard_anim_hover      0
-#define wizard_anim_fly        1
-#define wizard_anim_magic      2
-#define wizard_anim_pain       3
-#define wizard_anim_death      4
+const float wizard_anim_hover  = 0;
+const float wizard_anim_fly    = 1;
+const float wizard_anim_magic  = 2;
+const float wizard_anim_pain   = 3;
+const float wizard_anim_death  = 4;
 
 void Wiz_FastExplode()
 {
@@ -30,14 +37,10 @@ void Wiz_FastExplode()
 
 void Wiz_FastTouch ()
 {
-       PROJECTILE_TOUCH;
-       
        if(other == self.owner)
                return;
                
-       if(teamplay)
-       if(other.team == self.owner.team)
-               return;
+       PROJECTILE_TOUCH;
                
        pointparticles(particleeffectnum("TE_WIZSPIKE"), self.origin, '0 0 0', 1);
        
@@ -46,15 +49,10 @@ void Wiz_FastTouch ()
 
 void Wiz_StartFast ()
 {
-       local   entity  missile;
-       local   vector  dir = '0 0 0';
-       local   float   dist = 0, flytime = 0;
-
-       dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
-       dist = vlen (self.enemy.origin - self.origin);
-       flytime = dist * 0.002;
-       if (flytime < 0.1)
-               flytime = 0.1;
+       entity missile;
+       vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
+       
+       self.attack_finished_single = time + 0.2;
        
        self.v_angle = self.angles;
        makevectors (self.angles);
@@ -71,6 +69,7 @@ void Wiz_StartFast ()
        missile.solid = SOLID_BBOX;
        missile.movetype = MOVETYPE_FLYMISSILE;
        missile.touch = Wiz_FastTouch;
+       missile.projectiledeathtype = DEATH_MONSTER_SCRAG;
        CSQCProjectile(missile, TRUE, PROJECTILE_CRYLINK, TRUE);
        
        missile = spawn ();
@@ -85,13 +84,14 @@ void Wiz_StartFast ()
        missile.think = Wiz_FastExplode;
        missile.velocity = dir * autocvar_g_monster_wizard_spike_speed;
        missile.avelocity = '300 300 300';
+       missile.projectiledeathtype = DEATH_MONSTER_SCRAG;
        CSQCProjectile(missile, TRUE, PROJECTILE_CRYLINK, TRUE);
 }
 
 void wizard_think ()
 {
        self.think = wizard_think;
-       self.nextthink = time + 0.1;
+       self.nextthink = time + self.ticrate;
        
        monster_move(autocvar_g_monster_wizard_speed_run, autocvar_g_monster_wizard_speed_walk, 300, wizard_anim_fly, wizard_anim_hover, wizard_anim_hover);
 }
@@ -105,19 +105,14 @@ void wizard_die ()
 {
        Monster_CheckDropCvars ("wizard");
        
-       self.think                      = Monster_Fade;
-       self.solid                      = SOLID_NOT;
-       self.takedamage         = DAMAGE_NO;
-       self.event_damage   = func_null;
-       self.enemy                      = world;
-       self.movetype           = MOVETYPE_TOSS;
-       self.flags                      = FL_ONGROUND;
-       self.nextthink          = time + 2.1;
-       self.pain_finished  = self.nextthink; 
-       self.velocity_x         = -200 + 400*random();
-       self.velocity_y         = -200 + 400*random();
-       self.velocity_z         = 100 + 100*random();
-       self.frame                      = wizard_anim_death;
+       self.think                      = monster_dead_think;
+       self.nextthink          = time + self.ticrate;
+       self.ltime                      = time + 5;
+       self.velocity_x         = -200 + 400 * random();
+       self.velocity_y         = -200 + 400 * random();
+       self.velocity_z         = 100 + 100 * random();
+       
+       monsters_setframe(wizard_anim_death);
        
        monster_hook_death(); // for post-death mods
 }
@@ -140,34 +135,25 @@ void wizard_spawn ()
        self.movetype                   = MOVETYPE_FLY; // TODO: make it fly up/down
        self.flags                         |= FL_FLY;
        self.think                              = wizard_think;
-       self.sprite_height              = 30 * self.scale;
+       
+       monster_setupsounds("wizard");
        
        monster_hook_spawn(); // for post-spawn mods
 }
 
 void spawnfunc_monster_wizard ()
 {      
-       if not(autocvar_g_monster_wizard)
-       {
-               remove(self);
-               return;
-       }
+       if not(autocvar_g_monster_wizard) { remove(self); return; }
        
        self.monster_spawnfunc = spawnfunc_monster_wizard;
        
-       if(self.spawnflags & MONSTERFLAG_APPEAR)
-       {
-               self.think = func_null;
-               self.nextthink = -1;
-               self.use = Monster_Appear;
+       if(Monster_CheckAppearFlags(self))
                return;
-       }
        
        self.scale = 1.3;
        
        if not (monster_initialize(
-                        "Scrag",
-                        "models/monsters/wizard.mdl",
+                        "Scrag", MONSTER_SCRAG,
                         WIZARD_MIN, WIZARD_MAX,
                         TRUE,
                         wizard_die, wizard_spawn))
@@ -175,10 +161,9 @@ void spawnfunc_monster_wizard ()
                remove(self);
                return;
        }
-       
-       precache_model ("models/spike.mdl");
-       precache_sound ("weapons/spike.wav");
 }
 
 // compatibility with old spawns
 void spawnfunc_monster_scrag () { spawnfunc_monster_wizard(); }
+
+#endif // SVQC