From: FruitieX Date: Tue, 22 May 2012 20:47:06 +0000 (+0300) Subject: implement the first part of my laser idea (force calculations when you aim straight... X-Git-Tag: xonotic-v0.8.0~152^2~408^2~85 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=89fc7f16c912d53ae51cbc3218744fe472df9e44;p=xonotic%2Fxonotic-data.pk3dir.git implement the first part of my laser idea (force calculations when you aim straight at a player) --- diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index 5d9aebe83..8e41a6fda 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -47,7 +47,7 @@ void W_Laser_Shockwave (void) { // declarations float final_damage, final_spread; - entity head, next; + entity head, next, aim_ent; vector nearest, attack_endpos, angle_to_head, angle_to_attack, final_force; // set up the shot direction @@ -68,20 +68,28 @@ void W_Laser_Shockwave (void) { // find out what i'm pointing at targpos = (w_shotorg + (w_shotdir * autocvar_g_balance_laser_primary_radius)); - WarpZone_TraceLine(w_shotorg, targpos, MOVE_WORLDONLY, self); + WarpZone_TraceLine(w_shotorg, targpos, FALSE, self); //te_lightning2(world, trace_endpos, w_shotorg); + aim_ent = trace_ent; attack_endpos = trace_endpos; //total_attack_range = vlen(w_shotorg - trace_endpos); - // now figure out if I hit anything... + if(aim_ent.takedamage) // we actually aimed at a player + { + final_force = (normalize(aim_ent.origin - attack_endpos) * autocvar_g_balance_laser_primary_force); + Damage(aim_ent, self, self, autocvar_g_balance_laser_primary_damage, WEP_LASER, w_shotorg, final_force); + print("Player hit directly via aim!\n"); + } + + // now figure out if I hit anything else than what my aim pointed at... head = WarpZone_FindRadius(attack_endpos, vlen(w_shotorg - trace_endpos) + MAX_DAMAGEEXTRARADIUS, FALSE); while(head) { next = head.chain; - if((head != self) && (head.takedamage)) + if((head != self && head != aim_ent) && (head.takedamage)) { // is it in range of the attack? nearest = WarpZoneLib_NearestPointOnBox(head.origin + head.mins, head.origin + head.maxs, w_shotorg);