]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/spider.qc
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / spider.qc
index 8046170e246376af831f1d70c8385433dcc48e36..f2850c1470f2fa2ea44f12d9de9dd3ce9efcd61d 100644 (file)
@@ -2,7 +2,7 @@
 REGISTER_MONSTER(
 /* MON_##id   */ SPIDER,
 /* function   */ m_spider,
-/* spawnflags */ 0,
+/* spawnflags */ MON_FLAG_MELEE | MON_FLAG_RANGED,
 /* mins,maxs  */ '-18 -18 -25', '18 18 30',
 /* model      */ "spider.dpm",
 /* netname    */ "spider",
@@ -99,10 +99,10 @@ void spider_shootweb(float ptype)
        }
        
        vector fmins = '-4 -4 -4', fmaxs = '4 4 4';
-
-       W_SetupShot_ProjectileSize(self, fmins, fmaxs, FALSE, 2, snd, CH_WEAPON_A, 0);
-
-       w_shotdir = v_forward; // no TrueAim for grenades please
+       
+       monster_makevectors(self.enemy);
+       
+       sound(self, CH_SHOTS, snd, VOL_BASE, ATTEN_NORM);
 
        entity proj = spawn ();
        proj.classname = "plasma";
@@ -114,12 +114,12 @@ void spider_shootweb(float ptype)
        proj.nextthink = time + 5;
        PROJECTILE_MAKETRIGGER(proj);
        proj.projectiledeathtype = DEATH_MONSTER_SPIDER_FIRE;
-       setorigin(proj, w_shotorg);
+       setorigin(proj, CENTER_OR_VIEWOFS(self));
 
        //proj.glow_size = 50;
        //proj.glow_color = 45;
        proj.movetype = MOVETYPE_BOUNCE;
-       W_SetupProjectileVelocityEx(proj, w_shotdir, v_up, MON_CVAR(spider, attack_web_speed), MON_CVAR(spider, attack_web_speed_up), 0, 0, FALSE);
+       W_SetupProjectileVelocityEx(proj, v_forward, v_up, MON_CVAR(spider, attack_web_speed), MON_CVAR(spider, attack_web_speed_up), 0, 0, FALSE);
        proj.touch = spider_web_touch;
        setsize(proj, fmins, fmaxs);
        proj.takedamage = DAMAGE_NO;
@@ -141,12 +141,8 @@ float spider_attack(float attack_type)
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
-               {
-                       monster_melee(self.enemy, MON_CVAR(spider, attack_bite_damage), 0.3, DEATH_MONSTER_SPIDER, TRUE);
-                       monsters_setframe((random() > 0.5) ? spider_anim_attack : spider_anim_attack2);
-                       self.attack_finished_single = time + MON_CVAR(spider, attack_bite_delay);
-                       
-                       return TRUE;
+               {       
+                       return monster_melee(self.enemy, MON_CVAR(spider, attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, MON_CVAR(spider, attack_bite_delay), DEATH_MONSTER_SPIDER, TRUE);
                }
                case MONSTER_ATTACK_RANGED:
                {
@@ -155,7 +151,6 @@ float spider_attack(float attack_type)
                        
                        monsters_setframe(spider_anim_attack2);
                        self.attack_finished_single = time + MON_CVAR(spider, attack_web_delay);
-                       monster_makevectors(self.enemy);
                        spider_shootweb(self.spider_type);
                        
                        return TRUE;
@@ -189,7 +184,7 @@ float m_spider(float req)
                case MR_DEATH:
                {
                        monsters_setframe(spider_anim_attack);
-                       self.angles += '180 0 0';
+                       self.angles_x = 180;
                        self.SendFlags |= MSF_ANG;
                        return TRUE;
                }
@@ -197,7 +192,8 @@ float m_spider(float req)
                {
                        if not(self.health) self.health = MON_CVAR(spider, health);
                        if not(self.spider_type) self.spider_type = MON_CVAR(spider, attack_type);
-                               
+                       
+                       self.monster_loot = spawnfunc_item_health_medium;
                        self.monster_attackfunc = spider_attack;
                        monsters_setframe(spider_anim_idle);
                        
@@ -205,7 +201,9 @@ float m_spider(float req)
                }
                case MR_INIT:
                {
-                       // nothing
+                       precache_model ("models/ice/ice.md3");
+                       precache_sound ("weapons/electro_fire2.wav");
+                       precache_sound ("weapons/fireball_fire.wav");
                        return TRUE;
                }
                case MR_CONFIG: