void() train_next;
void train_wait()
{
- self.think = train_next;
- self.nextthink = self.ltime + self.wait;
-
if(self.noise != "")
stopsoundto(MSG_BROADCAST, self, CHAN_TRIGGER); // send this as unreliable only, as the train will resume operation shortly anyway
+
+ if(self.wait < 0)
+ {
+ train_next();
+ }
+ else
+ {
+ self.think = train_next;
+ self.nextthink = self.ltime + self.wait;
+ }
+
+ entity oldself;
+ oldself = self;
+ self = self.enemy;
+ SUB_UseTargets();
+ self = oldself;
+ self.enemy = world;
};
void train_next()
{
local entity targ;
targ = find(world, targetname, self.target);
+ self.enemy = targ;
self.target = targ.target;
if (!self.target)
objerror("train_next: no next target");
self.wait = targ.wait;
if (!self.wait)
self.wait = 0.1;
- if(self.wait < 0)
- {
- if (targ.speed)
- SUB_CalcMove(targ.origin - self.mins, targ.speed, train_next);
- else
- SUB_CalcMove(targ.origin - self.mins, self.speed, train_next);
- }
+
+ if (targ.speed)
+ SUB_CalcMove(targ.origin - self.mins, targ.speed, train_wait);
else
- {
- if (targ.speed)
- SUB_CalcMove(targ.origin - self.mins, targ.speed, train_wait);
- else
- SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait);
- }
+ SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait);
if(self.noise != "")
sound(self, CHAN_TRIGGER, self.noise, VOL_BASE, ATTN_IDLE);
-
- entity oldself;
- oldself = self;
- self = targ;
- SUB_UseTargets();
- self = oldself;
};
void func_train_find()
{
local entity oself;
+ print(sprintf("door_use: self=%s owner=%s fire\n", self.targetname, self.owner.targetname));
+
//dprint("door_use (model: ");dprint(self.model);dprint(")\n");
if (self.owner)
{