]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix triggering of func_train
authorRudolf Polzer <divverent@alientrap.org>
Mon, 14 Feb 2011 19:33:50 +0000 (20:33 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 14 Feb 2011 19:33:50 +0000 (20:33 +0100)
qcsrc/server/t_plats.qc

index 97897d9cd717a2d2d5a1c7345544fae50f1d8080..0d682e419553ad4441268e6f57c8da7ce1fd83a7 100644 (file)
@@ -245,46 +245,46 @@ void spawnfunc_func_plat()
 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()
@@ -956,6 +956,8 @@ void door_use()
 {
        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)
        {