]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/train.qc
Merge branch 'DefaultUser/gametype_votescreen' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / train.qc
index 015668328a3c32e0843ab78d7bc7c9181b1e7543..dd9eaac860a5efe24dc0f7d09b71569b356f5fc2 100644 (file)
@@ -1,3 +1,4 @@
+#include "train.qh"
 .float train_wait_turning;
 void train_next(entity this);
 #ifdef SVQC
@@ -6,18 +7,18 @@ void train_use(entity this, entity actor, entity trigger);
 void train_wait(entity this)
 {
        SUB_UseTargets(this.enemy, NULL, NULL);
-       this.enemy = world;
+       this.enemy = NULL;
 
        // if turning is enabled, the train will turn toward the next point while waiting
        if(this.platmovetype_turn && !this.train_wait_turning)
        {
                entity targ, cp;
                vector ang;
-               targ = find(world, targetname, this.target);
+               targ = find(NULL, targetname, this.target);
                if((this.spawnflags & 1) && targ.curvetarget)
-                       cp = find(world, targetname, targ.curvetarget);
+                       cp = find(NULL, targetname, targ.curvetarget);
                else
-                       cp = world;
+                       cp = NULL;
 
                if(cp) // bezier curves movement
                        ang = cp.origin - (this.origin - this.view_ofs); // use the origin of the control point of the next path_corner
@@ -40,7 +41,7 @@ void train_wait(entity this)
 #endif
 
 #ifdef SVQC
-       entity tg = find(world, targetname, this.target);
+       entity tg = find(NULL, targetname, this.target);
        if(tg.spawnflags & 4)
        {
                this.use = train_use;
@@ -63,16 +64,16 @@ void train_wait(entity this)
 
 void train_next(entity this)
 {
-       entity targ, cp = world;
+       entity targ, cp = NULL;
        vector cp_org = '0 0 0';
 
-       targ = find(world, targetname, this.target);
+       targ = find(NULL, targetname, this.target);
        this.target = targ.target;
        if (this.spawnflags & 1)
        {
                if(targ.curvetarget)
                {
-                       cp = find(world, targetname, targ.curvetarget); // get its second target (the control point)
+                       cp = find(NULL, targetname, targ.curvetarget); // get its second target (the control point)
                        cp_org = cp.origin - this.view_ofs; // no control point found, assume a straight line to the destination
                }
        }
@@ -186,7 +187,7 @@ void train_use(entity this, entity actor, entity trigger)
 void func_train_find(entity this)
 {
        entity targ;
-       targ = find(world, targetname, this.target);
+       targ = find(NULL, targetname, this.target);
        this.target = targ.target;
        if (this.target == "")
                objerror(this, "func_train_find: no next target");
@@ -307,9 +308,10 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew)
 
                this.classname = "func_train";
                this.solid = SOLID_BSP;
-               this.movetype = MOVETYPE_PUSH;
+               set_movetype(this, MOVETYPE_PUSH);
                this.drawmask = MASK_NORMAL;
                this.draw = train_draw;
+               if (isnew) IL_PUSH(g_drawables, this);
                this.entremove = trigger_remove_generic;
 
                if(set_platmovetype(this, this.platmovetype))
@@ -322,13 +324,9 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew)
                //func_train_find();
 
                // but we will need these
-               //this.move_nextthink = this.move_ltime + 0.1;
-               //this.move_think = train_next;
                train_next(this);
 
-               this.move_movetype = MOVETYPE_PUSH;
-               this.move_origin = this.origin;
-               this.move_angles = this.angles;
+               set_movetype(this, MOVETYPE_PUSH);
                this.move_time = time;
        }