X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fspider.qc;h=5954d2495867b3c2c7c6f8fca103e529af8b97e6;hb=066b04f9c76d2416846e67b05c7f337328cb97eb;hp=344d855be04e98d3c2076d44810110acdef23a6b;hpb=e259123719e072470e8fd479ffaf4d33f02cea2e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 344d855be..5954d2495 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -10,6 +10,7 @@ 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_attack_web_range = 800; float autocvar_g_monster_spider_attack_bite_damage; float autocvar_g_monster_spider_attack_bite_delay; @@ -58,12 +59,15 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity TC(SpiderAttack, thiswep); bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_monster_spider_attack_web_delay)) { + if ((!isPlayer && time >= actor.spider_web_delay) || (isPlayer && weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_monster_spider_attack_web_delay))) { if (!isPlayer) { - actor.spider_web_delay = time + 3; + actor.spider_web_delay = time + autocvar_g_monster_spider_attack_web_delay; setanim(actor, actor.anim_shoot, true, true, true); - actor.attack_finished_single[0] = time + (autocvar_g_monster_spider_attack_web_delay); - actor.anim_finished = time + 1; + if(actor.animstate_endtime > time) + actor.anim_finished = actor.animstate_endtime; + else + actor.anim_finished = time + 1; + actor.attack_finished_single[0] = actor.anim_finished + 0.2; } if (isPlayer) actor.enemy = Monster_FindTarget(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_SPIDER.m_id); @@ -103,7 +107,7 @@ void M_Spider_Attack_Web_Explode(entity this) Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1); 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) && GetResourceAmount(it, RESOURCE_HEALTH) > 0 && it.monsterid != MON_SPIDER.monsterid, { it.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); }); @@ -151,7 +155,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; + SetResourceAmountExplicit(proj, RESOURCE_HEALTH, 500); proj.event_damage = func_null; proj.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, proj); @@ -178,8 +182,11 @@ bool M_Spider_Attack(int attack_type, entity actor, entity targ, .entity weapone } case MONSTER_ATTACK_RANGED: { - wep.wr_think(wep, actor, weaponentity, 1); - return true; + if(vdist(actor.enemy.origin - actor.origin, <=, autocvar_g_monster_spider_attack_web_range)) + { + wep.wr_think(wep, actor, weaponentity, 1); + return true; + } } } @@ -242,7 +249,7 @@ METHOD(Spider, mr_anim, bool(Spider this, entity actor)) METHOD(Spider, mr_setup, bool(Spider this, entity actor)) { TC(Spider, this); - if(!actor.health) actor.health = (autocvar_g_monster_spider_health); + if(!GetResourceAmount(this, RESOURCE_HEALTH)) SetResourceAmountExplicit(actor, RESOURCE_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); }