From 1682b9ed6b90aa31577ed8a03c8295aac58761ce Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Tue, 3 Apr 2012 23:28:06 +0300 Subject: [PATCH] A try at making dropped weapons physical. Requires the ODE library for darkplaces and physics_ode to be enabled --- qcsrc/server/cl_weapons.qc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index 94eaccd2da..12f4151766 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -302,6 +302,32 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto wep.savenextthink = wep.nextthink; wep.nextthink = min(wep.nextthink, time + 0.5); wep.pickup_anyway = TRUE; // these are ALWAYS pickable + + // make the dropped weapon physical + //if(autocvar_sv_ode && autocvar_physics_ode) + { + entity wep2; + wep2 = spawn(); + setorigin(wep2, wep.origin); + setmodel(wep2, wep.model); + wep2.angles = wep.angles; + wep2.velocity = velo; + + wep2.classname = "droppedweapon2"; + wep2.owner = wep; + wep2.solid = SOLID_BBOX; + wep2.movetype = MOVETYPE_PHYSICS; + wep2.takedamage = DAMAGE_AIM; + wep2.colormap = wep.colormap; + wep2.glowmod = wep.glowmod; + + wep2.damageforcescale = 3; + + wep.alpha = -1; + wep.movetype = MOVETYPE_FOLLOW; + wep.aiment = wep2; + } + return s; } } -- 2.39.2