]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/target/spawn.qc
Combine `SELFCALL` and `SELFCALL_DONE` with `WITH`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / target / spawn.qc
index 020e404d30684f760064897402dab069012805e9..6572221f75a9e008d6c7668e2ff15758a0fb32a7 100644 (file)
@@ -38,7 +38,6 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
        string key, value, valuefield, valueoffset, valueoffsetrandom;
        entity valueent;
        vector data, data2;
-       entity oldself;
        entity oldactivator;
 
        n = tokenize_console(msg);
@@ -220,15 +219,10 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                                value = strcat("target_spawn_helper", value);
                        putentityfieldstring(target_spawn_spawnfunc_field, e, value);
 
-                       oldself = self;
                        oldactivator = activator;
 
-                       self = e;
                        activator = act;
-
-                       self.target_spawn_spawnfunc();
-
-                       self = oldself;
+                       WITH(entity, self, e, e.target_spawn_spawnfunc());
                        activator = oldactivator;
 
                        // We called an external function, so we have to re-tokenize msg.