X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fspider.qc;h=08d28218786524d462b6cf2d321b91aa38e899b0;hb=18dcd0070ab608b7788a7def821088060847fa76;hp=a122865321f0a5a69897245c38f69b9df00a4b11;hpb=34e7f534e2015466228eb3a78c9857741b736dca;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index a12286532..08d282187 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -18,16 +18,12 @@ void M_Spider_Attack_Web(entity this); REGISTER_MUTATOR(spiderweb, true); -MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics) +MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics_UpdateStats) { - entity player = M_ARGV(0, entity); - - if (time >= player.spider_slowness) - return false; - PHYS_MAXSPEED(player) *= 0.5; // half speed while slow from spider - PHYS_MAXAIRSPEED(player) *= 0.5; - PHYS_AIRSPEEDLIMIT_NONQW(player) *= 0.5; - PHYS_AIRSTRAFEACCELERATE(player) *= 0.5; + entity player = M_ARGV(0, entity); + + if(time < player.spider_slowness) + STAT(MOVEVARS_HIGHSPEED, player) *= 0.5; } MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove) @@ -70,7 +66,8 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity actor.anim_finished = time + 1; } if (isPlayer) actor.enemy = Monster_FindTarget(actor); - W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0); + monster_makevectors(actor, actor.enemy); + W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_SPIDER.m_id); if (!isPlayer) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin); M_Spider_Attack_Web(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready); @@ -105,9 +102,9 @@ void M_Spider_Attack_Web_Explode(entity this) if(this) { Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1); - RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, NULL); + RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, DMG_NOWEP, NULL); - FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && it.health > 0 && it.monsterid != MON_SPIDER.monsterid, + FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && GetResource(it, RES_HEALTH) > 0 && it.monsterdef != MON_SPIDER, { it.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); }); @@ -132,8 +129,6 @@ void adaptor_think2use_hittype_splash(entity this); void M_Spider_Attack_Web(entity this) { - monster_makevectors(this, this.enemy); - sound(this, CH_SHOTS, SND_ELECTRO_FIRE2, VOL_BASE, ATTEN_NORM); entity proj = new(plasma); @@ -155,7 +150,7 @@ void M_Spider_Attack_Web(entity this) setsize(proj, '-4 -4 -4', '4 4 4'); proj.takedamage = DAMAGE_NO; proj.damageforcescale = 0; - proj.health = 500; + SetResourceExplicit(proj, RES_HEALTH, 500); proj.event_damage = func_null; proj.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, proj); @@ -170,12 +165,11 @@ void M_Spider_Attack_Web(entity this) CSQCProjectile(proj, true, PROJECTILE_ELECTRO, true); } -bool M_Spider_Attack(int attack_type, entity actor, entity targ) +bool M_Spider_Attack(int attack_type, entity actor, entity targ, .entity weaponentity) { - .entity weaponentity = weaponentities[0]; + Weapon wep = WEP_SPIDER_ATTACK; switch(attack_type) { - Weapon wep = WEP_SPIDER_ATTACK; case MONSTER_ATTACK_MELEE: { wep.wr_think(wep, actor, weaponentity, 2); @@ -191,7 +185,7 @@ bool M_Spider_Attack(int attack_type, entity actor, entity targ) return false; } -spawnfunc(monster_spider) { Monster_Spawn(this, true, MON_SPIDER.monsterid); } +spawnfunc(monster_spider) { Monster_Spawn(this, true, MON_SPIDER); } #endif // SVQC #ifdef SVQC @@ -229,25 +223,18 @@ METHOD(Spider, mr_anim, bool(Spider this, entity actor)) } #endif #ifdef SVQC -spawnfunc(item_health_medium); METHOD(Spider, mr_setup, bool(Spider this, entity actor)) { TC(Spider, this); - if(!actor.health) actor.health = (autocvar_g_monster_spider_health); + if(!GetResource(this, RES_HEALTH)) SetResourceExplicit(actor, RES_HEALTH, autocvar_g_monster_spider_health); if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); } if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); } if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_spider_speed_stop); } if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_spider_damageforcescale); } - actor.monster_loot = spawnfunc_item_health_medium; + actor.monster_loot = ITEM_HealthMedium; actor.monster_attackfunc = M_Spider_Attack; return true; } - -METHOD(Spider, mr_precache, bool(Spider this)) -{ - TC(Spider, this); - return true; -} #endif