]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/target/spawn.qc
Merge branch 'terencehill/menu_optimization' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / target / spawn.qc
index 6572221f75a9e008d6c7668e2ff15758a0fb32a7..96c266f6cc57315e2436e3f752321b83405a5ab8 100644 (file)
@@ -1,9 +1,8 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
-       #include "../../../server/_all.qh"
-    #include "../../util.qh"
-    #include "../../../server/defs.qh"
+    #include <common/util.qh>
+    #include <server/defs.qh>
 #endif
 
 #ifdef SVQC
@@ -16,7 +15,7 @@
 //   2 = trigger on map load
 
 float target_spawn_initialized;
-.void() target_spawn_spawnfunc;
+.void(entity this) target_spawn_spawnfunc;
 float target_spawn_spawnfunc_field;
 .entity target_spawn_activator;
 .float target_spawn_id;
@@ -24,7 +23,7 @@ float target_spawn_count;
 
 void target_spawn_helper_setmodel()
 {SELFPARAM();
-       setmodel(self, self.model);
+       _setmodel(self, self.model);
 }
 
 void target_spawn_helper_setsize()
@@ -158,7 +157,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                                if(valuefield == "")
                                {
                                        if(value == "")
-                                               value = ftos(num_for_edict(valueent));
+                                               value = ftos(etof(valueent));
                                }
                                else
                                {
@@ -222,7 +221,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                        oldactivator = activator;
 
                        activator = act;
-                       WITH(entity, self, e, e.target_spawn_spawnfunc());
+                       WITH(entity, self, e, e.target_spawn_spawnfunc(e));
                        activator = oldactivator;
 
                        // We called an external function, so we have to re-tokenize msg.
@@ -280,6 +279,7 @@ void target_spawn_use()
                if(!target_spawn_cancreate())
                        return;
                e = spawn();
+               e.spawnfunc_checked = true;
                target_spawn_useon(e);
                e.target_spawn_id = self.target_spawn_id;
        }
@@ -332,8 +332,8 @@ void initialize_field_db()
        }
 }
 
-void spawnfunc_target_spawn()
-{SELFPARAM();
+spawnfunc(target_spawn)
+{
        initialize_field_db();
        self.use = target_spawn_use;
        self.message = strzone(strreplace("'", "\"", self.message));