X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fdevastator.qc;h=a6473b39274c552dc2520dc218b08cfb42fcbc91;hp=821ffb8ed51d932a55d187cfd568b85b3893471e;hb=646e82672a7a8b8db0be0caf5dbd062b0d04da96;hpb=590f996c6db674629b6e4410338d0f93b4e936d8 diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 821ffb8ed..a6473b392 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -40,6 +40,7 @@ CLASS(Devastator, Weapon) P(class, prefix, remote_edgedamage, float, NONE) \ P(class, prefix, remote_force, float, NONE) \ P(class, prefix, remote_jump_damage, float, NONE) \ + P(class, prefix, remote_jump_force, float, NONE) \ P(class, prefix, remote_jump_radius, float, NONE) \ P(class, prefix, remote_jump_velocity_z_add, float, NONE) \ P(class, prefix, remote_jump_velocity_z_max, float, NONE) \ @@ -142,50 +143,56 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) this.event_damage = func_null; this.takedamage = DAMAGE_NO; - float handled_as_rocketjump = false; + bool handled_as_rocketjump = false; + entity head = NULL; - entity head = WarpZone_FindRadius( - this.origin, - WEP_CVAR(devastator, remote_jump_radius), - false - ); - - while(head) + if(WEP_CVAR(devastator, remote_jump_radius)) { - if(head.takedamage && (head == this.realowner)) + head = WarpZone_FindRadius( + this.origin, + WEP_CVAR(devastator, remote_jump_radius), + false + ); + + while(head) { - float distance_to_head = vlen(this.origin - head.WarpZone_findradius_nearest); - if(distance_to_head <= WEP_CVAR(devastator, remote_jump_radius)) + if(head.takedamage && (head == this.realowner)) { - // we handled this as a rocketjump :) - handled_as_rocketjump = true; - - // modify velocity - head.velocity_x *= 0.9; - head.velocity_y *= 0.9; - head.velocity_z = bound( - WEP_CVAR(devastator, remote_jump_velocity_z_min), - head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add), - WEP_CVAR(devastator, remote_jump_velocity_z_max) - ); - - // now do the damage - RadiusDamage( - this, - head, - WEP_CVAR(devastator, remote_jump_damage), - WEP_CVAR(devastator, remote_jump_damage), - WEP_CVAR(devastator, remote_jump_radius), - NULL, - head, - 0, - this.projectiledeathtype | HITTYPE_BOUNCE, - NULL - ); - break; + if(vdist(this.origin - head.WarpZone_findradius_nearest, <=, WEP_CVAR(devastator, remote_jump_radius))) + { + // we handled this as a rocketjump :) + handled_as_rocketjump = true; + + // modify velocity + if(WEP_CVAR(devastator, remote_jump_velocity_z_add)) + { + head.velocity_x *= 0.9; + head.velocity_y *= 0.9; + head.velocity_z = bound( + WEP_CVAR(devastator, remote_jump_velocity_z_min), + head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add), + WEP_CVAR(devastator, remote_jump_velocity_z_max) + ); + } + + // now do the damage + RadiusDamage( + this, + head, + WEP_CVAR(devastator, remote_jump_damage), + WEP_CVAR(devastator, remote_jump_damage), + WEP_CVAR(devastator, remote_jump_radius), + NULL, + head, + (WEP_CVAR(devastator, remote_jump_force) ? WEP_CVAR(devastator, remote_jump_force) : 0), + this.projectiledeathtype | HITTYPE_BOUNCE, + NULL + ); + break; + } } + head = head.chain; } - head = head.chain; } RadiusDamage( @@ -383,6 +390,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity) missile.health = WEP_CVAR(devastator, health); missile.event_damage = W_Devastator_Damage; missile.damagedbycontents = true; + IL_PUSH(g_damagedbycontents, missile); set_movetype(missile, MOVETYPE_FLY); PROJECTILE_MAKETRIGGER(missile); @@ -415,10 +423,10 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity) MUTATOR_CALLHOOK(EditProjectile, actor, missile); } -METHOD(Devastator, wr_aim, void(entity thiswep, entity actor)) +METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { // aim and decide to fire if appropriate - PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! { // decide whether to detonate rockets @@ -529,13 +537,9 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen } } } -METHOD(Devastator, wr_setup, void(entity thiswep, entity actor)) +METHOD(Devastator, wr_setup, void(entity thiswep, entity actor, .entity weaponentity)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - actor.(weaponentity).rl_release = 1; - } + actor.(weaponentity).rl_release = 1; } METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) {