From: Mario Date: Tue, 14 Jan 2020 16:22:21 +0000 (+1000) Subject: Do traces for shot origin when the racer is actually going to fire, instead of every... X-Git-Tag: xonotic-v0.8.5~1105^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4327985ac413f5ef10ff7fc668e34f2fc7fe4952;p=xonotic%2Fxonotic-data.pk3dir.git Do traces for shot origin when the racer is actually going to fire, instead of every frame the player has the button held, fixes some inconsistencies with racer cannon alternation --- diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index e2a259394..87804586a 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -291,15 +291,6 @@ bool racer_frame(entity this, float dt) if (PHYS_INPUT_BUTTON_ATCK(player)) if (wep1.wr_checkammo1(wep1, vehic, weaponentity)) { - string tagname = (vehic.cnt) - ? (vehic.cnt = 0, "tag_fire1") - : (vehic.cnt = 1, "tag_fire2"); - vector org = gettaginfo(vehic, gettagindex(vehic, tagname)); - w_shotorg = org; - w_shotdir = v_forward; - // Fix z-aim (for chase mode) - crosshair_trace(player); - w_shotdir.z = normalize(trace_endpos - org).z * 0.5; wep1.wr_think(wep1, vehic, weaponentity, 1); } diff --git a/qcsrc/common/vehicles/vehicle/racer_weapon.qc b/qcsrc/common/vehicles/vehicle/racer_weapon.qc index 30a1873ac..f7253d8d8 100644 --- a/qcsrc/common/vehicles/vehicle/racer_weapon.qc +++ b/qcsrc/common/vehicles/vehicle/racer_weapon.qc @@ -14,6 +14,16 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weapone veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost; veh.wait = time; } + string tagname = (veh.cnt) + ? (veh.cnt = 0, "tag_fire1") + : (veh.cnt = 1, "tag_fire2"); + vector shotorg = gettaginfo(veh, gettagindex(veh, tagname)); + w_shotorg = shotorg; + w_shotdir = v_forward; + // Fix z-aim (for chase mode) + crosshair_trace(player); + w_shotdir.z = normalize(trace_endpos - shotorg).z * 0.5; + if (isPlayer) W_SetupShot_Dir(player, weaponentity, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0, DEATH_VH_WAKI_GUN.m_id); vector org = w_shotorg; vector dir = w_shotdir;