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",
/* fullname */ _("Spider")
);
-#define SPIDER_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, attack_web_damagetime) \
- MON_ADD_CVAR(monster, attack_web_speed) \
- MON_ADD_CVAR(monster, attack_web_speed_up) \
- MON_ADD_CVAR(monster, attack_web_delay) \
- MON_ADD_CVAR(monster, attack_type) \
- MON_ADD_CVAR(monster, speed_stop) \
- MON_ADD_CVAR(monster, speed_run) \
- MON_ADD_CVAR(monster, speed_walk)
-
-#ifdef SVQC
-SPIDER_SETTINGS(spider)
-#endif // SVQC
#else
#ifdef SVQC
+float autocvar_g_monster_spider_health;
+float autocvar_g_monster_spider_attack_bite_damage;
+float autocvar_g_monster_spider_attack_bite_delay;
+float autocvar_g_monster_spider_attack_web_damagetime;
+float autocvar_g_monster_spider_attack_web_speed;
+float autocvar_g_monster_spider_attack_web_speed_up;
+float autocvar_g_monster_spider_attack_web_delay;
+float autocvar_g_monster_spider_speed_stop;
+float autocvar_g_monster_spider_speed_run;
+float autocvar_g_monster_spider_speed_walk;
+
const float spider_anim_idle = 0;
const float spider_anim_walk = 1;
const float spider_anim_attack = 2;
const float spider_anim_attack2 = 3;
-.float spider_type; // used to switch between fire & ice attacks
-const float SPIDER_TYPE_ICE = 0;
-const float SPIDER_TYPE_FIRE = 1;
+.float spider_web_delay;
void spider_web_explode()
{
entity e;
if(self)
{
- float damg = 0, edamg = 0, rad = 1;
- switch(self.realowner.spider_type)
- {
- case SPIDER_TYPE_ICE:
- rad = 25;
- pointparticles(particleeffectnum("electro_impact"), self.origin, '0 0 0', 1);
- break;
- case SPIDER_TYPE_FIRE:
- pointparticles(particleeffectnum("fireball_explode"), self.origin, '0 0 0', 1);
- damg = 15;
- rad = 25;
- edamg = 6;
- break;
- }
-
- RadiusDamage(self, self.realowner, damg, edamg, 0, world, rad, DEATH_MONSTER_SPIDER_FIRE, world); // ice deals no damage anyway
-
- for(e = findradius(self.origin, rad); e; e = e.chain) if(e != self) if(e.takedamage && e.deadflag == DEAD_NO) if(e.health > 0)
- {
- switch(self.realowner.spider_type)
- {
- case SPIDER_TYPE_ICE:
- Freeze(e, 0.3, 2, FALSE);
- break;
- case SPIDER_TYPE_FIRE:
- Fire_AddDamage(e, self.realowner, 5 * monster_skill, MON_CVAR(spider, attack_web_damagetime), DEATH_MONSTER_SPIDER_FIRE);
- break;
- }
- }
-
+ pointparticles(particleeffectnum("electro_impact"), self.origin, '0 0 0', 1);
+ RadiusDamage(self, self.realowner, 0, 0, 25, world, 25, self.projectiledeathtype, world);
+
+ for(e = findradius(self.origin, 25); e; e = e.chain) if(e != self) if(e.takedamage && e.deadflag == DEAD_NO) if(e.health > 0)
+ e.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime);
+
remove(self);
}
}
void spider_web_touch()
{
PROJECTILE_TOUCH;
-
+
spider_web_explode();
}
-void spider_shootweb(float ptype)
+void spider_shootweb()
{
- float p = 0;
- string snd = "";
- switch(ptype)
- {
- case SPIDER_TYPE_ICE:
- p = PROJECTILE_ELECTRO;
- snd = "weapons/electro_fire2.wav";
- break;
- case SPIDER_TYPE_FIRE:
- p = PROJECTILE_FIREMINE;
- snd = "weapons/fireball_fire.wav";
- break;
- }
-
- vector fmins = '-4 -4 -4', fmaxs = '4 4 4';
-
monster_makevectors(self.enemy);
-
- sound(self, CH_SHOTS, snd, VOL_BASE, ATTN_NORM);
+
+ sound(self, CH_SHOTS, "weapons/electro_fire2.wav", VOL_BASE, ATTEN_NORM);
entity proj = spawn ();
proj.classname = "plasma";
proj.bot_dodgerating = 0;
proj.nextthink = time + 5;
PROJECTILE_MAKETRIGGER(proj);
- proj.projectiledeathtype = DEATH_MONSTER_SPIDER_FIRE;
+ proj.projectiledeathtype = DEATH_MONSTER_SPIDER;
setorigin(proj, CENTER_OR_VIEWOFS(self));
//proj.glow_size = 50;
//proj.glow_color = 45;
proj.movetype = MOVETYPE_BOUNCE;
- W_SetupProjectileVelocityEx(proj, v_forward, 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, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, FALSE);
proj.touch = spider_web_touch;
- setsize(proj, fmins, fmaxs);
+ setsize(proj, '-4 -4 -4', '4 4 4');
proj.takedamage = DAMAGE_NO;
proj.damageforcescale = 0;
proj.health = 500;
proj.bouncestop = 0.05;
proj.missile_flags = MIF_SPLASH | MIF_ARC;
- CSQCProjectile(proj, TRUE, p, TRUE);
+ CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, TRUE);
}
float spider_attack(float 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, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, TRUE);
}
case MONSTER_ATTACK_RANGED:
{
- if(self.enemy.frozen)
- return FALSE;
-
- monsters_setframe(spider_anim_attack2);
- self.attack_finished_single = time + MON_CVAR(spider, attack_web_delay);
- spider_shootweb(self.spider_type);
-
- return TRUE;
+ if(time >= self.spider_web_delay)
+ {
+ self.frame = spider_anim_attack2;
+ self.attack_finished_single = time + (autocvar_g_monster_spider_attack_web_delay);
+ spider_shootweb();
+ self.spider_web_delay = time + 3;
+ return TRUE;
+ }
+
+ return FALSE;
}
}
-
+
return FALSE;
}
-void spawnfunc_monster_spider()
+void spawnfunc_monster_spider()
{
self.classname = "monster_spider";
-
+
self.monster_spawnfunc = spawnfunc_monster_spider;
-
+
if(Monster_CheckAppearFlags(self))
return;
-
- if not(monster_initialize(MON_SPIDER, FALSE)) { remove(self); return; }
+
+ if(!monster_initialize(MON_SPIDER, FALSE)) { remove(self); return; }
}
float m_spider(float req)
{
case MR_THINK:
{
- monster_move(MON_CVAR(spider, speed_run), MON_CVAR(spider, speed_walk), MON_CVAR(spider, speed_stop), spider_anim_walk, spider_anim_walk, spider_anim_idle);
+ monster_move((autocvar_g_monster_spider_speed_run), (autocvar_g_monster_spider_speed_walk), (autocvar_g_monster_spider_speed_stop), spider_anim_walk, spider_anim_walk, spider_anim_idle);
return TRUE;
}
case MR_DEATH:
{
- monsters_setframe(spider_anim_attack);
- self.angles += '180 0 0';
- self.SendFlags |= MSF_ANG;
+ self.frame = spider_anim_attack;
+ self.angles_x = 180;
return TRUE;
}
case MR_SETUP:
{
- if not(self.health) self.health = MON_CVAR(spider, health);
- if not(self.spider_type) self.spider_type = MON_CVAR(spider, attack_type);
-
+ if(!self.health) self.health = (autocvar_g_monster_spider_health);
+
self.monster_loot = spawnfunc_item_health_medium;
self.monster_attackfunc = spider_attack;
- monsters_setframe(spider_anim_idle);
-
- return TRUE;
- }
- case MR_INIT:
- {
- // nothing
+ self.frame = spider_anim_idle;
+
return TRUE;
}
- case MR_CONFIG:
+ case MR_PRECACHE:
{
- MON_CONFIG_SETTINGS(SPIDER_SETTINGS(spider))
+ precache_model ("models/monsters/spider.dpm");
+ precache_sound ("weapons/electro_fire2.wav");
return TRUE;
}
}
-
+
return TRUE;
}
{
switch(req)
{
- case MR_DEATH:
- {
- // nothing
- return TRUE;
- }
- case MR_INIT:
+ case MR_PRECACHE:
{
precache_model ("models/monsters/spider.dpm");
return TRUE;
}
}
-
+
return TRUE;
}