diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 848daa59c..ca0fb0712 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -1661,12 +1661,6 @@ static void PDECL PR_DoSpawnInitialEntity(pubprogfuncs_t *progfuncs, struct edic func_t f; char spawnfuncname[256]; - if ((int)ed->v->spawnflags & ctx->killonspawnflags) - { - ED_Free(progfuncs, (struct edict_s *)ed); - return; - } - if (!ctx->foundfuncs) { ctx->foundfuncs = true; @@ -1676,6 +1670,15 @@ static void PDECL PR_DoSpawnInitialEntity(pubprogfuncs_t *progfuncs, struct edic ctx->SV_OnEntityPostSpawnFunction = PR_FindFunction(progfuncs, "SV_OnEntityPostSpawnFunction", -2); } + //remove the entity if its spawnflags matches the ones we're killing on + //we skip this check if the mod has the CheckSpawn function defined. Such mods can do their own filtering easily enough. + //dpcompat: SV_OnEntityPreSpawnFunction does not inhibit this legacy behaviour (even though it really ought to). + if (!ctx->CheckSpawn && (int)ed->v->spawnflags & ctx->killonspawnflags) + { + ED_Free(progfuncs, (struct edict_s *)ed); + return; + } + if (ctx->SV_OnEntityPreSpawnFunction) { // void *pr_globals = PR_globals(progfuncs, PR_CURRENT);