#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
// 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;
float target_spawn_count;
void target_spawn_helper_setmodel()
-{
- setmodel(self, self.model);
+{SELFPARAM();
+ _setmodel(self, self.model);
}
void target_spawn_helper_setsize()
-{
+{SELFPARAM();
setsize(self, self.mins, self.maxs);
}
void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act)
-{
+{SELFPARAM();
float i, n, valuefieldpos;
string key, value, valuefield, valueoffset, valueoffsetrandom;
entity valueent;
vector data, data2;
- entity oldself;
entity oldactivator;
n = tokenize_console(msg);
if(valuefield == "")
{
if(value == "")
- value = ftos(num_for_edict(valueent));
+ value = ftos(etof(valueent));
}
else
{
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(e));
activator = oldactivator;
// We called an external function, so we have to re-tokenize msg.
}
void target_spawn_useon(entity e)
-{
+{SELFPARAM();
self.target_spawn_activator = activator;
target_spawn_edit_entity(
e,
}
float target_spawn_cancreate()
-{
+{SELFPARAM();
float c;
entity e;
}
void target_spawn_use()
-{
+{SELFPARAM();
entity e;
if(self.target == "")
if(!target_spawn_cancreate())
return;
e = spawn();
+ e.spawnfunc_checked = true;
target_spawn_useon(e);
e.target_spawn_id = self.target_spawn_id;
}
}
void target_spawn_spawnfirst()
-{
+{SELFPARAM();
activator = self.target_spawn_activator;
if(self.spawnflags & 2)
target_spawn_use();
}
}
-void spawnfunc_target_spawn()
+spawnfunc(target_spawn)
{
initialize_field_db();
self.use = target_spawn_use;