void() train_next;
void train_wait()
{SELFPARAM();
- SELFCALL(self.enemy, SUB_UseTargets());
- SELFCALL_DONE();
+ WITH(entity, self, self.enemy, SUB_UseTargets());
self.enemy = world;
// if turning is enabled, the train will turn toward the next point while waiting
}
if(self.noise != "")
- sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE);
+ _sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE);
}
#ifdef SVQC
float train_send(entity to, float sf)
{SELFPARAM();
- WriteByte(MSG_ENTITY, ENT_CLIENT_TRAIN);
+ WriteHeader(MSG_ENTITY, ENT_CLIENT_TRAIN);
WriteByte(MSG_ENTITY, sf);
if(sf & SF_TRIGGER_INIT)
//Net_LinkEntity(self, 0, false, train_send);
}
+void train_use()
+{
+ self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
+ self.SUB_THINK = train_next;
+ self.use = func_null; // not again
+}
+
void func_train_find()
{SELFPARAM();
entity targ;
if (self.target == "")
objerror("func_train_find: no next target");
SUB_SETORIGIN(self, targ.origin - self.view_ofs);
- self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
- self.SUB_THINK = train_next;
+
+ if(!(self.spawnflags & 4))
+ {
+ self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
+ self.SUB_THINK = train_next;
+ }
train_link();
}
target : targetname of first spawnfunc_path_corner (starts here)
*/
#ifdef SVQC
-void spawnfunc_func_train()
-{SELFPARAM();
+spawnfunc(func_train)
+{
if (self.noise != "")
precache_sound(self.noise);
return;
self.effects |= EF_LOWPRECISION;
+ if(self.spawnflags & 4)
+ self.use = train_use;
+
if (self.spawnflags & 2)
{
self.platmovetype_turn = true;
// TODO make a reset function for this one
}
#elif defined(CSQC)
-void train_draw()
+void train_draw(entity this)
{
//Movetype_Physics_NoMatchServer();
Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
self.spawnflags = ReadByte();
self.model = strzone(ReadString());
- setmodel(self, self.model);
+ _setmodel(self, self.model);
trigger_common_read(true);