From 07c8f74cb88cadf8e790401dd8360908af34064c Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 20 Oct 2016 07:53:37 +1000 Subject: [PATCH] Make the target entity a parameter instead of spawning it, so the monster's spawn fields can be customized --- qcsrc/common/monsters/sv_spawn.qc | 4 +--- qcsrc/common/monsters/sv_spawn.qh | 2 +- qcsrc/common/mutators/mutator/nades/nades.qc | 2 +- qcsrc/server/command/common.qc | 2 +- qcsrc/server/mutators/mutator/gamemode_invasion.qc | 4 ++-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/qcsrc/common/monsters/sv_spawn.qc b/qcsrc/common/monsters/sv_spawn.qc index 6b9d4ea05..056379dbc 100644 --- a/qcsrc/common/monsters/sv_spawn.qc +++ b/qcsrc/common/monsters/sv_spawn.qc @@ -8,10 +8,8 @@ #include #include #endif -entity spawnmonster (string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag) +entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag) { - entity e = spawn(); - e.spawnflags = MONSTERFLAG_SPAWNED; if(!respwn) { e.spawnflags |= MONSTERFLAG_NORESPAWN; } diff --git a/qcsrc/common/monsters/sv_spawn.qh b/qcsrc/common/monsters/sv_spawn.qh index 00db84c1c..8e4d480cd 100644 --- a/qcsrc/common/monsters/sv_spawn.qh +++ b/qcsrc/common/monsters/sv_spawn.qh @@ -1,3 +1,3 @@ #pragma once -entity spawnmonster (string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag); +entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag); diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index b0c0e582a..d20940494 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -654,7 +654,7 @@ void nade_heal_boom(entity this) void nade_monster_boom(entity this) { - entity e = spawnmonster(this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1); + entity e = spawnmonster(spawn(), this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1); if(autocvar_g_nades_pokenade_monster_lifetime > 0) e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime; diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index ec1f9c89f..01997d903 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -391,7 +391,7 @@ void CommonCommand_editmob(int request, entity caller, int argc) totalspawned += 1; WarpZone_TraceBox(CENTER_OR_VIEWOFS(caller), caller.mins, caller.maxs, CENTER_OR_VIEWOFS(caller) + v_forward * 150, true, caller); - mon = spawnmonster(arg_lower, 0, caller, caller, trace_endpos, false, false, moveflag); + mon = spawnmonster(spawn(), arg_lower, 0, caller, caller, trace_endpos, false, false, moveflag); print_to(caller, strcat("Spawned ", mon.monster_name)); return; } diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index aa1a2643e..4c0976fe8 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -77,14 +77,14 @@ void invasion_SpawnChosenMonster(Monster mon) setsize(e, mon.mins, mon.maxs); if(MoveToRandomMapLocation(e, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256)) - monster = spawnmonster("", mon.m_id, NULL, NULL, e.origin, false, false, 2); + monster = spawnmonster(spawn(), "", mon.m_id, NULL, NULL, e.origin, false, false, 2); else return; setthink(e, SUB_Remove); e.nextthink = time + 0.1; } else // if spawnmob field falls through (unset), fallback to mon (relying on spawnmonster for that behaviour) - monster = spawnmonster(spawn_point.spawnmob, mon.m_id, spawn_point, spawn_point, spawn_point.origin, false, false, 2); + monster = spawnmonster(spawn(), spawn_point.spawnmob, mon.m_id, spawn_point, spawn_point, spawn_point.origin, false, false, 2); if(spawn_point) monster.target2 = spawn_point.target2; monster.spawnshieldtime = time; -- 2.39.2