.float train_wait_turning;
void() train_next;
+#ifdef SVQC
+void train_use();
+#endif
void train_wait()
{SELFPARAM();
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
self.enemy = world;
// if turning is enabled, the train will turn toward the next point while waiting
stopsoundto(MSG_BROADCAST, self, CH_TRIGGER_SINGLE); // send this as unreliable only, as the train will resume operation shortly anyway
#endif
- if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning
+#ifdef SVQC
+ entity tg = find(world, targetname, self.target);
+ if(tg.spawnflags & 4)
+ {
+ self.use = train_use;
+ self.SUB_THINK = func_null;
+ self.SUB_NEXTTHINK = 0;
+ }
+ else
+#endif
+ if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning
{
self.train_wait_turning = false;
train_next();
void train_use()
{
+ SELFPARAM();
self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
self.SUB_THINK = train_next;
self.use = func_null; // not again
}
-void func_train_find()
-{SELFPARAM();
+void func_train_find(entity this)
+{
entity targ;
targ = find(world, targetname, self.target);
self.target = targ.target;