X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fminelayer.qc;h=5f5898aa41b78953872242278cfb5e3067a1cf54;hb=268f9c69576b6bb929f66d19f0d077d19ba47edd;hp=2b59e7841b9b42c2907a92c39f6016c0b7f065f6;hpb=90e39049eaeafbbd25267d1dfcf08023734cf6b8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 2b59e7841..5f5898aa4 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -1,12 +1,13 @@ +#include "minelayer.qh" #ifndef IMPLEMENTATION CLASS(MineLayer, Weapon) -/* ammotype */ ATTRIB(MineLayer, ammo_field, .int, ammo_rockets) -/* impulse */ ATTRIB(MineLayer, impulse, int, 4) +/* ammotype */ ATTRIB(MineLayer, ammo_field, .int, ammo_rockets); +/* impulse */ ATTRIB(MineLayer, impulse, int, 4); /* flags */ ATTRIB(MineLayer, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH); /* rating */ ATTRIB(MineLayer, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH); /* color */ ATTRIB(MineLayer, wpcolor, vector, '0.75 1 0'); /* modelname */ ATTRIB(MineLayer, mdl, string, "minelayer"); -#ifndef MENUQC +#ifdef GAMEQC /* model */ ATTRIB(MineLayer, m_model, Model, MDL_MINELAYER_ITEM); #endif /* crosshair */ ATTRIB(MineLayer, w_crosshair, string, "gfx/crosshairminelayer"); @@ -103,6 +104,7 @@ void W_MineLayer_Stick(entity this, entity to) newmine.cnt = this.cnt; newmine.flags = this.flags; IL_PUSH(g_projectiles, newmine); + IL_PUSH(g_bot_dodge, newmine); delete(this); @@ -131,7 +133,8 @@ void W_MineLayer_Explode(entity this, entity directhitentity) if(!w.wr_checkammo1(w, own)) { own.cnt = WEP_MINE_LAYER.m_id; - int slot = 0; // TODO: unhardcode + .entity weaponentity = this.weaponentity_fld; + int slot = weaponslot(weaponentity); ATTACK_FINISHED(own, slot) = time; PS(own).m_switchweapon = w_getbestweapon(own); } @@ -162,7 +165,8 @@ void W_MineLayer_DoRemoteExplode(entity this) if(!w.wr_checkammo1(w, own)) { own.cnt = WEP_MINE_LAYER.m_id; - int slot = 0; // TODO: unhardcode + .entity weaponentity = this.weaponentity_fld; + int slot = weaponslot(weaponentity); ATTACK_FINISHED(own, slot) = time; PS(own).m_switchweapon = w_getbestweapon(own); } @@ -338,6 +342,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity) Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); mine = WarpZone_RefSys_SpawnSameRefSys(actor); + mine.weaponentity_fld = weaponentity; IL_PUSH(g_mines, mine); mine.owner = mine.realowner = actor; if(WEP_CVAR(minelayer, detonatedelay) >= 0) @@ -369,6 +374,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity) mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown)); mine.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, mine); + IL_PUSH(g_bot_dodge, mine); mine.missile_flags = MIF_SPLASH | MIF_ARC | MIF_PROXY; if(mine.cnt > 0) { mine.cnt += time; } @@ -432,7 +438,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) IL_EACH(g_mines, it.realowner == actor, { entity mine = it; - FOREACH_ENTITY_FLOAT(bot_attack, true, + IL_EACH(g_bot_targets, it.bot_attack, { float d = vlen(it.origin + (it.mins + it.maxs) * 0.5 - mine.origin); d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000); @@ -459,7 +465,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor)) if(skill > 9) // normal players only do this for the target they are tracking { entity mine = it; - FOREACH_ENTITY_FLOAT(bot_attack, true, + IL_EACH(g_bot_targets, it.bot_attack, { if((v_forward * normalize(mine.origin - it.origin) < 0.1) && desirabledamage > 0.1 * coredamage