X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fdevastator.qc;h=d30569adf2e65d07508537901d055669997166c8;hb=86c4f57358c37c4165945b1c99840aa447b50000;hp=0a046389c7fa3d3cc57aa2106324124dce0e3271;hpb=91819987a61f7675e34866edcb0fe3671a9b1ba4;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 0a046389c7..d30569adf2 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -235,11 +235,19 @@ void W_Devastator_Think(entity this) else f = 1; + vector md = this.realowner.(weaponentity).movedir; + vector vecs = ((md.x > 0) ? md : '0 0 0'); + + vector dv = v_right * -vecs.y + v_up * vecs.z; + + if(!W_DualWielding(this.realowner)) + dv = '0 0 0'; // don't override! + velspeed = vlen(this.velocity); makevectors(this.realowner.v_angle); desireddir = WarpZone_RefSys_TransformVelocity(this.realowner, this, v_forward); - desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs); + desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs + dv); olddir = normalize(this.velocity); // now it gets tricky... we want to move like some curve to approximate the target direction @@ -281,20 +289,20 @@ void W_Devastator_Touch(entity this, entity toucher) void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { - if(this.health <= 0) + if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0) return; if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - this.health = this.health - damage; + SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH) - damage); this.angles = vectoangles(this.velocity); - if(this.health <= 0) + if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0) W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode_think); } -void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity) +void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int fire) { W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo), weaponentity); @@ -316,7 +324,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity) missile.takedamage = DAMAGE_YES; missile.damageforcescale = WEP_CVAR(devastator, damageforcescale); - missile.health = WEP_CVAR(devastator, health); + SetResourceAmountExplicit(missile, RESOURCE_HEALTH, WEP_CVAR(devastator, health)); missile.event_damage = W_Devastator_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -334,6 +342,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity) setthink(missile, W_Devastator_Think); missile.nextthink = time; missile.cnt = time + WEP_CVAR(devastator, lifetime); + missile.rl_detonate_later = (fire & 2); // allow instant detonation missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); IL_PUSH(g_bot_dodge, missile); @@ -350,6 +359,11 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity) // common properties MUTATOR_CALLHOOK(EditProjectile, actor, missile); + + if (time >= missile.nextthink) + { + getthink(missile)(missile); + } } METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) @@ -423,7 +437,7 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponenti // but don't fire a new shot at the same time! if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events PHYS_INPUT_BUTTON_ATCK2(actor) = true; - if((skill > 6.5) && (selfdamage > actor.health)) + if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RESOURCE_HEALTH))) PHYS_INPUT_BUTTON_ATCK2(actor) = false; //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true) // dprint(ftos(desirabledamage),"\n"); @@ -441,7 +455,7 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen if(actor.(weaponentity).rl_release || WEP_CVAR(devastator, guidestop)) if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire))) { - W_Devastator_Attack(thiswep, actor, weaponentity); + W_Devastator_Attack(thiswep, actor, weaponentity, fire); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready); actor.(weaponentity).rl_release = 0; }