X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fspider.qc;h=a122865321f0a5a69897245c38f69b9df00a4b11;hb=275cead32998c415fff49383920c26e21de48662;hp=b9f9bfc21c2992807c513abaf5cd0c7649720138;hpb=74cebbb48d9481bb83eccb4438283f319352cb74;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index b9f9bfc21..a12286532 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -1,40 +1,4 @@ -#ifndef SPIDER_H -#define SPIDER_H - -#ifndef MENUQC -MODEL(MON_SPIDER, M_Model("spider.dpm")); -#endif - -CLASS(Spider, Monster) - ATTRIB(Spider, spawnflags, int, MON_FLAG_MELEE | MON_FLAG_RANGED | MON_FLAG_RIDE); - ATTRIB(Spider, mins, vector, '-18 -18 -25'); - ATTRIB(Spider, maxs, vector, '18 18 30'); -#ifndef MENUQC - ATTRIB(Spider, m_model, Model, MDL_MON_SPIDER); -#endif - ATTRIB(Spider, netname, string, "spider"); - ATTRIB(Spider, monster_name, string, _("Spider")); -ENDCLASS(Spider) - -REGISTER_MONSTER(SPIDER, NEW(Spider)) { -#ifndef MENUQC - this.mr_precache(this); -#endif -} - -#include - -CLASS(SpiderAttack, PortoLaunch) -/* flags */ ATTRIB(SpiderAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED); -/* impulse */ ATTRIB(SpiderAttack, impulse, int, 9); -/* refname */ ATTRIB(SpiderAttack, netname, string, "spider"); -/* wepname */ ATTRIB(SpiderAttack, m_name, string, _("Spider attack")); -ENDCLASS(SpiderAttack) -REGISTER_WEAPON(SPIDER_ATTACK, NEW(SpiderAttack)); - -#endif - -#ifdef IMPLEMENTATION +#include "spider.qh" #ifdef SVQC @@ -56,45 +20,45 @@ REGISTER_MUTATOR(spiderweb, true); MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics) { - SELFPARAM(); - if (time >= this.spider_slowness) + entity player = M_ARGV(0, entity); + + if (time >= player.spider_slowness) return false; - PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider - PHYS_MAXAIRSPEED(this) *= 0.5; - PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5; - PHYS_AIRSTRAFEACCELERATE(this) *= 0.5; - 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; } MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove) { - SELFPARAM(); - if(time < self.spider_slowness) + entity mon = M_ARGV(0, entity); + + if(time < mon.spider_slowness) { - monster_speed_run *= 0.5; - monster_speed_walk *= 0.5; + M_ARGV(1, float) *= 0.5; // run speed + M_ARGV(2, float) *= 0.5; // walk speed } - return false; } MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn) { - SELFPARAM(); - self.spider_slowness = 0; + entity player = M_ARGV(0, entity); + + player.spider_slowness = 0; return false; } MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn) { - SELFPARAM(); - self.spider_slowness = 0; - return false; + entity mon = M_ARGV(0, entity); + + mon.spider_slowness = 0; } SOUND(SpiderAttack_FIRE, W_Sound("electro_fire")); METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire)) { - SELFPARAM(); TC(SpiderAttack, thiswep); bool isPlayer = IS_PLAYER(actor); if (fire & 1) @@ -106,7 +70,7 @@ 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, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0); + W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0); 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); @@ -118,7 +82,7 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity actor.enemy = Monster_FindTarget(actor); actor.attack_range = 60; } - Monster_Attack_Melee(actor, actor.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? self.anim_melee : self.anim_shoot), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER.m_id, true); + Monster_Attack_Melee(actor, actor.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? actor.anim_melee : actor.anim_shoot), actor.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER.m_id, true); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, 0, w_ready); } } @@ -136,31 +100,32 @@ const float spider_anim_attack = 2; const float spider_anim_attack2 = 3; */ -void M_Spider_Attack_Web_Explode() -{SELFPARAM(); - entity e; - if(self) +void M_Spider_Attack_Web_Explode(entity this) +{ + if(this) { - Send_Effect(EFFECT_ELECTRO_IMPACT, self.origin, '0 0 0', 1); - RadiusDamage(self, self.realowner, 0, 0, 25, world, world, 25, self.projectiledeathtype, world); + Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1); + RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, NULL); - for(e = findradius(self.origin, 25); e; e = e.chain) if(e != self) if(e.takedamage && !IS_DEAD(e)) if(e.health > 0) if(e.monsterid != MON_SPIDER.monsterid) - e.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); + FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && it.health > 0 && it.monsterid != MON_SPIDER.monsterid, + { + it.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); + }); - remove(self); + delete(this); } } void M_Spider_Attack_Web_Explode_use(entity this, entity actor, entity trigger) { - WITHSELF(this, M_Spider_Attack_Web_Explode()); + M_Spider_Attack_Web_Explode(this); } -void M_Spider_Attack_Web_Touch(entity this) +void M_Spider_Attack_Web_Touch(entity this, entity toucher) { - PROJECTILE_TOUCH(this); + PROJECTILE_TOUCH(this, toucher); - M_Spider_Attack_Web_Explode(); + M_Spider_Attack_Web_Explode(this); } void adaptor_think2use_hittype_splash(entity this); @@ -184,7 +149,7 @@ void M_Spider_Attack_Web(entity this) //proj.glow_size = 50; //proj.glow_color = 45; - proj.movetype = MOVETYPE_BOUNCE; + set_movetype(proj, MOVETYPE_BOUNCE); W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, false); settouch(proj, M_Spider_Attack_Web_Touch); setsize(proj, '-4 -4 -4', '4 4 4'); @@ -193,7 +158,10 @@ void M_Spider_Attack_Web(entity this) proj.health = 500; proj.event_damage = func_null; proj.flags = FL_PROJECTILE; + IL_PUSH(g_projectiles, proj); + IL_PUSH(g_bot_dodge, proj); proj.damagedbycontents = true; + IL_PUSH(g_damagedbycontents, proj); proj.bouncefactor = 0.3; proj.bouncestop = 0.05; @@ -223,7 +191,7 @@ bool M_Spider_Attack(int attack_type, entity actor, entity targ) return false; } -spawnfunc(monster_spider) { Monster_Spawn(this, MON_SPIDER.monsterid); } +spawnfunc(monster_spider) { Monster_Spawn(this, true, MON_SPIDER.monsterid); } #endif // SVQC #ifdef SVQC @@ -233,10 +201,10 @@ METHOD(Spider, mr_think, bool(Spider this, entity actor)) return true; } -METHOD(Spider, mr_pain, bool(Spider this, entity actor)) +METHOD(Spider, mr_pain, float(Spider this, entity actor, float damage_take, entity attacker, float deathtype)) { TC(Spider, this); - return true; + return damage_take; } METHOD(Spider, mr_death, bool(Spider this, entity actor)) @@ -247,7 +215,7 @@ METHOD(Spider, mr_death, bool(Spider this, entity actor)) return true; } #endif -#ifndef MENUQC +#ifdef GAMEQC METHOD(Spider, mr_anim, bool(Spider this, entity actor)) { TC(Spider, this); @@ -283,5 +251,3 @@ METHOD(Spider, mr_precache, bool(Spider this)) return true; } #endif - -#endif