X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fcrylink.qc;h=a69f43fbd3f7afbdd01bca9d88707ee5255c5729;hb=8298414706b35c6726479437b0775aed4ac9b55d;hp=94cf04f0f4ef280422f7448af27fa7498115c9f2;hpb=8c094d930e9ef51767384452f80a3bccdc6fd38d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 94cf04f0f4..a69f43fbd3 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -43,9 +43,15 @@ void W_Crylink_Dequeue(entity e) W_Crylink_Dequeue_Raw(e.crylink_owner, e.queueprev, e, e.queuenext); } +void W_Crylink_DeleteLink(entity this) +{ + if(this.classname != "spike_oktoremove") + W_Crylink_Dequeue(this); + delete_fn(this); +} + void W_Crylink_Reset(entity this) { - W_Crylink_Dequeue(this); delete(this); } @@ -247,7 +253,7 @@ void W_Crylink_Touch(entity this, entity toucher) if(a) f *= a; - float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), + float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, this.weaponentity_fld, toucher); if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius))))) @@ -263,7 +269,6 @@ void W_Crylink_Touch(entity this, entity toucher) else if(finalhit) { // just unlink - W_Crylink_Dequeue(this); delete(this); return; } @@ -278,7 +283,6 @@ void W_Crylink_Touch(entity this, entity toucher) void W_Crylink_Fadethink(entity this) { - W_Crylink_Dequeue(this); delete(this); } @@ -297,7 +301,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) if(WEP_CVAR_PRI(crylink, joinexplode)) maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage); - W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg); + W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg, thiswep.m_id); forward = v_forward; right = v_right; up = v_up; @@ -308,6 +312,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) for(counter = 0; counter < shots; ++counter) { proj = new(spike); + proj.dtor = W_Crylink_DeleteLink; proj.reset = W_Crylink_Reset; proj.realowner = proj.owner = actor; proj.crylink_owner = actor; @@ -336,7 +341,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(proj, MOVETYPE_BOUNCEMISSILE); PROJECTILE_MAKETRIGGER(proj); - proj.projectiledeathtype = WEP_CRYLINK.m_id; + proj.projectiledeathtype = thiswep.m_id; //proj.gravity = 0.001; setorigin(proj, w_shotorg); @@ -409,7 +414,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) if(WEP_CVAR_SEC(crylink, joinexplode)) maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage); - W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg); + W_SetupShot(actor, weaponentity, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg, thiswep.m_id | HITTYPE_SECONDARY); forward = v_forward; right = v_right; up = v_up; @@ -420,6 +425,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) for(counter = 0; counter < shots; ++counter) { proj = new(spike); + proj.dtor = W_Crylink_DeleteLink; proj.weaponentity_fld = weaponentity; proj.reset = W_Crylink_Reset; proj.realowner = proj.owner = actor; @@ -448,7 +454,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(proj, MOVETYPE_BOUNCEMISSILE); PROJECTILE_MAKETRIGGER(proj); - proj.projectiledeathtype = WEP_CRYLINK.m_id | HITTYPE_SECONDARY; + proj.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY; //proj.gravity = 0.001; setorigin(proj, w_shotorg); @@ -568,10 +574,10 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit } actor.(weaponentity).crylink_waitrelease = 0; if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !thiswep.wr_checkammo2(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { // ran out of ammo! - actor.cnt = WEP_CRYLINK.m_id; + actor.cnt = thiswep.m_id; actor.(weaponentity).m_switchweapon = w_getbestweapon(actor, weaponentity); } } @@ -583,8 +589,8 @@ METHOD(Crylink, wr_checkammo1, bool(entity thiswep, entity actor, .entity weapon if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease) return true; - float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(crylink, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(crylink, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(crylink, ammo); return ammo_amount; } METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) @@ -593,8 +599,8 @@ METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease) return true; - float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(crylink, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(crylink, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(crylink, ammo); return ammo_amount; } METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))