]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Merge remote-tracking branch 'origin/master' into terencehill/ca_arena_mutators
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index 051b476002e0563cedb3db7cdb9b78fc1e6755fd..fa8be67fe04bdcae11117eec41683166b2a74ae0 100644 (file)
@@ -32,7 +32,6 @@ void WarpZone_crosshair_trace(entity pl)
 void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints
 void() spawnpoint_use;
 string GetMapname();
-string ColoredTeamName(float t);
 
 string admin_name(void)
 {
@@ -67,26 +66,40 @@ float DistributeEvenly_Get(float weight)
     DistributeEvenly_amount -= f;
     return f;
 }
+float DistributeEvenly_GetRandomized(float weight)
+{
+    float f;
+    if (weight <= 0)
+        return 0;
+    f = floor(random() + DistributeEvenly_amount * weight / DistributeEvenly_totalweight);
+    DistributeEvenly_totalweight -= weight;
+    DistributeEvenly_amount -= f;
+    return f;
+}
 
 #define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
 
-
 string STR_PLAYER = "player";
 string STR_SPECTATOR = "spectator";
 string STR_OBSERVER = "observer";
 
-#if 0
-#define FOR_EACH_CLIENT(v) for(v = world; (v = findflags(v, flags, FL_CLIENT)) != world; )
-#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(clienttype(v) == CLIENTTYPE_REAL)
-#define FOR_EACH_PLAYER(v) for(v = world; (v = find(v, classname, STR_PLAYER)) != world; )
-#define FOR_EACH_REALPLAYER(v) FOR_EACH_PLAYER(v) if(clienttype(v) == CLIENTTYPE_REAL)
-#else
+#define IS_PLAYER(v)                   (v.classname == STR_PLAYER)
+#define IS_SPEC(v)                             (v.classname == STR_SPECTATOR)
+#define IS_OBSERVER(v)                         (v.classname == STR_OBSERVER)
+#define IS_CLIENT(v)                   (v.flags & FL_CLIENT)
+#define IS_BOT_CLIENT(v)               (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_REAL_CLIENT(v)              (clienttype(v) == CLIENTTYPE_REAL)
+#define IS_NOT_A_CLIENT(v)             (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+
 #define FOR_EACH_CLIENTSLOT(v) for(v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
-#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if(v.flags & FL_CLIENT)
-#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(clienttype(v) == CLIENTTYPE_REAL)
-#define FOR_EACH_PLAYER(v) FOR_EACH_CLIENT(v) if(v.classname == STR_PLAYER)
-#define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if(v.classname == STR_PLAYER)
-#endif
+#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if(IS_CLIENT(v))
+#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(IS_REAL_CLIENT(v))
+
+#define FOR_EACH_PLAYER(v) FOR_EACH_CLIENT(v) if(IS_PLAYER(v))
+#define FOR_EACH_SPEC(v) FOR_EACH_CLIENT(v) if not(IS_PLAYER(v)) // Samual: shouldn't this be IS_SPEC(v)? and rather create a separate macro to include observers too
+#define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if(IS_PLAYER(v))
+
+#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
 
 // copies a string to a tempstring (so one can strunzone it)
 string strcat1(string s) = #115; // FRIK_FILE
@@ -94,15 +107,6 @@ string strcat1(string s) = #115; // FRIK_FILE
 float logfile_open;
 float logfile;
 
-void bcenterprint(string s)
-{
-    // TODO replace by MSG_ALL (would show it to spectators too, though)?
-    entity head;
-    FOR_EACH_PLAYER(head)
-    if (clienttype(head) == CLIENTTYPE_REAL)
-        centerprint(head, s);
-}
-
 void GameLogEcho(string s)
 {
     string fn;
@@ -415,7 +419,7 @@ string formatmessage(string msg)
                        else replacement = "batteries"; // ;)
                } else if (escape == "x") {
                        replacement = cursor_ent.netname;
-                       if (!replacement || !cursor_ent)
+                       if (replacement == "" || !cursor_ent)
                                replacement = "nothing";
                } else if (escape == "s")
                        replacement = ftos(vlen(self.velocity - self.velocity_z * '0 0 1'));
@@ -526,14 +530,18 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo)
 }
 void GetCvars(float f)
 {
-       string s;
+       string s = string_null;
 
        if (f > 0)
                s = strcat1(argv(f));
 
        get_cvars_f = f;
        get_cvars_s = s;
+
        MUTATOR_CALLHOOK(GetCvars);
+
+       Notification_GetCvars();
+
        GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch");
        GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot");
        GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
@@ -561,10 +569,6 @@ void GetCvars(float f)
        self.cvar_cl_accuracy_data_share = boolean(self.cvar_cl_accuracy_data_share);
        self.cvar_cl_accuracy_data_receive = boolean(self.cvar_cl_accuracy_data_receive);
 
-#ifdef ALLOW_FORCEMODELS
-       GetCvars_handleFloat(s, f, cvar_cl_forceplayermodels, "cl_forceplayermodels");
-       GetCvars_handleFloat(s, f, cvar_cl_forceplayermodelsfromxonotic, "cl_forceplayermodelsfromxonotic");
-#endif
        GetCvars_handleFloatOnce(s, f, cvar_cl_gunalign, "cl_gunalign");
        GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name");
        GetCvars_handleFloat(s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
@@ -581,102 +585,6 @@ void GetCvars(float f)
        }
 }
 
-void backtrace(string msg)
-{
-    float dev, war;
-    dev = autocvar_developer;
-    war = autocvar_prvm_backtraceforwarnings;
-    cvar_set("developer", "1");
-    cvar_set("prvm_backtraceforwarnings", "1");
-    print("\n");
-    print("--- CUT HERE ---\nWARNING: ");
-    print(msg);
-    print("\n");
-    remove(world); // isn't there any better way to cause a backtrace?
-    print("\n--- CUT UNTIL HERE ---\n");
-    cvar_set("developer", ftos(dev));
-    cvar_set("prvm_backtraceforwarnings", ftos(war));
-}
-
-string Team_ColorCode(float teamid)
-{
-    if (teamid == COLOR_TEAM1)
-        return "^1";
-    else if (teamid == COLOR_TEAM2)
-        return "^4";
-    else if (teamid == COLOR_TEAM3)
-        return "^3";
-    else if (teamid == COLOR_TEAM4)
-        return "^6";
-    else
-        return "^7";
-}
-
-string Team_ColorName(float t)
-{
-    // fixme: Search for team entities and get their .netname's!
-    if (t == COLOR_TEAM1)
-        return "Red";
-    if (t == COLOR_TEAM2)
-        return "Blue";
-    if (t == COLOR_TEAM3)
-        return "Yellow";
-    if (t == COLOR_TEAM4)
-        return "Pink";
-    return "Neutral";
-}
-
-string Team_ColorNameLowerCase(float t)
-{
-    // fixme: Search for team entities and get their .netname's!
-    if (t == COLOR_TEAM1)
-        return "red";
-    if (t == COLOR_TEAM2)
-        return "blue";
-    if (t == COLOR_TEAM3)
-        return "yellow";
-    if (t == COLOR_TEAM4)
-        return "pink";
-    return "neutral";
-}
-
-float ColourToNumber(string team_colour)
-{
-       if (team_colour == "red")
-               return COLOR_TEAM1;
-
-       if (team_colour == "blue")
-               return COLOR_TEAM2;
-
-       if (team_colour == "yellow")
-               return COLOR_TEAM3;
-
-       if (team_colour == "pink")
-               return COLOR_TEAM4;
-
-       if (team_colour == "auto")
-               return 0;
-
-       return -1;
-}
-
-float NumberToTeamNumber(float number)
-{
-       if (number == 1)
-               return COLOR_TEAM1;
-
-       if (number == 2)
-               return COLOR_TEAM2;
-
-       if (number == 3)
-               return COLOR_TEAM3;
-
-       if (number == 4)
-               return COLOR_TEAM4;
-
-       return -1;
-}
-
 // decolorizes and team colors the player name when needed
 string playername(entity p)
 {
@@ -772,7 +680,6 @@ float warmup_start_ammo_fuel;
 float warmup_start_health;
 float warmup_start_armorvalue;
 float g_weapon_stay;
-float g_ghost_items;
 
 entity get_weaponinfo(float w);
 
@@ -785,13 +692,19 @@ float want_weapon(string cvarprefix, entity weaponinfo, float allguns)
                return 0;
 
        if (g_lms || g_ca || allguns)
-               d = (weaponinfo.spawnflags & WEP_FLAG_NORMAL);
+       {
+               if(weaponinfo.spawnflags & WEP_FLAG_NORMAL)
+                       d = TRUE;
+               else
+                       d = FALSE;
+       }
        else if (g_cts)
                d = (i == WEP_SHOTGUN);
        else if (g_nexball)
                d = 0; // weapon is set a few lines later
        else
                d = (i == WEP_LASER || i == WEP_SHOTGUN);
+               
        if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook
                d |= (i == WEP_HOOK);
        if(weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED) // never default mutator blocked guns
@@ -799,6 +712,8 @@ float want_weapon(string cvarprefix, entity weaponinfo, float allguns)
 
        var float t = cvar(strcat(cvarprefix, weaponinfo.netname));
        
+       //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n"));
+       
        // bit order in t:
        // 1: want or not
        // 2: is default?
@@ -852,8 +767,11 @@ void readplayerstartcvars()
                g_weaponarena = 1;
                g_weaponarena_list = "All Weapons";
                for (j = WEP_FIRST; j <= WEP_LAST; ++j)
+               {
+                       e = get_weaponinfo(j);
                        if not(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
                                WEPSET_OR_AW(g_weaponarena_weapons, j);
+               }
        }
        else if (s == "most")
        {
@@ -1010,6 +928,8 @@ void readplayerstartcvars()
                        warmup_start_health = cvar("g_warmup_start_health");
                        warmup_start_armorvalue = cvar("g_warmup_start_armor");
                        WEPSET_CLEAR_A(warmup_start_weapons);
+                       WEPSET_CLEAR_A(warmup_start_weapons_default);
+                       WEPSET_CLEAR_A(warmup_start_weapons_defaultmask);
                        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
                        {
                                e = get_weaponinfo(i);
@@ -1073,19 +993,9 @@ float g_bugrigs_speed_ref;
 float g_bugrigs_speed_pow;
 float g_bugrigs_steer;
 
-float g_touchexplode;
-float g_touchexplode_radius;
-float g_touchexplode_damage;
-float g_touchexplode_edgedamage;
-float g_touchexplode_force;
-
 float sv_autotaunt;
 float sv_taunt;
 
-float sv_pitch_min;
-float sv_pitch_max;
-float sv_pitch_fixyaw;
-
 string GetGametype(); // g_world.qc
 void readlevelcvars(void)
 {
@@ -1096,6 +1006,10 @@ void readlevelcvars(void)
                MUTATOR_ADD(mutator_dodging);
        if(cvar("g_spawn_near_teammate"))
                MUTATOR_ADD(mutator_spawn_near_teammate);
+       if(cvar("g_physical_items"))
+               MUTATOR_ADD(mutator_physical_items);
+       if(cvar("g_touchexplode"))
+               MUTATOR_ADD(mutator_touchexplode);
        if(!g_minstagib)
        {
                if(cvar("g_invincible_projectiles"))
@@ -1107,7 +1021,9 @@ void readlevelcvars(void)
                if(cvar("g_rocket_flying"))
                        MUTATOR_ADD(mutator_rocketflying);
                if(cvar("g_vampire"))
-                       MUTATOR_ADD(mutator_vampire);
+                       MUTATOR_ADD(mutator_vampire);           
+               if(cvar("g_superspectate"))
+                       MUTATOR_ADD(mutator_superspec);
        }
 
        // is this a mutator? is this a mode?
@@ -1133,18 +1049,7 @@ void readlevelcvars(void)
     g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
     g_bugrigs_steer = cvar("g_bugrigs_steer");
 
-    g_touchexplode = cvar("g_touchexplode");
-    g_touchexplode_radius = cvar("g_touchexplode_radius");
-    g_touchexplode_damage = cvar("g_touchexplode_damage");
-    g_touchexplode_edgedamage = cvar("g_touchexplode_edgedamage");
-    g_touchexplode_force = cvar("g_touchexplode_force");
-
-#ifdef ALLOW_FORCEMODELS
-       sv_clforceplayermodels = cvar("sv_clforceplayermodels");
-#endif
-
        sv_clones = cvar("sv_clones");
-       sv_gentle = cvar("sv_gentle");
        sv_foginterval = cvar("sv_foginterval");
        g_cloaked = cvar("g_cloaked");
     if(g_cts)
@@ -1158,7 +1063,6 @@ void readlevelcvars(void)
        g_bloodloss = cvar("g_bloodloss");
        sv_maxidle = cvar("sv_maxidle");
        sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
-       g_ctf_reverse = cvar("g_ctf_reverse");
        sv_autotaunt = cvar("sv_autotaunt");
        sv_taunt = cvar("sv_taunt");
 
@@ -1167,7 +1071,7 @@ void readlevelcvars(void)
        g_warmup_allguns = cvar("g_warmup_allguns");
        g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
 
-       if ((g_race && g_race_qualifying == 2) || g_runematch || g_arena || g_assault || cvar("g_campaign"))
+       if ((g_race && g_race_qualifying == 2) || g_arena || g_assault || cvar("g_campaign"))
                inWarmupStage = 0; // these modes cannot work together, sorry
 
        g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon");
@@ -1236,17 +1140,8 @@ void readlevelcvars(void)
     if(!g_weapon_stay)
         g_weapon_stay = cvar("g_weapon_stay");
 
-       g_ghost_items = cvar("g_ghost_items");
-
-       if(g_ghost_items >= 1)
-               g_ghost_items = 0.25; // default alpha value
-
-       if not(inWarmupStage && !g_ca)
-               game_starttime = cvar("g_start_delay");
-
-       sv_pitch_min = cvar("sv_pitch_min");
-       sv_pitch_max = cvar("sv_pitch_max");
-       sv_pitch_fixyaw = cvar("sv_pitch_fixyaw");
+       if not(inWarmupStage)
+               game_starttime = time + cvar("g_start_delay");
 
        readplayerstartcvars();
 }
@@ -1509,11 +1404,6 @@ void precache()
 {
     // gamemode related things
     precache_model ("models/misc/chatbubble.spr");
-    if (g_runematch)
-    {
-        precache_model ("models/runematch/curse.mdl");
-        precache_model ("models/runematch/rune.mdl");
-    }
 
 #ifdef TTURRETS_ENABLED
     if (autocvar_g_turrets)
@@ -1578,9 +1468,6 @@ void precache()
     precache_sound ("player/lava.wav");
     precache_sound ("player/slime.wav");
 
-    if (g_jetpack)
-        precache_sound ("misc/jetpack_fly.wav");
-
     precache_model ("models/sprites/0.spr32");
     precache_model ("models/sprites/1.spr32");
     precache_model ("models/sprites/2.spr32");
@@ -1636,34 +1523,6 @@ void precache()
 #endif
 }
 
-// sorry, but using \ in macros breaks line numbers
-#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname
-#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement)
-#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0
-
-
-void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num)
-{
-       if ((clienttype(e) == CLIENTTYPE_REAL) && (e.flags & FL_CLIENT))
-       {
-               msg_entity = e;
-               WRITESPECTATABLE_MSG_ONE({
-                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                       WriteByte(MSG_ONE, TE_CSQC_CENTERPRINT_GENERIC);
-                       WriteByte(MSG_ONE, id);
-                       WriteString(MSG_ONE, s);
-                       if (id != 0 && s != "")
-                       {
-                               WriteByte(MSG_ONE, duration);
-                               WriteByte(MSG_ONE, countdown_num);
-                       }
-               });
-       }
-}
-void Send_CSQC_Centerprint_Generic_Expire(entity e, float id)
-{
-       Send_CSQC_Centerprint_Generic(e, id, "", 1, 0);
-}
 // WARNING: this kills the trace globals
 #define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch()) return
 #define EXACTTRIGGER_INIT  WarpZoneLib_ExactTrigger_Init()
@@ -1686,7 +1545,7 @@ void make_safe_for_remove(entity e)
 {
     if (e.initialize_entity)
     {
-        entity ent, prev;
+        entity ent, prev = world;
         for (ent = initialize_entity_first; ent; )
         {
             if ((ent == e) || ((ent.classname == "initialize_entity") && (ent.enemy == e)))
@@ -1758,6 +1617,7 @@ void InitializeEntity(entity e, void(void) func, float order)
     e.initialize_entity_order = order;
 
     cur = initialize_entity_first;
+    prev = world;
     for (;;)
     {
         if (!cur || cur.initialize_entity_order > order)
@@ -1802,7 +1662,7 @@ void InitializeEntitiesRun()
             self = e_old;
         }
         //dprint("Delayed initialization: ", self.classname, "\n");
-        if(func != func_null)
+        if(func)
             func();
         else
         {
@@ -1816,7 +1676,6 @@ void InitializeEntitiesRun()
 
 .float uncustomizeentityforclient_set;
 .void(void) uncustomizeentityforclient;
-void(void) SUB_Nullpointer = #0;
 void UncustomizeEntitiesRun()
 {
     entity oldself;
@@ -1829,7 +1688,7 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer)
 {
     e.customizeentityforclient = customizer;
     e.uncustomizeentityforclient = uncustomizer;
-    e.uncustomizeentityforclient_set = (uncustomizer != SUB_Nullpointer);
+    e.uncustomizeentityforclient_set = !!uncustomizer;
 }
 
 .float nottargeted;
@@ -2016,6 +1875,9 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback()
 }
 #define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
 
+#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP))
+
 void URI_Get_Callback(float id, float status, string data)
 {
        if(url_URI_Get_Callback(id, status, data))
@@ -2105,7 +1967,7 @@ void race_writeTime(string map, float t, string myuid)
        float newpos;
        newpos = race_readPos(map, t);
 
-       float i, prevpos;
+       float i, prevpos = 0;
        for(i = 1; i <= RANKINGS_CNT; ++i)
        {
                if(race_readUID(map, i) == myuid)
@@ -2139,22 +2001,6 @@ string race_readName(string map, float pos)
        return uid2name(db_get(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(pos))));
 }
 
-string race_placeName(float pos) {
-       if(floor((mod(pos, 100))/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block
-       {
-               if(mod(pos, 10) == 1)
-                       return strcat(ftos(pos), "st");
-               else if(mod(pos, 10) == 2)
-                       return strcat(ftos(pos), "nd");
-               else if(mod(pos, 10) == 3)
-                       return strcat(ftos(pos), "rd");
-               else
-                       return strcat(ftos(pos), "th");
-       }
-       else
-               return strcat(ftos(pos), "th");
-}
-
 float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
 {
     float m, i;
@@ -2167,6 +2013,8 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
     org = world.mins;
     delta = world.maxs - world.mins;
 
+    start = end = org;
+
     for (i = 0; i < attempts; ++i)
     {
         start_x = org_x + random() * delta_x;
@@ -2383,8 +2231,8 @@ vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float
        {
                if (visual)
                {
-                       vecs_y = 0;
-                       vecs_z -= 2;
+                       if (autocvar_g_shootfromclient) { vecs = shotorg_adjustfromclient(vecs, y_is_right, (autocvar_g_shootfromclient >= 2), algn); }
+                       else { vecs_y = 0; vecs_z -= 2; }
                }
                else
                {
@@ -2423,12 +2271,8 @@ vector shotorg_adjust(vector vecs, float y_is_right, float visual)
 void attach_sameorigin(entity e, entity to, string tag)
 {
     vector org, t_forward, t_left, t_up, e_forward, e_up;
-    vector org0, ang0;
     float tagscale;
 
-    ang0 = e.angles;
-    org0 = e.origin;
-
     org = e.origin - gettaginfo(to, gettagindex(to, tag));
     tagscale = pow(vlen(v_forward), -2); // undo a scale on the tag
     t_forward = v_forward * tagscale;
@@ -2506,43 +2350,6 @@ vector gettaginfo_relative(entity e, float tag)
     return gettaginfo(gettaginfo_relative_ent, tag);
 }
 
-void SoundEntity_StartSound(entity pl, float chan, string samp, float vol, float attn)
-{
-    float p;
-    p = pow(2, chan);
-    if (pl.soundentity.cnt & p)
-        return;
-    soundtoat(MSG_ALL, pl.soundentity, gettaginfo(pl.soundentity, 0), chan, samp, vol, attn);
-    pl.soundentity.cnt |= p;
-}
-
-void SoundEntity_StopSound(entity pl, float chan)
-{
-    float p;
-    p = pow(2, chan);
-    if (pl.soundentity.cnt & p)
-    {
-        stopsoundto(MSG_ALL, pl.soundentity, chan);
-        pl.soundentity.cnt &~= p;
-    }
-}
-
-void SoundEntity_Attach(entity pl)
-{
-    pl.soundentity = spawn();
-    pl.soundentity.classname = "soundentity";
-    pl.soundentity.owner = pl;
-    setattachment(pl.soundentity, pl, "");
-    setmodel(pl.soundentity, "null");
-}
-
-void SoundEntity_Detach(entity pl)
-{
-    float i;
-    for (i = 0; i <= 7; ++i)
-        SoundEntity_StopSound(pl, i);
-}
-
 .float scale2;
 
 float modeleffect_SendEntity(entity to, float sf)
@@ -2776,6 +2583,8 @@ float isPushable(entity e)
 {
        if(e.iscreature)
                return TRUE;
+       if(e.pushable)
+               return TRUE;
        switch(e.classname)
        {
                case "body":