X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fspider.qc;h=7ec7f95acb3ba9e17bb128dab4d41921bff18b69;hp=b6d41dbb424b76b7c85ae3ef4beb2af9fe5d0aeb;hb=5fb2f3c4e123910e6291d6337fadd61f5199f5a5;hpb=1237e104131b37576287fddcbee29a0fe8806f9c diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index b6d41dbb4..7ec7f95ac 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 @@ -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); @@ -148,7 +112,7 @@ void M_Spider_Attack_Web_Explode(entity this) it.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); }); - remove(this); + delete(this); } } @@ -185,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'); @@ -194,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; @@ -203,9 +170,8 @@ 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]; switch(attack_type) { Weapon wep = WEP_SPIDER_ATTACK; @@ -224,7 +190,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 @@ -248,7 +214,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); @@ -262,7 +228,6 @@ 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); @@ -272,7 +237,7 @@ METHOD(Spider, mr_setup, bool(Spider this, entity actor)) 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; @@ -284,5 +249,3 @@ METHOD(Spider, mr_precache, bool(Spider this)) return true; } #endif - -#endif