]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/sv_main.qc
Add rudimentary support for surfaceparm nodamage (negates fall damage)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / sv_main.qc
index 6b5b19d79ec8a60d141da4248e547b8deaca1480..345b7fdb836964b8e184c7e00c3d4ff46b23a08e 100644 (file)
@@ -120,7 +120,11 @@ void CreatureFrame_FallDamage(entity this)
                else
                        dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage);
                if (dm > 0)
-                       Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
+               {
+                       tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
+                       if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODAMAGE))
+                               Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
+               }
        }
 
        if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
@@ -324,14 +328,17 @@ void SV_OnEntityPreSpawnFunction(entity this)
        if (this.gametypefilter != "")
        if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, this.gametypefilter))
        {
-               goto cleanup;
+               delete(this);
+               return;
        }
        if (this.cvarfilter != "" && !expr_evaluate(this.cvarfilter)) {
-        goto cleanup;
+               delete(this);
+               return;
        }
 
        if (DoesQ3ARemoveThisEntity(this)) {
-               goto cleanup;
+               delete(this);
+               return;
        }
 
        set_movetype(this, this.movetype);
@@ -356,11 +363,9 @@ void SV_OnEntityPreSpawnFunction(entity this)
     #undef X
 
        if (MUTATOR_CALLHOOK(OnEntityPreSpawn, this)) {
-               goto cleanup;
+               delete(this);
+               return;
        }
-       return;
-LABEL(cleanup)
-    delete(this);
 }
 
 void WarpZone_PostInitialize_Callback()